Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef mozilla_a11y_HTMLImageMapAccessible_h__ |
michael@0 | 7 | #define mozilla_a11y_HTMLImageMapAccessible_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "HTMLLinkAccessible.h" |
michael@0 | 10 | #include "ImageAccessibleWrap.h" |
michael@0 | 11 | #include "nsIDOMHTMLMapElement.h" |
michael@0 | 12 | |
michael@0 | 13 | namespace mozilla { |
michael@0 | 14 | namespace a11y { |
michael@0 | 15 | |
michael@0 | 16 | /** |
michael@0 | 17 | * Used for HTML image maps. |
michael@0 | 18 | */ |
michael@0 | 19 | class HTMLImageMapAccessible : public ImageAccessibleWrap |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 23 | virtual ~HTMLImageMapAccessible() { } |
michael@0 | 24 | |
michael@0 | 25 | // nsISupports and cycle collector |
michael@0 | 26 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 27 | |
michael@0 | 28 | // Accessible |
michael@0 | 29 | virtual a11y::role NativeRole(); |
michael@0 | 30 | |
michael@0 | 31 | // HyperLinkAccessible |
michael@0 | 32 | virtual uint32_t AnchorCount(); |
michael@0 | 33 | virtual Accessible* AnchorAt(uint32_t aAnchorIndex); |
michael@0 | 34 | virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex); |
michael@0 | 35 | |
michael@0 | 36 | /** |
michael@0 | 37 | * Update area children of the image map. |
michael@0 | 38 | */ |
michael@0 | 39 | void UpdateChildAreas(bool aDoFireEvents = true); |
michael@0 | 40 | |
michael@0 | 41 | /** |
michael@0 | 42 | * Return accessible of child node. |
michael@0 | 43 | */ |
michael@0 | 44 | Accessible* GetChildAccessibleFor(const nsINode* aNode) const; |
michael@0 | 45 | |
michael@0 | 46 | protected: |
michael@0 | 47 | |
michael@0 | 48 | // Accessible |
michael@0 | 49 | virtual void CacheChildren(); |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | /** |
michael@0 | 53 | * Accessible for image map areas - must be child of image. |
michael@0 | 54 | */ |
michael@0 | 55 | class HTMLAreaAccessible : public HTMLLinkAccessible |
michael@0 | 56 | { |
michael@0 | 57 | public: |
michael@0 | 58 | |
michael@0 | 59 | HTMLAreaAccessible(nsIContent* aContent, DocAccessible* aDoc); |
michael@0 | 60 | |
michael@0 | 61 | // Accessible |
michael@0 | 62 | virtual void Description(nsString& aDescription); |
michael@0 | 63 | virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY, |
michael@0 | 64 | EWhichChildAtPoint aWhichChild); |
michael@0 | 65 | virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame); |
michael@0 | 66 | |
michael@0 | 67 | // HyperLinkAccessible |
michael@0 | 68 | virtual uint32_t StartOffset(); |
michael@0 | 69 | virtual uint32_t EndOffset(); |
michael@0 | 70 | |
michael@0 | 71 | protected: |
michael@0 | 72 | // Accessible |
michael@0 | 73 | virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
michael@0 | 74 | virtual void CacheChildren(); |
michael@0 | 75 | }; |
michael@0 | 76 | |
michael@0 | 77 | |
michael@0 | 78 | //////////////////////////////////////////////////////////////////////////////// |
michael@0 | 79 | // Accessible downcasting method |
michael@0 | 80 | |
michael@0 | 81 | inline HTMLImageMapAccessible* |
michael@0 | 82 | Accessible::AsImageMap() |
michael@0 | 83 | { |
michael@0 | 84 | return IsImageMap() ? static_cast<HTMLImageMapAccessible*>(this) : nullptr; |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | } // namespace a11y |
michael@0 | 88 | } // namespace mozilla |
michael@0 | 89 | |
michael@0 | 90 | #endif |