|
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_RootAccessible_h__ |
|
7 #define mozilla_a11y_RootAccessible_h__ |
|
8 |
|
9 #include "HyperTextAccessible.h" |
|
10 #include "DocAccessibleWrap.h" |
|
11 |
|
12 #include "nsIDOMEventListener.h" |
|
13 |
|
14 class nsIDocument; |
|
15 |
|
16 namespace mozilla { |
|
17 namespace a11y { |
|
18 |
|
19 class RootAccessible : public DocAccessibleWrap, |
|
20 public nsIDOMEventListener |
|
21 { |
|
22 NS_DECL_ISUPPORTS_INHERITED |
|
23 |
|
24 public: |
|
25 RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent, |
|
26 nsIPresShell* aPresShell); |
|
27 virtual ~RootAccessible(); |
|
28 |
|
29 // nsIDOMEventListener |
|
30 NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); |
|
31 |
|
32 // Accessible |
|
33 virtual void Shutdown(); |
|
34 virtual mozilla::a11y::ENameValueFlag Name(nsString& aName); |
|
35 virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; |
|
36 virtual mozilla::a11y::role NativeRole(); |
|
37 virtual uint64_t NativeState(); |
|
38 |
|
39 // RootAccessible |
|
40 |
|
41 /** |
|
42 * Notify that the sub document presshell was activated. |
|
43 */ |
|
44 virtual void DocumentActivated(DocAccessible* aDocument); |
|
45 |
|
46 protected: |
|
47 |
|
48 /** |
|
49 * Add/remove DOM event listeners. |
|
50 */ |
|
51 virtual nsresult AddEventListeners(); |
|
52 virtual nsresult RemoveEventListeners(); |
|
53 |
|
54 /** |
|
55 * Process the DOM event. |
|
56 */ |
|
57 void ProcessDOMEvent(nsIDOMEvent* aEvent); |
|
58 |
|
59 /** |
|
60 * Process "popupshown" event. Used by HandleEvent(). |
|
61 */ |
|
62 void HandlePopupShownEvent(Accessible* aAccessible); |
|
63 |
|
64 /* |
|
65 * Process "popuphiding" event. Used by HandleEvent(). |
|
66 */ |
|
67 void HandlePopupHidingEvent(nsINode* aNode); |
|
68 |
|
69 #ifdef MOZ_XUL |
|
70 void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent, |
|
71 XULTreeAccessible* aAccessible); |
|
72 void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent, |
|
73 XULTreeAccessible* aAccessible); |
|
74 |
|
75 uint32_t GetChromeFlags(); |
|
76 #endif |
|
77 }; |
|
78 |
|
79 inline RootAccessible* |
|
80 Accessible::AsRoot() |
|
81 { |
|
82 return IsRoot() ? static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr; |
|
83 } |
|
84 |
|
85 } // namespace a11y |
|
86 } // namespace mozilla |
|
87 |
|
88 #endif |