diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/css.cc | 19 | ||||
-rw-r--r-- | src/css.hh | 10 | ||||
-rw-r--r-- | src/cssparser.cc | 2 | ||||
-rw-r--r-- | src/styleengine.cc | 6 |
4 files changed, 19 insertions, 18 deletions
@@ -25,25 +25,16 @@ void CssProperty::print () { } CssPropertyList::~CssPropertyList () { - if (ownerOfStrings) { - for (int i = 0; i < size (); i++) { - CssProperty *p = getRef (i); - - switch (p->name) { - case CssProperty::CSS_PROPERTY_CONTENT: - case CssProperty::CSS_PROPERTY_FONT_FAMILY: - dFree (p->value.strVal); - break; - default: - break; - } - } - } + if (ownerOfStrings) + for (int i = 0; i < size (); i++) + getRef (i)->free (); } void CssPropertyList::set (CssProperty::Name name, CssProperty::Value value) { for (int i = 0; i < size (); i++) if (getRef (i)->name == name) { + if (ownerOfStrings) + getRef (i)->free (); getRef (i)->value = value; return; } @@ -160,6 +160,16 @@ class CssProperty { Name name; Value value; + void free () { + switch (name) { + case CssProperty::CSS_PROPERTY_CONTENT: + case CssProperty::CSS_PROPERTY_FONT_FAMILY: + dFree (value.strVal); + break; + default: + break; + } + } void print (); }; diff --git a/src/cssparser.cc b/src/cssparser.cc index 87718d31..bd5949bd 100644 --- a/src/cssparser.cc +++ b/src/cssparser.cc @@ -1186,7 +1186,7 @@ void a_Css_parse(CssContext * context, CssPropertyList *a_Css_parse_declaration(const char *buf, int buflen) { - CssPropertyList *props = new CssPropertyList (); + CssPropertyList *props = new CssPropertyList (true); CssParser parser; parser.context = NULL; diff --git a/src/styleengine.cc b/src/styleengine.cc index 015f75be..3f15c419 100644 --- a/src/styleengine.cc +++ b/src/styleengine.cc @@ -428,13 +428,13 @@ Style * StyleEngine::style0 (CssPropertyList *nonCssProperties) { // merge style information cssContext->apply (&props, this, styleAttributeProps, nonCssProperties); - if (styleAttributeProps) - delete styleAttributeProps; - // apply style apply (&attrs, &props); stack->getRef (stack->size () - 1)->style = Style::create (layout, &attrs); + + if (styleAttributeProps) + delete styleAttributeProps; return stack->getRef (stack->size () - 1)->style; } |