tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

MsaaDocAccessible.h (2109B)


      1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      2 /* vim: set ts=2 et sw=2 tw=80: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 #ifndef mozilla_a11y_MsaaDocAccessible_h__
      8 #define mozilla_a11y_MsaaDocAccessible_h__
      9 
     10 #include "ia2AccessibleHypertext.h"
     11 #include "nsTHashMap.h"
     12 
     13 namespace mozilla {
     14 
     15 namespace a11y {
     16 class Accessible;
     17 class DocAccessible;
     18 class DocAccessibleParent;
     19 
     20 class MsaaDocAccessible : public ia2AccessibleHypertext {
     21 public:
     22  DocAccessible* DocAcc();
     23 
     24  // IUnknown
     25  DECL_IUNKNOWN_INHERITED
     26  IMPL_IUNKNOWN_REFCOUNTING_INHERITED(ia2AccessibleHypertext)
     27 
     28  // IAccessible
     29 
     30  // Override get_accParent for e10s
     31  virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accParent(
     32      /* [retval][out] */ IDispatch __RPC_FAR* __RPC_FAR* ppdispParent)
     33      override;
     34 
     35  // Override get_accValue to provide URL when no other value is available
     36  virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue(
     37      /* [optional][in] */ VARIANT varChild,
     38      /* [retval][out] */ BSTR __RPC_FAR* pszValue) override;
     39 
     40  /**
     41   * Manage the mapping from id to Accessible.
     42   */
     43  void AddID(uint32_t aID, Accessible* aAcc) {
     44    mIDToAccessibleMap.InsertOrUpdate(aID, aAcc);
     45  }
     46  void RemoveID(uint32_t aID) { mIDToAccessibleMap.Remove(aID); }
     47  Accessible* GetAccessibleByID(uint32_t aID) const {
     48    return mIDToAccessibleMap.Get(aID);
     49  }
     50 
     51  static MsaaDocAccessible* GetFrom(DocAccessible* aDoc);
     52  static MsaaDocAccessible* GetFrom(DocAccessibleParent* aDoc);
     53 
     54  /**
     55   * Get the MsaaDocAccessible for the document which owns the given Accessible.
     56   */
     57  static MsaaDocAccessible* GetFromOwned(Accessible* aAcc);
     58 
     59 protected:
     60  using ia2AccessibleHypertext::ia2AccessibleHypertext;
     61 
     62  /*
     63   * This provides a mapping from 32 bit id to accessible objects.
     64   */
     65  nsTHashMap<nsUint32HashKey, Accessible*> mIDToAccessibleMap;
     66 };
     67 
     68 }  // namespace a11y
     69 }  // namespace mozilla
     70 
     71 #endif