Skip to content

[GTK][WPE] Limit the damage region of the scrollbar to the region actually painted#66417

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
fujii:eng/scrollbar-damage-region
Jun 4, 2026
Merged

[GTK][WPE] Limit the damage region of the scrollbar to the region actually painted#66417
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
fujii:eng/scrollbar-damage-region

Conversation

@fujii
Copy link
Copy Markdown
Contributor

@fujii fujii commented Jun 4, 2026

0512cc5

[GTK][WPE] Limit the damage region of the scrollbar to the region actually painted
https://bugs.webkit.org/show_bug.cgi?id=316268

Reviewed by Carlos Garcia Campos.

The whole scrollbar layer was always damaged while the overlay scrollbar is
hiding even though the most part of the overlay scrollbar is transparent. Only
the visible part, scrollbar thumb area, should be damaged during the hiding
animaiton.

* Source/WebCore/page/scrolling/coordinated/ScrollerCoordinated.cpp:
(WebCore::ScrollerCoordinated::updateValues):
* Source/WebCore/platform/adwaita/AdwaitaScrollbarPainter.cpp:
(WebCore::AdwaitaScrollbarPainter::paint):
* Source/WebCore/platform/adwaita/AdwaitaScrollbarPainter.h:
* Source/WebCore/platform/adwaita/ScrollerImpAdwaita.h:
(WebCore::ScrollerImpAdwaita::paint):
* Source/WebCore/platform/graphics/Damage.h:

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

ad0aae2

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk1 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 api-gtk
✅ 🛠 vision-sim ✅ 🧪 mac-wk2-stress ✅ 🛠 playstation
✅ 🛠 🧪 unsafe-merge ✅ 🧪 vision-wk2 🧪 mac-intel-wk2
✅ 🛠 tv ✅ 🛠 mac-safer-cpp
✅ 🛠 tv-sim ✅ 🧪 mac-site-isolation
✅ 🛠 watch
✅ 🛠 watch-sim

@fujii fujii requested review from a team and magomez as code owners June 4, 2026 02:13
@fujii fujii self-assigned this Jun 4, 2026
@fujii fujii added the WebKitGTK Bugs related to the Gtk API layer. label Jun 4, 2026
@fujii fujii marked this pull request as draft June 4, 2026 05:52
@fujii fujii force-pushed the eng/scrollbar-damage-region branch from fefc36d to d8a143b Compare June 4, 2026 06:02
Comment thread Source/WebCore/page/scrolling/coordinated/ScrollerCoordinated.cpp Outdated
@fujii fujii force-pushed the eng/scrollbar-damage-region branch from d8a143b to 9816afc Compare June 4, 2026 08:21
@fujii fujii marked this pull request as ready for review June 4, 2026 08:32
@fujii fujii requested a review from carlosgcampos June 4, 2026 08:32
GraphicsContextSkia context(*canvas, RenderingMode::Accelerated, RenderingPurpose::DOM);
context.scale(contentsScale);
scrollerImp->paint(context, state.frameRect, state);
scrollerImp->paint(context, state.frameRect, state, damage);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? paint expects a pointer

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This calls ScrollerImpAdwaita::paint rather than AdwaitaScrollbarPainter::paint.

};

void paint(GraphicsContext&, const IntRect&, const State&);
void paint(GraphicsContext&, const IntRect&, const State&, Damage* damageOut = nullptr);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to use std::optional instead of a pointer?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::optional<Damage>& ? this is a raw reference. There is no big difference between raw reference and raw pointer. But, a raw pointer can be nullptr.

void paint(GraphicsContext& graphicsContext, const IntRect& damageRect, const AdwaitaScrollbarPainter::State& state, Damage& damageOut)
{
AdwaitaScrollbarPainter::paint(graphicsContext, damageRect, state);
AdwaitaScrollbarPainter::paint(graphicsContext, damageRect, state, &damageOut);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed this, here is where we pass the pointer.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 4, 2026
@fujii fujii removed the merging-blocked Applied to prevent a change from being merged label Jun 4, 2026
@fujii fujii force-pushed the eng/scrollbar-damage-region branch from 9816afc to ad0aae2 Compare June 4, 2026 10:05
@fujii fujii added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Jun 4, 2026
…ually painted

https://bugs.webkit.org/show_bug.cgi?id=316268

Reviewed by Carlos Garcia Campos.

The whole scrollbar layer was always damaged while the overlay scrollbar is
hiding even though the most part of the overlay scrollbar is transparent. Only
the visible part, scrollbar thumb area, should be damaged during the hiding
animaiton.

* Source/WebCore/page/scrolling/coordinated/ScrollerCoordinated.cpp:
(WebCore::ScrollerCoordinated::updateValues):
* Source/WebCore/platform/adwaita/AdwaitaScrollbarPainter.cpp:
(WebCore::AdwaitaScrollbarPainter::paint):
* Source/WebCore/platform/adwaita/AdwaitaScrollbarPainter.h:
* Source/WebCore/platform/adwaita/ScrollerImpAdwaita.h:
(WebCore::ScrollerImpAdwaita::paint):
* Source/WebCore/platform/graphics/Damage.h:

Canonical link: https://commits.webkit.org/314540@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/scrollbar-damage-region branch from ad0aae2 to 0512cc5 Compare June 4, 2026 10:57
@webkit-commit-queue
Copy link
Copy Markdown
Collaborator

Committed 314540@main (0512cc5): https://commits.webkit.org/314540@main

Reviewed commits have been landed. Closing PR #66417 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 0512cc5 into WebKit:main Jun 4, 2026
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Jun 4, 2026
@fujii fujii deleted the eng/scrollbar-damage-region branch June 4, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

WebKitGTK Bugs related to the Gtk API layer.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants