From a8bca1607de9d2a0e6c6172d5ad9979149b88c05 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 30 Dec 2011 15:24:06 +0100 Subject: use array of CssStyleSheets instead of pointers in CssContext --- src/css.cc | 20 ++++++-------------- src/css.hh | 3 +-- 2 files changed, 7 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/css.cc b/src/css.cc index 4149fc8c..db255e0e 100644 --- a/src/css.cc +++ b/src/css.cc @@ -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); } } diff --git a/src/css.hh b/src/css.hh index 20935dfd..794caaab 100644 --- a/src/css.hh +++ b/src/css.hh @@ -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); -- cgit v1.2.3