LayoutTests:
[WebKit-https.git] / WebCore / html / HTMLSelectElement.cpp
index 39c7602d5eca24214a142f6ec2a23a5c2cc514eb..837f18252eccc139ba3ac7ff205ba97e18eb0d3f 100644 (file)
@@ -562,8 +562,7 @@ void HTMLSelectElement::notifyOptionSelected(HTMLOptionElement* selectedOption,
     if (selected && !m_multiple)
         deselectItems(selectedOption);
 
-    if (renderer() && !usesMenuList())
-        static_cast<RenderListBox*>(renderer())->selectionChanged();
+    scrollToSelection();
 
     m_lastOnChangeIndex = selectedOption->index();
     setChanged(true);
@@ -821,7 +820,7 @@ void HTMLSelectElement::updateListBoxSelection(bool deselectOtherOptions)
         }
     }
 
-    static_cast<RenderListBox*>(renderer())->selectionChanged();
+    scrollToSelection();
 }
 
 void HTMLSelectElement::listBoxOnChange()
@@ -1008,4 +1007,10 @@ void HTMLSelectElement::setLength(unsigned newLen, ExceptionCode& ec)
             remove(newLen);
 }
 
+void HTMLSelectElement::scrollToSelection()
+{
+    if (renderer() && !usesMenuList())
+        static_cast<RenderListBox*>(renderer())->selectionChanged();
+}
+
 } // namespace