AccessibleWrap.h (2119B)
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_AccessibleWrap_h_ 7 #define mozilla_a11y_AccessibleWrap_h_ 8 9 #include "LocalAccessible.h" 10 #include "mozilla/a11y/RemoteAccessible.h" 11 #include "mozilla/java/GeckoBundleWrappers.h" 12 #include "nsCOMPtr.h" 13 14 namespace mozilla { 15 namespace a11y { 16 17 class AccessibleWrap : public LocalAccessible { 18 public: 19 AccessibleWrap(nsIContent* aContent, DocAccessible* aDoc); 20 virtual ~AccessibleWrap(); 21 22 MOZ_CAN_RUN_SCRIPT_BOUNDARY // TODO: Mark this as MOZ_CAN_RUN_SCRIPT 23 virtual nsresult 24 HandleAccEvent(AccEvent* aEvent) override; 25 26 virtual void Shutdown() override; 27 28 virtual bool DoAction(uint8_t aIndex) const override; 29 30 static Accessible* ExploreByTouch(Accessible* aAccessible, float aX, 31 float aY); 32 33 static uint32_t GetFlags(Accessible* aAccessible); 34 35 static int32_t GetInputType(const nsString& aInputTypeAttr); 36 37 static int32_t GetAndroidClass(role aRole); 38 39 static void GetRoleDescription(role aRole, AccAttributes* aAttributes, 40 nsAString& aGeckoRole, 41 nsAString& aRoleDescription); 42 43 static int32_t AndroidClass(Accessible* aAccessible); 44 45 static int32_t GetVirtualViewID(Accessible* aAccessible); 46 47 static void SetVirtualViewID(Accessible* aAccessible, int32_t aVirtualViewID); 48 49 static Accessible* DoPivot(Accessible* aAccessible, int32_t aGranularity, 50 bool aForward, bool aInclusive); 51 52 static Maybe<std::pair<int32_t, int32_t>> NavigateText( 53 Accessible* aAccessible, int32_t aGranularity, int32_t aStartOffset, 54 int32_t aEndOffset, bool aForward, bool aSelect); 55 56 protected: 57 int32_t mID; 58 59 private: 60 void GetTextEquiv(nsString& aText); 61 62 bool HandleLiveRegionEvent(AccEvent* aEvent); 63 }; 64 65 } // namespace a11y 66 } // namespace mozilla 67 68 #endif