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] Unify all SVG geometry/transform computations with CSS
https://bugs.webkit.org/show_bug.cgi?id=247672 Reviewed by Rob Buis. Consistently use SVGLayerTranformComputation whenever transformations need to be computed in the SVG render tree, utilizing 'TransformState' and 'mapLocalToContainer', which were previously extended for SVGs needs (TransformState::TransformMatrixTracking). This assures that the very same transformation matrices / code paths are used for the following items: - Query SVG CTM (e.g. from JS), via SVGLocatable interface getCTM() / getScreenCTM() / (getTransformToElement()). - Painting layers for SVG renderers RenderLayer::paintLayerByApplyingTransform() uses the 4x4 3D aware m_transform matrix previously computed in RenderLayer::updateTransform(). - DOM geometry API (getBoundingClientRect / getClientRect / etc.) ... Covered by existing tests, fixes a bunch of tests in LBSE related to getCTM & friends. One test - svg/zoom/page/zoom-zoom-coords.xhtml was wrong in all browsers -- fix that, now legacy fails it and LBSE passes as all others (no change in behavior for legacy, only the test changed). * LayoutTests/platform/ios-wk2/svg/custom/getClientRects-expected.txt: * LayoutTests/platform/mac-ventura-wk2-lbse-text/TestExpectations: * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/W3C-SVG-1.1/coords-viewattr-01-b-expected.txt: * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/custom/container-opacity-clip-viewBox-expected.png: Added. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/custom/getTransformToElement-expected.txt: Added. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/custom/getscreenctm-in-mixed-content-expected.txt: Added. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/custom/getscreenctm-in-scrollable-div-area-expected.txt: Added. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/custom/getscreenctm-in-scrollable-div-area-nested-expected.txt: Added. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/custom/getscreenctm-in-scrollable-svg-area-expected.txt: Added. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/custom/text-ctm-expected.txt: Added. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/text/selection-doubleclick-expected.txt: * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/text/text-rescale-expected.txt: * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/zoom/page/zoom-coords-viewattr-01-b-expected.txt: * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/zoom/page/zoom-zoom-coords-expected.txt: Copied from LayoutTests/platform/mac/svg/zoom/page/zoom-zoom-coords-expected.txt. * LayoutTests/platform/mac-ventura-wk2-lbse-text/svg/zoom/text/zoom-coords-viewattr-01-b-expected.txt: * LayoutTests/platform/mac/svg/zoom/page/zoom-zoom-coords-expected.txt: * LayoutTests/svg/custom/getClientRects-expected.txt: * LayoutTests/svg/zoom/page/zoom-zoom-coords.xhtml: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Element.cpp: (WebCore::shouldObtainBoundsFromSVGModel): (WebCore::shouldObtainBoundsFromBoxModel): (WebCore::Element::boundsInRootViewSpace): (WebCore::Element::absoluteEventBounds): (WebCore::Element::getClientRects): (WebCore::Element::boundingAbsoluteRectWithoutLayout const): * Source/WebCore/rendering/RenderLayerModelObject.cpp: (WebCore::RenderLayerModelObject::mapLocalToSVGContainer const): (WebCore::RenderLayerModelObject::applySVGTransform const): * Source/WebCore/rendering/RenderLayerModelObject.h: * Source/WebCore/rendering/svg/RenderSVGBlock.cpp: (WebCore::RenderSVGBlock::absoluteRects const): (WebCore::RenderSVGBlock::absoluteQuads const): (WebCore::RenderSVGBlock::mapLocalToContainer const): (WebCore::RenderSVGBlock::offsetFromContainer const): * Source/WebCore/rendering/svg/RenderSVGModelObject.cpp: (WebCore::RenderSVGModelObject::absoluteRects const): (WebCore::RenderSVGModelObject::absoluteQuads const): * Source/WebCore/rendering/svg/RenderSVGRoot.cpp: (WebCore::RenderSVGRoot::mapLocalToContainer const): (WebCore::RenderSVGRoot::absoluteQuads const): * Source/WebCore/rendering/svg/SVGBoundingBoxComputation.cpp: (WebCore::SVGBoundingBoxComputation::handleRootOrContainer const): * Source/WebCore/rendering/svg/SVGLayerTransformComputation.h: (WebCore::SVGLayerTransformComputation::computeAccumulatedTransform const): (WebCore::SVGLayerTransformComputation::calculateScreenFontSizeScalingFactor const): * Source/WebCore/svg/SVGLocatable.cpp: (WebCore::SVGLocatable::computeCTM): * Source/WebCore/svg/SVGSVGElement.cpp: (WebCore::SVGSVGElement::localCoordinateSpaceTransform const): * Source/WebCore/svg/SVGUseElement.cpp: (WebCore::SVGUseElement::toClipPath): Canonical link: https://commits.webkit.org/256862@main
- Loading branch information
1 parent
ca1977f
commit 5c3443a0ab7a7fdeaeeb20c104da59b55de0e265
Showing
31 changed files
with
524 additions
and
202 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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
layer at (0,0) size 800x600 | ||
RenderView at (0,0) size 800x600 | ||
layer at (0,0) size 800x600 | ||
RenderSVGRoot {svg} at (0,0) size 800x600 | ||
layer at (0,0) size 800x600 | ||
RenderSVGViewportContainer at (0,0) size 800x600 | ||
layer at (50,123.50) size 82x35 | ||
RenderSVGTransformableContainer {g} at (50,123.50) size 81.67x34 | ||
layer at (50,123.50) size 82x34 | ||
RenderSVGText {text} at (0,0) size 82x34 contains 1 chunk(s) | ||
RenderSVGInlineText {#text} at (0,0) size 82x34 | ||
chunk 1 text run 1 at (50.00,150.00) startOffset 0 endOffset 6 width 81.67: "Passed" | ||
layer at (50,50) size 70x30 | ||
RenderSVGTransformableContainer {g} at (50,50) size 70x30 | ||
layer at (50,50) size 70x30 | ||
RenderSVGRect {rect} at (0,0) size 70x30 [x=50.00] [y=50.00] [width=70.00] [height=30.00] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
layer at (0,0) size 800x600 | ||
RenderView at (0,0) size 800x600 | ||
layer at (0,0) size 800x52 | ||
RenderBlock {html} at (0,0) size 800x52 | ||
RenderBody {body} at (8,8) size 784x36 | ||
RenderText {#text} at (0,0) size 174x18 | ||
text run at (0,0) width 174: "This tests the behaviour of " | ||
RenderInline {code} at (0,0) size 220x15 | ||
RenderText {#text} at (173,2) size 220x15 | ||
text run at (173,2) width 220: "SVGLocatable::getScreenCTM()" | ||
RenderText {#text} at (392,0) size 112x18 | ||
text run at (392,0) width 112: " in mixed content" | ||
RenderBR {br} at (503,0) size 1x18 | ||
RenderText {#text} at (0,18) size 322x18 | ||
text run at (0,18) width 322: "If the test passes you should see a green rectangle." | ||
layer at (30,100) size 400x200 | ||
RenderBlock (positioned) {div} at (30,100) size 400x200 | ||
RenderText {#text} at (0,0) size 0x0 | ||
layer at (30,100) size 400x200 | ||
RenderSVGRoot {svg} at (0,0) size 400x200 | ||
layer at (30,100) size 400x200 | ||
RenderSVGViewportContainer at (0,0) size 400x200 | ||
layer at (30,100) size 200x100 | ||
RenderSVGRect {rect} at (0,0) size 200x100 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=200.00] [height=100.00] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
layer at (0,0) size 800x600 | ||
RenderView at (0,0) size 800x600 | ||
layer at (0,0) size 800x550 | ||
RenderBlock {html} at (0,0) size 800x550 | ||
RenderBody {body} at (0,0) size 800x550 | ||
layer at (0,0) size 750x550 clip at (0,0) size 735x535 scrollY 1700 scrollHeight 4010 | ||
RenderBlock {div} at (0,0) size 750x550 | ||
RenderText {#text} at (0,0) size 0x0 | ||
layer at (0,-1700) size 735x4006 backgroundClip at (0,0) size 735x535 clip at (0,0) size 735x535 | ||
RenderSVGRoot {svg} at (0,0) size 735x4006 | ||
layer at (0,-1700) size 735x4006 backgroundClip at (0,0) size 735x535 clip at (0,0) size 735x535 | ||
RenderSVGViewportContainer at (0,0) size 735x4006 | ||
layer at (350,250) size 100x100 | ||
RenderSVGRect {rect} at (350,1950) size 100x100 [fill={[type=SOLID] [color=#000080] [opacity=0.50]}] [x=350.00] [y=1950.00] [width=100.00] [height=100.00] | ||
layer at (350,250) size 100x100 | ||
RenderSVGEllipse {circle} at (350,1950) size 100x100 [fill={[type=SOLID] [color=#F08080]}] [cx=400.00] [cy=2000.00] [r=50.00] | ||
layer at (266.92,386) size 266x18 | ||
RenderSVGText {text} at (266,2086) size 268x18 contains 1 chunk(s) | ||
RenderSVGInlineText {#text} at (0,0) size 267x18 | ||
chunk 1 (middle anchor) text run 1 at (266.93,2100.00) startOffset 0 endOffset 46 width 266.13: "The test passes if the circle sits in the rect" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
layer at (0,0) size 800x600 | ||
RenderView at (0,0) size 800x600 | ||
layer at (0,0) size 800x550 | ||
RenderBlock {html} at (0,0) size 800x550 | ||
RenderBody {body} at (0,0) size 800x550 | ||
layer at (0,0) size 750x550 clip at (0,0) size 735x535 scrollY 300 scrollHeight 1000 | ||
RenderBlock {div} at (0,0) size 750x550 | ||
layer at (0,-300) size 725x1000 backgroundClip at (0,0) size 725x535 clip at (0,0) size 710x535 scrollY 1400 scrollHeight 4100 | ||
RenderBlock {div} at (0,0) size 725x1000 | ||
RenderText {#text} at (0,0) size 0x0 | ||
layer at (0,-1700) size 710x4096 backgroundClip at (0,0) size 710x535 clip at (0,0) size 710x535 | ||
RenderSVGRoot {svg} at (0,0) size 710x4096 | ||
layer at (0,-1700) size 710x4096 backgroundClip at (0,0) size 710x535 clip at (0,0) size 710x535 | ||
RenderSVGViewportContainer at (0,0) size 710x4096 | ||
layer at (350,250) size 100x100 | ||
RenderSVGRect {rect} at (350,1950) size 100x100 [fill={[type=SOLID] [color=#000080] [opacity=0.50]}] [x=350.00] [y=1950.00] [width=100.00] [height=100.00] | ||
layer at (350,250) size 100x100 | ||
RenderSVGEllipse {circle} at (350,1950) size 100x100 [fill={[type=SOLID] [color=#F08080]}] [cx=400.00] [cy=2000.00] [r=50.00] | ||
layer at (266.92,386) size 266x18 | ||
RenderSVGText {text} at (266,2086) size 268x18 contains 1 chunk(s) | ||
RenderSVGInlineText {#text} at (0,0) size 267x18 | ||
chunk 1 (middle anchor) text run 1 at (266.93,2100.00) startOffset 0 endOffset 46 width 266.13: "The test passes if the circle sits in the rect" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
layer at (0,0) size 785x4004 | ||
RenderView at (0,0) size 785x600 | ||
layer at (0,0) size 785x4004 | ||
RenderBlock {html} at (0,0) size 785x4004 | ||
RenderBody {body} at (0,0) size 785x4004 | ||
RenderText {#text} at (0,0) size 0x0 | ||
RenderText {#text} at (0,0) size 0x0 | ||
layer at (0,0) size 785x4000 | ||
RenderSVGRoot {svg} at (0,0) size 785x4000 | ||
layer at (0,0) size 785x4000 | ||
RenderSVGViewportContainer at (0,0) size 785x4000 | ||
layer at (350,1950) size 100x100 | ||
RenderSVGRect {rect} at (350,1950) size 100x100 [fill={[type=SOLID] [color=#000080] [opacity=0.50]}] [x=350.00] [y=1950.00] [width=100.00] [height=100.00] | ||
layer at (350,1950) size 100x100 | ||
RenderSVGEllipse {circle} at (350,1950) size 100x100 [fill={[type=SOLID] [color=#F08080]}] [cx=400.00] [cy=2000.00] [r=50.00] | ||
layer at (266.92,2086) size 266x18 | ||
RenderSVGText {text} at (266,2086) size 268x18 contains 1 chunk(s) | ||
RenderSVGInlineText {#text} at (0,0) size 267x18 | ||
chunk 1 (middle anchor) text run 1 at (266.93,2100.00) startOffset 0 endOffset 46 width 266.13: "The test passes if the circle sits in the rect" | ||
scrolled to 0,1700 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
layer at (0,0) size 800x600 | ||
RenderView at (0,0) size 800x600 | ||
layer at (0,0) size 800x600 | ||
RenderSVGRoot {svg} at (0,0) size 800x600 | ||
layer at (0,0) size 800x600 | ||
RenderSVGViewportContainer at (0,0) size 800x600 | ||
layer at (70,55.50) size 44x19 | ||
RenderSVGTransformableContainer {g} at (70,55.50) size 43.56x18.50 | ||
layer at (0,0) size 800x601 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600 | ||
RenderSVGViewportContainer {svg} at (-70,-55.50) size 800x600 | ||
layer at (70,55.50) size 44x18 | ||
RenderSVGText {text} at (70,55) size 44x19 contains 1 chunk(s) | ||
RenderSVGInlineText {#text} at (0,0) size 44x19 | ||
chunk 1 text run 1 at (70.00,70.00) startOffset 0 endOffset 6 width 43.55: "Passed" |
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.