Title: [289809] releases/WebKitGTK/webkit-2.34/Source/WebCore
Revision
289809
Author
[email protected]
Date
2022-02-15 06:44:59 -0800 (Tue, 15 Feb 2022)

Log Message

Merge r289620 - [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: releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog (289808 => 289809)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-02-15 14:30:27 UTC (rev 289808)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/ChangeLog	2022-02-15 14:44:59 UTC (rev 289809)
@@ -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-15  Carlos Garcia Campos  <[email protected]>
 
         [GTK] D-Bus crash atk-bridge

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp (289808 => 289809)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp	2022-02-15 14:30:27 UTC (rev 289808)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/platform/adwaita/ScrollbarThemeAdwaita.cpp	2022-02-15 14:44:59 UTC (rev 289809)
@@ -117,7 +117,7 @@
     if (graphicsContext.paintingDisabled())
         return false;
 
-    if (!scrollbar.enabled())
+    if (!scrollbar.enabled() && usesOverlayScrollbars())
         return true;
 
     IntRect rect = scrollbar.frameRect();

Modified: releases/WebKitGTK/webkit-2.34/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (289808 => 289809)


--- releases/WebKitGTK/webkit-2.34/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp	2022-02-15 14:30:27 UTC (rev 289808)
+++ releases/WebKitGTK/webkit-2.34/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp	2022-02-15 14:44:59 UTC (rev 289809)
@@ -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() == VerticalScrollbar) {
-        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::VerticalScrollbar) {
+            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

Reply via email to