tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

SVGComponentTransferFunctionElement.h (5903B)


      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 DOM_SVG_SVGCOMPONENTTRANSFERFUNCTIONELEMENT_H_
      8 #define DOM_SVG_SVGCOMPONENTTRANSFERFUNCTIONELEMENT_H_
      9 
     10 #include "SVGAnimatedEnumeration.h"
     11 #include "SVGAnimatedNumber.h"
     12 #include "SVGAnimatedNumberList.h"
     13 #include "mozilla/dom/SVGFilters.h"
     14 
     15 namespace mozilla::dom {
     16 
     17 class DOMSVGAnimatedNumberList;
     18 
     19 using SVGComponentTransferFunctionElementBase = SVGFilterPrimitiveChildElement;
     20 
     21 class SVGComponentTransferFunctionElement
     22    : public SVGComponentTransferFunctionElementBase {
     23 protected:
     24  explicit SVGComponentTransferFunctionElement(
     25      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
     26      : SVGComponentTransferFunctionElementBase(std::move(aNodeInfo)) {}
     27 
     28  virtual ~SVGComponentTransferFunctionElement() = default;
     29 
     30 public:
     31  using ComponentTransferAttributes = gfx::ComponentTransferAttributes;
     32 
     33  NS_IMPL_FROMNODE_HELPER(SVGComponentTransferFunctionElement,
     34                          IsSVGComponentTransferFunctionElement())
     35 
     36  bool IsSVGComponentTransferFunctionElement() const final { return true; }
     37 
     38  bool AttributeAffectsRendering(int32_t aNameSpaceID,
     39                                 nsAtom* aAttribute) const override;
     40 
     41  virtual int32_t GetChannel() = 0;
     42 
     43  void ComputeAttributes(int32_t aChannel,
     44                         ComponentTransferAttributes& aAttributes);
     45 
     46  // WebIDL
     47  JSObject* WrapNode(JSContext* aCx,
     48                     JS::Handle<JSObject*> aGivenProto) override = 0;
     49  already_AddRefed<DOMSVGAnimatedEnumeration> Type();
     50  already_AddRefed<DOMSVGAnimatedNumberList> TableValues();
     51  already_AddRefed<DOMSVGAnimatedNumber> Slope();
     52  already_AddRefed<DOMSVGAnimatedNumber> Intercept();
     53  already_AddRefed<DOMSVGAnimatedNumber> Amplitude();
     54  already_AddRefed<DOMSVGAnimatedNumber> Exponent();
     55  already_AddRefed<DOMSVGAnimatedNumber> Offset();
     56 
     57 protected:
     58  NumberAttributesInfo GetNumberInfo() override;
     59  EnumAttributesInfo GetEnumInfo() override;
     60  NumberListAttributesInfo GetNumberListInfo() override;
     61 
     62  enum { TABLEVALUES };
     63  SVGAnimatedNumberList mNumberListAttributes[1];
     64  static NumberListInfo sNumberListInfo[1];
     65 
     66  enum { SLOPE, INTERCEPT, AMPLITUDE, EXPONENT, OFFSET };
     67  SVGAnimatedNumber mNumberAttributes[5];
     68  static NumberInfo sNumberInfo[5];
     69 
     70  enum { TYPE };
     71  SVGAnimatedEnumeration mEnumAttributes[1];
     72  static SVGEnumMapping sTypeMap[];
     73  static EnumInfo sEnumInfo[1];
     74 };
     75 
     76 }  // namespace mozilla::dom
     77 
     78 nsresult NS_NewSVGFEFuncRElement(
     79    nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
     80 
     81 namespace mozilla::dom {
     82 
     83 class SVGFEFuncRElement : public SVGComponentTransferFunctionElement {
     84  friend nsresult(::NS_NewSVGFEFuncRElement(
     85      nsIContent** aResult,
     86      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
     87 
     88 protected:
     89  explicit SVGFEFuncRElement(
     90      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
     91      : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
     92 
     93 public:
     94  int32_t GetChannel() override { return 0; }
     95 
     96  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
     97 
     98  JSObject* WrapNode(JSContext* aCx,
     99                     JS::Handle<JSObject*> aGivenProto) override;
    100 };
    101 
    102 }  // namespace mozilla::dom
    103 
    104 nsresult NS_NewSVGFEFuncGElement(
    105    nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
    106 
    107 namespace mozilla::dom {
    108 
    109 class SVGFEFuncGElement : public SVGComponentTransferFunctionElement {
    110  friend nsresult(::NS_NewSVGFEFuncGElement(
    111      nsIContent** aResult,
    112      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
    113 
    114 protected:
    115  explicit SVGFEFuncGElement(
    116      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
    117      : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
    118 
    119 public:
    120  int32_t GetChannel() override { return 1; }
    121 
    122  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
    123 
    124  JSObject* WrapNode(JSContext* aCx,
    125                     JS::Handle<JSObject*> aGivenProto) override;
    126 };
    127 
    128 }  // namespace mozilla::dom
    129 
    130 nsresult NS_NewSVGFEFuncBElement(
    131    nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
    132 
    133 namespace mozilla::dom {
    134 
    135 class SVGFEFuncBElement : public SVGComponentTransferFunctionElement {
    136  friend nsresult(::NS_NewSVGFEFuncBElement(
    137      nsIContent** aResult,
    138      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
    139 
    140 protected:
    141  explicit SVGFEFuncBElement(
    142      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
    143      : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
    144 
    145 public:
    146  int32_t GetChannel() override { return 2; }
    147 
    148  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
    149 
    150  JSObject* WrapNode(JSContext* aCx,
    151                     JS::Handle<JSObject*> aGivenProto) override;
    152 };
    153 
    154 }  // namespace mozilla::dom
    155 
    156 nsresult NS_NewSVGFEFuncAElement(
    157    nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
    158 
    159 namespace mozilla::dom {
    160 
    161 class SVGFEFuncAElement : public SVGComponentTransferFunctionElement {
    162  friend nsresult(::NS_NewSVGFEFuncAElement(
    163      nsIContent** aResult,
    164      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
    165 
    166 protected:
    167  explicit SVGFEFuncAElement(
    168      already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
    169      : SVGComponentTransferFunctionElement(std::move(aNodeInfo)) {}
    170 
    171 public:
    172  int32_t GetChannel() override { return 3; }
    173 
    174  nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
    175 
    176  JSObject* WrapNode(JSContext* aCx,
    177                     JS::Handle<JSObject*> aGivenProto) override;
    178 };
    179 
    180 }  // namespace mozilla::dom
    181 
    182 #endif  // DOM_SVG_SVGCOMPONENTTRANSFERFUNCTIONELEMENT_H_