| Index: Source/core/svg/SVGGraphicsElement.cpp
|
| diff --git a/Source/core/svg/SVGGraphicsElement.cpp b/Source/core/svg/SVGGraphicsElement.cpp
|
| index 34711c5d6056af34e9f4b3db2871be334059e086..61075da967ce57a3aa76961c4b597e8d09c15498 100644
|
| --- a/Source/core/svg/SVGGraphicsElement.cpp
|
| +++ b/Source/core/svg/SVGGraphicsElement.cpp
|
| @@ -122,7 +122,7 @@ PassRefPtr<SVGMatrixTearOff> SVGGraphicsElement::getScreenCTMFromJavascript()
|
| return SVGMatrixTearOff::create(getScreenCTM());
|
| }
|
|
|
| -AffineTransform SVGGraphicsElement::animatedLocalTransform() const
|
| +AffineTransform SVGGraphicsElement::calculateAnimatedLocalTransform() const
|
| {
|
| AffineTransform matrix;
|
| RenderStyle* style = renderer() ? renderer()->style() : 0;
|
| @@ -132,22 +132,28 @@ AffineTransform SVGGraphicsElement::animatedLocalTransform() const
|
| TransformationMatrix transform;
|
| float zoom = style->effectiveZoom();
|
|
|
| - // CSS transforms operate with pre-scaled lengths. To make this work with SVG
|
| - // (which applies the zoom factor globally, at the root level) we
|
| - //
|
| - // * pre-scale the bounding box (to bring it into the same space as the other CSS values)
|
| - // * invert the zoom factor (to effectively compute the CSS transform under a 1.0 zoom)
|
| - //
|
| - // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
|
| - // See the "Object bounding box units" section of http://dev.w3.org/csswg/css3-transforms/
|
| - if (zoom != 1) {
|
| - FloatRect scaledBBox = renderer()->objectBoundingBox();
|
| - scaledBBox.scale(zoom);
|
| - transform.scale(1 / zoom);
|
| - style->applyTransform(transform, scaledBBox);
|
| - transform.scale(zoom);
|
| + // SVGTextElements need special handling for the text positioning code.
|
| + if (isSVGTextElement(this)) {
|
| + // Do not take into account SVG's zoom rules, transform-origin, or percentage values.
|
| + style->applyTransform(transform, IntSize(0, 0), RenderStyle::ExcludeTransformOrigin);
|
| } else {
|
| - style->applyTransform(transform, renderer()->objectBoundingBox());
|
| + // CSS transforms operate with pre-scaled lengths. To make this work with SVG
|
| + // (which applies the zoom factor globally, at the root level) we
|
| + //
|
| + // * pre-scale the bounding box (to bring it into the same space as the other CSS values)
|
| + // * invert the zoom factor (to effectively compute the CSS transform under a 1.0 zoom)
|
| + //
|
| + // Note: objectBoundingBox is an emptyRect for elements like pattern or clipPath.
|
| + // See the "Object bounding box units" section of http://dev.w3.org/csswg/css3-transforms/
|
| + if (zoom != 1) {
|
| + FloatRect scaledBBox = renderer()->objectBoundingBox();
|
| + scaledBBox.scale(zoom);
|
| + transform.scale(1 / zoom);
|
| + style->applyTransform(transform, scaledBBox);
|
| + transform.scale(zoom);
|
| + } else {
|
| + style->applyTransform(transform, renderer()->objectBoundingBox());
|
| + }
|
| }
|
|
|
| // Flatten any 3D transform.
|
| @@ -254,8 +260,7 @@ RenderObject* SVGGraphicsElement::createRenderer(RenderStyle*)
|
| void SVGGraphicsElement::toClipPath(Path& path)
|
| {
|
| updatePathFromGraphicsElement(this, path);
|
| - // FIXME: How do we know the element has done a layout?
|
| - path.transform(animatedLocalTransform());
|
| + path.transform(calculateAnimatedLocalTransform());
|
| }
|
|
|
| }
|
|
|