LCOV - code coverage report
Current view: directory - layout/svg/base/src - nsSVGGFrame.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 28 0 0.0 %
Date: 2012-06-02 Functions: 8 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is the Mozilla SVG project.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Crocodile Clips Ltd..
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2001
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Alex Fritze <alex.fritze@crocodile-clips.com> (original author)
      24                 :  *
      25                 :  * Alternatively, the contents of this file may be used under the terms of
      26                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      27                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      28                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      29                 :  * of those above. If you wish to allow use of your version of this file only
      30                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      31                 :  * use your version of this file under the terms of the MPL, indicate your
      32                 :  * decision by deleting the provisions above and replace them with the notice
      33                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      34                 :  * the provisions above, a recipient may use your version of this file under
      35                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      36                 :  *
      37                 :  * ***** END LICENSE BLOCK ***** */
      38                 : 
      39                 : #include "nsIDOMSVGTransformable.h"
      40                 : #include "nsSVGGFrame.h"
      41                 : #include "nsIFrame.h"
      42                 : #include "nsGkAtoms.h"
      43                 : #include "nsSVGUtils.h"
      44                 : #include "nsSVGGraphicElement.h"
      45                 : 
      46                 : //----------------------------------------------------------------------
      47                 : // Implementation
      48                 : 
      49                 : nsIFrame*
      50               0 : NS_NewSVGGFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
      51                 : {  
      52               0 :   return new (aPresShell) nsSVGGFrame(aContext);
      53                 : }
      54                 : 
      55               0 : NS_IMPL_FRAMEARENA_HELPERS(nsSVGGFrame)
      56                 : 
      57                 : #ifdef DEBUG
      58                 : NS_IMETHODIMP
      59               0 : nsSVGGFrame::Init(nsIContent* aContent,
      60                 :                   nsIFrame* aParent,
      61                 :                   nsIFrame* aPrevInFlow)
      62                 : {
      63               0 :   nsCOMPtr<nsIDOMSVGTransformable> transformable = do_QueryInterface(aContent);
      64               0 :   NS_ASSERTION(transformable,
      65                 :                "The element doesn't support nsIDOMSVGTransformable\n");
      66                 : 
      67               0 :   return nsSVGGFrameBase::Init(aContent, aParent, aPrevInFlow);
      68                 : }
      69                 : #endif /* DEBUG */
      70                 : 
      71                 : nsIAtom *
      72               0 : nsSVGGFrame::GetType() const
      73                 : {
      74               0 :   return nsGkAtoms::svgGFrame;
      75                 : }
      76                 : 
      77                 : //----------------------------------------------------------------------
      78                 : // nsISVGChildFrame methods
      79                 : 
      80                 : void
      81               0 : nsSVGGFrame::NotifySVGChanged(PRUint32 aFlags)
      82                 : {
      83               0 :   NS_ABORT_IF_FALSE(!(aFlags & DO_NOT_NOTIFY_RENDERING_OBSERVERS) ||
      84                 :                     (GetStateBits() & NS_STATE_SVG_NONDISPLAY_CHILD),
      85                 :                     "Must be NS_STATE_SVG_NONDISPLAY_CHILD!");
      86                 : 
      87               0 :   NS_ABORT_IF_FALSE(aFlags & (TRANSFORM_CHANGED | COORD_CONTEXT_CHANGED),
      88                 :                     "Invalidation logic may need adjusting");
      89                 : 
      90               0 :   if (aFlags & TRANSFORM_CHANGED) {
      91                 :     // make sure our cached transform matrix gets (lazily) updated
      92               0 :     mCanvasTM = nsnull;
      93                 :   }
      94                 : 
      95               0 :   nsSVGGFrameBase::NotifySVGChanged(aFlags);
      96               0 : }
      97                 : 
      98                 : gfxMatrix
      99               0 : nsSVGGFrame::GetCanvasTM()
     100                 : {
     101               0 :   if (!mCanvasTM) {
     102               0 :     NS_ASSERTION(mParent, "null parent");
     103                 : 
     104               0 :     nsSVGContainerFrame *parent = static_cast<nsSVGContainerFrame*>(mParent);
     105               0 :     nsSVGGraphicElement *content = static_cast<nsSVGGraphicElement*>(mContent);
     106                 : 
     107               0 :     gfxMatrix tm = content->PrependLocalTransformsTo(parent->GetCanvasTM());
     108                 : 
     109               0 :     mCanvasTM = new gfxMatrix(tm);
     110                 :   }
     111               0 :   return *mCanvasTM;
     112                 : }
     113                 : 
     114                 : NS_IMETHODIMP
     115               0 : nsSVGGFrame::AttributeChanged(PRInt32         aNameSpaceID,
     116                 :                               nsIAtom*        aAttribute,
     117                 :                               PRInt32         aModType)
     118                 : {
     119               0 :   if (aNameSpaceID == kNameSpaceID_None &&
     120                 :       aAttribute == nsGkAtoms::transform) {
     121                 : 
     122               0 :     NotifySVGChanged(TRANSFORM_CHANGED);
     123                 :   }
     124                 :   
     125               0 :   return NS_OK;
     126                 : }

Generated by: LCOV version 1.7