| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 inline SVGPathElement::SVGPathElement(Document& document) | 51 inline SVGPathElement::SVGPathElement(Document& document) |
| 52 : SVGGeometryElement(SVGNames::pathTag, document) | 52 : SVGGeometryElement(SVGNames::pathTag, document) |
| 53 , m_pathLength(SVGAnimatedNumber::create(this, SVGNames::pathLengthAttr, SVG
Number::create())) | 53 , m_pathLength(SVGAnimatedNumber::create(this, SVGNames::pathLengthAttr, SVG
Number::create())) |
| 54 , m_pathSegList(SVGAnimatedPath::create(this, SVGNames::dAttr)) | 54 , m_pathSegList(SVGAnimatedPath::create(this, SVGNames::dAttr)) |
| 55 { | 55 { |
| 56 addToPropertyMap(m_pathLength); | 56 addToPropertyMap(m_pathLength); |
| 57 addToPropertyMap(m_pathSegList); | 57 addToPropertyMap(m_pathSegList); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void SVGPathElement::trace(Visitor* visitor) |
| 61 { |
| 62 visitor->trace(m_pathLength); |
| 63 visitor->trace(m_pathSegList); |
| 64 SVGGeometryElement::trace(visitor); |
| 65 } |
| 66 |
| 60 DEFINE_NODE_FACTORY(SVGPathElement) | 67 DEFINE_NODE_FACTORY(SVGPathElement) |
| 61 | 68 |
| 62 float SVGPathElement::getTotalLength() | 69 float SVGPathElement::getTotalLength() |
| 63 { | 70 { |
| 64 float totalLength = 0; | 71 float totalLength = 0; |
| 65 getTotalLengthOfSVGPathByteStream(pathByteStream(), totalLength); | 72 getTotalLengthOfSVGPathByteStream(pathByteStream(), totalLength); |
| 66 return totalLength; | 73 return totalLength; |
| 67 } | 74 } |
| 68 | 75 |
| 69 PassRefPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float length) | 76 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float l
ength) |
| 70 { | 77 { |
| 71 FloatPoint point; | 78 FloatPoint point; |
| 72 getPointAtLengthOfSVGPathByteStream(pathByteStream(), length, point); | 79 getPointAtLengthOfSVGPathByteStream(pathByteStream(), length, point); |
| 73 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); | 80 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim
Val); |
| 74 } | 81 } |
| 75 | 82 |
| 76 unsigned SVGPathElement::getPathSegAtLength(float length) | 83 unsigned SVGPathElement::getPathSegAtLength(float length) |
| 77 { | 84 { |
| 78 unsigned pathSeg = 0; | 85 unsigned pathSeg = 0; |
| 79 getSVGPathSegAtLengthFromSVGPathByteStream(pathByteStream(), length, pathSeg
); | 86 getSVGPathSegAtLengthFromSVGPathByteStream(pathByteStream(), length, pathSeg
); |
| 80 return pathSeg; | 87 return pathSeg; |
| 81 } | 88 } |
| 82 | 89 |
| 83 PassRefPtr<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClosePath() | 90 PassRefPtrWillBeRawPtr<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClos
ePath() |
| 84 { | 91 { |
| 85 return SVGPathSegClosePath::create(0); | 92 return SVGPathSegClosePath::create(0); |
| 86 } | 93 } |
| 87 | 94 |
| 88 PassRefPtr<SVGPathSegMovetoAbs> SVGPathElement::createSVGPathSegMovetoAbs(float
x, float y) | 95 PassRefPtrWillBeRawPtr<SVGPathSegMovetoAbs> SVGPathElement::createSVGPathSegMove
toAbs(float x, float y) |
| 89 { | 96 { |
| 90 return SVGPathSegMovetoAbs::create(0, x, y); | 97 return SVGPathSegMovetoAbs::create(0, x, y); |
| 91 } | 98 } |
| 92 | 99 |
| 93 PassRefPtr<SVGPathSegMovetoRel> SVGPathElement::createSVGPathSegMovetoRel(float
x, float y) | 100 PassRefPtrWillBeRawPtr<SVGPathSegMovetoRel> SVGPathElement::createSVGPathSegMove
toRel(float x, float y) |
| 94 { | 101 { |
| 95 return SVGPathSegMovetoRel::create(0, x, y); | 102 return SVGPathSegMovetoRel::create(0, x, y); |
| 96 } | 103 } |
| 97 | 104 |
| 98 PassRefPtr<SVGPathSegLinetoAbs> SVGPathElement::createSVGPathSegLinetoAbs(float
x, float y) | 105 PassRefPtrWillBeRawPtr<SVGPathSegLinetoAbs> SVGPathElement::createSVGPathSegLine
toAbs(float x, float y) |
| 99 { | 106 { |
| 100 return SVGPathSegLinetoAbs::create(0, x, y); | 107 return SVGPathSegLinetoAbs::create(0, x, y); |
| 101 } | 108 } |
| 102 | 109 |
| 103 PassRefPtr<SVGPathSegLinetoRel> SVGPathElement::createSVGPathSegLinetoRel(float
x, float y) | 110 PassRefPtrWillBeRawPtr<SVGPathSegLinetoRel> SVGPathElement::createSVGPathSegLine
toRel(float x, float y) |
| 104 { | 111 { |
| 105 return SVGPathSegLinetoRel::create(0, x, y); | 112 return SVGPathSegLinetoRel::create(0, x, y); |
| 106 } | 113 } |
| 107 | 114 |
| 108 PassRefPtr<SVGPathSegCurvetoCubicAbs> SVGPathElement::createSVGPathSegCurvetoCub
icAbs(float x, float y, float x1, float y1, float x2, float y2) | 115 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicAbs> SVGPathElement::createSVGPathS
egCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2) |
| 109 { | 116 { |
| 110 return SVGPathSegCurvetoCubicAbs::create(0, x, y, x1, y1, x2, y2); | 117 return SVGPathSegCurvetoCubicAbs::create(0, x, y, x1, y1, x2, y2); |
| 111 } | 118 } |
| 112 | 119 |
| 113 PassRefPtr<SVGPathSegCurvetoCubicRel> SVGPathElement::createSVGPathSegCurvetoCub
icRel(float x, float y, float x1, float y1, float x2, float y2) | 120 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicRel> SVGPathElement::createSVGPathS
egCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2) |
| 114 { | 121 { |
| 115 return SVGPathSegCurvetoCubicRel::create(0, x, y, x1, y1, x2, y2); | 122 return SVGPathSegCurvetoCubicRel::create(0, x, y, x1, y1, x2, y2); |
| 116 } | 123 } |
| 117 | 124 |
| 118 PassRefPtr<SVGPathSegCurvetoQuadraticAbs> SVGPathElement::createSVGPathSegCurvet
oQuadraticAbs(float x, float y, float x1, float y1) | 125 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticAbs> SVGPathElement::createSVGP
athSegCurvetoQuadraticAbs(float x, float y, float x1, float y1) |
| 119 { | 126 { |
| 120 return SVGPathSegCurvetoQuadraticAbs::create(0, x, y, x1, y1); | 127 return SVGPathSegCurvetoQuadraticAbs::create(0, x, y, x1, y1); |
| 121 } | 128 } |
| 122 | 129 |
| 123 PassRefPtr<SVGPathSegCurvetoQuadraticRel> SVGPathElement::createSVGPathSegCurvet
oQuadraticRel(float x, float y, float x1, float y1) | 130 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticRel> SVGPathElement::createSVGP
athSegCurvetoQuadraticRel(float x, float y, float x1, float y1) |
| 124 { | 131 { |
| 125 return SVGPathSegCurvetoQuadraticRel::create(0, x, y, x1, y1); | 132 return SVGPathSegCurvetoQuadraticRel::create(0, x, y, x1, y1); |
| 126 } | 133 } |
| 127 | 134 |
| 128 PassRefPtr<SVGPathSegArcAbs> SVGPathElement::createSVGPathSegArcAbs(float x, flo
at y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) | 135 PassRefPtrWillBeRawPtr<SVGPathSegArcAbs> SVGPathElement::createSVGPathSegArcAbs(
float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweep
Flag) |
| 129 { | 136 { |
| 130 return SVGPathSegArcAbs::create(0, x, y, r1, r2, angle, largeArcFlag, sweepF
lag); | 137 return SVGPathSegArcAbs::create(0, x, y, r1, r2, angle, largeArcFlag, sweepF
lag); |
| 131 } | 138 } |
| 132 | 139 |
| 133 PassRefPtr<SVGPathSegArcRel> SVGPathElement::createSVGPathSegArcRel(float x, flo
at y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) | 140 PassRefPtrWillBeRawPtr<SVGPathSegArcRel> SVGPathElement::createSVGPathSegArcRel(
float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweep
Flag) |
| 134 { | 141 { |
| 135 return SVGPathSegArcRel::create(0, x, y, r1, r2, angle, largeArcFlag, sweepF
lag); | 142 return SVGPathSegArcRel::create(0, x, y, r1, r2, angle, largeArcFlag, sweepF
lag); |
| 136 } | 143 } |
| 137 | 144 |
| 138 PassRefPtr<SVGPathSegLinetoHorizontalAbs> SVGPathElement::createSVGPathSegLineto
HorizontalAbs(float x) | 145 PassRefPtrWillBeRawPtr<SVGPathSegLinetoHorizontalAbs> SVGPathElement::createSVGP
athSegLinetoHorizontalAbs(float x) |
| 139 { | 146 { |
| 140 return SVGPathSegLinetoHorizontalAbs::create(0, x); | 147 return SVGPathSegLinetoHorizontalAbs::create(0, x); |
| 141 } | 148 } |
| 142 | 149 |
| 143 PassRefPtr<SVGPathSegLinetoHorizontalRel> SVGPathElement::createSVGPathSegLineto
HorizontalRel(float x) | 150 PassRefPtrWillBeRawPtr<SVGPathSegLinetoHorizontalRel> SVGPathElement::createSVGP
athSegLinetoHorizontalRel(float x) |
| 144 { | 151 { |
| 145 return SVGPathSegLinetoHorizontalRel::create(0, x); | 152 return SVGPathSegLinetoHorizontalRel::create(0, x); |
| 146 } | 153 } |
| 147 | 154 |
| 148 PassRefPtr<SVGPathSegLinetoVerticalAbs> SVGPathElement::createSVGPathSegLinetoVe
rticalAbs(float y) | 155 PassRefPtrWillBeRawPtr<SVGPathSegLinetoVerticalAbs> SVGPathElement::createSVGPat
hSegLinetoVerticalAbs(float y) |
| 149 { | 156 { |
| 150 return SVGPathSegLinetoVerticalAbs::create(0, y); | 157 return SVGPathSegLinetoVerticalAbs::create(0, y); |
| 151 } | 158 } |
| 152 | 159 |
| 153 PassRefPtr<SVGPathSegLinetoVerticalRel> SVGPathElement::createSVGPathSegLinetoVe
rticalRel(float y) | 160 PassRefPtrWillBeRawPtr<SVGPathSegLinetoVerticalRel> SVGPathElement::createSVGPat
hSegLinetoVerticalRel(float y) |
| 154 { | 161 { |
| 155 return SVGPathSegLinetoVerticalRel::create(0, y); | 162 return SVGPathSegLinetoVerticalRel::create(0, y); |
| 156 } | 163 } |
| 157 | 164 |
| 158 PassRefPtr<SVGPathSegCurvetoCubicSmoothAbs> SVGPathElement::createSVGPathSegCurv
etoCubicSmoothAbs(float x, float y, float x2, float y2) | 165 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicSmoothAbs> SVGPathElement::createSV
GPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2) |
| 159 { | 166 { |
| 160 return SVGPathSegCurvetoCubicSmoothAbs::create(0, x, y, x2, y2); | 167 return SVGPathSegCurvetoCubicSmoothAbs::create(0, x, y, x2, y2); |
| 161 } | 168 } |
| 162 | 169 |
| 163 PassRefPtr<SVGPathSegCurvetoCubicSmoothRel> SVGPathElement::createSVGPathSegCurv
etoCubicSmoothRel(float x, float y, float x2, float y2) | 170 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicSmoothRel> SVGPathElement::createSV
GPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2) |
| 164 { | 171 { |
| 165 return SVGPathSegCurvetoCubicSmoothRel::create(0, x, y, x2, y2); | 172 return SVGPathSegCurvetoCubicSmoothRel::create(0, x, y, x2, y2); |
| 166 } | 173 } |
| 167 | 174 |
| 168 PassRefPtr<SVGPathSegCurvetoQuadraticSmoothAbs> SVGPathElement::createSVGPathSeg
CurvetoQuadraticSmoothAbs(float x, float y) | 175 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticSmoothAbs> SVGPathElement::crea
teSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y) |
| 169 { | 176 { |
| 170 return SVGPathSegCurvetoQuadraticSmoothAbs::create(0, x, y); | 177 return SVGPathSegCurvetoQuadraticSmoothAbs::create(0, x, y); |
| 171 } | 178 } |
| 172 | 179 |
| 173 PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSeg
CurvetoQuadraticSmoothRel(float x, float y) | 180 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::crea
teSVGPathSegCurvetoQuadraticSmoothRel(float x, float y) |
| 174 { | 181 { |
| 175 return SVGPathSegCurvetoQuadraticSmoothRel::create(0, x, y); | 182 return SVGPathSegCurvetoQuadraticSmoothRel::create(0, x, y); |
| 176 } | 183 } |
| 177 | 184 |
| 178 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) | 185 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) |
| 179 { | 186 { |
| 180 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 187 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 181 if (supportedAttributes.isEmpty()) { | 188 if (supportedAttributes.isEmpty()) { |
| 182 supportedAttributes.add(SVGNames::dAttr); | 189 supportedAttributes.add(SVGNames::dAttr); |
| 183 supportedAttributes.add(SVGNames::pathLengthAttr); | 190 supportedAttributes.add(SVGNames::pathLengthAttr); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 285 |
| 279 // FIXME: Eventually we should support getBBox for detached elements. | 286 // FIXME: Eventually we should support getBBox for detached elements. |
| 280 if (!renderer()) | 287 if (!renderer()) |
| 281 return FloatRect(); | 288 return FloatRect(); |
| 282 | 289 |
| 283 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 290 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
| 284 return renderer->path().boundingRect(); | 291 return renderer->path().boundingRect(); |
| 285 } | 292 } |
| 286 | 293 |
| 287 } // namespace blink | 294 } // namespace blink |
| OLD | NEW |