Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[LBSE] Text rendering is not pixel perfect
https://bugs.webkit.org/show_bug.cgi?id=244487 Reviewed by Rob Buis. RenderSVGInlineText::computeNewScaledFontForStyle() uses SVGRenderingContext calculateScreenFontSizeScalingFactor() to determine the scaling factor to apply to the font size, to avoid scaling the rendered glyphs. As we want to get rid of 'SVGRenderingContext' and 'SVGRenderSupport' in LBSE (confusing, general purpose bins for different unrelated code pieces), add a new dedicated class which contains the code for the necessary computations. -> Introduce 'SVGLayerTransformComputation' for LBSE, which knows how to compute the 'Screen CTM' matrix (re-using SVG terminology here) for a given renderer. It includes all transformations up to the enclosing composited layer (or root) including the device scaling factor. Instead of manually multiplying matrices this now fully relies on mapLocalToContainer(). The very same code will be used to implement the SVG DOM getCTM() / getScreenCTM() APIs in a follow-up patch. TransformState needs to be extended to also accumulate the actual transformation matrix, instead of only points / quads, etc. This is precisely the information we need for getCTM() / getScreenCTM() and calculateScreenFontSizeScalingFactor(). Covered by existing tests, fixes 14 additional SVG 1.1 testcases. * LayoutTests/platform/mac-monterey-wk2-lbse-text/TestExpectations: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/animate-elem-84-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/coords-trans-02-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/coords-trans-03-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/coords-trans-04-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/coords-trans-05-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/coords-trans-06-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/filters-color-01-b-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/filters-comptran-01-b-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/interact-events-01-b-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/metadata-example-01-b-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/paths-data-04-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/paths-data-05-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/paths-data-06-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/paths-data-07-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/paths-data-08-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/pservers-grad-07-b-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/pservers-grad-08-b-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/struct-frag-02-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/struct-frag-03-t-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/W3C-SVG-1.1/text-text-01-b-expected.txt: * LayoutTests/platform/mac-monterey-wk2-lbse-text/svg/foreignObject/text-tref-02-b-expected.txt: * Source/WebCore/platform/graphics/transforms/TransformState.cpp: (WebCore::TransformState::operator=): (WebCore::TransformState::translateMappedCoordinates): (WebCore::TransformState::move): (WebCore::TransformState::flattenWithTransform): * Source/WebCore/platform/graphics/transforms/TransformState.h: (WebCore::TransformState::setTransformMatrixTracking): (WebCore::TransformState::transformMatrixTracking const): (WebCore::TransformState::releaseTrackedTransform): * Source/WebCore/rendering/svg/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::computeNewScaledFontForStyle): * Source/WebCore/rendering/svg/SVGLayerTransformComputation.h: Added. (WebCore::SVGLayerTransformComputation::SVGLayerTransformComputation): (WebCore::SVGLayerTransformComputation::computeAccumulatedTransform const): (WebCore::SVGLayerTransformComputation::calculateScreenFontSizeScalingFactor const): Canonical link: https://commits.webkit.org/253938@main
- Loading branch information
1 parent
d51fb37
commit e3e969227c9e4c59148f4e78a81fb9cbc6e2a3a3
Showing
26 changed files
with
452 additions
and
327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.