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, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 private: | 47 private: |
48 explicit SVGAnimatedPathLength(SVGPathElement* contextElement) | 48 explicit SVGAnimatedPathLength(SVGPathElement* contextElement) |
49 : SVGAnimatedNumber(contextElement, | 49 : SVGAnimatedNumber(contextElement, |
50 SVGNames::pathLengthAttr, | 50 SVGNames::pathLengthAttr, |
51 SVGNumber::create()) {} | 51 SVGNumber::create()) {} |
52 }; | 52 }; |
53 | 53 |
54 inline SVGPathElement::SVGPathElement(Document& document) | 54 inline SVGPathElement::SVGPathElement(Document& document) |
55 : SVGGeometryElement(SVGNames::pathTag, document), | 55 : SVGGeometryElement(SVGNames::pathTag, document), |
56 m_pathLength(SVGAnimatedPathLength::create(this)), | 56 m_pathLength(SVGAnimatedPathLength::create(this)), |
57 m_path(SVGAnimatedPath::create(this, SVGNames::dAttr)) { | 57 m_path(SVGAnimatedPath::create(this, SVGNames::dAttr, CSSPropertyD)) { |
58 addToPropertyMap(m_pathLength); | 58 addToPropertyMap(m_pathLength); |
59 addToPropertyMap(m_path); | 59 addToPropertyMap(m_path); |
60 } | 60 } |
61 | 61 |
62 DEFINE_TRACE(SVGPathElement) { | 62 DEFINE_TRACE(SVGPathElement) { |
63 visitor->trace(m_pathLength); | 63 visitor->trace(m_pathLength); |
64 visitor->trace(m_path); | 64 visitor->trace(m_path); |
65 SVGGeometryElement::trace(visitor); | 65 SVGGeometryElement::trace(visitor); |
66 } | 66 } |
67 | 67 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 FloatPoint point = SVGPathQuery(pathByteStream()).getPointAtLength(length); | 109 FloatPoint point = SVGPathQuery(pathByteStream()).getPointAtLength(length); |
110 return SVGPointTearOff::create(SVGPoint::create(point), 0, | 110 return SVGPointTearOff::create(SVGPoint::create(point), 0, |
111 PropertyIsNotAnimVal); | 111 PropertyIsNotAnimVal); |
112 } | 112 } |
113 | 113 |
114 unsigned SVGPathElement::getPathSegAtLength(float length) { | 114 unsigned SVGPathElement::getPathSegAtLength(float length) { |
115 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 115 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
116 return SVGPathQuery(pathByteStream()).getPathSegIndexAtLength(length); | 116 return SVGPathQuery(pathByteStream()).getPathSegIndexAtLength(length); |
117 } | 117 } |
118 | 118 |
119 bool SVGPathElement::isPresentationAttribute( | |
120 const QualifiedName& attrName) const { | |
121 if (attrName == SVGNames::dAttr) | |
122 return true; | |
123 return SVGGeometryElement::isPresentationAttribute(attrName); | |
124 } | |
125 | |
126 bool SVGPathElement::isPresentationAttributeWithSVGDOM( | |
127 const QualifiedName& attrName) const { | |
128 if (attrName == SVGNames::dAttr) | |
129 return true; | |
130 return SVGGeometryElement::isPresentationAttributeWithSVGDOM(attrName); | |
131 } | |
132 | |
133 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) { | 119 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) { |
134 if (attrName == SVGNames::dAttr) { | 120 if (attrName == SVGNames::dAttr) { |
135 SVGElement::InvalidationGuard invalidationGuard(this); | 121 SVGElement::InvalidationGuard invalidationGuard(this); |
136 invalidateSVGPresentationAttributeStyle(); | 122 invalidateSVGPresentationAttributeStyle(); |
137 setNeedsStyleRecalc(LocalStyleChange, | 123 setNeedsStyleRecalc(LocalStyleChange, |
138 StyleChangeReasonForTracing::fromAttribute(attrName)); | 124 StyleChangeReasonForTracing::fromAttribute(attrName)); |
139 | 125 |
140 if (LayoutSVGShape* layoutPath = toLayoutSVGShape(this->layoutObject())) | 126 if (LayoutSVGShape* layoutPath = toLayoutSVGShape(this->layoutObject())) |
141 layoutPath->setNeedsShapeUpdate(); | 127 layoutPath->setNeedsShapeUpdate(); |
142 | 128 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 192 } |
207 | 193 |
208 FloatRect SVGPathElement::getBBox() { | 194 FloatRect SVGPathElement::getBBox() { |
209 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 195 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
210 | 196 |
211 // We want the exact bounds. | 197 // We want the exact bounds. |
212 return SVGPathElement::asPath().boundingRect(Path::BoundsType::Exact); | 198 return SVGPathElement::asPath().boundingRect(Path::BoundsType::Exact); |
213 } | 199 } |
214 | 200 |
215 } // namespace blink | 201 } // namespace blink |
OLD | NEW |