Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef mozilla_a11y_TextLeafAccessible_h__ |
michael@0 | 7 | #define mozilla_a11y_TextLeafAccessible_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "BaseAccessibles.h" |
michael@0 | 10 | |
michael@0 | 11 | namespace mozilla { |
michael@0 | 12 | namespace a11y { |
michael@0 | 13 | |
michael@0 | 14 | /** |
michael@0 | 15 | * Generic class used for text nodes. |
michael@0 | 16 | */ |
michael@0 | 17 | class TextLeafAccessible : public LinkableAccessible |
michael@0 | 18 | { |
michael@0 | 19 | public: |
michael@0 | 20 | TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 21 | virtual ~TextLeafAccessible(); |
michael@0 | 22 | |
michael@0 | 23 | // Accessible |
michael@0 | 24 | virtual mozilla::a11y::role NativeRole(); |
michael@0 | 25 | virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0, |
michael@0 | 26 | uint32_t aLength = UINT32_MAX); |
michael@0 | 27 | virtual ENameValueFlag Name(nsString& aName); |
michael@0 | 28 | |
michael@0 | 29 | // TextLeafAccessible |
michael@0 | 30 | void SetText(const nsAString& aText) { mText = aText; } |
michael@0 | 31 | const nsString& Text() const { return mText; } |
michael@0 | 32 | |
michael@0 | 33 | protected: |
michael@0 | 34 | // Accessible |
michael@0 | 35 | virtual void CacheChildren(); |
michael@0 | 36 | |
michael@0 | 37 | protected: |
michael@0 | 38 | nsString mText; |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | |
michael@0 | 42 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 43 | // Accessible downcast method |
michael@0 | 44 | |
michael@0 | 45 | inline TextLeafAccessible* |
michael@0 | 46 | Accessible::AsTextLeaf() |
michael@0 | 47 | { |
michael@0 | 48 | return IsTextLeaf() ? static_cast<TextLeafAccessible*>(this) : nullptr; |
michael@0 | 49 | } |
michael@0 | 50 | |
michael@0 | 51 | } // namespace a11y |
michael@0 | 52 | } // namespace mozilla |
michael@0 | 53 | |
michael@0 | 54 | #endif |
michael@0 | 55 |