Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/SVGFEImageElement.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_SVGFEImageElement_h
8
#define mozilla_dom_SVGFEImageElement_h
9
10
#include "nsSVGFilters.h"
11
#include "SVGAnimatedPreserveAspectRatio.h"
12
13
class SVGFEImageFrame;
14
15
nsresult NS_NewSVGFEImageElement(nsIContent **aResult,
16
                                 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
17
18
namespace mozilla {
19
namespace dom {
20
21
typedef nsSVGFE SVGFEImageElementBase;
22
23
class SVGFEImageElement final : public SVGFEImageElementBase,
24
                                public nsImageLoadingContent
25
{
26
  friend class ::SVGFEImageFrame;
27
28
protected:
29
  friend nsresult (::NS_NewSVGFEImageElement(nsIContent **aResult,
30
                                             already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
31
  explicit SVGFEImageElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
32
  virtual ~SVGFEImageElement();
33
  virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
34
35
public:
36
0
  virtual bool SubregionIsUnionOfRegions() override { return false; }
37
38
  // interfaces:
39
  NS_DECL_ISUPPORTS_INHERITED
40
41
  // EventTarget
42
  virtual void AsyncEventRunning(AsyncEventDispatcher* aEvent) override;
43
44
  virtual FilterPrimitiveDescription
45
    GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
46
                            const IntRect& aFilterSubregion,
47
                            const nsTArray<bool>& aInputsAreTainted,
48
                            nsTArray<RefPtr<SourceSurface>>& aInputImages) override;
49
  virtual bool AttributeAffectsRendering(
50
          int32_t aNameSpaceID, nsAtom* aAttribute) const override;
51
0
  virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; }
52
  virtual bool OutputIsTainted(const nsTArray<bool>& aInputsAreTainted,
53
                               nsIPrincipal* aReferencePrincipal) override;
54
55
  // nsIContent
56
  NS_IMETHOD_(bool) IsAttributeMapped(const nsAtom* aAttribute) const override;
57
58
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
59
60
  virtual nsresult AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
61
                                const nsAttrValue* aValue,
62
                                const nsAttrValue* aOldValue,
63
                                nsIPrincipal* aSubjectPrincipal,
64
                                bool aNotify) override;
65
  virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
66
                              nsIContent* aBindingParent) override;
67
  virtual void UnbindFromTree(bool aDeep, bool aNullParent) override;
68
  virtual EventStates IntrinsicState() const override;
69
70
  NS_IMETHOD Notify(imgIRequest *aRequest, int32_t aType, const nsIntRect* aData) override;
71
72
  void MaybeLoadSVGImage();
73
74
  // WebIDL
75
  already_AddRefed<SVGAnimatedString> Href();
76
  already_AddRefed<DOMSVGAnimatedPreserveAspectRatio> PreserveAspectRatio();
77
78
private:
79
  // Invalidate users of the filter containing this element.
80
  void Invalidate();
81
82
  nsresult LoadSVGImage(bool aForce, bool aNotify);
83
84
protected:
85
0
  virtual bool ProducesSRGB() override { return true; }
86
87
  virtual SVGAnimatedPreserveAspectRatio *GetPreserveAspectRatio() override;
88
  virtual StringAttributesInfo GetStringInfo() override;
89
90
  // Override for nsImageLoadingContent.
91
0
  nsIContent* AsContent() override { return this; }
92
93
  enum { RESULT, HREF, XLINK_HREF };
94
  nsSVGString mStringAttributes[3];
95
  static StringInfo sStringInfo[3];
96
97
  SVGAnimatedPreserveAspectRatio mPreserveAspectRatio;
98
};
99
100
} // namespace dom
101
} // namespace mozilla
102
103
#endif