Skip to content

Commit 23b6b78

Browse files
nmouchtmnutt
authored andcommitted
[UI-side compositing] NSScrollerImps are still created in the web process (triggering CATransactions)
https://bugs.webkit.org/show_bug.cgi?id=258369 rdar://109689491 Reviewed by Simon Fraser. With UI-side compositing, NSScrollerImps are now kept in the UI-process for all scrollbars except for RenderListBox scrollbars. To prevent the unnecessary creation of NSScrollerImps in the web process in ScrollbarThemeMac::registerScrollbar, check if the scrollbar is one of a RenderListBox and if we have a RemoteScrollbarsController. * Source/WebCore/platform/ScrollableArea.cpp: (WebCore::ScrollableArea::shouldRegisterScrollbars const): * Source/WebCore/platform/ScrollableArea.h: * Source/WebCore/platform/Scrollbar.cpp: (WebCore::Scrollbar::shouldRegisterScrollbar const): * Source/WebCore/platform/Scrollbar.h: * Source/WebCore/platform/ScrollbarsController.h: (WebCore::ScrollbarsController::shouldRegisterScrollbars const): * Source/WebCore/platform/mac/ScrollbarThemeMac.mm: (WebCore::ScrollbarThemeMac::registerScrollbar): * Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollbarsController.h: Canonical link: https://commits.webkit.org/265731@main
1 parent 5dafb3e commit 23b6b78

File tree

5 files changed

+10
-1
lines changed

5 files changed

+10
-1
lines changed

Source/WebCore/platform/Scrollbar.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,9 @@ float Scrollbar::deviceScaleFactor() const
528528
return m_scrollableArea.deviceScaleFactor();
529529
}
530530

531+
bool Scrollbar::shouldRegisterScrollbar() const
532+
{
533+
return m_scrollableArea.scrollbarsController().shouldRegisterScrollbars();
534+
}
535+
531536
} // namespace WebCore

Source/WebCore/platform/Scrollbar.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,8 @@ class Scrollbar : public Widget {
141141

142142
float deviceScaleFactor() const;
143143

144+
bool shouldRegisterScrollbar() const;
145+
144146
protected:
145147
Scrollbar(ScrollableArea&, ScrollbarOrientation, ScrollbarWidth, ScrollbarTheme* = nullptr, bool isCustomScrollbar = false);
146148

Source/WebCore/platform/ScrollbarsController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ class ScrollbarsController {
9494
WEBCORE_EXPORT virtual void setScrollbarVisibilityState(ScrollbarOrientation, bool) { }
9595

9696
WEBCORE_EXPORT virtual bool shouldDrawIntoScrollbarLayer(Scrollbar&) const { return true; }
97+
WEBCORE_EXPORT virtual bool shouldRegisterScrollbars() const { return true; }
9798

9899
private:
99100
ScrollableArea& m_scrollableArea;

Source/WebCore/platform/mac/ScrollbarThemeMac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ + (void)registerAsObserver
156156

157157
void ScrollbarThemeMac::registerScrollbar(Scrollbar& scrollbar)
158158
{
159-
if (scrollbar.isCustomScrollbar())
159+
if (scrollbar.isCustomScrollbar() || !scrollbar.shouldRegisterScrollbar())
160160
return;
161161

162162
bool isHorizontal = scrollbar.orientation() == ScrollbarOrientation::Horizontal;

Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteScrollbarsController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ class RemoteScrollbarsController final : public WebCore::ScrollbarsController {
5151

5252
void setScrollbarVisibilityState(WebCore::ScrollbarOrientation, bool) final;
5353
bool shouldDrawIntoScrollbarLayer(WebCore::Scrollbar&) const final;
54+
bool shouldRegisterScrollbars() const final { return scrollableArea().isListBox(); }
5455

5556
private:
5657
bool m_horizontalOverlayScrollbarIsVisible { false };

0 commit comments

Comments
 (0)