diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/css.cc | 18 | ||||
-rw-r--r-- | src/css.hh | 3 | ||||
-rw-r--r-- | src/cssparser.cc | 12 |
3 files changed, 19 insertions, 14 deletions
@@ -348,14 +348,20 @@ void CssContext::apply (CssPropertyList *props, Doctree *docTree, tagStyle->apply (props); } -void CssContext::addRule (CssRule *rule, CssPrimaryOrder order) { - if (sheet[order] == NULL) - sheet[order] = new CssStyleSheet (); +void CssContext::addRule (CssSelector *sel, CssPropertyList *props, + CssPrimaryOrder order) { - sheet[order]->addRule (rule); + if (props->size () > 0) { + CssRule *rule = new CssRule (sel, props); -// fprintf(stderr, "Adding Rule (%d)\n", order); -// rule->print (); + if (sheet[order] == NULL) + sheet[order] = new CssStyleSheet (); + + sheet[order]->addRule (rule); + +// fprintf(stderr, "Adding Rule (%d)\n", order); +// rule->print (); + } } void CssContext::buildUserAgentStyle () { @@ -339,7 +339,8 @@ class CssContext { CssContext (); ~CssContext (); - void addRule (CssRule *rule, CssPrimaryOrder order); + void addRule (CssSelector *sel, CssPropertyList *props, + CssPrimaryOrder order); void apply (CssPropertyList *props, Doctree *docTree, CssPropertyList *tagStyle, CssPropertyList *nonCssHints); diff --git a/src/cssparser.cc b/src/cssparser.cc index bd5949bd..60fa1ce9 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -1139,16 +1139,14 @@ static void Css_parse_ruleset(CssParser * parser) CssSelector *s = list->get(i); if (parser->origin == CSS_ORIGIN_USER_AGENT) { - parser->context->addRule(new CssRule(s, props), - CSS_PRIMARY_USER_AGENT); + parser->context->addRule(s, props, CSS_PRIMARY_USER_AGENT); } else if (parser->origin == CSS_ORIGIN_USER) { - parser->context->addRule(new CssRule(s, props), CSS_PRIMARY_USER); - parser->context->addRule(new CssRule(s, importantProps), + parser->context->addRule(s, props, CSS_PRIMARY_USER); + parser->context->addRule(s, importantProps, CSS_PRIMARY_USER_IMPORTANT); } else if (parser->origin == CSS_ORIGIN_AUTHOR) { - parser->context->addRule(new CssRule(s, props), - CSS_PRIMARY_AUTHOR); - parser->context->addRule(new CssRule(s, importantProps), + parser->context->addRule(s, props, CSS_PRIMARY_AUTHOR); + parser->context->addRule(s, importantProps, CSS_PRIMARY_AUTHOR_IMPORTANT); } |