summaryrefslogtreecommitdiff
path: root/src/stylesheet.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 08:14:10 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-02-14 08:14:10 +0000
commit4fb1e33000041b3befba0d5b200f733028ccf72b (patch)
treec654401a1381dfd8351b624fdb64b9ab7d98b06b /src/stylesheet.c
parentc4415a128f7651f2f7358401af75cfc1959c2413 (diff)
downloadlibcss-4fb1e33000041b3befba0d5b200f733028ccf72b.tar.gz
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
Diffstat (limited to 'src/stylesheet.c')
-rw-r--r--src/stylesheet.c12
1 files changed, 10 insertions, 2 deletions
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;