[webkit-changes] [WebKit/WebKit] 6a6822: Excessive repainting when scrolling position:stick...

Simon Fraser noreply at github.com
Mon Oct 7 19:50:41 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6a6822efc75ae88b07a8290a19b27eea03cdba8b
      https://github.com/WebKit/WebKit/commit/6a6822efc75ae88b07a8290a19b27eea03cdba8b
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2024-10-07 (Mon, 07 Oct 2024)

  Changed paths:
    M LayoutTests/TestExpectations
    A LayoutTests/compositing/repaint/sticky-repaint-on-scroll-expected.txt
    A LayoutTests/compositing/repaint/sticky-repaint-on-scroll.html
    M LayoutTests/platform/mac-wk2/TestExpectations
    M Source/WebCore/rendering/RenderLayer.cpp
    M Source/WebCore/rendering/RenderLayer.h

  Log Message:
  -----------
  Excessive repainting when scrolling position:sticky in some configurations
https://bugs.webkit.org/show_bug.cgi?id=280316
rdar://120280327

Reviewed by Alan Baradlay.

https://www.stripe.press/poor-charlies-almanack/talk-one has a tiled `position:sticky` element
which repaints on every scroll. This happens when `RenderLayer::recursiveUpdateLayerPositionsAfterScroll()`
and `RenderLayer::recursiveUpdateLayerPositions()` have different criteria for the `clearRepaintRects()`
condition; the former was testing `!isVisuallyNonEmpty()` and the latter just `m_hasVisibleContent`.

The fix is to have both code paths use a new `isVisibilityHiddenOrOpacityZero()` which just does the
simple check for the visibility and opacity properties. This shouldn't cause much new repainting, because
`recursiveUpdateLayerPositionsAfterScroll()` was doing the stricter check, and we'll almost always do layout
after scroll.

The test requires async scrolling (programmatic scrolling triggers layouts on every scroll as the layout viewport changes).

* LayoutTests/TestExpectations:
* LayoutTests/compositing/repaint/sticky-repaint-on-scroll-expected.txt: Added.
* LayoutTests/compositing/repaint/sticky-repaint-on-scroll.html: Added.
* LayoutTests/platform/mac-wk2/TestExpectations:
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::RenderLayer::calculateClipRects const):

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



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


More information about the webkit-changes mailing list