2010-07-13 Eric Seidel <eric@webkit.org>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jul 2010 00:18:52 +0000 (00:18 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 14 Jul 2010 00:18:52 +0000 (00:18 +0000)
        Reviewed by Adam Barth.

        Make our end tag in-foreign-content mode spec bug workarounds more closely match minefield
        https://bugs.webkit.org/show_bug.cgi?id=42187

        * html5lib/runner-expected-html5.txt:
2010-07-13  Eric Seidel  <eric@webkit.org>

        Reviewed by Adam Barth.

        Make our end tag in-foreign-content mode spec bug workarounds more closely match minefield
        https://bugs.webkit.org/show_bug.cgi?id=42187

        I do not expect these work-arounds to be permanent.  Hixie has promised to
        addresses the feedback to the parser sections of HTML5 soon.
        I added these hacks to make our hacks more-closely match Minefield's hacks
        and thus have us "pass" a few more html5lib runner tests.

        We now pass all of the html5lib foreign content tests
        (thus we'll likely need to write more).

        Tested by html5lib/runner.html

        * html/HTMLElementStack.cpp:
        (WebCore::HTMLElementStack::contains):
        * html/HTMLElementStack.h:
        * html/HTMLTreeBuilder.cpp:
        (WebCore::HTMLTreeBuilder::processEndTag):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63264 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/HTMLTreeBuilder.cpp

index 2c837bb..42a94de 100644 (file)
@@ -1,3 +1,12 @@
+2010-07-13  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Make our end tag in-foreign-content mode spec bug workarounds more closely match minefield
+        https://bugs.webkit.org/show_bug.cgi?id=42187
+
+        * html5lib/runner-expected-html5.txt:
+
 2010-07-13  Brian Weinstein  <bweinstein@apple.com>
 
         Reviewed by Steve Falkenburg.
index 4d5e896..9895f96 100644 (file)
@@ -335,197 +335,14 @@ Expected:
 |     <keygen>
 resources/tests8.dat: PASS
 
-resources/tests9.dat:
-14
+resources/tests9.dat: PASS
+
+resources/tests10.dat: PASS
 
-Test 14 of 25 in resources/tests9.dat failed. Input:
-<!DOCTYPE html><body><table><caption><math><mi>foo</mi><mi>bar</mi>baz</table><p>quux
-Got:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <caption>
-|         <math math>
-|           <math mi>
-|             "foo"
-|           <math mi>
-|             "bar"
-|           "baz"
-|         <p>
-|           "quux"
-Expected:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <caption>
-|         <math math>
-|           <math mi>
-|             "foo"
-|           <math mi>
-|             "bar"
-|           "baz"
-|     <p>
-|       "quux"
-resources/tests10.dat:
-14
-
-Test 14 of 25 in resources/tests10.dat failed. Input:
-<!DOCTYPE html><body><table><caption><svg><g>foo</g><g>bar</g>baz</table><p>quux
-Got:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <caption>
-|         <svg svg>
-|           <svg g>
-|             "foo"
-|           <svg g>
-|             "bar"
-|           "baz"
-|         <p>
-|           "quux"
-Expected:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <table>
-|       <caption>
-|         <svg svg>
-|           <svg g>
-|             "foo"
-|           <svg g>
-|             "bar"
-|           "baz"
-|     <p>
-|       "quux"
 resources/tests11.dat: PASS
 
-resources/tests12.dat:
-1
-2
+resources/tests12.dat: PASS
 
-Test 1 of 2 in resources/tests12.dat failed. Input:
-<!DOCTYPE html><body><p>foo<math><mtext><i>baz</i></mtext><annotation-xml><svg><desc><b>eggs</b></desc><g><foreignObject><P>spam<TABLE><tr><td><img></td></table></foreignObject></g><g>quux</g></svg></annotation-xml></math>bar
-Got:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <p>
-|       "foo"
-|       <math math>
-|         <math mtext>
-|           <i>
-|             "baz"
-|         <math annotation-xml>
-|           <svg svg>
-|             <svg desc>
-|               <b>
-|                 "eggs"
-|             <svg g>
-|               <svg foreignObject>
-|                 <p>
-|                   "spam"
-|                 <table>
-|                   <tbody>
-|                     <tr>
-|                       <td>
-|                         <img>
-|                 <g>
-|                   "quux"
-|                 "bar"
-Expected:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     <p>
-|       "foo"
-|       <math math>
-|         <math mtext>
-|           <i>
-|             "baz"
-|         <math annotation-xml>
-|           <svg svg>
-|             <svg desc>
-|               <b>
-|                 "eggs"
-|             <svg g>
-|               <svg foreignObject>
-|                 <p>
-|                   "spam"
-|                 <table>
-|                   <tbody>
-|                     <tr>
-|                       <td>
-|                         <img>
-|             <svg g>
-|               "quux"
-|       "bar"
-
-Test 2 of 2 in resources/tests12.dat failed. Input:
-<!DOCTYPE html><body>foo<math><mtext><i>baz</i></mtext><annotation-xml><svg><desc><b>eggs</b></desc><g><foreignObject><P>spam<TABLE><tr><td><img></td></table></foreignObject></g><g>quux</g></svg></annotation-xml></math>bar
-Got:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     "foo"
-|     <math math>
-|       <math mtext>
-|         <i>
-|           "baz"
-|       <math annotation-xml>
-|         <svg svg>
-|           <svg desc>
-|             <b>
-|               "eggs"
-|           <svg g>
-|             <svg foreignObject>
-|               <p>
-|                 "spam"
-|               <table>
-|                 <tbody>
-|                   <tr>
-|                     <td>
-|                       <img>
-|               <g>
-|                 "quux"
-|               "bar"
-Expected:
-| <!DOCTYPE html>
-| <html>
-|   <head>
-|   <body>
-|     "foo"
-|     <math math>
-|       <math mtext>
-|         <i>
-|           "baz"
-|       <math annotation-xml>
-|         <svg svg>
-|           <svg desc>
-|             <b>
-|               "eggs"
-|           <svg g>
-|             <svg foreignObject>
-|               <p>
-|                 "spam"
-|               <table>
-|                 <tbody>
-|                   <tr>
-|                     <td>
-|                       <img>
-|           <svg g>
-|             "quux"
-|     "bar"
 resources/tests14.dat: PASS
 
 resources/tests15.dat: PASS
index 3650d79..a97cf4c 100644 (file)
@@ -1,3 +1,26 @@
+2010-07-13  Eric Seidel  <eric@webkit.org>
+
+        Reviewed by Adam Barth.
+
+        Make our end tag in-foreign-content mode spec bug workarounds more closely match minefield
+        https://bugs.webkit.org/show_bug.cgi?id=42187
+
+        I do not expect these work-arounds to be permanent.  Hixie has promised to
+        addresses the feedback to the parser sections of HTML5 soon.
+        I added these hacks to make our hacks more-closely match Minefield's hacks
+        and thus have us "pass" a few more html5lib runner tests.
+
+        We now pass all of the html5lib foreign content tests
+        (thus we'll likely need to write more).
+
+        Tested by html5lib/runner.html
+
+        * html/HTMLElementStack.cpp:
+        (WebCore::HTMLElementStack::contains):
+        * html/HTMLElementStack.h:
+        * html/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::processEndTag):
+
 2010-07-12  Tony Gentilcore  <tonyg@chromium.org>
 
         Reviewed by Darin Fisher.
index d1a1752..850f53f 100644 (file)
@@ -325,6 +325,11 @@ bool HTMLElementStack::contains(Element* element) const
     return !!find(element);
 }
 
+bool HTMLElementStack::contains(const AtomicString& tagName) const
+{
+    return !!topmost(tagName);
+}
+
 template <bool isMarker(Element*)>
 bool inScopeCommon(HTMLElementStack::ElementRecord* top, const AtomicString& targetTag)
 {
index 8be4422..be8f081 100644 (file)
@@ -97,6 +97,7 @@ public:
     void removeHTMLHeadElement(Element*);
 
     bool contains(Element*) const;
+    bool contains(const AtomicString& tagName) const;
 
     bool inScope(Element*) const;
     bool inScope(const AtomicString& tagName) const;
index 8a357ff..8051b3e 100644 (file)
@@ -2340,9 +2340,11 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token)
             HTMLElementStack::ElementRecord* nodeRecord = m_tree.openElements()->topRecord();
             if (!nodeRecord->element()->hasLocalName(token.name())) {
                 parseError(token);
-                // FIXME: This return is not in the spec but appears to be needed.
+                // FIXME: This return is not in the spec but it needed for now
+                // to prevent walking off the bottom of the stack.
                 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10118
-                return;
+                if (!m_tree.openElements()->contains(token.name()))
+                    return;
             }
             while (1) {
                 if (nodeRecord->element()->hasLocalName(token.name())) {
@@ -2350,8 +2352,13 @@ void HTMLTreeBuilder::processEndTag(AtomicHTMLToken& token)
                     return;
                 }
                 nodeRecord = nodeRecord->next();
-                if (nodeRecord->element()->namespaceURI() == xhtmlNamespaceURI)
+                if (nodeRecord->element()->namespaceURI() == xhtmlNamespaceURI) {
                     processUsingSecondaryInsertionModeAndAdjustInsertionMode(token);
+                    // FIXME: This is a hack around a spec bug and is likely wrong.
+                    // http://www.w3.org/Bugs/Public/show_bug.cgi?id=9581
+                    if (nodeRecord != m_tree.openElements()->topRecord())
+                        return;
+                }
             }
             return;
         }