/work/obj-fuzz/dist/include/mozilla/a11y/DocAccessibleChildBase.h
Line | Count | Source (jump to first uncovered line) |
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_DocAccessibleChildBase_h |
8 | | #define mozilla_a11y_DocAccessibleChildBase_h |
9 | | |
10 | | #include "mozilla/a11y/DocAccessible.h" |
11 | | #include "mozilla/a11y/PDocAccessibleChild.h" |
12 | | #include "mozilla/Unused.h" |
13 | | #include "nsISupportsImpl.h" |
14 | | |
15 | | namespace mozilla { |
16 | | namespace a11y { |
17 | | |
18 | | class Accessible; |
19 | | class AccShowEvent; |
20 | | |
21 | | class DocAccessibleChildBase : public PDocAccessibleChild |
22 | | { |
23 | | public: |
24 | | explicit DocAccessibleChildBase(DocAccessible* aDoc) |
25 | | : mDoc(aDoc) |
26 | 0 | { |
27 | 0 | MOZ_COUNT_CTOR(DocAccessibleChildBase); |
28 | 0 | } |
29 | | |
30 | | ~DocAccessibleChildBase() |
31 | 0 | { |
32 | 0 | // Shutdown() should have been called, but maybe it isn't if the process is |
33 | 0 | // killed? |
34 | 0 | MOZ_ASSERT(!mDoc); |
35 | 0 | if (mDoc) { |
36 | 0 | mDoc->SetIPCDoc(nullptr); |
37 | 0 | } |
38 | 0 |
|
39 | 0 | MOZ_COUNT_DTOR(DocAccessibleChildBase); |
40 | 0 | } |
41 | | |
42 | | virtual void Shutdown() |
43 | 0 | { |
44 | 0 | DetachDocument(); |
45 | 0 | SendShutdown(); |
46 | 0 | } |
47 | | |
48 | | /** |
49 | | * Serializes a shown tree and sends it to the chrome process. |
50 | | */ |
51 | | void InsertIntoIpcTree(Accessible* aParent, |
52 | | Accessible* aChild, uint32_t aIdxInParent); |
53 | | void ShowEvent(AccShowEvent* aShowEvent); |
54 | | |
55 | | virtual void ActorDestroy(ActorDestroyReason) override |
56 | 0 | { |
57 | 0 | if (!mDoc) { |
58 | 0 | return; |
59 | 0 | } |
60 | 0 | |
61 | 0 | mDoc->SetIPCDoc(nullptr); |
62 | 0 | mDoc = nullptr; |
63 | 0 | } |
64 | | |
65 | | protected: |
66 | | static uint32_t InterfacesFor(Accessible* aAcc); |
67 | | static void SerializeTree(Accessible* aRoot, nsTArray<AccessibleData>& aTree); |
68 | | |
69 | | virtual void MaybeSendShowEvent(ShowEventData& aData, bool aFromUser) |
70 | 0 | { Unused << SendShowEvent(aData, aFromUser); } |
71 | | |
72 | | void DetachDocument() |
73 | 0 | { |
74 | 0 | if (mDoc) { |
75 | 0 | mDoc->SetIPCDoc(nullptr); |
76 | 0 | mDoc = nullptr; |
77 | 0 | } |
78 | 0 | } |
79 | | |
80 | | DocAccessible* mDoc; |
81 | | }; |
82 | | |
83 | | } // namespace a11y |
84 | | } // namespace mozilla |
85 | | |
86 | | #endif // mozilla_a11y_DocAccessibleChildBase_h |