LCOV - code coverage report
Current view: top level - dom/svg - SVGMPathElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 13 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 8 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             : #ifndef mozilla_dom_SVGMPathElement_h
       8             : #define mozilla_dom_SVGMPathElement_h
       9             : 
      10             : #include "nsSVGElement.h"
      11             : #include "nsStubMutationObserver.h"
      12             : #include "nsSVGString.h"
      13             : #include "nsReferencedElement.h"
      14             : 
      15             : nsresult NS_NewSVGMPathElement(nsIContent **aResult,
      16             :                                already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
      17             : 
      18             : typedef nsSVGElement SVGMPathElementBase;
      19             : 
      20             : namespace mozilla {
      21             : namespace dom {
      22             : class SVGPathElement;
      23             : 
      24             : class SVGMPathElement final : public SVGMPathElementBase,
      25             :                               public nsStubMutationObserver
      26             : {
      27             : protected:
      28             :   friend nsresult (::NS_NewSVGMPathElement(nsIContent **aResult,
      29             :                                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
      30             :   explicit SVGMPathElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
      31             :   ~SVGMPathElement();
      32             : 
      33             :   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
      34             : 
      35             : public:
      36             :   // interfaces:
      37             :   NS_DECL_ISUPPORTS_INHERITED
      38             : 
      39           0 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGMPathElement,
      40             :                                            SVGMPathElementBase)
      41             : 
      42             :   NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
      43             : 
      44             :   // nsIContent interface
      45             :   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
      46             :                          bool aPreallocateChildren) const override;
      47             :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      48             :                               nsIContent* aBindingParent,
      49             :                               bool aCompileEventHandlers) override;
      50             :   virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
      51             : 
      52             :   virtual nsresult UnsetAttr(int32_t aNamespaceID, nsIAtom* aAttribute,
      53             :                              bool aNotify) override;
      54             :   // Element specializations
      55             :   virtual bool ParseAttribute(int32_t aNamespaceID,
      56             :                                 nsIAtom* aAttribute,
      57             :                                 const nsAString& aValue,
      58             :                                 nsAttrValue& aResult) override;
      59             : 
      60             :   // Public helper method: If our xlink:href attribute links to a <path>
      61             :   // element, this method returns a pointer to that element. Otherwise,
      62             :   // this returns nullptr.
      63             :   SVGPathElement* GetReferencedPath();
      64             : 
      65             :   // WebIDL
      66             :   already_AddRefed<SVGAnimatedString> Href();
      67             : 
      68             : protected:
      69           0 :   class PathReference : public nsReferencedElement {
      70             :   public:
      71           0 :     explicit PathReference(SVGMPathElement* aMpathElement) :
      72           0 :       mMpathElement(aMpathElement) {}
      73             :   protected:
      74             :     // We need to be notified when target changes, in order to request a sample
      75             :     // (which will clear animation effects that used the old target-path
      76             :     // and recompute the animation effects using the new target-path).
      77           0 :     virtual void ElementChanged(Element* aFrom, Element* aTo) override {
      78           0 :       nsReferencedElement::ElementChanged(aFrom, aTo);
      79           0 :       if (aFrom) {
      80           0 :         aFrom->RemoveMutationObserver(mMpathElement);
      81             :       }
      82           0 :       if (aTo) {
      83           0 :         aTo->AddMutationObserver(mMpathElement);
      84             :       }
      85           0 :       mMpathElement->NotifyParentOfMpathChange(mMpathElement->GetParent());
      86           0 :     }
      87             : 
      88             :     // We need to override IsPersistent to get persistent tracking (beyond the
      89             :     // first time the target changes)
      90           0 :     virtual bool IsPersistent() override { return true; }
      91             :   private:
      92             :     SVGMPathElement* const mMpathElement;
      93             :   };
      94             : 
      95             :   virtual StringAttributesInfo GetStringInfo() override;
      96             : 
      97             :   void UpdateHrefTarget(nsIContent* aParent, const nsAString& aHrefStr);
      98             :   void UnlinkHrefTarget(bool aNotifyParent);
      99             :   void NotifyParentOfMpathChange(nsIContent* aParent);
     100             : 
     101             :   enum { HREF, XLINK_HREF };
     102             :   nsSVGString        mStringAttributes[2];
     103             :   static StringInfo  sStringInfo[2];
     104             :   PathReference      mHrefTarget;
     105             : };
     106             : 
     107             : } // namespace dom
     108             : } // namespace mozilla
     109             : 
     110             : #endif // mozilla_dom_SVGMPathElement_h

Generated by: LCOV version 1.13