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 #include "TextLeafAccessible.h"
8 #include "mozilla/a11y/Role.h"
10 using namespace mozilla::a11y
;
12 ////////////////////////////////////////////////////////////////////////////////
14 ////////////////////////////////////////////////////////////////////////////////
16 TextLeafAccessible::TextLeafAccessible(nsIContent
* aContent
,
18 : LinkableAccessible(aContent
, aDoc
) {
19 mType
= eTextLeafType
;
20 mGenericTypes
|= eText
;
21 mStateFlags
|= eNoKidsFromDOM
;
24 TextLeafAccessible::~TextLeafAccessible() {}
26 role
TextLeafAccessible::NativeRole() const {
27 nsIFrame
* frame
= GetFrame();
28 if (frame
&& frame
->IsGeneratedContentFrame()) return roles::STATICTEXT
;
30 return roles::TEXT_LEAF
;
33 void TextLeafAccessible::AppendTextTo(nsAString
& aText
, uint32_t aStartOffset
,
35 aText
.Append(Substring(mText
, aStartOffset
, aLength
));
38 ENameValueFlag
TextLeafAccessible::Name(nsString
& aName
) const {
39 // Text node, ARIA can't be used.