changeset 950:397174ba98a3

merge
author Jorge Arellano Cid <jcid@dillo.org>
date Sun, 15 Feb 2009 16:07:50 -0300
parents 691053e40394 (current diff) d79c70297a00 (diff)
children 43543b61743f
files
diffstat 2 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/css.cc	Sun Feb 15 16:04:56 2009 -0300
+++ b/src/css.cc	Sun Feb 15 16:07:50 2009 -0300
@@ -310,8 +310,12 @@
       ruleList = anyTable;
    }
 
-   if (ruleList)
+   if (ruleList) {
       ruleList->insert (rule);
+   } else {
+      assert (top->element == CssSimpleSelector::ELEMENT_NONE);
+      delete rule;
+   }
 }
 
 void CssStyleSheet::apply (CssPropertyList *props,
--- a/src/styleengine.cc	Sun Feb 15 16:04:56 2009 -0300
+++ b/src/styleengine.cc	Sun Feb 15 16:07:50 2009 -0300
@@ -43,13 +43,17 @@
    n->num = num++;
    n->style = Style::create (layout, &style_attrs);
    n->wordStyle = NULL;
+   n->element = 0;
+   n->id = NULL;
+   n->klass = NULL;
    n->pseudo = NULL;
    n->styleAttribute = NULL;
    n->inheritBackgroundColor = false;
 }
 
 StyleEngine::~StyleEngine () {
-   /* \todo clear stack if not empty */
+   while (stack->size () > 0)
+      endElement (stack->getRef (stack->size () - 1)->element);
    delete stack;
    delete cssContext;
 }
@@ -136,7 +140,7 @@
  */
 void StyleEngine::endElement (int element) {
 //   fprintf(stderr, "===> END %d\n", element);
-   assert (stack->size () > 1);
+   assert (stack->size () > 0);
    assert (element == stack->getRef (stack->size () - 1)->element);
 
    Node *n =  stack->getRef (stack->size () - 1);