Not reviewed - build fix.
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 11:37:12 +0000 (11:37 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 6 Jul 2006 11:37:12 +0000 (11:37 +0000)
        - back out earlier leak fix, as it caused a crash on one of the fast/invalid layout tests

        * dom/Document.cpp:
        (WebCore::Document::removedLastRef):
        * html/HTMLParser.cpp:
        (WebCore::HTMLStackElem::HTMLStackElem):
        (WebCore::HTMLParser::popNestedHeaderTag):
        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
        (WebCore::HTMLParser::reopenResidualStyleTags):
        (WebCore::HTMLParser::popBlock):
        (WebCore::HTMLParser::popOneBlock):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15184 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/dom/Document.cpp
WebCore/html/HTMLParser.cpp

index a3024a2a8d2387a38d6f4a01c5a008bf9a3d24c7..519dab23581b8b74b4163796fc591e51787bee24 100644 (file)
@@ -1,3 +1,19 @@
+2006-07-06  Maciej Stachowiak  <mjs@apple.com>
+
+        Not reviewed - build fix.
+
+        - back out earlier leak fix, as it caused a crash on one of the fast/invalid layout tests
+
+        * dom/Document.cpp:
+        (WebCore::Document::removedLastRef):
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLStackElem::HTMLStackElem):
+        (WebCore::HTMLParser::popNestedHeaderTag):
+        (WebCore::HTMLParser::handleResidualStyleCloseTagAcrossBlocks):
+        (WebCore::HTMLParser::reopenResidualStyleTags):
+        (WebCore::HTMLParser::popBlock):
+        (WebCore::HTMLParser::popOneBlock):
+
 2006-07-06  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders.
index 001cfcdba0d10e583778f7e2448f829392e1d893..b9480075b3ce20a629214834f3b7a99da453fb13 100644 (file)
@@ -304,9 +304,6 @@ void Document::removedLastRef()
         removeAllChildren();
 
         m_markers.clear();
-
-        delete m_tokenizer;
-        m_tokenizer = 0;
     } else
         delete this;
 }
index 6e8f8b45ce70b3f6effb3c7984f55cb98be9ee1e..bf4322ec60dd1fe406d219944586664207326f78 100644 (file)
@@ -71,37 +71,15 @@ public:
         tagName(_tagName),
         level(_level),
         strayTableContent(false),
-        nodeIsRefd(!_node->isDocumentNode()),
-        next(_next),
-        m_node(_node)
-    { 
-        if (nodeIsRefd)
-            m_node->ref();
-    }
-
-    ~HTMLStackElem()
-    {
-        if (nodeIsRefd)
-            m_node->deref();
-    }
-
-    Node* node() { return m_node; }
-    void setNode(Node* _node)
-    {
-        if (nodeIsRefd)
-            m_node->deref();
-        nodeIsRefd = !_node->isDocumentNode();
-        m_node = _node;
-    }
+        node(_node),
+        next(_next)
+        { }
 
     AtomicString tagName;
     int level;
     bool strayTableContent;
-    bool nodeIsRefd;
+    RefPtr<Node> node;
     HTMLStackElem* next;
-
-private:
-    Node* m_node;
 };
 
 /**
@@ -885,7 +863,7 @@ void HTMLParser::popNestedHeaderTag()
         }
         if (currNode && !isInline(currNode))
             return;
-        currNode = curr->node();
+        currNode = curr->node.get();
     }
 }
 
@@ -996,9 +974,9 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
 
     if (!curr || !maxElem || !isAffectedByResidualStyle(maxElem->tagName)) return;
 
-    Node* residualElem = prev->node();
-    Node* blockElem = prevMaxElem ? prevMaxElem->node() : current;
-    Node* parentElem = elem->node();
+    Node* residualElem = prev->node.get();
+    Node* blockElem = prevMaxElem ? prevMaxElem->node.get() : current;
+    Node* parentElem = elem->node.get();
 
     // Check to see if the reparenting that is going to occur is allowed according to the DOM.
     // FIXME: We should either always allow it or perform an additional fixup instead of
@@ -1007,7 +985,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
     if (!parentElem->childAllowed(blockElem))
         return;
     
-    if (maxElem->node()->parentNode() != elem->node()) {
+    if (maxElem->node->parentNode() != elem->node) {
         // Walk the stack and remove any elements that aren't residual style tags.  These
         // are basically just being closed up.  Example:
         // <font><span>Moo<p>Goo</font></p>.
@@ -1018,7 +996,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
             HTMLStackElem* nextElem = currElem->next;
             if (!isResidualStyleTag(currElem->tagName)) {
                 prevElem->next = nextElem;
-                prevElem->setNode(currElem->node());
+                prevElem->node = currElem->node;
                 delete currElem;
             }
             else
@@ -1036,13 +1014,13 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
         // under the reopened residual tags (e.g., the <i> in the above example.)
         Node* prevNode = 0;
         currElem = maxElem;
-        while (currElem->node() != residualElem) {
-            if (isResidualStyleTag(currElem->node()->localName())) {
+        while (currElem->node != residualElem) {
+            if (isResidualStyleTag(currElem->node->localName())) {
                 // Create a clone of this element.
-                RefPtr<Node> currNode = currElem->node()->cloneNode(false);
+                RefPtr<Node> currNode = currElem->node->cloneNode(false);
 
                 // Change the stack element's node to point to the clone.
-                currElem->setNode(currNode.get());
+                currElem->node = currNode;
                 
                 // Attach the previous node as a child of this new node.
                 if (prevNode)
@@ -1058,7 +1036,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
 
         // Now append the chain of new residual style elements if one exists.
         if (prevNode)
-            elem->node()->appendChild(prevNode, ec);
+            elem->node->appendChild(prevNode, ec);
     }
          
     // Check if the block is still in the tree. If it isn't, then we don't
@@ -1110,7 +1088,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
         currElem = currElem->next;
     }
     prevElem->next = elem->next;
-    prevElem->setNode(elem->node());
+    prevElem->node = elem->node;
     delete elem;
     
     // Step 7: Reopen intermediate inlines, e.g., <b><p><i>Foo</b>Goo</p>.
@@ -1131,7 +1109,7 @@ void HTMLParser::handleResidualStyleCloseTagAcrossBlocks(HTMLStackElem* elem)
             // curr->id rather than the node that you should pop to when the element gets pulled off
             // the stack.
             popOneBlock(false);
-            curr->setNode(currNode);
+            curr->node = currNode;
             curr->next = residualStyleStack;
             residualStyleStack = curr;
         }
@@ -1153,7 +1131,7 @@ void HTMLParser::reopenResidualStyleTags(HTMLStackElem* elem, Node* malformedTab
     // Loop for each tag that needs to be reopened.
     while (elem) {
         // Create a shallow clone of the DOM node for this element.
-        RefPtr<Node> newNode = elem->node()->cloneNode(false); 
+        RefPtr<Node> newNode = elem->node->cloneNode(false); 
 
         // Append the new node. In the malformed table case, we need to insert before the table,
         // which will be the last child.
@@ -1258,7 +1236,7 @@ void HTMLParser::popBlock(const AtomicString& _tagName)
                 // the stack.
                 popOneBlock(false);
                 Elem->next = residualStyleStack;
-                Elem->setNode(currNode);
+                Elem->node = currNode;
                 residualStyleStack = Elem;
             }
             else
@@ -1276,11 +1254,11 @@ void HTMLParser::popOneBlock(bool delBlock)
 
     // Form elements restore their state during the parsing process.
     // Also, a few elements (<applet>, <object>) need to know when all child elements (<param>s) are available.
-    if (current && elem->node() != current)
+    if (current && elem->node != current)
         current->closeRenderer();
 
     blockStack = elem->next;
-    setCurrent(elem->node());
+    setCurrent(elem->node.get());
 
     if (elem->strayTableContent)
         inStrayTableContent--;