/src/mozilla-central/accessible/generic/TextLeafAccessible.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | #include "TextLeafAccessible.h" |
7 | | |
8 | | #include "nsAccUtils.h" |
9 | | #include "DocAccessible.h" |
10 | | #include "Role.h" |
11 | | |
12 | | using namespace mozilla::a11y; |
13 | | |
14 | | //////////////////////////////////////////////////////////////////////////////// |
15 | | // TextLeafAccessible |
16 | | //////////////////////////////////////////////////////////////////////////////// |
17 | | |
18 | | TextLeafAccessible:: |
19 | | TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
20 | | LinkableAccessible(aContent, aDoc) |
21 | 0 | { |
22 | 0 | mType = eTextLeafType; |
23 | 0 | mGenericTypes |= eText; |
24 | 0 | mStateFlags |= eNoKidsFromDOM; |
25 | 0 | } |
26 | | |
27 | | TextLeafAccessible::~TextLeafAccessible() |
28 | 0 | { |
29 | 0 | } |
30 | | |
31 | | role |
32 | | TextLeafAccessible::NativeRole() const |
33 | 0 | { |
34 | 0 | nsIFrame* frame = GetFrame(); |
35 | 0 | if (frame && frame->IsGeneratedContentFrame()) |
36 | 0 | return roles::STATICTEXT; |
37 | 0 | |
38 | 0 | return roles::TEXT_LEAF; |
39 | 0 | } |
40 | | |
41 | | void |
42 | | TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset, |
43 | | uint32_t aLength) |
44 | 0 | { |
45 | 0 | aText.Append(Substring(mText, aStartOffset, aLength)); |
46 | 0 | } |
47 | | |
48 | | ENameValueFlag |
49 | | TextLeafAccessible::Name(nsString& aName) const |
50 | 0 | { |
51 | 0 | // Text node, ARIA can't be used. |
52 | 0 | aName = mText; |
53 | 0 | return eNameOK; |
54 | 0 | } |