[gtk] Add & use GTK_CSS_AFFECTS_TRANSFORM



commit 0ae7c3010538dc085c536d01b83cc32361735cc1
Author: Timm Bäder <mail baedert org>
Date:   Wed Jan 23 17:42:03 2019 +0100

    Add & use GTK_CSS_AFFECTS_TRANSFORM
    
    This avoids invalidating the size of all widgets when updating CSS
    transforms.
    
    In theory, we don't even have to allocate the widget itself, because we
    didn't change its size. But we have no way to track that.

 gtk/gtkcssstylepropertyimpl.c | 2 +-
 gtk/gtkcsstypesprivate.h      | 4 +++-
 gtk/gtkwidget.c               | 4 ++++
 3 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 62ddce3cd0..62c48c39a0 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -1623,7 +1623,7 @@ _gtk_css_style_property_init_properties (void)
                                           GTK_CSS_PROPERTY_TRANSFORM,
                                           G_TYPE_NONE,
                                           GTK_STYLE_PROPERTY_ANIMATED,
-                                          GTK_CSS_AFFECTS_SIZE,
+                                          GTK_CSS_AFFECTS_TRANSFORM,
                                           transform_value_parse,
                                           NULL,
                                           _gtk_css_transform_value_new_none ());
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index e305fdfb9d..6d5401b7de 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -115,6 +115,7 @@ typedef guint64 GtkCssChange;
  * @GTK_CSS_AFFECTS_POSTEFFECT: An effect is applied after drawing that changes
  * @GTK_CSS_AFFECTS_TEXT: Affects anything related to text rendering.
  * @GTK_CSS_AFFECTS_REDRAW: Affects anything that requires redraw.
+ * @GTK_CSS_AFFECTS_TRANSFORM: Affects the element transformation.
  *
  * The generic effects that a CSS property can have. If a value is
  * set, then the property will have an influence on that feature.
@@ -133,7 +134,8 @@ typedef enum {
   GTK_CSS_AFFECTS_SYMBOLIC_ICON = (1 << 8),
   GTK_CSS_AFFECTS_OUTLINE       = (1 << 9),
   GTK_CSS_AFFECTS_SIZE          = (1 << 10),
-  GTK_CSS_AFFECTS_POSTEFFECT    = (1 << 11)
+  GTK_CSS_AFFECTS_POSTEFFECT    = (1 << 11),
+  GTK_CSS_AFFECTS_TRANSFORM     = (1 << 12),
 } GtkCssAffects;
 
 #define GTK_CSS_AFFECTS_REDRAW (GTK_CSS_AFFECTS_CONTENT |       \
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 33bfcb52cf..edade0538e 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -5522,6 +5522,10 @@ gtk_widget_real_style_updated (GtkWidget *widget)
             {
               gtk_widget_queue_resize (widget);
             }
+          else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TRANSFORM))
+            {
+                gtk_widget_queue_allocate (widget);
+            }
           else if (gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_REDRAW) ||
                    (has_text && gtk_css_style_change_affects (change, GTK_CSS_AFFECTS_TEXT_CONTENT)))
             {


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