Changeset 62573 in webkit
- Timestamp:
- Jul 6, 2010 11:33:36 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r62568 r62573 1 2010-07-06 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Implement InTableBodyMode 6 https://bugs.webkit.org/show_bug.cgi?id=41671 7 8 * html5lib/runner-expected-html5.txt: 9 1 10 2010-07-06 Varun Jain <varunjain@chromium.org> 2 11 -
trunk/LayoutTests/html5lib/runner-expected-html5.txt
r62563 r62573 1 CONSOLE MESSAGE: line 1: SyntaxError: Parse error 1 2 CONSOLE MESSAGE: line 1: SyntaxError: Parse error 2 3 CONSOLE MESSAGE: line 2: PASS … … 4 5 Content-Type: text/plain 5 6 resources/tests1.dat: 6 217 7 30 8 8 32 … … 17 17 103 18 18 104 19 10720 19 109 21 20 110 22 21 112 23 24 Test 21 of 113 in resources/tests1.dat failed. Input:25 <b><table><td></b><i></table>X26 Got:27 | <html>28 | <head>29 | <body>30 | <b>31 | <table>32 | <tbody>33 | <tr>34 | <td>35 | <i>36 Expected:37 | <html>38 | <head>39 | <body>40 | <b>41 | <table>42 | <tbody>43 | <tr>44 | <td>45 | <i>46 | "X"47 22 48 23 Test 30 of 113 in resources/tests1.dat failed. Input: … … 60 35 | <table> 61 36 | <a> 37 | <a> 38 | <a> 39 | <b> 40 | "X" 41 | "C" 42 | <a> 43 | "Y" 62 44 Expected: 63 45 | <html> … … 213 195 | <tr> 214 196 | <td> 197 | "x" 198 | "aoe" 215 199 Expected: 216 200 | <html> … … 250 234 | href="foo" 251 235 | "br" 236 | "x" 237 | "aoe" 252 238 Expected: 253 239 | <html> … … 282 268 | href="foo" 283 269 | "br" 270 | "x" 271 | "aoe" 284 272 Expected: 285 273 | <html> … … 370 358 | <table> 371 359 | <a> 360 | <a> 361 | <a> 372 362 Expected: 373 363 | <html> … … 422 412 | <li> 423 413 424 Test 107 of 113 in resources/tests1.dat failed. Input:425 <h1><table><td><h3></table><h3></h1>426 Got:427 | <html>428 | <head>429 | <body>430 | <h1>431 | <table>432 | <tbody>433 | <tr>434 | <td>435 | <h3>436 Expected:437 | <html>438 | <head>439 | <body>440 | <h1>441 | <table>442 | <tbody>443 | <tr>444 | <td>445 | <h3>446 | <h3>447 448 414 Test 109 of 113 in resources/tests1.dat failed. Input: 449 415 <table><col><tbody><col><tr><col><td><col></table><col> … … 456 422 | <col> 457 423 | <tbody> 458 | <tr> 424 | <colgroup> 425 | <col> 426 | <tbody> 427 | <tr> 428 | <colgroup> 429 | <col> 430 | <tbody> 459 431 | <tr> 460 432 | <td> … … 488 460 | <colgroup> 489 461 | <tbody> 490 | <tr> 462 | <colgroup> 463 | <tbody> 464 | <tr> 465 | <colgroup> 466 | <tbody> 491 467 | <tr> 492 468 | <td> … … 516 492 | <tbody> 517 493 | <tr> 494 | <p> 518 495 Expected: 519 496 | <html> … … 1190 1167 7 1191 1168 8 1192 101193 1169 15 1194 1170 16 … … 1296 1272 | <body> 1297 1273 1298 Test 10 of 30 in resources/tests7.dat failed. Input:1299 <!doctype html><table><TBODY><script> <tr>x </script> </table>1300 Got:1301 | <!DOCTYPE html>1302 | <html>1303 | <head>1304 | <body>1305 | <table>1306 | <tbody>1307 | <tr>1308 | "x "1309 Expected:1310 | <!DOCTYPE html>1311 | <html>1312 | <head>1313 | <body>1314 | <table>1315 | <tbody>1316 | <script>1317 | " <tr>x "1318 | " "1319 1320 1274 Test 15 of 30 in resources/tests7.dat failed. Input: 1321 1275 <!doctype html><table><input type=hidDEN></table> … … 1455 1409 | <td> 1456 1410 | "aaa" 1411 | "bbb" 1412 | "ccc" 1457 1413 Expected: 1458 1414 | <html> … … 1481 1437 | <tr> 1482 1438 | " B" 1439 | " B" 1483 1440 Expected: 1484 1441 | <html> … … 1501 1458 | <tr> 1502 1459 | " B" 1460 | " C" 1503 1461 Expected: 1504 1462 | <html> … … 1693 1651 14 1694 1652 15 1695 161696 1653 17 1697 1654 18 … … 1804 1761 | <table> 1805 1762 | <tbody> 1763 | <math> 1764 | <mi> 1765 | "foo" 1766 | <mi> 1767 | "bar" 1806 1768 Expected: 1807 1769 | <!DOCTYPE html> … … 2039 2001 | <table> 2040 2002 | <colgroup> 2041 | <p>2042 | "quux"2043 2044 Test 16 of 25 in resources/tests9.dat failed. Input:2045 <!DOCTYPE html><body><table><tr><td><select><math><mi>foo</mi><mi>bar</mi><p>baz</table><p>quux2046 Got:2047 | <!DOCTYPE html>2048 | <html>2049 | <head>2050 | <body>2051 | <table>2052 | <tbody>2053 | <tr>2054 | <td>2055 | <select>2056 | "foobarbaz"2057 Expected:2058 | <!DOCTYPE html>2059 | <html>2060 | <head>2061 | <body>2062 | <table>2063 | <tbody>2064 | <tr>2065 | <td>2066 | <select>2067 | "foobarbaz"2068 2003 | <p> 2069 2004 | "quux" … … 2255 2190 14 2256 2191 15 2257 162258 2192 17 2259 2193 18 … … 2366 2300 | <table> 2367 2301 | <tbody> 2302 | <svg> 2303 | <g> 2304 | "foo" 2305 | <g> 2306 | "bar" 2368 2307 Expected: 2369 2308 | <!DOCTYPE html> … … 2601 2540 | <table> 2602 2541 | <colgroup> 2603 | <p>2604 | "quux"2605 2606 Test 16 of 25 in resources/tests10.dat failed. Input:2607 <!DOCTYPE html><body><table><tr><td><select><svg><g>foo</g><g>bar</g><p>baz</table><p>quux2608 Got:2609 | <!DOCTYPE html>2610 | <html>2611 | <head>2612 | <body>2613 | <table>2614 | <tbody>2615 | <tr>2616 | <td>2617 | <select>2618 | "foobarbaz"2619 Expected:2620 | <!DOCTYPE html>2621 | <html>2622 | <head>2623 | <body>2624 | <table>2625 | <tbody>2626 | <tr>2627 | <td>2628 | <select>2629 | "foobarbaz"2630 2542 | <p> 2631 2543 | "quux" … … 3765 3677 | <td> 3766 3678 | <img> 3679 | <g> 3680 | "quux" 3681 | "bar" 3767 3682 Expected: 3768 3683 | <!DOCTYPE html> … … 3820 3735 | <td> 3821 3736 | <img> 3737 | <g> 3738 | "quux" 3739 | "bar" 3822 3740 Expected: 3823 3741 | <!DOCTYPE html> … … 4217 4135 9 4218 4136 10 4219 124220 134221 4137 4222 4138 Test 4 of 14 in resources/tables01.dat failed. Input: … … 4313 4229 | <td> 4314 4230 | "B" 4315 4316 Test 12 of 14 in resources/tables01.dat failed. Input:4317 <table><td>A</table>B4318 Got:4319 | <html>4320 | <head>4321 | <body>4322 | <table>4323 | <tbody>4324 | <tr>4325 | <td>4326 | "A"4327 Expected:4328 | <html>4329 | <head>4330 | <body>4331 | <table>4332 | <tbody>4333 | <tr>4334 | <td>4335 | "A"4336 | "B"4337 4338 Test 13 of 14 in resources/tables01.dat failed. Input:4339 <table><tr><caption>4340 Got:4341 | <html>4342 | <head>4343 | <body>4344 | <table>4345 | <tbody>4346 | <tr>4347 Expected:4348 | <html>4349 | <head>4350 | <body>4351 | <table>4352 | <tbody>4353 | <tr>4354 | <caption>4355 4231 #EOF -
trunk/WebCore/ChangeLog
r62571 r62573 1 2010-07-06 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Eric Seidel. 4 5 Implement InTableBodyMode 6 https://bugs.webkit.org/show_bug.cgi?id=41671 7 8 In the process of implementing this patch, Eric and I discussed some of 9 the high-level organization of the HTMLTreeBuilder class. We'd like to 10 split it up into smaller pieces. In the meantime, I've reordered some 11 of the declarations in the header to make the relations between the 12 different kinds of functions clearer. 13 14 * html/HTMLElementStack.cpp: 15 * html/HTMLTreeBuilder.cpp: 16 (WebCore::HTMLTreeBuilder::processIsindexStartTagForInBody): 17 (WebCore::HTMLTreeBuilder::processStartTagForInBody): 18 (WebCore::HTMLTreeBuilder::processStartTagForInTable): 19 (WebCore::HTMLTreeBuilder::processStartTag): 20 (WebCore::HTMLTreeBuilder::processEndTagForInTable): 21 (WebCore::HTMLTreeBuilder::processEndTag): 22 (WebCore::HTMLTreeBuilder::processCharacter): 23 (WebCore::HTMLTreeBuilder::processEndOfFile): 24 * html/HTMLTreeBuilder.h: 25 1 26 2010-07-06 Leandro Pereira <leandro@profusion.mobi> 2 27 -
trunk/WebCore/html/HTMLElementStack.cpp
r62563 r62573 63 63 || element->hasTagName(ulTag); 64 64 } 65 65 66 inline bool isTableScopeMarker(Element* element) 66 67 { -
trunk/WebCore/html/HTMLTreeBuilder.cpp
r62563 r62573 494 494 } 495 495 496 void HTMLTreeBuilder::processIsindexStartTagForBody(AtomicHTMLToken& token) 497 { 496 void HTMLTreeBuilder::processIsindexStartTagForInBody(AtomicHTMLToken& token) 497 { 498 ASSERT(token.type() == HTMLToken::StartTag); 499 ASSERT(token.name() == isindexTag); 498 500 parseError(token); 499 501 if (m_formElement) … … 667 669 } 668 670 if (token.name() == isindexTag) { 669 processIsindexStartTagFor Body(token);671 processIsindexStartTagForInBody(token); 670 672 return; 671 673 } … … 769 771 processFakeEndTag(thTag); 770 772 ASSERT(insertionMode() == InRowMode); 773 } 774 775 void HTMLTreeBuilder::processStartTagForInTable(AtomicHTMLToken& token) 776 { 777 ASSERT(token.type() == HTMLToken::StartTag); 778 if (token.name() == captionTag) { 779 m_openElements.popUntilTableScopeMarker(); 780 m_activeFormattingElements.appendMarker(); 781 insertElement(token); 782 m_insertionMode = InCaptionMode; 783 return; 784 } 785 if (token.name() == colgroupTag) { 786 m_openElements.popUntilTableScopeMarker(); 787 insertElement(token); 788 m_insertionMode = InColumnGroupMode; 789 return; 790 } 791 if (token.name() == colTag) { 792 processFakeStartTag(colgroupTag); 793 ASSERT(InColumnGroupMode); 794 processStartTag(token); 795 return; 796 } 797 if (isTableBodyContextTag(token.name())) { 798 m_openElements.popUntilTableScopeMarker(); 799 insertElement(token); 800 m_insertionMode = InTableBodyMode; 801 return; 802 } 803 if (token.name() == tdTag || token.name() == thTag || token.name() == trTag) { 804 processFakeStartTag(tbodyTag); 805 ASSERT(insertionMode() == InTableBodyMode); 806 processStartTag(token); 807 return; 808 } 809 if (token.name() == tableTag) { 810 notImplemented(); 811 return; 812 } 813 if (token.name() == styleTag || token.name() == scriptTag) { 814 processStartTagForInHead(token); 815 return; 816 } 817 if (token.name() == inputTag) { 818 notImplemented(); 819 return; 820 } 821 if (token.name() == formTag) { 822 parseError(token); 823 if (m_formElement) 824 return; 825 insertSelfClosingElement(token); 826 return; 827 } 828 parseError(token); 829 if (currentElement()->hasTagName(tableTag) || isTableBodyContextTag(currentElement()->localName()) || currentElement()->hasTagName(trTag)) 830 notImplemented(); // "whenever a node would be inserted into the current node, it must instead be foster parented." 831 processStartTagForInBody(token); 771 832 } 772 833 … … 844 905 case InTableMode: 845 906 ASSERT(insertionMode() == InTableMode); 846 if (token.name() == captionTag) { 847 m_openElements.popUntilTableScopeMarker(); 848 m_activeFormattingElements.appendMarker(); 849 insertElement(token); 850 m_insertionMode = InCaptionMode; 851 return; 852 } 853 if (token.name() == colgroupTag) { 854 m_openElements.popUntilTableScopeMarker(); 855 insertElement(token); 856 m_insertionMode = InColumnGroupMode; 857 return; 858 } 859 if (token.name() == colTag) { 860 processFakeStartTag(colgroupTag); 861 ASSERT(InColumnGroupMode); 862 processStartTag(token); 863 return; 864 } 865 if (isTableBodyContextTag(token.name())) { 866 m_openElements.popUntilTableScopeMarker(); 867 insertElement(token); 868 m_insertionMode = InTableBodyMode; 869 return; 870 } 871 if (token.name() == tdTag || token.name() == thTag || token.name() == trTag) { 872 processFakeStartTag(tbodyTag); 873 ASSERT(insertionMode() == InTableBodyMode); 874 processStartTag(token); 875 return; 876 } 877 if (token.name() == tableTag) { 878 notImplemented(); 879 return; 880 } 881 if (token.name() == styleTag || token.name() == scriptTag) { 882 processStartTagForInHead(token); 883 return; 884 } 885 if (token.name() == inputTag) { 886 notImplemented(); 887 return; 888 } 889 if (token.name() == formTag) { 890 parseError(token); 891 if (m_formElement) 892 return; 893 insertSelfClosingElement(token); 894 return; 895 } 896 parseError(token); 897 if (currentElement()->hasTagName(tableTag) || isTableBodyContextTag(currentElement()->localName()) || currentElement()->hasTagName(trTag)) 898 notImplemented(); // "whenever a node would be inserted into the current node, it must instead be foster parented." 899 processStartTagForInBody(token); 907 processStartTagForInTable(token); 900 908 break; 901 909 case InCaptionMode: … … 944 952 } 945 953 if (token.name() == captionTag || token.name() == colTag || token.name() == colgroupTag || isTableBodyContextTag(token.name())) { 946 notImplemented(); 947 return; 948 } 949 notImplemented(); // process using "in table" rules 954 // FIXME: This is slow. 955 if (!m_openElements.inTableScope(tbodyTag.localName()) && !m_openElements.inTableScope(theadTag.localName()) && !m_openElements.inTableScope(tfootTag.localName())) { 956 ASSERT(m_isParsingFragment); 957 parseError(token); 958 return; 959 } 960 m_openElements.popUntilTableBodyScopeMarker(); 961 ASSERT(currentElement()->tagQName() == tbodyTag || currentElement()->tagQName() == tfootTag || currentElement()->tagQName() == theadTag); 962 processFakeEndTag(currentElement()->tagQName()); 963 processStartTag(token); 964 return; 965 } 966 processStartTagForInTable(token); 950 967 break; 951 968 case InRowMode: … … 1522 1539 } 1523 1540 1541 void HTMLTreeBuilder::processEndTagForInTable(AtomicHTMLToken& token) 1542 { 1543 ASSERT(token.type() == HTMLToken::EndTag); 1544 if (token.name() == tableTag) { 1545 if (!m_openElements.inTableScope(token.name())) { 1546 ASSERT(m_isParsingFragment); 1547 parseError(token); 1548 return; 1549 } 1550 m_openElements.popUntil(tableTag.localName()); 1551 m_openElements.pop(); 1552 resetInsertionModeAppropriately(); 1553 return; 1554 } 1555 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) { 1556 parseError(token); 1557 return; 1558 } 1559 // FIXME: Do we need to worry about "whenever a node would be inserted into the current node, it must instead be foster parented"? 1560 processEndTagForInBody(token); 1561 } 1562 1524 1563 void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token) 1525 1564 { … … 1573 1612 case InTableMode: 1574 1613 ASSERT(insertionMode() == InTableMode); 1575 if (token.name() == tableTag) { 1576 if (!m_openElements.inTableScope(token.name())) { 1577 ASSERT(m_isParsingFragment); 1578 parseError(token); 1579 return; 1580 } 1581 m_openElements.popUntil(tableTag.localName()); 1582 m_openElements.pop(); 1583 resetInsertionModeAppropriately(); 1584 return; 1585 } 1586 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) { 1587 parseError(token); 1588 return; 1589 } 1590 // FIXME: Do we need to worry about "whenever a node would be inserted into the current node, it must instead be foster parented"? 1591 processEndTagForInBody(token); 1614 processEndTagForInTable(token); 1592 1615 break; 1593 1616 case InCaptionMode: … … 1694 1717 processEndTagForInBody(token); 1695 1718 break; 1719 case InTableBodyMode: 1720 ASSERT(insertionMode() == InTableBodyMode); 1721 if (token.name() == tbodyTag || token.name() == tfootTag || token.name() == theadTag) { 1722 if (!m_openElements.inTableScope(token.name())) { 1723 parseError(token); 1724 return; 1725 } 1726 m_openElements.popUntilTableBodyScopeMarker(); 1727 m_openElements.pop(); 1728 m_insertionMode = InTableMode; 1729 return; 1730 } 1731 if (token.name() == tableTag) { 1732 // FIXME: This is slow. 1733 if (!m_openElements.inTableScope(tbodyTag.localName()) && !m_openElements.inTableScope(theadTag.localName()) && !m_openElements.inTableScope(tfootTag.localName())) { 1734 ASSERT(m_isParsingFragment); 1735 parseError(token); 1736 return; 1737 } 1738 m_openElements.popUntilTableBodyScopeMarker(); 1739 ASSERT(currentElement()->tagQName() == tbodyTag || currentElement()->tagQName() == tfootTag || currentElement()->tagQName() == theadTag); 1740 processFakeEndTag(currentElement()->tagQName()); 1741 processEndTag(token); 1742 return; 1743 } 1744 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) { 1745 parseError(token); 1746 return; 1747 } 1748 processEndTagForInTable(token); 1749 break; 1696 1750 case AfterBodyMode: 1697 1751 ASSERT(insertionMode() == AfterBodyMode); … … 1861 1915 break; 1862 1916 case InTableMode: 1917 case InTableBodyMode: 1863 1918 case InRowMode: 1864 ASSERT(insertionMode() == InTableMode || insertionMode() == In RowMode);1919 ASSERT(insertionMode() == InTableMode || insertionMode() == InTableBodyMode || insertionMode() == InRowMode); 1865 1920 notImplemented(); // Crazy pending characters. 1866 1921 insertTextNode(token); … … 1947 2002 case InFramesetMode: 1948 2003 case InTableMode: 2004 case InTableBodyMode: 1949 2005 case InSelectInTableMode: 1950 2006 case InSelectMode: 1951 ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode || insertionMode() == InTableMode || insertionMode() == InFramesetMode );2007 ASSERT(insertionMode() == InSelectMode || insertionMode() == InSelectInTableMode || insertionMode() == InTableMode || insertionMode() == InFramesetMode || insertionMode() == InTableBodyMode); 1952 2008 if (currentElement() != m_openElements.htmlElement()) 1953 2009 parseError(token); -
trunk/WebCore/html/HTMLTreeBuilder.h
r62563 r62573 105 105 void passTokenToLegacyParser(HTMLToken&); 106 106 107 // Specialized functions for processing the different types of tokens.108 107 void processToken(AtomicHTMLToken&); 108 109 109 void processDoctypeToken(AtomicHTMLToken&); 110 110 void processStartTag(AtomicHTMLToken&); … … 114 114 void processEndOfFile(AtomicHTMLToken&); 115 115 116 bool processStartTagForInHead(AtomicHTMLToken&); 117 void processStartTagForInBody(AtomicHTMLToken&); 118 void processStartTagForInTable(AtomicHTMLToken&); 119 void processEndTagForInBody(AtomicHTMLToken&); 120 void processEndTagForInTable(AtomicHTMLToken&); 121 122 void processIsindexStartTagForInBody(AtomicHTMLToken&); 123 bool processBodyEndTagForInBody(AtomicHTMLToken&); 124 bool processCaptionEndTagForInCaption(); 125 bool processColgroupEndTagForInColumnGroup(); 126 bool processTrEndTagForInRow(); 127 // FIXME: This function should be inlined into its one call site or it 128 // needs to assert which tokens it can be called with. 129 void processAnyOtherEndTagForInBody(AtomicHTMLToken&); 130 131 void processFakeStartTag(const QualifiedName&, PassRefPtr<NamedNodeMap> attributes = 0); 132 void processFakeEndTag(const QualifiedName&); 133 void processFakeCharacters(const String&); 134 void processFakePEndTagIfPInScope(); 135 116 136 // Default processing for the different insertion modes. 137 // FIXME: These functions need to be renamed to remove "process" from their names. 117 138 void processDefaultForInitialMode(AtomicHTMLToken&); 118 139 void processDefaultForBeforeHTMLMode(AtomicHTMLToken&); … … 122 143 void processDefaultForAfterHeadMode(AtomicHTMLToken&); 123 144 124 bool processStartTagForInHead(AtomicHTMLToken&);125 void processStartTagForInBody(AtomicHTMLToken&);126 void processEndTagForInBody(AtomicHTMLToken&);127 145 PassRefPtr<NamedNodeMap> attributesForIsindexInput(AtomicHTMLToken&); 128 void processIsindexStartTagForBody(AtomicHTMLToken&);129 bool processBodyEndTagForInBody(AtomicHTMLToken&);130 bool processCaptionEndTagForInCaption();131 bool processColgroupEndTagForInColumnGroup();132 bool processTrEndTagForInRow();133 void processAnyOtherEndTagForInBody(AtomicHTMLToken&);134 135 void processFakeStartTag(const QualifiedName&, PassRefPtr<NamedNodeMap> attributes = 0);136 void processFakeEndTag(const QualifiedName&);137 void processFakeCharacters(const String&);138 void processFakePEndTagIfPInScope();139 146 140 147 HTMLElementStack::ElementRecord* furthestBlockForFormattingElement(Element*);
Note: See TracChangeset
for help on using the changeset viewer.