OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2014 Google, Inc. | 4 * Copyright (C) 2014 Google, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 26 matching lines...) Expand all Loading... |
37 , SVGTests(this) | 37 , SVGTests(this) |
38 , m_transform(SVGAnimatedTransformList::create(this, SVGNames::transformAttr
, SVGTransformList::create())) | 38 , m_transform(SVGAnimatedTransformList::create(this, SVGNames::transformAttr
, SVGTransformList::create())) |
39 { | 39 { |
40 addToPropertyMap(m_transform); | 40 addToPropertyMap(m_transform); |
41 } | 41 } |
42 | 42 |
43 SVGGraphicsElement::~SVGGraphicsElement() | 43 SVGGraphicsElement::~SVGGraphicsElement() |
44 { | 44 { |
45 } | 45 } |
46 | 46 |
47 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getTransformToElement(SVGElemen
t* target, ExceptionState& exceptionState) | 47 void SVGGraphicsElement::trace(Visitor* visitor) |
| 48 { |
| 49 visitor->trace(m_transform); |
| 50 SVGElement::trace(visitor); |
| 51 SVGTests::trace(visitor); |
| 52 } |
| 53 |
| 54 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGGraphicsElement::getTransformToEleme
nt(SVGElement* target, ExceptionState& exceptionState) |
48 { | 55 { |
49 AffineTransform ctm = getCTM(AllowStyleUpdate); | 56 AffineTransform ctm = getCTM(AllowStyleUpdate); |
50 | 57 |
51 if (target && target->isSVGGraphicsElement()) { | 58 if (target && target->isSVGGraphicsElement()) { |
52 AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(AllowSt
yleUpdate); | 59 AffineTransform targetCTM = toSVGGraphicsElement(target)->getCTM(AllowSt
yleUpdate); |
53 if (!targetCTM.isInvertible()) { | 60 if (!targetCTM.isInvertible()) { |
54 exceptionState.throwDOMException(InvalidStateError, "The target tran
sformation is not invertable."); | 61 exceptionState.throwDOMException(InvalidStateError, "The target tran
sformation is not invertable."); |
55 return nullptr; | 62 return nullptr; |
56 } | 63 } |
57 ctm = targetCTM.inverse() * ctm; | 64 ctm = targetCTM.inverse() * ctm; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 AffineTransform SVGGraphicsElement::getCTM(StyleUpdateStrategy styleUpdateStrate
gy) | 112 AffineTransform SVGGraphicsElement::getCTM(StyleUpdateStrategy styleUpdateStrate
gy) |
106 { | 113 { |
107 return computeCTM(NearestViewportScope, styleUpdateStrategy); | 114 return computeCTM(NearestViewportScope, styleUpdateStrategy); |
108 } | 115 } |
109 | 116 |
110 AffineTransform SVGGraphicsElement::getScreenCTM(StyleUpdateStrategy styleUpdate
Strategy) | 117 AffineTransform SVGGraphicsElement::getScreenCTM(StyleUpdateStrategy styleUpdate
Strategy) |
111 { | 118 { |
112 return computeCTM(ScreenScope, styleUpdateStrategy); | 119 return computeCTM(ScreenScope, styleUpdateStrategy); |
113 } | 120 } |
114 | 121 |
115 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getCTMFromJavascript() | 122 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGGraphicsElement::getCTMFromJavascrip
t() |
116 { | 123 { |
117 return SVGMatrixTearOff::create(getCTM()); | 124 return SVGMatrixTearOff::create(getCTM()); |
118 } | 125 } |
119 | 126 |
120 PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJavascript() | 127 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJav
ascript() |
121 { | 128 { |
122 return SVGMatrixTearOff::create(getScreenCTM()); | 129 return SVGMatrixTearOff::create(getScreenCTM()); |
123 } | 130 } |
124 | 131 |
125 bool SVGGraphicsElement::hasAnimatedLocalTransform() const | 132 bool SVGGraphicsElement::hasAnimatedLocalTransform() const |
126 { | 133 { |
127 RenderStyle* style = renderer() ? renderer()->style() : 0; | 134 RenderStyle* style = renderer() ? renderer()->style() : 0; |
128 | 135 |
129 // Each of these is used in SVGGraphicsElement::calculateAnimatedLocalTransf
orm to create an animated local transform. | 136 // Each of these is used in SVGGraphicsElement::calculateAnimatedLocalTransf
orm to create an animated local transform. |
130 return (style && style->hasTransform()) || !m_transform->currentValue()->isE
mpty() || hasSVGRareData(); | 137 return (style && style->hasTransform()) || !m_transform->currentValue()->isE
mpty() || hasSVGRareData(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 { | 254 { |
248 document().updateLayoutIgnorePendingStylesheets(); | 255 document().updateLayoutIgnorePendingStylesheets(); |
249 | 256 |
250 // FIXME: Eventually we should support getBBox for detached elements. | 257 // FIXME: Eventually we should support getBBox for detached elements. |
251 if (!renderer()) | 258 if (!renderer()) |
252 return FloatRect(); | 259 return FloatRect(); |
253 | 260 |
254 return renderer()->objectBoundingBox(); | 261 return renderer()->objectBoundingBox(); |
255 } | 262 } |
256 | 263 |
257 PassRefPtr<SVGRectTearOff> SVGGraphicsElement::getBBoxFromJavascript() | 264 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGGraphicsElement::getBBoxFromJavascript
() |
258 { | 265 { |
259 return SVGRectTearOff::create(SVGRect::create(getBBox()), 0, PropertyIsNotAn
imVal); | 266 return SVGRectTearOff::create(SVGRect::create(getBBox()), 0, PropertyIsNotAn
imVal); |
260 } | 267 } |
261 | 268 |
262 RenderObject* SVGGraphicsElement::createRenderer(RenderStyle*) | 269 RenderObject* SVGGraphicsElement::createRenderer(RenderStyle*) |
263 { | 270 { |
264 // By default, any subclass is expected to do path-based drawing | 271 // By default, any subclass is expected to do path-based drawing |
265 return new RenderSVGPath(this); | 272 return new RenderSVGPath(this); |
266 } | 273 } |
267 | 274 |
268 void SVGGraphicsElement::toClipPath(Path& path) | 275 void SVGGraphicsElement::toClipPath(Path& path) |
269 { | 276 { |
270 updatePathFromGraphicsElement(this, path); | 277 updatePathFromGraphicsElement(this, path); |
271 path.transform(calculateAnimatedLocalTransform()); | 278 path.transform(calculateAnimatedLocalTransform()); |
272 } | 279 } |
273 | 280 |
274 } | 281 } |
OLD | NEW |