Bug 893909 - Part f: Cleanup HTMLSelectElement::IsOptionSelectedByIndex; r=dzbarsky
authorMs2ger <ms2ger@gmail.com>
Wed, 24 Jul 2013 09:37:03 +0200
changeset 151944 39fc7ef972b870e356ed4e9d6a371463226f9224
parent 151943 3ec0906fcf685eb6121323113901a946bcd713b9
child 151945 1f1718431c33aecaf83067ad433670243c1fc277
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdzbarsky
bugs893909
milestone25.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 893909 - Part f: Cleanup HTMLSelectElement::IsOptionSelectedByIndex; r=dzbarsky
content/html/content/src/HTMLSelectElement.cpp
--- a/content/html/content/src/HTMLSelectElement.cpp
+++ b/content/html/content/src/HTMLSelectElement.cpp
@@ -811,22 +811,18 @@ HTMLSelectElement::GetOptionIndex(nsIDOM
 {
   nsCOMPtr<nsINode> option = do_QueryInterface(aOption);
   return mOptions->GetOptionIndex(option->AsElement(), aStartIndex, aForward, aIndex);
 }
 
 bool
 HTMLSelectElement::IsOptionSelectedByIndex(int32_t aIndex)
 {
-  nsIDOMHTMLOptionElement* option = mOptions->ItemAsOption(aIndex);
-  bool isSelected = false;
-  if (option) {
-    option->GetSelected(&isSelected);
-  }
-  return isSelected;
+  HTMLOptionElement* option = Item(static_cast<uint32_t>(aIndex));
+  return option && option->Selected();
 }
 
 void
 HTMLSelectElement::OnOptionSelected(nsISelectControlFrame* aSelectFrame,
                                     int32_t aIndex,
                                     bool aSelected,
                                     bool aChangeOptionState,
                                     bool aNotify)