LCOV - code coverage report
Current view: top level - layout/generic - nsImageMap.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : /* code for HTML client-side image maps */
       7             : 
       8             : #ifndef nsImageMap_h
       9             : #define nsImageMap_h
      10             : 
      11             : #include "mozilla/gfx/2D.h"
      12             : #include "nsCOMPtr.h"
      13             : #include "nsCoord.h"
      14             : #include "nsTArray.h"
      15             : #include "nsStubMutationObserver.h"
      16             : #include "nsIDOMEventListener.h"
      17             : 
      18             : class Area;
      19             : class nsImageFrame;
      20             : class nsIFrame;
      21             : class nsIContent;
      22             : struct nsRect;
      23             : 
      24             : class nsImageMap final : public nsStubMutationObserver,
      25             :                          public nsIDOMEventListener
      26             : {
      27             :   typedef mozilla::gfx::DrawTarget DrawTarget;
      28             :   typedef mozilla::gfx::ColorPattern ColorPattern;
      29             :   typedef mozilla::gfx::StrokeOptions StrokeOptions;
      30             : 
      31             : public:
      32             :   nsImageMap();
      33             : 
      34             :   nsresult Init(nsImageFrame* aImageFrame, nsIContent* aMap);
      35             : 
      36             :   /**
      37             :    * Return the first area element (in content order) for the given aX,aY pixel
      38             :    * coordinate or nullptr if the coordinate is outside all areas.
      39             :    */
      40             :   nsIContent* GetArea(nscoord aX, nscoord aY) const;
      41             : 
      42             :   /**
      43             :    * Return area elements count associated with the image map.
      44             :    */
      45           0 :   uint32_t AreaCount() const { return mAreas.Length(); }
      46             : 
      47             :   /**
      48             :    * Return area element at the given index.
      49             :    */
      50             :   nsIContent* GetAreaAt(uint32_t aIndex) const;
      51             : 
      52             :   void Draw(nsIFrame* aFrame, DrawTarget& aDrawTarget,
      53             :             const ColorPattern& aColor,
      54             :             const StrokeOptions& aStrokeOptions = StrokeOptions());
      55             : 
      56             :   /**
      57             :    * Called just before the nsImageFrame releases us.
      58             :    * Used to break the cycle caused by the DOM listener.
      59             :    */
      60             :   void Destroy();
      61             : 
      62             :   // nsISupports
      63             :   NS_DECL_ISUPPORTS
      64             : 
      65             :   // nsIMutationObserver
      66             :   NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
      67             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
      68             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
      69             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
      70             :   NS_DECL_NSIMUTATIONOBSERVER_PARENTCHAINCHANGED
      71             : 
      72             :   //nsIDOMEventListener
      73             :   NS_DECL_NSIDOMEVENTLISTENER
      74             : 
      75             :   nsresult GetBoundsForAreaContent(nsIContent *aContent,
      76             :                                    nsRect& aBounds);
      77             : 
      78             : protected:
      79             :   virtual ~nsImageMap();
      80             : 
      81             :   void FreeAreas();
      82             : 
      83             :   nsresult UpdateAreas();
      84             :   nsresult SearchForAreas(nsIContent* aParent, bool& aFoundArea,
      85             :                           bool& aFoundAnchor);
      86             : 
      87             :   nsresult AddArea(nsIContent* aArea);
      88             : 
      89             :   void MaybeUpdateAreas(nsIContent *aContent);
      90             : 
      91             :   nsImageFrame* mImageFrame;  // the frame that owns us
      92             :   nsCOMPtr<nsIContent> mMap;
      93             :   AutoTArray<Area*, 8> mAreas; // almost always has some entries
      94             :   bool mContainsBlockContents;
      95             : };
      96             : 
      97             : #endif /* nsImageMap_h */

Generated by: LCOV version 1.13