- Revision
- 274411
- Author
- [email protected]
- Date
- 2021-03-15 04:27:16 -0700 (Mon, 15 Mar 2021)
Log Message
Do not shrink radio buttons bellow its size
https://bugs.webkit.org/show_bug.cgi?id=215575
Reviewed by Darin Adler.
LayoutTests/imported/w3c:
* web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt: Replaced FAIL by PASS expectations.
Source/WebCore:
A radio button used as a flex item would be invisible by default because it'll compute is
min-size to 0. That's why we should not let them shrink below their size (width/height).
* platform/Theme.cpp:
(WebCore::Theme::minimumControlSize const): Do not let Radio buttons shrink bellow their size.
* platform/Theme.h: make minimumControlSize() protected. Add a new non-virtual method with the same parameter
plus another one (the minimum size under which we cannot shrink) which calls the virtual method.
* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle): Pass the {style.width(),style.height()} as the minimum size under which
we should not shrink the control.
Modified Paths
Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (274410 => 274411)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-03-15 11:15:39 UTC (rev 274410)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-03-15 11:27:16 UTC (rev 274411)
@@ -1,3 +1,12 @@
+2021-03-10 Sergio Villar Senin <[email protected]>
+
+ Do not shrink radio buttons bellow its size
+ https://bugs.webkit.org/show_bug.cgi?id=215575
+
+ Reviewed by Darin Adler.
+
+ * web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt: Replaced FAIL by PASS expectations.
+
2021-03-14 Sam Weinig <[email protected]>
Match other browsers by interpolating colors in floating point space rather than uint8_t space
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt (274410 => 274411)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt 2021-03-15 11:15:39 UTC (rev 274410)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/radiobutton-min-size-expected.txt 2021-03-15 11:27:16 UTC (rev 274411)
@@ -4,5 +4,5 @@
Text
Text
-FAIL two radio button widths are identical assert_equals: width should be equal expected 0 but got 12
+PASS two radio button widths are identical
Modified: trunk/Source/WebCore/ChangeLog (274410 => 274411)
--- trunk/Source/WebCore/ChangeLog 2021-03-15 11:15:39 UTC (rev 274410)
+++ trunk/Source/WebCore/ChangeLog 2021-03-15 11:27:16 UTC (rev 274411)
@@ -1,3 +1,21 @@
+2021-03-10 Sergio Villar Senin <[email protected]>
+
+ Do not shrink radio buttons bellow its size
+ https://bugs.webkit.org/show_bug.cgi?id=215575
+
+ Reviewed by Darin Adler.
+
+ A radio button used as a flex item would be invisible by default because it'll compute is
+ min-size to 0. That's why we should not let them shrink below their size (width/height).
+
+ * platform/Theme.cpp:
+ (WebCore::Theme::minimumControlSize const): Do not let Radio buttons shrink bellow their size.
+ * platform/Theme.h: make minimumControlSize() protected. Add a new non-virtual method with the same parameter
+ plus another one (the minimum size under which we cannot shrink) which calls the virtual method.
+ * rendering/RenderTheme.cpp:
+ (WebCore::RenderTheme::adjustStyle): Pass the {style.width(),style.height()} as the minimum size under which
+ we should not shrink the control.
+
2021-03-15 Kimmo Kinnunen <[email protected]>
REGRESSION(r270185) [GTK] Some webgl failures after multivalue setter refactor
Modified: trunk/Source/WebCore/platform/Theme.cpp (274410 => 274411)
--- trunk/Source/WebCore/platform/Theme.cpp 2021-03-15 11:15:39 UTC (rev 274410)
+++ trunk/Source/WebCore/platform/Theme.cpp 2021-03-15 11:27:16 UTC (rev 274411)
@@ -48,6 +48,18 @@
return zoomedSize;
}
+LengthSize Theme::minimumControlSize(ControlPart part, const FontCascade& fontCascade, const LengthSize& zoomedSize, const LengthSize& nonShrinkableZoomedSize, float zoom) const
+{
+ auto minSize = minimumControlSize(part, fontCascade, zoomedSize, zoom);
+ if (part == ControlPart::RadioPart) {
+ if (zoomedSize.width.isIntrinsicOrAuto())
+ minSize.width = nonShrinkableZoomedSize.width;
+ if (zoomedSize.height.isIntrinsicOrAuto())
+ minSize.height = nonShrinkableZoomedSize.height;
+ }
+ return minSize;
+}
+
LengthSize Theme::minimumControlSize(ControlPart, const FontCascade&, const LengthSize&, float) const
{
return { { 0, LengthType::Fixed }, { 0, LengthType::Fixed } };
Modified: trunk/Source/WebCore/platform/Theme.h (274410 => 274411)
--- trunk/Source/WebCore/platform/Theme.h 2021-03-15 11:15:39 UTC (rev 274410)
+++ trunk/Source/WebCore/platform/Theme.h 2021-03-15 11:27:16 UTC (rev 274411)
@@ -57,7 +57,7 @@
virtual LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float zoomFactor) const;
// Returns the minimum size for a control in zoomed coordinates.
- virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float zoomFactor) const;
+ LengthSize minimumControlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, const LengthSize& nonShrinkableZoomedSize, float zoomFactor) const;
// Allows the theme to modify the existing padding/border.
virtual LengthBox controlPadding(ControlPart, const FontCascade&, const LengthBox& zoomedBox, float zoomFactor) const;
@@ -84,6 +84,8 @@
Theme() = default;
virtual ~Theme() = default;
+ virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float zoomFactor) const;
+
private:
Theme(const Theme&) = delete;
void operator=(const Theme&) = delete;
Modified: trunk/Source/WebCore/rendering/RenderTheme.cpp (274410 => 274411)
--- trunk/Source/WebCore/rendering/RenderTheme.cpp 2021-03-15 11:15:39 UTC (rev 274410)
+++ trunk/Source/WebCore/rendering/RenderTheme.cpp 2021-03-15 11:27:16 UTC (rev 274411)
@@ -168,7 +168,7 @@
style.setHeight(WTFMove(controlSize.height));
// Min-Width / Min-Height
- LengthSize minControlSize = Theme::singleton().minimumControlSize(part, style.fontCascade(), { style.minWidth(), style.minHeight() }, style.effectiveZoom());
+ LengthSize minControlSize = Theme::singleton().minimumControlSize(part, style.fontCascade(), { style.minWidth(), style.minHeight() }, { style.width(), style.height() }, style.effectiveZoom());
if (minControlSize.width != style.minWidth())
style.setMinWidth(WTFMove(minControlSize.width));
if (minControlSize.height != style.minHeight())