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

        Implement InTableBodyMode
        https://bugs.webkit.org/show_bug.cgi?id=41671

        In the process of implementing this patch, Eric and I discussed some of
        the high-level organization of the HTMLTreeBuilder class.  We'd like to
        split it up into smaller pieces.  In the meantime, I've reordered some
        of the declarations in the header to make the relations between the
        different kinds of functions clearer.

        * html/HTMLElementStack.cpp:
        * html/HTMLTreeBuilder.cpp:
        (WebCore::HTMLTreeBuilder::processIsindexStartTagForInBody):
        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
        (WebCore::HTMLTreeBuilder::processStartTagForInTable):
        (WebCore::HTMLTreeBuilder::processStartTag):
        (WebCore::HTMLTreeBuilder::processEndTagForInTable):
        (WebCore::HTMLTreeBuilder::processEndTag):
        (WebCore::HTMLTreeBuilder::processCharacter):
        (WebCore::HTMLTreeBuilder::processEndOfFile):
        * html/HTMLTreeBuilder.h:
2010-07-06  Adam Barth  <abarth@webkit.org>

        Reviewed by Eric Seidel.

        Implement InTableBodyMode
        https://bugs.webkit.org/show_bug.cgi?id=41671

        * html5lib/runner-expected-html5.txt:

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

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

index 2728362..abd6751 100644 (file)
@@ -1,3 +1,12 @@
+2010-07-06  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Implement InTableBodyMode
+        https://bugs.webkit.org/show_bug.cgi?id=41671
+
+        * html5lib/runner-expected-html5.txt:
+
 2010-07-06  Varun Jain  <varunjain@chromium.org>
 
         Reviewed by Oliver Hunt.
index 4ce30de..4c059a2 100644 (file)
@@ -1,9 +1,9 @@
 CONSOLE MESSAGE: line 1: SyntaxError: Parse error
+CONSOLE MESSAGE: line 1: SyntaxError: Parse error
 CONSOLE MESSAGE: line 2: PASS
 CONSOLE MESSAGE: line 2: FOO<span>BAR</span>BAZ
 Content-Type: text/plain
 resources/tests1.dat:
-21
 30
 32
 33
@@ -16,35 +16,10 @@ resources/tests1.dat:
 90
 103
 104
-107
 109
 110
 112
 
-Test 21 of 113 in resources/tests1.dat failed. Input:
-<b><table><td></b><i></table>X
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <b>
-|       <table>
-|         <tbody>
-|           <tr>
-|             <td>
-|               <i>
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <b>
-|       <table>
-|         <tbody>
-|           <tr>
-|             <td>
-|               <i>
-|       "X"
-
 Test 30 of 113 in resources/tests1.dat failed. Input:
 <a><table><td><a><table></table><a></tr><a></table><b>X</b>C<a>Y
 Got:
@@ -59,6 +34,13 @@ Got:
 |               <a>
 |                 <table>
 |               <a>
+|           <a>
+|       <a>
+|         <b>
+|           "X"
+|         "C"
+|       <a>
+|         "Y"
 Expected:
 | <html>
 |   <head>
@@ -212,6 +194,8 @@ Got:
 |         <tbody>
 |           <tr>
 |             <td>
+|           "x"
+|     "aoe"
 Expected:
 | <html>
 |   <head>
@@ -249,6 +233,8 @@ Got:
 |               <a>
 |                 href="foo"
 |                 "br"
+|           "x"
+|       "aoe"
 Expected:
 | <html>
 |   <head>
@@ -281,6 +267,8 @@ Got:
 |             <a>
 |               href="foo"
 |               "br"
+|         "x"
+|     "aoe"
 Expected:
 | <html>
 |   <head>
@@ -369,6 +357,8 @@ Got:
 |               <a>
 |                 <table>
 |               <a>
+|           <a>
+|       <a>
 Expected:
 | <html>
 |   <head>
@@ -421,30 +411,6 @@ Expected:
 |           <em>
 |       <li>
 
-Test 107 of 113 in resources/tests1.dat failed. Input:
-<h1><table><td><h3></table><h3></h1>
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <h1>
-|       <table>
-|         <tbody>
-|           <tr>
-|             <td>
-|               <h3>
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <h1>
-|       <table>
-|         <tbody>
-|           <tr>
-|             <td>
-|               <h3>
-|     <h3>
-
 Test 109 of 113 in resources/tests1.dat failed. Input:
 <table><col><tbody><col><tr><col><td><col></table><col>
 Got:
@@ -455,7 +421,13 @@ Got:
 |       <colgroup>
 |         <col>
 |       <tbody>
+|       <colgroup>
+|         <col>
+|       <tbody>
 |         <tr>
+|       <colgroup>
+|         <col>
+|       <tbody>
 |         <tr>
 |           <td>
 Expected:
@@ -487,7 +459,11 @@ Got:
 |     <table>
 |       <colgroup>
 |       <tbody>
+|       <colgroup>
+|       <tbody>
 |         <tr>
+|       <colgroup>
+|       <tbody>
 |         <tr>
 |           <td>
 Expected:
@@ -515,6 +491,7 @@ Got:
 |     <table>
 |       <tbody>
 |         <tr>
+|     <p>
 Expected:
 | <html>
 |   <head>
@@ -1189,7 +1166,6 @@ resources/tests7.dat:
 6
 7
 8
-10
 15
 16
 17
@@ -1295,28 +1271,6 @@ Expected:
 |   <head>
 |   <body>
 
-Test 10 of 30 in resources/tests7.dat failed. Input:
-<!doctype html><table><TBODY><script> <tr>x </script> </table>
-Got:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           "x  "
-Expected:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <script>
-|           " <tr>x "
-|         " "
-
 Test 15 of 30 in resources/tests7.dat failed. Input:
 <!doctype html><table><input type=hidDEN></table>
 Got:
@@ -1454,6 +1408,8 @@ Got:
 |         <tr>
 |           <td>
 |             "aaa"
+|         "bbb"
+|     "ccc"
 Expected:
 | <html>
 |   <head>
@@ -1480,6 +1436,7 @@ Got:
 |       <tbody>
 |         <tr>
 |           " B"
+|         " B"
 Expected:
 | <html>
 |   <head>
@@ -1500,6 +1457,7 @@ Got:
 |       <tbody>
 |         <tr>
 |           " B"
+|         " C"
 Expected:
 | <html>
 |   <head>
@@ -1692,7 +1650,6 @@ resources/tests9.dat:
 13
 14
 15
-16
 17
 18
 19
@@ -1803,6 +1760,11 @@ Got:
 |   <body>
 |     <table>
 |       <tbody>
+|         <math>
+|           <mi>
+|             "foo"
+|           <mi>
+|             "bar"
 Expected:
 | <!DOCTYPE html>
 | <html>
@@ -2041,33 +2003,6 @@ Expected:
 |     <p>
 |       "quux"
 
-Test 16 of 25 in resources/tests9.dat failed. Input:
-<!DOCTYPE html><body><table><tr><td><select><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux
-Got:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             <select>
-|               "foobarbaz"
-Expected:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             <select>
-|               "foobarbaz"
-|     <p>
-|       "quux"
-
 Test 17 of 25 in resources/tests9.dat failed. Input:
 <!DOCTYPE html><body><table><select><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux
 Got:
@@ -2254,7 +2189,6 @@ resources/tests10.dat:
 13
 14
 15
-16
 17
 18
 19
@@ -2365,6 +2299,11 @@ Got:
 |   <body>
 |     <table>
 |       <tbody>
+|         <svg>
+|           <g>
+|             "foo"
+|           <g>
+|             "bar"
 Expected:
 | <!DOCTYPE html>
 | <html>
@@ -2603,33 +2542,6 @@ Expected:
 |     <p>
 |       "quux"
 
-Test 16 of 25 in resources/tests10.dat failed. Input:
-<!DOCTYPE html><body><table><tr><td><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux
-Got:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             <select>
-|               "foobarbaz"
-Expected:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             <select>
-|               "foobarbaz"
-|     <p>
-|       "quux"
-
 Test 17 of 25 in resources/tests10.dat failed. Input:
 <!DOCTYPE html><body><table><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux
 Got:
@@ -3764,6 +3676,9 @@ Got:
 |           <tr>
 |             <td>
 |               <img>
+|       <g>
+|         "quux"
+|       "bar"
 Expected:
 | <!DOCTYPE html>
 | <html>
@@ -3819,6 +3734,9 @@ Got:
 |                     <tr>
 |                       <td>
 |                         <img>
+|                 <g>
+|                   "quux"
+|                 "bar"
 Expected:
 | <!DOCTYPE html>
 | <html>
@@ -4216,8 +4134,6 @@ resources/tables01.dat:
 8
 9
 10
-12
-13
 
 Test 4 of 14 in resources/tables01.dat failed. Input:
 <table><colgroup></html>foo
@@ -4312,44 +4228,4 @@ Expected:
 |         <tr>
 |           <td>
 |             "B"
-
-Test 12 of 14 in resources/tables01.dat failed. Input:
-<table><td>A</table>B
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             "A"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             "A"
-|     "B"
-
-Test 13 of 14 in resources/tables01.dat failed. Input:
-<table><tr><caption>
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <tbody>
-|         <tr>
-|       <caption>
 #EOF
index d3d6348..d19c2c5 100644 (file)
@@ -1,3 +1,28 @@
+2010-07-06  Adam Barth  <abarth@webkit.org>
+
+        Reviewed by Eric Seidel.
+
+        Implement InTableBodyMode
+        https://bugs.webkit.org/show_bug.cgi?id=41671
+
+        In the process of implementing this patch, Eric and I discussed some of
+        the high-level organization of the HTMLTreeBuilder class.  We'd like to
+        split it up into smaller pieces.  In the meantime, I've reordered some
+        of the declarations in the header to make the relations between the
+        different kinds of functions clearer.
+
+        * html/HTMLElementStack.cpp:
+        * html/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processIsindexStartTagForInBody):
+        (WebCore::HTMLTreeBuilder::processStartTagForInBody):
+        (WebCore::HTMLTreeBuilder::processStartTagForInTable):
+        (WebCore::HTMLTreeBuilder::processStartTag):
+        (WebCore::HTMLTreeBuilder::processEndTagForInTable):
+        (WebCore::HTMLTreeBuilder::processEndTag):
+        (WebCore::HTMLTreeBuilder::processCharacter):
+        (WebCore::HTMLTreeBuilder::processEndOfFile):
+        * html/HTMLTreeBuilder.h:
+
 2010-07-06  Leandro Pereira  <leandro@profusion.mobi>
 
         Unreviewed build fix.
index 2e9282f..0a1e11b 100644 (file)
@@ -62,6 +62,7 @@ inline bool isListItemScopeMarker(Element* element)
         || element->hasTagName(olTag)
         || element->hasTagName(ulTag);
 }
+
 inline bool isTableScopeMarker(Element* element)
 {
     return element->hasTagName(tableTag)
index b50843d..9ed1dd5 100644 (file)
@@ -493,8 +493,10 @@ PassRefPtr<NamedNodeMap> HTMLTreeBuilder::attributesForIsindexInput(AtomicHTMLTo
     return attributes.release();
 }
 
-void HTMLTreeBuilder::processIsindexStartTagForBody(AtomicHTMLToken& token)
+void HTMLTreeBuilder::processIsindexStartTagForInBody(AtomicHTMLToken& token)
 {
+    ASSERT(token.type() == HTMLToken::StartTag);
+    ASSERT(token.name() == isindexTag);
     parseError(token);
     if (m_formElement)
         return;
@@ -666,7 +668,7 @@ void HTMLTreeBuilder::processStartTagForInBody(AtomicHTMLToken& token)
         return;
     }
     if (token.name() == isindexTag) {
-        processIsindexStartTagForBody(token);
+        processIsindexStartTagForInBody(token);
         return;
     }
     if (token.name() == textareaTag) {
@@ -770,6 +772,65 @@ void HTMLTreeBuilder::closeTheCell()
     ASSERT(insertionMode() == InRowMode);
 }
 
+void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken& token)
+{
+    ASSERT(token.type() == HTMLToken::StartTag);
+    if (token.name() == captionTag) {
+        m_openElements.popUntilTableScopeMarker();
+        m_activeFormattingElements.appendMarker();
+        insertElement(token);
+        m_insertionMode = InCaptionMode;
+        return;
+    }
+    if (token.name() == colgroupTag) {
+        m_openElements.popUntilTableScopeMarker();
+        insertElement(token);
+        m_insertionMode = InColumnGroupMode;
+        return;
+    }
+    if (token.name() == colTag) {
+        processFakeStartTag(colgroupTag);
+        ASSERT(InColumnGroupMode);
+        processStartTag(token);
+        return;
+    }
+    if (isTableBodyContextTag(token.name())) {
+        m_openElements.popUntilTableScopeMarker();
+        insertElement(token);
+        m_insertionMode = InTableBodyMode;
+        return;
+    }
+    if (token.name() == tdTag || token.name() == thTag || token.name() == trTag) {
+        processFakeStartTag(tbodyTag);
+        ASSERT(insertionMode() == InTableBodyMode);
+        processStartTag(token);
+        return;
+    }
+    if (token.name() == tableTag) {
+        notImplemented();
+        return;
+    }
+    if (token.name() == styleTag || token.name() == scriptTag) {
+        processStartTagForInHead(token);
+        return;
+    }
+    if (token.name() == inputTag) {
+        notImplemented();
+        return;
+    }
+    if (token.name() == formTag) {
+        parseError(token);
+        if (m_formElement)
+            return;
+        insertSelfClosingElement(token);
+        return;
+    }
+    parseError(token);
+    if (currentElement()->hasTagName(tableTag) || isTableBodyContextTag(currentElement()->localName()) || currentElement()->hasTagName(trTag))
+        notImplemented(); // "whenever a node would be inserted into the current node, it must instead be foster parented."
+    processStartTagForInBody(token);
+}
+
 void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token)
 {
     ASSERT(token.type() == HTMLToken::StartTag);
@@ -843,60 +904,7 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token)
         break;
     case InTableMode:
         ASSERT(insertionMode() == InTableMode);
-        if (token.name() == captionTag) {
-            m_openElements.popUntilTableScopeMarker();
-            m_activeFormattingElements.appendMarker();
-            insertElement(token);
-            m_insertionMode = InCaptionMode;
-            return;
-        }
-        if (token.name() == colgroupTag) {
-            m_openElements.popUntilTableScopeMarker();
-            insertElement(token);
-            m_insertionMode = InColumnGroupMode;
-            return;
-        }
-        if (token.name() == colTag) {
-            processFakeStartTag(colgroupTag);
-            ASSERT(InColumnGroupMode);
-            processStartTag(token);
-            return;
-        }
-        if (isTableBodyContextTag(token.name())) {
-            m_openElements.popUntilTableScopeMarker();
-            insertElement(token);
-            m_insertionMode = InTableBodyMode;
-            return;
-        }
-        if (token.name() == tdTag || token.name() == thTag || token.name() == trTag) {
-            processFakeStartTag(tbodyTag);
-            ASSERT(insertionMode() == InTableBodyMode);
-            processStartTag(token);
-            return;
-        }
-        if (token.name() == tableTag) {
-            notImplemented();
-            return;
-        }
-        if (token.name() == styleTag || token.name() == scriptTag) {
-            processStartTagForInHead(token);
-            return;
-        }
-        if (token.name() == inputTag) {
-            notImplemented();
-            return;
-        }
-        if (token.name() == formTag) {
-            parseError(token);
-            if (m_formElement)
-                return;
-            insertSelfClosingElement(token);
-            return;
-        }
-        parseError(token);
-        if (currentElement()->hasTagName(tableTag) || isTableBodyContextTag(currentElement()->localName()) || currentElement()->hasTagName(trTag))
-            notImplemented(); // "whenever a node would be inserted into the current node, it must instead be foster parented."
-        processStartTagForInBody(token);
+        processStartTagForInTable(token);
         break;
     case InCaptionMode:
         ASSERT(insertionMode() == InCaptionMode);
@@ -943,10 +951,19 @@ void HTMLTreeBuilder::processStartTag(AtomicHTMLToken& token)
             return;
         }
         if (token.name() == captionTag || token.name() == colTag || token.name() == colgroupTag || isTableBodyContextTag(token.name())) {
-            notImplemented();
+            // FIXME: This is slow.
+            if (!m_openElements.inTableScope(tbodyTag.localName()) && !m_openElements.inTableScope(theadTag.localName()) && !m_openElements.inTableScope(tfootTag.localName())) {
+                ASSERT(m_isParsingFragment);
+                parseError(token);
+                return;
+            }
+            m_openElements.popUntilTableBodyScopeMarker();
+            ASSERT(currentElement()->tagQName() == tbodyTag || currentElement()->tagQName() == tfootTag || currentElement()->tagQName() == theadTag);
+            processFakeEndTag(currentElement()->tagQName());
+            processStartTag(token);
             return;
         }
-        notImplemented(); // process using "in table" rules
+        processStartTagForInTable(token);
         break;
     case InRowMode:
         ASSERT(insertionMode() == InRowMode);
@@ -1521,6 +1538,28 @@ bool HTMLTreeBuilder::processTrEndTagForInRow()
     return true;
 }
 
+void HTMLTreeBuilder::processEndTagForInTable(AtomicHTMLToken& token)
+{
+    ASSERT(token.type() == HTMLToken::EndTag);
+    if (token.name() == tableTag) {
+        if (!m_openElements.inTableScope(token.name())) {
+            ASSERT(m_isParsingFragment);
+            parseError(token);
+            return;
+        }
+        m_openElements.popUntil(tableTag.localName());
+        m_openElements.pop();
+        resetInsertionModeAppropriately();
+        return;
+    }
+    if (token.name() == bodyTag || token.name() == captionTag || token.name() == colTag || token.name() == colgroupTag || token.name() == htmlTag || token.name() == tbodyTag || token.name() == tdTag || token.name() == tfootTag || token.name() == thTag || token.name() == theadTag || token.name() == trTag) {
+        parseError(token);
+        return;
+    }
+    // FIXME: Do we need to worry about "whenever a node would be inserted into the current node, it must instead be foster parented"?
+    processEndTagForInBody(token);
+}
+
 void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token)
 {
     ASSERT(token.type() == HTMLToken::EndTag);
@@ -1572,23 +1611,7 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token)
         break;
     case InTableMode:
         ASSERT(insertionMode() == InTableMode);
-        if (token.name() == tableTag) {
-            if (!m_openElements.inTableScope(token.name())) {
-                ASSERT(m_isParsingFragment);
-                parseError(token);
-                return;
-            }
-            m_openElements.popUntil(tableTag.localName());
-            m_openElements.pop();
-            resetInsertionModeAppropriately();
-            return;
-        }
-        if (token.name() == bodyTag || token.name() == captionTag || token.name() == colTag || token.name() == colgroupTag || token.name() == htmlTag || token.name() == tbodyTag || token.name() == tdTag || token.name() == tfootTag || token.name() == thTag || token.name() == theadTag || token.name() == trTag) {
-            parseError(token);
-            return;
-        }
-        // FIXME: Do we need to worry about "whenever a node would be inserted into the current node, it must instead be foster parented"?
-        processEndTagForInBody(token);
+        processEndTagForInTable(token);
         break;
     case InCaptionMode:
         ASSERT(insertionMode() == InCaptionMode);
@@ -1693,6 +1716,37 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token)
         }
         processEndTagForInBody(token);
         break;
+    case InTableBodyMode:
+        ASSERT(insertionMode() == InTableBodyMode);
+        if (token.name() == tbodyTag || token.name() == tfootTag || token.name() == theadTag) {
+            if (!m_openElements.inTableScope(token.name())) {
+                parseError(token);
+                return;
+            }
+            m_openElements.popUntilTableBodyScopeMarker();
+            m_openElements.pop();
+            m_insertionMode = InTableMode;
+            return;
+        }
+        if (token.name() == tableTag) {
+            // FIXME: This is slow.
+            if (!m_openElements.inTableScope(tbodyTag.localName()) && !m_openElements.inTableScope(theadTag.localName()) && !m_openElements.inTableScope(tfootTag.localName())) {
+                ASSERT(m_isParsingFragment);
+                parseError(token);
+                return;
+            }
+            m_openElements.popUntilTableBodyScopeMarker();
+            ASSERT(currentElement()->tagQName() == tbodyTag || currentElement()->tagQName() == tfootTag || currentElement()->tagQName() == theadTag);
+            processFakeEndTag(currentElement()->tagQName());
+            processEndTag(token);
+            return;
+        }
+        if (token.name() == bodyTag || token.name() == captionTag || token.name() == colTag || token.name() == colgroupTag || token.name() == htmlTag || token.name() == tdTag || token.name() == thTag || token.name() == trTag) {
+            parseError(token);
+            return;
+        }
+        processEndTagForInTable(token);
+        break;
     case AfterBodyMode:
         ASSERT(insertionMode() == AfterBodyMode);
         if (token.name() == htmlTag) {
@@ -1860,8 +1914,9 @@ void HTMLTreeBuilder::processCharacter(AtomicHTMLToken& token)
         insertTextNode(token);
         break;
     case InTableMode:
+    case InTableBodyMode:
     case InRowMode:
-        ASSERT(insertionMode() == InTableMode || insertionMode() == InRowMode);
+        ASSERT(insertionMode() == InTableMode || insertionMode() == InTableBodyMode || insertionMode() == InRowMode);
         notImplemented(); // Crazy pending characters.
         insertTextNode(token);
         break;
@@ -1946,9 +2001,10 @@ void HTMLTreeBuilder::processEndOfFile(AtomicHTMLToken& token)
         break;
     case InFramesetMode:
     case InTableMode:
+    case InTableBodyMode:
     case InSelectInTableMode:
     case InSelectMode:
-        ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode || insertionMode() == InTableMode || insertionMode() == InFramesetMode);
+        ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode || insertionMode() == InTableMode || insertionMode() == InFramesetMode || insertionMode() == InTableBodyMode);
         if (currentElement() != m_openElements.htmlElement())
             parseError(token);
         break;
index 293b9a8..203f586 100644 (file)
@@ -104,8 +104,8 @@ private:
 
     void passTokenToLegacyParser(HTMLToken&);
 
-    // Specialized functions for processing the different types of tokens.
     void processToken(AtomicHTMLToken&);
+
     void processDoctypeToken(AtomicHTMLToken&);
     void processStartTag(AtomicHTMLToken&);
     void processEndTag(AtomicHTMLToken&);
@@ -113,23 +113,19 @@ private:
     void processCharacter(AtomicHTMLToken&);
     void processEndOfFile(AtomicHTMLToken&);
 
-    // Default processing for the different insertion modes.
-    void processDefaultForInitialMode(AtomicHTMLToken&);
-    void processDefaultForBeforeHTMLMode(AtomicHTMLToken&);
-    void processDefaultForBeforeHeadMode(AtomicHTMLToken&);
-    void processDefaultForInHeadMode(AtomicHTMLToken&);
-    void processDefaultForInHeadNoscriptMode(AtomicHTMLToken&);
-    void processDefaultForAfterHeadMode(AtomicHTMLToken&);
-
     bool processStartTagForInHead(AtomicHTMLToken&);
     void processStartTagForInBody(AtomicHTMLToken&);
+    void processStartTagForInTable(AtomicHTMLToken&);
     void processEndTagForInBody(AtomicHTMLToken&);
-    PassRefPtr<NamedNodeMap> attributesForIsindexInput(AtomicHTMLToken&);
-    void processIsindexStartTagForBody(AtomicHTMLToken&);
+    void processEndTagForInTable(AtomicHTMLToken&);
+
+    void processIsindexStartTagForInBody(AtomicHTMLToken&);
     bool processBodyEndTagForInBody(AtomicHTMLToken&);
     bool processCaptionEndTagForInCaption();
     bool processColgroupEndTagForInColumnGroup();
     bool processTrEndTagForInRow();
+    // FIXME: This function should be inlined into its one call site or it
+    // needs to assert which tokens it can be called with.
     void processAnyOtherEndTagForInBody(AtomicHTMLToken&);
 
     void processFakeStartTag(const QualifiedName&, PassRefPtr<NamedNodeMap> attributes = 0);
@@ -137,6 +133,17 @@ private:
     void processFakeCharacters(const String&);
     void processFakePEndTagIfPInScope();
 
+    // Default processing for the different insertion modes.
+    // FIXME: These functions need to be renamed to remove "process" from their names.
+    void processDefaultForInitialMode(AtomicHTMLToken&);
+    void processDefaultForBeforeHTMLMode(AtomicHTMLToken&);
+    void processDefaultForBeforeHeadMode(AtomicHTMLToken&);
+    void processDefaultForInHeadMode(AtomicHTMLToken&);
+    void processDefaultForInHeadNoscriptMode(AtomicHTMLToken&);
+    void processDefaultForAfterHeadMode(AtomicHTMLToken&);
+
+    PassRefPtr<NamedNodeMap> attributesForIsindexInput(AtomicHTMLToken&);
+
     HTMLElementStack::ElementRecord* furthestBlockForFormattingElement(Element*);
     void findFosterParentFor(Element*);
     void reparentChildren(Element* oldParent, Element* newParent);