SVGTextElement.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/dom/SVGTextElement.h"
  6. #include "mozilla/dom/SVGTextElementBinding.h"
  7. NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(Text)
  8. namespace mozilla {
  9. namespace dom {
  10. JSObject*
  11. SVGTextElement::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
  12. {
  13. return SVGTextElementBinding::Wrap(aCx, this, aGivenProto);
  14. }
  15. //----------------------------------------------------------------------
  16. // Implementation
  17. SVGTextElement::SVGTextElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  18. : SVGTextElementBase(aNodeInfo)
  19. {
  20. }
  21. nsSVGElement::EnumAttributesInfo
  22. SVGTextElement::GetEnumInfo()
  23. {
  24. return EnumAttributesInfo(mEnumAttributes, sEnumInfo,
  25. ArrayLength(sEnumInfo));
  26. }
  27. nsSVGElement::LengthAttributesInfo
  28. SVGTextElement::GetLengthInfo()
  29. {
  30. return LengthAttributesInfo(mLengthAttributes, sLengthInfo,
  31. ArrayLength(sLengthInfo));
  32. }
  33. //----------------------------------------------------------------------
  34. // nsIDOMNode methods
  35. NS_IMPL_ELEMENT_CLONE_WITH_INIT(SVGTextElement)
  36. //----------------------------------------------------------------------
  37. // nsIContent methods
  38. NS_IMETHODIMP_(bool)
  39. SVGTextElement::IsAttributeMapped(const nsIAtom* name) const
  40. {
  41. static const MappedAttributeEntry* const map[] = {
  42. sTextContentElementsMap,
  43. sFontSpecificationMap
  44. };
  45. return FindAttributeDependence(name, map) ||
  46. SVGTextElementBase::IsAttributeMapped(name);
  47. }
  48. } // namespace dom
  49. } // namespace mozilla