|
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_HTMLImageMapAccessible_h__ |
|
7 #define mozilla_a11y_HTMLImageMapAccessible_h__ |
|
8 |
|
9 #include "HTMLLinkAccessible.h" |
|
10 #include "ImageAccessibleWrap.h" |
|
11 #include "nsIDOMHTMLMapElement.h" |
|
12 |
|
13 namespace mozilla { |
|
14 namespace a11y { |
|
15 |
|
16 /** |
|
17 * Used for HTML image maps. |
|
18 */ |
|
19 class HTMLImageMapAccessible : public ImageAccessibleWrap |
|
20 { |
|
21 public: |
|
22 HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc); |
|
23 virtual ~HTMLImageMapAccessible() { } |
|
24 |
|
25 // nsISupports and cycle collector |
|
26 NS_DECL_ISUPPORTS_INHERITED |
|
27 |
|
28 // Accessible |
|
29 virtual a11y::role NativeRole(); |
|
30 |
|
31 // HyperLinkAccessible |
|
32 virtual uint32_t AnchorCount(); |
|
33 virtual Accessible* AnchorAt(uint32_t aAnchorIndex); |
|
34 virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex); |
|
35 |
|
36 /** |
|
37 * Update area children of the image map. |
|
38 */ |
|
39 void UpdateChildAreas(bool aDoFireEvents = true); |
|
40 |
|
41 /** |
|
42 * Return accessible of child node. |
|
43 */ |
|
44 Accessible* GetChildAccessibleFor(const nsINode* aNode) const; |
|
45 |
|
46 protected: |
|
47 |
|
48 // Accessible |
|
49 virtual void CacheChildren(); |
|
50 }; |
|
51 |
|
52 /** |
|
53 * Accessible for image map areas - must be child of image. |
|
54 */ |
|
55 class HTMLAreaAccessible : public HTMLLinkAccessible |
|
56 { |
|
57 public: |
|
58 |
|
59 HTMLAreaAccessible(nsIContent* aContent, DocAccessible* aDoc); |
|
60 |
|
61 // Accessible |
|
62 virtual void Description(nsString& aDescription); |
|
63 virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY, |
|
64 EWhichChildAtPoint aWhichChild); |
|
65 virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame); |
|
66 |
|
67 // HyperLinkAccessible |
|
68 virtual uint32_t StartOffset(); |
|
69 virtual uint32_t EndOffset(); |
|
70 |
|
71 protected: |
|
72 // Accessible |
|
73 virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; |
|
74 virtual void CacheChildren(); |
|
75 }; |
|
76 |
|
77 |
|
78 //////////////////////////////////////////////////////////////////////////////// |
|
79 // Accessible downcasting method |
|
80 |
|
81 inline HTMLImageMapAccessible* |
|
82 Accessible::AsImageMap() |
|
83 { |
|
84 return IsImageMap() ? static_cast<HTMLImageMapAccessible*>(this) : nullptr; |
|
85 } |
|
86 |
|
87 } // namespace a11y |
|
88 } // namespace mozilla |
|
89 |
|
90 #endif |