Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bc68ba9c807c8876f89480d26161f07e00e26df6
      
https://github.com/WebKit/WebKit/commit/bc68ba9c807c8876f89480d26161f07e00e26df6
  Author: Simon Fraser <[email protected]>
  Date:   2026-01-09 (Fri, 09 Jan 2026)

  Changed paths:
    M LayoutTests/platform/ios/TestExpectations
    A LayoutTests/scrollbars/scrollbar-drag-thumb-composited-expected.txt
    A LayoutTests/scrollbars/scrollbar-drag-thumb-composited.html
    M Source/WebCore/rendering/RenderLayer.h
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp
    M Source/WebCore/rendering/RenderLayerScrollableArea.h
    M Source/WebCore/rendering/RenderWidget.cpp

  Log Message:
  -----------
  REGRESSION (Safari 26.2): Scrollbar drag fails on first attempt after dynamic 
DOM replacement in overflow container
https://bugs.webkit.org/show_bug.cgi?id=304726
rdar://167249048

Reviewed by Alan Baradlay.

Dragging the scrollbar thumb would often fail the first time with always-on 
scrollbars.

Code in `RenderLayerScrollableArea::paintOverflowControls()` called 
`positionOverflowControls()` using a paint-relative
offset, which is different from the layout-relative offset normally used, and 
this sets a bad `frameRect` on the
`Scrollbar` until fixed by the next layout. When dragging the thumb, this 
mutation of the scrollbar's frame
confused the event coordinate logic.

The call to `positionOverflowControls()` in 
`RenderLayerScrollableArea::paintOverflowControls()` is necessary
for painted scrollbars (e.g. the mock scrollbars used for testing), which rely 
on the bad repositioning
of the Scrollbar's Widget. So fix that so that we can paint scrollbars without 
mutating their position,
by applying math similar to that in `RenderWidget::paint()` (another place we 
paint Widgets), which transforms
the GraphicsContext so that the Scrollbar can use its frameRect to paint with. 
This prompted cleanup of this
overflow control painting code, and some minor optimizing to only call 
`overflowControlsRects()` once.

Test: scrollbars/scrollbar-drag-thumb-composited.html

* LayoutTests/platform/ios/TestExpectations:
* LayoutTests/scrollbars/scrollbar-drag-thumb-composited-expected.txt: Added.
* LayoutTests/scrollbars/scrollbar-drag-thumb-composited.html: Added.
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintContents):
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::RenderLayerScrollableArea::paintOverflowControls):
(WebCore::RenderLayerScrollableArea::paintScrollCorner):
(WebCore::RenderLayerScrollableArea::paintResizer):
* Source/WebCore/rendering/RenderLayerScrollableArea.h:
* Source/WebCore/rendering/RenderWidget.cpp:
(WebCore::RenderWidget::paint):

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



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

Reply via email to