Line data Source code
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 0 : TextLeafAccessible::
19 0 : TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) :
20 0 : LinkableAccessible(aContent, aDoc)
21 : {
22 0 : mType = eTextLeafType;
23 0 : mGenericTypes |= eText;
24 0 : mStateFlags |= eNoKidsFromDOM;
25 0 : }
26 :
27 0 : TextLeafAccessible::~TextLeafAccessible()
28 : {
29 0 : }
30 :
31 : role
32 0 : TextLeafAccessible::NativeRole()
33 : {
34 0 : nsIFrame* frame = GetFrame();
35 0 : if (frame && frame->IsGeneratedContentFrame())
36 0 : return roles::STATICTEXT;
37 :
38 0 : return roles::TEXT_LEAF;
39 : }
40 :
41 : void
42 0 : TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
43 : uint32_t aLength)
44 : {
45 0 : aText.Append(Substring(mText, aStartOffset, aLength));
46 0 : }
47 :
48 : ENameValueFlag
49 0 : TextLeafAccessible::Name(nsString& aName)
50 : {
51 : // Text node, ARIA can't be used.
52 0 : aName = mText;
53 0 : return eNameOK;
54 : }
|