HTMLLinkAccessible.h (1920B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 #ifndef mozilla_a11y_HTMLLinkAccessible_h__ 7 #define mozilla_a11y_HTMLLinkAccessible_h__ 8 9 #include "HyperTextAccessible.h" 10 11 namespace mozilla { 12 namespace a11y { 13 14 class HTMLLinkAccessible : public HyperTextAccessible { 15 public: 16 HTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc); 17 18 NS_INLINE_DECL_REFCOUNTING_INHERITED(HTMLLinkAccessible, HyperTextAccessible) 19 20 // LocalAccessible 21 virtual void Value(nsString& aValue) const override; 22 virtual a11y::role NativeRole() const override; 23 virtual uint64_t NativeState() const override; 24 virtual uint64_t NativeLinkState() const override; 25 virtual uint64_t NativeInteractiveState() const override; 26 27 // ActionAccessible 28 virtual bool HasPrimaryAction() const override; 29 virtual void ActionNameAt(uint8_t aIndex, nsAString& aName) override; 30 31 // HyperLinkAccessible 32 virtual bool IsLink() const override; 33 34 /** 35 * Returns true if the link has href attribute. 36 */ 37 bool IsLinked() const; 38 39 protected: 40 virtual ~HTMLLinkAccessible() {} 41 42 virtual bool AttributeChangesState(nsAtom* aAttribute) override; 43 44 virtual void DOMAttributeChanged(int32_t aNameSpaceID, nsAtom* aAttribute, 45 AttrModType aModType, 46 const nsAttrValue* aOldValue, 47 uint64_t aOldState) override; 48 49 virtual ENameValueFlag NativeName(nsString& aName) const override; 50 51 enum { eAction_Jump = 0 }; 52 }; 53 54 inline HTMLLinkAccessible* LocalAccessible::AsHTMLLink() { 55 return IsHTMLLink() ? static_cast<HTMLLinkAccessible*>(this) : nullptr; 56 } 57 58 } // namespace a11y 59 } // namespace mozilla 60 61 #endif