css: Don't query type for regions

Regions are regions and don't match by type.
This commit is contained in:
Benjamin Otte 2011-05-16 04:31:07 +02:00
parent 1400644069
commit d3c60cc89c

View File

@ -21,6 +21,8 @@
#include "gtkcssselectorprivate.h" #include "gtkcssselectorprivate.h"
#include "gtkstylecontextprivate.h"
struct _GtkCssSelector struct _GtkCssSelector
{ {
GtkCssSelector * previous; /* link to next element in selector or NULL if last */ GtkCssSelector * previous; /* link to next element in selector or NULL if last */
@ -48,7 +50,7 @@ _gtk_css_selector_new (GtkCssSelector *previous,
selector->previous = previous; selector->previous = previous;
selector->combine = combine; selector->combine = combine;
selector->name = name ? g_quark_to_string (g_quark_from_string (name)) : NULL; selector->name = name ? g_quark_to_string (g_quark_from_string (name)) : NULL;
selector->type = G_TYPE_INVALID; selector->type = !name || _gtk_style_context_check_region_name (name) ? G_TYPE_NONE : G_TYPE_INVALID;
selector->ids = ids; selector->ids = ids;
selector->classes = classes; selector->classes = classes;
selector->pseudo_classes = pseudo_classes; selector->pseudo_classes = pseudo_classes;
@ -190,6 +192,9 @@ gtk_css_selector_matches_type (const GtkCssSelector *selector,
if (selector->pseudo_classes) if (selector->pseudo_classes)
return FALSE; return FALSE;
if (selector->type == G_TYPE_NONE)
return FALSE;
/* ugh, assigning to a const variable */ /* ugh, assigning to a const variable */
if (selector->type == G_TYPE_INVALID) if (selector->type == G_TYPE_INVALID)
((GtkCssSelector *) selector)->type = g_type_from_name (selector->name); ((GtkCssSelector *) selector)->type = g_type_from_name (selector->name);