mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-19 01:40:10 +00:00
css: Implement inherit properties
Huge performance hit (slows down things roughly by a factor of 3), but necessary for CSS conformance and for implementing "inherit" and percentages.
This commit is contained in:
parent
25c396409c
commit
b37f9fdf81
@ -1108,14 +1108,17 @@ gtk_css_provider_get_style (GtkStyleProvider *provider,
|
||||
GtkCssProvider *css_provider;
|
||||
GtkCssProviderPrivate *priv;
|
||||
GtkStyleProperties *props;
|
||||
guint i;
|
||||
guint i, l, length;
|
||||
|
||||
css_provider = GTK_CSS_PROVIDER (provider);
|
||||
priv = css_provider->priv;
|
||||
length = gtk_widget_path_length (path);
|
||||
props = gtk_style_properties_new ();
|
||||
|
||||
css_provider_dump_symbolic_colors (css_provider, props);
|
||||
|
||||
for (l = 1; l <= length; l++)
|
||||
{
|
||||
for (i = 0; i < priv->selectors_info->len; i++)
|
||||
{
|
||||
SelectorStyleInfo *info;
|
||||
@ -1124,7 +1127,10 @@ gtk_css_provider_get_style (GtkStyleProvider *provider,
|
||||
|
||||
info = g_ptr_array_index (priv->selectors_info, i);
|
||||
|
||||
if (!_gtk_css_selector_matches (info->selector, path, gtk_widget_path_length (path)))
|
||||
if (l < length && _gtk_css_selector_get_state_flags (info->selector))
|
||||
continue;
|
||||
|
||||
if (!_gtk_css_selector_matches (info->selector, path, l))
|
||||
continue;
|
||||
|
||||
g_hash_table_iter_init (&iter, info->style);
|
||||
@ -1136,12 +1142,16 @@ gtk_css_provider_get_style (GtkStyleProvider *provider,
|
||||
if (!gtk_style_properties_lookup_property (key, NULL, &pspec))
|
||||
continue;
|
||||
|
||||
if (l != length && !gtk_style_param_get_inherit (pspec))
|
||||
continue;
|
||||
|
||||
_gtk_style_properties_set_property_by_pspec (props,
|
||||
pspec,
|
||||
_gtk_css_selector_get_state_flags (info->selector),
|
||||
value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return props;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user