text controls are sized too small when a percentage height is set
authorojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2013 19:40:40 +0000 (19:40 +0000)
committerojan@chromium.org <ojan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jan 2013 19:40:40 +0000 (19:40 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139089 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/forms/percent-height-auto-width-form-controls-expected.txt [new file with mode: 0644]
LayoutTests/fast/forms/percent-height-auto-width-form-controls.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderFileUploadControl.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderSlider.cpp
Source/WebCore/rendering/RenderTextControl.cpp

index f8c8f1d..3ace287 100644 (file)
@@ -1,3 +1,13 @@
+2013-01-08  Ojan Vafai  <ojan@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  <mkwst@chromium.org>
 
         CSP: 'none' should take effect only if no other source expression is present.
diff --git a/LayoutTests/fast/forms/percent-height-auto-width-form-controls-expected.txt b/LayoutTests/fast/forms/percent-height-auto-width-form-controls-expected.txt
new file mode 100644 (file)
index 0000000..7549834
--- /dev/null
@@ -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.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/LayoutTests/fast/forms/percent-height-auto-width-form-controls.html b/LayoutTests/fast/forms/percent-height-auto-width-form-controls.html
new file mode 100644 (file)
index 0000000..ab24fe9
--- /dev/null
@@ -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="../js/resources/js-test-pre.js"></script>
+<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="../js/resources/js-test-post.js"></script>
index 0b8b3d6..e9bcd1f 100644 (file)
@@ -1,3 +1,27 @@
+2013-01-08  Ojan Vafai  <ojan@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  <peter@chromium.org>
 
         [Chromium] Modify Android's user agent CSS to not set a border-radius on select elements
index 188d855..5b00ca2 100644 (file)
@@ -195,7 +195,7 @@ void RenderFileUploadControl::computePreferredLogicalWidths()
     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;
index 4d5335a..14ae0be 100644 (file)
@@ -221,7 +221,7 @@ void RenderListBox::computePreferredLogicalWidths()
     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;
index bab366e..9f83e84 100644 (file)
@@ -285,7 +285,7 @@ void RenderMenuList::computePreferredLogicalWidths()
     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;
index d5b90ca..09a9a9c 100644 (file)
@@ -83,7 +83,7 @@ void RenderSlider::computePreferredLogicalWidths()
     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;
index 35da704..761d68e 100644 (file)
@@ -274,7 +274,7 @@ void RenderTextControl::computePreferredLogicalWidths()
     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;