Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 10bb43f2800676df37a1c6cee6fe646e330858f9
      
https://github.com/WebKit/WebKit/commit/10bb43f2800676df37a1c6cee6fe646e330858f9
  Author: Vitaly Dyachkov <[email protected]>
  Date:   2026-07-31 (Fri, 31 Jul 2026)

  Changed paths:
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/page/scrolling/coordinated/ScrollingTreeCoordinated.cpp
    M 
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.cpp
    M 
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.h

  Log Message:
  -----------
  Improve `ScrollingTreeCoordinated` layer hit testing
https://bugs.webkit.org/show_bug.cgi?id=320449

Reviewed by Carlos Garcia Campos.

Current implementation walks the layer tree and returns the first layer
it encounters that has a scrolling node, with no check that this layer
is actually the one visually on top at the hit point. As a result, a
scrolling node can be chosen even when it's covered by an unrelated
element positioned on top of it.

This patch mirrors the `ScrollingTreeMac` implementation as closely as
possible: layers at the hit point are collected front-to-back, and a
candidate scrolling node is only accepted once `isScrolledBy()` confirms
it's actually an ancestor of the frontmost interactive layer with a
fallback to layers further back for the case where the frontmost layer
is itself non-interactive.

* Source/WebCore/page/scrolling/coordinated/ScrollingTreeCoordinated.cpp:
(WebCore::collectDescendantLayersAtPoint):
Walks the layer tree under a given point and builds a flat list of every
layer whose bounds contain the point.
(WebCore::isScrolledBy):
Given a candidate scrolling node and the actual frontmost hit layer,
walks up the frontmost layer's ancestor chain checking whether that
scrolling node owns it.
(WebCore::ScrollingTreeCoordinated::scrollingNodeForPoint):
Collects all candidate layers front-to-back, remembers the first
("frontmost") one that is interactive, and for each candidate checks
whether its scrolling node is confirmed by `isScrolledBy()` against that
frontmost layer. If the frontmost interactive layer itself isn't
scrollable, falls back to checking layers further behind it.
(WebCore::ScrollingTreeCoordinated::eventListenerRegionTypesForPoint const):
(WebCore::traverseDescendantLayersAtPoint): Deleted.
(WebCore::layersAtPointToCheckForScrolling):
(WebCore::layerEventRegionContainsPoint):
* 
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.cpp:
(WebCore::CoordinatedPlatformLayer::setChildren):
(WebCore::CoordinatedPlatformLayer::removeFromParent):
(WebCore::CoordinatedPlatformLayer::masksToBounds const):
(WebCore::CoordinatedPlatformLayer::mask const):
(WebCore::CoordinatedPlatformLayer::parent const):
* 
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.h:
(WebCore::CoordinatedPlatformLayer::parent const):
* LayoutTests/platform/glib/TestExpectations:

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



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

Reply via email to