RESOLVED DUPLICATE of bug 194903 133150
REGRESSION transform-origin doesn't take zoom into account correctly for SVG content
https://bugs.webkit.org/show_bug.cgi?id=133150
Summary REGRESSION transform-origin doesn't take zoom into account correctly for SVG ...
Dirk Schulze
Reported 2014-05-21 01:58:59 PDT
In the following fiddle, the transform-origin doesn't apply the value of the zoom property (or CMD+/CMD-) correctly. It seems that the origin stays at the same position as without zoom. Note: it works correctly in Safari 7. I don't know the regression window yet. Must be a problem in 2013 or earlier though. http://jsfiddle.net/cpkSp/
Attachments
Dirk Schulze
Comment 1 2014-05-21 02:02:17 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.
Ahmad Saleem
Comment 2 2023-01-07 15:26:25 PST
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!
Ahmad Saleem
Comment 3 2023-05-14 03:32:44 PDT
(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.
Ahmad Saleem
Comment 4 2024-05-15 11:34:26 PDT
Ahmad Saleem
Comment 5 2024-05-15 16:11:14 PDT
// 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.
Devon Govett
Comment 6 2024-09-16 16:13:33 PDT
Just ran into this too. Ahmad, did you submit a PR with your patch?
Fujii Hironori
Comment 7 2024-09-16 16:40:03 PDT
281265@main fixed the problem.
Fujii Hironori
Comment 8 2024-09-16 16:47:41 PDT
*** This bug has been marked as a duplicate of bug 194903 ***
Devon Govett
Comment 9 2024-09-16 17:35:47 PDT
Oh thanks! I can verify that it is fixed in the latest Safari tech preview.
Ahmad Saleem
Comment 10 2024-09-17 06:39:50 PDT
(In reply to Devon Govett from comment #9) > Oh thanks! I can verify that it is fixed in the latest Safari tech preview. I think Fuji fixed it and you should test on Safari Technology Preview. Only bit missing would be SVG text but I haven't test it yet.
Note You need to log in before you can comment on or make changes to this bug.