summaryrefslogtreecommitdiff
path: root/src/select
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-07-22 06:50:07 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-07-22 06:50:07 +0000
commit3a0f617925f0313b17b9ef8ca5a845bb2cab8cf0 (patch)
tree15e6894e330b4bbde56cc30c39ce6e47be97bbb7 /src/select
parent22dc756a77e37611bfe26d408ec67143101a4973 (diff)
downloadlibcss-3a0f617925f0313b17b9ef8ca5a845bb2cab8cf0.tar.gz
libcss-3a0f617925f0313b17b9ef8ca5a845bb2cab8cf0.tar.bz2
Match details before considering combinators.
svn path=/trunk/libcss/; revision=8667
Diffstat (limited to 'src/select')
-rw-r--r--src/select/select.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/src/select/select.c b/src/select/select.c
index ca1a3c0..1893f69 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -746,19 +746,6 @@ css_error match_selector_chain(css_select_ctx *ctx,
const css_selector_detail *detail = &s->data;
bool match = false;
- /* First, consider any named combinator on this selector */
- if (s->data.comb != CSS_COMBINATOR_NONE &&
- s->combinator->data.name != state->universal) {
- error = match_named_combinator(ctx, s->data.comb,
- s->combinator, state, node, &next_node);
- if (error != CSS_OK)
- return error;
-
- /* No match for combinator, so reject selector chain */
- if (next_node == NULL)
- return CSS_OK;
- }
-
/* If this is the first selector in the chain, we must match
* its details. The details of subsequent selectors will be
* matched when processing the combinator. */
@@ -774,9 +761,21 @@ css_error match_selector_chain(css_select_ctx *ctx,
}
- /* If we had a universal combinator, then consider that */
+ /* Consider any combinator on this selector */
if (s->data.comb != CSS_COMBINATOR_NONE &&
+ s->combinator->data.name != state->universal) {
+ /* Named combinator */
+ error = match_named_combinator(ctx, s->data.comb,
+ s->combinator, state, node, &next_node);
+ if (error != CSS_OK)
+ return error;
+
+ /* No match for combinator, so reject selector chain */
+ if (next_node == NULL)
+ return CSS_OK;
+ } else if (s->data.comb != CSS_COMBINATOR_NONE &&
s->combinator->data.name == state->universal) {
+ /* Universal combinator */
error = match_universal_combinator(ctx, s->data.comb,
s->combinator, state, node, &next_node);
if (error != CSS_OK)