Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: df9d73be75356c5200568fb53708f15c7997d211
      
https://github.com/WebKit/WebKit/commit/df9d73be75356c5200568fb53708f15c7997d211
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-06-09 (Tue, 09 Jun 2026)

  Changed paths:
    M 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/svg-intersection-with-fractional-bounds-2-expected.txt
    M 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/svg-viewbox-expected.txt
    M Source/WebCore/page/IntersectionObserver.cpp

  Log Message:
  -----------
  IntersectionObserver does not compute intersections for SVG element roots
https://bugs.webkit.org/show_bug.cgi?id=315445
rdar://177807041

Reviewed by Simon Fraser.

IntersectionObserver::computeIntersectionState() bailed out when an
explicit root was an SVG element: the rootRenderer downcast was
RenderBlock, but both LegacyRenderSVGRoot and RenderSVGRoot derive
from RenderReplaced, so the cast returned null and
canComputeIntersection stayed false. Every entry was queued with
zero rects, and once previousThresholdIndex pinned to 0 against the
zero geometry no later setAttribute() change could shift the
threshold, so subsequent observations were dropped.

Relax the cast to RenderBox (which both SVG roots and RenderBlock
derive from) and resolve the root-ancestor check by root type:

- When the explicit root is an SVG element, resolve via the target's
  SVG tree root, since containingBlock() skips SVG boundaries (the SVG
  root is a RenderReplaced; see the note in
  RenderObject::propagateFragmentedFlowState). Legacy SVG uses
  SVGRenderSupport::findTreeRootObject; LBSE uses lineageOfType<RenderSVGRoot>.
- Otherwise walk containingBlock() to the root, as before.

NOTE: This patch fixes both Legacy and Layer Based SVG engines.

* 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/svg-intersection-with-fractional-bounds-2-expected.txt:
 Progressions
* 
LayoutTests/imported/w3c/web-platform-tests/intersection-observer/svg-viewbox-expected.txt:
 Ditto
* Source/WebCore/page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::computeIntersectionState const):

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



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

Reply via email to