michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_a11y_RootAccessible_h__ michael@0: #define mozilla_a11y_RootAccessible_h__ michael@0: michael@0: #include "HyperTextAccessible.h" michael@0: #include "DocAccessibleWrap.h" michael@0: michael@0: #include "nsIDOMEventListener.h" michael@0: michael@0: class nsIDocument; michael@0: michael@0: namespace mozilla { michael@0: namespace a11y { michael@0: michael@0: class RootAccessible : public DocAccessibleWrap, michael@0: public nsIDOMEventListener michael@0: { michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: michael@0: public: michael@0: RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent, michael@0: nsIPresShell* aPresShell); michael@0: virtual ~RootAccessible(); michael@0: michael@0: // nsIDOMEventListener michael@0: NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent); michael@0: michael@0: // Accessible michael@0: virtual void Shutdown(); michael@0: virtual mozilla::a11y::ENameValueFlag Name(nsString& aName); michael@0: virtual Relation RelationByType(RelationType aType) MOZ_OVERRIDE; michael@0: virtual mozilla::a11y::role NativeRole(); michael@0: virtual uint64_t NativeState(); michael@0: michael@0: // RootAccessible michael@0: michael@0: /** michael@0: * Notify that the sub document presshell was activated. michael@0: */ michael@0: virtual void DocumentActivated(DocAccessible* aDocument); michael@0: michael@0: protected: michael@0: michael@0: /** michael@0: * Add/remove DOM event listeners. michael@0: */ michael@0: virtual nsresult AddEventListeners(); michael@0: virtual nsresult RemoveEventListeners(); michael@0: michael@0: /** michael@0: * Process the DOM event. michael@0: */ michael@0: void ProcessDOMEvent(nsIDOMEvent* aEvent); michael@0: michael@0: /** michael@0: * Process "popupshown" event. Used by HandleEvent(). michael@0: */ michael@0: void HandlePopupShownEvent(Accessible* aAccessible); michael@0: michael@0: /* michael@0: * Process "popuphiding" event. Used by HandleEvent(). michael@0: */ michael@0: void HandlePopupHidingEvent(nsINode* aNode); michael@0: michael@0: #ifdef MOZ_XUL michael@0: void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent, michael@0: XULTreeAccessible* aAccessible); michael@0: void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent, michael@0: XULTreeAccessible* aAccessible); michael@0: michael@0: uint32_t GetChromeFlags(); michael@0: #endif michael@0: }; michael@0: michael@0: inline RootAccessible* michael@0: Accessible::AsRoot() michael@0: { michael@0: return IsRoot() ? static_cast(this) : nullptr; michael@0: } michael@0: michael@0: } // namespace a11y michael@0: } // namespace mozilla michael@0: michael@0: #endif