Title: [188611] trunk
Revision
188611
Author
wenson_hs...@apple.com
Date
2015-08-18 17:23:49 -0700 (Tue, 18 Aug 2015)

Log Message

Search input results and clear icons are misaligned when padding is added
https://bugs.webkit.org/show_bug.cgi?id=148146
<rdar://problem/22310951>

Reviewed by Zalan Bujtas.

Source/WebCore:

Use content box rect to determine where to draw the results and cancel buttons
of a search field that has -webkit-appearance: textfield. Previously, we used
the bounding box, which caused the buttons to render in the input's padding
region.

Test: platform/mac/fast/forms/search/search-padding-cancel-results-buttons.html

* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintSearchFieldCancelButton): Use content box to
    compute where to render cancel button.
(WebCore::RenderThemeMac::paintSearchFieldResultsButton): Use content box to
    compute where to render results button.

LayoutTests:

Tests that for a search field with -webkit-appearance: textfield; and padding will not clip
its cancel and results buttons.

* platform/mac/fast/forms/search/search-padding-cancel-results-buttons-expected.txt: Added.
* platform/mac/fast/forms/search/search-padding-cancel-results-buttons.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (188610 => 188611)


--- trunk/LayoutTests/ChangeLog	2015-08-19 00:21:48 UTC (rev 188610)
+++ trunk/LayoutTests/ChangeLog	2015-08-19 00:23:49 UTC (rev 188611)
@@ -1,3 +1,17 @@
+2015-08-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Search input results and clear icons are misaligned when padding is added
+        https://bugs.webkit.org/show_bug.cgi?id=148146
+        <rdar://problem/22310951>
+
+        Reviewed by Zalan Bujtas.
+
+        Tests that for a search field with -webkit-appearance: textfield; and padding will not clip
+        its cancel and results buttons.
+
+        * platform/mac/fast/forms/search/search-padding-cancel-results-buttons-expected.txt: Added.
+        * platform/mac/fast/forms/search/search-padding-cancel-results-buttons.html: Added.
+
 2015-08-18  Simon Fraser  <simon.fra...@apple.com>
 
         will-change: backface-visibility should not cause stacking context

Added: trunk/LayoutTests/platform/mac/fast/forms/search/search-padding-cancel-results-buttons-expected.txt (0 => 188611)


--- trunk/LayoutTests/platform/mac/fast/forms/search/search-padding-cancel-results-buttons-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/forms/search/search-padding-cancel-results-buttons-expected.txt	2015-08-19 00:23:49 UTC (rev 188611)
@@ -0,0 +1,15 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584
+      RenderTextControl {INPUT} at (2,2) size 199x37 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+        RenderFlexibleBox {DIV} at (12,12) size 175x13
+          RenderBlock {DIV} at (0,1) size 22x11
+          RenderBlock {DIV} at (22,0) size 140x13
+          RenderBlock {DIV} at (161,1) size 14x11
+      RenderText {#text} at (0,0) size 0x0
+layer at (44,22) size 139x13
+  RenderBlock {DIV} at (0,0) size 140x13
+    RenderText {#text} at (0,0) size 20x13
+      text run at (0,0) width 20: "test"

Added: trunk/LayoutTests/platform/mac/fast/forms/search/search-padding-cancel-results-buttons.html (0 => 188611)


--- trunk/LayoutTests/platform/mac/fast/forms/search/search-padding-cancel-results-buttons.html	                        (rev 0)
+++ trunk/LayoutTests/platform/mac/fast/forms/search/search-padding-cancel-results-buttons.html	2015-08-19 00:23:49 UTC (rev 188611)
@@ -0,0 +1,14 @@
+<html>
+<head>
+    <style>
+    input {
+        -webkit-appearance: textfield;
+        padding: 10px;
+    }
+    </style>
+</head>
+
+<body>
+    <input type="search" value="test" results="5" />
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (188610 => 188611)


--- trunk/Source/WebCore/ChangeLog	2015-08-19 00:21:48 UTC (rev 188610)
+++ trunk/Source/WebCore/ChangeLog	2015-08-19 00:23:49 UTC (rev 188611)
@@ -1,3 +1,24 @@
+2015-08-18  Wenson Hsieh  <wenson_hs...@apple.com>
+
+        Search input results and clear icons are misaligned when padding is added
+        https://bugs.webkit.org/show_bug.cgi?id=148146
+        <rdar://problem/22310951>
+
+        Reviewed by Zalan Bujtas.
+
+        Use content box rect to determine where to draw the results and cancel buttons
+        of a search field that has -webkit-appearance: textfield. Previously, we used
+        the bounding box, which caused the buttons to render in the input's padding
+        region.
+
+        Test: platform/mac/fast/forms/search/search-padding-cancel-results-buttons.html
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintSearchFieldCancelButton): Use content box to
+            compute where to render cancel button.
+        (WebCore::RenderThemeMac::paintSearchFieldResultsButton): Use content box to
+            compute where to render results button.
+
 2015-08-18  Dean Jackson  <d...@apple.com>
 
         CAOpenGLLayer doesn't need an SPI declaration

Modified: trunk/Source/WebCore/rendering/RenderThemeMac.mm (188610 => 188611)


--- trunk/Source/WebCore/rendering/RenderThemeMac.mm	2015-08-19 00:21:48 UTC (rev 188610)
+++ trunk/Source/WebCore/rendering/RenderThemeMac.mm	2015-08-19 00:23:49 UTC (rev 188611)
@@ -1699,7 +1699,7 @@
 
     float zoomLevel = o.style().effectiveZoom();
 
-    FloatRect localBounds = [search cancelButtonRectForBounds:NSRect(snappedIntRect(input->renderBox()->borderBoxRect()))];
+    FloatRect localBounds = [search cancelButtonRectForBounds:NSRect(snappedIntRect(input->renderBox()->contentBoxRect()))];
     localBounds = convertToPaintingRect(*input->renderer(), o, localBounds, r);
 
     FloatRect unzoomedRect(localBounds);
@@ -1810,7 +1810,7 @@
     GraphicsContextStateSaver stateSaver(*paintInfo.context);
     float zoomLevel = o.style().effectiveZoom();
 
-    FloatRect localBounds = [search searchButtonRectForBounds:NSRect(snappedIntRect(input->renderBox()->borderBoxRect()))];
+    FloatRect localBounds = [search searchButtonRectForBounds:NSRect(snappedIntRect(input->renderBox()->contentBoxRect()))];
     localBounds = convertToPaintingRect(*input->renderer(), o, localBounds, r);
 
     IntRect unzoomedRect(localBounds);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to