[gtk/matthiasc/for-master] text: React to text attribute changes in css



commit 043ffd38bcc508db6813c4029203b8cd4ebbb967
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Oct 21 13:46:58 2020 -0400

    text: React to text attribute changes in css
    
    Recompute the layout when the css style change
    affects text attributes. This matches what we do
    in GtkLabel, and without this, changing the
    font-features-setting css property in the Inspector
    does not have immediate effect.

 gtk/gtktext.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 7f3d064a94..8f2745caf6 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -3488,11 +3488,13 @@ gtk_text_css_changed (GtkWidget         *widget,
 
   gtk_text_update_cached_style_values (self);
 
-  if (change == NULL ||
-      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
+  if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT |
                                             GTK_CSS_AFFECTS_BACKGROUND |
                                             GTK_CSS_AFFECTS_CONTENT))
-    gtk_widget_queue_draw (GTK_WIDGET (self));
+    gtk_widget_queue_draw (widget);
+
+  if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS))
+    gtk_text_recompute (self);
 }
 
 static void


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