2010-07-07 Eric Seidel <eric@webkit.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jul 2010 08:50:48 +0000 (08:50 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Jul 2010 08:50:48 +0000 (08:50 +0000)
        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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@62642 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/HTMLFormattingElementList.cpp
WebCore/html/HTMLFormattingElementList.h
WebCore/html/HTMLTreeBuilder.cpp

index 307e089..5cf5e7b 100644 (file)
@@ -1,3 +1,12 @@
+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-06  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Adam Barth.
index d26ec9a..64f2826 100644 (file)
@@ -923,120 +923,9 @@ Expected:
 |     <select>
 |     <keygen>
 resources/tests8.dat:
-1
-2
-3
-4
-5
 6
 7
 
-Test 1 of 9 in resources/tests8.dat failed. Input:
-<div>
-<div></div>
-</span>x
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "
-"
-|       <div>
-|     "
-x"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "
-"
-|       <div>
-|       "
-x"
-
-Test 2 of 9 in resources/tests8.dat failed. Input:
-<div>x<div></div>
-</span>x
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|     "
-x"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|       "
-x"
-
-Test 3 of 9 in resources/tests8.dat failed. Input:
-<div>x<div></div>x</span>x
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|     "xx"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|       "xx"
-
-Test 4 of 9 in resources/tests8.dat failed. Input:
-<div>x<div></div>y</span>z
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|     "yz"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|       "yz"
-
-Test 5 of 9 in resources/tests8.dat failed. Input:
-<table><div>x<div></div>x</span>x
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|     <table>
-|       "xx"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <div>
-|       "x"
-|       <div>
-|       "xx"
-|     <table>
-
 Test 6 of 9 in resources/tests8.dat failed. Input:
 x<table>x
 Got:
@@ -3321,7 +3210,6 @@ resources/comments01.dat: PASS
 
 resources/adoption01.dat:
 3
-5
 
 Test 3 of 9 in resources/adoption01.dat failed. Input:
 <a>1<button>2</a>3</button>
@@ -3342,37 +3230,6 @@ Expected:
 |       <button>
 |         "2"
 |     "3"
-
-Test 5 of 9 in resources/adoption01.dat failed. Input:
-<a>1<div>2<div>3</a>4</div>5</div>
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <a>
-|       "1"
-|     <div>
-|       <a>
-|         "2"
-|       <div>
-|         <a>
-|           "3"
-|         "4"
-|     "5"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <a>
-|       "1"
-|     <div>
-|       <a>
-|         "2"
-|       <div>
-|         <a>
-|           "3"
-|         "4"
-|       "5"
 resources/inbody01.dat: PASS
 
 resources/isindex.dat: PASS
index 2b6be26..898fd2a 100644 (file)
@@ -1,3 +1,26 @@
+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):
+
 2010-07-06  Eric Seidel  <eric@webkit.org>
 
         Reviewed by Adam Barth.
index d87e954..9f815c9 100644 (file)
@@ -418,4 +418,14 @@ void HTMLElementStack::removeNonTopCommon(Element* element)
     ASSERT_NOT_REACHED();
 }
 
+#ifndef NDEBUG
+
+void HTMLElementStack::show()
+{
+    for (ElementRecord* record = m_top.get(); record; record = record->next())
+        record->element()->showNode();
+}
+
+#endif
+
 }
index 3e6e69c..07f6e60 100644 (file)
@@ -107,6 +107,10 @@ public:
     Element* headElement() const;
     Element* bodyElement() const;
 
+#ifndef NDEBUG
+    void show();
+#endif
+
 private:
     void pushCommon(PassRefPtr<Element>);
     void popCommon();
index 818bfb3..e046b51 100644 (file)
@@ -168,4 +168,19 @@ void HTMLFormattingElementList::clearToLastMarker()
         m_entries.removeLast();
 }
 
+#ifndef NDEBUG
+
+void HTMLFormattingElementList::show()
+{
+    for (unsigned i = 1; i <= m_entries.size(); ++i) {
+        const Entry& entry = m_entries[m_entries.size() - i];
+        if (entry.isMarker())
+            fprintf(stderr, "marker\n");
+        else
+            entry.element()->showNode();
+    }
+}
+
+#endif
+
 }
index ac75cc3..d5fcc0f 100644 (file)
@@ -105,6 +105,10 @@ public:
     const Entry& at(size_t i) const { return m_entries[i]; }
     Entry& at(size_t i) { return m_entries[i]; }
 
+#ifndef NDEBUG
+    void show();
+#endif
+
 private:
     Vector<Entry> m_entries;
 };
index 9da0bd3..b886e9b 100644 (file)
@@ -1457,7 +1457,28 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken& token)
             processEndTag(token);
         return;
     }
-    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) {
+    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) {
         if (!m_tree.openElements()->inScope(token.name())) {
             parseError(token);
             return;
@@ -1467,6 +1488,7 @@ void HTMLTreeBuilder::processEndTagForInBody(AtomicHTMLToken& token)
             parseError(token);
         m_tree.openElements()->popUntil(token.name());
         m_tree.openElements()->pop();
+        return;
     }
     if (token.name() == formTag) {
         RefPtr<Element> node = m_tree.takeForm();