From 4fb1e33000041b3befba0d5b200f733028ccf72b Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 14 Feb 2009 08:14:10 +0000 Subject: Discard selectors that contain pseudo elements in non-terminal simple selectors. More test data for selectors with pseudo elements svn path=/trunk/libcss/; revision=6473 --- src/stylesheet.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/stylesheet.c') diff --git a/src/stylesheet.c b/src/stylesheet.c index da76915..40230e1 100644 --- a/src/stylesheet.c +++ b/src/stylesheet.c @@ -557,18 +557,26 @@ css_error css_stylesheet_selector_append_specific(css_stylesheet *sheet, * For example, given A + B, the combinator field of B would point at A, * with a combinator type of CSS_COMBINATOR_SIBLING. Thus, given B, we can * find its combinator. It is not possible to find B given A. - * - * \todo Check that this (backwards) representation plays well with CSSOM. */ css_error css_stylesheet_selector_combine(css_stylesheet *sheet, css_combinator type, css_selector *a, css_selector *b) { + const css_selector_detail *det; + if (sheet == NULL || a == NULL || b == NULL) return CSS_BADPARM; /* Ensure that there is no existing combinator on B */ assert(b->combinator == NULL); + /* A must not contain a pseudo element */ + for (det = &a->data; det != NULL; ) { + if (det->type == CSS_SELECTOR_PSEUDO_ELEMENT) + return CSS_INVALID; + + det = (det->next != 0) ? det + 1 : NULL; + } + b->combinator = a; b->data.comb = type; -- cgit v1.2.3