Changeset 62642 in webkit


Ignore:
Timestamp:
Jul 7, 2010 1:50:48 AM (14 years ago)
Author:
eric@webkit.org
Message:

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

Reviewed by Adam Barth.

</div> pops too many <div> elements in body
https://bugs.webkit.org/show_bug.cgi?id=41751

  • html5lib/runner-expected-html5.txt:

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

Reviewed by Adam Barth.

</div> pops too many <div> elements in body
https://bugs.webkit.org/show_bug.cgi?id=41751

Another missing return!

While tracking this down I added some debugging code to both the
open elements stack and the active formatting elements list.

I also unwrapped a very long
chain to make it more readable.
  • html/HTMLElementStack.cpp: (WebCore::HTMLElementStack::show):
  • html/HTMLElementStack.h:
  • html/HTMLFormattingElementList.cpp: (WebCore::HTMLFormattingElementList::show):
  • html/HTMLFormattingElementList.h:
  • html/HTMLTreeBuilder.cpp: (WebCore::HTMLTreeBuilder::processEndTagForInBody):
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r62640 r62642  
     12010-07-07  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        </div> pops too many <div> elements in body
     6        https://bugs.webkit.org/show_bug.cgi?id=41751
     7
     8        * html5lib/runner-expected-html5.txt:
     9
    1102010-07-06  Eric Seidel  <eric@webkit.org>
    211
  • trunk/LayoutTests/html5lib/runner-expected-html5.txt

    r62640 r62642  
    924924|     <keygen>
    925925resources/tests8.dat:
    926 1
    927 2
    928 3
    929 4
    930 5
    9319266
    9329277
    933 
    934 Test 1 of 9 in resources/tests8.dat failed. Input:
    935 <div>
    936 <div></div>
    937 </span>x
    938 Got:
    939 | <html>
    940 |   <head>
    941 |   <body>
    942 |     <div>
    943 |       "
    944 "
    945 |       <div>
    946 |     "
    947 x"
    948 Expected:
    949 | <html>
    950 |   <head>
    951 |   <body>
    952 |     <div>
    953 |       "
    954 "
    955 |       <div>
    956 |       "
    957 x"
    958 
    959 Test 2 of 9 in resources/tests8.dat failed. Input:
    960 <div>x<div></div>
    961 </span>x
    962 Got:
    963 | <html>
    964 |   <head>
    965 |   <body>
    966 |     <div>
    967 |       "x"
    968 |       <div>
    969 |     "
    970 x"
    971 Expected:
    972 | <html>
    973 |   <head>
    974 |   <body>
    975 |     <div>
    976 |       "x"
    977 |       <div>
    978 |       "
    979 x"
    980 
    981 Test 3 of 9 in resources/tests8.dat failed. Input:
    982 <div>x<div></div>x</span>x
    983 Got:
    984 | <html>
    985 |   <head>
    986 |   <body>
    987 |     <div>
    988 |       "x"
    989 |       <div>
    990 |     "xx"
    991 Expected:
    992 | <html>
    993 |   <head>
    994 |   <body>
    995 |     <div>
    996 |       "x"
    997 |       <div>
    998 |       "xx"
    999 
    1000 Test 4 of 9 in resources/tests8.dat failed. Input:
    1001 <div>x<div></div>y</span>z
    1002 Got:
    1003 | <html>
    1004 |   <head>
    1005 |   <body>
    1006 |     <div>
    1007 |       "x"
    1008 |       <div>
    1009 |     "yz"
    1010 Expected:
    1011 | <html>
    1012 |   <head>
    1013 |   <body>
    1014 |     <div>
    1015 |       "x"
    1016 |       <div>
    1017 |       "yz"
    1018 
    1019 Test 5 of 9 in resources/tests8.dat failed. Input:
    1020 <table><div>x<div></div>x</span>x
    1021 Got:
    1022 | <html>
    1023 |   <head>
    1024 |   <body>
    1025 |     <div>
    1026 |       "x"
    1027 |       <div>
    1028 |     <table>
    1029 |       "xx"
    1030 Expected:
    1031 | <html>
    1032 |   <head>
    1033 |   <body>
    1034 |     <div>
    1035 |       "x"
    1036 |       <div>
    1037 |       "xx"
    1038 |     <table>
    1039928
    1040929Test 6 of 9 in resources/tests8.dat failed. Input:
     
    33223211resources/adoption01.dat:
    332332123
    3324 5
    33253213
    33263214Test 3 of 9 in resources/adoption01.dat failed. Input:
     
    33433231|         "2"
    33443232|     "3"
    3345 
    3346 Test 5 of 9 in resources/adoption01.dat failed. Input:
    3347 <a>1<div>2<div>3</a>4</div>5</div>
    3348 Got:
    3349 | <html>
    3350 |   <head>
    3351 |   <body>
    3352 |     <a>
    3353 |       "1"
    3354 |     <div>
    3355 |       <a>
    3356 |         "2"
    3357 |       <div>
    3358 |         <a>
    3359 |           "3"
    3360 |         "4"
    3361 |     "5"
    3362 Expected:
    3363 | <html>
    3364 |   <head>
    3365 |   <body>
    3366 |     <a>
    3367 |       "1"
    3368 |     <div>
    3369 |       <a>
    3370 |         "2"
    3371 |       <div>
    3372 |         <a>
    3373 |           "3"
    3374 |         "4"
    3375 |       "5"
    33763233resources/inbody01.dat: PASS
    33773234
  • trunk/WebCore/ChangeLog

    r62640 r62642  
     12010-07-07  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Adam Barth.
     4
     5        </div> pops too many <div> elements in body
     6        https://bugs.webkit.org/show_bug.cgi?id=41751
     7
     8        Another missing return!
     9
     10        While tracking this down I added some debugging code to both the
     11        open elements stack and the active formatting elements list.
     12
     13        I also unwrapped a very long || chain to make it more readable.
     14
     15        * html/HTMLElementStack.cpp:
     16        (WebCore::HTMLElementStack::show):
     17        * html/HTMLElementStack.h:
     18        * html/HTMLFormattingElementList.cpp:
     19        (WebCore::HTMLFormattingElementList::show):
     20        * html/HTMLFormattingElementList.h:
     21        * html/HTMLTreeBuilder.cpp:
     22        (WebCore::HTMLTreeBuilder::processEndTagForInBody):
     23
    1242010-07-06  Eric Seidel  <eric@webkit.org>
    225
  • trunk/WebCore/html/HTMLElementStack.cpp

    r62618 r62642  
    419419}
    420420
    421 }
     421#ifndef NDEBUG
     422
     423void HTMLElementStack::show()
     424{
     425    for (ElementRecord* record = m_top.get(); record; record = record->next())
     426        record->element()->showNode();
     427}
     428
     429#endif
     430
     431}
  • trunk/WebCore/html/HTMLElementStack.h

    r62618 r62642  
    108108    Element* bodyElement() const;
    109109
     110#ifndef NDEBUG
     111    void show();
     112#endif
     113
    110114private:
    111115    void pushCommon(PassRefPtr<Element>);
  • trunk/WebCore/html/HTMLFormattingElementList.cpp

    r62563 r62642  
    169169}
    170170
     171#ifndef NDEBUG
     172
     173void HTMLFormattingElementList::show()
     174{
     175    for (unsigned i = 1; i <= m_entries.size(); ++i) {
     176        const Entry& entry = m_entries[m_entries.size() - i];
     177        if (entry.isMarker())
     178            fprintf(stderr, "marker\n");
     179        else
     180            entry.element()->showNode();
     181    }
    171182}
     183
     184#endif
     185
     186}
  • trunk/WebCore/html/HTMLFormattingElementList.h

    r62599 r62642  
    106106    Entry& at(size_t i) { return m_entries[i]; }
    107107
     108#ifndef NDEBUG
     109    void show();
     110#endif
     111
    108112private:
    109113    Vector<Entry> m_entries;
  • trunk/WebCore/html/HTMLTreeBuilder.cpp

    r62640 r62642  
    14581458        return;
    14591459    }
    1460     if (token.name() == addressTag || token.name() == articleTag || token.name() == asideTag || token.name() == blockquoteTag || token.name() == buttonTag || 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() == listingTag || token.name() == menuTag || token.name() == navTag || token.name() == olTag || token.name() == preTag || token.name() == sectionTag || token.name() == ulTag) {
     1460    if (token.name() == addressTag
     1461        || token.name() == articleTag
     1462        || token.name() == asideTag
     1463        || token.name() == blockquoteTag
     1464        || token.name() == buttonTag
     1465        || token.name() == centerTag
     1466        || token.name() == "details"
     1467        || token.name() == dirTag
     1468        || token.name() == divTag
     1469        || token.name() == dlTag
     1470        || token.name() == fieldsetTag
     1471        || token.name() == "figure"
     1472        || token.name() == footerTag
     1473        || token.name() == headerTag
     1474        || token.name() == hgroupTag
     1475        || token.name() == listingTag
     1476        || token.name() == menuTag
     1477        || token.name() == navTag
     1478        || token.name() == olTag
     1479        || token.name() == preTag
     1480        || token.name() == sectionTag
     1481        || token.name() == ulTag) {
    14611482        if (!m_tree.openElements()->inScope(token.name())) {
    14621483            parseError(token);
     
    14681489        m_tree.openElements()->popUntil(token.name());
    14691490        m_tree.openElements()->pop();
     1491        return;
    14701492    }
    14711493    if (token.name() == formTag) {
Note: See TracChangeset for help on using the changeset viewer.