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/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)