[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

eric at webkit.org eric at webkit.org
Wed Dec 22 11:12:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit cb8055b1a75fc7fe26408072c0e31ad1f6d5dd61
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jul 15 01:06:11 2010 +0000

    2010-07-14  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            HTMLTreeBuilder foster parents when it should not
            https://bugs.webkit.org/show_bug.cgi?id=42235
    
            * html5lib/resources/adoption01.dat:
            * html5lib/runner-expected-html5.txt:
            * html5lib/runner-expected.txt:
    2010-07-14  Eric Seidel  <eric at webkit.org>
    
            Reviewed by Adam Barth.
    
            HTMLTreeBuilder foster parents when it should not
            https://bugs.webkit.org/show_bug.cgi?id=42235
    
            Regarding foster parenting of nodes inside tables:
            "Process the token using the rules for the "in body" insertion mode,
            except that if the current node is a table, tbody, tfoot, thead, or
            tr element, then, whenever a node would be inserted into the current
            node, it must instead be foster parented."
    
            We were forgetting the "when the current node is" part of that check
            and always foster parenting, even if we had just inserted another
            element (which would have just changed the current node).
    
            This was covered by multiple tests in html5lib/runner.html
            but I wrote a reduction (one which I included) as it makes it
            easier to see what's going on.
    
            * html/HTMLConstructionSite.cpp:
            (WebCore::HTMLNames::causesFosterParenting):
            (WebCore::HTMLConstructionSite::attach):
            (WebCore::HTMLConstructionSite::insertHTMLHtmlElement):
            (WebCore::HTMLConstructionSite::insertHTMLHeadElement):
            (WebCore::HTMLConstructionSite::insertHTMLBodyElement):
            (WebCore::HTMLConstructionSite::insertTextNode):
            (WebCore::HTMLConstructionSite::shouldFosterParent):
            * html/HTMLConstructionSite.h:
            * html/HTMLTreeBuilder.cpp:
            (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@63386 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2c8b97f..49b7cc2 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2010-07-14  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        HTMLTreeBuilder foster parents when it should not
+        https://bugs.webkit.org/show_bug.cgi?id=42235
+
+        * html5lib/resources/adoption01.dat:
+        * html5lib/runner-expected-html5.txt:
+        * html5lib/runner-expected.txt:
+
 2010-07-14  Alexey Proskuryakov  <ap at apple.com>
 
         The same old directory name was present in mac-tiger skipped list.
diff --git a/LayoutTests/html5lib/resources/adoption01.dat b/LayoutTests/html5lib/resources/adoption01.dat
index 01e7948..3420ab8 100644
--- a/LayoutTests/html5lib/resources/adoption01.dat
+++ b/LayoutTests/html5lib/resources/adoption01.dat
@@ -164,3 +164,20 @@
 |     <b>
 |       id="A"
 |       "TEXT"
+
+#data
+<table><a>1<td>2</td>3</table>
+#errors
+#document
+| <html>
+|   <head>
+|   <body>
+|     <a>
+|       "1"
+|     <a>
+|       "3"
+|     <table>
+|       <tbody>
+|         <tr>
+|           <td>
+|             "2"
diff --git a/LayoutTests/html5lib/runner-expected-html5.txt b/LayoutTests/html5lib/runner-expected-html5.txt
index fd6eab2..92c4206 100644
--- a/LayoutTests/html5lib/runner-expected-html5.txt
+++ b/LayoutTests/html5lib/runner-expected-html5.txt
@@ -6,95 +6,8 @@ CONSOLE MESSAGE: line 0: Warning: Problem parsing viewBox=""
 CONSOLE MESSAGE: line 2: PASS
 CONSOLE MESSAGE: line 2: FOO<span>BAR</span>BAZ
 Content-Type: text/plain
-resources/tests1.dat:
-78
-80
+resources/tests1.dat: PASS
 
-Test 78 of 113 in resources/tests1.dat failed. Input:
-<a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <a>
-|       href="blah"
-|       "aba"
-|       <a>
-|         href="foo"
-|         "br"
-|       <a>
-|         href="foo"
-|       "x"
-|       <table>
-|         <tbody>
-|           <tr>
-|             <td>
-|     <a>
-|       href="foo"
-|       "aoe"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <a>
-|       href="blah"
-|       "aba"
-|       <a>
-|         href="foo"
-|         "br"
-|       <a>
-|         href="foo"
-|         "x"
-|       <table>
-|         <tbody>
-|           <tr>
-|             <td>
-|     <a>
-|       href="foo"
-|       "aoe"
-
-Test 80 of 113 in resources/tests1.dat failed. Input:
-<table><a href="blah">aba<tr><td><a href="foo">br</td></tr>x</table>aoe
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <a>
-|       href="blah"
-|       "aba"
-|     <a>
-|       href="blah"
-|     "x"
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             <a>
-|               href="foo"
-|               "br"
-|     <a>
-|       href="blah"
-|       "aoe"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <a>
-|       href="blah"
-|       "aba"
-|     <a>
-|       href="blah"
-|       "x"
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             <a>
-|               href="foo"
-|               "br"
-|     <a>
-|       href="blah"
-|       "aoe"
 resources/tests2.dat: PASS
 
 resources/tests3.dat: PASS
@@ -206,7 +119,6 @@ Expected:
 |   <body>
 resources/tests7.dat:
 24
-27
 30
 
 Test 24 of 30 in resources/tests7.dat failed. Input:
@@ -218,37 +130,6 @@ Expected:
 | <body>
 |   "X"
 
-Test 27 of 30 in resources/tests7.dat failed. Input:
-<table><b><tr><td>aaa</td></tr>bbb</table>ccc
-Got:
-| <html>
-|   <head>
-|   <body>
-|     <b>
-|     <b>
-|     "bbb"
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             "aaa"
-|     <b>
-|       "ccc"
-Expected:
-| <html>
-|   <head>
-|   <body>
-|     <b>
-|     <b>
-|       "bbb"
-|     <table>
-|       <tbody>
-|         <tr>
-|           <td>
-|             "aaa"
-|     <b>
-|       "ccc"
-
 Test 30 of 30 in resources/tests7.dat failed. Input:
 <select><keygen>
 Got:
@@ -328,7 +209,7 @@ resources/adoption01.dat:
 3
 11
 
-Test 3 of 11 in resources/adoption01.dat failed. Input:
+Test 3 of 12 in resources/adoption01.dat failed. Input:
 <a>1<button>2</a>3</button>
 Got:
 | <html>
@@ -348,7 +229,7 @@ Expected:
 |         "2"
 |     "3"
 
-Test 11 of 11 in resources/adoption01.dat failed. Input:
+Test 11 of 12 in resources/adoption01.dat failed. Input:
 <p><b id="A"><script>document.getElementById("A").id = "B"</script></p>TEXT</b>
 Got:
 | <html>
diff --git a/LayoutTests/html5lib/runner-expected.txt b/LayoutTests/html5lib/runner-expected.txt
index ff1d8ed..625c97a 100644
--- a/LayoutTests/html5lib/runner-expected.txt
+++ b/LayoutTests/html5lib/runner-expected.txt
@@ -5004,8 +5004,9 @@ resources/adoption01.dat:
 8
 9
 11
+12
 
-Test 1 of 11 in resources/adoption01.dat failed. Input:
+Test 1 of 12 in resources/adoption01.dat failed. Input:
 <a><p></a></p>
 Got:
 | <html>
@@ -5021,7 +5022,7 @@ Expected:
 |     <p>
 |       <a>
 
-Test 6 of 11 in resources/adoption01.dat failed. Input:
+Test 6 of 12 in resources/adoption01.dat failed. Input:
 <table><a>1<p>2</a>3</p>
 Got:
 | <html>
@@ -5046,7 +5047,7 @@ Expected:
 |       "3"
 |     <table>
 
-Test 7 of 11 in resources/adoption01.dat failed. Input:
+Test 7 of 12 in resources/adoption01.dat failed. Input:
 <b><b><a><p></a>
 Got:
 | <html>
@@ -5066,7 +5067,7 @@ Expected:
 |         <p>
 |           <a>
 
-Test 8 of 11 in resources/adoption01.dat failed. Input:
+Test 8 of 12 in resources/adoption01.dat failed. Input:
 <b><a><b><p></a>
 Got:
 | <html>
@@ -5088,7 +5089,7 @@ Expected:
 |         <p>
 |           <a>
 
-Test 9 of 11 in resources/adoption01.dat failed. Input:
+Test 9 of 12 in resources/adoption01.dat failed. Input:
 <a><b><b><p></a>
 Got:
 | <html>
@@ -5112,7 +5113,7 @@ Expected:
 |         <p>
 |           <a>
 
-Test 11 of 11 in resources/adoption01.dat failed. Input:
+Test 11 of 12 in resources/adoption01.dat failed. Input:
 <p><b id="A"><script>document.getElementById("A").id = "B"</script></p>TEXT</b>
 Got:
 | <html>
@@ -5138,6 +5139,34 @@ Expected:
 |     <b>
 |       id="A"
 |       "TEXT"
+
+Test 12 of 12 in resources/adoption01.dat failed. Input:
+<table><a>1<td>2</td>3</table>
+Got:
+| <html>
+|   <head>
+|   <body>
+|     <a>
+|       "1"
+|     "3"
+|     <table>
+|       <tbody>
+|         <tr>
+|           <td>
+|             "2"
+Expected:
+| <html>
+|   <head>
+|   <body>
+|     <a>
+|       "1"
+|     <a>
+|       "3"
+|     <table>
+|       <tbody>
+|         <tr>
+|           <td>
+|             "2"
 resources/inbody01.dat: PASS
 
 resources/isindex.dat:
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 02437d1..5cc8e19 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-07-14  Eric Seidel  <eric at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        HTMLTreeBuilder foster parents when it should not
+        https://bugs.webkit.org/show_bug.cgi?id=42235
+
+        Regarding foster parenting of nodes inside tables:
+        "Process the token using the rules for the "in body" insertion mode,
+        except that if the current node is a table, tbody, tfoot, thead, or
+        tr element, then, whenever a node would be inserted into the current
+        node, it must instead be foster parented."
+
+        We were forgetting the "when the current node is" part of that check
+        and always foster parenting, even if we had just inserted another
+        element (which would have just changed the current node).
+
+        This was covered by multiple tests in html5lib/runner.html
+        but I wrote a reduction (one which I included) as it makes it
+        easier to see what's going on.
+
+        * html/HTMLConstructionSite.cpp:
+        (WebCore::HTMLNames::causesFosterParenting):
+        (WebCore::HTMLConstructionSite::attach):
+        (WebCore::HTMLConstructionSite::insertHTMLHtmlElement):
+        (WebCore::HTMLConstructionSite::insertHTMLHeadElement):
+        (WebCore::HTMLConstructionSite::insertHTMLBodyElement):
+        (WebCore::HTMLConstructionSite::insertTextNode):
+        (WebCore::HTMLConstructionSite::shouldFosterParent):
+        * html/HTMLConstructionSite.h:
+        * html/HTMLTreeBuilder.cpp:
+        (WebCore::HTMLTreeBuilder::callTheAdoptionAgency):
+
 2010-07-14  Brady Eidson  <beidson at apple.com>
 
         Reviewed by Mark Rowe.
diff --git a/WebCore/html/HTMLConstructionSite.cpp b/WebCore/html/HTMLConstructionSite.cpp
index 1e2d75f..754c118 100644
--- a/WebCore/html/HTMLConstructionSite.cpp
+++ b/WebCore/html/HTMLConstructionSite.cpp
@@ -70,6 +70,15 @@ bool hasImpliedEndTag(Element* element)
         || element->hasTagName(rtTag);
 }
 
+bool causesFosterParenting(const QualifiedName& tagName)
+{
+    return tagName == tableTag
+        || tagName == tbodyTag
+        || tagName == tfootTag
+        || tagName == theadTag
+        || tagName == trTag;
+}
+
 } // namespace
 
 template<typename ChildType>
@@ -80,7 +89,7 @@ PassRefPtr<ChildType> HTMLConstructionSite::attach(Node* parent, PassRefPtr<Chil
     // FIXME: It's confusing that HTMLConstructionSite::attach does the magic
     // redirection to the foster parent but HTMLConstructionSite::attachAtSite
     // doesn't.  It feels like we're missing a concept somehow.
-    if (m_redirectAttachToFosterParent) {
+    if (shouldFosterParent()) {
         fosterParent(child.get());
         ASSERT(child->attached());
         return child.release();
@@ -200,20 +209,20 @@ PassRefPtr<Element> HTMLConstructionSite::attachToCurrent(PassRefPtr<Element> ch
 
 void HTMLConstructionSite::insertHTMLHtmlElement(AtomicHTMLToken& token)
 {
-    ASSERT(!m_redirectAttachToFosterParent);
+    ASSERT(!shouldFosterParent());
     m_openElements.pushHTMLHtmlElement(attachToCurrent(createHTMLElement(token)));
 }
 
 void HTMLConstructionSite::insertHTMLHeadElement(AtomicHTMLToken& token)
 {
-    ASSERT(!m_redirectAttachToFosterParent);
+    ASSERT(!shouldFosterParent());
     m_head = attachToCurrent(createHTMLElement(token));
     m_openElements.pushHTMLHeadElement(m_head);
 }
 
 void HTMLConstructionSite::insertHTMLBodyElement(AtomicHTMLToken& token)
 {
-    ASSERT(!m_redirectAttachToFosterParent);
+    ASSERT(!shouldFosterParent());
     m_openElements.pushHTMLBodyElement(attachToCurrent(createHTMLElement(token)));
 }
 
@@ -261,7 +270,7 @@ void HTMLConstructionSite::insertTextNode(const String& characters)
     AttachmentSite site;
     site.parent = currentElement();
     site.nextChild = 0;
-    if (m_redirectAttachToFosterParent)
+    if (shouldFosterParent())
         findFosterSite(site);
 
     Node* previousChild = site.nextChild ? site.nextChild->previousSibling() : site.parent->lastChild();
@@ -397,6 +406,12 @@ void HTMLConstructionSite::findFosterSite(AttachmentSite& site)
     site.nextChild = 0;
 }
 
+bool HTMLConstructionSite::shouldFosterParent() const
+{
+    return m_redirectAttachToFosterParent
+        && causesFosterParenting(currentElement()->tagQName());
+}
+
 void HTMLConstructionSite::fosterParent(Node* node)
 {
     AttachmentSite site;
diff --git a/WebCore/html/HTMLConstructionSite.h b/WebCore/html/HTMLConstructionSite.h
index d3a977a..fb27c96 100644
--- a/WebCore/html/HTMLConstructionSite.h
+++ b/WebCore/html/HTMLConstructionSite.h
@@ -66,6 +66,7 @@ public:
     PassRefPtr<Element> createHTMLElement(AtomicHTMLToken&);
     PassRefPtr<Element> createHTMLElementFromElementRecord(HTMLElementStack::ElementRecord*);
 
+    bool shouldFosterParent() const;
     void fosterParent(Node*);
 
     bool indexOfFirstUnopenFormattingElement(unsigned& firstUnopenElementIndex) const;
diff --git a/WebCore/html/HTMLTreeBuilder.cpp b/WebCore/html/HTMLTreeBuilder.cpp
index d784a7f..1c0ad27 100644
--- a/WebCore/html/HTMLTreeBuilder.cpp
+++ b/WebCore/html/HTMLTreeBuilder.cpp
@@ -1695,6 +1695,8 @@ void HTMLTreeBuilder::callTheAdoptionAgency(AtomicHTMLToken& token)
         }
         // 7
         const AtomicString& commonAncestorTag = commonAncestor->localName();
+        // FIXME: If this moves to HTMLConstructionSite, this check should use
+        // causesFosterParenting(tagName) instead.
         if (commonAncestorTag == tableTag
             || commonAncestorTag == trTag
             || isTableBodyContextTag(commonAncestorTag))

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list