DocAccessible.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_a11y_DocAccessible_h__
  6. #define mozilla_a11y_DocAccessible_h__
  7. #include "nsIAccessiblePivot.h"
  8. #include "HyperTextAccessibleWrap.h"
  9. #include "AccEvent.h"
  10. #include "nsAutoPtr.h"
  11. #include "nsClassHashtable.h"
  12. #include "nsDataHashtable.h"
  13. #include "nsIDocument.h"
  14. #include "nsIDocumentObserver.h"
  15. #include "nsIEditor.h"
  16. #include "nsIObserver.h"
  17. #include "nsIScrollPositionListener.h"
  18. #include "nsITimer.h"
  19. #include "nsIWeakReference.h"
  20. class nsAccessiblePivot;
  21. const uint32_t kDefaultCacheLength = 128;
  22. namespace mozilla {
  23. namespace a11y {
  24. class DocManager;
  25. class NotificationController;
  26. class DocAccessibleChild;
  27. class RelatedAccIterator;
  28. template<class Class, class ... Args>
  29. class TNotification;
  30. class DocAccessible : public HyperTextAccessibleWrap,
  31. public nsIDocumentObserver,
  32. public nsIObserver,
  33. public nsIScrollPositionListener,
  34. public nsSupportsWeakReference,
  35. public nsIAccessiblePivotObserver
  36. {
  37. NS_DECL_ISUPPORTS_INHERITED
  38. NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(DocAccessible, Accessible)
  39. NS_DECL_NSIOBSERVER
  40. NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
  41. public:
  42. DocAccessible(nsIDocument* aDocument, nsIPresShell* aPresShell);
  43. // nsIScrollPositionListener
  44. virtual void ScrollPositionWillChange(nscoord aX, nscoord aY) override {}
  45. virtual void ScrollPositionDidChange(nscoord aX, nscoord aY) override;
  46. // nsIDocumentObserver
  47. NS_DECL_NSIDOCUMENTOBSERVER
  48. // Accessible
  49. virtual void Init();
  50. virtual void Shutdown() override;
  51. virtual nsIFrame* GetFrame() const override;
  52. virtual nsINode* GetNode() const override { return mDocumentNode; }
  53. nsIDocument* DocumentNode() const { return mDocumentNode; }
  54. virtual mozilla::a11y::ENameValueFlag Name(nsString& aName) override;
  55. virtual void Description(nsString& aDescription) override;
  56. virtual Accessible* FocusedChild() override;
  57. virtual mozilla::a11y::role NativeRole() override;
  58. virtual uint64_t NativeState() override;
  59. virtual uint64_t NativeInteractiveState() const override;
  60. virtual bool NativelyUnavailable() const override;
  61. virtual void ApplyARIAState(uint64_t* aState) const override;
  62. virtual already_AddRefed<nsIPersistentProperties> Attributes() override;
  63. virtual void TakeFocus() override;
  64. #ifdef A11Y_LOG
  65. virtual nsresult HandleAccEvent(AccEvent* aEvent) override;
  66. #endif
  67. virtual nsRect RelativeBounds(nsIFrame** aRelativeFrame) const override;
  68. // HyperTextAccessible
  69. virtual already_AddRefed<nsIEditor> GetEditor() const override;
  70. // DocAccessible
  71. /**
  72. * Return document URL.
  73. */
  74. void URL(nsAString& aURL) const;
  75. /**
  76. * Return DOM document title.
  77. */
  78. void Title(nsString& aTitle) const { mDocumentNode->GetTitle(aTitle); }
  79. /**
  80. * Return DOM document mime type.
  81. */
  82. void MimeType(nsAString& aType) const { mDocumentNode->GetContentType(aType); }
  83. /**
  84. * Return DOM document type.
  85. */
  86. void DocType(nsAString& aType) const;
  87. /**
  88. * Return virtual cursor associated with the document.
  89. */
  90. nsIAccessiblePivot* VirtualCursor();
  91. /**
  92. * Return presentation shell for this document accessible.
  93. */
  94. nsIPresShell* PresShell() const { return mPresShell; }
  95. /**
  96. * Return the presentation shell's context.
  97. */
  98. nsPresContext* PresContext() const { return mPresShell->GetPresContext(); }
  99. /**
  100. * Return true if associated DOM document was loaded and isn't unloading.
  101. */
  102. bool IsContentLoaded() const
  103. {
  104. // eDOMLoaded flag check is used for error pages as workaround to make this
  105. // method return correct result since error pages do not receive 'pageshow'
  106. // event and as consequence nsIDocument::IsShowing() returns false.
  107. return mDocumentNode && mDocumentNode->IsVisible() &&
  108. (mDocumentNode->IsShowing() || HasLoadState(eDOMLoaded));
  109. }
  110. /**
  111. * Document load states.
  112. */
  113. enum LoadState {
  114. // initial tree construction is pending
  115. eTreeConstructionPending = 0,
  116. // initial tree construction done
  117. eTreeConstructed = 1,
  118. // DOM document is loaded.
  119. eDOMLoaded = 1 << 1,
  120. // document is ready
  121. eReady = eTreeConstructed | eDOMLoaded,
  122. // document and all its subdocuments are ready
  123. eCompletelyLoaded = eReady | 1 << 2
  124. };
  125. /**
  126. * Return true if the document has given document state.
  127. */
  128. bool HasLoadState(LoadState aState) const
  129. { return (mLoadState & static_cast<uint32_t>(aState)) ==
  130. static_cast<uint32_t>(aState); }
  131. /**
  132. * Return a native window handler or pointer depending on platform.
  133. */
  134. virtual void* GetNativeWindow() const;
  135. /**
  136. * Return the parent document.
  137. */
  138. DocAccessible* ParentDocument() const
  139. { return mParent ? mParent->Document() : nullptr; }
  140. /**
  141. * Return the child document count.
  142. */
  143. uint32_t ChildDocumentCount() const
  144. { return mChildDocuments.Length(); }
  145. /**
  146. * Return the child document at the given index.
  147. */
  148. DocAccessible* GetChildDocumentAt(uint32_t aIndex) const
  149. { return mChildDocuments.SafeElementAt(aIndex, nullptr); }
  150. /**
  151. * Fire accessible event asynchronously.
  152. */
  153. void FireDelayedEvent(AccEvent* aEvent);
  154. void FireDelayedEvent(uint32_t aEventType, Accessible* aTarget);
  155. void FireEventsOnInsertion(Accessible* aContainer);
  156. /**
  157. * Fire value change event on the given accessible if applicable.
  158. */
  159. void MaybeNotifyOfValueChange(Accessible* aAccessible);
  160. /**
  161. * Get/set the anchor jump.
  162. */
  163. Accessible* AnchorJump()
  164. { return GetAccessibleOrContainer(mAnchorJumpElm); }
  165. void SetAnchorJump(nsIContent* aTargetNode)
  166. { mAnchorJumpElm = aTargetNode; }
  167. /**
  168. * Bind the child document to the tree.
  169. */
  170. void BindChildDocument(DocAccessible* aDocument);
  171. /**
  172. * Process the generic notification.
  173. *
  174. * @note The caller must guarantee that the given instance still exists when
  175. * notification is processed.
  176. * @see NotificationController::HandleNotification
  177. */
  178. template<class Class, class Arg>
  179. void HandleNotification(Class* aInstance,
  180. typename TNotification<Class, Arg>::Callback aMethod,
  181. Arg* aArg);
  182. /**
  183. * Return the cached accessible by the given DOM node if it's in subtree of
  184. * this document accessible or the document accessible itself, otherwise null.
  185. *
  186. * @return the accessible object
  187. */
  188. Accessible* GetAccessible(nsINode* aNode) const
  189. {
  190. return aNode == mDocumentNode ?
  191. const_cast<DocAccessible*>(this) : mNodeToAccessibleMap.Get(aNode);
  192. }
  193. /**
  194. * Return an accessible for the given node even if the node is not in
  195. * document's node map cache (like HTML area element).
  196. *
  197. * XXX: it should be really merged with GetAccessible().
  198. */
  199. Accessible* GetAccessibleEvenIfNotInMap(nsINode* aNode) const;
  200. Accessible* GetAccessibleEvenIfNotInMapOrContainer(nsINode* aNode) const;
  201. /**
  202. * Return whether the given DOM node has an accessible or not.
  203. */
  204. bool HasAccessible(nsINode* aNode) const
  205. { return GetAccessible(aNode); }
  206. /**
  207. * Return the cached accessible by the given unique ID within this document.
  208. *
  209. * @note the unique ID matches with the uniqueID() of Accessible
  210. *
  211. * @param aUniqueID [in] the unique ID used to cache the node.
  212. */
  213. Accessible* GetAccessibleByUniqueID(void* aUniqueID)
  214. {
  215. return UniqueID() == aUniqueID ?
  216. this : mAccessibleCache.GetWeak(aUniqueID);
  217. }
  218. /**
  219. * Return the cached accessible by the given unique ID looking through
  220. * this and nested documents.
  221. */
  222. Accessible* GetAccessibleByUniqueIDInSubtree(void* aUniqueID);
  223. /**
  224. * Return an accessible for the given DOM node or container accessible if
  225. * the node is not accessible.
  226. */
  227. Accessible* GetAccessibleOrContainer(nsINode* aNode) const;
  228. /**
  229. * Return a container accessible for the given DOM node.
  230. */
  231. Accessible* GetContainerAccessible(nsINode* aNode) const
  232. {
  233. return aNode ? GetAccessibleOrContainer(aNode->GetParentNode()) : nullptr;
  234. }
  235. /**
  236. * Return an accessible for the given node if any, or an immediate accessible
  237. * container for it.
  238. */
  239. Accessible* AccessibleOrTrueContainer(nsINode* aNode) const;
  240. /**
  241. * Return an accessible for the given node or its first accessible descendant.
  242. */
  243. Accessible* GetAccessibleOrDescendant(nsINode* aNode) const;
  244. /**
  245. * Returns aria-owns seized child at the given index.
  246. */
  247. Accessible* ARIAOwnedAt(Accessible* aParent, uint32_t aIndex) const
  248. {
  249. nsTArray<RefPtr<Accessible> >* children = mARIAOwnsHash.Get(aParent);
  250. if (children) {
  251. return children->SafeElementAt(aIndex);
  252. }
  253. return nullptr;
  254. }
  255. uint32_t ARIAOwnedCount(Accessible* aParent) const
  256. {
  257. nsTArray<RefPtr<Accessible> >* children = mARIAOwnsHash.Get(aParent);
  258. return children ? children->Length() : 0;
  259. }
  260. /**
  261. * Return true if the given ID is referred by relation attribute.
  262. *
  263. * @note Different elements may share the same ID if they are hosted inside
  264. * XBL bindings. Be careful the result of this method may be senseless
  265. * while it's called for XUL elements (where XBL is used widely).
  266. */
  267. bool IsDependentID(const nsAString& aID) const
  268. { return mDependentIDsHash.Get(aID, nullptr); }
  269. /**
  270. * Initialize the newly created accessible and put it into document caches.
  271. *
  272. * @param aAccessible [in] created accessible
  273. * @param aRoleMapEntry [in] the role map entry role the ARIA role or nullptr
  274. * if none
  275. */
  276. void BindToDocument(Accessible* aAccessible,
  277. const nsRoleMapEntry* aRoleMapEntry);
  278. /**
  279. * Remove from document and shutdown the given accessible.
  280. */
  281. void UnbindFromDocument(Accessible* aAccessible);
  282. /**
  283. * Notify the document accessible that content was inserted.
  284. */
  285. void ContentInserted(nsIContent* aContainerNode,
  286. nsIContent* aStartChildNode,
  287. nsIContent* aEndChildNode);
  288. /**
  289. * Notify the document accessible that content was removed.
  290. */
  291. void ContentRemoved(Accessible* aContainer, nsIContent* aChildNode)
  292. {
  293. // Update the whole tree of this document accessible when the container is
  294. // null (document element is removed).
  295. UpdateTreeOnRemoval((aContainer ? aContainer : this), aChildNode);
  296. }
  297. void ContentRemoved(nsIContent* aContainerNode, nsIContent* aChildNode)
  298. {
  299. ContentRemoved(GetAccessibleOrContainer(aContainerNode), aChildNode);
  300. }
  301. /**
  302. * Updates accessible tree when rendered text is changed.
  303. */
  304. void UpdateText(nsIContent* aTextNode);
  305. /**
  306. * Recreate an accessible, results in hide/show events pair.
  307. */
  308. void RecreateAccessible(nsIContent* aContent);
  309. /**
  310. * Schedule ARIA owned element relocation if needed. Return true if relocation
  311. * was scheduled.
  312. */
  313. bool RelocateARIAOwnedIfNeeded(nsIContent* aEl);
  314. /**
  315. * Return a notification controller associated with the document.
  316. */
  317. NotificationController* Controller() const { return mNotificationController; }
  318. /**
  319. * If this document is in a content process return the object responsible for
  320. * communicating with the main process for it.
  321. */
  322. DocAccessibleChild* IPCDoc() const { return mIPCDoc; }
  323. protected:
  324. virtual ~DocAccessible();
  325. void LastRelease();
  326. // DocAccessible
  327. virtual nsresult AddEventListeners();
  328. virtual nsresult RemoveEventListeners();
  329. /**
  330. * Marks this document as loaded or loading.
  331. */
  332. void NotifyOfLoad(uint32_t aLoadEventType);
  333. void NotifyOfLoading(bool aIsReloading);
  334. friend class DocManager;
  335. /**
  336. * Perform initial update (create accessible tree).
  337. * Can be overridden by wrappers to prepare initialization work.
  338. */
  339. virtual void DoInitialUpdate();
  340. /**
  341. * Updates root element and picks up ARIA role on it if any.
  342. */
  343. void UpdateRootElIfNeeded();
  344. /**
  345. * Process document load notification, fire document load and state busy
  346. * events if applicable.
  347. */
  348. void ProcessLoad();
  349. /**
  350. * Add/remove scroll listeners, @see nsIScrollPositionListener interface.
  351. */
  352. void AddScrollListener();
  353. void RemoveScrollListener();
  354. /**
  355. * Append the given document accessible to this document's child document
  356. * accessibles.
  357. */
  358. bool AppendChildDocument(DocAccessible* aChildDocument)
  359. {
  360. return mChildDocuments.AppendElement(aChildDocument);
  361. }
  362. /**
  363. * Remove the given document accessible from this document's child document
  364. * accessibles.
  365. */
  366. void RemoveChildDocument(DocAccessible* aChildDocument)
  367. {
  368. mChildDocuments.RemoveElement(aChildDocument);
  369. }
  370. /**
  371. * Add dependent IDs pointed by accessible element by relation attribute to
  372. * cache. If the relation attribute is missed then all relation attributes
  373. * are checked.
  374. *
  375. * @param aRelProvider [in] accessible that element has relation attribute
  376. * @param aRelAttr [in, optional] relation attribute
  377. */
  378. void AddDependentIDsFor(Accessible* aRelProvider,
  379. nsIAtom* aRelAttr = nullptr);
  380. /**
  381. * Remove dependent IDs pointed by accessible element by relation attribute
  382. * from cache. If the relation attribute is absent then all relation
  383. * attributes are checked.
  384. *
  385. * @param aRelProvider [in] accessible that element has relation attribute
  386. * @param aRelAttr [in, optional] relation attribute
  387. */
  388. void RemoveDependentIDsFor(Accessible* aRelProvider,
  389. nsIAtom* aRelAttr = nullptr);
  390. /**
  391. * Update or recreate an accessible depending on a changed attribute.
  392. *
  393. * @param aElement [in] the element the attribute was changed on
  394. * @param aAttribute [in] the changed attribute
  395. * @return true if an action was taken on the attribute change
  396. */
  397. bool UpdateAccessibleOnAttrChange(mozilla::dom::Element* aElement,
  398. nsIAtom* aAttribute);
  399. /**
  400. * Fire accessible events when attribute is changed.
  401. *
  402. * @param aAccessible [in] accessible the DOM attribute is changed for
  403. * @param aNameSpaceID [in] namespace of changed attribute
  404. * @param aAttribute [in] changed attribute
  405. */
  406. void AttributeChangedImpl(Accessible* aAccessible,
  407. int32_t aNameSpaceID, nsIAtom* aAttribute);
  408. /**
  409. * Fire accessible events when ARIA attribute is changed.
  410. *
  411. * @param aAccessible [in] accesislbe the DOM attribute is changed for
  412. * @param aAttribute [in] changed attribute
  413. */
  414. void ARIAAttributeChanged(Accessible* aAccessible, nsIAtom* aAttribute);
  415. /**
  416. * Process ARIA active-descendant attribute change.
  417. */
  418. void ARIAActiveDescendantChanged(Accessible* aAccessible);
  419. /**
  420. * Update the accessible tree for inserted content.
  421. */
  422. void ProcessContentInserted(Accessible* aContainer,
  423. const nsTArray<nsCOMPtr<nsIContent> >* aInsertedContent);
  424. void ProcessContentInserted(Accessible* aContainer,
  425. nsIContent* aInsertedContent);
  426. /**
  427. * Used to notify the document to make it process the invalidation list.
  428. *
  429. * While children are cached we may encounter the case there's no accessible
  430. * for referred content by related accessible. Store these related nodes to
  431. * invalidate their containers later.
  432. */
  433. void ProcessInvalidationList();
  434. /**
  435. * Update the accessible tree for content removal.
  436. */
  437. void UpdateTreeOnRemoval(Accessible* aContainer, nsIContent* aChildNode);
  438. /**
  439. * Validates all aria-owns connections and updates the tree accordingly.
  440. */
  441. void ValidateARIAOwned();
  442. /**
  443. * Steals or puts back accessible subtrees.
  444. */
  445. void DoARIAOwnsRelocation(Accessible* aOwner);
  446. /**
  447. * Moves children back under their original parents.
  448. */
  449. void PutChildrenBack(nsTArray<RefPtr<Accessible> >* aChildren,
  450. uint32_t aStartIdx);
  451. bool MoveChild(Accessible* aChild, Accessible* aNewParent,
  452. int32_t aIdxInParent);
  453. /**
  454. * Create accessible tree.
  455. *
  456. * @param aRoot [in] a root of subtree to create
  457. * @param aFocusedAcc [in, optional] a focused accessible under created
  458. * subtree if any
  459. */
  460. void CacheChildrenInSubtree(Accessible* aRoot,
  461. Accessible** aFocusedAcc = nullptr);
  462. void CreateSubtree(Accessible* aRoot);
  463. /**
  464. * Remove accessibles in subtree from node to accessible map.
  465. */
  466. void UncacheChildrenInSubtree(Accessible* aRoot);
  467. /**
  468. * Shutdown any cached accessible in the subtree.
  469. *
  470. * @param aAccessible [in] the root of the subrtee to invalidate accessible
  471. * child/parent refs in
  472. */
  473. void ShutdownChildrenInSubtree(Accessible* aAccessible);
  474. /**
  475. * Return true if the document is a target of document loading events
  476. * (for example, state busy change or document reload events).
  477. *
  478. * Rules: The root chrome document accessible is never an event target
  479. * (for example, Firefox UI window). If the sub document is loaded within its
  480. * parent document then the parent document is a target only (aka events
  481. * coalescence).
  482. */
  483. bool IsLoadEventTarget() const;
  484. /*
  485. * Set the object responsible for communicating with the main process on
  486. * behalf of this document.
  487. */
  488. void SetIPCDoc(DocAccessibleChild* aIPCDoc) { mIPCDoc = aIPCDoc; }
  489. friend class DocAccessibleChildBase;
  490. /**
  491. * Used to fire scrolling end event after page scroll.
  492. *
  493. * @param aTimer [in] the timer object
  494. * @param aClosure [in] the document accessible where scrolling happens
  495. */
  496. static void ScrollTimerCallback(nsITimer* aTimer, void* aClosure);
  497. protected:
  498. /**
  499. * State and property flags, kept by mDocFlags.
  500. */
  501. enum {
  502. // Whether scroll listeners were added.
  503. eScrollInitialized = 1 << 0,
  504. // Whether the document is a tab document.
  505. eTabDocument = 1 << 1
  506. };
  507. /**
  508. * Cache of accessibles within this document accessible.
  509. */
  510. AccessibleHashtable mAccessibleCache;
  511. nsDataHashtable<nsPtrHashKey<const nsINode>, Accessible*>
  512. mNodeToAccessibleMap;
  513. nsIDocument* mDocumentNode;
  514. nsCOMPtr<nsITimer> mScrollWatchTimer;
  515. uint16_t mScrollPositionChangedTicks; // Used for tracking scroll events
  516. /**
  517. * Bit mask of document load states (@see LoadState).
  518. */
  519. uint32_t mLoadState : 3;
  520. /**
  521. * Bit mask of other states and props.
  522. */
  523. uint32_t mDocFlags : 28;
  524. /**
  525. * Type of document load event fired after the document is loaded completely.
  526. */
  527. uint32_t mLoadEventType;
  528. /**
  529. * Reference to anchor jump element.
  530. */
  531. nsCOMPtr<nsIContent> mAnchorJumpElm;
  532. /**
  533. * A generic state (see items below) before the attribute value was changed.
  534. * @see AttributeWillChange and AttributeChanged notifications.
  535. */
  536. union {
  537. // ARIA attribute value
  538. nsIAtom* mARIAAttrOldValue;
  539. // True if the accessible state bit was on
  540. bool mStateBitWasOn;
  541. };
  542. nsTArray<RefPtr<DocAccessible> > mChildDocuments;
  543. /**
  544. * The virtual cursor of the document.
  545. */
  546. RefPtr<nsAccessiblePivot> mVirtualCursor;
  547. /**
  548. * A storage class for pairing content with one of its relation attributes.
  549. */
  550. class AttrRelProvider
  551. {
  552. public:
  553. AttrRelProvider(nsIAtom* aRelAttr, nsIContent* aContent) :
  554. mRelAttr(aRelAttr), mContent(aContent) { }
  555. nsIAtom* mRelAttr;
  556. nsCOMPtr<nsIContent> mContent;
  557. private:
  558. AttrRelProvider();
  559. AttrRelProvider(const AttrRelProvider&);
  560. AttrRelProvider& operator =(const AttrRelProvider&);
  561. };
  562. /**
  563. * The cache of IDs pointed by relation attributes.
  564. */
  565. typedef nsTArray<nsAutoPtr<AttrRelProvider> > AttrRelProviderArray;
  566. nsClassHashtable<nsStringHashKey, AttrRelProviderArray>
  567. mDependentIDsHash;
  568. friend class RelatedAccIterator;
  569. /**
  570. * Used for our caching algorithm. We store the list of nodes that should be
  571. * invalidated.
  572. *
  573. * @see ProcessInvalidationList
  574. */
  575. nsTArray<RefPtr<nsIContent>> mInvalidationList;
  576. /**
  577. * Holds a list of aria-owns relocations.
  578. */
  579. nsClassHashtable<nsPtrHashKey<Accessible>, nsTArray<RefPtr<Accessible> > >
  580. mARIAOwnsHash;
  581. /**
  582. * Used to process notification from core and accessible events.
  583. */
  584. RefPtr<NotificationController> mNotificationController;
  585. friend class EventTree;
  586. friend class NotificationController;
  587. private:
  588. nsIPresShell* mPresShell;
  589. // Exclusively owned by IPDL so don't manually delete it!
  590. DocAccessibleChild* mIPCDoc;
  591. };
  592. inline DocAccessible*
  593. Accessible::AsDoc()
  594. {
  595. return IsDoc() ? static_cast<DocAccessible*>(this) : nullptr;
  596. }
  597. } // namespace a11y
  598. } // namespace mozilla
  599. #endif