-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Add test for scrolling descendants of 'perspective-origin' #56030
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
base: master
Are you sure you want to change the base?
Add test for scrolling descendants of 'perspective-origin' #56030
Conversation
c19fb0f to
390642c
Compare
dbaron
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little surprised this isn't already in WPT, given that this interaction is important for parallax scrolling effects, which are possible only using the perspective property, specifically because it has a different interaction with the scroll offset than a perspective() transform function on the child.
One minor suggestion follows.
| <meta charset="utf-8"> | ||
| <title>A parent's 'perspective-origin' needs to respect descendant's scroll position.</title> | ||
| <link rel="author" title="Psychpsyo" href="mailto:psychpsyo@gmail.com"> | ||
| <link rel="help" href="https://www.w3.org/TR/css-transforms-2/#perspective-origin-property"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest also linking to https://drafts.csswg.org/css-transforms-2/#accumulated-3d-transformation-matrix-computation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because the accumulated 3D transform matrix does not apply here. It specifies the "final value of the transform used to render an element in a 3D rendering context".
And, according to the spec:
A 3D rendering context is established by a transformable element whose used value for transform-style is 'preserve-3d'
transform-style is not being tested here. This is purely about computing the correct perspective matrix for descendants of an element with transform and transform-origin when that element can be scrolled. So in essence, it's testing that the transform origin does not move together with the scrolling descendants, but rather stays fixed to the bounds of the scroll container that has perspective-origin.
I've changed the title of the test to something more like that, and also linked to https://www.w3.org/TR/css-transforms-2/#perspective-matrix-computation now, which is the relevant computation here.
390642c to
ff60182
Compare
ff60182 to
8f86ced
Compare
To spec and passes in every browser. Written while implementing this in ladybird.