mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-28 14:31:10 +00:00
cssmatcher: Use quarks for classes
This commit is contained in:
parent
115c34498e
commit
44187ca3b5
@ -78,15 +78,15 @@ gtk_css_matcher_widget_path_has_name (const GtkCssMatcher *matcher,
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_widget_path_has_class (const GtkCssMatcher *matcher,
|
||||
const char *class_name)
|
||||
GQuark class_name)
|
||||
{
|
||||
const GtkWidgetPath *siblings;
|
||||
|
||||
siblings = gtk_widget_path_iter_get_siblings (matcher->path.path, matcher->path.index);
|
||||
if (siblings && matcher->path.sibling_index != gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index))
|
||||
return gtk_widget_path_iter_has_class (siblings, matcher->path.sibling_index, class_name);
|
||||
return gtk_widget_path_iter_has_qclass (siblings, matcher->path.sibling_index, class_name);
|
||||
else
|
||||
return gtk_widget_path_iter_has_class (matcher->path.path, matcher->path.index, class_name);
|
||||
return gtk_widget_path_iter_has_qclass (matcher->path.path, matcher->path.index, class_name);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -238,7 +238,7 @@ gtk_css_matcher_any_has_name (const GtkCssMatcher *matcher,
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_any_has_class (const GtkCssMatcher *matcher,
|
||||
const char *class_name)
|
||||
GQuark class_name)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@ -336,7 +336,7 @@ gtk_css_matcher_superset_has_name (const GtkCssMatcher *matcher,
|
||||
|
||||
static gboolean
|
||||
gtk_css_matcher_superset_has_class (const GtkCssMatcher *matcher,
|
||||
const char *class_name)
|
||||
GQuark class_name)
|
||||
{
|
||||
if (matcher->superset.relevant & GTK_CSS_CHANGE_CLASS)
|
||||
return _gtk_css_matcher_has_class (matcher->superset.subset, class_name);
|
||||
|
@ -39,7 +39,7 @@ struct _GtkCssMatcherClass {
|
||||
gboolean (* has_name) (const GtkCssMatcher *matcher,
|
||||
const char *name);
|
||||
gboolean (* has_class) (const GtkCssMatcher *matcher,
|
||||
const char *class_name);
|
||||
GQuark class_name);
|
||||
gboolean (* has_id) (const GtkCssMatcher *matcher,
|
||||
const char *id);
|
||||
gboolean (* has_regions) (const GtkCssMatcher *matcher);
|
||||
@ -110,7 +110,7 @@ _gtk_css_matcher_has_name (const GtkCssMatcher *matcher,
|
||||
|
||||
static inline gboolean
|
||||
_gtk_css_matcher_has_class (const GtkCssMatcher *matcher,
|
||||
const char *class_name)
|
||||
GQuark class_name)
|
||||
{
|
||||
return matcher->klass->has_class (matcher, class_name);
|
||||
}
|
||||
|
@ -351,14 +351,14 @@ gtk_css_selector_class_print (const GtkCssSelector *selector,
|
||||
GString *string)
|
||||
{
|
||||
g_string_append_c (string, '.');
|
||||
g_string_append (string, selector->data);
|
||||
g_string_append (string, g_quark_to_string (GPOINTER_TO_UINT (selector->data)));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_css_selector_class_match (const GtkCssSelector *selector,
|
||||
const GtkCssMatcher *matcher)
|
||||
{
|
||||
if (!_gtk_css_matcher_has_class (matcher, selector->data))
|
||||
if (!_gtk_css_matcher_has_class (matcher, GPOINTER_TO_UINT (selector->data)))
|
||||
return FALSE;
|
||||
|
||||
return gtk_css_selector_match (gtk_css_selector_previous (selector), matcher);
|
||||
@ -764,7 +764,7 @@ parse_selector_class (GtkCssParser *parser, GtkCssSelector *selector)
|
||||
|
||||
selector = gtk_css_selector_new (>K_CSS_SELECTOR_CLASS,
|
||||
selector,
|
||||
g_intern_string (name));
|
||||
GUINT_TO_POINTER (g_quark_from_string (name)));
|
||||
|
||||
g_free (name);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user