LCOV - code coverage report
Current view: top level - dom/svg - SVGFilterElement.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 46 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 17 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "mozilla/ArrayUtils.h"
       8             : 
       9             : #include "nsGkAtoms.h"
      10             : #include "nsCOMPtr.h"
      11             : #include "mozilla/dom/SVGFilterElement.h"
      12             : #include "mozilla/dom/SVGFilterElementBinding.h"
      13             : #include "nsSVGUtils.h"
      14             : 
      15           0 : NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Filter)
      16             : 
      17             : namespace mozilla {
      18             : namespace dom {
      19             : 
      20             : JSObject*
      21           0 : SVGFilterElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
      22             : {
      23           0 :   return SVGFilterElementBinding::Wrap(aCx, this, aGivenProto);
      24             : }
      25             : 
      26             : nsSVGElement::LengthInfo SVGFilterElement::sLengthInfo[4] =
      27             : {
      28             :   { &nsGkAtoms::x, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
      29             :   { &nsGkAtoms::y, -10, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
      30             :   { &nsGkAtoms::width, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::X },
      31             :   { &nsGkAtoms::height, 120, nsIDOMSVGLength::SVG_LENGTHTYPE_PERCENTAGE, SVGContentUtils::Y },
      32             : };
      33             : 
      34             : nsSVGElement::EnumInfo SVGFilterElement::sEnumInfo[2] =
      35             : {
      36             :   { &nsGkAtoms::filterUnits,
      37             :     sSVGUnitTypesMap,
      38             :     SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
      39             :   },
      40             :   { &nsGkAtoms::primitiveUnits,
      41             :     sSVGUnitTypesMap,
      42             :     SVG_UNIT_TYPE_USERSPACEONUSE
      43             :   }
      44             : };
      45             : 
      46             : nsSVGElement::StringInfo SVGFilterElement::sStringInfo[2] =
      47             : {
      48             :   { &nsGkAtoms::href, kNameSpaceID_None, true },
      49             :   { &nsGkAtoms::href, kNameSpaceID_XLink, true }
      50             : };
      51             : 
      52             : //----------------------------------------------------------------------
      53             : // Implementation
      54             : 
      55           0 : SVGFilterElement::SVGFilterElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
      56           0 :   : SVGFilterElementBase(aNodeInfo)
      57             : {
      58           0 : }
      59             : 
      60             : //----------------------------------------------------------------------
      61             : // nsIDOMNode methods
      62             : 
      63             : 
      64           0 : NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGFilterElement)
      65             : 
      66             : 
      67             : //----------------------------------------------------------------------
      68             : 
      69             : already_AddRefed<SVGAnimatedLength>
      70           0 : SVGFilterElement::X()
      71             : {
      72           0 :   return mLengthAttributes[ATTR_X].ToDOMAnimatedLength(this);
      73             : }
      74             : 
      75             : already_AddRefed<SVGAnimatedLength>
      76           0 : SVGFilterElement::Y()
      77             : {
      78           0 :    return mLengthAttributes[ATTR_Y].ToDOMAnimatedLength(this);
      79             : }
      80             : 
      81             : already_AddRefed<SVGAnimatedLength>
      82           0 : SVGFilterElement::Width()
      83             : {
      84           0 :   return mLengthAttributes[ATTR_WIDTH].ToDOMAnimatedLength(this);
      85             : }
      86             : 
      87             : already_AddRefed<SVGAnimatedLength>
      88           0 : SVGFilterElement::Height()
      89             : {
      90           0 :   return mLengthAttributes[ATTR_HEIGHT].ToDOMAnimatedLength(this);
      91             : }
      92             : 
      93             : already_AddRefed<SVGAnimatedEnumeration>
      94           0 : SVGFilterElement::FilterUnits()
      95             : {
      96           0 :   return mEnumAttributes[FILTERUNITS].ToDOMAnimatedEnum(this);
      97             : }
      98             : 
      99             : already_AddRefed<SVGAnimatedEnumeration>
     100           0 : SVGFilterElement::PrimitiveUnits()
     101             : {
     102           0 :   return mEnumAttributes[PRIMITIVEUNITS].ToDOMAnimatedEnum(this);
     103             : }
     104             : 
     105             : already_AddRefed<SVGAnimatedString>
     106           0 : SVGFilterElement::Href()
     107             : {
     108           0 :   return mStringAttributes[HREF].IsExplicitlySet()
     109             :          ? mStringAttributes[HREF].ToDOMAnimatedString(this)
     110           0 :          : mStringAttributes[XLINK_HREF].ToDOMAnimatedString(this);
     111             : }
     112             : 
     113             : //----------------------------------------------------------------------
     114             : // nsIContent methods
     115             : 
     116             : NS_IMETHODIMP_(bool)
     117           0 : SVGFilterElement::IsAttributeMapped(const nsIAtom* name) const
     118             : {
     119             :   static const MappedAttributeEntry* const map[] = {
     120             :     sFEFloodMap,
     121             :     sFiltersMap,
     122             :     sFontSpecificationMap,
     123             :     sGradientStopMap,
     124             :     sLightingEffectsMap,
     125             :     sMarkersMap,
     126             :     sTextContentElementsMap,
     127             :     sViewportsMap
     128             :   };
     129           0 :   return FindAttributeDependence(name, map) ||
     130           0 :     SVGFilterElementBase::IsAttributeMapped(name);
     131             : }
     132             : 
     133             : void
     134           0 : SVGFilterElement::Invalidate()
     135             : {
     136           0 :   nsTObserverArray<nsIMutationObserver*> *observers = GetMutationObservers();
     137             : 
     138           0 :   if (observers && !observers->IsEmpty()) {
     139           0 :     nsTObserverArray<nsIMutationObserver*>::ForwardIterator iter(*observers);
     140           0 :     while (iter.HasMore()) {
     141           0 :       nsCOMPtr<nsIMutationObserver> obs(iter.GetNext());
     142           0 :       nsCOMPtr<nsISVGFilterReference> filter = do_QueryInterface(obs);
     143           0 :       if (filter)
     144           0 :         filter->Invalidate();
     145             :     }
     146             :   }
     147           0 : }
     148             : 
     149             : //----------------------------------------------------------------------
     150             : // nsSVGElement methods
     151             : 
     152             : /* virtual */ bool
     153           0 : SVGFilterElement::HasValidDimensions() const
     154             : {
     155           0 :   return (!mLengthAttributes[ATTR_WIDTH].IsExplicitlySet() ||
     156           0 :            mLengthAttributes[ATTR_WIDTH].GetAnimValInSpecifiedUnits() > 0) &&
     157           0 :          (!mLengthAttributes[ATTR_HEIGHT].IsExplicitlySet() ||
     158           0 :            mLengthAttributes[ATTR_HEIGHT].GetAnimValInSpecifiedUnits() > 0);
     159             : }
     160             : 
     161             : nsSVGElement::LengthAttributesInfo
     162           0 : SVGFilterElement::GetLengthInfo()
     163             : {
     164             :   return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
     165           0 :                               ArrayLength(sLengthInfo));
     166             : }
     167             : 
     168             : nsSVGElement::EnumAttributesInfo
     169           0 : SVGFilterElement::GetEnumInfo()
     170             : {
     171             :   return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
     172           0 :                             ArrayLength(sEnumInfo));
     173             : }
     174             : 
     175             : nsSVGElement::StringAttributesInfo
     176           0 : SVGFilterElement::GetStringInfo()
     177             : {
     178             :   return StringAttributesInfo(mStringAttributes, sStringInfo,
     179           0 :                               ArrayLength(sStringInfo));
     180             : }
     181             : 
     182             : } // namespace dom
     183             : } // namespace mozilla

Generated by: LCOV version 1.13