Changeset 62499 in webkit


Ignore:
Timestamp:
Jul 5, 2010 1:02:11 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-07-05 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

Add basic "in row" mode to support <td> and <th> insertion
https://bugs.webkit.org/show_bug.cgi?id=41588

Also fixed <td> or <th> as a direct child of <table>.

Most of this was covered by html5lib/runner.html tests,
but I had to add a new tables01.dat to cover the <th> cases.

  • html/HTMLElementStack.cpp: (WebCore::HTMLNames::isTableRowScopeMarker): (WebCore::HTMLElementStack::popUntilTableRowScopeMarker):
  • html/HTMLElementStack.h:
  • html/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processStartTag):

2010-07-05 Eric Seidel <eric@webkit.org>

Reviewed by Adam Barth.

Add basic "in row" mode to support <td> insertion
https://bugs.webkit.org/show_bug.cgi?id=41588

Added tables01.dat to test a previously untested
<table><th> case. I expect we'll add many more table
tests there as we complete our implementation.

  • html5lib/runner-expected-html5.txt:
  • html5lib/runner-expected.txt:
  • html5lib/runner.html:
  • html5lib/resources/tables01.dat: Added.
Location:
trunk
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r62498 r62499  
     12010-07-05  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add basic "in row" mode to support <td> insertion
     6        https://bugs.webkit.org/show_bug.cgi?id=41588
     7
     8        Added tables01.dat to test a previously untested
     9        <table><th> case.  I expect we'll add many more table
     10        tests there as we complete our implementation.
     11
     12        * html5lib/runner-expected-html5.txt:
     13        * html5lib/runner-expected.txt:
     14        * html5lib/runner.html:
     15        * html5lib/resources/tables01.dat: Added.
     16
    1172010-07-05  Eric Seidel  <eric@webkit.org>
    218
  • trunk/LayoutTests/html5lib/runner-expected-html5.txt

    r62498 r62499  
    6868|     <b>
    6969|       <table>
     70|         <tbody>
     71|           <tr>
     72|             <td>
    7073Expected:
    7174| <html>
     
    8790|     <b>
    8891|       <table>
     92|         <tbody>
     93|           <tr>
     94|             <td>
    8995Expected:
    9096| <html>
     
    222228|     <a>
    223229|       <table>
     230|         <tbody>
     231|           <tr>
     232|             <td>
    224233Expected:
    225234| <html>
     
    283292|         "hello"
    284293|         <table>
    285 |           <!-- X -->
     294|           <tbody>
     295|             <tr>
     296|               <th>
     297|                 <!-- X -->
    286298Expected:
    287299| <!-- - -->
     
    919931|       "aba"
    920932|       <table>
     933|         <tbody>
     934|           <tr>
     935|             <td>
    921936Expected:
    922937| <html>
     
    950965|       "aba"
    951966|       <table>
     967|         <tbody>
     968|           <tr>
     969|             <td>
    952970Expected:
    953971| <html>
     
    973991|   <body>
    974992|     <table>
     993|       <tbody>
     994|         <tr>
     995|           <td>
    975996Expected:
    976997| <html>
     
    10561077|   <body>
    10571078|     <table>
     1079|       <tbody>
     1080|         <tr>
     1081|           <td>
    10581082Expected:
    10591083| <html>
     
    10991123|     <b>
    11001124|       <table>
     1125|         <tbody>
     1126|           <tr>
     1127|             <td>
    11011128Expected:
    11021129| <html>
     
    11181145|     <b>
    11191146|       <table>
     1147|         <tbody>
     1148|           <tr>
     1149|             <td>
    11201150Expected:
    11211151| <html>
     
    12391269|     <a>
    12401270|       <table>
     1271|         <tbody>
     1272|           <tr>
     1273|             <td>
    12411274Expected:
    12421275| <html>
     
    13001333|     <h1>
    13011334|       <table>
     1335|         <tbody>
     1336|           <tr>
     1337|             <td>
    13021338Expected:
    13031339| <html>
     
    13471383|       <tbody>
    13481384|         <tr>
     1385|           <td>
    13491386Expected:
    13501387| <html>
     
    14121449|   <body>
    14131450|     <table>
     1451|       <tbody>
     1452|         <tr>
    14141453Expected:
    14151454| <html>
     
    14221461|     <p>
    14231462resources/tests2.dat:
    1424 3
    142514634
    142614648
     
    1443148158
    14441482
    1445 Test 3 of 59 in resources/tests2.dat failed. Input:
    1446 <table><td>
    1447 Got:
    1448 | <html>
    1449 |   <head>
    1450 |   <body>
    1451 |     <table>
    1452 Expected:
    1453 | <html>
    1454 |   <head>
    1455 |   <body>
    1456 |     <table>
    1457 |       <tbody>
    1458 |         <tr>
    1459 |           <td>
    1460 
    14611483Test 4 of 59 in resources/tests2.dat failed. Input:
    14621484<table><td>test</tbody></table>
     
    14661488|   <body>
    14671489|     <table>
     1490|       <tbody>
     1491|         <tr>
     1492|           <td>
    14681493Expected:
    14691494| <html>
     
    15251550|   <body>
    15261551|     <table>
     1552|       <tbody>
     1553|         <tr>
     1554|           <td>
    15271555Expected:
    15281556| <html>
     
    15411569|   <body>
    15421570|     <table>
     1571|       <tbody>
     1572|         <tr>
    15431573Expected:
    15441574| <!DOCTYPE html>
     
    17951825|   <body>
    17961826|     <table>
     1827|       <tbody>
     1828|         <tr>
     1829|           <td>
    17971830Expected:
    17981831| <!DOCTYPE html>
     
    2105213813
    2106213914
    2107 15
    2108214016
    2109214117
    2110214219
    2111214323
    2112 24
    2113214426
    2114214527
     
    22392270|     <button>
    22402271
    2241 Test 15 of 51 in resources/tests6.dat failed. Input:
    2242 <table><tr><td></th>
    2243 Got:
    2244 | <html>
    2245 |   <head>
    2246 |   <body>
    2247 |     <table>
    2248 Expected:
    2249 | <html>
    2250 |   <head>
    2251 |   <body>
    2252 |     <table>
    2253 |       <tbody>
    2254 |         <tr>
    2255 |           <td>
    2256 
    22572272Test 16 of 51 in resources/tests6.dat failed. Input:
    22582273<table><caption><td>
     
    23212336|         <div>
    23222337
    2323 Test 24 of 51 in resources/tests6.dat failed. Input:
    2324 <table><tr><td></body></caption></col></colgroup></html>
    2325 Got:
    2326 | <html>
    2327 |   <head>
    2328 |   <body>
    2329 |     <table>
    2330 Expected:
    2331 | <html>
    2332 |   <head>
    2333 |   <body>
    2334 |     <table>
    2335 |       <tbody>
    2336 |         <tr>
    2337 |           <td>
    2338 
    23392338Test 26 of 51 in resources/tests6.dat failed. Input:
    23402339<table><colgroup>foo
     
    23742373|   <body>
    23752374|     <table>
     2375|       <tbody>
     2376|         <tr>
    23762377Expected:
    23772378| <html>
     
    23902391|   <body>
    23912392|     <table>
     2393|       <tbody>
     2394|         <tr>
     2395|           <td>
    23922396Expected:
    23932397| <html>
     
    25322536|   <body>
    25332537|     <table>
     2538|       <tbody>
     2539|         <tr>
     2540|           <td>
    25342541Expected:
    25352542| <!DOCTYPE html>
     
    27462753|   <body>
    27472754|     <table>
     2755|       <tbody>
     2756|         <tr>
    27482757Expected:
    27492758| <!DOCTYPE html>
     
    28072816|   <body>
    28082817|     <table>
     2818|       <tbody>
     2819|         <tr>
     2820|           <td>
    28092821Expected:
    28102822| <html>
     
    28252837|   <body>
    28262838|     <table>
     2839|       <tbody>
     2840|         <tr>
     2841|           <td>
    28272842Expected:
    28282843| <html>
     
    28482863|     "A"
    28492864|     <table>
     2865|       <tbody>
     2866|         <tr>
    28502867Expected:
    28512868| <html>
     
    28652882|     "A"
    28662883|     <table>
     2884|       <tbody>
     2885|         <tr>
    28672886Expected:
    28682887| <html>
     
    32593278|       <tbody>
    32603279|         <tr>
     3280|           <td>
    32613281Expected:
    32623282| <!DOCTYPE html>
     
    32843304|       <tbody>
    32853305|         <tr>
     3306|           <td>
    32863307Expected:
    32873308| <!DOCTYPE html>
     
    34103431|   <body>
    34113432|     <table>
     3433|       <tbody>
     3434|         <tr>
     3435|           <td>
    34123436Expected:
    34133437| <!DOCTYPE html>
     
    37723796|       <tbody>
    37733797|         <tr>
     3798|           <td>
    37743799Expected:
    37753800| <!DOCTYPE html>
     
    37973822|       <tbody>
    37983823|         <tr>
     3824|           <td>
    37993825Expected:
    38003826| <!DOCTYPE html>
     
    39233949|   <body>
    39243950|     <table>
     3951|       <tbody>
     3952|         <tr>
     3953|           <td>
    39253954Expected:
    39263955| <!DOCTYPE html>
     
    50635092|       "spam"
    50645093|       <table>
     5094|         <tbody>
     5095|           <tr>
     5096|             <td>
    50655097Expected:
    50665098| <!DOCTYPE html>
     
    51145146|                 "spam"
    51155147|                 <table>
     5148|                   <tbody>
     5149|                     <tr>
     5150|                       <td>
    51165151Expected:
    51175152| <!DOCTYPE html>
     
    52895324|   <body>
    52905325|     <table>
     5326|       <tbody>
     5327|         <tr>
    52915328Expected:
    52925329| <!DOCTYPE html>
     
    53295366|     <div>
    53305367|       <table>
     5368|         <tbody>
     5369|           <tr>
     5370|             <td>
    53315371Expected:
    53325372| <!DOCTYPE html>
     
    53755415|   <body>
    53765416|     <table>
     5417|       <tbody>
     5418|         <tr>
     5419|           <td>
    53775420Expected:
    53785421| <!DOCTYPE html>
     
    55855628|     <table>
    55865629resources/inbody01.dat: PASS
     5630
     5631resources/tables01.dat: PASS
    55875632#EOF
  • trunk/LayoutTests/html5lib/runner-expected.txt

    r62498 r62499  
    49374937|     <table>
    49384938resources/inbody01.dat: PASS
     4939
     4940resources/tables01.dat: PASS
  • trunk/LayoutTests/html5lib/runner.html

    r62498 r62499  
    6161        'resources/comments01.dat',
    6262        'resources/adoption01.dat',
    63         'resources/inbody01.dat'
     63        'resources/inbody01.dat',
     64        'resources/tables01.dat'
    6465    ],
    6566    tests = [],
  • trunk/WebCore/ChangeLog

    r62498 r62499  
     12010-07-05  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        Add basic "in row" mode to support <td> and <th> insertion
     6        https://bugs.webkit.org/show_bug.cgi?id=41588
     7
     8        Also fixed <td> or <th> as a direct child of <table>.
     9
     10        Most of this was covered by html5lib/runner.html tests,
     11        but I had to add a new tables01.dat to cover the <th> cases.
     12
     13        * html/HTMLElementStack.cpp:
     14        (WebCore::HTMLNames::isTableRowScopeMarker):
     15        (WebCore::HTMLElementStack::popUntilTableRowScopeMarker):
     16        * html/HTMLElementStack.h:
     17        * html/HTMLTreeBuilder.cpp:
     18        (WebCore::HTMLTreeBuilder::processStartTag):
     19
    1202010-07-05  Eric Seidel  <eric@webkit.org>
    221
  • trunk/WebCore/html/HTMLElementStack.cpp

    r62474 r62499  
    7777}
    7878
     79inline bool isTableRowScopeMarker(Element* element)
     80{
     81    return element->hasTagName(trTag)
     82        || element->hasTagName(htmlTag);
     83}
     84
    7985}
    8086
     
    163169    // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#clear-the-stack-back-to-a-table-body-context
    164170    while (!isTableBodyScopeMarker(top()))
     171        pop();
     172}
     173
     174void HTMLElementStack::popUntilTableRowScopeMarker()
     175{
     176    // http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html#clear-the-stack-back-to-a-table-row-context
     177    while (!isTableRowScopeMarker(top()))
    165178        pop();
    166179}
  • trunk/WebCore/html/HTMLElementStack.h

    r62474 r62499  
    8585    void popUntilTableScopeMarker(); // "clear the stack back to a table context" in the spec.
    8686    void popUntilTableBodyScopeMarker(); // "clear the stack back to a table body context" in the spec.
     87    void popUntilTableRowScopeMarker(); // "clear the stack back to a table row context" in the spec.
    8788    void popHTMLHeadElement();
    8889    void popHTMLBodyElement();
  • trunk/WebCore/html/HTMLTreeBuilder.cpp

    r62498 r62499  
    757757        }
    758758        if (token.name() == tdTag || token.name() == thTag || token.name() == trTag) {
    759             notImplemented();
     759            AtomicHTMLToken fakeToken(HTMLToken::StartTag, tbodyTag.localName());
     760            processStartTag(fakeToken);
     761            ASSERT(insertionMode() == InTableBodyMode);
     762            processStartTag(token);
    760763            return;
    761764        }
     
    799802        }
    800803        if (token.name() == captionTag || token.name() == colTag || token.name() == colgroupTag || isTableBodyContextTag(token.name())) {
    801             // FIXME: The spec is unclear as to what is supposed to happen here.
    802804            notImplemented();
    803805            return;
    804806        }
    805807        notImplemented(); // process using "in table" rules
     808        break;
     809    case InRowMode:
     810        if (token.name() == thTag || token.name() == tdTag) {
     811            m_openElements.popUntilTableRowScopeMarker();
     812            insertElement(token);
     813            m_insertionMode = InCellMode;
     814            m_activeFormattingElements.appendMarker();
     815        }
     816        if (token.name() == captionTag || token.name() == colTag || token.name() == colgroupTag || isTableBodyContextTag(token.name())) {
     817            notImplemented();
     818            return;
     819        }
     820        notImplemented();
    806821        break;
    807822    case AfterBodyMode:
Note: See TracChangeset for help on using the changeset viewer.