Title: [139089] trunk
Revision
139089
Author
o...@chromium.org
Date
2013-01-08 11:40:40 -0800 (Tue, 08 Jan 2013)

Log Message

text controls are sized too small when a percentage height is set
https://bugs.webkit.org/show_bug.cgi?id=106277

Reviewed by Tony Chang.

Source/WebCore:

This makes our behavior match Firefox 17, IE 9 and Opera 12.
The current logic came from http://trac.webkit.org/changeset/13723,
which itself was copy-pasted from RenderReplaced and no longer has this clause..

Test: fast/forms/percent-height-auto-width-form-controls.html

* rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::computePreferredLogicalWidths):
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::computePreferredLogicalWidths):
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::computePreferredLogicalWidths):
* rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::computePreferredLogicalWidths):

LayoutTests:

* fast/forms/percent-height-auto-width-form-controls-expected.txt: Added.
* fast/forms/percent-height-auto-width-form-controls.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139088 => 139089)


--- trunk/LayoutTests/ChangeLog	2013-01-08 19:35:54 UTC (rev 139088)
+++ trunk/LayoutTests/ChangeLog	2013-01-08 19:40:40 UTC (rev 139089)
@@ -1,3 +1,13 @@
+2013-01-08  Ojan Vafai  <o...@chromium.org>
+
+        text controls are sized too small when a percentage height is set
+        https://bugs.webkit.org/show_bug.cgi?id=106277
+
+        Reviewed by Tony Chang.
+
+        * fast/forms/percent-height-auto-width-form-controls-expected.txt: Added.
+        * fast/forms/percent-height-auto-width-form-controls.html: Added.
+
 2013-01-08  Mike West  <mk...@chromium.org>
 
         CSP: 'none' should take effect only if no other source _expression_ is present.

Added: trunk/LayoutTests/fast/forms/percent-height-auto-width-form-controls-expected.txt (0 => 139089)


--- trunk/LayoutTests/fast/forms/percent-height-auto-width-form-controls-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/percent-height-auto-width-form-controls-expected.txt	2013-01-08 19:40:40 UTC (rev 139089)
@@ -0,0 +1,20 @@
+PASS document.getElementById("text-a").offsetWidth is document.getElementById("text-b").offsetWidth
+PASS document.getElementById("file-a").offsetWidth is document.getElementById("file-b").offsetWidth
+PASS document.getElementById("range-a").offsetWidth is document.getElementById("range-b").offsetWidth
+PASS document.getElementById("select-a").offsetWidth is document.getElementById("select-b").offsetWidth
+PASS document.getElementById("multiple-a").offsetWidth is document.getElementById("multiple-b").offsetWidth
+PASS successfullyParsed is true
+
+TEST COMPLETE
+The form controls of the same type below should be the same width.
+
+
+
+
+
+
+
+
+
+
+

Added: trunk/LayoutTests/fast/forms/percent-height-auto-width-form-controls.html (0 => 139089)


--- trunk/LayoutTests/fast/forms/percent-height-auto-width-form-controls.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/percent-height-auto-width-form-controls.html	2013-01-08 19:40:40 UTC (rev 139089)
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<p>The form controls of the same type below should be the same width.</p>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <input id="text-a" style="height: 100%">
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <input id="text-b">
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <input id="file-a" type=file style="height: 100%">
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <input id="file-b" type=file>
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <input id="range-a" type=range style="height: 100%">
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <input id="range-b" type=range>
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <select id="select-a" style="height: 100%"><option>aaaaaaaaaaaaaaaaaaaaaaaaa
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <select id="select-b"><option>aaaaaaaaaaaaaaaaaaaaaaaaa
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <select id="multiple-a" multiple style="height: 100%"><option>aaaaaaaaaaaaaaaaaaaaaaaaa
+    </td></tr></tbody></table>
+</div>
+
+<div style="width: 100px; background: pink">
+    <table><tbody><tr><td>
+        <select id="multiple-b" multiple><option>aaaaaaaaaaaaaaaaaaaaaaaaa
+    </td></tr></tbody></table>
+</div>
+
+<script src=""
+<script>
+var ids = ['text', 'file', 'range', 'select', 'multiple'];
+ids.forEach(function(id) {
+    shouldBe('document.getElementById("' + id + '-a").offsetWidth', 'document.getElementById("' + id + '-b").offsetWidth');
+})
+</script>
+<script src=""

Modified: trunk/Source/WebCore/ChangeLog (139088 => 139089)


--- trunk/Source/WebCore/ChangeLog	2013-01-08 19:35:54 UTC (rev 139088)
+++ trunk/Source/WebCore/ChangeLog	2013-01-08 19:40:40 UTC (rev 139089)
@@ -1,3 +1,27 @@
+2013-01-08  Ojan Vafai  <o...@chromium.org>
+
+        text controls are sized too small when a percentage height is set
+        https://bugs.webkit.org/show_bug.cgi?id=106277
+
+        Reviewed by Tony Chang.
+
+        This makes our behavior match Firefox 17, IE 9 and Opera 12.
+        The current logic came from http://trac.webkit.org/changeset/13723,
+        which itself was copy-pasted from RenderReplaced and no longer has this clause..
+
+        Test: fast/forms/percent-height-auto-width-form-controls.html
+
+        * rendering/RenderFileUploadControl.cpp:
+        (WebCore::RenderFileUploadControl::computePreferredLogicalWidths):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::computePreferredLogicalWidths):
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::computePreferredLogicalWidths):
+        * rendering/RenderSlider.cpp:
+        (WebCore::RenderSlider::computePreferredLogicalWidths):
+        * rendering/RenderTextControl.cpp:
+        (WebCore::RenderTextControl::computePreferredLogicalWidths):
+
 2013-01-08  Peter Beverloo  <pe...@chromium.org>
 
         [Chromium] Modify Android's user agent CSS to not set a border-radius on select elements

Modified: trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp (139088 => 139089)


--- trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2013-01-08 19:35:54 UTC (rev 139088)
+++ trunk/Source/WebCore/rendering/RenderFileUploadControl.cpp	2013-01-08 19:40:40 UTC (rev 139089)
@@ -195,7 +195,7 @@
     if (style->minWidth().isFixed() && style->minWidth().value() > 0) {
         m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style->minWidth().value()));
         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style->minWidth().value()));
-    } else if (style->width().isPercent() || (style->width().isAuto() && style->height().isPercent()))
+    } else if (style->width().isPercent())
         m_minPreferredLogicalWidth = 0;
     else
         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (139088 => 139089)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2013-01-08 19:35:54 UTC (rev 139088)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2013-01-08 19:40:40 UTC (rev 139089)
@@ -221,7 +221,7 @@
     if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
         m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
-    } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
+    } else if (style()->width().isPercent())
         m_minPreferredLogicalWidth = 0;
     else
         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;

Modified: trunk/Source/WebCore/rendering/RenderMenuList.cpp (139088 => 139089)


--- trunk/Source/WebCore/rendering/RenderMenuList.cpp	2013-01-08 19:35:54 UTC (rev 139088)
+++ trunk/Source/WebCore/rendering/RenderMenuList.cpp	2013-01-08 19:40:40 UTC (rev 139089)
@@ -285,7 +285,7 @@
     if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
         m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
-    } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
+    } else if (style()->width().isPercent())
         m_minPreferredLogicalWidth = 0;
     else
         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;

Modified: trunk/Source/WebCore/rendering/RenderSlider.cpp (139088 => 139089)


--- trunk/Source/WebCore/rendering/RenderSlider.cpp	2013-01-08 19:35:54 UTC (rev 139088)
+++ trunk/Source/WebCore/rendering/RenderSlider.cpp	2013-01-08 19:40:40 UTC (rev 139089)
@@ -83,7 +83,7 @@
     if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
         m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
-    } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
+    } else if (style()->width().isPercent())
         m_minPreferredLogicalWidth = 0;
     else
         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;

Modified: trunk/Source/WebCore/rendering/RenderTextControl.cpp (139088 => 139089)


--- trunk/Source/WebCore/rendering/RenderTextControl.cpp	2013-01-08 19:35:54 UTC (rev 139088)
+++ trunk/Source/WebCore/rendering/RenderTextControl.cpp	2013-01-08 19:40:40 UTC (rev 139089)
@@ -274,7 +274,7 @@
     if (style()->minWidth().isFixed() && style()->minWidth().value() > 0) {
         m_maxPreferredLogicalWidth = max(m_maxPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
         m_minPreferredLogicalWidth = max(m_minPreferredLogicalWidth, adjustContentBoxLogicalWidthForBoxSizing(style()->minWidth().value()));
-    } else if (style()->width().isPercent() || (style()->width().isAuto() && style()->height().isPercent()))
+    } else if (style()->width().isPercent())
         m_minPreferredLogicalWidth = 0;
     else
         m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to