no bug - Bumping Firefox l10n changesets r=release a=l10n-bump DONTBUILD CLOSED TREE
[gecko.git] / accessible / generic / TextLeafAccessible.h
blob65d59a2aadd16a15e45e0c88fa11cc94ecc001bc
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/. */
6 #ifndef mozilla_a11y_TextLeafAccessible_h__
7 #define mozilla_a11y_TextLeafAccessible_h__
9 #include "BaseAccessibles.h"
11 namespace mozilla {
12 namespace a11y {
14 /**
15 * Generic class used for text nodes.
17 class TextLeafAccessible : public LinkableAccessible {
18 public:
19 TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
20 virtual ~TextLeafAccessible();
22 // LocalAccessible
23 virtual mozilla::a11y::role NativeRole() const override;
24 virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
25 uint32_t aLength = UINT32_MAX) override;
26 virtual ENameValueFlag Name(nsString& aName) const override;
28 // TextLeafAccessible
29 void SetText(const nsAString& aText) { mText = aText; }
30 const nsString& Text() const { return mText; }
32 protected:
33 nsString mText;
36 ////////////////////////////////////////////////////////////////////////////////
37 // LocalAccessible downcast method
39 inline TextLeafAccessible* LocalAccessible::AsTextLeaf() {
40 return IsTextLeaf() ? static_cast<TextLeafAccessible*>(this) : nullptr;
43 } // namespace a11y
44 } // namespace mozilla
46 #endif