michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "TextLeafAccessible.h" michael@0: michael@0: #include "nsAccUtils.h" michael@0: #include "DocAccessible.h" michael@0: #include "Role.h" michael@0: michael@0: using namespace mozilla::a11y; michael@0: michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: // TextLeafAccessible michael@0: //////////////////////////////////////////////////////////////////////////////// michael@0: michael@0: TextLeafAccessible:: michael@0: TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) : michael@0: LinkableAccessible(aContent, aDoc) michael@0: { michael@0: mType = eTextLeafType; michael@0: } michael@0: michael@0: TextLeafAccessible::~TextLeafAccessible() michael@0: { michael@0: } michael@0: michael@0: role michael@0: TextLeafAccessible::NativeRole() michael@0: { michael@0: nsIFrame* frame = GetFrame(); michael@0: if (frame && frame->IsGeneratedContentFrame()) michael@0: return roles::STATICTEXT; michael@0: michael@0: return roles::TEXT_LEAF; michael@0: } michael@0: michael@0: void michael@0: TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset, michael@0: uint32_t aLength) michael@0: { michael@0: aText.Append(Substring(mText, aStartOffset, aLength)); michael@0: } michael@0: michael@0: ENameValueFlag michael@0: TextLeafAccessible::Name(nsString& aName) michael@0: { michael@0: // Text node, ARIA can't be used. michael@0: aName = mText; michael@0: return eNameOK; michael@0: } michael@0: michael@0: void michael@0: TextLeafAccessible::CacheChildren() michael@0: { michael@0: // No children for text accessible. michael@0: }