cssnode: Optimize listing of classes

Avoid creating the GList of strings when the GQuarks
will just be determined again. Instead have
gtk_style_context_list_classes() do it specifically.
This commit is contained in:
Garrett Regier
2015-09-11 17:49:59 +02:00
committed by Benjamin Otte
parent 44460cd720
commit 41b386cd6a
8 changed files with 72 additions and 58 deletions

View File

@ -805,20 +805,23 @@ gtk_widget_path_iter_add_class (GtkWidgetPath *path,
gint pos,
const gchar *name)
{
GtkPathElement *elem;
gboolean added = FALSE;
GQuark qname;
guint i;
gtk_internal_return_if_fail (path != NULL);
gtk_internal_return_if_fail (path->elems->len != 0);
gtk_internal_return_if_fail (name != NULL);
if (pos < 0 || pos >= path->elems->len)
pos = path->elems->len - 1;
gtk_widget_path_iter_add_qclass (path, pos, g_quark_from_string (name));
}
void
gtk_widget_path_iter_add_qclass (GtkWidgetPath *path,
gint pos,
GQuark qname)
{
GtkPathElement *elem;
gboolean added = FALSE;
guint i;
elem = &g_array_index (path->elems, GtkPathElement, pos);
qname = g_quark_from_string (name);
if (!elem->classes)
elem->classes = g_array_new (FALSE, FALSE, sizeof (GQuark));