tor-browser

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

OuterDocAccessible.h (2731B)


      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 
      6 #ifndef MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
      7 #define MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
      8 
      9 #include "AccessibleWrap.h"
     10 
     11 namespace mozilla {
     12 
     13 namespace dom {
     14 class BrowserBridgeChild;
     15 }
     16 
     17 namespace a11y {
     18 class DocAccessibleParent;
     19 
     20 /**
     21 * Used for <browser>, <frame>, <iframe>, <page> or editor> elements.
     22 *
     23 * In these variable names, "outer" relates to the OuterDocAccessible as
     24 * opposed to the DocAccessibleWrap which is "inner". The outer node is
     25 * a something like tags listed above, whereas the inner node corresponds to
     26 * the inner document root.
     27 */
     28 
     29 class OuterDocAccessible final : public AccessibleWrap {
     30 public:
     31  OuterDocAccessible(nsIContent* aContent, DocAccessible* aDoc);
     32 
     33  NS_INLINE_DECL_REFCOUNTING_INHERITED(OuterDocAccessible, AccessibleWrap)
     34 
     35  DocAccessibleParent* RemoteChildDoc() const;
     36 
     37  /**
     38   * For iframes in a content process which will be rendered in another content
     39   * process, tell the parent process about this OuterDocAccessible
     40   * so it can link the trees together when the embedded document is added.
     41   * Note that an OuterDocAccessible can be created before the
     42   * BrowserBridgeChild or vice versa. Therefore, this must be conditionally
     43   * called when either of these is created.
     44   */
     45  void SendEmbedderAccessible(dom::BrowserBridgeChild* aBridge);
     46 
     47  Maybe<nsMargin> GetCrossDocOffset() { return mCrossDocOffset; }
     48 
     49  void SetCrossDocOffset(nsMargin aMargin) { mCrossDocOffset = Some(aMargin); }
     50 
     51  // LocalAccessible
     52  virtual void Shutdown() override;
     53  virtual mozilla::a11y::role NativeRole() const override;
     54  virtual LocalAccessible* LocalChildAtPoint(
     55      int32_t aX, int32_t aY, EWhichChildAtPoint aWhichChild) override;
     56 
     57  virtual bool InsertChildAt(uint32_t aIdx, LocalAccessible* aChild) override;
     58  virtual bool RemoveChild(LocalAccessible* aAccessible) override;
     59  virtual bool IsAcceptableChild(nsIContent* aEl) const override;
     60 
     61  virtual uint32_t ChildCount() const override;
     62 
     63  // Accessible
     64  virtual Accessible* ChildAt(uint32_t aIndex) const override;
     65  virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
     66                                   EWhichChildAtPoint aWhichChild) override;
     67 
     68 protected:
     69  virtual ~OuterDocAccessible() override;
     70  Maybe<nsMargin> mCrossDocOffset;
     71 };
     72 
     73 inline OuterDocAccessible* LocalAccessible::AsOuterDoc() {
     74  return IsOuterDoc() ? static_cast<OuterDocAccessible*>(this) : nullptr;
     75 }
     76 
     77 }  // namespace a11y
     78 }  // namespace mozilla
     79 
     80 #endif