LCOV - code coverage report
Current view: top level - layout/svg - nsSVGImageFrame.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 11 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 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             : #ifndef __NS_SVGIMAGEFRAME_H__
       7             : #define __NS_SVGIMAGEFRAME_H__
       8             : 
       9             : // Keep in (case-insensitive) order:
      10             : #include "gfxContext.h"
      11             : #include "gfxPlatform.h"
      12             : #include "mozilla/gfx/2D.h"
      13             : #include "imgIContainer.h"
      14             : #include "nsContainerFrame.h"
      15             : #include "nsIDOMMutationEvent.h"
      16             : #include "nsIImageLoadingContent.h"
      17             : #include "nsLayoutUtils.h"
      18             : #include "imgINotificationObserver.h"
      19             : #include "nsSVGEffects.h"
      20             : #include "mozilla/dom/SVGSVGElement.h"
      21             : #include "nsSVGUtils.h"
      22             : #include "SVGContentUtils.h"
      23             : #include "SVGGeometryFrame.h"
      24             : #include "SVGImageContext.h"
      25             : #include "mozilla/dom/SVGImageElement.h"
      26             : #include "nsContentUtils.h"
      27             : #include "nsIReflowCallback.h"
      28             : #include "mozilla/Unused.h"
      29             : 
      30             : using namespace mozilla;
      31             : using namespace mozilla::dom;
      32             : using namespace mozilla::gfx;
      33             : using namespace mozilla::image;
      34             : 
      35             : class nsSVGImageFrame;
      36             : 
      37             : class nsSVGImageListener final : public imgINotificationObserver
      38             : {
      39             : public:
      40             :   explicit nsSVGImageListener(nsSVGImageFrame *aFrame);
      41             : 
      42             :   NS_DECL_ISUPPORTS
      43             :   NS_DECL_IMGINOTIFICATIONOBSERVER
      44             : 
      45           0 :   void SetFrame(nsSVGImageFrame *frame) { mFrame = frame; }
      46             : 
      47             : private:
      48           0 :   ~nsSVGImageListener() {}
      49             : 
      50             :   nsSVGImageFrame *mFrame;
      51             : };
      52             : 
      53             : class nsSVGImageFrame final
      54             :   : public SVGGeometryFrame
      55             :   , public nsIReflowCallback
      56             : {
      57             :   friend nsIFrame*
      58             :   NS_NewSVGImageFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
      59             : 
      60             : protected:
      61           0 :   explicit nsSVGImageFrame(nsStyleContext* aContext)
      62           0 :     : SVGGeometryFrame(aContext, kClassID)
      63             :     , mReflowCallbackPosted(false)
      64           0 :     , mForceSyncDecoding(false)
      65             :   {
      66           0 :     EnableVisibilityTracking();
      67           0 :   }
      68             : 
      69             :   virtual ~nsSVGImageFrame();
      70             : 
      71             : public:
      72             :   NS_DECL_QUERYFRAME
      73           0 :   NS_DECL_FRAMEARENA_HELPERS(nsSVGImageFrame)
      74             : 
      75             :   // nsSVGDisplayableFrame interface:
      76             :   virtual void PaintSVG(gfxContext& aContext,
      77             :                         const gfxMatrix& aTransform,
      78             :                         imgDrawingParams& aImgParams,
      79             :                         const nsIntRect* aDirtyRect = nullptr) override;
      80             :   virtual nsIFrame* GetFrameForPoint(const gfxPoint& aPoint) override;
      81             :   virtual void ReflowSVG() override;
      82             : 
      83             :   // SVGGeometryFrame methods:
      84             :   virtual uint16_t GetHitTestFlags() override;
      85             : 
      86             :   // nsIFrame interface:
      87             :   virtual nsresult  AttributeChanged(int32_t         aNameSpaceID,
      88             :                                      nsIAtom*        aAttribute,
      89             :                                      int32_t         aModType) override;
      90             : 
      91             :   void OnVisibilityChange(Visibility aNewVisibility,
      92             :                           const Maybe<OnNonvisible>& aNonvisibleAction = Nothing()) override;
      93             : 
      94             :   virtual void Init(nsIContent*       aContent,
      95             :                     nsContainerFrame* aParent,
      96             :                     nsIFrame*         aPrevInFlow) override;
      97             :   virtual void DestroyFrom(nsIFrame* aDestructRoot) override;
      98             : 
      99             : #ifdef DEBUG_FRAME_DUMP
     100           0 :   virtual nsresult GetFrameName(nsAString& aResult) const override
     101             :   {
     102           0 :     return MakeFrameName(NS_LITERAL_STRING("SVGImage"), aResult);
     103             :   }
     104             : #endif
     105             : 
     106             :   // nsIReflowCallback
     107             :   virtual bool ReflowFinished() override;
     108             :   virtual void ReflowCallbackCanceled() override;
     109             : 
     110             :   /// Always sync decode our image when painting if @aForce is true.
     111           0 :   void SetForceSyncDecoding(bool aForce) { mForceSyncDecoding = aForce; }
     112             : 
     113             : private:
     114             :   gfx::Matrix GetRasterImageTransform(int32_t aNativeWidth,
     115             :                                       int32_t aNativeHeight);
     116             :   gfx::Matrix GetVectorImageTransform();
     117             :   bool TransformContextForPainting(gfxContext* aGfxContext,
     118             :                                    const gfxMatrix& aTransform);
     119             : 
     120             :   nsCOMPtr<imgINotificationObserver> mListener;
     121             : 
     122             :   nsCOMPtr<imgIContainer> mImageContainer;
     123             : 
     124             :   bool mReflowCallbackPosted;
     125             :   bool mForceSyncDecoding;
     126             : 
     127             :   friend class nsSVGImageListener;
     128             : };
     129             : 
     130             : #endif // __NS_SVGIMAGEFRAME_H__

Generated by: LCOV version 1.13