Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/SVGFEDisplacementMapElement.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_SVGFEDisplacementMapElement_h
8
#define mozilla_dom_SVGFEDisplacementMapElement_h
9
10
#include "nsSVGEnum.h"
11
#include "nsSVGFilters.h"
12
13
nsresult NS_NewSVGFEDisplacementMapElement(nsIContent **aResult,
14
                                           already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
15
16
namespace mozilla {
17
namespace dom {
18
19
typedef nsSVGFE SVGFEDisplacementMapElementBase;
20
21
class SVGFEDisplacementMapElement : public SVGFEDisplacementMapElementBase
22
{
23
protected:
24
  friend nsresult (::NS_NewSVGFEDisplacementMapElement(nsIContent **aResult,
25
                                                       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
26
  explicit SVGFEDisplacementMapElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
27
    : SVGFEDisplacementMapElementBase(std::move(aNodeInfo))
28
0
  {
29
0
  }
30
  virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
31
32
public:
33
  virtual FilterPrimitiveDescription
34
    GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
35
                            const IntRect& aFilterSubregion,
36
                            const nsTArray<bool>& aInputsAreTainted,
37
                            nsTArray<RefPtr<SourceSurface>>& aInputImages) override;
38
  virtual bool AttributeAffectsRendering(
39
          int32_t aNameSpaceID, nsAtom* aAttribute) const override;
40
0
  virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; }
41
  virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources) override;
42
43
  virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
44
45
  // WebIDL
46
  already_AddRefed<SVGAnimatedString> In1();
47
  already_AddRefed<SVGAnimatedString> In2();
48
  already_AddRefed<SVGAnimatedNumber> Scale();
49
  already_AddRefed<SVGAnimatedEnumeration> XChannelSelector();
50
  already_AddRefed<SVGAnimatedEnumeration> YChannelSelector();
51
52
protected:
53
  virtual bool OperatesOnSRGB(int32_t aInputIndex,
54
0
                              bool aInputIsAlreadySRGB) override {
55
0
    switch (aInputIndex) {
56
0
    case 0:
57
0
      return aInputIsAlreadySRGB;
58
0
    case 1:
59
0
      return SVGFEDisplacementMapElementBase::OperatesOnSRGB(aInputIndex, aInputIsAlreadySRGB);
60
0
    default:
61
0
      NS_ERROR("Will not give correct color model");
62
0
      return false;
63
0
    }
64
0
  }
65
66
  virtual NumberAttributesInfo GetNumberInfo() override;
67
  virtual EnumAttributesInfo GetEnumInfo() override;
68
  virtual StringAttributesInfo GetStringInfo() override;
69
70
  enum { SCALE };
71
  nsSVGNumber2 mNumberAttributes[1];
72
  static NumberInfo sNumberInfo[1];
73
74
  enum { CHANNEL_X, CHANNEL_Y };
75
  nsSVGEnum mEnumAttributes[2];
76
  static nsSVGEnumMapping sChannelMap[];
77
  static EnumInfo sEnumInfo[2];
78
79
  enum { RESULT, IN1, IN2 };
80
  nsSVGString mStringAttributes[3];
81
  static StringInfo sStringInfo[3];
82
};
83
84
} // namespace dom
85
} // namespace mozilla
86
87
#endif // mozilla_dom_SVGFEDisplacementMapElement_h