[webkit-changes] [WebKit/WebKit] 1e1ce7: Making a scroller composited generates repaints fo...

mattwoodrow noreply at github.com
Wed Jul 17 12:33:51 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1e1ce773deb4727ab1fd65317fc61b9592ba44fc
      https://github.com/WebKit/WebKit/commit/1e1ce773deb4727ab1fd65317fc61b9592ba44fc
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2024-07-17 (Wed, 17 Jul 2024)

  Changed paths:
    A LayoutTests/compositing/repaint/scroller-repaints-once-expected.txt
    A LayoutTests/compositing/repaint/scroller-repaints-once.html
    M LayoutTests/platform/glib/TestExpectations
    A LayoutTests/platform/ios/compositing/repaint/scroller-repaints-once-expected.txt
    M LayoutTests/platform/mac-wk1/TestExpectations
    M LayoutTests/platform/win/TestExpectations
    A LayoutTests/platform/wpe/fast/text/mark-matches-overflow-clip-expected.txt
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.h
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp

  Log Message:
  -----------
  Making a scroller composited generates repaints for two rendering updates.
https://bugs.webkit.org/show_bug.cgi?id=276465
<rdar://131502835>

Reviewed by Simon Fraser.

Creating a newly composited scroller paints the scroller in the following
rendering update, and then repaints it again (as it switches to painting outside
of the directly visible area) on the following rendering update.

One issue is that RenderLayer::updateLayerPositionsAfterLayout computes repaint
rects relative to the nearest composited ancestor, but this runs before
computeCompositingRequirements, so the scroller isn't considered composited.
Elements inside the scroller get rects relative to the root, and get clipped by
the scroller, so anything not directly visible has an empty rect. On the
successive paint, the scroller is the composited ancestor, so unclipped rects
get generated and new repaints are issued for the change.

The fix for this is to have
RenderLayerScrollableArea::computeHasCompositedScrollableOverflow call
layerStartedCompositingScrollableOverflow (a simplified version of
layerStyleChanged) so that the scroller gets a compositing layer immediately and
updateLayerPositions can compute the right rects initially.

A second issue is that RenderLayerScrollableArea::usesCompositedScrolling()
depends on the presence of RenderLayerBackingStore::m_scrollContainerLayer,
which also isn't created until compositing layers are flushed (after
updateLayerPositions has finished).

This fix is to check hasCompositedScrollableOverflow() instead, which is the
input to deciding if a scroll container layer will be created in the future.

New test added that creates a composited scroller, and then checks the coverage
rects after the first rendering update. This only has the right rects with the
second, third and fourth issues fixed.

It then mutates an element inside the scroller (but isn't visible) and checks
that the repaint rects are exactly what changed. Without the first bug fixed,
the repaint rects cover the whole scrollable area.

* LayoutTests/compositing/repaint/scroller-repaints-once-expected.txt: Added.
* LayoutTests/compositing/repaint/scroller-repaints-once.html: Added.
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/ios/compositing/repaint/scroller-repaints-once-expected.txt: Added.
* LayoutTests/platform/mac-wk1/TestExpectations:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::layerStartedCompositingScrollableOverflow):
* Source/WebCore/rendering/RenderLayerCompositor.h:
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::computeScrollDimensions):
(WebCore::RenderLayerScrollableArea::computeHasCompositedScrollableOverflow):
(WebCore::RenderLayerScrollableArea::usesCompositedScrolling const):
* Source/WebCore/rendering/RenderLayerScrollableArea.h:

Canonical link: https://commits.webkit.org/281062@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