Skip to content

[cssom-view] Clarify GeometryUtils for pseudo-elements - #14131

Open
jogibear9988 wants to merge 2 commits into
w3c:mainfrom
jogibear9988:patch-3
Open

[cssom-view] Clarify GeometryUtils for pseudo-elements#14131
jogibear9988 wants to merge 2 commits into
w3c:mainfrom
jogibear9988:patch-3

Conversation

@jogibear9988

Copy link
Copy Markdown

This clarifies how GeometryUtils applies to CSSPseudoElement objects.

Changes

  • Specify that GeometryUtils operates on the boxes generated by the pseudo-element itself.
  • Explicitly cover generated content pseudos like ::before and ::after, including out-of-flow boxes such as absolutely positioned pseudos.
  • Clarify behavior for sub-pseudo-elements.
  • Specify that getBoxQuads() returns an empty list when a pseudo-element generates no boxes.
  • Use CSSPseudoElement.parent when walking transforms for nested pseudos.
  • Use CSSPseudoElement.element when resolving the node document.
  • Clarify that convertPointFromNode() flattens to 2D and ignores z/w.
  • Expand the placeholder convertQuadFromNode() / convertRectFromNode() algorithms into Bikeshed-friendly steps.

Testing

  • git diff --check
  • Remote Bikeshed generator succeeded for cssom-view-1/Overview.bs

@jogibear9988

Copy link
Copy Markdown
Author

I created a implementation of this for chrome (https://chromium-review.googlesource.com/c/chromium/src/+/8039580) and during this some issues popped up

@jogibear9988

Copy link
Copy Markdown
Author

@emilio @whimboo @Psychpsyo

maybe someone of you could review this additional request.

Also added pseudo test's to my WPT pull req: https://github.com/web-platform-tests/wpt/pull/61015/commits

@jogibear9988

Copy link
Copy Markdown
Author

@jogibear9988

Copy link
Copy Markdown
Author

So hopefully we get closer to deliver this at some time in the near future

GeometryUtils coordinate conversion can traverse nested document boundaries. Checking only the origins of the endpoint nodes is insufficient: two same-origin documents can have a cross-origin document between them, allowing the inner document to observe layout information from that intermediate document.

Define the document chains participating in a conversion and require every document up to their common container document to be same-origin with the target node's document. Throw SecurityError before computing transforms when that condition is not met.

This prevents the cross-origin layout leak while retaining support for coordinate conversion across same-origin iframe hierarchies. Because the check is performed by convertPointFromNode(), it also applies to the quad, rectangle, and getBoxQuads({relativeTo}) paths built on top of point conversion.

Fixes w3c#14170
@jogibear9988

Copy link
Copy Markdown
Author

@emilio @whimboo @Psychpsyo
can you also review this. I changed smth about Cross Origin cause of a security complain from @progers

@emilio emilio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

How exactly can you get your hands on nodes from two different origins in the same script without being an extension or so?

@progers

progers commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@emilio , the security issue (#14170) involves two nodes from the same origin but with a cross-origin frame between them. For example:

https://origin-a.com/outer.html
  https://origin-b.com/middle.html
    https://origin-a.com/inner.html

Querying the geometry of a node in https://origin-a.com/inner.html relative to a node in https://origin-a.com/outer.html would reveal information from https://origin-b.com/middle.html, such as layout and scroll position. This information is partially available today with intersection observer, but this API would make it much easier to access.

@jogibear9988's solution is to restrict the GeometryUtils API in cases where cross-origin information would be revealed while still allowing the cross-frame case as long as everything is same-origin.

@emilio emilio left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Cool, I see, looks good.

I guess you could get a reasonable conversion between those by converting to the toplevel, but yeah not something we'd want to expose.

@emilio

emilio commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

We need to do the IPR thing again @svgeesus

@jogibear9988

Copy link
Copy Markdown
Author

are some of you also responsible for wpt tests? web-platform-tests/wpt#61015
And what's the way to get the cross iframe change then to firefox? a bugreport?

@emilio

emilio commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Yes please file a bug in https://bugzilla.mozilla.org, thanks!

@jogibear9988

Copy link
Copy Markdown
Author

Yes please file a bug in https://bugzilla.mozilla.org, thanks!

will do when the spec change is merged

@jogibear9988

Copy link
Copy Markdown
Author

@emilio any news to this? cause in chrome me pull req. is merge ready, but it implements also this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants