Title: [99653] trunk
Revision
99653
Author
commit-qu...@webkit.org
Date
2011-11-08 23:11:27 -0800 (Tue, 08 Nov 2011)

Log Message

Default <select multiple> expands up to 10 items instead of showing 4.
https://bugs.webkit.org/show_bug.cgi?id=70765

Patch by Antaryami Pandia <antaryami.pan...@motorola.com> on 2011-11-08
Reviewed by Darin Adler.

Source/WebCore:

Tests: fast/forms/select-clientheight-large-size.html
       fast/forms/select-clientheight-with-multiple-attr.html

* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::size):

LayoutTests:

* fast/forms/select-clientheight-large-size-expected.txt: Added.
* fast/forms/select-clientheight-large-size.html: Added.
* fast/forms/select-clientheight-with-multiple-attr-expected.txt: Added.
* fast/forms/select-clientheight-with-multiple-attr.html: Added.
* platform/chromium/test_expectations.txt:
* platform/gtk/fast/forms/listbox-clip-expected.txt:
* platform/mac/test_expectations.txt:
* platform/qt/test_expectations.txt:
* platform/win/test_expectations.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (99652 => 99653)


--- trunk/LayoutTests/ChangeLog	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/LayoutTests/ChangeLog	2011-11-09 07:11:27 UTC (rev 99653)
@@ -1,3 +1,20 @@
+2011-11-08  Antaryami Pandia  <antaryami.pan...@motorola.com>
+
+        Default <select multiple> expands up to 10 items instead of showing 4.
+        https://bugs.webkit.org/show_bug.cgi?id=70765
+
+        Reviewed by Darin Adler.
+
+        * fast/forms/select-clientheight-large-size-expected.txt: Added.
+        * fast/forms/select-clientheight-large-size.html: Added.
+        * fast/forms/select-clientheight-with-multiple-attr-expected.txt: Added.
+        * fast/forms/select-clientheight-with-multiple-attr.html: Added.
+        * platform/chromium/test_expectations.txt:
+        * platform/gtk/fast/forms/listbox-clip-expected.txt:
+        * platform/mac/test_expectations.txt:
+        * platform/qt/test_expectations.txt:
+        * platform/win/test_expectations.txt:
+
 2011-11-08  Chris Evans  <cev...@google.com>
 
         Crash accessing font fact rule parent

Added: trunk/LayoutTests/fast/forms/select-clientheight-large-size-expected.txt (0 => 99653)


--- trunk/LayoutTests/fast/forms/select-clientheight-large-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select-clientheight-large-size-expected.txt	2011-11-09 07:11:27 UTC (rev 99653)
@@ -0,0 +1,14 @@
+HTMLSelectElement multiple attribute test when no size is specified
+
+PASS clientHeight('select2') is clientHeight('select1')
+PASS getElemById('select2').setAttribute('size', '4'); clientHeight('select2') == clientHeight('select1') is true
+PASS getElemById('select2').setAttribute('size', '5'); clientHeight('select2') > clientHeight('select1') is true
+PASS getElemById('select2').setAttribute('size', '8'); clientHeight('select2') == multipleOfElement('select1', 2) is true
+PASS getElemById('select2').setAttribute('size', '12'); clientHeight('select2') == multipleOfElement('select1', 3) is true
+PASS getElemById('select2').setAttribute('size', '16'); clientHeight('select2') == multipleOfElement('select1', 4) is true
+PASS getElemById('select2').setAttribute('size', '400'); clientHeight('select2') == multipleOfElement('select1', 100) is true
+PASS getElemById('select2').setAttribute('size', '4000'); clientHeight('select2') == multipleOfElement('select1', 1000) is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+  

Added: trunk/LayoutTests/fast/forms/select-clientheight-large-size.html (0 => 99653)


--- trunk/LayoutTests/fast/forms/select-clientheight-large-size.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select-clientheight-large-size.html	2011-11-09 07:11:27 UTC (rev 99653)
@@ -0,0 +1,67 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p>HTMLSelectElement multiple attribute test when no size is specified</p>
+<div id="console"></div>
+
+<select multiple id="select1" >
+    <option value="0">0</option>
+    <option value="1">1</option>
+    <option value="2">2</option>
+    <option value="3">3</option>
+    <option value="4">4</option>
+    <option value="5">5</option>
+    <option value="6">6</option>
+    <option value="7">7</option>
+    <option value="8">8</option>
+    <option value="9">9</option>
+</select>
+
+<select multiple id="select2" ></select>
+
+<script>
+
+    function AddItem(Text,Value) {
+        var opt = document.createElement("option");
+        document.getElementById("select2").options.add(opt);
+
+        opt.text = Text;
+        opt.value = Value;
+
+    }
+
+    function getElemById(elemId) {
+        return document.getElementById(elemId);
+    }
+
+    function clientHeight(elemId) {
+        var element = getElemById(elemId);
+        return element.clientHeight;
+    }
+
+    function multipleOfElement(elemId, multiple) {
+        var element = getElemById(elemId);
+        var value = element.clientHeight * multiple + (multiple - 1);
+        return value;
+    }
+
+    var select = document.getElementById("select2");
+    
+    // Add large number of options
+    for (i=0 ; i<= 10000 ;i++)
+        AddItem(i, i);
+
+    shouldBe("clientHeight('select2')", "clientHeight('select1')");
+    shouldBeTrue("getElemById('select2').setAttribute('size', '4'); clientHeight('select2') == clientHeight('select1')");
+    shouldBeTrue("getElemById('select2').setAttribute('size', '5'); clientHeight('select2') > clientHeight('select1')");
+    shouldBeTrue("getElemById('select2').setAttribute('size', '8'); clientHeight('select2') == multipleOfElement('select1', 2)");
+    shouldBeTrue("getElemById('select2').setAttribute('size', '12'); clientHeight('select2') == multipleOfElement('select1', 3)");
+    shouldBeTrue("getElemById('select2').setAttribute('size', '16'); clientHeight('select2') == multipleOfElement('select1', 4)");
+    shouldBeTrue("getElemById('select2').setAttribute('size', '400'); clientHeight('select2') == multipleOfElement('select1', 100)");
+    shouldBeTrue("getElemById('select2').setAttribute('size', '4000'); clientHeight('select2') == multipleOfElement('select1', 1000)");
+</script>
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/fast/forms/select-clientheight-with-multiple-attr-expected.txt (0 => 99653)


--- trunk/LayoutTests/fast/forms/select-clientheight-with-multiple-attr-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select-clientheight-with-multiple-attr-expected.txt	2011-11-09 07:11:27 UTC (rev 99653)
@@ -0,0 +1,13 @@
+HTMLSelectElement multiple attribute test when no size is specified
+
+PASS clientHeight('sel2') is clientHeight('sel1')
+PASS getElemById('sel2').setAttribute('size', '5'); clientHeight('sel2') > clientHeight('sel1') is true
+PASS clientHeight('sel3') is clientHeight('sel1')
+PASS getElemById('sel3').setAttribute('size', '2'); clientHeight('sel3') is clientHeight('sel1')
+PASS getElemById('sel3').setAttribute('size', '0'); clientHeight('sel3') is clientHeight('sel1')
+PASS getElemById('sel3').setAttribute('size', ''); clientHeight('sel3') is clientHeight('sel1')
+PASS getElemById('sel3').setAttribute('size', '1+ef'); clientHeight('sel3') is clientHeight('sel1')
+PASS successfullyParsed is true
+
+TEST COMPLETE
+    

Added: trunk/LayoutTests/fast/forms/select-clientheight-with-multiple-attr.html (0 => 99653)


--- trunk/LayoutTests/fast/forms/select-clientheight-with-multiple-attr.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/select-clientheight-with-multiple-attr.html	2011-11-09 07:11:27 UTC (rev 99653)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<p>HTMLSelectElement multiple attribute test when no size is specified</p>
+<div id="console"></div>
+
+<select multiple id="sel1" >
+    <option value="1">One</option>
+</select>
+
+<select multiple id="sel2" >
+    <option value="1">One</option>
+    <option value="2">Two</option>
+    <option value="3">Three</option>
+    <option value="4">Four</option>
+    <option value="5">Five</option>
+    <option value="6">Six</option>
+    <option value="7">Seven</option>
+    <option value="8">Eight</option>
+    <option value="9">Nine</option>
+    <option value="10">Ten</option>
+    <option value="11">Eleven</option>
+    <option value="12">Twelve</option>
+    <option value="13">Thirteen</option>
+    <option value="14">Fourteen</option>
+</select>
+
+<select multiple id="sel3" >
+    <option value="1">One</option>
+    <option value="2">Two</option>
+    <option value="3">Three</option>
+</select>
+
+<script>
+
+    function getElemById(elemId) {
+        return document.getElementById(elemId);
+    }
+
+    function clientHeight(elemId) {
+        var element = getElemById(elemId);
+        return element.clientHeight;
+    }
+
+    shouldBe("clientHeight('sel2')", "clientHeight('sel1')");
+    shouldBeTrue("getElemById('sel2').setAttribute('size', '5'); clientHeight('sel2') > clientHeight('sel1')");
+    shouldBe("clientHeight('sel3')", "clientHeight('sel1')");
+    shouldBe("getElemById('sel3').setAttribute('size', '2'); clientHeight('sel3')", "clientHeight('sel1')");
+    shouldBe("getElemById('sel3').setAttribute('size', '0'); clientHeight('sel3')", "clientHeight('sel1')");
+    shouldBe("getElemById('sel3').setAttribute('size', ''); clientHeight('sel3')", "clientHeight('sel1')");
+    shouldBe("getElemById('sel3').setAttribute('size', '1+ef'); clientHeight('sel3')", "clientHeight('sel1')");
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (99652 => 99653)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2011-11-09 07:11:27 UTC (rev 99653)
@@ -1968,6 +1968,9 @@
 // They should be moved to the _javascript_Core test suite.
 BUGCR42875 SKIP WONTFIX : sputnik = TEXT
 
+// Need rebaseline
+BUGWK70765 : fast/forms/listbox-clip.html = TEXT
+
 BUGWK38705 : http/tests/security/sandbox-inherit-to-initial-document-2.html = TEXT
 
 // WebKit roll 58791:58807

Modified: trunk/LayoutTests/platform/gtk/fast/forms/listbox-clip-expected.txt (99652 => 99653)


--- trunk/LayoutTests/platform/gtk/fast/forms/listbox-clip-expected.txt	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/LayoutTests/platform/gtk/fast/forms/listbox-clip-expected.txt	2011-11-09 07:11:27 UTC (rev 99653)
@@ -3,6 +3,6 @@
 layer at (0,0) size 800x600
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
-      RenderListBox {SELECT} at (0,2) size 100x106 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
+      RenderListBox {SELECT} at (0,2) size 100x85 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
       RenderText {#text} at (0,0) size 0x0
       RenderText {#text} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/mac/test_expectations.txt (99652 => 99653)


--- trunk/LayoutTests/platform/mac/test_expectations.txt	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/LayoutTests/platform/mac/test_expectations.txt	2011-11-09 07:11:27 UTC (rev 99653)
@@ -25,6 +25,9 @@
 BUGWK58192 : fast/frames/flattening/iframe-flattening-offscreen.html = TEXT PASS
 BUGWK58192 : svg/dom/SVGScriptElement/script-set-href.svg = TEXT PASS
 
+// Need rebaseline
+BUGWK70765 : fast/forms/listbox-clip.html = TEXT
+
 BUGWK67007 DEBUG : fast/ruby/after-block-doesnt-crash.html = CRASH
 BUGWK67007 DEBUG : fast/ruby/after-table-doesnt-crash.html = CRASH
 BUGWK67007 DEBUG : fast/ruby/generated-after-counter-doesnt-crash.html = CRASH

Modified: trunk/LayoutTests/platform/qt/test_expectations.txt (99652 => 99653)


--- trunk/LayoutTests/platform/qt/test_expectations.txt	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/LayoutTests/platform/qt/test_expectations.txt	2011-11-09 07:11:27 UTC (rev 99653)
@@ -16,4 +16,7 @@
 BUGWK67007 DEBUG : fast/ruby/generated-after-counter-doesnt-crash.html = CRASH
 BUGWK67007 DEBUG : fast/ruby/generated-before-and-after-counter-doesnt-crash.html = CRASH
 
+// Need rebaseline
+BUGWK70765 : fast/forms/listbox-clip.html = TEXT
+
 BUGWK62662 DEBUG : inspector/cookie-parser.html = CRASH PASS

Modified: trunk/LayoutTests/platform/win/test_expectations.txt (99652 => 99653)


--- trunk/LayoutTests/platform/win/test_expectations.txt	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/LayoutTests/platform/win/test_expectations.txt	2011-11-09 07:11:27 UTC (rev 99653)
@@ -8,4 +8,7 @@
 BUGWK67007 DEBUG : fast/ruby/generated-before-and-after-counter-doesnt-crash.html = CRASH
 
 // Need rebaseline
+BUGWK70765 : fast/forms/listbox-clip.html = TEXT
+
+// Need rebaseline
 BUGWK65361 : fast/forms/input-disabled-color.html = IMAGE+TEXT

Modified: trunk/Source/WebCore/ChangeLog (99652 => 99653)


--- trunk/Source/WebCore/ChangeLog	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/Source/WebCore/ChangeLog	2011-11-09 07:11:27 UTC (rev 99653)
@@ -1,3 +1,16 @@
+2011-11-08  Antaryami Pandia  <antaryami.pan...@motorola.com>
+
+        Default <select multiple> expands up to 10 items instead of showing 4.
+        https://bugs.webkit.org/show_bug.cgi?id=70765
+
+        Reviewed by Darin Adler.
+
+        Tests: fast/forms/select-clientheight-large-size.html
+               fast/forms/select-clientheight-with-multiple-attr.html
+
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::size):
+
 2011-11-08  Chris Evans  <cev...@google.com>
 
         Crash accessing font fact rule parent

Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (99652 => 99653)


--- trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-11-09 06:41:55 UTC (rev 99652)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp	2011-11-09 07:11:27 UTC (rev 99653)
@@ -70,9 +70,13 @@
 
 const int optionsSpacingHorizontal = 2;
 
+// The minSize constant was originally defined to render scrollbars correctly.
+// This might vary for different platforms.
 const int minSize = 4;
-const int maxDefaultSize = 10;
 
+// Default size when the multiple attribute is present but size attribute is absent.
+const int defaultSize = 4;
+
 // FIXME: This hardcoded baselineAdjustment is what we used to do for the old
 // widget, but I'm not sure this is right for the new control.
 const int baselineAdjustment = 7;
@@ -216,7 +220,8 @@
     int specifiedSize = toHTMLSelectElement(node())->size();
     if (specifiedSize > 1)
         return max(minSize, specifiedSize);
-    return min(max(minSize, numItems()), maxDefaultSize);
+
+    return defaultSize;
 }
 
 int RenderListBox::numVisibleItems() const
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to