Bug 1769547 - Do not MOZ_CRASH() on missing process r=nika
[gecko.git] / accessible / html / HTMLListAccessible.h
blob73c8857d92ab97b2bd5f0d6f7c7c8863b510d33d
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_a11y_HTMLListAccessible_h__
8 #define mozilla_a11y_HTMLListAccessible_h__
10 #include "BaseAccessibles.h"
11 #include "HyperTextAccessibleWrap.h"
13 namespace mozilla {
14 namespace a11y {
16 class HTMLListBulletAccessible;
18 /**
19 * Used for HTML list (like HTML ul).
21 class HTMLListAccessible : public HyperTextAccessibleWrap {
22 public:
23 HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc)
24 : HyperTextAccessibleWrap(aContent, aDoc) {
25 mGenericTypes |= eList;
28 // nsISupports
29 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLListAccessible,
30 HyperTextAccessibleWrap)
32 // LocalAccessible
33 virtual a11y::role NativeRole() const override;
34 virtual uint64_t NativeState() const override;
36 protected:
37 virtual ~HTMLListAccessible() {}
40 /**
41 * Used for HTML list item (e.g. HTML li).
43 class HTMLLIAccessible : public HyperTextAccessibleWrap {
44 public:
45 HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);
47 // nsISupports
48 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLIAccessible,
49 HyperTextAccessibleWrap)
51 // LocalAccessible
52 virtual nsRect BoundsInAppUnits() const override;
53 virtual a11y::role NativeRole() const override;
54 virtual uint64_t NativeState() const override;
56 // HTMLLIAccessible
57 LocalAccessible* Bullet() const;
59 protected:
60 virtual ~HTMLLIAccessible() {}
63 /**
64 * Used for bullet of HTML list item element (for example, HTML li).
66 class HTMLListBulletAccessible : public LeafAccessible {
67 public:
68 HTMLListBulletAccessible(nsIContent* aContent, DocAccessible* aDoc);
69 virtual ~HTMLListBulletAccessible() {}
71 // LocalAccessible
72 virtual ENameValueFlag Name(nsString& aName) const override;
73 virtual a11y::role NativeRole() const override;
74 virtual uint64_t NativeState() const override;
75 virtual already_AddRefed<AccAttributes> NativeAttributes() override;
76 virtual void AppendTextTo(nsAString& aText, uint32_t aStartOffset = 0,
77 uint32_t aLength = UINT32_MAX) override;
80 inline HTMLLIAccessible* LocalAccessible::AsHTMLListItem() {
81 return IsHTMLListItem() ? static_cast<HTMLLIAccessible*>(this) : nullptr;
84 } // namespace a11y
85 } // namespace mozilla
87 #endif