Title: [180530] trunk
Revision
180530
Author
[email protected]
Date
2015-02-23 16:17:17 -0800 (Mon, 23 Feb 2015)

Log Message

Default value of HTMLSelectElement size IDL attribute should be 0.
https://bugs.webkit.org/show_bug.cgi?id=141795

Reviewed by Andreas Kling.

Source/WebCore:

Default value of HTMLSelectElement size IDL attribute should be 0.
As in spec: http://www.w3.org/html/wg/drafts/html/master/forms.html#the-select-element, also this matches the behavior of Chrome, IE and
Gecko.

Test: fast/dom/select-size.html

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::parseAttribute):

LayoutTests:

* fast/dom/select-size-expected.txt: Added.
* fast/dom/select-size.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (180529 => 180530)


--- trunk/LayoutTests/ChangeLog	2015-02-23 23:50:01 UTC (rev 180529)
+++ trunk/LayoutTests/ChangeLog	2015-02-24 00:17:17 UTC (rev 180530)
@@ -1,3 +1,13 @@
+2015-02-23  Shivakumar JM  <[email protected]>
+
+        Default value of HTMLSelectElement size IDL attribute should be 0.
+        https://bugs.webkit.org/show_bug.cgi?id=141795
+
+        Reviewed by Andreas Kling.
+
+        * fast/dom/select-size-expected.txt: Added.
+        * fast/dom/select-size.html: Added.
+
 2015-02-23  Said Abou-Hallawa  <[email protected]>
 
         Drawing an SVG image into a canvas using drawImage() ignores globalAlpha.

Added: trunk/LayoutTests/fast/dom/select-size-expected.txt (0 => 180530)


--- trunk/LayoutTests/fast/dom/select-size-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/select-size-expected.txt	2015-02-24 00:17:17 UTC (rev 180530)
@@ -0,0 +1,36 @@
+Test HTMLSelectElement::size behavior.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS select.size is 0
+PASS select.setAttribute("size", "1"); select.size is 1
+PASS select.setAttribute("size", "2"); select.size is 2
+PASS select.setAttribute("size", "3"); select.size is 3
+PASS select.setAttribute("size", "4"); select.size is 4
+PASS select.setAttribute("size", "0"); select.size is 0
+PASS select.setAttribute("size", "-1"); select.size is 0
+PASS select.setAttribute("size", "abc"); select.size is 0
+PASS select.setAttribute("size", "3.14"); select.size is 3
+PASS select.size is 2
+PASS select.setAttribute("size", "1"); select.size is 1
+PASS select.setAttribute("size", "0"); select.size is 0
+PASS select.setAttribute("size", "-1"); select.size is 0
+PASS select.setAttribute("size", "abc"); select.size is 0
+PASS select.setAttribute("size", "3.14"); select.size is 3
+PASS select.size is 0
+PASS select.setAttribute("size", "1"); select.size is 1
+PASS select.setAttribute("size", "0"); select.size is 0
+PASS select.setAttribute("size", "-1"); select.size is 0
+PASS select.setAttribute("size", "abc"); select.size is 0
+PASS select.setAttribute("size", "3.14"); select.size is 3
+PASS select.size is 1
+PASS select.setAttribute("size", "2"); select.size is 2
+PASS select.setAttribute("size", "0"); select.size is 0
+PASS select.setAttribute("size", "-1"); select.size is 0
+PASS select.setAttribute("size", "abc"); select.size is 0
+PASS select.setAttribute("size", "3.14"); select.size is 3
+PASS successfullyParsed is true
+
+TEST COMPLETE
+   

Added: trunk/LayoutTests/fast/dom/select-size.html (0 => 180530)


--- trunk/LayoutTests/fast/dom/select-size.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/select-size.html	2015-02-24 00:17:17 UTC (rev 180530)
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<select id="test1"></select>
+<select id="test2" size=2></select>
+<select id="test3" multiple></select>
+<select id="test4" multiple size=1></select>
+<script>
+description('Test HTMLSelectElement::size behavior.');
+
+var select = document.getElementById('test1');
+shouldBe('select.size', '0');
+shouldBe('select.setAttribute("size", "1"); select.size', '1');
+shouldBe('select.setAttribute("size", "2"); select.size', '2');
+shouldBe('select.setAttribute("size", "3"); select.size', '3');
+shouldBe('select.setAttribute("size", "4"); select.size', '4');
+shouldBe('select.setAttribute("size", "0"); select.size', '0');
+shouldBe('select.setAttribute("size", "-1"); select.size', '0');
+shouldBe('select.setAttribute("size", "abc"); select.size', '0');
+shouldBe('select.setAttribute("size", "3.14"); select.size', '3');
+
+var select = document.getElementById('test2');
+shouldBe('select.size', '2');
+shouldBe('select.setAttribute("size", "1"); select.size', '1');
+shouldBe('select.setAttribute("size", "0"); select.size', '0');
+shouldBe('select.setAttribute("size", "-1"); select.size', '0');
+shouldBe('select.setAttribute("size", "abc"); select.size', '0');
+shouldBe('select.setAttribute("size", "3.14"); select.size', '3');
+
+var select = document.getElementById('test3');
+shouldBe('select.size', '0');
+shouldBe('select.setAttribute("size", "1"); select.size', '1');
+shouldBe('select.setAttribute("size", "0"); select.size', '0');
+shouldBe('select.setAttribute("size", "-1"); select.size', '0');
+shouldBe('select.setAttribute("size", "abc"); select.size', '0');
+shouldBe('select.setAttribute("size", "3.14"); select.size', '3');
+
+var select = document.getElementById('test4');
+shouldBe('select.size', '1');
+shouldBe('select.setAttribute("size", "2"); select.size', '2');
+shouldBe('select.setAttribute("size", "0"); select.size', '0');
+shouldBe('select.setAttribute("size", "-1"); select.size', '0');
+shouldBe('select.setAttribute("size", "abc"); select.size', '0');
+shouldBe('select.setAttribute("size", "3.14"); select.size', '3');
+
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (180529 => 180530)


--- trunk/Source/WebCore/ChangeLog	2015-02-23 23:50:01 UTC (rev 180529)
+++ trunk/Source/WebCore/ChangeLog	2015-02-24 00:17:17 UTC (rev 180530)
@@ -1,3 +1,19 @@
+2015-02-23  Shivakumar JM  <[email protected]>
+
+        Default value of HTMLSelectElement size IDL attribute should be 0.
+        https://bugs.webkit.org/show_bug.cgi?id=141795
+
+        Reviewed by Andreas Kling.
+
+        Default value of HTMLSelectElement size IDL attribute should be 0. 
+        As in spec: http://www.w3.org/html/wg/drafts/html/master/forms.html#the-select-element, also this matches the behavior of Chrome, IE and
+        Gecko.
+
+        Test: fast/dom/select-size.html
+
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::parseAttribute):
+
 2015-02-23  Said Abou-Hallawa  <[email protected]>
 
         Drawing an SVG image into a canvas using drawImage() ignores globalAlpha.

Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (180529 => 180530)


--- trunk/Source/WebCore/html/HTMLSelectElement.cpp	2015-02-23 23:50:01 UTC (rev 180529)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp	2015-02-24 00:17:17 UTC (rev 180530)
@@ -311,7 +311,7 @@
             if (Attribute* sizeAttribute = ensureUniqueElementData().findAttributeByName(sizeAttr))
                 sizeAttribute->setValue(attrSize);
         }
-        size = std::max(size, 1);
+        size = std::max(size, 0);
 
         // Ensure that we've determined selectedness of the items at least once prior to changing the size.
         if (oldSize != size)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to