1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/src/generic/RootAccessible.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,88 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef mozilla_a11y_RootAccessible_h__ 1.10 +#define mozilla_a11y_RootAccessible_h__ 1.11 + 1.12 +#include "HyperTextAccessible.h" 1.13 +#include "DocAccessibleWrap.h" 1.14 + 1.15 +#include "nsIDOMEventListener.h" 1.16 + 1.17 +class nsIDocument; 1.18 + 1.19 +namespace mozilla { 1.20 +namespace a11y { 1.21 + 1.22 +class RootAccessible : public DocAccessibleWrap, 1.23 + public nsIDOMEventListener 1.24 +{ 1.25 + NS_DECL_ISUPPORTS_INHERITED 1.26 + 1.27 +public: 1.28 + RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent, 1.29 + nsIPresShell* aPresShell); 1.30 + virtual ~RootAccessible(); 1.31 + 1.32 + // nsIDOMEventListener 1.33 + NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); 1.34 + 1.35 + // Accessible 1.36 + virtual void Shutdown(); 1.37 + virtual mozilla::a11y::ENameValueFlag Name(nsString& aName); 1.38 + virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; 1.39 + virtual mozilla::a11y::role NativeRole(); 1.40 + virtual uint64_t NativeState(); 1.41 + 1.42 + // RootAccessible 1.43 + 1.44 + /** 1.45 + * Notify that the sub document presshell was activated. 1.46 + */ 1.47 + virtual void DocumentActivated(DocAccessible* aDocument); 1.48 + 1.49 +protected: 1.50 + 1.51 + /** 1.52 + * Add/remove DOM event listeners. 1.53 + */ 1.54 + virtual nsresult AddEventListeners(); 1.55 + virtual nsresult RemoveEventListeners(); 1.56 + 1.57 + /** 1.58 + * Process the DOM event. 1.59 + */ 1.60 + void ProcessDOMEvent(nsIDOMEvent* aEvent); 1.61 + 1.62 + /** 1.63 + * Process "popupshown" event. Used by HandleEvent(). 1.64 + */ 1.65 + void HandlePopupShownEvent(Accessible* aAccessible); 1.66 + 1.67 + /* 1.68 + * Process "popuphiding" event. Used by HandleEvent(). 1.69 + */ 1.70 + void HandlePopupHidingEvent(nsINode* aNode); 1.71 + 1.72 +#ifdef MOZ_XUL 1.73 + void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent, 1.74 + XULTreeAccessible* aAccessible); 1.75 + void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent, 1.76 + XULTreeAccessible* aAccessible); 1.77 + 1.78 + uint32_t GetChromeFlags(); 1.79 +#endif 1.80 +}; 1.81 + 1.82 +inline RootAccessible* 1.83 +Accessible::AsRoot() 1.84 +{ 1.85 + return IsRoot() ? static_cast<mozilla::a11y::RootAccessible*>(this) : nullptr; 1.86 +} 1.87 + 1.88 +} // namespace a11y 1.89 +} // namespace mozilla 1.90 + 1.91 +#endif