SVGClipPathElement.cpp (1818B)
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 #include "mozilla/dom/SVGClipPathElement.h" 8 9 #include "mozilla/dom/SVGClipPathElementBinding.h" 10 #include "mozilla/dom/SVGUnitTypesBinding.h" 11 #include "nsGkAtoms.h" 12 13 NS_IMPL_NS_NEW_SVG_ELEMENT(ClipPath) 14 15 namespace mozilla::dom { 16 17 using namespace SVGUnitTypes_Binding; 18 19 JSObject* SVGClipPathElement::WrapNode(JSContext* aCx, 20 JS::Handle<JSObject*> aGivenProto) { 21 return SVGClipPathElement_Binding::Wrap(aCx, this, aGivenProto); 22 } 23 24 SVGElement::EnumInfo SVGClipPathElement::sEnumInfo[1] = { 25 {nsGkAtoms::clipPathUnits, sSVGUnitTypesMap, SVG_UNIT_TYPE_USERSPACEONUSE}}; 26 27 //---------------------------------------------------------------------- 28 // Implementation 29 30 SVGClipPathElement::SVGClipPathElement( 31 already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo) 32 : SVGClipPathElementBase(std::move(aNodeInfo)) {} 33 34 already_AddRefed<DOMSVGAnimatedEnumeration> 35 SVGClipPathElement::ClipPathUnits() { 36 return mEnumAttributes[CLIPPATHUNITS].ToDOMAnimatedEnum(this); 37 } 38 39 SVGElement::EnumAttributesInfo SVGClipPathElement::GetEnumInfo() { 40 return EnumAttributesInfo(mEnumAttributes, sEnumInfo, std::size(sEnumInfo)); 41 } 42 43 bool SVGClipPathElement::IsUnitsObjectBoundingBox() const { 44 return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == 45 SVG_UNIT_TYPE_OBJECTBOUNDINGBOX; 46 } 47 48 //---------------------------------------------------------------------- 49 // nsINode methods 50 51 NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGClipPathElement) 52 53 } // namespace mozilla::dom