Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9d1b2ba86390b4d32457a0ff0089da31cec31e68
      
https://github.com/WebKit/WebKit/commit/9d1b2ba86390b4d32457a0ff0089da31cec31e68
  Author: Kiet Ho <[email protected]>
  Date:   2025-11-20 (Thu, 20 Nov 2025)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/scroll-margin-propagation-iframe-1.html
    A 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/scroll-margin-propagation-iframe-2.html
    A 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/scroll-margin-propagation-iframe-3.html
    A 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/scroll-margin-propagation-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/scroll-margin-propagation.html
    M Source/WebCore/page/IntersectionObserver.cpp

  Log Message:
  -----------
  [intersection-observer] scroll-margin should not be applied to scrollers in 
cross-origin frames
rdar://164994009
https://bugs.webkit.org/show_bug.cgi?id=302732

Reviewed by Simon Fraser.

Currently, WebKit applies scroll margin to every frame in the chain from the 
target's
frame to the main frame. This includes cross-origin-domain frames, which might 
leak
information about the frame. In the discussion about adding scroll margin [1], 
there's
an implementation notes about not propagating scroll margin past the first 
cross-origin
frame:

> Implementation notes:
> * [...]
> * Should stop margins at a cross-origin iframe boundary for security

Fix WebKit's implementation to follow this implementation note. Included is a 
test case
that fully passes in Firefox Nightly 147.0a1 (2025-11-19) (aarch64). Chrome 
seems to
have an issue wrt. intersection observers not firing in deeply nested iframes.

[1]: 
https://github.com/w3c/IntersectionObserver/issues/431#issuecomment-1542502858

Test: 
imported/w3c/web-platform-tests/intersection-observer/scroll-margin-propagation.html

* 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/scroll-margin-propagation-iframe-1.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/scroll-margin-propagation-iframe-2.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/resources/scroll-margin-propagation-iframe-3.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/scroll-margin-propagation-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/scroll-margin-propagation.html:
 Added.
* Source/WebCore/page/IntersectionObserver.cpp:
(WebCore::computeClippedRectInRootContentsSpace):
    - When traversing up the frame chain, stop applying and propagating
      scroll margin if we visit a cross-origin-domain frame.
(WebCore::IntersectionObserver::computeIntersectionState const):

Canonical link: https://commits.webkit.org/303367@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to