summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2011-12-30 15:24:06 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2011-12-30 15:24:06 +0100
commita8bca1607de9d2a0e6c6172d5ad9979149b88c05 (patch)
tree6eba3b7b1826e7c033fa2aaccd0311732a59af17 /src
parent1e8a589bcd72bfd5045302698409d23070060507 (diff)
use array of CssStyleSheets instead of pointers in CssContext
Diffstat (limited to 'src')
-rw-r--r--src/css.cc20
-rw-r--r--src/css.hh3
2 files changed, 7 insertions, 16 deletions
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);