http://bugs.webkit.org/show_bug.cgi?id=16982
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2008 21:49:25 +0000 (21:49 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Jan 2008 21:49:25 +0000 (21:49 +0000)
        Make sure to make <head> the current block if it is created before a <body> already exists.

        Reviewed by Dan

        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::createHead):

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

WebCore/ChangeLog
WebCore/html/HTMLParser.cpp

index 88c8c5e..e856c49 100644 (file)
@@ -1,3 +1,14 @@
+2008-01-24  David Hyatt  <hyatt@apple.com>
+
+        http://bugs.webkit.org/show_bug.cgi?id=16982
+
+        Make sure to make <head> the current block if it is created before a <body> already exists.
+
+        Reviewed by Dan
+
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::createHead):
+
 2008-01-24  Alexey Proskuryakov  <ap@webkit.org>
 
         http://bugs.webkit.org/show_bug.cgi?id=16993
index b218c46..22ed9cb 100644 (file)
@@ -1380,6 +1380,12 @@ void HTMLParser::createHead()
     document->documentElement()->insertBefore(head, body, ec);
     if (ec)
         head = 0;
+        
+    // If the body does not exist yet, then the <head> should be pushed as the current block.
+    if (head && !body) {
+        pushBlock(head->localName(), head->tagPriority());
+        setCurrent(head);
+    }
 }
 
 PassRefPtr<Node> HTMLParser::handleIsindex(Token* t)