1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/src/generic/TextLeafAccessible.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#include "TextLeafAccessible.h" 1.10 + 1.11 +#include "nsAccUtils.h" 1.12 +#include "DocAccessible.h" 1.13 +#include "Role.h" 1.14 + 1.15 +using namespace mozilla::a11y; 1.16 + 1.17 +//////////////////////////////////////////////////////////////////////////////// 1.18 +// TextLeafAccessible 1.19 +//////////////////////////////////////////////////////////////////////////////// 1.20 + 1.21 +TextLeafAccessible:: 1.22 + TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc) : 1.23 + LinkableAccessible(aContent, aDoc) 1.24 +{ 1.25 + mType = eTextLeafType; 1.26 +} 1.27 + 1.28 +TextLeafAccessible::~TextLeafAccessible() 1.29 +{ 1.30 +} 1.31 + 1.32 +role 1.33 +TextLeafAccessible::NativeRole() 1.34 +{ 1.35 + nsIFrame* frame = GetFrame(); 1.36 + if (frame && frame->IsGeneratedContentFrame()) 1.37 + return roles::STATICTEXT; 1.38 + 1.39 + return roles::TEXT_LEAF; 1.40 +} 1.41 + 1.42 +void 1.43 +TextLeafAccessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset, 1.44 + uint32_t aLength) 1.45 +{ 1.46 + aText.Append(Substring(mText, aStartOffset, aLength)); 1.47 +} 1.48 + 1.49 +ENameValueFlag 1.50 +TextLeafAccessible::Name(nsString& aName) 1.51 +{ 1.52 + // Text node, ARIA can't be used. 1.53 + aName = mText; 1.54 + return eNameOK; 1.55 +} 1.56 + 1.57 +void 1.58 +TextLeafAccessible::CacheChildren() 1.59 +{ 1.60 + // No children for text accessible. 1.61 +}