2012-05-23 22:05:57 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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 "nsAccUtils.h"
|
2012-05-27 13:01:40 +04:00
|
|
|
#include "DocAccessible.h"
|
2012-05-23 22:05:57 +04:00
|
|
|
#include "Role.h"
|
|
|
|
|
|
|
|
using namespace mozilla::a11y;
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// TextLeafAccessible
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-05-27 13:01:40 +04:00
|
|
|
TextLeafAccessible::TextLeafAccessible(nsIContent* aContent,
|
|
|
|
DocAccessible* aDoc)
|
2012-06-04 16:32:29 +04:00
|
|
|
: LinkableAccessible(aContent, aDoc) {
|
2012-12-18 09:22:26 +04:00
|
|
|
mType = eTextLeafType;
|
2016-04-08 15:35:11 +03:00
|
|
|
mGenericTypes |= eText;
|
2016-04-01 04:40:56 +03:00
|
|
|
mStateFlags |= eNoKidsFromDOM;
|
2012-05-23 22:05:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
TextLeafAccessible::~TextLeafAccessible() {}
|
|
|
|
|
2018-05-07 22:05:50 +03:00
|
|
|
role TextLeafAccessible::NativeRole() const {
|
2012-05-23 22:05:57 +04:00
|
|
|
nsIFrame* frame = GetFrame();
|
2014-09-16 21:30:23 +04:00
|
|
|
if (frame && frame->IsGeneratedContentFrame()) return roles::STATICTEXT;
|
2012-05-23 22:05:57 +04:00
|
|
|
|
|
|
|
return roles::TEXT_LEAF;
|
|
|
|
}
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
void TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
|
|
|
|
uint32_t aLength) {
|
2012-05-23 22:05:57 +04:00
|
|
|
aText.Append(Substring(mText, aStartOffset, aLength));
|
|
|
|
}
|
|
|
|
|
2018-05-15 19:13:02 +03:00
|
|
|
ENameValueFlag TextLeafAccessible::Name(nsString& aName) const {
|
2012-05-23 22:05:57 +04:00
|
|
|
// Text node, ARIA can't be used.
|
|
|
|
aName = mText;
|
|
|
|
return eNameOK;
|
|
|
|
}
|