LCOV - code coverage report
Current view: top level - layout/svg - nsSVGGFrame.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 13 26 50.0 %
Date: 2017-07-14 16:53:18 Functions: 4 6 66.7 %
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             : // Main header first:
       7             : #include "nsSVGGFrame.h"
       8             : 
       9             : // Keep others in (case-insensitive) order:
      10             : #include "nsGkAtoms.h"
      11             : #include "SVGTransformableElement.h"
      12             : #include "nsIFrame.h"
      13             : #include "SVGGraphicsElement.h"
      14             : #include "nsSVGIntegrationUtils.h"
      15             : #include "nsSVGUtils.h"
      16             : 
      17             : using namespace mozilla::dom;
      18             : 
      19             : //----------------------------------------------------------------------
      20             : // Implementation
      21             : 
      22             : nsIFrame*
      23          11 : NS_NewSVGGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
      24             : {
      25          11 :   return new (aPresShell) nsSVGGFrame(aContext);
      26             : }
      27             : 
      28          11 : NS_IMPL_FRAMEARENA_HELPERS(nsSVGGFrame)
      29             : 
      30             : #ifdef DEBUG
      31             : void
      32          34 : nsSVGGFrame::Init(nsIContent*       aContent,
      33             :                   nsContainerFrame* aParent,
      34             :                   nsIFrame*         aPrevInFlow)
      35             : {
      36          34 :   NS_ASSERTION(aContent->IsSVGElement() &&
      37             :                static_cast<nsSVGElement*>(aContent)->IsTransformable(),
      38             :                "The element doesn't support nsIDOMSVGTransformable");
      39             : 
      40          34 :   nsSVGDisplayContainerFrame::Init(aContent, aParent, aPrevInFlow);
      41          34 : }
      42             : #endif /* DEBUG */
      43             : 
      44             : //----------------------------------------------------------------------
      45             : // nsSVGDisplayableFrame methods
      46             : 
      47             : void
      48          25 : nsSVGGFrame::NotifySVGChanged(uint32_t aFlags)
      49             : {
      50          25 :   MOZ_ASSERT(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
      51             :              "Invalidation logic may need adjusting");
      52             : 
      53          25 :   if (aFlags & TRANSFORM_CHANGED) {
      54             :     // make sure our cached transform matrix gets (lazily) updated
      55          25 :     mCanvasTM = nullptr;
      56             :   }
      57             : 
      58          25 :   nsSVGDisplayContainerFrame::NotifySVGChanged(aFlags);
      59          25 : }
      60             : 
      61             : gfxMatrix
      62           0 : nsSVGGFrame::GetCanvasTM()
      63             : {
      64           0 :   if (!mCanvasTM) {
      65           0 :     NS_ASSERTION(GetParent(), "null parent");
      66             : 
      67           0 :     nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(GetParent());
      68           0 :     SVGGraphicsElement *content = static_cast<SVGGraphicsElement*>(mContent);
      69             : 
      70           0 :     gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
      71             : 
      72           0 :     mCanvasTM = new gfxMatrix(tm);
      73             :   }
      74           0 :   return *mCanvasTM;
      75             : }
      76             : 
      77             : nsresult
      78           0 : nsSVGGFrame::AttributeChanged(int32_t         aNameSpaceID,
      79             :                               nsIAtom*        aAttribute,
      80             :                               int32_t         aModType)
      81             : {
      82           0 :   if (aNameSpaceID == kNameSpaceID_None &&
      83           0 :       aAttribute == nsGkAtoms::transform) {
      84             :     // We don't invalidate for transform changes (the layers code does that).
      85             :     // Also note that SVGTransformableElement::GetAttributeChangeHint will
      86             :     // return nsChangeHint_UpdateOverflow for "transform" attribute changes
      87             :     // and cause DoApplyRenderingChangeToTree to make the SchedulePaint call.
      88           0 :     NotifySVGChanged(TRANSFORM_CHANGED);
      89             :   }
      90             : 
      91           0 :   return NS_OK;
      92             : }

Generated by: LCOV version 1.13