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