Title: [289620] trunk/Source/WebCore
- Revision
- 289620
- Author
- [email protected]
- Date
- 2022-02-11 06:53:57 -0800 (Fri, 11 Feb 2022)
Log Message
[GTK] WebKit browser scrollbars not always correctly displayed if overlay scrollbars are disabled
https://bugs.webkit.org/show_bug.cgi?id=234874
Patch by Michael Catanzaro <[email protected]> on 2022-02-11
Reviewed by Carlos Garcia Campos.
If overlay scrollbars are disabled, and there is not enough content for the page to be
scrollable, and scrollbars are forced using overflow:scroll, then we currently fail to
paint the scrollbars properly. At minimum, we need to paint the scrollbar background, which
is what the macOS port does. Do so.
In the future, we might want to additionally paint the rest of the scrollbars, similar to
the GTK_POLICY_ALWAYS scrollbar policy type, but this would require more work.
* platform/adwaita/ScrollbarThemeAdwaita.cpp:
(WebCore::ScrollbarThemeAdwaita::paint):
* platform/gtk/ScrollbarThemeGtk.cpp:
(WebCore::ScrollbarThemeGtk::paint):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (289619 => 289620)
--- trunk/Source/WebCore/ChangeLog 2022-02-11 13:30:47 UTC (rev 289619)
+++ trunk/Source/WebCore/ChangeLog 2022-02-11 14:53:57 UTC (rev 289620)
@@ -1,3 +1,23 @@
+2022-02-11 Michael Catanzaro <[email protected]>
+
+ [GTK] WebKit browser scrollbars not always correctly displayed if overlay scrollbars are disabled
+ https://bugs.webkit.org/show_bug.cgi?id=234874
+
+ Reviewed by Carlos Garcia Campos.
+
+ If overlay scrollbars are disabled, and there is not enough content for the page to be
+ scrollable, and scrollbars are forced using overflow:scroll, then we currently fail to
+ paint the scrollbars properly. At minimum, we need to paint the scrollbar background, which
+ is what the macOS port does. Do so.
+
+ In the future, we might want to additionally paint the rest of the scrollbars, similar to
+ the GTK_POLICY_ALWAYS scrollbar policy type, but this would require more work.
+
+ * platform/adwaita/ScrollbarThemeAdwaita.cpp:
+ (WebCore::ScrollbarThemeAdwaita::paint):
+ * platform/gtk/ScrollbarThemeGtk.cpp:
+ (WebCore::ScrollbarThemeGtk::paint):
+
2022-02-11 Antti Koivisto <[email protected]>
[CSS Container Queries] Implement container name matching
Modified: trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp (289619 => 289620)
--- trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2022-02-11 13:30:47 UTC (rev 289619)
+++ trunk/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp 2022-02-11 14:53:57 UTC (rev 289620)
@@ -117,7 +117,7 @@
if (graphicsContext.paintingDisabled())
return false;
- if (!scrollbar.enabled())
+ if (!scrollbar.enabled() && usesOverlayScrollbars())
return true;
IntRect rect = scrollbar.frameRect();
Modified: trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (289619 => 289620)
--- trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp 2022-02-11 13:30:47 UTC (rev 289619)
+++ trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp 2022-02-11 14:53:57 UTC (rev 289620)
@@ -331,7 +331,7 @@
if (graphicsContext.paintingDisabled())
return false;
- if (!scrollbar.enabled())
+ if (!scrollbar.enabled() && usesOverlayScrollbars())
return true;
double opacity = scrollbar.hoveredPart() == NoPart ? scrollbar.opacity() : 1;
@@ -376,19 +376,21 @@
preferredSize += scrollbarGadget.preferredSize() - scrollbarGadget.minimumSize();
FloatRect contentsRect(rect);
- // When using overlay scrollbars we always claim the size of the scrollbar when hovered, so when
- // drawing the indicator we need to adjust the rectangle to its actual size in indicator mode.
- if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
- if (rect.width() != preferredSize.width()) {
- if (!scrollbar.scrollableArea().shouldPlaceVerticalScrollbarOnLeft())
- contentsRect.move(std::abs(rect.width() - preferredSize.width()), 0);
- contentsRect.setWidth(preferredSize.width());
+ if (usesOverlayScrollbars()) {
+ // When using overlay scrollbars we always claim the size of the scrollbar when hovered, so when
+ // drawing the indicator we need to adjust the rectangle to its actual size in indicator mode.
+ if (scrollbar.orientation() == ScrollbarOrientation::Vertical) {
+ if (rect.width() != preferredSize.width()) {
+ if (!scrollbar.scrollableArea().shouldPlaceVerticalScrollbarOnLeft())
+ contentsRect.move(std::abs(rect.width() - preferredSize.width()), 0);
+ contentsRect.setWidth(preferredSize.width());
+ }
+ } else {
+ if (rect.height() != preferredSize.height()) {
+ contentsRect.move(0, std::abs(rect.height() - preferredSize.height()));
+ contentsRect.setHeight(preferredSize.height());
+ }
}
- } else {
- if (rect.height() != preferredSize.height()) {
- contentsRect.move(0, std::abs(rect.height() - preferredSize.height()));
- contentsRect.setHeight(preferredSize.height());
- }
}
if (opacity != 1) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes