| Summary: | REGRESSION transform-origin doesn't take zoom into account correctly for SVG content | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Dirk Schulze <krit> |
| Component: | SVG | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW --- | ||
| Severity: | Normal | CC: | ahmad.saleem792, fotis.papadogeorgopoulos, zimmermann |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| URL: | http://jsfiddle.net/cpkSp/ | ||
| See Also: | https://bugs.webkit.org/show_bug.cgi?id=258615 | ||
|
Description
Dirk Schulze
2014-05-21 01:58:59 PDT
Additional information: This problem just occurs for percentage values. Pixel values are scaled correctly. Which, on the other hand, doesn't work correctly in Safari 7. It is still happening in Safari 16.2 & STP160 using JSFiddle from Comment 0 and it is fixed in following commit by Blink: Commit - https://src.chromium.org/viewvc/blink?view=revision&revision=174907 WebKit Source - https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGGraphicsElement.cpp#98 There are fixes in LBSE so I don't know whether it is already fixed in LBSE or not? Appreciate if @Nikolaz can confirm. Thanks! (In reply to Ahmad Saleem from comment #2) > It is still happening in Safari 16.2 & STP160 using JSFiddle from Comment 0 > and it is fixed in following commit by Blink: > > Commit - https://src.chromium.org/viewvc/blink?view=revision&revision=174907 > > WebKit Source - > https://searchfox.org/wubkat/source/Source/WebCore/svg/SVGGraphicsElement. > cpp#98 > > There are fixes in LBSE so I don't know whether it is already fixed in LBSE > or not? Appreciate if @Nikolaz can confirm. Thanks! I applied this locally and this does fix the attached test case but the attached testcase with the commit does not work. Blink Commit (from GitHub Repo - Chromium) - https://github.com/chromium/chromium/commit/56ca23de0ae12871406e53753d71c2237551ac24 // Honor any of the transform-related CSS properties if set.
if (hasSpecifiedTransform || (style && (style->translate() || style->scale() || style->rotate()))) {
TransformationMatrix transform;
float zoom = style->usedZoom();
// 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->transformReferenceBoxRect();
scaledBBox.scale(zoom);
transform.scale(1 / zoom);
style->applyTransform(transform, TransformOperationData(scaledBBox, renderer.get()));
transform.scale(zoom);
} else
style->applyTransform(transform, TransformOperationData(renderer->transformReferenceBoxRect(), renderer.get()));
___
This compiles and fix attach test case.
|