SVGFECompositeElement.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_SVGFECompositeElement_h
  6. #define mozilla_dom_SVGFECompositeElement_h
  7. #include "nsSVGEnum.h"
  8. #include "nsSVGFilters.h"
  9. #include "nsSVGNumber2.h"
  10. nsresult NS_NewSVGFECompositeElement(nsIContent **aResult,
  11. already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
  12. namespace mozilla {
  13. namespace dom {
  14. typedef nsSVGFE SVGFECompositeElementBase;
  15. class SVGFECompositeElement : public SVGFECompositeElementBase
  16. {
  17. friend nsresult (::NS_NewSVGFECompositeElement(nsIContent **aResult,
  18. already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
  19. protected:
  20. explicit SVGFECompositeElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  21. : SVGFECompositeElementBase(aNodeInfo)
  22. {
  23. }
  24. virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
  25. public:
  26. virtual FilterPrimitiveDescription
  27. GetPrimitiveDescription(nsSVGFilterInstance* aInstance,
  28. const IntRect& aFilterSubregion,
  29. const nsTArray<bool>& aInputsAreTainted,
  30. nsTArray<RefPtr<SourceSurface>>& aInputImages) override;
  31. virtual bool AttributeAffectsRendering(
  32. int32_t aNameSpaceID, nsIAtom* aAttribute) const override;
  33. virtual nsSVGString& GetResultImageName() override { return mStringAttributes[RESULT]; }
  34. virtual void GetSourceImageNames(nsTArray<nsSVGStringInfo>& aSources) override;
  35. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  36. // WebIDL
  37. already_AddRefed<SVGAnimatedString> In1();
  38. already_AddRefed<SVGAnimatedString> In2();
  39. already_AddRefed<SVGAnimatedEnumeration> Operator();
  40. already_AddRefed<SVGAnimatedNumber> K1();
  41. already_AddRefed<SVGAnimatedNumber> K2();
  42. already_AddRefed<SVGAnimatedNumber> K3();
  43. already_AddRefed<SVGAnimatedNumber> K4();
  44. void SetK(float k1, float k2, float k3, float k4);
  45. protected:
  46. virtual NumberAttributesInfo GetNumberInfo() override;
  47. virtual EnumAttributesInfo GetEnumInfo() override;
  48. virtual StringAttributesInfo GetStringInfo() override;
  49. enum { ATTR_K1, ATTR_K2, ATTR_K3, ATTR_K4 };
  50. nsSVGNumber2 mNumberAttributes[4];
  51. static NumberInfo sNumberInfo[4];
  52. enum { OPERATOR };
  53. nsSVGEnum mEnumAttributes[1];
  54. static nsSVGEnumMapping sOperatorMap[];
  55. static EnumInfo sEnumInfo[1];
  56. enum { RESULT, IN1, IN2 };
  57. nsSVGString mStringAttributes[3];
  58. static StringInfo sStringInfo[3];
  59. };
  60. } // namespace dom
  61. } // namespace mozilla
  62. #endif // mozilla_dom_SVGFECompositeElement_h