LCOV - app.info - content/svg/content/src/nsSVGFilterElement.cpp

LCOV - code coverage report
| Current view: | directory - content/svg/content/src - nsSVGFilterElement.cpp (source / functions) |  | Found | Hit | Coverage |
| Test: | app.info | Lines: | 59 | 0 | 0.0 %
| Date: | 2012-06-02 | Functions: | 24 | 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 IBM Corporation.
          18                 :  * Portions created by the Initial Developer are Copyright (C) 2005
          19                 :  * the Initial Developer. All Rights Reserved.
          20                 :  *
          21                 :  * Contributor(s):
          22                 :  *
          23                 :  * Alternatively, the contents of this file may be used under the terms of
          24                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
          25                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
          26                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
          27                 :  * of those above. If you wish to allow use of your version of this file only
          28                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
          29                 :  * use your version of this file under the terms of the MPL, indicate your
          30                 :  * decision by deleting the provisions above and replace them with the notice
          31                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
          32                 :  * the provisions above, a recipient may use your version of this file under
          33                 :  * the terms of any one of the MPL, the GPL or the LGPL.
          34                 :  *
          35                 :  * ***** END LICENSE BLOCK ***** */
          36                 :
          37                 : #include "mozilla/Util.h"
          38                 :
          39                 : #include "nsGkAtoms.h"
          40                 : #include "nsCOMPtr.h"
          41                 : #include "nsSVGFilterElement.h"
          42                 : #include "nsSVGEffects.h"
          43                 :
          44                 : using namespace mozilla;
          45                 :
          46                 : nsSVGElement::LengthInfo nsSVGFilterElement::sLengthInfo[4] =
          47                 : {
          48                 :   { &nsGkAtoms::x, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::X },
          49                 :   { &nsGkAtoms::y, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::Y },
          50                 :   { &nsGkAtoms::width, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::X },
          51                 :   { &nsGkAtoms::height, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, nsSVGUtils::Y },
          52                 : };
          53                 :
          54                 : nsSVGElement::IntegerPairInfo nsSVGFilterElement::sIntegerPairInfo[1] =
          55                 : {
          56                 :   { &nsGkAtoms::filterRes, 0 }
          57                 : };
          58                 :
          59                 : nsSVGElement::EnumInfo nsSVGFilterElement::sEnumInfo[2] =
          60                 : {
          61                 :   { &nsGkAtoms::filterUnits,
          62                 :     sSVGUnitTypesMap,
          63                 :     nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
          64                 :   },
          65                 :   { &nsGkAtoms::primitiveUnits,
          66                 :     sSVGUnitTypesMap,
          67                 :     nsIDOMSVGUnitTypes::SVG_UNIT_TYPE_USERSPACEONUSE
          68                 :   }
          69                 : };
          70                 :
          71                 : nsSVGElement::StringInfo nsSVGFilterElement::sStringInfo[1] =
          72                 : {
          73                 :   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
          74                 : };
          75                 :
          76               0 : NS_IMPL_NS_NEW_SVG_ELEMENT(Filter)
          77                 :
          78                 : //----------------------------------------------------------------------
          79                 : // nsISupports methods
          80                 :
          81               0 : NS_IMPL_ADDREF_INHERITED(nsSVGFilterElement,nsSVGFilterElementBase)
          82               0 : NS_IMPL_RELEASE_INHERITED(nsSVGFilterElement,nsSVGFilterElementBase)
          83                 :
          84               0 : DOMCI_NODE_DATA(SVGFilterElement, nsSVGFilterElement)
          85                 :
          86               0 : NS_INTERFACE_TABLE_HEAD(nsSVGFilterElement)
          87               0 :   NS_NODE_INTERFACE_TABLE6(nsSVGFilterElement, nsIDOMNode, nsIDOMElement,
          88                 :                            nsIDOMSVGElement, nsIDOMSVGTests,
          89                 :                            nsIDOMSVGFilterElement,
          90                 :                            nsIDOMSVGURIReference)
          91               0 :   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(SVGFilterElement)
          92               0 : NS_INTERFACE_MAP_END_INHERITING(nsSVGFilterElementBase)
          93                 :
          94                 : //----------------------------------------------------------------------
          95                 : // Implementation
          96                 :
          97               0 : nsSVGFilterElement::nsSVGFilterElement(already_AddRefed<nsINodeInfo> aNodeInfo)
          98               0 :   : nsSVGFilterElementBase(aNodeInfo)
          99                 : {
         100               0 : }
         101                 :
         102                 : //----------------------------------------------------------------------
         103                 : // nsIDOMNode methods
         104                 :
         105                 :
         106               0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(nsSVGFilterElement)
         107                 :
         108                 :
         109                 : //----------------------------------------------------------------------
         110                 : // nsIDOMSVGFilterElement methods
         111                 :
         112                 : /* readonly attribute nsIDOMSVGAnimatedLength x; */
         113               0 : NS_IMETHODIMP nsSVGFilterElement::GetX(nsIDOMSVGAnimatedLength * *aX)
         114                 : {
         115               0 :   return mLengthAttributes[X].ToDOMAnimatedLength(aX, this);
         116                 : }
         117                 :
         118                 : /* readonly attribute nsIDOMSVGAnimatedLength y; */
         119               0 : NS_IMETHODIMP nsSVGFilterElement::GetY(nsIDOMSVGAnimatedLength * *aY)
         120                 : {
         121               0 :   return mLengthAttributes[Y].ToDOMAnimatedLength(aY, this);
         122                 : }
         123                 :
         124                 : /* readonly attribute nsIDOMSVGAnimatedLength width; */
         125               0 : NS_IMETHODIMP nsSVGFilterElement::GetWidth(nsIDOMSVGAnimatedLength * *aWidth)
         126                 : {
         127               0 :   return mLengthAttributes[WIDTH].ToDOMAnimatedLength(aWidth, this);
         128                 : }
         129                 :
         130                 : /* readonly attribute nsIDOMSVGAnimatedLength height; */
         131               0 : NS_IMETHODIMP nsSVGFilterElement::GetHeight(nsIDOMSVGAnimatedLength * *aHeight)
         132                 : {
         133               0 :   return mLengthAttributes[HEIGHT].ToDOMAnimatedLength(aHeight, this);
         134                 : }
         135                 :
         136                 : /* readonly attribute nsIDOMSVGAnimatedEnumeration filterUnits; */
         137               0 : NS_IMETHODIMP nsSVGFilterElement::GetFilterUnits(nsIDOMSVGAnimatedEnumeration * *aUnits)
         138                 : {
         139               0 :   return mEnumAttributes[FILTERUNITS].ToDOMAnimatedEnum(aUnits, this);
         140                 : }
         141                 :
         142                 : /* readonly attribute nsIDOMSVGAnimatedEnumeration primitiveUnits; */
         143               0 : NS_IMETHODIMP nsSVGFilterElement::GetPrimitiveUnits(nsIDOMSVGAnimatedEnumeration * *aUnits)
         144                 : {
         145               0 :   return mEnumAttributes[PRIMITIVEUNITS].ToDOMAnimatedEnum(aUnits, this);
         146                 : }
         147                 :
         148                 : /* readonly attribute nsIDOMSVGAnimatedEnumeration filterResY; */
         149               0 : NS_IMETHODIMP nsSVGFilterElement::GetFilterResX(nsIDOMSVGAnimatedInteger * *aFilterResX)
         150                 : {
         151                 :   return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(aFilterResX,
         152                 :                                                                 nsSVGIntegerPair::eFirst,
         153               0 :                                                                 this);
         154                 : }
         155                 :
         156                 : /* readonly attribute nsIDOMSVGAnimatedEnumeration filterResY; */
         157               0 : NS_IMETHODIMP nsSVGFilterElement::GetFilterResY(nsIDOMSVGAnimatedInteger * *aFilterResY)
         158                 : {
         159                 :   return mIntegerPairAttributes[FILTERRES].ToDOMAnimatedInteger(aFilterResY,
         160                 :                                                                 nsSVGIntegerPair::eSecond,
         161               0 :                                                                 this);
         162                 : }
         163                 :
         164                 : /* void setFilterRes (in unsigned long filterResX, in unsigned long filterResY);
         165                 :  */
         166                 : NS_IMETHODIMP
         167               0 : nsSVGFilterElement::SetFilterRes(PRUint32 filterResX, PRUint32 filterResY)
         168                 : {
         169               0 :   mIntegerPairAttributes[FILTERRES].SetBaseValues(filterResX, filterResY, this);
         170               0 :   return NS_OK;
         171                 : }
         172                 :
         173                 : //----------------------------------------------------------------------
         174                 : // nsIDOMSVGURIReference methods
         175                 :
         176                 : /* readonly attribute nsIDOMSVGAnimatedString href; */
         177                 : NS_IMETHODIMP
         178               0 : nsSVGFilterElement::GetHref(nsIDOMSVGAnimatedString * *aHref)
         179                 : {
         180               0 :   return mStringAttributes[HREF].ToDOMAnimatedString(aHref, this);
         181                 : }
         182                 :
         183                 : //----------------------------------------------------------------------
         184                 : // nsIContent methods
         185                 :
         186                 : NS_IMETHODIMP_(bool)
         187               0 : nsSVGFilterElement::IsAttributeMapped(const nsIAtom* name) const
         188                 : {
         189                 :   static const MappedAttributeEntry* const map[] = {
         190                 :     sFEFloodMap,
         191                 :     sFiltersMap,
         192                 :     sFontSpecificationMap,
         193                 :     sGradientStopMap,
         194                 :     sLightingEffectsMap,
         195                 :     sMarkersMap,
         196                 :     sTextContentElementsMap,
         197                 :     sViewportsMap
         198                 :   };
         199               0 :   return FindAttributeDependence(name, map) ||
         200               0 :     nsSVGGraphicElementBase::IsAttributeMapped(name);
         201                 : }
         202                 :
         203                 : void
         204               0 : nsSVGFilterElement::Invalidate()
         205                 : {
         206               0 :   nsTObserverArray<nsIMutationObserver*> *observers = GetMutationObservers();
         207                 :
         208               0 :   if (observers && !observers->IsEmpty()) {
         209               0 :     nsTObserverArray<nsIMutationObserver*>::ForwardIterator iter(*observers);
         210               0 :     while (iter.HasMore()) {
         211               0 :       nsCOMPtr<nsIMutationObserver> obs(iter.GetNext());
         212               0 :       nsCOMPtr<nsISVGFilterProperty> filter = do_QueryInterface(obs);
         213               0 :       if (filter)
         214               0 :         filter->Invalidate();
         215                 :     }
         216                 :   }
         217               0 : }
         218                 :
         219                 : //----------------------------------------------------------------------
         220                 : // nsSVGElement methods
         221                 :
         222                 : /* virtual */ bool
         223               0 : nsSVGFilterElement::HasValidDimensions() const
         224                 : {
         225               0 :   return (!mLengthAttributes[WIDTH].IsExplicitlySet() ||
         226               0 :            mLengthAttributes[WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
         227               0 :          (!mLengthAttributes[HEIGHT].IsExplicitlySet() ||
         228               0 :            mLengthAttributes[HEIGHT].GetAnimValInSpecifiedUnits() > 0);
         229                 : }
         230                 :
         231                 : nsSVGElement::LengthAttributesInfo
         232               0 : nsSVGFilterElement::GetLengthInfo()
         233                 : {
         234                 :   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
         235               0 :                               ArrayLength(sLengthInfo));
         236                 : }
         237                 :
         238                 : nsSVGElement::IntegerPairAttributesInfo
         239               0 : nsSVGFilterElement::GetIntegerPairInfo()
         240                 : {
         241                 :   return IntegerPairAttributesInfo(mIntegerPairAttributes, sIntegerPairInfo,
         242               0 :                                    ArrayLength(sIntegerPairInfo));
         243                 : }
         244                 :
         245                 : nsSVGElement::EnumAttributesInfo
         246               0 : nsSVGFilterElement::GetEnumInfo()
         247                 : {
         248                 :   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
         249               0 :                             ArrayLength(sEnumInfo));
         250                 : }
         251                 :
         252                 : nsSVGElement::StringAttributesInfo
         253               0 : nsSVGFilterElement::GetStringInfo()
         254                 : {
         255                 :   return StringAttributesInfo(mStringAttributes, sStringInfo,
         256               0 :                               ArrayLength(sStringInfo));
         257                 : }

Generated by: LCOV version 1.7