Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/SVGStyleElement.h
Line
Count
Source (jump to first uncovered line)
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
  NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(SVGStyleElement,
39
                                           SVGStyleElementBase)
40
41
  // nsIContent
42
  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
43
                              nsIContent* aBindingParent) override;
44
  virtual void UnbindFromTree(bool aDeep = true,
45
                              bool aNullParent = true) override;
46
  virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
47
                                const nsAttrValue* aValue,
48
                                const nsAttrValue* aOldValue,
49
                                nsIPrincipal* aMaybeScriptedPrincipal,
50
                                bool aNotify) override;
51
  virtual bool ParseAttribute(int32_t aNamespaceID,
52
                              nsAtom* aAttribute,
53
                              const nsAString& aValue,
54
                              nsIPrincipal* aMaybeScriptedPrincipal,
55
                              nsAttrValue& aResult) override;
56
57
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
58
59
  // nsIMutationObserver
60
  NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
61
  NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
62
  NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
63
  NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
64
65
  // WebIDL
66
  void GetXmlspace(nsAString & aXmlspace);
67
  void SetXmlspace(const nsAString & aXmlspace, ErrorResult& rv);
68
  void GetMedia(nsAString & aMedia);
69
  void SetMedia(const nsAString& aMedia, ErrorResult& rv);
70
  void GetType(nsAString & aType);
71
  void SetType(const nsAString& aType, ErrorResult& rv);
72
  void GetTitle(nsAString & aTitle);
73
  void SetTitle(const nsAString& aTitle, ErrorResult& rv);
74
75
protected:
76
  // Dummy init method to make the NS_IMPL_NS_NEW_SVG_ELEMENT and
77
  // NS_IMPL_ELEMENT_CLONE_WITH_INIT usable with this class. This should be
78
  // completely optimized away.
79
  inline nsresult Init()
80
0
  {
81
0
    return NS_OK;
82
0
  }
83
84
  // nsStyleLinkElement overrides
85
  Maybe<SheetInfo> GetStyleSheetInfo() final;
86
87
  /**
88
   * Common method to call from the various mutation observer methods.
89
   * aContent is a content node that's either the one that changed or its
90
   * parent; we should only respond to the change if aContent is non-anonymous.
91
   */
92
  void ContentChanged(nsIContent* aContent);
93
};
94
95
} // namespace dom
96
} // namespace mozilla
97
98
#endif // mozilla_dom_SVGStyleElement_h