LCOV - code coverage report
Current view: top level - dom/svg - SVGStyleElement.h (source / functions) Hit Total Coverage
Test: output.info Lines: 3 5 60.0 %
Date: 2017-07-14 16:53:18 Functions: 2 6 33.3 %
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_SVGStyleElement_h
       8             : #define mozilla_dom_SVGStyleElement_h
       9             : 
      10             : #include "mozilla/Attributes.h"
      11             : #include "nsSVGElement.h"
      12             : #include "nsStyleLinkElement.h"
      13             : #include "nsStubMutationObserver.h"
      14             : 
      15             : nsresult NS_NewSVGStyleElement(nsIContent **aResult,
      16             :                                already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
      17             : 
      18             : typedef nsSVGElement SVGStyleElementBase;
      19             : 
      20             : namespace mozilla {
      21             : namespace dom {
      22             : 
      23             : class SVGStyleElement final : public SVGStyleElementBase,
      24             :                               public nsStyleLinkElement,
      25             :                               public nsStubMutationObserver
      26             : {
      27             : protected:
      28             :   friend nsresult (::NS_NewSVGStyleElement(nsIContent **aResult,
      29             :                                            already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
      30             :   explicit SVGStyleElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo);
      31             :   ~SVGStyleElement();
      32             : 
      33             :   virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
      34             : 
      35             : public:
      36             :   NS_DECL_ISUPPORTS_INHERITED
      37             : 
      38           5 :   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGStyleElement,
      39             :                                            SVGStyleElementBase)
      40             : 
      41             :   // nsIContent
      42             :   virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
      43             :                               nsIContent* aBindingParent,
      44             :                               bool aCompileEventHandlers) override;
      45             :   virtual void UnbindFromTree(bool aDeep = true,
      46             :                               bool aNullParent = true) override;
      47           0 :   nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
      48             :                    const nsAString& aValue, bool aNotify)
      49             :   {
      50           0 :     return SetAttr(aNameSpaceID, aName, nullptr, aValue, aNotify);
      51             :   }
      52             :   virtual nsresult SetAttr(int32_t aNameSpaceID, nsIAtom* aName,
      53             :                            nsIAtom* aPrefix, const nsAString& aValue,
      54             :                            bool aNotify) override;
      55             :   virtual nsresult UnsetAttr(int32_t aNameSpaceID, nsIAtom* aAttribute,
      56             :                              bool aNotify) override;
      57             :   virtual bool ParseAttribute(int32_t aNamespaceID,
      58             :                               nsIAtom* aAttribute,
      59             :                               const nsAString& aValue,
      60             :                               nsAttrValue& aResult) override;
      61             : 
      62             :   virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult,
      63             :                          bool aPreallocateChildren) const override;
      64             : 
      65             :   // nsIMutationObserver
      66             :   NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
      67             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
      68             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
      69             :   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
      70             : 
      71             :   // WebIDL
      72             :   void GetXmlspace(nsAString & aXmlspace);
      73             :   void SetXmlspace(const nsAString & aXmlspace, ErrorResult& rv);
      74             :   void GetMedia(nsAString & aMedia);
      75             :   void SetMedia(const nsAString& aMedia, ErrorResult& rv);
      76             :   bool Scoped() const;
      77             :   void SetScoped(bool aScoped, ErrorResult& rv);
      78             :   void GetType(nsAString & aType);
      79             :   void SetType(const nsAString& aType, ErrorResult& rv);
      80             :   void GetTitle(nsAString & aTitle);
      81             :   void SetTitle(const nsAString& aTitle, ErrorResult& rv);
      82             : 
      83             : protected:
      84             :   // Dummy init method to make the NS_IMPL_NS_NEW_SVG_ELEMENT and
      85             :   // NS_IMPL_ELEMENT_CLONE_WITH_INIT usable with this class. This should be
      86             :   // completely optimized away.
      87           5 :   inline nsresult Init()
      88             :   {
      89           5 :     return NS_OK;
      90             :   }
      91             : 
      92             :   // nsStyleLinkElement overrides
      93             :   already_AddRefed<nsIURI> GetStyleSheetURL(bool* aIsInline) override;
      94             : 
      95             :   void GetStyleSheetInfo(nsAString& aTitle,
      96             :                          nsAString& aType,
      97             :                          nsAString& aMedia,
      98             :                          bool* aIsScoped,
      99             :                          bool* aIsAlternate) override;
     100             :   virtual CORSMode GetCORSMode() const override;
     101             : 
     102             :   /**
     103             :    * Common method to call from the various mutation observer methods.
     104             :    * aContent is a content node that's either the one that changed or its
     105             :    * parent; we should only respond to the change if aContent is non-anonymous.
     106             :    */
     107             :   void ContentChanged(nsIContent* aContent);
     108             : };
     109             : 
     110             : } // namespace dom
     111             : } // namespace mozilla
     112             : 
     113             : #endif // mozilla_dom_SVGStyleElement_h

Generated by: LCOV version 1.13