Files
serge-sans-paille f81328e365 Bug 2023519 - Make our codebase modernize-use-equals-default + modernize-use-equals-delete -safe wrt. clang-tidy r=sylvestre,necko-reviewers,media-playback-reviewers,profiler-reviewers,dom-storage-reviewers,layout-reviewers,dom-worker-reviewers,valentin,jesup,padenot,edenchuang,emilio
The changeset has been generated automatically through:

    ./mach static-analysis check --output ./clang-tidy-bugprone.json --format json --fix

followed by manual adjustment when needed or when the auto-fixer bailed out.

This paves the way for Bug 2023527

Differential Revision: https://phabricator.services.mozilla.com/D287941
2026-03-22 08:35:47 +00:00

46 lines
1.4 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "TextLeafAccessible.h"
#include "mozilla/a11y/Role.h"
#include "nsCoreUtils.h"
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// TextLeafAccessible
////////////////////////////////////////////////////////////////////////////////
TextLeafAccessible::TextLeafAccessible(nsIContent* aContent,
DocAccessible* aDoc)
: LinkableAccessible(aContent, aDoc) {
mType = eTextLeafType;
mGenericTypes |= eText;
mStateFlags |= eNoKidsFromDOM;
}
TextLeafAccessible::~TextLeafAccessible() = default;
role TextLeafAccessible::NativeRole() const {
nsIFrame* frame = GetFrame();
if ((frame && frame->IsGeneratedContentFrame()) ||
nsCoreUtils::IsPseudoElement(GetContent())) {
return roles::STATICTEXT;
}
return roles::TEXT_LEAF;
}
void TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
uint32_t aLength) {
aText.Append(Substring(mText, aStartOffset, aLength));
}
ENameValueFlag TextLeafAccessible::DirectName(nsString& aName) const {
// Text node, ARIA can't be used.
aName = mText;
return eNameOK;
}