Default: avoid use of opacity for overlay scrollbars
authorChristian Hergert <chergert@redhat.com>
Tue, 22 Mar 2022 01:54:09 +0000 (18:54 -0700)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 21 Apr 2022 23:14:14 +0000 (19:14 -0400)
If using the opacity CSS property the renderer cannot optimize these
handles without the use of offscreens due to the use of both a border
and rgb render node.

Instead, we can apply the alpha to the color values and get the same
effect in a way that the GL renderer can optimize without the use of
offscreen textures for a sizeable reduction in runtime overhead.

gtk/theme/Default/_common.scss

index 27e75a2d52e4c8ecbe7dac9ac79e6e7d7c500976..a779dc2e7a042a3b994d6315d203908ef1907527 100644 (file)
@@ -2352,15 +2352,14 @@ scrollbar {
   &.overlay-indicator {
     &:not(.dragging):not(.hovering) {
       border-color: transparent;
-      opacity: 0.4;
       background-color: transparent;
 
       > range > trough > slider {
         margin: 0;
         min-width: 3px;
         min-height: 3px;
-        background-color: $fg_color;
-        border: 1px solid if($variant == 'light', white, black);
+        background-color: gtkalpha($fg_color, 0.4);
+        border: 1px solid gtkalpha(if($variant == 'light', white, black), 0.4);
       }
 
       &.horizontal {
@@ -2379,7 +2378,10 @@ scrollbar {
     }
 
     &.dragging,
-    &.hovering { opacity: 0.8; }
+    &.hovering {
+      background-color: gtkalpha($scrollbar_bg_color, 0.8);
+      border: 1px solid gtkalpha(if($variant == 'light', white, black), 0.8);
+    }
   }
 
   &.horizontal > range > trough > slider { min-width: $_slider_min_length; }