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/. */
7 #include "mozilla/dom/SVGTextPositioningElement.h"
9 #include "mozilla/ArrayUtils.h"
10 #include "SVGAnimatedLengthList.h"
11 #include "DOMSVGAnimatedLengthList.h"
12 #include "DOMSVGAnimatedNumberList.h"
13 #include "SVGContentUtils.h"
15 namespace mozilla::dom
{
17 SVGElement::LengthListInfo
SVGTextPositioningElement::sLengthListInfo
[4] = {
18 {nsGkAtoms::x
, SVGContentUtils::X
, false},
19 {nsGkAtoms::y
, SVGContentUtils::Y
, false},
20 {nsGkAtoms::dx
, SVGContentUtils::X
, true},
21 {nsGkAtoms::dy
, SVGContentUtils::Y
, true}};
23 SVGElement::LengthListAttributesInfo
24 SVGTextPositioningElement::GetLengthListInfo() {
25 return LengthListAttributesInfo(mLengthListAttributes
, sLengthListInfo
,
26 ArrayLength(sLengthListInfo
));
29 SVGElement::NumberListInfo
SVGTextPositioningElement::sNumberListInfo
[1] = {
32 SVGElement::NumberListAttributesInfo
33 SVGTextPositioningElement::GetNumberListInfo() {
34 return NumberListAttributesInfo(mNumberListAttributes
, sNumberListInfo
,
35 ArrayLength(sNumberListInfo
));
38 //----------------------------------------------------------------------
40 already_AddRefed
<DOMSVGAnimatedLengthList
> SVGTextPositioningElement::X() {
41 return DOMSVGAnimatedLengthList::GetDOMWrapper(
42 &mLengthListAttributes
[ATTR_X
], this, ATTR_X
, SVGContentUtils::X
);
45 already_AddRefed
<DOMSVGAnimatedLengthList
> SVGTextPositioningElement::Y() {
46 return DOMSVGAnimatedLengthList::GetDOMWrapper(
47 &mLengthListAttributes
[ATTR_Y
], this, ATTR_Y
, SVGContentUtils::Y
);
50 already_AddRefed
<DOMSVGAnimatedLengthList
> SVGTextPositioningElement::Dx() {
51 return DOMSVGAnimatedLengthList::GetDOMWrapper(
52 &mLengthListAttributes
[ATTR_DX
], this, ATTR_DX
, SVGContentUtils::X
);
55 already_AddRefed
<DOMSVGAnimatedLengthList
> SVGTextPositioningElement::Dy() {
56 return DOMSVGAnimatedLengthList::GetDOMWrapper(
57 &mLengthListAttributes
[ATTR_DY
], this, ATTR_DY
, SVGContentUtils::Y
);
60 already_AddRefed
<DOMSVGAnimatedNumberList
> SVGTextPositioningElement::Rotate() {
61 return DOMSVGAnimatedNumberList::GetDOMWrapper(&mNumberListAttributes
[ROTATE
],
65 } // namespace mozilla::dom