diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-12-30 00:41:36 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-12-30 00:41:36 +0100 |
commit | 1e8a589bcd72bfd5045302698409d23070060507 (patch) | |
tree | 6ac3fea9241bf0728e5c4ff99ab3b90f60b8cab2 /src | |
parent | fb503884d404da8796bd88d77389f3227b6651e8 (diff) |
simplify CssContext a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/css.cc | 24 |
1 files changed, 7 insertions, 17 deletions
@@ -501,10 +501,8 @@ void CssStyleSheet::apply (CssPropertyList *props, CssContext::CssContext () { pos = 0; - memset (sheet, 0, sizeof(sheet)); - sheet[CSS_PRIMARY_USER_AGENT] = new CssStyleSheet (); - sheet[CSS_PRIMARY_USER] = new CssStyleSheet (); - sheet[CSS_PRIMARY_USER_IMPORTANT] = new CssStyleSheet (); + for (int i = 0; i < CSS_PRIMARY_LAST; i++) + sheet[i] = new CssStyleSheet (); buildUserAgentStyle (); buildUserStyle (); @@ -528,29 +526,24 @@ void CssContext::apply (CssPropertyList *props, Doctree *docTree, DoctreeNode *node, CssPropertyList *tagStyle, CssPropertyList *tagStyleImportant, CssPropertyList *nonCssHints) { - if (sheet[CSS_PRIMARY_USER_AGENT]) - sheet[CSS_PRIMARY_USER_AGENT]->apply (props, docTree, node); - if (sheet[CSS_PRIMARY_USER]) - sheet[CSS_PRIMARY_USER]->apply (props, docTree, node); + sheet[CSS_PRIMARY_USER_AGENT]->apply (props, docTree, node); + sheet[CSS_PRIMARY_USER]->apply (props, docTree, node); if (nonCssHints) nonCssHints->apply (props); - if (sheet[CSS_PRIMARY_AUTHOR]) - sheet[CSS_PRIMARY_AUTHOR]->apply (props, docTree, node); + sheet[CSS_PRIMARY_AUTHOR]->apply (props, docTree, node); if (tagStyle) tagStyle->apply (props); - if (sheet[CSS_PRIMARY_AUTHOR_IMPORTANT]) - sheet[CSS_PRIMARY_AUTHOR_IMPORTANT]->apply (props, docTree, node); + sheet[CSS_PRIMARY_AUTHOR_IMPORTANT]->apply (props, docTree, node); if (tagStyleImportant) tagStyleImportant->apply (props); - if (sheet[CSS_PRIMARY_USER_IMPORTANT]) - sheet[CSS_PRIMARY_USER_IMPORTANT]->apply (props, docTree, node); + sheet[CSS_PRIMARY_USER_IMPORTANT]->apply (props, docTree, node); } void CssContext::addRule (CssSelector *sel, CssPropertyList *props, @@ -559,9 +552,6 @@ void CssContext::addRule (CssSelector *sel, CssPropertyList *props, if (props->size () > 0) { CssRule *rule = new CssRule (sel, props, pos++); - if (sheet[order] == NULL) - sheet[order] = new CssStyleSheet (); - sheet[order]->addRule (rule); } } |