Title: [219447] trunk
Revision
219447
Author
clo...@igalia.com
Date
2017-07-13 02:38:52 -0700 (Thu, 13 Jul 2017)

Log Message

REGRESSION(r219332): [GTK] 9 new failures on fast/forms spinbutton related tests
https://bugs.webkit.org/show_bug.cgi?id=174395

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Covered by existing tests.

Before r219332 the height of the spin button widget was
calculated as the maximum value between the individual button
( the [+] or [-] ) width (33 pixels) and height (16 pixels).
And r219332 caused the height of the widget to be calculated as
the height of the button (16 pixels), which was incorrect as
each button should be first expanded vertically to fit the
preferred size of the widget.

Fix this by making the calculations about the spin button widget
on a new function spinButtonSize() that takes this into account,
and use this values both for adjusting the style of the input
field and the spin button widget itself.

* rendering/RenderThemeGtk.cpp:
(WebCore::spinButtonSize):
(WebCore::RenderThemeGtk::adjustTextFieldStyle):
(WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):

LayoutTests:

* fast/forms/number/number-spinbutton-in-multi-column.html: Instead of assuming that the width will be 100, calculate a -7 offset dinamically.
* platform/gtk/TestExpectations: Remove expected failures now orking.
* platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.png: Rebaseline.
* platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.txt: Rebaseline.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (219446 => 219447)


--- trunk/LayoutTests/ChangeLog	2017-07-13 09:21:52 UTC (rev 219446)
+++ trunk/LayoutTests/ChangeLog	2017-07-13 09:38:52 UTC (rev 219447)
@@ -1,3 +1,15 @@
+2017-07-12  Carlos Alberto Lopez Perez  <clo...@igalia.com>
+
+        REGRESSION(r219332): [GTK] 9 new failures on fast/forms spinbutton related tests
+        https://bugs.webkit.org/show_bug.cgi?id=174395
+
+        Reviewed by Carlos Garcia Campos.
+
+        * fast/forms/number/number-spinbutton-in-multi-column.html: Instead of assuming that the width will be 100, calculate a -7 offset dinamically.
+        * platform/gtk/TestExpectations: Remove expected failures now orking.
+        * platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.png: Rebaseline.
+        * platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.txt: Rebaseline.
+
 2017-07-13  Caio Lima  <ticaiol...@gmail.com>
 
         [ESnext] Implement Object Spread

Modified: trunk/LayoutTests/fast/forms/number/number-spinbutton-in-multi-column.html (219446 => 219447)


--- trunk/LayoutTests/fast/forms/number/number-spinbutton-in-multi-column.html	2017-07-13 09:21:52 UTC (rev 219446)
+++ trunk/LayoutTests/fast/forms/number/number-spinbutton-in-multi-column.html	2017-07-13 09:38:52 UTC (rev 219447)
@@ -58,7 +58,7 @@
     const spinId = "c" + formIndex + colIndex;
     const spin = document.getElementById(spinId);
 
-    const clickX = pageX(column) + colWidth * colIndex + ofsX;
+    const clickX = pageX(column) + colWidth * colIndex + spin.offsetWidth + ofsX;
     const clickY = pageY(column) + Math.floor(spin.offsetHeight / 3) + 2;
 
     eventSender.mouseMoveTo(clickX, clickY);
@@ -92,7 +92,7 @@
 
     for (var formIndex = 0; formIndex < numForms; formIndex++) {
         for (var colIndex = 0; colIndex < numCols; colIndex++) {
-          testIt(formIndex, colIndex, 93, 10);
+          testIt(formIndex, colIndex, -7, 10);
         }
     }
 }

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (219446 => 219447)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2017-07-13 09:21:52 UTC (rev 219446)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2017-07-13 09:38:52 UTC (rev 219447)
@@ -1256,17 +1256,6 @@
 # GTK port doesn't use the scrolling tree
 fast/scrolling/scrolling-tree-includes-frame.html [ Skip ]
 
-# Regressions on fast/forms spinbutton related tests after r219332
-webkit.org/b/174395 fast/events/touch/touch-before-pressing-spin-button.html [ Failure ]
-webkit.org/b/174395 fast/forms/input-number-click.html [ Failure ]
-webkit.org/b/174395 fast/forms/input-step-as-double.html [ Failure ]
-webkit.org/b/174395 fast/forms/number/number-large-padding.html [ Failure ]
-webkit.org/b/174395 fast/forms/number/number-spinbutton-capturing.html [ Failure ]
-webkit.org/b/174395 fast/forms/number/number-spinbutton-change-and-input-events.html [ Failure ]
-webkit.org/b/174395 fast/forms/number/number-spinbutton-gets-disabled-or-readonly.html [ Failure ]
-webkit.org/b/174395 fast/forms/number/number-spinbutton-in-multi-column.html [ Failure ]
-webkit.org/b/174395 fast/forms/number/number-spinbutton-state.html [ Failure ]
-
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of Expected failures
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/LayoutTests/platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.txt (219446 => 219447)


--- trunk/LayoutTests/platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.txt	2017-07-13 09:21:52 UTC (rev 219446)
+++ trunk/LayoutTests/platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.txt	2017-07-13 09:38:52 UTC (rev 219447)
@@ -12,23 +12,23 @@
         RenderBR {BR} at (0,0) size 0x17
         RenderBR {BR} at (0,17) size 0x17
         RenderTextControl {INPUT} at (0,34) size 82x34 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 76x28
-            RenderBlock {DIV} at (0,5) size 10x18
+          RenderFlexibleBox {DIV} at (3,0) size 76x34
+            RenderBlock {DIV} at (0,8) size 10x18
         RenderText {#text} at (82,42) size 4x17
           text run at (82,42) width 4: " "
         RenderTextControl {INPUT} at (86,34) size 82x34 [bgcolor=#FFFFFF]
-          RenderFlexibleBox {DIV} at (1,1) size 80x32
-            RenderBlock {DIV} at (0,7) size 14x18
+          RenderFlexibleBox {DIV} at (1,0) size 80x34
+            RenderBlock {DIV} at (0,8) size 14x18
         RenderText {#text} at (168,42) size 4x17
           text run at (168,42) width 4: " "
         RenderTextControl {INPUT} at (172,34) size 82x34 [bgcolor=#FF0000] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 76x28
-            RenderBlock {DIV} at (0,5) size 10x18
+          RenderFlexibleBox {DIV} at (3,0) size 76x34
+            RenderBlock {DIV} at (0,8) size 10x18
         RenderText {#text} at (254,42) size 4x17
           text run at (254,42) width 4: " "
         RenderTextControl {INPUT} at (258,34) size 82x34 [bgcolor=#FFFFFF] [border: (2px dashed #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 76x28
-            RenderBlock {DIV} at (0,5) size 10x18
+          RenderFlexibleBox {DIV} at (3,0) size 76x34
+            RenderBlock {DIV} at (0,8) size 10x18
         RenderText {#text} at (340,42) size 4x17
           text run at (340,42) width 4: " "
         RenderBR {BR} at (344,56) size 0x0
@@ -56,45 +56,45 @@
         RenderBR {BR} at (680,179) size 0x0
         RenderBR {BR} at (0,187) size 0x17
         RenderTextControl {INPUT} at (0,204) size 114x34 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 108x28
-            RenderBlock {DIV} at (0,5) size 42x18
+          RenderFlexibleBox {DIV} at (3,0) size 108x34
+            RenderBlock {DIV} at (0,8) size 42x18
         RenderText {#text} at (114,212) size 4x17
           text run at (114,212) width 4: " "
         RenderTextControl {INPUT} at (118,204) size 114x34 [bgcolor=#FFFFFF]
-          RenderFlexibleBox {DIV} at (1,1) size 112x32
-            RenderBlock {DIV} at (0,7) size 46x18
+          RenderFlexibleBox {DIV} at (1,0) size 112x34
+            RenderBlock {DIV} at (0,8) size 46x18
         RenderText {#text} at (232,212) size 4x17
           text run at (232,212) width 4: " "
         RenderTextControl {INPUT} at (236,204) size 114x34 [bgcolor=#FF0000] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 108x28
-            RenderBlock {DIV} at (0,5) size 42x18
+          RenderFlexibleBox {DIV} at (3,0) size 108x34
+            RenderBlock {DIV} at (0,8) size 42x18
         RenderText {#text} at (350,212) size 4x17
           text run at (350,212) width 4: " "
         RenderTextControl {INPUT} at (354,204) size 114x34 [bgcolor=#FFFFFF] [border: (2px dashed #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 108x28
-            RenderBlock {DIV} at (0,5) size 42x18
+          RenderFlexibleBox {DIV} at (3,0) size 108x34
+            RenderBlock {DIV} at (0,8) size 42x18
         RenderText {#text} at (468,212) size 4x17
           text run at (468,212) width 4: " "
         RenderBR {BR} at (472,226) size 0x0
         RenderBR {BR} at (0,238) size 0x17
         RenderTextControl {INPUT} at (2,257) size 113x34 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 107x28
-            RenderBlock {DIV} at (0,5) size 41x18
+          RenderFlexibleBox {DIV} at (3,0) size 107x34
+            RenderBlock {DIV} at (0,8) size 41x18
         RenderText {#text} at (117,265) size 4x17
           text run at (117,265) width 4: " "
         RenderTextControl {INPUT} at (121,257) size 131x34 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (3,3) size 125x28
-            RenderBlock {DIV} at (0,5) size 59x18
+          RenderFlexibleBox {DIV} at (3,0) size 125x34
+            RenderBlock {DIV} at (0,8) size 59x18
         RenderText {#text} at (252,265) size 4x17
           text run at (252,265) width 4: " "
         RenderTextControl {INPUT} at (256,257) size 131x34 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (14,8) size 103x18
-            RenderBlock {DIV} at (0,0) size 37x18
+          RenderFlexibleBox {DIV} at (14,0) size 103x34
+            RenderBlock {DIV} at (0,8) size 37x18
         RenderText {#text} at (387,265) size 4x17
           text run at (387,265) width 4: " "
         RenderTextControl {INPUT} at (391,257) size 131x34 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
-          RenderFlexibleBox {DIV} at (14,8) size 103x18
-            RenderBlock {DIV} at (0,0) size 37x18
+          RenderFlexibleBox {DIV} at (14,0) size 103x34
+            RenderBlock {DIV} at (0,8) size 37x18
         RenderText {#text} at (522,265) size 4x17
           text run at (522,265) width 4: " "
         RenderBR {BR} at (526,279) size 0x0
@@ -163,35 +163,35 @@
   RenderBlock {DIV} at (0,0) size 37x17
     RenderText {#text} at (0,0) size 27x17
       text run at (0,0) width 27: "108"
-layer at (21,118) size 66x16
-  RenderBlock (relative positioned) {DIV} at (10,6) size 66x16
-layer at (109,118) size 66x16
-  RenderBlock (relative positioned) {DIV} at (14,8) size 66x16
-layer at (193,118) size 66x16
-  RenderBlock (relative positioned) {DIV} at (10,6) size 66x16
-layer at (279,118) size 66x16
-  RenderBlock (relative positioned) {DIV} at (10,6) size 66x16
-layer at (105,202) size 66x16
-  RenderBlock (relative positioned) {DIV} at (94,42) size 66x16
-layer at (277,204) size 66x16
-  RenderBlock (relative positioned) {DIV} at (98,42) size 66x16
-layer at (445,202) size 66x16
-  RenderBlock (relative positioned) {DIV} at (94,42) size 66x16
-layer at (615,202) size 66x16
-  RenderBlock (relative positioned) {DIV} at (94,42) size 66x16
-layer at (53,288) size 66x16
-  RenderBlock (relative positioned) {DIV} at (42,6) size 66x16
-layer at (173,288) size 66x16
-  RenderBlock (relative positioned) {DIV} at (46,8) size 66x16
-layer at (289,288) size 66x16
-  RenderBlock (relative positioned) {DIV} at (42,6) size 66x16
-layer at (407,288) size 66x16
-  RenderBlock (relative positioned) {DIV} at (42,6) size 66x16
-layer at (54,341) size 66x16
-  RenderBlock (relative positioned) {DIV} at (41,6) size 66x16
-layer at (191,341) size 66x16
-  RenderBlock (relative positioned) {DIV} at (59,6) size 66x16
-layer at (315,341) size 66x16
-  RenderBlock (relative positioned) {DIV} at (37,1) size 66x16
-layer at (450,341) size 66x16
-  RenderBlock (relative positioned) {DIV} at (37,1) size 66x16
+layer at (21,109) size 66x34
+  RenderBlock (relative positioned) {DIV} at (10,0) size 66x34
+layer at (109,109) size 66x34
+  RenderBlock (relative positioned) {DIV} at (14,0) size 66x34
+layer at (193,109) size 66x34
+  RenderBlock (relative positioned) {DIV} at (10,0) size 66x34
+layer at (279,109) size 66x34
+  RenderBlock (relative positioned) {DIV} at (10,0) size 66x34
+layer at (105,193) size 66x34
+  RenderBlock (relative positioned) {DIV} at (94,33) size 66x34
+layer at (277,195) size 66x34
+  RenderBlock (relative positioned) {DIV} at (98,33) size 66x34
+layer at (445,193) size 66x34
+  RenderBlock (relative positioned) {DIV} at (94,33) size 66x34
+layer at (615,193) size 66x34
+  RenderBlock (relative positioned) {DIV} at (94,33) size 66x34
+layer at (53,279) size 66x34
+  RenderBlock (relative positioned) {DIV} at (42,0) size 66x34
+layer at (173,279) size 66x34
+  RenderBlock (relative positioned) {DIV} at (46,0) size 66x34
+layer at (289,279) size 66x34
+  RenderBlock (relative positioned) {DIV} at (42,0) size 66x34
+layer at (407,279) size 66x34
+  RenderBlock (relative positioned) {DIV} at (42,0) size 66x34
+layer at (54,332) size 66x34
+  RenderBlock (relative positioned) {DIV} at (41,0) size 66x34
+layer at (191,332) size 66x34
+  RenderBlock (relative positioned) {DIV} at (59,0) size 66x34
+layer at (315,332) size 66x34
+  RenderBlock (relative positioned) {DIV} at (37,0) size 66x34
+layer at (450,332) size 66x34
+  RenderBlock (relative positioned) {DIV} at (37,0) size 66x34

Modified: trunk/Source/WebCore/ChangeLog (219446 => 219447)


--- trunk/Source/WebCore/ChangeLog	2017-07-13 09:21:52 UTC (rev 219446)
+++ trunk/Source/WebCore/ChangeLog	2017-07-13 09:38:52 UTC (rev 219447)
@@ -1,3 +1,30 @@
+2017-07-12  Carlos Alberto Lopez Perez  <clo...@igalia.com>
+
+        REGRESSION(r219332): [GTK] 9 new failures on fast/forms spinbutton related tests
+        https://bugs.webkit.org/show_bug.cgi?id=174395
+
+        Reviewed by Carlos Garcia Campos.
+
+        Covered by existing tests.
+
+        Before r219332 the height of the spin button widget was
+        calculated as the maximum value between the individual button
+        ( the [+] or [-] ) width (33 pixels) and height (16 pixels).
+        And r219332 caused the height of the widget to be calculated as
+        the height of the button (16 pixels), which was incorrect as
+        each button should be first expanded vertically to fit the
+        preferred size of the widget.
+
+        Fix this by making the calculations about the spin button widget
+        on a new function spinButtonSize() that takes this into account,
+        and use this values both for adjusting the style of the input
+        field and the spin button widget itself.
+
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::spinButtonSize):
+        (WebCore::RenderThemeGtk::adjustTextFieldStyle):
+        (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle):
+
 2017-07-13  Miguel Gomez  <mago...@igalia.com>
 
         [GTK][WPE] border-radius with non visible border doesn't work on images that have their own RenderLayer

Modified: trunk/Source/WebCore/rendering/RenderThemeGtk.cpp (219446 => 219447)


--- trunk/Source/WebCore/rendering/RenderThemeGtk.cpp	2017-07-13 09:21:52 UTC (rev 219446)
+++ trunk/Source/WebCore/rendering/RenderThemeGtk.cpp	2017-07-13 09:38:52 UTC (rev 219447)
@@ -931,12 +931,9 @@
 }
 
 #if GTK_CHECK_VERSION(3, 20, 0)
-void RenderThemeGtk::adjustTextFieldStyle(StyleResolver&, RenderStyle& style, const Element* element) const
+
+static IntSize spinButtonSize()
 {
-    if (!is<HTMLInputElement>(element) || !shouldHaveSpinButton(downcast<HTMLInputElement>(*element)))
-        return;
-
-    // Input field need minimum dimensions to render the spinbuttons correctly (without covering the values).
     auto& spinButtonWidget = static_cast<RenderThemeSpinButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SpinButton));
     spinButtonWidget.spinButton().setState(GTK_STATE_FLAG_NORMAL);
     spinButtonWidget.entry().setState(GTK_STATE_FLAG_NORMAL);
@@ -948,16 +945,23 @@
     IntSize upPreferredSize = preferredSize.expandedTo(spinButtonWidget.up().preferredSize());
     IntSize downPreferredSize = preferredSize.expandedTo(spinButtonWidget.down().preferredSize());
 
-    // Ensure that the minimum height space is enough for the taller of the spin buttons.
-    int minimumHeight = std::max(upPreferredSize.height(), downPreferredSize.height());
-    style.setMinHeight(Length(minimumHeight, Fixed));
+    return IntSize(upPreferredSize.width() + downPreferredSize.width(), std::max(upPreferredSize.height(), downPreferredSize.height()));
+}
 
+
+void RenderThemeGtk::adjustTextFieldStyle(StyleResolver&, RenderStyle& style, const Element* element) const
+{
+    if (!is<HTMLInputElement>(element) || !shouldHaveSpinButton(downcast<HTMLInputElement>(*element)))
+        return;
+
+    style.setMinHeight(Length(spinButtonSize().height(), Fixed));
+
     // The default theme for the GTK+ port uses very wide spin buttons (66px) compared to what other
     // browsers use (~13 px). And unfortunately, most of the web developers won't test how their site
     // renders on WebKitGTK+. To ensure that spin buttons don't end up covering the values of the input
     // field, we override the width of the input element and always increment it with the width needed
     // for the spinbutton (when drawing the spinbutton).
-    int minimumWidth = style.width().intValue() + upPreferredSize.width() + downPreferredSize.width();
+    int minimumWidth = style.width().intValue() + spinButtonSize().width();
     style.setMinWidth(Length(minimumWidth, Fixed));
 }
 
@@ -1522,18 +1526,8 @@
 
 void RenderThemeGtk::adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle& style, const Element*) const
 {
-    auto& spinButtonWidget = static_cast<RenderThemeSpinButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SpinButton));
-    spinButtonWidget.spinButton().setState(GTK_STATE_FLAG_NORMAL);
-    spinButtonWidget.entry().setState(GTK_STATE_FLAG_NORMAL);
-    spinButtonWidget.up().setState(GTK_STATE_FLAG_NORMAL);
-    spinButtonWidget.down().setState(GTK_STATE_FLAG_NORMAL);
-
-    IntSize upPreferredSize = spinButtonWidget.up().preferredSize();
-    IntSize downPreferredSize = spinButtonWidget.down().preferredSize();
-    int minimumHeight = std::max(upPreferredSize.height(), downPreferredSize.height());
-    int minimumWidth = upPreferredSize.width() + downPreferredSize.width();
-    style.setWidth(Length(minimumWidth, Fixed));
-    style.setHeight(Length(minimumHeight, Fixed));
+    style.setWidth(Length(spinButtonSize().width(), Fixed));
+    style.setHeight(Length(spinButtonSize().height(), Fixed));
 }
 
 bool RenderThemeGtk::paintInnerSpinButton(const RenderObject& renderObject, const PaintInfo& paintInfo, const IntRect& rect)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to