Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 34b552ef6263497a52db44d5cb38278f0b776530
      
https://github.com/WebKit/WebKit/commit/34b552ef6263497a52db44d5cb38278f0b776530
  Author: Cameron McCormack <[email protected]>
  Date:   2026-07-15 (Wed, 15 Jul 2026)

  Changed paths:
    A 
LayoutTests/fast/scrolling/mac/view-transition-captures-composited-scrollbars-expected.html
    A 
LayoutTests/fast/scrolling/mac/view-transition-captures-composited-scrollbars.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/scroller-child.html
    M 
LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/scroller.html
    M Source/WebCore/platform/Scrollbar.h
    M Source/WebCore/platform/mac/ScrollbarThemeMac.mm
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp

  Log Message:
  -----------
  Capture always-on scrollbars in View Transitions snapshots
https://bugs.webkit.org/show_bug.cgi?id=319473
rdar://problem/182283234

Reviewed by Simon Fraser.

css/css-view-transitions/scroller.html and scroller-child.html fail on
wpt.fyi because the View Transitions snapshot does not include the
scrollbars of the element with scrollable overflow.

On the wpt.fyi bots, Always On Scrollbars are used, which take layout
space and render scrollbars with two rounded rectangles (one for the
track, one for the thumb). This is rendered in the UI process by getting
AppKit to create layers for the scrollbar parts. During snapshotting,
we currently skip drawing scollbars if we know that they are being
rendered by the UI process.

Also, the existing scrollbar drawing code, which uses drawKnobSlotInRect:
and drawKnob:, results in a legacy appearance that does not match the
Always On Scrollbars appearance that AppKit creates via layers.

So, we change paintScrollbar to allow painting the scrollbar during
snapshotting, even when the UI process is handling scrollbar rendering,
and add a new method to render the scrollbar via NSScrollerImp's layer-
generating path.

A custom NSScrollerImpDelegate is needed to:

1. opt in to the layer-based rendering (through
   shouldUseLayerPerPartForScrollerImp:)

2. ensure that the ScrollableArea's appearance (dark or light)
   propagates to the scrollbar

3. work around an issue where the CALayers created by the NSScrollerImp
   have corner radii set to NaN, which the window server interprets as
   "maximum radius given the size of the layer", but which renderInContext:
   does not seem to handle.

(And WebScrollerImpDelegateMac, which is what the UI process uses, is tied
too closely to a ScrollerMac, so cannot be directly used here.)

The rendering of the rounded corners of the scrollbars differs a little
between the window server and renderInContext:, so the fuzz values for
the WPTs are increased.

When these WPTs are run in WebKit's CI, they use mock scrollbars and
have async overflow scrolling disabled, which causes the test to pass
despite having this issue. So we add an equivalent (almost identical) test as
a regular layout test so that we can force mock scrollbars off and async
scrolling on, which allows us to test that the Always On Scrollbar
rendering in the viewport matches UI process rendered scrollbars.

* 
LayoutTests/fast/scrolling/mac/view-transition-captures-composited-scrollbars-expected.html:
 Added.
* 
LayoutTests/fast/scrolling/mac/view-transition-captures-composited-scrollbars.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/scroller-child.html:
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-view-transitions/scroller.html:
* Source/WebCore/platform/Scrollbar.h:
(WebCore::Scrollbar::paintingIntoSnapshot const):
(WebCore::Scrollbar::setPaintingIntoSnapshot):
* Source/WebCore/platform/mac/ScrollbarThemeMac.mm:
(-[WebSnapshotScrollerImpDelegate convertRectToBacking:]):
(-[WebSnapshotScrollerImpDelegate convertRectFromBacking:]):
(-[WebSnapshotScrollerImpDelegate shouldUseLayerPerPartForScrollerImp:]):
(-[WebSnapshotScrollerImpDelegate effectiveAppearanceForScrollerImp:]):
(-[WebSnapshotScrollerImpDelegate displayLayer:]):
(-[WebSnapshotScrollerImpDelegate scrollerImp:animateKnobAlphaTo:duration:]):
(-[WebSnapshotScrollerImpDelegate scrollerImp:animateTrackAlphaTo:duration:]):
(-[WebSnapshotScrollerImpDelegate scrollerImp:overlayScrollerStateChangedTo:]):
(WebCore::paintScrollbarUsingLayersForSnapshot):
(WebCore::paintScrollbarUsingLegacyAppearance):
(WebCore::paintScrollbar):
(WebCore::ScrollbarThemeMac::paint):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::paintOverflowControls):

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



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

Reply via email to