LCOV - code coverage report
Current view: directory - content/svg/content/src - nsSVGPatternElement.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 56 0 0.0 %
Date: 2012-06-02 Functions: 25 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                 :  * Scooter Morris.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2005
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *   Scooter Morris <scootermorris@comcast.net>
      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 "mozilla/Util.h"
      40                 : 
      41                 : #include "DOMSVGAnimatedTransformList.h"
      42                 : #include "nsIDOMMutationEvent.h"
      43                 : #include "nsCOMPtr.h"
      44                 : #include "nsGkAtoms.h"
      45                 : #include "nsSVGPatternElement.h"
      46                 : #include "nsIFrame.h"
      47                 : 
      48                 : using namespace mozilla;
      49                 : 
      50                 : //--------------------- Patterns ------------------------
      51                 : 
      52                 : nsSVGElement::LengthInfo nsSVGPatternElement::sLengthInfo[4] =
      53                 : {
      54                 :   { &nsGkAtoms::x, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::X },
      55                 :   { &nsGkAtoms::y, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::Y },
      56                 :   { &nsGkAtoms::width, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::X },
      57                 :   { &nsGkAtoms::height, 0, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::Y },
      58                 : };
      59                 : 
      60                 : nsSVGElement::EnumInfo nsSVGPatternElement::sEnumInfo[2] =
      61                 : {
      62                 :   { &nsGkAtoms::patternUnits,
      63                 :     sSVGUnitTypesMap,
      64                 :     nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
      65                 :   },
      66                 :   { &nsGkAtoms::patternContentUnits,
      67                 :     sSVGUnitTypesMap,
      68                 :     nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE
      69                 :   }
      70                 : };
      71                 : 
      72                 : nsSVGElement::StringInfo nsSVGPatternElement::sStringInfo[1] =
      73                 : {
      74                 :   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
      75                 : };
      76                 : 
      77               0 : NS_IMPL_NS_NEW_SVG_ELEMENT(Pattern)
      78                 : 
      79                 : //----------------------------------------------------------------------
      80                 : // nsISupports methods
      81                 : 
      82               0 : NS_IMPL_ADDREF_INHERITED(nsSVGPatternElement,nsSVGPatternElementBase)
      83               0 : NS_IMPL_RELEASE_INHERITED(nsSVGPatternElement,nsSVGPatternElementBase)
      84                 : 
      85               0 : DOMCI_NODE_DATA(SVGPatternElement, nsSVGPatternElement)
      86                 : 
      87               0 : NS_INTERFACE_TABLE_HEAD(nsSVGPatternElement)
      88               0 :   NS_NODE_INTERFACE_TABLE8(nsSVGPatternElement, nsIDOMNode, nsIDOMElement,
      89                 :                            nsIDOMSVGElement, nsIDOMSVGTests,
      90                 :                            nsIDOMSVGFitToViewBox, nsIDOMSVGURIReference,
      91                 :                            nsIDOMSVGPatternElement, nsIDOMSVGUnitTypes)
      92               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGPatternElement)
      93               0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGPatternElementBase)
      94                 : 
      95                 : //----------------------------------------------------------------------
      96                 : // Implementation
      97                 : 
      98               0 : nsSVGPatternElement::nsSVGPatternElement(already_AddRefed<nsINodeInfo> aNodeInfo)
      99               0 :   : nsSVGPatternElementBase(aNodeInfo)
     100                 : {
     101               0 : }
     102                 : 
     103                 : //----------------------------------------------------------------------
     104                 : // nsIDOMNode method
     105                 : 
     106               0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGPatternElement)
     107                 : 
     108                 : //----------------------------------------------------------------------
     109                 : // nsIDOMSVGFitToViewBox methods
     110                 : 
     111                 : /* readonly attribute nsIDOMSVGAnimatedRect viewBox; */
     112               0 : NS_IMETHODIMP nsSVGPatternElement::GetViewBox(nsIDOMSVGAnimatedRect * *aViewBox)
     113                 : {
     114               0 :   return mViewBox.ToDOMAnimatedRect(aViewBox, this);
     115                 : }
     116                 : 
     117                 : /* readonly attribute nsIDOMSVGAnimatedPreserveAspectRatio preserveAspectRatio; */
     118                 : NS_IMETHODIMP
     119               0 : nsSVGPatternElement::GetPreserveAspectRatio(nsIDOMSVGAnimatedPreserveAspectRatio
     120                 :                                             **aPreserveAspectRatio)
     121                 : {
     122               0 :   return mPreserveAspectRatio.ToDOMAnimatedPreserveAspectRatio(aPreserveAspectRatio, this);
     123                 : }
     124                 : 
     125                 : //----------------------------------------------------------------------
     126                 : // nsIDOMSVGPatternElement methods
     127                 : 
     128                 : /* readonly attribute nsIDOMSVGAnimatedEnumeration patternUnits; */
     129               0 : NS_IMETHODIMP nsSVGPatternElement::GetPatternUnits(nsIDOMSVGAnimatedEnumeration * *aPatternUnits)
     130                 : {
     131               0 :   return mEnumAttributes[PATTERNUNITS].ToDOMAnimatedEnum(aPatternUnits, this);
     132                 : }
     133                 : 
     134                 : /* readonly attribute nsIDOMSVGAnimatedEnumeration patternContentUnits; */
     135               0 : NS_IMETHODIMP nsSVGPatternElement::GetPatternContentUnits(nsIDOMSVGAnimatedEnumeration * *aPatternUnits)
     136                 : {
     137               0 :   return mEnumAttributes[PATTERNCONTENTUNITS].ToDOMAnimatedEnum(aPatternUnits, this);
     138                 : }
     139                 : 
     140                 : /* readonly attribute nsIDOMSVGAnimatedTransformList patternTransform; */
     141               0 : NS_IMETHODIMP nsSVGPatternElement::GetPatternTransform(nsIDOMSVGAnimatedTransformList * *aPatternTransform)
     142                 : {
     143                 :   *aPatternTransform =
     144               0 :     DOMSVGAnimatedTransformList::GetDOMWrapper(GetAnimatedTransformList(), this)
     145               0 :     .get();
     146               0 :   return NS_OK;
     147                 : }
     148                 : 
     149                 : /* readonly attribute nsIDOMSVGAnimatedLength x; */
     150               0 : NS_IMETHODIMP nsSVGPatternElement::GetX(nsIDOMSVGAnimatedLength * *aX)
     151                 : {
     152               0 :   return mLengthAttributes[X].ToDOMAnimatedLength(aX, this);
     153                 : }
     154                 : 
     155                 : /* readonly attribute nsIDOMSVGAnimatedLength y; */
     156               0 : NS_IMETHODIMP nsSVGPatternElement::GetY(nsIDOMSVGAnimatedLength * *aY)
     157                 : {
     158               0 :   return mLengthAttributes[Y].ToDOMAnimatedLength(aY, this);
     159                 : }
     160                 : 
     161                 : /* readonly attribute nsIDOMSVGAnimatedLength width; */
     162               0 : NS_IMETHODIMP nsSVGPatternElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
     163                 : {
     164               0 :   return mLengthAttributes[WIDTH].ToDOMAnimatedLength(aWidth, this);
     165                 : }
     166                 : 
     167                 : /* readonly attribute nsIDOMSVGAnimatedLength height; */
     168               0 : NS_IMETHODIMP nsSVGPatternElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
     169                 : {
     170               0 :   return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this);
     171                 : }
     172                 : 
     173                 : 
     174                 : //----------------------------------------------------------------------
     175                 : // nsIDOMSVGURIReference methods:
     176                 : 
     177                 : /* readonly attribute nsIDOMSVGAnimatedString href; */
     178                 : NS_IMETHODIMP
     179               0 : nsSVGPatternElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
     180                 : {
     181               0 :   return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
     182                 : }
     183                 : 
     184                 : //----------------------------------------------------------------------
     185                 : // nsIContent methods
     186                 : 
     187                 : NS_IMETHODIMP_(bool)
     188               0 : nsSVGPatternElement::IsAttributeMapped(const nsIAtom* name) const
     189                 : {
     190                 :   static const MappedAttributeEntry* const map[] = {
     191                 :     sFEFloodMap,
     192                 :     sFiltersMap,
     193                 :     sFontSpecificationMap,
     194                 :     sGradientStopMap,
     195                 :     sLightingEffectsMap,
     196                 :     sMarkersMap,
     197                 :     sTextContentElementsMap,
     198                 :     sViewportsMap
     199                 :   };
     200                 : 
     201               0 :   return FindAttributeDependence(name, map) ||
     202               0 :     nsSVGPatternElementBase::IsAttributeMapped(name);
     203                 : }
     204                 : 
     205                 : //----------------------------------------------------------------------
     206                 : // nsSVGElement methods
     207                 : 
     208                 : SVGAnimatedTransformList*
     209               0 : nsSVGPatternElement::GetAnimatedTransformList()
     210                 : {
     211               0 :   if (!mPatternTransform) {
     212               0 :     mPatternTransform = new SVGAnimatedTransformList();
     213                 :   }
     214               0 :   return mPatternTransform;
     215                 : }
     216                 : 
     217                 : /* virtual */ bool
     218               0 : nsSVGPatternElement::HasValidDimensions() const
     219                 : {
     220               0 :   return mLengthAttributes[WIDTH].IsExplicitlySet() &&
     221               0 :          mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0 &&
     222               0 :          mLengthAttributes[HEIGHT].IsExplicitlySet() &&
     223               0 :          mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0;
     224                 : }
     225                 : 
     226                 : nsSVGElement::LengthAttributesInfo
     227               0 : nsSVGPatternElement::GetLengthInfo()
     228                 : {
     229                 :   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
     230               0 :                               ArrayLength(sLengthInfo));
     231                 : }
     232                 : 
     233                 : nsSVGElement::EnumAttributesInfo
     234               0 : nsSVGPatternElement::GetEnumInfo()
     235                 : {
     236                 :   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
     237               0 :                             ArrayLength(sEnumInfo));
     238                 : }
     239                 : 
     240                 : nsSVGViewBox *
     241               0 : nsSVGPatternElement::GetViewBox()
     242                 : {
     243               0 :   return &mViewBox;
     244                 : }
     245                 : 
     246                 : SVGAnimatedPreserveAspectRatio *
     247               0 : nsSVGPatternElement::GetPreserveAspectRatio()
     248                 : {
     249               0 :   return &mPreserveAspectRatio;
     250                 : }
     251                 : 
     252                 : nsSVGElement::StringAttributesInfo
     253               0 : nsSVGPatternElement::GetStringInfo()
     254                 : {
     255                 :   return StringAttributesInfo(mStringAttributes, sStringInfo,
     256               0 :                               ArrayLength(sStringInfo));
     257                 : }
     258                 : 

Generated by: LCOV version 1.7