2012-05-07 22:16:40 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_a11y_HTMLListAccessible_h__
|
|
|
|
#define mozilla_a11y_HTMLListAccessible_h__
|
|
|
|
|
2012-06-04 05:32:29 -07:00
|
|
|
#include "BaseAccessibles.h"
|
2012-05-31 01:04:41 -07:00
|
|
|
#include "HyperTextAccessibleWrap.h"
|
2012-05-07 22:16:40 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
|
|
|
class HTMLListBulletAccessible;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used for HTML list (like HTML ul).
|
|
|
|
*/
|
2012-05-31 01:04:41 -07:00
|
|
|
class HTMLListAccessible : public HyperTextAccessibleWrap
|
2012-05-07 22:16:40 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 02:01:40 -07:00
|
|
|
HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
|
2012-12-17 21:22:26 -08:00
|
|
|
HyperTextAccessibleWrap(aContent, aDoc) { mGenericTypes |= eList; }
|
2012-05-07 22:16:40 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2014-07-08 14:23:18 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~HTMLListAccessible() { }
|
2012-05-07 22:16:40 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used for HTML list item (e.g. HTML li).
|
|
|
|
*/
|
2012-05-31 01:04:41 -07:00
|
|
|
class HTMLLIAccessible : public HyperTextAccessibleWrap
|
2012-05-07 22:16:40 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-05-27 02:01:40 -07:00
|
|
|
HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2012-05-07 22:16:40 -07:00
|
|
|
|
|
|
|
// nsISupports
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2013-10-28 20:30:55 -07:00
|
|
|
virtual void Shutdown();
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual nsIntRect Bounds() const MOZ_OVERRIDE;
|
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2012-05-07 22:16:40 -07:00
|
|
|
|
2013-12-10 04:40:54 -08:00
|
|
|
// HTMLLIAccessible
|
2014-02-05 07:21:32 -08:00
|
|
|
HTMLListBulletAccessible* Bullet() const { return mBullet; }
|
2012-05-07 22:16:40 -07:00
|
|
|
void UpdateBullet(bool aHasBullet);
|
|
|
|
|
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~HTMLLIAccessible() { }
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2012-05-07 22:16:40 -07:00
|
|
|
virtual void CacheChildren();
|
|
|
|
|
|
|
|
private:
|
|
|
|
nsRefPtr<HTMLListBulletAccessible> mBullet;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used for bullet of HTML list item element (for example, HTML li).
|
|
|
|
*/
|
2012-06-04 05:32:29 -07:00
|
|
|
class HTMLListBulletAccessible : public LeafAccessible
|
2012-05-07 22:16:40 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-09-03 23:06:10 -07:00
|
|
|
HTMLListBulletAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2012-05-07 22:16:40 -07:00
|
|
|
virtual ~HTMLListBulletAccessible() { }
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2013-10-28 20:30:55 -07:00
|
|
|
virtual nsIFrame* GetFrame() const;
|
2012-05-07 22:16:40 -07:00
|
|
|
virtual ENameValueFlag Name(nsString& aName);
|
2014-09-16 10:30:23 -07:00
|
|
|
virtual a11y::role NativeRole() MOZ_OVERRIDE;
|
|
|
|
virtual uint64_t NativeState() MOZ_OVERRIDE;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
|
2012-09-27 23:57:33 -07:00
|
|
|
uint32_t aLength = UINT32_MAX);
|
2012-05-13 21:51:45 -07:00
|
|
|
|
|
|
|
// HTMLListBulletAccessible
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return true if the bullet is inside of list item element boundaries.
|
|
|
|
*/
|
|
|
|
bool IsInside() const;
|
2012-05-07 22:16:40 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-11-17 18:01:44 -08:00
|
|
|
inline HTMLLIAccessible*
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible::AsHTMLListItem()
|
2012-05-07 22:16:40 -07:00
|
|
|
{
|
2012-12-17 21:22:26 -08:00
|
|
|
return IsHTMLListItem() ? static_cast<HTMLLIAccessible*>(this) : nullptr;
|
2012-05-07 22:16:40 -07:00
|
|
|
}
|
|
|
|
|
2012-11-17 18:01:44 -08:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2012-05-07 22:16:40 -07:00
|
|
|
#endif
|