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/. */
7 #include "mozilla/dom/SVGClipPathElement.h"
9 #include "mozilla/ArrayUtils.h"
10 #include "mozilla/dom/SVGClipPathElementBinding.h"
11 #include "mozilla/dom/SVGUnitTypesBinding.h"
12 #include "nsGkAtoms.h"
14 NS_IMPL_NS_NEW_SVG_ELEMENT(ClipPath
)
16 namespace mozilla::dom
{
18 using namespace SVGUnitTypes_Binding
;
20 JSObject
* SVGClipPathElement::WrapNode(JSContext
* aCx
,
21 JS::Handle
<JSObject
*> aGivenProto
) {
22 return SVGClipPathElement_Binding::Wrap(aCx
, this, aGivenProto
);
25 SVGElement::EnumInfo
SVGClipPathElement::sEnumInfo
[1] = {
26 {nsGkAtoms::clipPathUnits
, sSVGUnitTypesMap
, SVG_UNIT_TYPE_USERSPACEONUSE
}};
28 //----------------------------------------------------------------------
31 SVGClipPathElement::SVGClipPathElement(
32 already_AddRefed
<mozilla::dom::NodeInfo
>&& aNodeInfo
)
33 : SVGClipPathElementBase(std::move(aNodeInfo
)) {}
35 already_AddRefed
<DOMSVGAnimatedEnumeration
>
36 SVGClipPathElement::ClipPathUnits() {
37 return mEnumAttributes
[CLIPPATHUNITS
].ToDOMAnimatedEnum(this);
40 SVGElement::EnumAttributesInfo
SVGClipPathElement::GetEnumInfo() {
41 return EnumAttributesInfo(mEnumAttributes
, sEnumInfo
, ArrayLength(sEnumInfo
));
44 bool SVGClipPathElement::IsUnitsObjectBoundingBox() const {
45 return mEnumAttributes
[CLIPPATHUNITS
].GetAnimValue() ==
46 SVG_UNIT_TYPE_OBJECTBOUNDINGBOX
;
49 //----------------------------------------------------------------------
52 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGClipPathElement
)
54 } // namespace mozilla::dom