Title: [265613] trunk
Revision
265613
Author
[email protected]
Date
2020-08-13 10:56:06 -0700 (Thu, 13 Aug 2020)

Log Message

[macOS] Zoomed-in search field is clipped out
https://bugs.webkit.org/show_bug.cgi?id=215428
<rdar://problem/66161781>

Reviewed by Darin Adler.

Source/WebCore:

r257150 added support for painting large form controls using NSControlSizeLarge.
However, RenderThemeMac::searchFieldSizes() still returned a height
corresponding to NSControlSizeRegular rather than NSControlSizeLarge. This
behavior causes the height of the layout rect to be smaller than the height
of the painted cell, resulting in clipping.

Returning the correct height in searchFieldSizes is not enough to solve the
issue. Currently, the height of the layout rect is set before adjusting the font
size of the corresponding RenderStyle. This is problematic as the initial font
size could correspond to NSControlSizeRegular, but when adjusted for zoom, the
font size could correspond to NSControlSizeLarge. To ensure that the font size
and height correspond to the same control size, the font size is now adjusted
prior to adjusting the height.

Test: fast/forms/search/search-zoom-computed-style-height.html

* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::searchFieldSizes const): Correct height for NSControlSizeLarge.
(WebCore::RenderThemeMac::adjustSearchFieldStyle const):

LayoutTests:

Added a test to verify the computed style height of a zoomed-in search field.

* fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.
* fast/forms/search/search-zoom-computed-style-height.html: Added.
* platform/ios/fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.
* platform/mac-mojave/fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.
* platform/win/fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (265612 => 265613)


--- trunk/LayoutTests/ChangeLog	2020-08-13 17:27:35 UTC (rev 265612)
+++ trunk/LayoutTests/ChangeLog	2020-08-13 17:56:06 UTC (rev 265613)
@@ -1,3 +1,19 @@
+2020-08-13  Aditya Keerthi  <[email protected]>
+
+        [macOS] Zoomed-in search field is clipped out
+        https://bugs.webkit.org/show_bug.cgi?id=215428
+        <rdar://problem/66161781>
+
+        Reviewed by Darin Adler.
+
+        Added a test to verify the computed style height of a zoomed-in search field.
+
+        * fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.
+        * fast/forms/search/search-zoom-computed-style-height.html: Added.
+        * platform/ios/fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.
+        * platform/mac-mojave/fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.
+        * platform/win/fast/forms/search/search-zoom-computed-style-height-expected.txt: Added.
+
 2020-08-13  Karl Rackler  <[email protected]>
 
         rdar://66995964 (REGRESSION (r265358): [ Win10 wk1 ] animations/steps-transform-rendering-updates.html is a constant failure (215454))

Added: trunk/LayoutTests/fast/forms/search/search-zoom-computed-style-height-expected.txt (0 => 265613)


--- trunk/LayoutTests/fast/forms/search/search-zoom-computed-style-height-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-zoom-computed-style-height-expected.txt	2020-08-13 17:56:06 UTC (rev 265613)
@@ -0,0 +1,10 @@
+Test for computed style height of a zoomed-in search field
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+Computed style height: 30px

Added: trunk/LayoutTests/fast/forms/search/search-zoom-computed-style-height.html (0 => 265613)


--- trunk/LayoutTests/fast/forms/search/search-zoom-computed-style-height.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/search/search-zoom-computed-style-height.html	2020-08-13 17:56:06 UTC (rev 265613)
@@ -0,0 +1,29 @@
+<!doctype html>
+<html>
+<head>
+    <script src=""
+    <style>
+    body {
+        zoom: 2;
+        background: yellow;
+    }
+    </style>
+</head>
+<body>
+    <input id="field" type="search" autofocus>
+    <div>
+        <span>Computed style height: </span>
+        <span id="output"></span>
+    </div>
+    <script>
+        description('Test for computed style height of a zoomed-in search field');
+
+        const input = document.getElementById('field');
+        const style = window.getComputedStyle(input);
+
+        const output = document.getElementById('output');
+        output.innerHTML = style.height;
+    </script>
+    <script src=""
+</body>
+</html>

Added: trunk/LayoutTests/platform/ios/fast/forms/search/search-zoom-computed-style-height-expected.txt (0 => 265613)


--- trunk/LayoutTests/platform/ios/fast/forms/search/search-zoom-computed-style-height-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios/fast/forms/search/search-zoom-computed-style-height-expected.txt	2020-08-13 17:56:06 UTC (rev 265613)
@@ -0,0 +1,10 @@
+Test for computed style height of a zoomed-in search field
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+Computed style height: 20.9921875px

Added: trunk/LayoutTests/platform/mac-mojave/fast/forms/search/search-zoom-computed-style-height-expected.txt (0 => 265613)


--- trunk/LayoutTests/platform/mac-mojave/fast/forms/search/search-zoom-computed-style-height-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-mojave/fast/forms/search/search-zoom-computed-style-height-expected.txt	2020-08-13 17:56:06 UTC (rev 265613)
@@ -0,0 +1,10 @@
+Test for computed style height of a zoomed-in search field
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+Computed style height: 22px

Added: trunk/LayoutTests/platform/win/fast/forms/search/search-zoom-computed-style-height-expected.txt (0 => 265613)


--- trunk/LayoutTests/platform/win/fast/forms/search/search-zoom-computed-style-height-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/win/fast/forms/search/search-zoom-computed-style-height-expected.txt	2020-08-13 17:56:06 UTC (rev 265613)
@@ -0,0 +1,10 @@
+Test for computed style height of a zoomed-in search field
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
+Computed style height: 19.5px

Modified: trunk/Source/WebCore/ChangeLog (265612 => 265613)


--- trunk/Source/WebCore/ChangeLog	2020-08-13 17:27:35 UTC (rev 265612)
+++ trunk/Source/WebCore/ChangeLog	2020-08-13 17:56:06 UTC (rev 265613)
@@ -1,3 +1,31 @@
+2020-08-13  Aditya Keerthi  <[email protected]>
+
+        [macOS] Zoomed-in search field is clipped out
+        https://bugs.webkit.org/show_bug.cgi?id=215428
+        <rdar://problem/66161781>
+
+        Reviewed by Darin Adler.
+
+        r257150 added support for painting large form controls using NSControlSizeLarge.
+        However, RenderThemeMac::searchFieldSizes() still returned a height
+        corresponding to NSControlSizeRegular rather than NSControlSizeLarge. This
+        behavior causes the height of the layout rect to be smaller than the height
+        of the painted cell, resulting in clipping.
+
+        Returning the correct height in searchFieldSizes is not enough to solve the
+        issue. Currently, the height of the layout rect is set before adjusting the font
+        size of the corresponding RenderStyle. This is problematic as the initial font
+        size could correspond to NSControlSizeRegular, but when adjusted for zoom, the
+        font size could correspond to NSControlSizeLarge. To ensure that the font size
+        and height correspond to the same control size, the font size is now adjusted
+        prior to adjusting the height.
+
+        Test: fast/forms/search/search-zoom-computed-style-height.html
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::searchFieldSizes const): Correct height for NSControlSizeLarge.
+        (WebCore::RenderThemeMac::adjustSearchFieldStyle const):
+
 2020-08-12  Myles C. Maxfield  <[email protected]>
 
         Font loads quickly followed by navigations may fail indefinitely

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (265612 => 265613)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2020-08-13 17:27:35 UTC (rev 265612)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2020-08-13 17:56:06 UTC (rev 265613)
@@ -1965,7 +1965,7 @@
 
 const IntSize* RenderThemeMac::searchFieldSizes() const
 {
-    static const IntSize sizes[4] = { IntSize(0, 22), IntSize(0, 19), IntSize(0, 17), IntSize(0, 22) };
+    static const IntSize sizes[4] = { IntSize(0, 22), IntSize(0, 19), IntSize(0, 17), IntSize(0, 30) };
     return sizes;
 }
 
@@ -1993,6 +1993,10 @@
     style.setBorderTopWidth(borderWidth);
     style.setBorderTopStyle(BorderStyle::Inset);
 
+    // Adjust the font size prior to adjusting height, as the adjusted size may
+    // correspond to a different control size when style.effectiveZoom() != 1.
+    setFontFromControlSize(style, controlSizeForFont(style));
+
     // Override height.
     style.setHeight(Length(Auto));
     setSearchFieldSize(style);
@@ -2004,9 +2008,6 @@
     style.setPaddingTop(Length(padding, Fixed));
     style.setPaddingBottom(Length(padding, Fixed));
 
-    NSControlSize controlSize = controlSizeForFont(style);
-    setFontFromControlSize(style, controlSize);
-
     style.setBoxShadow(nullptr);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to