diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-12-30 15:24:06 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2011-12-30 15:24:06 +0100 |
commit | a8bca1607de9d2a0e6c6172d5ad9979149b88c05 (patch) | |
tree | 6eba3b7b1826e7c033fa2aaccd0311732a59af17 | |
parent | 1e8a589bcd72bfd5045302698409d23070060507 (diff) |
use array of CssStyleSheets instead of pointers in CssContext
-rw-r--r-- | src/css.cc | 20 | ||||
-rw-r--r-- | src/css.hh | 3 |
2 files changed, 7 insertions, 16 deletions
@@ -501,18 +501,10 @@ void CssStyleSheet::apply (CssPropertyList *props, CssContext::CssContext () { pos = 0; - for (int i = 0; i < CSS_PRIMARY_LAST; i++) - sheet[i] = new CssStyleSheet (); - buildUserAgentStyle (); buildUserStyle (); } -CssContext::~CssContext () { - for (int o = CSS_PRIMARY_USER_AGENT; o < CSS_PRIMARY_LAST; o++) - delete sheet[o]; -} - /** * \brief Apply a CSS context to a property list. * @@ -527,23 +519,23 @@ void CssContext::apply (CssPropertyList *props, Doctree *docTree, CssPropertyList *tagStyle, CssPropertyList *tagStyleImportant, CssPropertyList *nonCssHints) { - sheet[CSS_PRIMARY_USER_AGENT]->apply (props, docTree, node); - 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); - sheet[CSS_PRIMARY_AUTHOR]->apply (props, docTree, node); + sheet[CSS_PRIMARY_AUTHOR].apply (props, docTree, node); if (tagStyle) tagStyle->apply (props); - sheet[CSS_PRIMARY_AUTHOR_IMPORTANT]->apply (props, docTree, node); + sheet[CSS_PRIMARY_AUTHOR_IMPORTANT].apply (props, docTree, node); if (tagStyleImportant) tagStyleImportant->apply (props); - 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, @@ -552,7 +544,7 @@ void CssContext::addRule (CssSelector *sel, CssPropertyList *props, if (props->size () > 0) { CssRule *rule = new CssRule (sel, props, pos++); - sheet[order]->addRule (rule); + sheet[order].addRule (rule); } } @@ -458,7 +458,7 @@ class CssStyleSheet { */ class CssContext { private: - CssStyleSheet *sheet[CSS_PRIMARY_USER_IMPORTANT + 1]; + CssStyleSheet sheet[CSS_PRIMARY_USER_IMPORTANT + 1]; int pos; void buildUserAgentStyle (); @@ -466,7 +466,6 @@ class CssContext { public: CssContext (); - ~CssContext (); void addRule (CssSelector *sel, CssPropertyList *props, CssPrimaryOrder order); |