1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/src/html/HTMLImageMapAccessible.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,90 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +#ifndef mozilla_a11y_HTMLImageMapAccessible_h__ 1.10 +#define mozilla_a11y_HTMLImageMapAccessible_h__ 1.11 + 1.12 +#include "HTMLLinkAccessible.h" 1.13 +#include "ImageAccessibleWrap.h" 1.14 +#include "nsIDOMHTMLMapElement.h" 1.15 + 1.16 +namespace mozilla { 1.17 +namespace a11y { 1.18 + 1.19 +/** 1.20 + * Used for HTML image maps. 1.21 + */ 1.22 +class HTMLImageMapAccessible : public ImageAccessibleWrap 1.23 +{ 1.24 +public: 1.25 + HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc); 1.26 + virtual ~HTMLImageMapAccessible() { } 1.27 + 1.28 + // nsISupports and cycle collector 1.29 + NS_DECL_ISUPPORTS_INHERITED 1.30 + 1.31 + // Accessible 1.32 + virtual a11y::role NativeRole(); 1.33 + 1.34 + // HyperLinkAccessible 1.35 + virtual uint32_t AnchorCount(); 1.36 + virtual Accessible* AnchorAt(uint32_t aAnchorIndex); 1.37 + virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex); 1.38 + 1.39 + /** 1.40 + * Update area children of the image map. 1.41 + */ 1.42 + void UpdateChildAreas(bool aDoFireEvents = true); 1.43 + 1.44 + /** 1.45 + * Return accessible of child node. 1.46 + */ 1.47 + Accessible* GetChildAccessibleFor(const nsINode* aNode) const; 1.48 + 1.49 +protected: 1.50 + 1.51 + // Accessible 1.52 + virtual void CacheChildren(); 1.53 +}; 1.54 + 1.55 +/** 1.56 + * Accessible for image map areas - must be child of image. 1.57 + */ 1.58 +class HTMLAreaAccessible : public HTMLLinkAccessible 1.59 +{ 1.60 +public: 1.61 + 1.62 + HTMLAreaAccessible(nsIContent* aContent, DocAccessible* aDoc); 1.63 + 1.64 + // Accessible 1.65 + virtual void Description(nsString& aDescription); 1.66 + virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY, 1.67 + EWhichChildAtPoint aWhichChild); 1.68 + virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame); 1.69 + 1.70 + // HyperLinkAccessible 1.71 + virtual uint32_t StartOffset(); 1.72 + virtual uint32_t EndOffset(); 1.73 + 1.74 +protected: 1.75 + // Accessible 1.76 + virtual ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; 1.77 + virtual void CacheChildren(); 1.78 +}; 1.79 + 1.80 + 1.81 +//////////////////////////////////////////////////////////////////////////////// 1.82 +// Accessible downcasting method 1.83 + 1.84 +inline HTMLImageMapAccessible* 1.85 +Accessible::AsImageMap() 1.86 +{ 1.87 + return IsImageMap() ? static_cast<HTMLImageMapAccessible*>(this) : nullptr; 1.88 +} 1.89 + 1.90 +} // namespace a11y 1.91 +} // namespace mozilla 1.92 + 1.93 +#endif