Bug 1856976 [wpt PR 42335] - Update mutation event suppression for <details name...
[gecko.git] / accessible / generic / TextLeafAccessible.cpp
blob42dc07f2287f7b1060091fc8be122663f17dc525
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 ////////////////////////////////////////////////////////////////////////////////
13 // TextLeafAccessible
14 ////////////////////////////////////////////////////////////////////////////////
16 TextLeafAccessible::TextLeafAccessible(nsIContent* aContent,
17 DocAccessible* aDoc)
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,
34 uint32_t aLength) {
35 aText.Append(Substring(mText, aStartOffset, aLength));
38 ENameValueFlag TextLeafAccessible::Name(nsString& aName) const {
39 // Text node, ARIA can't be used.
40 aName = mText;
41 return eNameOK;