2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-04 05:32:34 -07:00
|
|
|
#ifndef mozilla_a11y_HTMLImageMapAccessible_h__
|
|
|
|
#define mozilla_a11y_HTMLImageMapAccessible_h__
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-04 05:32:38 -07:00
|
|
|
#include "HTMLLinkAccessible.h"
|
2012-06-02 04:30:34 -07:00
|
|
|
#include "ImageAccessibleWrap.h"
|
2010-04-05 17:41:28 -07:00
|
|
|
#include "nsIDOMHTMLMapElement.h"
|
|
|
|
|
2012-06-04 05:32:34 -07:00
|
|
|
namespace mozilla {
|
|
|
|
namespace a11y {
|
|
|
|
|
2010-04-05 17:41:28 -07:00
|
|
|
/**
|
|
|
|
* Used for HTML image maps.
|
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
class HTMLImageMapAccessible final : public ImageAccessibleWrap
|
2010-04-05 17:41:28 -07:00
|
|
|
{
|
|
|
|
public:
|
2012-06-04 05:32:34 -07:00
|
|
|
HTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2010-04-05 17:41:28 -07:00
|
|
|
|
|
|
|
// nsISupports and cycle collector
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual a11y::role NativeRole() override;
|
2010-04-05 17:41:28 -07:00
|
|
|
|
2010-08-31 20:26:13 -07:00
|
|
|
// HyperLinkAccessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint32_t AnchorCount() override;
|
|
|
|
virtual Accessible* AnchorAt(uint32_t aAnchorIndex) override;
|
|
|
|
virtual already_AddRefed<nsIURI> AnchorURIAt(uint32_t aAnchorIndex) override;
|
2010-08-31 20:26:13 -07:00
|
|
|
|
2012-03-15 13:16:02 -07:00
|
|
|
/**
|
|
|
|
* Update area children of the image map.
|
|
|
|
*/
|
|
|
|
void UpdateChildAreas(bool aDoFireEvents = true);
|
|
|
|
|
2014-02-10 12:52:34 -08:00
|
|
|
/**
|
|
|
|
* Return accessible of child node.
|
|
|
|
*/
|
|
|
|
Accessible* GetChildAccessibleFor(const nsINode* aNode) const;
|
|
|
|
|
2010-04-05 17:41:28 -07:00
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~HTMLImageMapAccessible() { }
|
2010-04-05 17:41:28 -07:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void CacheChildren() override;
|
2010-04-05 17:41:28 -07:00
|
|
|
};
|
|
|
|
|
2009-10-28 03:42:36 -07:00
|
|
|
/**
|
|
|
|
* Accessible for image map areas - must be child of image.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2015-03-21 09:28:04 -07:00
|
|
|
class HTMLAreaAccessible final : public HTMLLinkAccessible
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
2010-08-18 19:14:50 -07:00
|
|
|
|
2012-06-04 05:32:34 -07:00
|
|
|
HTMLAreaAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
2008-03-05 19:33:33 -08:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual void Description(nsString& aDescription) override;
|
2012-08-22 08:56:38 -07:00
|
|
|
virtual Accessible* ChildAtPoint(int32_t aX, int32_t aY,
|
2015-03-21 09:28:04 -07:00
|
|
|
EWhichChildAtPoint aWhichChild) override;
|
|
|
|
virtual nsRect RelativeBounds(nsIFrame** aBoundingFrame) const override;
|
2009-10-28 03:42:36 -07:00
|
|
|
|
2010-08-31 20:26:13 -07:00
|
|
|
// HyperLinkAccessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual uint32_t StartOffset() override;
|
|
|
|
virtual uint32_t EndOffset() override;
|
2010-08-31 20:26:13 -07:00
|
|
|
|
2009-10-28 03:42:36 -07:00
|
|
|
protected:
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2015-03-21 09:28:04 -07:00
|
|
|
virtual ENameValueFlag NativeName(nsString& aName) override;
|
|
|
|
virtual void CacheChildren() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
2012-06-04 05:32:34 -07:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Accessible downcasting method
|
|
|
|
|
2012-11-17 18:01:44 -08:00
|
|
|
inline HTMLImageMapAccessible*
|
2012-06-04 05:32:34 -07:00
|
|
|
Accessible::AsImageMap()
|
|
|
|
{
|
2012-12-17 21:22:26 -08:00
|
|
|
return IsImageMap() ? static_cast<HTMLImageMapAccessible*>(this) : nullptr;
|
2012-06-04 05:32:34 -07:00
|
|
|
}
|
|
|
|
|
2012-11-17 18:01:44 -08:00
|
|
|
} // namespace a11y
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2012-06-02 04:30:34 -07:00
|
|
|
#endif
|