| 1 | /* |
| 2 | * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 | * Copyright (C) 2004, 2005, 2006, 2008 Rob Buis <buis@kde.org> |
| 4 | * Copyright (C) 2018-2019 Apple Inc. All rights reserved. |
| 5 | * |
| 6 | * This library is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU Library General Public |
| 8 | * License as published by the Free Software Foundation; either |
| 9 | * version 2 of the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This library is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * Library General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU Library General Public License |
| 17 | * along with this library; see the file COPYING.LIB. If not, write to |
| 18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 19 | * Boston, MA 02110-1301, USA. |
| 20 | */ |
| 21 | |
| 22 | #pragma once |
| 23 | |
| 24 | #include "SVGTextContentElement.h" |
| 25 | |
| 26 | namespace WebCore { |
| 27 | |
| 28 | class SVGTextPositioningElement : public SVGTextContentElement { |
| 29 | WTF_MAKE_ISO_ALLOCATED(SVGTextPositioningElement); |
| 30 | public: |
| 31 | static SVGTextPositioningElement* elementFromRenderer(RenderBoxModelObject&); |
| 32 | |
| 33 | using PropertyRegistry = SVGPropertyOwnerRegistry<SVGTextPositioningElement, SVGTextContentElement>; |
| 34 | |
| 35 | const SVGLengthList& x() const { return m_x->currentValue(); } |
| 36 | const SVGLengthList& y() const { return m_y->currentValue(); } |
| 37 | const SVGLengthList& dx() const { return m_dx->currentValue(); } |
| 38 | const SVGLengthList& dy() const { return m_dy->currentValue(); } |
| 39 | const SVGNumberList& rotate() const { return m_rotate->currentValue(); } |
| 40 | |
| 41 | SVGAnimatedLengthList& xAnimated() { return m_x; } |
| 42 | SVGAnimatedLengthList& yAnimated() { return m_y; } |
| 43 | SVGAnimatedLengthList& dxAnimated() { return m_dx; } |
| 44 | SVGAnimatedLengthList& dyAnimated() { return m_dy; } |
| 45 | SVGAnimatedNumberList& rotateAnimated() { return m_rotate; } |
| 46 | |
| 47 | protected: |
| 48 | SVGTextPositioningElement(const QualifiedName&, Document&); |
| 49 | |
| 50 | void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 51 | void svgAttributeChanged(const QualifiedName&) override; |
| 52 | |
| 53 | private: |
| 54 | bool isPresentationAttribute(const QualifiedName&) const final; |
| 55 | void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) final; |
| 56 | |
| 57 | const SVGPropertyRegistry& propertyRegistry() const override { return m_propertyRegistry; } |
| 58 | |
| 59 | PropertyRegistry m_propertyRegistry { *this }; |
| 60 | Ref<SVGAnimatedLengthList> m_x { SVGAnimatedLengthList::create(this, LengthModeWidth) }; |
| 61 | Ref<SVGAnimatedLengthList> m_y { SVGAnimatedLengthList::create(this, LengthModeHeight) }; |
| 62 | Ref<SVGAnimatedLengthList> m_dx { SVGAnimatedLengthList::create(this, LengthModeWidth) }; |
| 63 | Ref<SVGAnimatedLengthList> m_dy { SVGAnimatedLengthList::create(this, LengthModeHeight) }; |
| 64 | Ref<SVGAnimatedNumberList> m_rotate { SVGAnimatedNumberList::create(this) }; |
| 65 | }; |
| 66 | |
| 67 | } // namespace WebCore |
| 68 | |