SVGClipPathElement.cpp 1.7 KB

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