| 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 const ComputedStyle* style = layoutObject() ? layoutObject()->style() : null
ptr; | 142 const ComputedStyle* style = layoutObject() ? layoutObject()->style() : null
ptr; |
| 143 | 143 |
| 144 // If CSS property was set, use that, otherwise fallback to attribute (if se
t). | 144 // If CSS property was set, use that, otherwise fallback to attribute (if se
t). |
| 145 if (style && style->hasTransform()) { | 145 if (style && style->hasTransform()) { |
| 146 TransformationMatrix transform; | 146 TransformationMatrix transform; |
| 147 float zoom = style->effectiveZoom(); | 147 float zoom = style->effectiveZoom(); |
| 148 | 148 |
| 149 // SVGTextElements need special handling for the text positioning code. | 149 // SVGTextElements need special handling for the text positioning code. |
| 150 if (isSVGTextElement(this)) { | 150 if (isSVGTextElement(this)) { |
| 151 // Do not take into account SVG's zoom rules, transform-origin, or p
ercentage values. | 151 // Do not take into account SVG's zoom rules, transform-origin, or p
ercentage values. |
| 152 style->applyTransform(transform, LayoutSize(0, 0), ComputedStyle::Ex
cludeTransformOrigin); | 152 style->applyTransform(transform, LayoutSize(0, 0), ComputedStyle::Ex
cludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIn
dependentTransformProperties); |
| 153 } else { | 153 } else { |
| 154 // CSS transforms operate with pre-scaled lengths. To make this work
with SVG | 154 // CSS transforms operate with pre-scaled lengths. To make this work
with SVG |
| 155 // (which applies the zoom factor globally, at the root level) we | 155 // (which applies the zoom factor globally, at the root level) we |
| 156 // | 156 // |
| 157 // * pre-scale the bounding box (to bring it into the same space a
s the other CSS values) | 157 // * pre-scale the bounding box (to bring it into the same space a
s the other CSS values) |
| 158 // * invert the zoom factor (to effectively compute the CSS transf
orm under a 1.0 zoom) | 158 // * invert the zoom factor (to effectively compute the CSS transf
orm under a 1.0 zoom) |
| 159 // | 159 // |
| 160 // Note: objectBoundingBox is an emptyRect for elements like pattern
or clipPath. | 160 // Note: objectBoundingBox is an emptyRect for elements like pattern
or clipPath. |
| 161 // See the "Object bounding box units" section of http://dev.w3.org/
csswg/css3-transforms/ | 161 // See the "Object bounding box units" section of http://dev.w3.org/
csswg/css3-transforms/ |
| 162 if (zoom != 1) { | 162 if (zoom != 1) { |
| 163 FloatRect scaledBBox = layoutObject()->objectBoundingBox(); | 163 FloatRect scaledBBox = layoutObject()->objectBoundingBox(); |
| 164 scaledBBox.scale(zoom); | 164 scaledBBox.scale(zoom); |
| 165 transform.scale(1 / zoom); | 165 transform.scale(1 / zoom); |
| 166 style->applyTransform(transform, scaledBBox); | 166 style->applyTransform(transform, scaledBBox, ComputedStyle::Incl
udeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeInde
pendentTransformProperties); |
| 167 transform.scale(zoom); | 167 transform.scale(zoom); |
| 168 } else { | 168 } else { |
| 169 style->applyTransform(transform, layoutObject()->objectBoundingB
ox()); | 169 style->applyTransform(transform, layoutObject()->objectBoundingB
ox(), ComputedStyle::IncludeTransformOrigin, ComputedStyle::IncludeMotionPath, C
omputedStyle::IncludeIndependentTransformProperties); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Flatten any 3D transform. | 173 // Flatten any 3D transform. |
| 174 matrix = transform.toAffineTransform(); | 174 matrix = transform.toAffineTransform(); |
| 175 } else { | 175 } else { |
| 176 m_transform->currentValue()->concatenate(matrix); | 176 m_transform->currentValue()->concatenate(matrix); |
| 177 } | 177 } |
| 178 | 178 |
| 179 if (hasSVGRareData()) | 179 if (hasSVGRareData()) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 | 239 |
| 240 return layoutObject()->objectBoundingBox(); | 240 return layoutObject()->objectBoundingBox(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGGraphicsElement::getBBoxFromJavascript
() | 243 PassRefPtrWillBeRawPtr<SVGRectTearOff> SVGGraphicsElement::getBBoxFromJavascript
() |
| 244 { | 244 { |
| 245 return SVGRectTearOff::create(SVGRect::create(getBBox()), 0, PropertyIsNotAn
imVal); | 245 return SVGRectTearOff::create(SVGRect::create(getBBox()), 0, PropertyIsNotAn
imVal); |
| 246 } | 246 } |
| 247 | 247 |
| 248 } | 248 } |
| OLD | NEW |