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.
This commit is contained in:
Timm Bäder 2019-01-23 17:42:03 +01:00 committed by Benjamin Otte
parent fd318a17a4
commit 0ae7c30105
3 changed files with 8 additions and 2 deletions

View File

@ -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 ());

View File

@ -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 | \

View File

@ -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)))
{