tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

HTMLImageMapAccessible.h (2385B)


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