LCOV - code coverage report
Current view: top level - layout/svg - nsSVGStopFrame.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 25 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 11 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             : // Keep in (case-insensitive) order:
       7             : #include "nsContainerFrame.h"
       8             : #include "nsFrame.h"
       9             : #include "nsGkAtoms.h"
      10             : #include "nsStyleContext.h"
      11             : #include "nsSVGEffects.h"
      12             : 
      13             : // This is a very simple frame whose only purpose is to capture style change
      14             : // events and propagate them to the parent.  Most of the heavy lifting is done
      15             : // within the nsSVGGradientFrame, which is the parent for this frame
      16             : 
      17           0 : class nsSVGStopFrame : public nsFrame
      18             : {
      19             :   friend nsIFrame*
      20             :   NS_NewSVGStopFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
      21             : protected:
      22           0 :   explicit nsSVGStopFrame(nsStyleContext* aContext)
      23           0 :     : nsFrame(aContext, kClassID)
      24             :   {
      25           0 :     AddStateBits(NS_FRAME_IS_NONDISPLAY);
      26           0 :   }
      27             : 
      28             : public:
      29           0 :   NS_DECL_FRAMEARENA_HELPERS(nsSVGStopFrame)
      30             : 
      31             :   // nsIFrame interface:
      32             : #ifdef DEBUG
      33             :   virtual void Init(nsIContent*       aContent,
      34             :                     nsContainerFrame* aParent,
      35             :                     nsIFrame*         aPrevInFlow) override;
      36             : #endif
      37             : 
      38           0 :   void BuildDisplayList(nsDisplayListBuilder*   aBuilder,
      39             :                         const nsRect&           aDirtyRect,
      40           0 :                         const nsDisplayListSet& aLists) override {}
      41             : 
      42             :   virtual nsresult AttributeChanged(int32_t         aNameSpaceID,
      43             :                                     nsIAtom*        aAttribute,
      44             :                                     int32_t         aModType) override;
      45             : 
      46           0 :   virtual bool IsFrameOfType(uint32_t aFlags) const override
      47             :   {
      48           0 :     return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eSVG));
      49             :   }
      50             : 
      51             : #ifdef DEBUG_FRAME_DUMP
      52           0 :   virtual nsresult GetFrameName(nsAString& aResult) const override
      53             :   {
      54           0 :     return MakeFrameName(NS_LITERAL_STRING("SVGStop"), aResult);
      55             :   }
      56             : #endif
      57             : };
      58             : 
      59             : //----------------------------------------------------------------------
      60             : // Implementation
      61             : 
      62           0 : NS_IMPL_FRAMEARENA_HELPERS(nsSVGStopFrame)
      63             : 
      64             : //----------------------------------------------------------------------
      65             : // nsIFrame methods:
      66             : 
      67             : #ifdef DEBUG
      68             : void
      69           0 : nsSVGStopFrame::Init(nsIContent*       aContent,
      70             :                      nsContainerFrame* aParent,
      71             :                      nsIFrame*         aPrevInFlow)
      72             : {
      73           0 :   NS_ASSERTION(aContent->IsSVGElement(nsGkAtoms::stop), "Content is not a stop element");
      74             : 
      75           0 :   nsFrame::Init(aContent, aParent, aPrevInFlow);
      76           0 : }
      77             : #endif /* DEBUG */
      78             : 
      79             : nsresult
      80           0 : nsSVGStopFrame::AttributeChanged(int32_t         aNameSpaceID,
      81             :                                  nsIAtom*        aAttribute,
      82             :                                  int32_t         aModType)
      83             : {
      84           0 :   if (aNameSpaceID == kNameSpaceID_None &&
      85           0 :       aAttribute == nsGkAtoms::offset) {
      86           0 :     MOZ_ASSERT(GetParent()->IsSVGLinearGradientFrame() ||
      87             :                GetParent()->IsSVGRadialGradientFrame(),
      88             :                "Observers observe the gradient, so that's what we must invalidate");
      89           0 :     nsSVGEffects::InvalidateDirectRenderingObservers(GetParent());
      90             :   }
      91             : 
      92           0 :   return nsFrame::AttributeChanged(aNameSpaceID, aAttribute, aModType);
      93             : }
      94             : 
      95             : // -------------------------------------------------------------------------
      96             : // Public functions
      97             : // -------------------------------------------------------------------------
      98             : 
      99           0 : nsIFrame* NS_NewSVGStopFrame(nsIPresShell*   aPresShell,
     100             :                              nsStyleContext* aContext)
     101             : {
     102           0 :   return new (aPresShell) nsSVGStopFrame(aContext);
     103             : }

Generated by: LCOV version 1.13