Skip to content

Conversation

@Psychpsyo
Copy link
Contributor

@Psychpsyo Psychpsyo commented Nov 14, 2025

To spec and passes in every browser. Written while implementing this in ladybird.

Copy link
Member

@dbaron dbaron left a 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">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@Psychpsyo Psychpsyo Nov 16, 2025

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.

@Psychpsyo Psychpsyo force-pushed the perspective-origin-scroll branch from 390642c to ff60182 Compare November 16, 2025 08:31
@Psychpsyo Psychpsyo force-pushed the perspective-origin-scroll branch from ff60182 to 8f86ced Compare November 16, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants