1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

CSS: Fix parent selectors broken in the previous commit.

This commit is contained in:
Kalle Olavi Niemitalo 2007-07-16 01:42:15 +03:00 committed by Kalle Olavi Niemitalo
parent 591ff81890
commit 275402f43c
3 changed files with 8 additions and 7 deletions

View File

@ -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; \

View File

@ -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

View File

@ -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 *