2010-07-02 Adam Barth <abarth@webkit.org>
authorabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Jul 2010 06:47:33 +0000 (06:47 +0000)
committerabarth@webkit.org <abarth@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 3 Jul 2010 06:47:33 +0000 (06:47 +0000)
        Reviewed by Eric Seidel.

        Handle <frameset> InBody
        https://bugs.webkit.org/show_bug.cgi?id=41558

        Yay test progression.

        * html5lib/runner-expected-html5.txt:
2010-07-02  Adam Barth  <abarth@webkit.org>

        Reviewed by Eric Seidel.

        Handle <frameset> InBody
        https://bugs.webkit.org/show_bug.cgi?id=41558

        Handling the <frameset> tag in the InBody mode is somewhat delicate.

        * html/HTMLElementStack.cpp:
        (WebCore::HTMLElementStack::popHTMLBodyElement):
        (WebCore::HTMLElementStack::popUntil):
        (WebCore::HTMLElementStack::popCommon):
        * html/HTMLElementStack.h:
        * html/HTMLTreeBuilder.cpp:
        (WebCore::HTMLTreeBuilder::processStartTag):

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

LayoutTests/ChangeLog
LayoutTests/html5lib/runner-expected-html5.txt
WebCore/ChangeLog
WebCore/html/HTMLElementStack.cpp
WebCore/html/HTMLElementStack.h
WebCore/html/HTMLTreeBuilder.cpp

index bef8cfe..2f688b5 100644 (file)
@@ -2,6 +2,17 @@
 
         Reviewed by Eric Seidel.
 
+        Handle <frameset> InBody
+        https://bugs.webkit.org/show_bug.cgi?id=41558
+
+        Yay test progression.
+
+        * html5lib/runner-expected-html5.txt:
+
+2010-07-02  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
         Special handling of <rp> and <rt> tags
         https://bugs.webkit.org/show_bug.cgi?id=41557
 
index 3fe36ab..2a1699c 100644 (file)
@@ -2117,9 +2117,6 @@ resources/tests6.dat:
 45
 46
 47
-48
-49
-51
 
 Test 1 of 51 in resources/tests6.dat failed. Input:
 <!doctype html></head> <head>
@@ -2542,41 +2539,6 @@ Expected:
 | <html>
 |   <head>
 |   <body>
-
-Test 48 of 51 in resources/tests6.dat failed. Input:
-<param><frameset></frameset>
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <param>
-Expected:
-| <html>
-|   <head>
-|   <frameset>
-
-Test 49 of 51 in resources/tests6.dat failed. Input:
-<source><frameset></frameset>
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <source>
-Expected:
-| <html>
-|   <head>
-|   <frameset>
-
-Test 51 of 51 in resources/tests6.dat failed. Input:
-</body><frameset></frameset>
-Got:
-| <html>
-|   <head>
-|   <body>
-Expected:
-| <html>
-|   <head>
-|   <frameset>
 resources/tests7.dat:
 2
 5
@@ -5432,9 +5394,7 @@ Test 13 of 14 in resources/tests15.dat failed. Input:
 Got:
 | <html>
 |   <head>
-|   <body>
-|     <noframes>
-|       "</frameset><noframes>"
+|   <frameset>
 Expected:
 | <html>
 |   <head>
index fa282cd..10a4701 100644 (file)
@@ -2,6 +2,23 @@
 
         Reviewed by Eric Seidel.
 
+        Handle <frameset> InBody
+        https://bugs.webkit.org/show_bug.cgi?id=41558
+
+        Handling the <frameset> tag in the InBody mode is somewhat delicate.
+
+        * html/HTMLElementStack.cpp:
+        (WebCore::HTMLElementStack::popHTMLBodyElement):
+        (WebCore::HTMLElementStack::popUntil):
+        (WebCore::HTMLElementStack::popCommon):
+        * html/HTMLElementStack.h:
+        * html/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processStartTag):
+
+2010-07-02  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
         Special handling of <rp> and <rt> tags
         https://bugs.webkit.org/show_bug.cgi?id=41557
 
index c9e73c2..70761c6 100644 (file)
@@ -74,6 +74,13 @@ void HTMLElementStack::popHTMLHeadElement()
     popCommon();
 }
 
+void HTMLElementStack::popHTMLBodyElement()
+{
+    ASSERT(top() == m_bodyElement);
+    m_bodyElement = 0;
+    popCommon();
+}
+
 void HTMLElementStack::pop()
 {
     ASSERT(!top()->hasTagName(HTMLNames::headTag));
@@ -89,6 +96,12 @@ void HTMLElementStack::popUntil(const AtomicString& tagName)
     }
 }
 
+void HTMLElementStack::popUntil(Element* element)
+{
+    while (top() != element)
+        pop();
+}
+
 void HTMLElementStack::pushHTMLHtmlElement(PassRefPtr<Element> element)
 {
     ASSERT(element->hasTagName(HTMLNames::htmlTag));
@@ -260,7 +273,8 @@ void HTMLElementStack::pushCommon(PassRefPtr<Element> element)
 void HTMLElementStack::popCommon()
 {
     ASSERT(!top()->hasTagName(HTMLNames::htmlTag));
-    ASSERT(!top()->hasTagName(HTMLNames::bodyTag));
+    ASSERT(!top()->hasTagName(HTMLNames::headTag) || !m_headElement);
+    ASSERT(!top()->hasTagName(HTMLNames::bodyTag) || !m_bodyElement);
     top()->finishParsingChildren();
     m_top = m_top->releaseNext();
 }
index 253c1af..8ca7c81 100644 (file)
@@ -49,7 +49,9 @@ public:
 
     void pop();
     void popUntil(const AtomicString& tagName);
+    void popUntil(Element*);
     void popHTMLHeadElement();
+    void popHTMLBodyElement();
 
     void remove(Element*);
     void removeHTMLHeadElement(Element*);
@@ -75,7 +77,7 @@ private:
     OwnPtr<ElementRecord> m_top;
 
     // We remember <html>, <head> and <body> as they are pushed.  Their
-    // ElementRecords keep them alive.  <html> and <body> are never popped.
+    // ElementRecords keep them alive.  <html> is never popped.
     // FIXME: We don't currently require type-specific information about
     // these elements so we haven't yet bothered to plumb the types all the
     // way down through createElement, etc.
index bbdcd18..d3a34df 100644 (file)
@@ -400,7 +400,18 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token)
             return;
         }
         if (token.name() == framesetTag) {
-            notImplemented();
+            parseError(token);
+            notImplemented(); // fragment case
+            if (!m_framesetOk)
+                return;
+            ExceptionCode ec = 0;
+            m_openElements.bodyElement()->remove(ec);
+            ASSERT(!ec);
+            m_openElements.popUntil(m_openElements.bodyElement());
+            m_openElements.popHTMLBodyElement();
+            ASSERT(m_openElements.top() == m_openElements.htmlElement());
+            insertElement(token);
+            m_insertionMode = InFramesetMode;
             return;
         }
         if (token.name() == addressTag || token.name() == articleTag || token.name() == asideTag || token.name() == blockquoteTag || token.name() == centerTag || token.name() == "details" || token.name() == dirTag || token.name() == divTag || token.name() == dlTag || token.name() == fieldsetTag || token.name() == "figure" || token.name() == footerTag || token.name() == headerTag || token.name() == hgroupTag || token.name() == menuTag || token.name() == navTag || token.name() == olTag || token.name() == pTag || token.name() == sectionTag || token.name() == ulTag) {