LCOV - code coverage report
Current view: directory - content/svg/content/src - nsSVGForeignObjectElement.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 41 0 0.0 %
Date: 2012-06-02 Functions: 15 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 of the GNU General Public License Version 2 or later (the "GPL"),
      27                 :  * or 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 "mozilla/Util.h"
      40                 : 
      41                 : #include "nsCOMPtr.h"
      42                 : #include "nsSVGForeignObjectElement.h"
      43                 : 
      44                 : using namespace mozilla;
      45                 : 
      46                 : nsSVGElement::LengthInfo nsSVGForeignObjectElement::sLengthInfo[4] =
      47                 : {
      48                 :   { &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::X },
      49                 :   { &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::Y },
      50                 :   { &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::X },
      51                 :   { &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_NUMBER, nsSVGUtils::Y },
      52                 : };
      53                 : 
      54               0 : NS_IMPL_NS_NEW_SVG_ELEMENT(ForeignObject)
      55                 : 
      56                 : //----------------------------------------------------------------------
      57                 : // nsISupports methods
      58                 : 
      59               0 : NS_IMPL_ADDREF_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase)
      60               0 : NS_IMPL_RELEASE_INHERITED(nsSVGForeignObjectElement,nsSVGForeignObjectElementBase)
      61                 : 
      62               0 : DOMCI_NODE_DATA(SVGForeignObjectElement, nsSVGForeignObjectElement)
      63                 : 
      64               0 : NS_INTERFACE_TABLE_HEAD(nsSVGForeignObjectElement)
      65               0 :   NS_NODE_INTERFACE_TABLE5(nsSVGForeignObjectElement, nsIDOMNode, nsIDOMElement,
      66                 :                            nsIDOMSVGElement, nsIDOMSVGTests,
      67                 :                            nsIDOMSVGForeignObjectElement)
      68               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGForeignObjectElement)
      69               0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGForeignObjectElementBase)
      70                 : 
      71                 : //----------------------------------------------------------------------
      72                 : // Implementation
      73                 : 
      74               0 : nsSVGForeignObjectElement::nsSVGForeignObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo)
      75               0 :   : nsSVGForeignObjectElementBase(aNodeInfo)
      76                 : {
      77               0 : }
      78                 : 
      79                 : //----------------------------------------------------------------------
      80                 : // nsIDOMNode methods
      81                 : 
      82               0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGForeignObjectElement)
      83                 : 
      84                 : //----------------------------------------------------------------------
      85                 : // nsIDOMSVGForeignObjectElement methods:
      86                 : 
      87                 : /* readonly attribute nsIDOMSVGAnimatedLength x; */
      88               0 : NS_IMETHODIMP nsSVGForeignObjectElement::GetX(nsIDOMSVGAnimatedLength * *aX)
      89                 : {
      90               0 :   return mLengthAttributes[X].ToDOMAnimatedLength(aX, this);
      91                 : }
      92                 : 
      93                 : /* readonly attribute nsIDOMSVGAnimatedLength y; */
      94               0 : NS_IMETHODIMP nsSVGForeignObjectElement::GetY(nsIDOMSVGAnimatedLength * *aY)
      95                 : {
      96               0 :   return mLengthAttributes[Y].ToDOMAnimatedLength(aY, this);
      97                 : }
      98                 : 
      99                 : /* readonly attribute nsIDOMSVGAnimatedLength width; */
     100               0 : NS_IMETHODIMP nsSVGForeignObjectElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
     101                 : {
     102               0 :   return mLengthAttributes[WIDTH].ToDOMAnimatedLength(aWidth, this);
     103                 : }
     104                 : 
     105                 : /* readonly attribute nsIDOMSVGAnimatedLength height; */
     106               0 : NS_IMETHODIMP nsSVGForeignObjectElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
     107                 : {
     108               0 :   return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this);
     109                 : }
     110                 : 
     111                 : //----------------------------------------------------------------------
     112                 : // nsSVGElement methods
     113                 : 
     114                 : /* virtual */ gfxMatrix
     115               0 : nsSVGForeignObjectElement::PrependLocalTransformsTo(const gfxMatrix &aMatrix,
     116                 :                                                     TransformTypes aWhich) const
     117                 : {
     118               0 :   NS_ABORT_IF_FALSE(aWhich != eChildToUserSpace || aMatrix.IsIdentity(),
     119                 :                     "Skipping eUserSpaceToParent transforms makes no sense");
     120                 : 
     121                 :   // 'transform' attribute:
     122                 :   gfxMatrix fromUserSpace =
     123               0 :     nsSVGForeignObjectElementBase::PrependLocalTransformsTo(aMatrix, aWhich);
     124               0 :   if (aWhich == eUserSpaceToParent) {
     125               0 :     return fromUserSpace;
     126                 :   }
     127                 :   // our 'x' and 'y' attributes:
     128                 :   float x, y;
     129                 :   const_cast<nsSVGForeignObjectElement*>(this)->
     130               0 :     GetAnimatedLengthValues(&x, &y, nsnull);
     131               0 :   gfxMatrix toUserSpace = gfxMatrix().Translate(gfxPoint(x, y));
     132               0 :   if (aWhich == eChildToUserSpace) {
     133               0 :     return toUserSpace;
     134                 :   }
     135               0 :   NS_ABORT_IF_FALSE(aWhich == eAllTransforms, "Unknown TransformTypes");
     136               0 :   return toUserSpace * fromUserSpace;
     137                 : }
     138                 : 
     139                 : /* virtual */ bool
     140               0 : nsSVGForeignObjectElement::HasValidDimensions() const
     141                 : {
     142               0 :   return mLengthAttributes[WIDTH].IsExplicitlySet() &&
     143               0 :          mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
     144               0 :          mLengthAttributes[HEIGHT].IsExplicitlySet() &&
     145               0 :          mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
     146                 : }
     147                 : 
     148                 : //----------------------------------------------------------------------
     149                 : // nsIContent methods
     150                 : 
     151                 : NS_IMETHODIMP_(bool)
     152               0 : nsSVGForeignObjectElement::IsAttributeMapped(const nsIAtom* name) const
     153                 : {
     154                 :   static const MappedAttributeEntry* const map[] = {
     155                 :     sFEFloodMap,
     156                 :     sFiltersMap,
     157                 :     sFontSpecificationMap,
     158                 :     sGradientStopMap,
     159                 :     sLightingEffectsMap,
     160                 :     sMarkersMap,
     161                 :     sTextContentElementsMap,
     162                 :     sViewportsMap
     163                 :   };
     164                 : 
     165               0 :   return FindAttributeDependence(name, map) ||
     166               0 :     nsSVGForeignObjectElementBase::IsAttributeMapped(name);
     167                 : }
     168                 : 
     169                 : //----------------------------------------------------------------------
     170                 : // nsSVGElement methods
     171                 : 
     172                 : nsSVGElement::LengthAttributesInfo
     173               0 : nsSVGForeignObjectElement::GetLengthInfo()
     174                 : {
     175                 :   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
     176               0 :                               ArrayLength(sLengthInfo));
     177                 : }

Generated by: LCOV version 1.7