bug 920738 - don't unbind accessibles in XULTextFieldAccessible::CacheChildren() r=surkov
authorTrevor Saunders <trev.saunders@gmail.com>
Wed, 25 Sep 2013 16:30:00 -0400
changeset 149379 254f4bfb92fe4273d2ca9ba4c75a5b0b090c8062
parent 149378 e0994d28e8b301a3e9c2688b05cbe23d251aa86b
child 149380 5788132639b454ef8d253bfdd7d99d658bbc68be
push id25386
push useremorley@mozilla.com
push dateTue, 01 Oct 2013 09:29:22 +0000
treeherdermozilla-central@6856c45f3688 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs920738
milestone27.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 920738 - don't unbind accessibles in XULTextFieldAccessible::CacheChildren() r=surkov
accessible/src/xul/XULFormControlAccessible.cpp
accessible/src/xul/XULFormControlAccessible.h
--- a/accessible/src/xul/XULFormControlAccessible.cpp
+++ b/accessible/src/xul/XULFormControlAccessible.cpp
@@ -763,16 +763,25 @@ XULTextFieldAccessible::DoAction(uint8_t
 }
 
 bool
 XULTextFieldAccessible::CanHaveAnonChildren()
 {
   return false;
 }
 
+bool
+XULTextFieldAccessible::IsAcceptableChild(Accessible* aPossibleChild) const
+{
+  // XXX: entry shouldn't contain anything but text leafs. Currently it may
+  // contain a trailing fake HTML br element added for layout needs. We don't
+  // need to expose it since it'd be confusing for AT.
+  return aPossibleChild->IsTextLeaf();
+}
+
 already_AddRefed<nsIEditor>
 XULTextFieldAccessible::GetEditor() const
 {
   nsCOMPtr<nsIContent> inputField = GetInputField();
   nsCOMPtr<nsIDOMNSEditableElement> editableElt(do_QueryInterface(inputField));
   if (!editableElt)
     return nullptr;
 
@@ -789,27 +798,19 @@ XULTextFieldAccessible::CacheChildren()
 {
   NS_ENSURE_TRUE_VOID(mDoc);
   // Create child accessibles for native anonymous content of underlying HTML
   // input element.
   nsCOMPtr<nsIContent> inputContent(GetInputField());
   if (!inputContent)
     return;
 
-  // XXX: entry shouldn't contain anything but text leafs. Currently it may
-  // contain a trailing fake HTML br element added for layout needs. We don't
-  // need to expose it since it'd be confusing for AT.
   TreeWalker walker(this, inputContent);
-  Accessible* child = nullptr;
-  while ((child = walker.NextChild())) {
-    if (child->IsTextLeaf())
-      AppendChild(child);
-    else
-      Document()->UnbindFromDocument(child);
-  }
+  while (Accessible* child = walker.NextChild())
+    AppendChild(child);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTextFieldAccessible: HyperTextAccessible protected
 
 already_AddRefed<nsFrameSelection>
 XULTextFieldAccessible::FrameSelection()
 {
--- a/accessible/src/xul/XULFormControlAccessible.h
+++ b/accessible/src/xul/XULFormControlAccessible.h
@@ -235,16 +235,17 @@ public:
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
   // Accessible
   virtual void Value(nsString& aValue);
   virtual void ApplyARIAState(uint64_t* aState) const;
   virtual mozilla::a11y::role NativeRole();
   virtual uint64_t NativeState();
   virtual bool CanHaveAnonChildren();
+  virtual bool IsAcceptableChild(Accessible* aPossibleChild) const MOZ_OVERRIDE;
 
   // ActionAccessible
   virtual uint8_t ActionCount();
 
 protected:
   // Accessible
   virtual void CacheChildren();