Changeset 219332 in webkit
- Timestamp:
- Jul 11, 2017, 8:34:41 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/LayoutTests/ChangeLog ¶
r219331 r219332 1 2017-07-11 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 3 [GTK] Spin buttons on input type number appear over the value itself for small widths 4 https://bugs.webkit.org/show_bug.cgi?id=173572 5 6 Reviewed by Carlos Garcia Campos. 7 8 * fast/forms/number/number-size-expected.txt: 9 * fast/forms/number/number-size.html: Obtain the size of the spinbutton by inspecting the shadow dom (is more reliable) 10 and make the test for user controlled style special for the case of GTK+. 11 * platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.png: Added. 12 * platform/gtk/fast/forms/number/number-size-spinbutton-nocover-expected.txt: Added. 13 * platform/gtk/fast/forms/number/number-size-spinbutton-nocover.html: Added. 14 1 15 2017-07-11 Youenn Fablet <youenn@apple.com> 2 16 -
TabularUnified trunk/LayoutTests/fast/forms/number/number-size-expected.txt ¶
r203333 r219332 9 9 10 10 The number whose width is specified should respect the setting 11 PASS numberWithWidth.offsetWidth is 10012 PASS numberWithWidth.min = 0; numberWithWidth.max = 100; numberWithWidth.offsetWidth is 10011 PASS numberWithWidth.offsetWidth is widthSpecified(100) 12 PASS numberWithWidth.min = 0; numberWithWidth.max = 100; numberWithWidth.offsetWidth is widthSpecified(100) 13 13 14 14 The number input should ignore size attribute for layout -
TabularUnified trunk/LayoutTests/fast/forms/number/number-size.html ¶
r203333 r219332 3 3 <head> 4 4 <script src="../../../resources/js-test-pre.js"></script> 5 <script src="../../../resources/platform-helper.js"></script> 6 <script src="../resources/common.js"></script> 5 7 <style> 6 8 … … 15 17 } 16 18 17 input#number-without-spinbutton::-webkit-inner-spin-button {18 display: none;19 margin: 0;20 }21 19 input#number-with-width { 22 20 width: 100px; … … 30 28 31 29 <script> 30 31 function widthSpecified(size) { 32 // GTK+ port overrides the style width and always increments it with the spinbuttons size. 33 if (isGtk()) 34 size += spinButtonWidth; 35 return size; 36 } 37 32 38 description('Test for size attribute of input'); 33 39 34 40 var parent = document.createElement('div'); 35 41 document.body.appendChild(parent); 36 parent.innerHTML = '<input type=text id=text>' 37 + '<input type="number" id=number>' 38 + '<input type="number" id="number-without-spinbutton" min="0" max="10" step="1">' 39 + '<input type="number" id="number-with-spinbutton" min="0" max="10" step="1">' 42 parent.innerHTML = '<input type=text id="text">' 43 + '<input type="number" id="number">' 40 44 + '<input type="number" id="number-with-width">' 41 45 var number = document.getElementById('number'); 42 var numberWithoutSpinButton = document.getElementById('number-without-spinbutton');43 var numberWithSpinButton = document.getElementById('number-with-spinbutton');44 46 var numberWithWidth = document.getElementById('number-with-width'); 45 47 var text = document.getElementById('text'); 46 48 47 49 // The width of spin button should differ by environment. So it should be calculated here. 48 var spinButtonWidth = numberWithSpinButton.offsetWidth - numberWithoutSpinButton.offsetWidth;50 var spinButtonWidth = getElementByPseudoId(internals.shadowRoot(number), "-webkit-inner-spin-button").offsetWidth; 49 51 // spinButtonWidth should have menaningful width. 50 52 shouldBeGreaterThanOrEqual('spinButtonWidth', '1'); … … 55 57 56 58 debug('The number whose width is specified should respect the setting'); 57 shouldBe('numberWithWidth.offsetWidth', ' 100');58 shouldBe('numberWithWidth.min = 0; numberWithWidth.max = 100; numberWithWidth.offsetWidth', ' 100');59 shouldBe('numberWithWidth.offsetWidth', 'widthSpecified(100)'); 60 shouldBe('numberWithWidth.min = 0; numberWithWidth.max = 100; numberWithWidth.offsetWidth', 'widthSpecified(100)'); 59 61 debug(''); 60 62 -
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r219331 r219332 1 2017-07-11 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 3 [GTK] Spin buttons on input type number appear over the value itself for small widths 4 https://bugs.webkit.org/show_bug.cgi?id=173572 5 6 Reviewed by Carlos Garcia Campos. 7 8 When drawing the spin buttons, override the width of the input 9 element to increment it with the width of the spin button. 10 This ensures that we don't end up covering the input values with 11 the spin buttons. 12 13 Do this also for user controlled styles, because most web authors 14 won't test how their site renders on WebKitGTK+, and they will 15 assume spin buttons in the order of 13 pixels wide (that is what 16 most browsers use), but the GTK+ spin button is much wider (66 pixels). 17 18 Test: platform/gtk/fast/forms/number/number-size-spinbutton-nocover.html 19 20 * rendering/RenderTheme.cpp: 21 (WebCore::RenderTheme::adjustStyle): 22 * rendering/RenderThemeGtk.cpp: 23 (WebCore::RenderThemeGtk::adjustTextFieldStyle): Call the theme's adjustTextFieldStyle() also for user controlled styles. 24 (WebCore::RenderThemeGtk::adjustInnerSpinButtonStyle): 25 1 26 2017-07-11 Youenn Fablet <youenn@apple.com> 2 27 -
TabularUnified trunk/Source/WebCore/rendering/RenderTheme.cpp ¶
r217937 r219332 92 92 93 93 if (UAHasAppearance && isControlStyled(style, border, background, backgroundColor)) { 94 if (part == MenulistPart) { 94 switch (part) { 95 case MenulistPart: 95 96 style.setAppearance(MenulistButtonPart); 96 97 part = MenulistButtonPart; 97 } else 98 break; 99 case TextFieldPart: 100 adjustTextFieldStyle(styleResolver, style, element); 101 FALLTHROUGH; 102 default: 98 103 style.setAppearance(NoControlPart); 104 break; 105 } 99 106 } 100 107 -
TabularUnified trunk/Source/WebCore/rendering/RenderThemeGtk.cpp ¶
r217702 r219332 937 937 return; 938 938 939 // Spinbuttons need a minimum height to be rendered correctly.939 // Input field need minimum dimensions to render the spinbuttons correctly (without covering the values). 940 940 auto& spinButtonWidget = static_cast<RenderThemeSpinButton&>(RenderThemeWidget::getOrCreate(RenderThemeWidget::Type::SpinButton)); 941 941 spinButtonWidget.spinButton().setState(GTK_STATE_FLAG_NORMAL); … … 948 948 IntSize upPreferredSize = preferredSize.expandedTo(spinButtonWidget.up().preferredSize()); 949 949 IntSize downPreferredSize = preferredSize.expandedTo(spinButtonWidget.down().preferredSize()); 950 int height = std::max(upPreferredSize.height(), downPreferredSize.height()); 951 style.setMinHeight(Length(height, Fixed)); 950 951 // Ensure that the minimum height space is enough for the taller of the spin buttons. 952 int minimumHeight = std::max(upPreferredSize.height(), downPreferredSize.height()); 953 style.setMinHeight(Length(minimumHeight, Fixed)); 954 955 // The default theme for the GTK+ port uses very wide spin buttons (66px) compared to what other 956 // browsers use (~13 px). And unfortunately, most of the web developers won't test how their site 957 // renders on WebKitGTK+. To ensure that spin buttons don't end up covering the values of the input 958 // field, we override the width of the input element and always increment it with the width needed 959 // for the spinbutton (when drawing the spinbutton). 960 int minimumWidth = style.width().intValue() + upPreferredSize.width() + downPreferredSize.width(); 961 style.setMinWidth(Length(minimumWidth, Fixed)); 952 962 } 953 963 … … 1521 1531 IntSize upPreferredSize = spinButtonWidget.up().preferredSize(); 1522 1532 IntSize downPreferredSize = spinButtonWidget.down().preferredSize(); 1523 int buttonSize = std::max(std::max(upPreferredSize.width(), downPreferredSize.width()), std::max(upPreferredSize.height(), downPreferredSize.height())); 1524 style.setWidth(Length(buttonSize * 2, Fixed)); 1525 style.setHeight(Length(buttonSize, Fixed)); 1533 int minimumHeight = std::max(upPreferredSize.height(), downPreferredSize.height()); 1534 int minimumWidth = upPreferredSize.width() + downPreferredSize.width(); 1535 style.setWidth(Length(minimumWidth, Fixed)); 1536 style.setHeight(Length(minimumHeight, Fixed)); 1526 1537 } 1527 1538
Note:
See TracChangeset
for help on using the changeset viewer.