Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perspective should not be affected by transform-origin #720

Conversation

nikolaszimmermann
Copy link
Contributor

@nikolaszimmermann nikolaszimmermann commented May 18, 2022

0d63a64

Perspective should not be affected by transform-origin
https://bugs.webkit.org/show_bug.cgi?id=211787
<rdar://problem/63143806 >

Patch by Nikolas Zimmermann <nzimmermann@igalia.com > on 2022-05-21
Reviewed by Simon Fraser.

Fix a number of issues related to perspective handling:
- 'perspective-origin' always used the border-box as reference box, when resolving
  length percentages, ignoring the choice of 'transform-box'. Fix that.

- Proper 'transform-box' awareness throghout RenderLayerBacking (few places with issue, e.g. perspectiveOrigin()
  affecting repaint & coverage rects)

- The chosen perspective transformation was not invariant under 'transform-origin' / 'transform-box'
  changes of the element A, that defines the perspective. However the perspective set on element A
  should only affect the rendering of its descendants: the choice of the 'transform-origin' / 'transform-box'
  of element A should have no effect on the perspective established for the children.

- Assure that 'transform-box' changes trigger GraphicLayer geometry updates: this fully fixes 'transform-box'
  support for composited elements, and brings its state on-par with non-composited elements (both support all kind of
  transform-box / transform-origin combinations on regular layers, clipped layers, scrolled layers).

This fixes the (not yet upstreamed) test web-platform-tests/css/css-transforms/animation/transform-box-will-change-transform-layer.html.

Prepared a new WPT test (see above) for upstreaming.

* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::computeTransformedExtentViaTransformList const):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::perspectiveTransform const):
(WebCore::RenderLayer::perspectiveOrigin const):
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateTransform):
(WebCore::RenderLayerBacking::updateChildrenTransformAndAnchorPoint):
(WebCore::RenderLayerBacking::computeTransformOriginForPainting const): Deleted.
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::recompositeChangeRequiresGeometryUpdate):
* Source/WebCore/rendering/RenderLayerModelObject.cpp:
(WebCore::RenderLayerModelObject::applySVGTransform const):
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::computePerspectiveOrigin const):
(WebCore::RenderStyle::applyPerspective const):
(WebCore::RenderStyle::computeTransformOrigin const):
(WebCore::RenderStyle::applyTransformOrigin const):
(WebCore::RenderStyle::unapplyTransformOrigin const):
(WebCore::RenderStyle::applyTransform const):
(WebCore::RenderStyle::applyMotionPathTransform const):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/svg/SVGGraphicsElement.cpp:
(WebCore::SVGGraphicsElement::animatedLocalTransform const):
* LayoutTests/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt:
* LayoutTests/compositing/tiling/perspective-on-scroller-tile-coverage-expected.txt:
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/ios-wk2/compositing/tiling/coverage-adjustment-secondary-quad-mapping-expected.txt:
* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/platform/mac-wk1/compositing/tiling/perspective-on-scroller-tile-coverage-expected.txt:
* LayoutTests/platform/mac/TestExpectations:
* LayoutTests/platform/win/TestExpectations:

Canonical link: https://commits.webkit.org/250841@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294615 268f45cc-cd09-0410-ab3c-d52691b4dbfc

@nikolaszimmermann nikolaszimmermann self-assigned this May 18, 2022
@nikolaszimmermann nikolaszimmermann added Layout and Rendering For bugs with layout and rendering of Web pages. Safari Technology Preview labels May 18, 2022
@webkit-early-warning-system webkit-early-warning-system added the merging-blocked Applied to prevent a change from being merged label May 18, 2022
@nikolaszimmermann nikolaszimmermann removed merging-blocked Applied to prevent a change from being merged Layout and Rendering For bugs with layout and rendering of Web pages. Safari Technology Preview labels May 18, 2022
@nikolaszimmermann nikolaszimmermann force-pushed the eng/Perspective-should-not-be-affected-by-transform-origin branch from 5721529 to 8de011c Compare May 18, 2022 20:42
@nikolaszimmermann nikolaszimmermann added Layout and Rendering For bugs with layout and rendering of Web pages. Safari Technology Preview labels May 18, 2022
Source/WebCore/rendering/RenderLayer.h Outdated Show resolved Hide resolved
@nikolaszimmermann nikolaszimmermann force-pushed the eng/Perspective-should-not-be-affected-by-transform-origin branch 2 times, most recently from dca9c71 to 55f8203 Compare May 19, 2022 21:33
@nikolaszimmermann
Copy link
Contributor Author

Ready :-)

@nikolaszimmermann
Copy link
Contributor Author

Ready :-)

Are we supposed to use the re-request review feature? Or is that additional nagging'? I guess the folks already get message once they are involved in a conversation/review here, no?

@nikolaszimmermann nikolaszimmermann added the merge-queue Applied to send a pull request to merge-queue label May 20, 2022
@nikolaszimmermann nikolaszimmermann force-pushed the eng/Perspective-should-not-be-affected-by-transform-origin branch from 010ccf8 to 0f6f333 Compare May 21, 2022 21:22
@nikolaszimmermann nikolaszimmermann added merge-queue Applied to send a pull request to merge-queue and removed merge-queue Applied to send a pull request to merge-queue labels May 21, 2022
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/Perspective-should-not-be-affected-by-transform-origin branch from 0f6f333 to 0d63a64 Compare May 21, 2022 23:17
@webkit-early-warning-system webkit-early-warning-system merged commit 0d63a64 into WebKit:main May 21, 2022
@webkit-early-warning-system
Copy link
Collaborator

Committed r294615 (250841@main): https://commits.webkit.org/250841@main

Reviewed commits have been landed. Closing PR #720 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system removed the merge-queue Applied to send a pull request to merge-queue label May 21, 2022
@nikolaszimmermann nikolaszimmermann deleted the eng/Perspective-should-not-be-affected-by-transform-origin branch June 21, 2022 08:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layout and Rendering For bugs with layout and rendering of Web pages.
Projects
None yet
3 participants