Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7531c8a6aab99257ee7de279e862fc06318be678
      
https://github.com/WebKit/WebKit/commit/7531c8a6aab99257ee7de279e862fc06318be678
  Author: Ben Nham <[email protected]>
  Date:   2026-10-14 (Wed, 14 Oct 2026)

  Changed paths:
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayer.h

  Log Message:
  -----------
  Only update layer positions in subtrees with viewport-constrained layers when 
the document scrolls
https://bugs.webkit.org/show_bug.cgi?id=326584
rdar://problem/189346423

Reviewed by Simon Fraser.

When a document with fixed or sticky content scrolls, 
recursiveUpdateLayerPositionsAfterScroll()
visits every layer in the frame and calls updateLayerPosition() on each one.

For most layers this does nothing. The position of a layer that is not fixed or 
sticky depends on
its current layout and on the scroll positions of overflow scrolling ancestors. 
(The document's
scroll position is not one of those, since it is in LocalFrameView rather than 
in RenderLayer.)
updateLayerPositionsAfterScrolling() calls flushUpdateLayerPositions() before 
the visit, so all
layer positions already match the current layout, and the visit recalculates 
the same values.

We still need to visit fixed or sticky layers and their descendants. The 
position of a sticky layer
changes because the sticky offset depends on the viewport. These layers also 
move in document
coordinates when the document scrolls, so their clip rects and repaint rects 
change.

So we now skip any subtree that does not contain a fixed or sticky layer and is 
not inside one.
Overflow scrolls still visit the full subtree.

In debug builds, verifySkippedLayerPositionsAfterDocumentScroll() checks each 
skipped subtree. It
asserts that the subtree has no fixed or sticky layers, and it calls 
updateLayerPosition() in Verify
mode on each layer to assert that the position is already up to date.

* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::recursiveUpdateLayerPositionsAfterScroll):
(WebCore::RenderLayer::verifySkippedLayerPositionsAfterDocumentScroll):
(WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll):
* Source/WebCore/rendering/RenderLayer.h:

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



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

Reply via email to