#include "gtkcssmatcherprivate.h"
+#include "gtkcssnodedeclarationprivate.h"
#include "gtkwidgetpath.h"
/* GTK_CSS_MATCHER_WIDGET_PATH */
return FALSE;
matcher->path.klass = child->path.klass;
+ matcher->path.decl = NULL;
matcher->path.path = child->path.path;
matcher->path.index = child->path.index - 1;
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (matcher->path.path, matcher->path.index);
return FALSE;
matcher->path.klass = next->path.klass;
+ matcher->path.decl = NULL;
matcher->path.path = next->path.path;
matcher->path.index = next->path.index;
matcher->path.sibling_index = next->path.sibling_index - 1;
{
const GtkWidgetPath *siblings;
+ if (matcher->path.decl)
+ return gtk_css_node_declaration_get_state (matcher->path.decl);
+
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_get_state (siblings, matcher->path.sibling_index);
{
const GtkWidgetPath *siblings;
+ if (matcher->path.decl &&
+ gtk_css_node_declaration_has_class (matcher->path.decl, class_name))
+ return TRUE;
+
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_qclass (siblings, matcher->path.sibling_index, class_name);
GSList *regions;
gboolean result;
+ if (matcher->path.decl)
+ {
+ GList *list = gtk_css_node_declaration_list_regions (matcher->path.decl);
+ if (list)
+ {
+ g_list_free (list);
+ return TRUE;
+ }
+ }
+
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
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))
const GtkWidgetPath *siblings;
GtkRegionFlags region_flags;
+ if (matcher->path.decl)
+ {
+ GQuark q = g_quark_try_string (region);
+
+ if (q && gtk_css_node_declaration_has_region (matcher->path.decl, q, ®ion_flags))
+ goto found;
+ }
+
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
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))
if (!gtk_widget_path_iter_has_region (matcher->path.path, matcher->path.index, region, ®ion_flags))
return FALSE;
}
+G_GNUC_END_IGNORE_DEPRECATIONS
+found:
if ((flags & region_flags) != flags)
return FALSE;
return TRUE;
-G_GNUC_END_IGNORE_DEPRECATIONS
}
static gboolean
};
gboolean
-_gtk_css_matcher_init (GtkCssMatcher *matcher,
- const GtkWidgetPath *path)
+_gtk_css_matcher_init (GtkCssMatcher *matcher,
+ const GtkWidgetPath *path,
+ const GtkCssNodeDeclaration *decl)
{
if (gtk_widget_path_length (path) == 0)
return FALSE;
matcher->path.klass = >K_CSS_MATCHER_WIDGET_PATH;
+ matcher->path.decl = decl;
matcher->path.path = path;
matcher->path.index = gtk_widget_path_length (path) - 1;
matcher->path.sibling_index = gtk_widget_path_iter_get_sibling_index (path, matcher->path.index);
struct _GtkCssMatcherWidgetPath {
const GtkCssMatcherClass *klass;
+ const GtkCssNodeDeclaration *decl;
const GtkWidgetPath *path;
guint index;
guint sibling_index;
};
gboolean _gtk_css_matcher_init (GtkCssMatcher *matcher,
- const GtkWidgetPath *path) G_GNUC_WARN_UNUSED_RESULT;
+ const GtkWidgetPath *path,
+ const GtkCssNodeDeclaration *decl) G_GNUC_WARN_UNUSED_RESULT;
void _gtk_css_matcher_any_init (GtkCssMatcher *matcher);
void _gtk_css_matcher_superset_init (GtkCssMatcher *matcher,
const GtkCssMatcher *subset,