Changeset 63386 in webkit
- Timestamp:
- Jul 14, 2010 6:06:11 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r63381 r63386 1 2010-07-14 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 HTMLTreeBuilder foster parents when it should not 6 https://bugs.webkit.org/show_bug.cgi?id=42235 7 8 * html5lib/resources/adoption01.dat: 9 * html5lib/runner-expected-html5.txt: 10 * html5lib/runner-expected.txt: 11 1 12 2010-07-14 Alexey Proskuryakov <ap@apple.com> 2 13 -
trunk/LayoutTests/html5lib/resources/adoption01.dat
r63338 r63386 165 165 | id="A" 166 166 | "TEXT" 167 168 #data 169 <table><a>1<td>2</td>3</table> 170 #errors 171 #document 172 | <html> 173 | <head> 174 | <body> 175 | <a> 176 | "1" 177 | <a> 178 | "3" 179 | <table> 180 | <tbody> 181 | <tr> 182 | <td> 183 | "2" -
trunk/LayoutTests/html5lib/runner-expected-html5.txt
r63338 r63386 7 7 CONSOLE MESSAGE: line 2: FOO<span>BAR</span>BAZ 8 8 Content-Type: text/plain 9 resources/tests1.dat: 10 78 11 80 12 13 Test 78 of 113 in resources/tests1.dat failed. Input: 14 <a href="blah">aba<table><a href="foo">br<tr><td></td></tr>x</table>aoe 15 Got: 16 | <html> 17 | <head> 18 | <body> 19 | <a> 20 | href="blah" 21 | "aba" 22 | <a> 23 | href="foo" 24 | "br" 25 | <a> 26 | href="foo" 27 | "x" 28 | <table> 29 | <tbody> 30 | <tr> 31 | <td> 32 | <a> 33 | href="foo" 34 | "aoe" 35 Expected: 36 | <html> 37 | <head> 38 | <body> 39 | <a> 40 | href="blah" 41 | "aba" 42 | <a> 43 | href="foo" 44 | "br" 45 | <a> 46 | href="foo" 47 | "x" 48 | <table> 49 | <tbody> 50 | <tr> 51 | <td> 52 | <a> 53 | href="foo" 54 | "aoe" 55 56 Test 80 of 113 in resources/tests1.dat failed. Input: 57 <table><a href="blah">aba<tr><td><a href="foo">br</td></tr>x</table>aoe 58 Got: 59 | <html> 60 | <head> 61 | <body> 62 | <a> 63 | href="blah" 64 | "aba" 65 | <a> 66 | href="blah" 67 | "x" 68 | <table> 69 | <tbody> 70 | <tr> 71 | <td> 72 | <a> 73 | href="foo" 74 | "br" 75 | <a> 76 | href="blah" 77 | "aoe" 78 Expected: 79 | <html> 80 | <head> 81 | <body> 82 | <a> 83 | href="blah" 84 | "aba" 85 | <a> 86 | href="blah" 87 | "x" 88 | <table> 89 | <tbody> 90 | <tr> 91 | <td> 92 | <a> 93 | href="foo" 94 | "br" 95 | <a> 96 | href="blah" 97 | "aoe" 9 resources/tests1.dat: PASS 10 98 11 resources/tests2.dat: PASS 99 12 … … 207 120 resources/tests7.dat: 208 121 24 209 27210 122 30 211 123 … … 218 130 | <body> 219 131 | "X" 220 221 Test 27 of 30 in resources/tests7.dat failed. Input:222 <table><b><tr><td>aaa</td></tr>bbb</table>ccc223 Got:224 | <html>225 | <head>226 | <body>227 | <b>228 | <b>229 | "bbb"230 | <table>231 | <tbody>232 | <tr>233 | <td>234 | "aaa"235 | <b>236 | "ccc"237 Expected:238 | <html>239 | <head>240 | <body>241 | <b>242 | <b>243 | "bbb"244 | <table>245 | <tbody>246 | <tr>247 | <td>248 | "aaa"249 | <b>250 | "ccc"251 132 252 133 Test 30 of 30 in resources/tests7.dat failed. Input: … … 329 210 11 330 211 331 Test 3 of 1 1in resources/adoption01.dat failed. Input:212 Test 3 of 12 in resources/adoption01.dat failed. Input: 332 213 <a>1<button>2</a>3</button> 333 214 Got: … … 349 230 | "3" 350 231 351 Test 11 of 1 1in resources/adoption01.dat failed. Input:232 Test 11 of 12 in resources/adoption01.dat failed. Input: 352 233 <p><b id="A"><script>document.getElementById("A").id = "B"</script></p>TEXT</b> 353 234 Got: -
trunk/LayoutTests/html5lib/runner-expected.txt
r63338 r63386 5005 5005 9 5006 5006 11 5007 5008 Test 1 of 11 in resources/adoption01.dat failed. Input: 5007 12 5008 5009 Test 1 of 12 in resources/adoption01.dat failed. Input: 5009 5010 <a><p></a></p> 5010 5011 Got: … … 5022 5023 | <a> 5023 5024 5024 Test 6 of 1 1in resources/adoption01.dat failed. Input:5025 Test 6 of 12 in resources/adoption01.dat failed. Input: 5025 5026 <table><a>1<p>2</a>3</p> 5026 5027 Got: … … 5047 5048 | <table> 5048 5049 5049 Test 7 of 1 1in resources/adoption01.dat failed. Input:5050 Test 7 of 12 in resources/adoption01.dat failed. Input: 5050 5051 <b><b><a><p></a> 5051 5052 Got: … … 5067 5068 | <a> 5068 5069 5069 Test 8 of 1 1in resources/adoption01.dat failed. Input:5070 Test 8 of 12 in resources/adoption01.dat failed. Input: 5070 5071 <b><a><b><p></a> 5071 5072 Got: … … 5089 5090 | <a> 5090 5091 5091 Test 9 of 1 1in resources/adoption01.dat failed. Input:5092 Test 9 of 12 in resources/adoption01.dat failed. Input: 5092 5093 <a><b><b><p></a> 5093 5094 Got: … … 5113 5114 | <a> 5114 5115 5115 Test 11 of 1 1in resources/adoption01.dat failed. Input:5116 Test 11 of 12 in resources/adoption01.dat failed. Input: 5116 5117 <p><b id="A"><script>document.getElementById("A").id = "B"</script></p>TEXT</b> 5117 5118 Got: … … 5139 5140 | id="A" 5140 5141 | "TEXT" 5142 5143 Test 12 of 12 in resources/adoption01.dat failed. Input: 5144 <table><a>1<td>2</td>3</table> 5145 Got: 5146 | <html> 5147 | <head> 5148 | <body> 5149 | <a> 5150 | "1" 5151 | "3" 5152 | <table> 5153 | <tbody> 5154 | <tr> 5155 | <td> 5156 | "2" 5157 Expected: 5158 | <html> 5159 | <head> 5160 | <body> 5161 | <a> 5162 | "1" 5163 | <a> 5164 | "3" 5165 | <table> 5166 | <tbody> 5167 | <tr> 5168 | <td> 5169 | "2" 5141 5170 resources/inbody01.dat: PASS 5142 5171 -
trunk/WebCore/ChangeLog
r63384 r63386 1 2010-07-14 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Adam Barth. 4 5 HTMLTreeBuilder foster parents when it should not 6 https://bugs.webkit.org/show_bug.cgi?id=42235 7 8 Regarding foster parenting of nodes inside tables: 9 "Process the token using the rules for the "in body" insertion mode, 10 except that if the current node is a table, tbody, tfoot, thead, or 11 tr element, then, whenever a node would be inserted into the current 12 node, it must instead be foster parented." 13 14 We were forgetting the "when the current node is" part of that check 15 and always foster parenting, even if we had just inserted another 16 element (which would have just changed the current node). 17 18 This was covered by multiple tests in html5lib/runner.html 19 but I wrote a reduction (one which I included) as it makes it 20 easier to see what's going on. 21 22 * html/HTMLConstructionSite.cpp: 23 (WebCore::HTMLNames::causesFosterParenting): 24 (WebCore::HTMLConstructionSite::attach): 25 (WebCore::HTMLConstructionSite::insertHTMLHtmlElement): 26 (WebCore::HTMLConstructionSite::insertHTMLHeadElement): 27 (WebCore::HTMLConstructionSite::insertHTMLBodyElement): 28 (WebCore::HTMLConstructionSite::insertTextNode): 29 (WebCore::HTMLConstructionSite::shouldFosterParent): 30 * html/HTMLConstructionSite.h: 31 * html/HTMLTreeBuilder.cpp: 32 (WebCore::HTMLTreeBuilder::callTheAdoptionAgency): 33 1 34 2010-07-14 Brady Eidson <beidson@apple.com> 2 35 -
trunk/WebCore/html/HTMLConstructionSite.cpp
r63338 r63386 71 71 } 72 72 73 bool causesFosterParenting(const QualifiedName& tagName) 74 { 75 return tagName == tableTag 76 || tagName == tbodyTag 77 || tagName == tfootTag 78 || tagName == theadTag 79 || tagName == trTag; 80 } 81 73 82 } // namespace 74 83 … … 81 90 // redirection to the foster parent but HTMLConstructionSite::attachAtSite 82 91 // doesn't. It feels like we're missing a concept somehow. 83 if ( m_redirectAttachToFosterParent) {92 if (shouldFosterParent()) { 84 93 fosterParent(child.get()); 85 94 ASSERT(child->attached()); … … 201 210 void HTMLConstructionSite::insertHTMLHtmlElement(AtomicHTMLToken& token) 202 211 { 203 ASSERT(! m_redirectAttachToFosterParent);212 ASSERT(!shouldFosterParent()); 204 213 m_openElements.pushHTMLHtmlElement(attachToCurrent(createHTMLElement(token))); 205 214 } … … 207 216 void HTMLConstructionSite::insertHTMLHeadElement(AtomicHTMLToken& token) 208 217 { 209 ASSERT(! m_redirectAttachToFosterParent);218 ASSERT(!shouldFosterParent()); 210 219 m_head = attachToCurrent(createHTMLElement(token)); 211 220 m_openElements.pushHTMLHeadElement(m_head); … … 214 223 void HTMLConstructionSite::insertHTMLBodyElement(AtomicHTMLToken& token) 215 224 { 216 ASSERT(! m_redirectAttachToFosterParent);225 ASSERT(!shouldFosterParent()); 217 226 m_openElements.pushHTMLBodyElement(attachToCurrent(createHTMLElement(token))); 218 227 } … … 262 271 site.parent = currentElement(); 263 272 site.nextChild = 0; 264 if ( m_redirectAttachToFosterParent)273 if (shouldFosterParent()) 265 274 findFosterSite(site); 266 275 … … 398 407 } 399 408 409 bool HTMLConstructionSite::shouldFosterParent() const 410 { 411 return m_redirectAttachToFosterParent 412 && causesFosterParenting(currentElement()->tagQName()); 413 } 414 400 415 void HTMLConstructionSite::fosterParent(Node* node) 401 416 { -
trunk/WebCore/html/HTMLConstructionSite.h
r63338 r63386 67 67 PassRefPtr<Element> createHTMLElementFromElementRecord(HTMLElementStack::ElementRecord*); 68 68 69 bool shouldFosterParent() const; 69 70 void fosterParent(Node*); 70 71 -
trunk/WebCore/html/HTMLTreeBuilder.cpp
r63374 r63386 1696 1696 // 7 1697 1697 const AtomicString& commonAncestorTag = commonAncestor->localName(); 1698 // FIXME: If this moves to HTMLConstructionSite, this check should use 1699 // causesFosterParenting(tagName) instead. 1698 1700 if (commonAncestorTag == tableTag 1699 1701 || commonAncestorTag == trTag
Note: See TracChangeset
for help on using the changeset viewer.