Bug 1258228 - create special child accessibles in owner's constructor, part3, r=marcoz
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 31 Mar 2016 21:22:56 -0400
changeset 291171 cc5e38a943bb74b37182f5650bd12e2cfc0bac26
parent 291170 ed20f4a35b9a213167c869e93a30fc85ee9d78f4
child 291172 2724b036ed2b3a3bab2987a563ccc7fc64488618
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarcoz
bugs1258228
milestone48.0a1
Bug 1258228 - create special child accessibles in owner's constructor, part3, r=marcoz
accessible/html/HTMLSelectAccessible.cpp
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -332,16 +332,26 @@ HTMLSelectOptGroupAccessible::DoAction(u
 ////////////////////////////////////////////////////////////////////////////////
 
 HTMLComboboxAccessible::
   HTMLComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
   AccessibleWrap(aContent, aDoc)
 {
   mType = eHTMLComboboxType;
   mGenericTypes |= eCombobox;
+
+  nsIComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
+  if (comboFrame) {
+    nsIFrame* listFrame = comboFrame->GetDropDown();
+    if (listFrame) {
+      mListAccessible = new HTMLComboboxListAccessible(mParent, mContent, mDoc);
+      Document()->BindToDocument(mListAccessible, nullptr);
+      AppendChild(mListAccessible);
+    }
+  }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // HTMLComboboxAccessible: Accessible
 
 role
 HTMLComboboxAccessible::NativeRole()
 {
@@ -357,36 +367,16 @@ HTMLComboboxAccessible::RemoveChild(Acce
     return true;
   }
   return false;
 }
 
 void
 HTMLComboboxAccessible::CacheChildren()
 {
-  nsIComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
-  if (!comboFrame)
-    return;
-
-  nsIFrame* listFrame = comboFrame->GetDropDown();
-  if (!listFrame)
-    return;
-
-  if (!mListAccessible) {
-    mListAccessible = new HTMLComboboxListAccessible(mParent, mContent, mDoc);
-
-    // Initialize and put into cache.
-    Document()->BindToDocument(mListAccessible, nullptr);
-  }
-
-  if (AppendChild(mListAccessible)) {
-    // Cache combobox option accessibles so that we build complete accessible
-    // tree for combobox.
-    mListAccessible->EnsureChildren();
-  }
 }
 
 void
 HTMLComboboxAccessible::Shutdown()
 {
   MOZ_ASSERT(mDoc->IsDefunct() || !mListAccessible);
   if (mListAccessible) {
     mListAccessible->Shutdown();