SVGTextPositioningElement.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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/SVGTextPositioningElement.h"
  7. #include "SVGAnimatedLengthList.h"
  8. #include "DOMSVGAnimatedLengthList.h"
  9. #include "DOMSVGAnimatedNumberList.h"
  10. #include "SVGContentUtils.h"
  11. namespace mozilla {
  12. namespace dom {
  13. nsSVGElement::LengthListInfo SVGTextPositioningElement::sLengthListInfo[4] =
  14. {
  15. { &nsGkAtoms::x, SVGContentUtils::X, false },
  16. { &nsGkAtoms::y, SVGContentUtils::Y, false },
  17. { &nsGkAtoms::dx, SVGContentUtils::X, true },
  18. { &nsGkAtoms::dy, SVGContentUtils::Y, true }
  19. };
  20. nsSVGElement::LengthListAttributesInfo
  21. SVGTextPositioningElement::GetLengthListInfo()
  22. {
  23. return LengthListAttributesInfo(mLengthListAttributes, sLengthListInfo,
  24. ArrayLength(sLengthListInfo));
  25. }
  26. nsSVGElement::NumberListInfo SVGTextPositioningElement::sNumberListInfo[1] =
  27. {
  28. { &nsGkAtoms::rotate }
  29. };
  30. nsSVGElement::NumberListAttributesInfo
  31. SVGTextPositioningElement::GetNumberListInfo()
  32. {
  33. return NumberListAttributesInfo(mNumberListAttributes, sNumberListInfo,
  34. ArrayLength(sNumberListInfo));
  35. }
  36. //----------------------------------------------------------------------
  37. already_AddRefed<DOMSVGAnimatedLengthList>
  38. SVGTextPositioningElement::X()
  39. {
  40. return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_X],
  41. this, ATTR_X, SVGContentUtils::X);
  42. }
  43. already_AddRefed<DOMSVGAnimatedLengthList>
  44. SVGTextPositioningElement::Y()
  45. {
  46. return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_Y],
  47. this, ATTR_Y, SVGContentUtils::Y);
  48. }
  49. already_AddRefed<DOMSVGAnimatedLengthList>
  50. SVGTextPositioningElement::Dx()
  51. {
  52. return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_DX],
  53. this, ATTR_DX, SVGContentUtils::X);
  54. }
  55. already_AddRefed<DOMSVGAnimatedLengthList>
  56. SVGTextPositioningElement::Dy()
  57. {
  58. return DOMSVGAnimatedLengthList::GetDOMWrapper(&mLengthListAttributes[ATTR_DY],
  59. this, ATTR_DY, SVGContentUtils::Y);
  60. }
  61. already_AddRefed<DOMSVGAnimatedNumberList>
  62. SVGTextPositioningElement::Rotate()
  63. {
  64. return DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes[ROTATE],
  65. this, ROTATE);
  66. }
  67. } // namespace dom
  68. } // namespace mozilla