SVGStopElement.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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/dom/SVGStopElement.h"
  6. #include "mozilla/dom/SVGStopElementBinding.h"
  7. NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Stop)
  8. namespace mozilla {
  9. namespace dom {
  10. JSObject*
  11. SVGStopElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
  12. {
  13. return SVGStopElementBinding::Wrap(aCx, this, aGivenProto);
  14. }
  15. nsSVGElement::NumberInfo SVGStopElement::sNumberInfo =
  16. { &nsGkAtoms::offset, 0, true };
  17. //----------------------------------------------------------------------
  18. // Implementation
  19. SVGStopElement::SVGStopElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  20. : SVGStopElementBase(aNodeInfo)
  21. {
  22. }
  23. //----------------------------------------------------------------------
  24. // nsIDOMNode methods
  25. NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGStopElement)
  26. //----------------------------------------------------------------------
  27. already_AddRefed<SVGAnimatedNumber>
  28. SVGStopElement::Offset()
  29. {
  30. return mOffset.ToDOMAnimatedNumber(this);
  31. }
  32. //----------------------------------------------------------------------
  33. // sSVGElement methods
  34. nsSVGElement::NumberAttributesInfo
  35. SVGStopElement::GetNumberInfo()
  36. {
  37. return NumberAttributesInfo(&mOffset, &sNumberInfo, 1);
  38. }
  39. //----------------------------------------------------------------------
  40. // nsIContent methods
  41. NS_IMETHODIMP_(bool)
  42. SVGStopElement::IsAttributeMapped(const nsIAtom* name) const
  43. {
  44. static const MappedAttributeEntry* const map[] = {
  45. sGradientStopMap
  46. };
  47. return FindAttributeDependence(name, map) ||
  48. SVGStopElementBase::IsAttributeMapped(name);
  49. }
  50. } // namespace dom
  51. } // namespace mozilla