| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
| 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #ifndef SVGPathElement_h | 21 #ifndef SVGPathElement_h |
| 22 #define SVGPathElement_h | 22 #define SVGPathElement_h |
| 23 | 23 |
| 24 #include "core/SVGNames.h" | 24 #include "core/SVGNames.h" |
| 25 #include "core/svg/SVGAnimatedNumber.h" | |
| 26 #include "core/svg/SVGAnimatedPath.h" | 25 #include "core/svg/SVGAnimatedPath.h" |
| 27 #include "core/svg/SVGGeometryElement.h" | 26 #include "core/svg/SVGGeometryElement.h" |
| 28 #include "platform/heap/Handle.h" | 27 #include "platform/heap/Handle.h" |
| 29 | 28 |
| 30 namespace blink { | 29 namespace blink { |
| 31 | 30 |
| 32 class StylePath; | 31 class StylePath; |
| 33 | 32 |
| 34 class SVGPathElement final : public SVGGeometryElement { | 33 class SVGPathElement final : public SVGGeometryElement { |
| 35 DEFINE_WRAPPERTYPEINFO(); | 34 DEFINE_WRAPPERTYPEINFO(); |
| 36 | 35 |
| 37 public: | 36 public: |
| 38 DECLARE_NODE_FACTORY(SVGPathElement); | 37 DECLARE_NODE_FACTORY(SVGPathElement); |
| 39 | 38 |
| 40 Path asPath() const override; | 39 Path asPath() const override; |
| 41 Path attributePath() const; | 40 Path attributePath() const; |
| 42 | 41 |
| 43 float getTotalLength() override; | 42 float getTotalLength() override; |
| 44 SVGPointTearOff* getPointAtLength(float distance) override; | 43 SVGPointTearOff* getPointAtLength(float distance) override; |
| 45 unsigned getPathSegAtLength(float distance); | 44 unsigned getPathSegAtLength(float distance); |
| 46 | 45 |
| 47 SVGAnimatedPath* path() const { return m_path.get(); } | 46 SVGAnimatedPath* path() const { return m_path.get(); } |
| 48 SVGAnimatedNumber* pathLength() const { return m_pathLength.get(); } | 47 float computePathLength() const override; |
| 49 float pathLengthScaleFactor() const; | |
| 50 const SVGPathByteStream& pathByteStream() const { | 48 const SVGPathByteStream& pathByteStream() const { |
| 51 return stylePath()->byteStream(); | 49 return stylePath()->byteStream(); |
| 52 } | 50 } |
| 53 | 51 |
| 54 FloatRect getBBox() override; | 52 FloatRect getBBox() override; |
| 55 | 53 |
| 56 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
| 57 | 55 |
| 58 private: | 56 private: |
| 59 explicit SVGPathElement(Document&); | 57 explicit SVGPathElement(Document&); |
| 60 | 58 |
| 61 const StylePath* stylePath() const; | 59 const StylePath* stylePath() const; |
| 62 | 60 |
| 63 void svgAttributeChanged(const QualifiedName&) override; | 61 void svgAttributeChanged(const QualifiedName&) override; |
| 64 | 62 |
| 65 void collectStyleForPresentationAttribute(const QualifiedName&, | 63 void collectStyleForPresentationAttribute(const QualifiedName&, |
| 66 const AtomicString&, | 64 const AtomicString&, |
| 67 MutableStylePropertySet*) override; | 65 MutableStylePropertySet*) override; |
| 68 | 66 |
| 69 Node::InsertionNotificationRequest insertedInto(ContainerNode*) override; | 67 Node::InsertionNotificationRequest insertedInto(ContainerNode*) override; |
| 70 void removedFrom(ContainerNode*) override; | 68 void removedFrom(ContainerNode*) override; |
| 71 | 69 |
| 72 void invalidateMPathDependencies(); | 70 void invalidateMPathDependencies(); |
| 73 | 71 |
| 74 Member<SVGAnimatedNumber> m_pathLength; | |
| 75 Member<SVGAnimatedPath> m_path; | 72 Member<SVGAnimatedPath> m_path; |
| 76 }; | 73 }; |
| 77 | 74 |
| 78 } // namespace blink | 75 } // namespace blink |
| 79 | 76 |
| 80 #endif // SVGPathElement_h | 77 #endif // SVGPathElement_h |
| OLD | NEW |