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
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
TextLeafAccessible::
|
2012-05-27 13:01:40 +04:00
|
|
|
TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
2012-06-04 16:32:29 +04:00
|
|
|
LinkableAccessible(aContent, aDoc)
|
2012-05-23 22:05:57 +04:00
|
|
|
{
|
2012-12-18 09:22:26 +04:00
|
|
|
mType = eTextLeafType;
|
2016-04-01 04:40:56 +03:00
|
|
|
mStateFlags |= eNoKidsFromDOM;
|
2012-05-23 22:05:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
TextLeafAccessible::~TextLeafAccessible()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
role
|
|
|
|
TextLeafAccessible::NativeRole()
|
|
|
|
{
|
|
|
|
nsIFrame* frame = GetFrame();
|
2014-09-16 21:30:23 +04:00
|
|
|
if (frame && frame->IsGeneratedContentFrame())
|
2012-05-23 22:05:57 +04:00
|
|
|
return roles::STATICTEXT;
|
|
|
|
|
|
|
|
return roles::TEXT_LEAF;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
|
|
|
|
uint32_t aLength)
|
2012-05-23 22:05:57 +04:00
|
|
|
{
|
|
|
|
aText.Append(Substring(mText, aStartOffset, aLength));
|
|
|
|
}
|
|
|
|
|
|
|
|
ENameValueFlag
|
|
|
|
TextLeafAccessible::Name(nsString& aName)
|
|
|
|
{
|
|
|
|
// Text node, ARIA can't be used.
|
|
|
|
aName = mText;
|
|
|
|
return eNameOK;
|
|
|
|
}
|