[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

commit-queue at webkit.org commit-queue at webkit.org
Mon Feb 21 00:29:13 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 4de046c79591bf31420e25bb521d8fa5fd588ed2
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Feb 1 03:45:45 2011 +0000

    2011-01-31  Emil A Eklund  <eae at chromium.org>
    
            Reviewed by Darin Adler.
    
            Setting "selected" attribute to false should have no effect in single line <select>
            https://bugs.webkit.org/show_bug.cgi?id=52436
    
            Add test for changing the selection in a one-line select element using\
            the option.selected property.
    
            * fast/dom/HTMLSelectElement/selected-false-expected.txt: Added.
            * fast/dom/HTMLSelectElement/selected-false.html: Added.
    2011-01-31  Emil A Eklund  <eae at chromium.org>
    
            Reviewed by Darin Adler.
    
            Setting "selected" attribute to false should have no effect in single line <select>
            https://bugs.webkit.org/show_bug.cgi?id=52436
    
            Change SelectElement::setSelectedIndex to select the first selectable
            option when the select state of all options is set to false as required
            by the HTML5 specification.
    
            Test: fast/dom/HTMLSelectElement/selected-false.html
    
            * dom/SelectElement.cpp:
            (WebCore::SelectElement::setSelectedIndex):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77206 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 0646d1b..814abe5 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2011-01-31  Emil A Eklund  <eae at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Setting "selected" attribute to false should have no effect in single line <select>
+        https://bugs.webkit.org/show_bug.cgi?id=52436
+
+        Add test for changing the selection in a one-line select element using\
+        the option.selected property.
+
+        * fast/dom/HTMLSelectElement/selected-false-expected.txt: Added.
+        * fast/dom/HTMLSelectElement/selected-false.html: Added.
+
 2011-01-31  Ryosuke Niwa  <rniwa at webkit.org>
 
         Unreviewed Chromium rebaselines for r77173.
diff --git a/LayoutTests/fast/dom/HTMLSelectElement/selected-false-expected.txt b/LayoutTests/fast/dom/HTMLSelectElement/selected-false-expected.txt
new file mode 100644
index 0000000..edc9f2f
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLSelectElement/selected-false-expected.txt
@@ -0,0 +1,27 @@
+
+PASS selectElement.selectedIndex = 0; selectElement.selectedIndex is 0
+PASS optionElements[0].selected is true
+PASS optionElements[1].selected is false
+PASS optionElements[2].selected is false
+PASS selectElement.selectedIndex = -1; selectElement.selectedIndex is -1
+PASS optionElements[0].selected is false
+PASS optionElements[1].selected is false
+PASS optionElements[2].selected is false
+PASS selectElement.selectedIndex = -2; selectElement.selectedIndex is -1
+PASS selectElement.selectedIndex is 1
+PASS optionElements[0].selected is false
+PASS optionElements[1].selected is true
+PASS optionElements[2].selected is false
+PASS selectElement.selectedIndex is 2
+PASS optionElements[0].selected is false
+PASS optionElements[1].selected is false
+PASS optionElements[2].selected is true
+PASS selectElement.selectedIndex is 0
+PASS optionElements[0].selected is true
+PASS optionElements[1].selected is false
+PASS optionElements[2].selected is false
+PASS selectElement.selectedIndex is 1
+PASS optionElements[0].selected is false
+PASS optionElements[1].selected is true
+PASS optionElements[2].selected is false
+
diff --git a/LayoutTests/fast/dom/HTMLSelectElement/selected-false.html b/LayoutTests/fast/dom/HTMLSelectElement/selected-false.html
new file mode 100644
index 0000000..a8ef4b4
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLSelectElement/selected-false.html
@@ -0,0 +1,56 @@
+<html>
+<head>
+<script src="../../js/resources/js-test-pre.js"></script>
+<body> 
+    <select size="1"> 
+        <option id="opt1" value="1">1</option> 
+        <option id="opt2" value="2">2</option>
+        <option id="opt2" value="3">3</option> 
+    </select>
+    <div id="console"></div>
+</body>
+<script>
+    var selectElement = document.getElementsByTagName('select')[0];
+    var optionElements = selectElement.getElementsByTagName('option');
+
+    shouldBe("selectElement.selectedIndex = 0; selectElement.selectedIndex", "0");
+    shouldBe("optionElements[0].selected", "true");
+    shouldBe("optionElements[1].selected", "false");
+    shouldBe("optionElements[2].selected", "false");
+
+    shouldBe("selectElement.selectedIndex = -1; selectElement.selectedIndex", "-1");
+    shouldBe("optionElements[0].selected", "false");
+    shouldBe("optionElements[1].selected", "false");
+    shouldBe("optionElements[2].selected", "false");
+
+    shouldBe("selectElement.selectedIndex = -2; selectElement.selectedIndex", "-1");
+
+    optionElements[2].selected = true;
+    optionElements[1].selected = true;
+    shouldBe("selectElement.selectedIndex", "1");
+    shouldBe("optionElements[0].selected", "false");
+    shouldBe("optionElements[1].selected", "true");
+    shouldBe("optionElements[2].selected", "false");
+    
+    optionElements[1].selected = true;
+    optionElements[2].selected = true;
+    shouldBe("selectElement.selectedIndex", "2");
+    shouldBe("optionElements[0].selected", "false");
+    shouldBe("optionElements[1].selected", "false");
+    shouldBe("optionElements[2].selected", "true");
+
+    optionElements[0].selected = false;
+    optionElements[2].selected = false;
+    shouldBe("selectElement.selectedIndex", "0");
+    shouldBe("optionElements[0].selected", "true");
+    shouldBe("optionElements[1].selected", "false");
+    shouldBe("optionElements[2].selected", "false");
+
+    optionElements[0].disabled = true;
+    optionElements[0].selected = false;
+    shouldBe("selectElement.selectedIndex", "1");
+    shouldBe("optionElements[0].selected", "false");
+    shouldBe("optionElements[1].selected", "true");
+    shouldBe("optionElements[2].selected", "false");
+</script>
+</html> 
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index f193e80..283f288 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2011-01-31  Emil A Eklund  <eae at chromium.org>
+
+        Reviewed by Darin Adler.
+
+        Setting "selected" attribute to false should have no effect in single line <select>
+        https://bugs.webkit.org/show_bug.cgi?id=52436
+
+        Change SelectElement::setSelectedIndex to select the first selectable
+        option when the select state of all options is set to false as required
+        by the HTML5 specification.
+
+        Test: fast/dom/HTMLSelectElement/selected-false.html
+
+        * dom/SelectElement.cpp:
+        (WebCore::SelectElement::setSelectedIndex):
+
 2011-01-31  Alexander Pavlov  <apavlov at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/Source/WebCore/dom/SelectElement.cpp b/Source/WebCore/dom/SelectElement.cpp
index 24ad1be..a66d803 100644
--- a/Source/WebCore/dom/SelectElement.cpp
+++ b/Source/WebCore/dom/SelectElement.cpp
@@ -315,11 +315,14 @@ int SelectElement::selectedIndex(const SelectElementData& data, const Element* e
 
 void SelectElement::setSelectedIndex(SelectElementData& data, Element* element, int optionIndex, bool deselect, bool fireOnChangeNow, bool userDrivenChange)
 {
-    const Vector<Element*>& items = data.listItems(element);
-    int listIndex = optionToListIndex(data, element, optionIndex);
+    if (optionIndex == -1 && !deselect && !data.multiple())
+        optionIndex = nextSelectableListIndex(data, element, -1);
     if (!data.multiple())
         deselect = true;
 
+    const Vector<Element*>& items = data.listItems(element);
+    int listIndex = optionToListIndex(data, element, optionIndex);
+
     Element* excludeElement = 0;
     if (OptionElement* optionElement = (listIndex >= 0 ? toOptionElement(items[listIndex]) : 0)) {
         excludeElement = items[listIndex];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list