Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3a24edb712c909d7883a9f670435121bf326480c
      
https://github.com/WebKit/WebKit/commit/3a24edb712c909d7883a9f670435121bf326480c
  Author: Lily Spiniolas <[email protected]>
  Date:   2026-03-12 (Thu, 12 Mar 2026)

  Changed paths:
    M Source/WebCore/platform/ScrollView.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Tools/TestWebKitAPI/Tests/mac/ScrollbarTests.mm

  Log Message:
  -----------
  [macOS] CSS scrollbars may be cut off, scrollbar corner rect may be sized 
incorrectly
https://bugs.webkit.org/show_bug.cgi?id=309753
rdar://168566468

Reviewed by Aditya Keerthi.

In 306039@main we introduced a mechanism to inset scrollbars based on the size
of the window's corner radii in order to prevent them from being partially
obscured. While it worked well for non-custom scrollbars, it introduced a new
issue which caused the scrollbar corner rect to increase in size as the window's
corner radii increased.

To fix this, the scroll corner rect is now computed directly from the 
scrollbars'
already-positioned frame rects. The previous implementation independently 
computed
two rects based on the tracked dimensions and united them, which produced an
oversized result after corner-radius avoidance changed the scrollbar lengths. 
This
also naturally handles obscured content insets and RTL placement since the 
scrollbar
frame rects already account for those. This fixes not only the size of the 
corner
rect, but also fixes an additional bug in which the scroll corner was obscured 
by
obscured content insets.

For the custom scrollbars themselves, we no longer reduce the inset by half of 
the
length of the scrollbar cap because we have no guarantee that the scrollbar has
a round cap. We also factor in the size of the scroll corner rect when 
determining
insets so that the scrollbar insets are not unnecessarily large. For example, if
a scroll corner of height 16px is displaying and the window corner radius is 
26px,
we only need to inset the vertical scrollbar 10px further.

Test: Tools/TestWebKitAPI/Tests/mac/ScrollbarTests.mm

* Source/WebCore/platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):
(WebCore::ScrollView::scrollCornerRect const):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::scrollCornerRect const):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Tools/TestWebKitAPI/Tests/mac/ScrollbarTests.mm:
(TestWebKitAPI::scrollCornerRectForWebView):
(TestWebKitAPI::=):
(TestWebKitAPI::customScrollbarHTMLWithDimensions):
(TestWebKitAPI::customScrollbarHTMLWithBothScrollbars):
(TestWebKitAPI::TEST(ScrollbarTests, CustomScrollbarSizesNoCornerRadii)):
(TestWebKitAPI::TEST(ScrollbarTests, 
CustomScrollbarScrollCornerRectNoCornerRadii)):
(TestWebKitAPI::TEST(ScrollbarTests, 
CustomScrollbarScrollCornerRectWithObscuredContentInsets)):
(TestWebKitAPI::TEST(ScrollbarTests, 
CustomScrollbarCornerRadiusAvoidanceAccountsForScrollCorner)):
(TestWebKitAPI::TEST(ScrollbarTests, 
CustomScrollbarCornerRadiusAvoidanceWithObscuredContentInsetsAndScrollCorner)):
(TestWebKitAPI::TEST(ScrollbarTests, 
CustomScrollbarScrollCornerSmallCornerRadius)):

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



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

Reply via email to