2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-23 11:05:57 -07:00
|
|
|
#ifndef mozilla_a11y_TextLeafAccessible_h__
|
|
|
|
#define mozilla_a11y_TextLeafAccessible_h__
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-04 05:32:29 -07:00
|
|
|
#include "BaseAccessibles.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-23 11:05:57 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2009-10-28 03:42:36 -07:00
|
|
|
/**
|
|
|
|
* Generic class used for text nodes.
|
|
|
|
*/
|
2012-06-04 05:32:29 -07:00
|
|
|
class TextLeafAccessible : public LinkableAccessible
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 02:01:40 -07:00
|
|
|
TextLeafAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2012-05-23 11:05:57 -07:00
|
|
|
virtual ~TextLeafAccessible();
|
2007-04-10 21:17:33 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual mozilla::a11y::role NativeRole() MOZ_OVERRIDE;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
|
2015-01-01 22:11:21 -08:00
|
|
|
uint32_t aLength = UINT32_MAX) MOZ_OVERRIDE;
|
|
|
|
virtual ENameValueFlag Name(nsString& aName) MOZ_OVERRIDE;
|
2009-10-28 03:42:36 -07:00
|
|
|
|
2012-05-23 11:05:57 -07:00
|
|
|
// TextLeafAccessible
|
2011-01-31 07:53:09 -08:00
|
|
|
void SetText(const nsAString& aText) { mText = aText; }
|
|
|
|
const nsString& Text() const { return mText; }
|
2009-10-28 03:42:36 -07:00
|
|
|
|
2011-01-31 07:53:09 -08:00
|
|
|
protected:
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-01-01 22:11:21 -08:00
|
|
|
virtual void CacheChildren() MOZ_OVERRIDE;
|
2011-01-31 07:53:09 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
nsString mText;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-30 20:04:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible downcast method
|
2011-01-30 20:04:32 -08:00
|
|
|
|
2012-11-17 18:01:44 -08:00
|
|
|
inline TextLeafAccessible*
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible::AsTextLeaf()
|
2011-01-30 20:04:32 -08:00
|
|
|
{
|
2012-12-17 21:22:26 -08:00
|
|
|
return IsTextLeaf() ? static_cast<TextLeafAccessible*>(this) : nullptr;
|
2011-01-30 20:04:32 -08:00
|
|
|
}
|
|
|
|
|
2012-11-17 18:01:44 -08:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|