Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #include "TextLeafAccessible.h" |
michael@0 | 7 | |
michael@0 | 8 | #include "nsAccUtils.h" |
michael@0 | 9 | #include "DocAccessible.h" |
michael@0 | 10 | #include "Role.h" |
michael@0 | 11 | |
michael@0 | 12 | using namespace mozilla::a11y; |
michael@0 | 13 | |
michael@0 | 14 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 15 | // TextLeafAccessible |
michael@0 | 16 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 17 | |
michael@0 | 18 | TextLeafAccessible:: |
michael@0 | 19 | TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) : |
michael@0 | 20 | LinkableAccessible(aContent, aDoc) |
michael@0 | 21 | { |
michael@0 | 22 | mType = eTextLeafType; |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | TextLeafAccessible::~TextLeafAccessible() |
michael@0 | 26 | { |
michael@0 | 27 | } |
michael@0 | 28 | |
michael@0 | 29 | role |
michael@0 | 30 | TextLeafAccessible::NativeRole() |
michael@0 | 31 | { |
michael@0 | 32 | nsIFrame* frame = GetFrame(); |
michael@0 | 33 | if (frame && frame->IsGeneratedContentFrame()) |
michael@0 | 34 | return roles::STATICTEXT; |
michael@0 | 35 | |
michael@0 | 36 | return roles::TEXT_LEAF; |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | void |
michael@0 | 40 | TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset, |
michael@0 | 41 | uint32_t aLength) |
michael@0 | 42 | { |
michael@0 | 43 | aText.Append(Substring(mText, aStartOffset, aLength)); |
michael@0 | 44 | } |
michael@0 | 45 | |
michael@0 | 46 | ENameValueFlag |
michael@0 | 47 | TextLeafAccessible::Name(nsString& aName) |
michael@0 | 48 | { |
michael@0 | 49 | // Text node, ARIA can't be used. |
michael@0 | 50 | aName = mText; |
michael@0 | 51 | return eNameOK; |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | void |
michael@0 | 55 | TextLeafAccessible::CacheChildren() |
michael@0 | 56 | { |
michael@0 | 57 | // No children for text accessible. |
michael@0 | 58 | } |