| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 return SVGMatrixTearOff::create(getCTM()); | 124 return SVGMatrixTearOff::create(getCTM()); |
| 125 } | 125 } |
| 126 | 126 |
| 127 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJav
ascript() | 127 PassRefPtrWillBeRawPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJav
ascript() |
| 128 { | 128 { |
| 129 return SVGMatrixTearOff::create(getScreenCTM()); | 129 return SVGMatrixTearOff::create(getScreenCTM()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 bool SVGGraphicsElement::hasAnimatedLocalTransform() const | 132 bool SVGGraphicsElement::hasAnimatedLocalTransform() const |
| 133 { | 133 { |
| 134 const LayoutStyle* style = layoutObject() ? layoutObject()->style() : nullpt
r; | 134 const ComputedStyle* style = layoutObject() ? layoutObject()->style() : null
ptr; |
| 135 | 135 |
| 136 // 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. |
| 137 return (style && style->hasTransform()) || !m_transform->currentValue()->isE
mpty() || hasSVGRareData(); | 137 return (style && style->hasTransform()) || !m_transform->currentValue()->isE
mpty() || hasSVGRareData(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const | 140 AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const |
| 141 { | 141 { |
| 142 AffineTransform matrix; | 142 AffineTransform matrix; |
| 143 const LayoutStyle* style = layoutObject() ? layoutObject()->style() : nullpt
r; | 143 const ComputedStyle* style = layoutObject() ? layoutObject()->style() : null
ptr; |
| 144 | 144 |
| 145 // If CSS property was set, use that, otherwise fallback to attribute (if se
t). | 145 // If CSS property was set, use that, otherwise fallback to attribute (if se
t). |
| 146 if (style && style->hasTransform()) { | 146 if (style && style->hasTransform()) { |
| 147 TransformationMatrix transform; | 147 TransformationMatrix transform; |
| 148 float zoom = style->effectiveZoom(); | 148 float zoom = style->effectiveZoom(); |
| 149 | 149 |
| 150 // SVGTextElements need special handling for the text positioning code. | 150 // SVGTextElements need special handling for the text positioning code. |
| 151 if (isSVGTextElement(this)) { | 151 if (isSVGTextElement(this)) { |
| 152 // Do not take into account SVG's zoom rules, transform-origin, or p
ercentage values. | 152 // Do not take into account SVG's zoom rules, transform-origin, or p
ercentage values. |
| 153 style->applyTransform(transform, LayoutSize(0, 0), LayoutStyle::Excl
udeTransformOrigin); | 153 style->applyTransform(transform, LayoutSize(0, 0), ComputedStyle::Ex
cludeTransformOrigin); |
| 154 } else { | 154 } else { |
| 155 // CSS transforms operate with pre-scaled lengths. To make this work
with SVG | 155 // CSS transforms operate with pre-scaled lengths. To make this work
with SVG |
| 156 // (which applies the zoom factor globally, at the root level) we | 156 // (which applies the zoom factor globally, at the root level) we |
| 157 // | 157 // |
| 158 // * pre-scale the bounding box (to bring it into the same space a
s the other CSS values) | 158 // * pre-scale the bounding box (to bring it into the same space a
s the other CSS values) |
| 159 // * invert the zoom factor (to effectively compute the CSS transf
orm under a 1.0 zoom) | 159 // * invert the zoom factor (to effectively compute the CSS transf
orm under a 1.0 zoom) |
| 160 // | 160 // |
| 161 // Note: objectBoundingBox is an emptyRect for elements like pattern
or clipPath. | 161 // Note: objectBoundingBox is an emptyRect for elements like pattern
or clipPath. |
| 162 // See the "Object bounding box units" section of http://dev.w3.org/
csswg/css3-transforms/ | 162 // See the "Object bounding box units" section of http://dev.w3.org/
csswg/css3-transforms/ |
| 163 if (zoom != 1) { | 163 if (zoom != 1) { |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 return FloatRect(); | 254 return FloatRect(); |
| 255 | 255 |
| 256 return layoutObject()->objectBoundingBox(); | 256 return layoutObject()->objectBoundingBox(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGGraphicsElement::getBBoxFromJavascript
() | 259 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGGraphicsElement::getBBoxFromJavascript
() |
| 260 { | 260 { |
| 261 return SVGRectTearOff::create(SVGRect::create(getBBox()), 0, PropertyIsNotAn
imVal); | 261 return SVGRectTearOff::create(SVGRect::create(getBBox()), 0, PropertyIsNotAn
imVal); |
| 262 } | 262 } |
| 263 | 263 |
| 264 LayoutObject* SVGGraphicsElement::createLayoutObject(const LayoutStyle&) | 264 LayoutObject* SVGGraphicsElement::createLayoutObject(const ComputedStyle&) |
| 265 { | 265 { |
| 266 // By default, any subclass is expected to do path-based drawing | 266 // By default, any subclass is expected to do path-based drawing |
| 267 return new LayoutSVGPath(this); | 267 return new LayoutSVGPath(this); |
| 268 } | 268 } |
| 269 | 269 |
| 270 void SVGGraphicsElement::toClipPath(Path& path) | 270 void SVGGraphicsElement::toClipPath(Path& path) |
| 271 { | 271 { |
| 272 updatePathFromGraphicsElement(this, path); | 272 updatePathFromGraphicsElement(this, path); |
| 273 path.transform(calculateAnimatedLocalTransform()); | 273 path.transform(calculateAnimatedLocalTransform()); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } | 276 } |
| OLD | NEW |