summaryrefslogtreecommitdiff
path: root/gtk/gtkcssmatcher.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2014-08-13 16:18:39 +0200
committerBenjamin Otte <otte@redhat.com>2014-08-13 16:51:16 +0200
commitdff52f7a040c2271ed93307f32a545bd662f9dbc (patch)
tree6f2e8060e8d0e51f34713e13075b714b59ddf58e /gtk/gtkcssmatcher.c
parentb276b6198f6937700f0cfc39dfbfe7cd156747e7 (diff)
downloadgtk+-dff52f7a040c2271ed93307f32a545bd662f9dbc.tar.gz
css: Match state in siblings properly
Previously, we always returned the state flags of the original widget and did not consider the siblings' pseudoclasses. Testcase is attached.
Diffstat (limited to 'gtk/gtkcssmatcher.c')
-rw-r--r--gtk/gtkcssmatcher.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gtk/gtkcssmatcher.c b/gtk/gtkcssmatcher.c
index d169c274cf..b734bfa3ea 100644
--- a/gtk/gtkcssmatcher.c
+++ b/gtk/gtkcssmatcher.c
@@ -56,7 +56,13 @@ gtk_css_matcher_widget_path_get_previous (GtkCssMatcher *matcher,
static GtkStateFlags
gtk_css_matcher_widget_path_get_state (const GtkCssMatcher *matcher)
{
- return gtk_widget_path_iter_get_state (matcher->path.path, matcher->path.index);
+ 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_get_state (siblings, matcher->path.sibling_index);
+ else
+ return gtk_widget_path_iter_get_state (matcher->path.path, matcher->path.index);
}
static gboolean