diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2009-07-15 02:31:28 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2009-07-15 02:31:28 +0000 |
commit | 1ebed74cd8be22ff805bffb10f6d1e55f2a9866f (patch) | |
tree | 3edb3bf0f8b1607a4add21d72b148e9455b017f2 /src/select | |
parent | a61e4fc15ca36c3fd699043499ddadc34fc11ca9 (diff) | |
download | libcss-1ebed74cd8be22ff805bffb10f6d1e55f2a9866f.tar.gz libcss-1ebed74cd8be22ff805bffb10f6d1e55f2a9866f.tar.bz2 |
Fix selection from selectors within @media blocks.
svn path=/trunk/libcss/; revision=8549
Diffstat (limited to 'src/select')
-rw-r--r-- | src/select/select.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/select/select.c b/src/select/select.c index 983d77e..ed529ec 100644 --- a/src/select/select.c +++ b/src/select/select.c @@ -634,21 +634,24 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx, /* Process any matching selectors */ while (*selectors != NULL) { - css_rule *rule; + css_rule *rule, *parent; bool process = true; /* Ignore any selectors contained in rules which are a child * of an @media block that doesn't match the current media * requirements. */ - for (rule = (*selectors)->rule; - rule->ptype != CSS_RULE_PARENT_STYLESHEET; - rule = rule->parent) { + for (rule = (*selectors)->rule; rule != NULL; rule = parent) { if (rule->type == CSS_RULE_MEDIA && (((css_rule_media *) rule)->media & state->media) == 0) { process = false; break; } + + if (rule->ptype != CSS_RULE_PARENT_STYLESHEET) + parent = rule->parent; + else + parent = NULL; } if (process) { @@ -671,21 +674,24 @@ css_error match_selectors_in_sheet(css_select_ctx *ctx, /* Process any matching selectors */ while (*selectors != NULL) { - css_rule *rule; + css_rule *rule, *parent; bool process = true; /* Ignore any selectors contained in rules which are a child * of an @media block that doesn't match the current media * requirements. */ - for (rule = (*selectors)->rule; - rule->ptype != CSS_RULE_PARENT_STYLESHEET; - rule = rule->parent) { + for (rule = (*selectors)->rule; rule != NULL; rule = parent) { if (rule->type == CSS_RULE_MEDIA && (((css_rule_media *) rule)->media & state->media) == 0) { process = false; break; } + + if (rule->ptype != CSS_RULE_PARENT_STYLESHEET) + parent = rule->parent; + else + parent = NULL; } if (process) { |