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_SVGCLIPPATHELEMENT_H_
8 #define DOM_SVG_SVGCLIPPATHELEMENT_H_
9 
10 #include "SVGAnimatedEnumeration.h"
11 #include "mozilla/dom/SVGTransformableElement.h"
12 
13 nsresult NS_NewSVGClipPathElement(
14     nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
15 
16 namespace mozilla {
17 class SVGClipPathFrame;
18 
19 namespace dom {
20 
21 using SVGClipPathElementBase = SVGTransformableElement;
22 
23 class SVGClipPathElement final : public SVGClipPathElementBase {
24   friend class mozilla::SVGClipPathFrame;
25 
26  protected:
27   friend nsresult(::NS_NewSVGClipPathElement(
28       nsIContent** aResult,
29       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
30   explicit SVGClipPathElement(
31       already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
32   virtual JSObject* WrapNode(JSContext* cx,
33                              JS::Handle<JSObject*> aGivenProto) override;
34 
35  public:
36   virtual nsresult Clone(dom::NodeInfo*, nsINode** aResult) const override;
37 
38   // WebIDL
39   already_AddRefed<DOMSVGAnimatedEnumeration> ClipPathUnits();
40 
41   // This is an internal method that does not flush style, and thus
42   // the answer may be out of date if there's a pending style flush.
43   bool IsUnitsObjectBoundingBox() const;
44 
45  protected:
46   enum { CLIPPATHUNITS };
47   SVGAnimatedEnumeration mEnumAttributes[1];
48   static EnumInfo sEnumInfo[1];
49 
50   virtual EnumAttributesInfo GetEnumInfo() override;
51 };
52 
53 }  // namespace dom
54 }  // namespace mozilla
55 
56 #endif  // DOM_SVG_SVGCLIPPATHELEMENT_H_
57