summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/select/select.c14
-rw-r--r--src/stylesheet.c2
-rw-r--r--src/stylesheet.h3
3 files changed, 11 insertions, 8 deletions
diff --git a/src/select/select.c b/src/select/select.c
index b2820c8..411081e 100644
--- a/src/select/select.c
+++ b/src/select/select.c
@@ -496,6 +496,9 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
{
const css_stylesheet *s = sheet;
const css_rule *rule = s->rule_list;
+ uint32_t sp = 0;
+#define IMPORT_STACK_SIZE 256
+ const css_rule *import_stack[IMPORT_STACK_SIZE];
do {
/* Find first non-charset rule, if we're at the list head */
@@ -514,6 +517,10 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
if (import->sheet != NULL &&
(import->media & state->media) != 0) {
/* It's applicable, so process it */
+ assert(sp < IMPORT_STACK_SIZE - 1);
+
+ import_stack[sp++] = rule;
+
s = import->sheet;
rule = s->rule_list;
} else {
@@ -537,9 +544,10 @@ css_error select_from_sheet(css_select_ctx *ctx, const css_stylesheet *sheet,
return error;
/* Find next sheet to process */
- if (s->ownerRule != NULL) {
- rule = s->ownerRule->next;
- s = s->ownerRule->parent;
+ if (sp > 0) {
+ sp--;
+ rule = import_stack[sp]->next;
+ s = import_stack[sp]->parent;
} else {
s = NULL;
}
diff --git a/src/stylesheet.c b/src/stylesheet.c
index 20cc91f..eed4735 100644
--- a/src/stylesheet.c
+++ b/src/stylesheet.c
@@ -361,8 +361,6 @@ css_error css_stylesheet_register_import(css_stylesheet *parent,
if (r->type == CSS_RULE_IMPORT && i->sheet == NULL) {
i->sheet = import;
- import->ownerRule = r;
-
return CSS_OK;
}
}
diff --git a/src/stylesheet.h b/src/stylesheet.h
index b708257..2c6caac 100644
--- a/src/stylesheet.h
+++ b/src/stylesheet.h
@@ -157,9 +157,6 @@ struct css_stylesheet {
char *url; /**< URL of this sheet */
char *title; /**< Title of this sheet */
- void *ownerNode; /**< Owning node in document */
- css_rule *ownerRule; /**< Owning rule in parent */
-
css_language_level level; /**< Language level of sheet */
css_parser *parser; /**< Core parser for sheet */
void *parser_frontend; /**< Frontend parser */