From 275402f43cdd67a82b89dc846b32529d517f0a0b Mon Sep 17 00:00:00 2001 From: Kalle Olavi Niemitalo Date: Mon, 16 Jul 2007 01:42:15 +0300 Subject: [PATCH] CSS: Fix parent selectors broken in the previous commit. --- src/document/css/apply.c | 2 +- src/document/css/stylesheet.c | 11 ++++++----- src/document/css/stylesheet.h | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/document/css/apply.c b/src/document/css/apply.c index 6d4155e0a..05072d127 100644 --- a/src/document/css/apply.c +++ b/src/document/css/apply.c @@ -141,7 +141,7 @@ examine_element(struct html_context *html_context, struct css_selector *base, dbginfo(sel, type, base); \ merge_css_selectors(base, sel); \ /* Ancestor matches? */ \ - if (sel->leaves.may_contain_rel_ancestor \ + if (sel->leaves.may_contain_rel_ancestor_or_parent \ && (struct list_head *) element->next \ != &html_context->stack) { \ struct html_element *ancestor; \ diff --git a/src/document/css/stylesheet.c b/src/document/css/stylesheet.c index e2ad9fc94..6f36ba60e 100644 --- a/src/document/css/stylesheet.c +++ b/src/document/css/stylesheet.c @@ -84,8 +84,8 @@ void set_css_selector_relation(struct css_selector *selector, enum css_selector_relation relation) { - /* Changing the relation after the selector is in a set might - * require setting css_relation_set.may_contain_rel_ancestor, + /* Changing the relation after the selector is in a set might require + * setting css_relation_set.may_contain_rel_ancestor_or_parent, * but we don't have a pointer to the set here. */ assert(!css_selector_is_in_set(selector)); selector->relation = relation; @@ -194,7 +194,7 @@ done_css_selector(struct css_selector *selector) void init_css_selector_set(struct css_selector_set *set) { - set->may_contain_rel_ancestor = 0; + set->may_contain_rel_ancestor_or_parent = 0; init_list(set->list); } @@ -213,8 +213,9 @@ add_css_selector_to_set(struct css_selector *selector, assert(!css_selector_is_in_set(selector)); add_to_list(set->list, selector); - if (selector->relation == CSR_ANCESTOR) - set->may_contain_rel_ancestor = 1; + if (selector->relation == CSR_ANCESTOR + || selector->relation == CSR_PARENT) + set->may_contain_rel_ancestor_or_parent = 1; } void diff --git a/src/document/css/stylesheet.h b/src/document/css/stylesheet.h index 2da2feaa7..54857881d 100644 --- a/src/document/css/stylesheet.h +++ b/src/document/css/stylesheet.h @@ -41,7 +41,7 @@ * because all rules for the same selector have already been merged * into one struct css_selector. */ struct css_selector_set { - unsigned char may_contain_rel_ancestor; + unsigned char may_contain_rel_ancestor_or_parent; /* Keep this away from the beginning of the structure, * so that nobody can cast the struct css_selector_set *