[gtk/matthiasc/for-master: 9/9] Adwaita: Tweaks to avoid costly selectors



commit 3bf54a11de57f8faf90bf898a83aaae41feedeb0
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Jan 23 23:13:32 2020 -0500

    Adwaita: Tweaks to avoid costly selectors
    
    Avoid things like "label button", which cause us to
    walk the entire ancestor tree for each label.

 gtk/theme/Adwaita/_common.scss | 29 +++++++++++------------------
 1 file changed, 11 insertions(+), 18 deletions(-)
---
diff --git a/gtk/theme/Adwaita/_common.scss b/gtk/theme/Adwaita/_common.scss
index 806d436423..c732c1411f 100644
--- a/gtk/theme/Adwaita/_common.scss
+++ b/gtk/theme/Adwaita/_common.scss
@@ -179,12 +179,8 @@ label {
   &:disabled {
     color: $insensitive_fg_color;
 
-    button & { color: inherit; }
-
     &:backdrop {
       color: $backdrop_insensitive_color;
-
-      button & { color: inherit; }
     }
 
     > selection { @extend %selected_items_disabled; }
@@ -596,7 +592,8 @@ button {
       padding-left: 8px;
       padding-right: 8px;
 
-      label {
+     > label,
+     > * > label {
         padding-left: 8px;
         padding-right: 8px;
       }
@@ -827,7 +824,7 @@ button {
   }
 
   // hide separators
-  &.font{
+  &.font {
     separator { background-color: transparent; }
     > box { border-spacing: 6px; }
     > box > box > label { font-weight: bold; }
@@ -846,7 +843,7 @@ button {
     border-radius: 9999px;
     -gtk-outline-radius: 9999px;
 
-    label { padding: 0; }
+    > label { padding: 0; }
   }
 }
 
@@ -1511,7 +1508,7 @@ headerbar {
       background-image: none;
       box-shadow: inset 0 1px mix($top_hilight, $selected_bg_color, 60%);
 
-      label {
+      label:backdrop {
         text-shadow: none;
         color: $selected_fg_color;
       }
@@ -1780,14 +1777,14 @@ pathbar > button {
     padding-right: 4px;
   }
 
-  &.text-button.image-button label {
+  &.text-button.image-button > label {
     padding-left: 0;
     padding-right: 0;
   }
 
   &.text-button.image-button, & {
-    label:last-child { padding-right: 8px; }
-    label:first-child { padding-left: 8px; }
+    > label:last-child { padding-right: 8px; }
+    > label:first-child { padding-left: 8px; }
   }
 
   image {
@@ -4030,7 +4027,6 @@ infobar {
   &.warning,
   &.error {
     &:backdrop, & {
-      label, & { color: $fg_color; }
       background-color: if($variant == 'light', desaturate(lighten(invert($selected_bg_color), 45%), 30%), 
                         desaturate(darken(invert($selected_bg_color),40%), 70%));
       border-color: lighten($borders_color, 10%);
@@ -4067,9 +4063,6 @@ infobar {
           border-color: _border_color($bg_color);
         }
       }
-      &:backdrop, & {
-        label, & { color: $fg_color; }
-      }
     }
 
     selection { background-color: darken($bg_color, 10%); }
@@ -4563,14 +4556,14 @@ button.emoji-section {
   &:hover { border-color: if($variant == 'light', $borders_color, transparentize($fg_color, .9)); }
   &:checked { border-color: $selected_bg_color; }
 
-  label {
+  > label {
     padding: 0;
 
     opacity: 0.55;
   }
 
-  &:hover label { opacity: 0.775; }
-  &:checked label { opacity: 1; }
+  &:hover > label { opacity: 0.775; }
+  &:checked > label { opacity: 1; }
 }
 
 popover.emoji-picker emoji {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]