Bug 1883888 [wpt PR 44943] - Name unhandledrejection event correctly, a=testonly
[gecko.git] / accessible / generic / OuterDocAccessible.h
blob6c16d69124435288fe999701c2f207f29f7acb4e
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/. */
6 #ifndef MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
7 #define MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
9 #include "AccessibleWrap.h"
11 namespace mozilla {
13 namespace dom {
14 class BrowserBridgeChild;
17 namespace a11y {
18 class DocAccessibleParent;
20 /**
21 * Used for <browser>, <frame>, <iframe>, <page> or editor> elements.
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.
29 class OuterDocAccessible final : public AccessibleWrap {
30 public:
31 OuterDocAccessible(nsIContent* aContent, DocAccessible* aDoc);
33 NS_INLINE_DECL_REFCOUNTING_INHERITED(OuterDocAccessible, AccessibleWrap)
35 DocAccessibleParent* RemoteChildDoc() const;
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.
45 void SendEmbedderAccessible(dom::BrowserBridgeChild* aBridge);
47 Maybe<nsMargin> GetCrossDocOffset() { return mCrossDocOffset; }
49 void SetCrossDocOffset(nsMargin aMargin) { mCrossDocOffset = Some(aMargin); }
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;
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;
61 virtual uint32_t ChildCount() const override;
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;
68 protected:
69 virtual ~OuterDocAccessible() override;
70 Maybe<nsMargin> mCrossDocOffset;
73 inline OuterDocAccessible* LocalAccessible::AsOuterDoc() {
74 return IsOuterDoc() ? static_cast<OuterDocAccessible*>(this) : nullptr;
77 } // namespace a11y
78 } // namespace mozilla
80 #endif