[gtk+/gtk-3-22] Revert "css: Replace _AFFECTS_TEXT with _TEXT_SIZE and _TEXT_CLIP"



commit 32332b3a035d7b5781b6b9eb0f13778ecda3942b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Dec 17 11:20:50 2017 -0500

    Revert "css: Replace _AFFECTS_TEXT with _TEXT_SIZE and _TEXT_CLIP"
    
    This reverts commit 492469a94af35c2b102bcf7f07046ef2d09b2b3d.
    
    People have been reporting missing invalidations with this change.

 gtk/gtkbuiltinicon.c          |    2 +-
 gtk/gtkcssstylepropertyimpl.c |   30 +++++++++++++++---------------
 gtk/gtkcsstypesprivate.h      |   34 ++++++++++++++++------------------
 gtk/gtkprogressbar.c          |    2 +-
 gtk/gtkscale.c                |    4 ++--
 gtk/gtkswitch.c               |    2 +-
 gtk/gtktextview.c             |    2 +-
 gtk/gtkwidget.c               |   23 ++++++++---------------
 8 files changed, 45 insertions(+), 54 deletions(-)
---
diff --git a/gtk/gtkbuiltinicon.c b/gtk/gtkbuiltinicon.c
index 1535a2c..feedb2c 100644
--- a/gtk/gtkbuiltinicon.c
+++ b/gtk/gtkbuiltinicon.c
@@ -167,7 +167,7 @@ gtk_builtin_icon_style_changed (GtkCssGadget      *gadget,
 {
   GtkBuiltinIconPrivate *priv = gtk_builtin_icon_get_instance_private (GTK_BUILTIN_ICON (gadget));
 
-  if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
+  if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
     priv->strikethrough_valid = FALSE;
 
   GTK_CSS_GADGET_CLASS (gtk_builtin_icon_parent_class)->style_changed (gadget, change);
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 92e32f6..9fd506a 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -1058,7 +1058,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_COLOR,
                                           GDK_TYPE_RGBA,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_CONTENT | GTK_CSS_AFFECTS_SYMBOLIC_ICON,
+                                          GTK_CSS_AFFECTS_FOREGROUND | GTK_CSS_AFFECTS_TEXT | 
GTK_CSS_AFFECTS_SYMBOLIC_ICON,
                                           color_parse,
                                           color_query,
                                           color_assign,
@@ -1067,7 +1067,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_DPI,
                                           G_TYPE_NONE,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_TEXT_SIZE,
+                                          GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_SIZE,
                                           dpi_parse,
                                           NULL,
                                           NULL,
@@ -1076,7 +1076,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_FONT_SIZE,
                                           G_TYPE_DOUBLE,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_SIZE | GTK_CSS_AFFECTS_TEXT_SIZE,
+                                          GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_SIZE,
                                           font_size_parse,
                                           query_font_size,
                                           assign_font_size,
@@ -1117,7 +1117,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_FONT_FAMILY,
                                           G_TYPE_STRV,
                                           GTK_STYLE_PROPERTY_INHERIT,
-                                          GTK_CSS_AFFECTS_TEXT_SIZE,
+                                          GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           font_family_parse,
                                           font_family_query,
                                           font_family_assign,
@@ -1126,7 +1126,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_FONT_STYLE,
                                           PANGO_TYPE_STYLE,
                                           GTK_STYLE_PROPERTY_INHERIT,
-                                          GTK_CSS_AFFECTS_TEXT_SIZE,
+                                          GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           font_style_parse,
                                           font_style_query,
                                           font_style_assign,
@@ -1135,7 +1135,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_FONT_VARIANT,
                                           PANGO_TYPE_VARIANT,
                                           GTK_STYLE_PROPERTY_INHERIT,
-                                          GTK_CSS_AFFECTS_TEXT,
+                                          GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           font_variant_parse,
                                           font_variant_query,
                                           font_variant_assign,
@@ -1144,7 +1144,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_FONT_WEIGHT,
                                           PANGO_TYPE_WEIGHT,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_TEXT_SIZE,
+                                          GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           font_weight_parse,
                                           font_weight_query,
                                           font_weight_assign,
@@ -1153,7 +1153,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_FONT_STRETCH,
                                           PANGO_TYPE_STRETCH,
                                           GTK_STYLE_PROPERTY_INHERIT,
-                                          GTK_CSS_AFFECTS_TEXT_SIZE,
+                                          GTK_CSS_AFFECTS_FONT | GTK_CSS_AFFECTS_TEXT,
                                           font_stretch_parse,
                                           font_stretch_query,
                                           font_stretch_assign,
@@ -1163,7 +1163,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_LETTER_SPACING,
                                           G_TYPE_NONE,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_TEXT_ATTRS,
+                                          GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS,
                                           parse_letter_spacing,
                                           NULL,
                                           NULL,
@@ -1173,7 +1173,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_TEXT_DECORATION_LINE,
                                           G_TYPE_NONE,
                                           0,
-                                          GTK_CSS_AFFECTS_TEXT_ATTRS,
+                                          GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS,
                                           parse_text_decoration_line,
                                           NULL,
                                           NULL,
@@ -1182,7 +1182,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR,
                                           G_TYPE_NONE,
                                           GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_TEXT_ATTRS,
+                                          GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS,
                                           color_parse,
                                           NULL,
                                           NULL,
@@ -1191,7 +1191,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_TEXT_DECORATION_STYLE,
                                           G_TYPE_NONE,
                                           0,
-                                          GTK_CSS_AFFECTS_TEXT_ATTRS,
+                                          GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS,
                                           parse_text_decoration_style,
                                           NULL,
                                           NULL,
@@ -1201,7 +1201,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_TEXT_SHADOW,
                                           G_TYPE_NONE,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_TEXT_CLIP,
+                                          GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_CLIP,
                                           shadow_value_parse,
                                           NULL,
                                           NULL,
@@ -1855,7 +1855,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
                                           GTK_CSS_PROPERTY_CARET_COLOR,
                                           GDK_TYPE_RGBA,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_CONTENT,
+                                          GTK_CSS_AFFECTS_TEXT,
                                           color_parse,
                                           color_query,
                                           color_assign,
@@ -1864,7 +1864,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
                                           GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR,
                                           GDK_TYPE_RGBA,
                                           GTK_STYLE_PROPERTY_INHERIT | GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_CONTENT,
+                                          GTK_CSS_AFFECTS_TEXT,
                                           color_parse,
                                           color_query,
                                           color_assign,
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index 523551d..59f392a 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -96,10 +96,13 @@ typedef guint64 GtkCssChange;
 /*
  * GtkCssAffects:
  * @GTK_CSS_AFFECTS_FOREGROUND: The foreground rendering is affected.
- *   This does not include things that affect the font.
+ *   This does not include things that affect the font. For those,
+ *   see @GTK_CSS_AFFECTS_FONT.
  * @GTK_CSS_AFFECTS_BACKGROUND: The background rendering is affected.
  * @GTK_CSS_AFFECTS_BORDER: The border styling is affected.
  * @GTK_CSS_AFFECTS_PANGO_LAYOUT: Font rendering is affected.
+ * @GTK_CSS_AFFECTS_FONT: The font is affected and should be reloaded
+ *   if it was cached.
  * @GTK_CSS_AFFECTS_TEXT: Text rendering is affected.
  * @GTK_CSS_AFFECTS_TEXT_ATTRS: Text attributes are affected.
  * @GTK_CSS_AFFECTS_ICON: Fullcolor icons and their rendering is affected.
@@ -119,31 +122,26 @@ typedef guint64 GtkCssChange;
  * Note that multiple values can be set.
  */
 typedef enum {
-  GTK_CSS_AFFECTS_CONTENT       = (1 << 0),
-  GTK_CSS_AFFECTS_BACKGROUND    = (1 << 1),
-  GTK_CSS_AFFECTS_BORDER        = (1 << 2),
-  GTK_CSS_AFFECTS_TEXT_ATTRS    = (1 << 4),
-  GTK_CSS_AFFECTS_TEXT_SIZE     = (1 << 5),
-  GTK_CSS_AFFECTS_TEXT_CLIP     = (1 << 6),
-  GTK_CSS_AFFECTS_ICON          = (1 << 7),
-  GTK_CSS_AFFECTS_SYMBOLIC_ICON = (1 << 8),
-  GTK_CSS_AFFECTS_OUTLINE       = (1 << 9),
-  GTK_CSS_AFFECTS_CLIP          = (1 << 10),
-  GTK_CSS_AFFECTS_SIZE          = (1 << 11),
-  GTK_CSS_AFFECTS_POSTEFFECT    = (1 << 12)
+  GTK_CSS_AFFECTS_FOREGROUND = (1 << 0),
+  GTK_CSS_AFFECTS_BACKGROUND = (1 << 1),
+  GTK_CSS_AFFECTS_BORDER = (1 << 2),
+  GTK_CSS_AFFECTS_FONT = (1 << 3),
+  GTK_CSS_AFFECTS_TEXT = (1 << 4),
+  GTK_CSS_AFFECTS_TEXT_ATTRS = (1 << 5),
+  GTK_CSS_AFFECTS_ICON = (1 << 6),
+  GTK_CSS_AFFECTS_SYMBOLIC_ICON = (1 << 7),
+  GTK_CSS_AFFECTS_OUTLINE = (1 << 8),
+  GTK_CSS_AFFECTS_CLIP = (1 << 9),
+  GTK_CSS_AFFECTS_SIZE = (1 << 10)
 } GtkCssAffects;
 
-#define GTK_CSS_AFFECTS_REDRAW (GTK_CSS_AFFECTS_CONTENT |       \
+#define GTK_CSS_AFFECTS_REDRAW (GTK_CSS_AFFECTS_FOREGROUND |    \
                                 GTK_CSS_AFFECTS_BACKGROUND |    \
                                 GTK_CSS_AFFECTS_BORDER |        \
                                 GTK_CSS_AFFECTS_ICON |          \
                                 GTK_CSS_AFFECTS_SYMBOLIC_ICON | \
                                 GTK_CSS_AFFECTS_OUTLINE)
 
-#define GTK_CSS_AFFECTS_TEXT (GTK_CSS_AFFECTS_TEXT_SIZE | \
-                              GTK_CSS_AFFECTS_TEXT_CLIP)
-
-
 enum { /*< skip >*/
   GTK_CSS_PROPERTY_COLOR,
   GTK_CSS_PROPERTY_DPI,
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index 5098558..1dfef03 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -1521,7 +1521,7 @@ gtk_progress_bar_text_style_changed (GtkCssNode        *node,
 {
   if (change == NULL ||
       gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS) ||
-      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
+      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
     {
       gtk_widget_queue_resize (GTK_WIDGET (pbar));
     }
diff --git a/gtk/gtkscale.c b/gtk/gtkscale.c
index b3f0d36..18bb7f8 100644
--- a/gtk/gtkscale.c
+++ b/gtk/gtkscale.c
@@ -1594,7 +1594,7 @@ gtk_scale_value_style_changed (GtkCssNode        *node,
 {
   if (change == NULL ||
       gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS) ||
-      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
+      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
     {
       gtk_scale_clear_value_layout (scale);
       gtk_widget_queue_resize (GTK_WIDGET (scale));
@@ -1608,7 +1608,7 @@ gtk_scale_mark_style_changed (GtkCssNode        *node,
 {
   if (change == NULL ||
       gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_ATTRS) ||
-      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
+      gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
     {
       GtkCssNode *widget_node;
       GtkWidget *scale;
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index 6572a34..15f11a4 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -332,7 +332,7 @@ gtk_switch_style_updated (GtkWidget *widget)
   context = gtk_widget_get_style_context (widget);
   change = gtk_style_context_get_change (context);
 
-  if (change == NULL || gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
+  if (change == NULL || gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT))
     gtk_switch_create_pango_layouts (self);
 }
 
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 3c9d9f6..1b001bb 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4895,7 +4895,7 @@ gtk_text_view_style_updated (GtkWidget *widget)
   style_context = gtk_widget_get_style_context (widget);
   change = gtk_style_context_get_change (style_context);
 
-  if ((change == NULL || gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT)) &&
+  if ((change == NULL || gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT)) &&
       priv->layout && priv->layout->default_style)
     {
       gtk_text_view_set_attributes_from_style (text_view,
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ee4ae27..efab399 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -8168,29 +8168,22 @@ gtk_widget_real_style_updated (GtkWidget *widget)
   if (widget->priv->context)
     {
       GtkCssStyleChange *change = gtk_style_context_get_change (widget->priv->context);
-      const gboolean has_text = gtk_widget_peek_pango_context (widget) != NULL;
+      gboolean has_text = gtk_widget_peek_pango_context (widget) != NULL;
 
-      if (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT))
+      if (change == NULL ||
+          (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_FONT)))
         gtk_widget_update_pango_context (widget);
 
       if (widget->priv->anchored)
         {
           if (change == NULL ||
               gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_SIZE) ||
-              (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_SIZE)))
-            {
-              gtk_widget_queue_resize (widget);
-            }
-          else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_CLIP) ||
-                   (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_CLIP)))
-            {
-              gtk_widget_queue_allocate (widget);
-            }
+              (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT)))
+            gtk_widget_queue_resize (widget);
+          else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_CLIP))
+            gtk_widget_queue_allocate (widget);
           else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_REDRAW))
-
-            {
-                gtk_widget_queue_draw (widget);
-            }
+            gtk_widget_queue_draw (widget);
         }
     }
   else


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