Title: [86915] branches/safari-534.36-branch

Diff

Modified: branches/safari-534.36-branch/LayoutTests/ChangeLog (86914 => 86915)


--- branches/safari-534.36-branch/LayoutTests/ChangeLog	2011-05-20 01:13:36 UTC (rev 86914)
+++ branches/safari-534.36-branch/LayoutTests/ChangeLog	2011-05-20 01:13:38 UTC (rev 86915)
@@ -1,5 +1,19 @@
 2011-05-19  Lucas Forschler  <[email protected]
 
+    Merged r86827.
+    
+    2011-05-19  Emil A Eklund  <[email protected]>
+
+        Reviewed by Alexey Proskuryakov.
+
+        REGRESSION (r80808): Multiple <select> - Selection reset to first element from multiple selected ones
+        https://bugs.webkit.org/show_bug.cgi?id=60986
+
+        * fast/dom/HTMLSelectElement/change-multiple-preserve-selection-expected.txt:
+        * fast/dom/HTMLSelectElement/change-multiple-preserve-selection.html:
+
+2011-05-19  Lucas Forschler  <[email protected]
+
     Merged r86748.
     
     2011-05-18  Abhishek Arya  <[email protected]>

Modified: branches/safari-534.36-branch/LayoutTests/fast/dom/HTMLSelectElement/change-multiple-preserve-selection-expected.txt (86914 => 86915)


--- branches/safari-534.36-branch/LayoutTests/fast/dom/HTMLSelectElement/change-multiple-preserve-selection-expected.txt	2011-05-20 01:13:36 UTC (rev 86914)
+++ branches/safari-534.36-branch/LayoutTests/fast/dom/HTMLSelectElement/change-multiple-preserve-selection-expected.txt	2011-05-20 01:13:38 UTC (rev 86915)
@@ -1,8 +1,17 @@
-      
+        
 PASS selectElement.selectedIndex is -1
 PASS selectElement.selectedIndex is -1
 PASS selectElement.selectedIndex is 0
 PASS selectElement.selectedIndex is -1
 PASS selectElement.selectedIndex is -1
 PASS selectElement.selectedIndex is 0
+PASS selectElement.options[0].selected is true
+PASS selectElement.options[1].selected is true
+PASS selectElement.options[2].selected is false
+PASS selectElement.options[0].selected is true
+PASS selectElement.options[1].selected is true
+PASS selectElement.options[2].selected is false
+PASS selectElement.options[0].selected is true
+PASS selectElement.options[1].selected is false
+PASS selectElement.options[2].selected is false
 

Modified: branches/safari-534.36-branch/LayoutTests/fast/dom/HTMLSelectElement/change-multiple-preserve-selection.html (86914 => 86915)


--- branches/safari-534.36-branch/LayoutTests/fast/dom/HTMLSelectElement/change-multiple-preserve-selection.html	2011-05-20 01:13:36 UTC (rev 86914)
+++ branches/safari-534.36-branch/LayoutTests/fast/dom/HTMLSelectElement/change-multiple-preserve-selection.html	2011-05-20 01:13:38 UTC (rev 86915)
@@ -30,6 +30,20 @@
     selectElement.style.display = '';
     selectElement.multiple = true;
     shouldBe("selectElement.selectedIndex", "0");
+
+    // Test resetting the multiple attribute.
+    selectElement = document.getElementsByTagName('select')[4];
+    shouldBe("selectElement.options[0].selected", "true");
+    shouldBe("selectElement.options[1].selected", "true");
+    shouldBe("selectElement.options[2].selected", "false");
+    selectElement.multiple = true;
+    shouldBe("selectElement.options[0].selected", "true");
+    shouldBe("selectElement.options[1].selected", "true");
+    shouldBe("selectElement.options[2].selected", "false");
+    selectElement.multiple = false;
+    shouldBe("selectElement.options[0].selected", "true");
+    shouldBe("selectElement.options[1].selected", "false");
+    shouldBe("selectElement.options[2].selected", "false");
 }
 </script>
 <body _onload_="go()"> 
@@ -53,6 +67,11 @@
         <option id="opt2" value="2">2</option>
         <option id="opt2" value="3">3</option> 
     </select>
+    <select multiple="true"> 
+        <option id="opt1" value="1" selected="selected">1</option> 
+        <option id="opt2" value="2" selected="selected">2</option>
+        <option id="opt2" value="3">3</option> 
+    </select>
     <div id="console"></div>
 </body>
 </html> 

Modified: branches/safari-534.36-branch/Source/WebCore/ChangeLog (86914 => 86915)


--- branches/safari-534.36-branch/Source/WebCore/ChangeLog	2011-05-20 01:13:36 UTC (rev 86914)
+++ branches/safari-534.36-branch/Source/WebCore/ChangeLog	2011-05-20 01:13:38 UTC (rev 86915)
@@ -1,5 +1,20 @@
 2011-05-19  Lucas Forschler  <[email protected]
 
+    Merged r86827.
+        
+    2011-05-19  Emil A Eklund  <[email protected]>
+
+        Reviewed by Alexey Proskuryakov.
+
+        REGRESSION (r80808): Multiple <select> - Selection reset to first element from multiple selected ones
+        https://bugs.webkit.org/show_bug.cgi?id=60986
+
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::setMultiple):
+        Don't restore selection if the multiple attribute hasn't changed.
+
+2011-05-19  Lucas Forschler  <[email protected]
+
     Merged r86785.
     
     2011-05-18  Oliver Hunt  <[email protected]>

Modified: branches/safari-534.36-branch/Source/WebCore/html/HTMLSelectElement.cpp (86914 => 86915)


--- branches/safari-534.36-branch/Source/WebCore/html/HTMLSelectElement.cpp	2011-05-20 01:13:36 UTC (rev 86914)
+++ branches/safari-534.36-branch/Source/WebCore/html/HTMLSelectElement.cpp	2011-05-20 01:13:38 UTC (rev 86915)
@@ -434,12 +434,14 @@
     
 void HTMLSelectElement::setMultiple(bool multiple)
 {
+    bool oldMultiple = this->multiple();
     int oldSelectedIndex = selectedIndex();
     setAttribute(multipleAttr, multiple ? "" : 0);
 
     // Restore selectedIndex after changing the multiple flag to preserve
     // selection as single-line and multi-line has different defaults.
-    setSelectedIndex(oldSelectedIndex);
+    if (oldMultiple != this->multiple())
+        setSelectedIndex(oldSelectedIndex);
 }
 
 void HTMLSelectElement::setSize(int size)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to