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"
14 class BrowserBridgeChild
;
18 class DocAccessibleParent
;
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
{
31 OuterDocAccessible(nsIContent
* aContent
, DocAccessible
* aDoc
);
33 NS_INLINE_DECL_REFCOUNTING_INHERITED(OuterDocAccessible
, AccessibleWrap
)
35 DocAccessibleParent
* RemoteChildDoc() const;
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
); }
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
;
64 virtual Accessible
* ChildAt(uint32_t aIndex
) const override
;
65 virtual Accessible
* ChildAtPoint(int32_t aX
, int32_t aY
,
66 EWhichChildAtPoint aWhichChild
) override
;
69 virtual ~OuterDocAccessible() override
;
70 Maybe
<nsMargin
> mCrossDocOffset
;
73 inline OuterDocAccessible
* LocalAccessible::AsOuterDoc() {
74 return IsOuterDoc() ? static_cast<OuterDocAccessible
*>(this) : nullptr;
78 } // namespace mozilla