Skip to content

Commit

Permalink
[LBSE] Computation of on-screen font scaling factor ignores page zoom
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=258120

Reviewed by Rob Buis.

For standalone SVG documents the page zoom has to be taken into account when computing the
on-screen font scaling factor. Currently we ignore the effective zoom factor and thus select
a sub-optimal font.

Non-scaling-stroke (webkit.org/b/139322) works properly in LBSE, if this fix is applied as well.
Two tests fail in LBSE without this patch: svg/text/non-scaling-stroke-textRendering-default.svg
and svg/text/non-scaling-stroke-textRendering-geometricPrecision.svg).

Covered by new tests added by webkit.org/b/139322 -- easy to test with non-scaling-stroke.
Without non-scaling-stroke, this is most noticeable in zoom-zoom-coords.html which now
exposes slighly different metrics for <text> since the internal font-size scaling factor
changed (now taking zoom into account, as the legacy SVG engine already does).

zoom-zoom-coords.xhtml now delivers correct results across all platforms and is identical
for legacy SVG engine and LBSE -- get rid of platform specific results, finally.

* LayoutTests/platform/glib/svg/zoom/page/zoom-zoom-coords-expected.txt: Removed.
* LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/zoom/page/zoom-zoom-coords-expected.txt: Removed.
* LayoutTests/platform/mac/svg/zoom/page/zoom-zoom-coords-expected.txt: Removed.
* LayoutTests/svg/zoom/page/zoom-zoom-coords-expected.txt:
Finally a single non-LBSE/LBSE result for all platforms.
* LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml:
* Source/WebCore/rendering/svg/SVGLayerTransformComputation.h:
(WebCore::SVGLayerTransformComputation::calculateScreenFontSizeScalingFactor const):
Multiply scaling factor by effectiveZoom() (which includes page zoom), but only for non-standalone
SVG documents. For standalone SVG documents the page-zoom induced scaling is already part of the CTM.

Canonical link: https://commits.webkit.org/265208@main
  • Loading branch information
nikolaszimmermann committed Jun 15, 2023
1 parent 68f1d51 commit 988fed7
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 366 deletions.
115 changes: 0 additions & 115 deletions LayoutTests/platform/glib/svg/zoom/page/zoom-zoom-coords-expected.txt

This file was deleted.

This file was deleted.

115 changes: 0 additions & 115 deletions LayoutTests/platform/mac/svg/zoom/page/zoom-zoom-coords-expected.txt

This file was deleted.

12 changes: 6 additions & 6 deletions LayoutTests/svg/zoom/page/zoom-zoom-coords-expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ PASS image1.height.toFixed(2) is "25.00"
PASS image1.right.toFixed(2) is "150.00"
PASS image1.bottom.toFixed(2) is "275.00"
PASS text1.left.toFixed(2) is "100.00"
PASS text1.top.toFixed(2) is "282.66"
PASS text1.top.toFixed(2) is "282.58"
PASS text1.width.toFixed(2) is "49.20"
PASS text1.height.toFixed(2) is "6.16"
PASS text1.right.toFixed(2) is "149.20"
PASS text1.bottom.toFixed(2) is "288.82"
PASS text1.bottom.toFixed(2) is "288.73"

PASS svg2.left.toFixed(2) is "75.00"
PASS svg2.top.toFixed(2) is "100.00"
Expand All @@ -78,11 +78,11 @@ PASS image2.height.toFixed(2) is "25.00"
PASS image2.right.toFixed(2) is "225.00"
PASS image2.bottom.toFixed(2) is "125.00"
PASS text2.left.toFixed(2) is "175.00"
PASS text2.top.toFixed(2) is "132.66"
PASS text2.top.toFixed(2) is "132.75"
PASS text2.width.toFixed(2) is "47.44"
PASS text2.height.toFixed(2) is "5.94"
PASS text2.right.toFixed(2) is "222.44"
PASS text2.bottom.toFixed(2) is "138.60"
PASS text2.bottom.toFixed(2) is "138.69"

PASS svg3.left.toFixed(2) is "900.00"
PASS svg3.top.toFixed(2) is "500.00"
Expand All @@ -103,11 +103,11 @@ PASS image3.height.toFixed(2) is "50.00"
PASS image3.right.toFixed(2) is "1200.00"
PASS image3.bottom.toFixed(2) is "550.00"
PASS text3.left.toFixed(2) is "1100.00"
PASS text3.top.toFixed(2) is "565.33"
PASS text3.top.toFixed(2) is "565.16"
PASS text3.width.toFixed(2) is "98.41"
PASS text3.height.toFixed(2) is "12.31"
PASS text3.right.toFixed(2) is "1198.41"
PASS text3.bottom.toFixed(2) is "577.64"
PASS text3.bottom.toFixed(2) is "577.47"

PASS successfullyParsed is true

Expand Down
Loading

0 comments on commit 988fed7

Please sign in to comment.