Changeset 128373 in webkit
- Timestamp:
- Sep 12, 2012 3:40:15 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/html5lib/runner-expected.txt
r128359 r128373 10 10 resources/adoption01.dat: 11 11 14 12 1613 12 14 13 Test 14 of 17 in resources/adoption01.dat failed. Input: … … 66 65 | <div> 67 66 | <div> 68 69 Test 16 of 17 in resources/adoption01.dat failed. Input:70 <b><b><b><b>x</b></b></b></b>y71 Got:72 | <html>73 | <head>74 | <body>75 | <b>76 | <b>77 | <b>78 | <b>79 | "x"80 | "y"81 Expected:82 | <html>83 | <head>84 | <body>85 | <b>86 | <b>87 | <b>88 | <b>89 | "x"90 | "y"91 67 resources/adoption02.dat: PASS 92 68 -
trunk/Source/WebCore/ChangeLog
r128372 r128373 1 2012-09-12 Eric Seidel <eric@webkit.org> 2 3 HTML parser fails to propertly close 4 identical nested formatting elements 4 https://bugs.webkit.org/show_bug.cgi?id=96385 5 6 Reviewed by Adam Barth. 7 8 Add missing Adoption agency step 4.a to fix one of our two outlying Adoption Agency bugs. 9 This is the same step that Opera was missing (must have been recently added to the spec). 10 11 * html/parser/HTMLTreeBuilder.cpp: 12 (WebCore::HTMLTreeBuilder::callTheAdoptionAgency): 13 1 14 2012-09-12 Siraj Razick <siraj.razick@collabora.co.uk> 2 15 -
trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp
r126355 r128373 1421 1421 static const int innerIterationLimit = 3; 1422 1422 1423 // 1, 2, 3 and 16 are covered by the for() loop. 1423 1424 for (int i = 0; i < outerIterationLimit; ++i) { 1424 // 1.1425 // 4. 1425 1426 Element* formattingElement = m_tree.activeFormattingElements()->closestElementInScopeWithName(token->name()); 1426 if (!formattingElement || ((m_tree.openElements()->contains(formattingElement)) && !m_tree.openElements()->inScope(formattingElement))) { 1427 // 4.a 1428 if (!formattingElement) 1429 return processAnyOtherEndTagForInBody(token); 1430 // 4.c 1431 if ((m_tree.openElements()->contains(formattingElement)) && !m_tree.openElements()->inScope(formattingElement)) { 1427 1432 parseError(token); 1428 1433 notImplemented(); // Check the stack of open elements for a more specific parse error. 1429 1434 return; 1430 1435 } 1436 // 4.b 1431 1437 HTMLElementStack::ElementRecord* formattingElementRecord = m_tree.openElements()->find(formattingElement); 1432 1438 if (!formattingElementRecord) { … … 1435 1441 return; 1436 1442 } 1443 // 4.d 1437 1444 if (formattingElement != m_tree.currentElement()) 1438 1445 parseError(token); 1439 // 2.1446 // 5. 1440 1447 HTMLElementStack::ElementRecord* furthestBlock = m_tree.openElements()->furthestBlockForFormattingElement(formattingElement); 1441 // 3.1448 // 6. 1442 1449 if (!furthestBlock) { 1443 1450 m_tree.openElements()->popUntilPopped(formattingElement); … … 1445 1452 return; 1446 1453 } 1447 // 4.1454 // 7. 1448 1455 ASSERT(furthestBlock->isAbove(formattingElementRecord)); 1449 1456 RefPtr<HTMLStackItem> commonAncestor = formattingElementRecord->next()->stackItem(); 1450 // 5.1457 // 8. 1451 1458 HTMLFormattingElementList::Bookmark bookmark = m_tree.activeFormattingElements()->bookmarkFor(formattingElement); 1452 // 6.1459 // 9. 1453 1460 HTMLElementStack::ElementRecord* node = furthestBlock; 1454 1461 HTMLElementStack::ElementRecord* nextNode = node->next(); 1455 1462 HTMLElementStack::ElementRecord* lastNode = furthestBlock; 1463 // 9.1, 9.2, 9.3 and 9.11 are covered by the for() loop. 1456 1464 for (int i = 0; i < innerIterationLimit; ++i) { 1457 // 6.11465 // 9.4 1458 1466 node = nextNode; 1459 1467 ASSERT(node); 1460 nextNode = node->next(); // Save node->next() for the next iteration in case node is deleted in 6.2.1461 // 6.21468 nextNode = node->next(); // Save node->next() for the next iteration in case node is deleted in 9.5. 1469 // 9.5 1462 1470 if (!m_tree.activeFormattingElements()->contains(node->element())) { 1463 1471 m_tree.openElements()->remove(node->element()); … … 1465 1473 continue; 1466 1474 } 1467 // 6.31475 // 9.6 1468 1476 if (node == formattingElementRecord) 1469 1477 break; 1470 // 6.51478 // 9.7 1471 1479 RefPtr<HTMLStackItem> newItem = m_tree.createElementFromSavedToken(node->stackItem().get()); 1472 1480 … … 1474 1482 nodeEntry->replaceElement(newItem); 1475 1483 node->replaceElement(newItem.release()); 1476 // 6.4 -- Intentionally out of order to handle the case where node 1477 // was replaced in 6.5. 1478 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10096 1484 1485 // 9.8 1479 1486 if (lastNode == furthestBlock) 1480 1487 bookmark.moveToAfter(nodeEntry); 1481 // 6.61488 // 9.9 1482 1489 if (ContainerNode* parent = lastNode->element()->parentNode()) 1483 1490 parent->parserRemoveChild(lastNode->element()); … … 1485 1492 if (lastNode->element()->parentElement()->attached() && !lastNode->element()->attached()) 1486 1493 lastNode->element()->lazyAttach(); 1487 // 6.71494 // 9.10 1488 1495 lastNode = node; 1489 1496 } 1490 // 71497 // 10. 1491 1498 if (ContainerNode* parent = lastNode->element()->parentNode()) 1492 1499 parent->parserRemoveChild(lastNode->element()); … … 1500 1507 lastNode->element()->lazyAttach(); 1501 1508 } 1502 // 81509 // 11. 1503 1510 RefPtr<HTMLStackItem> newItem = m_tree.createElementFromSavedToken(formattingElementRecord->stackItem().get()); 1504 // 91511 // 12. 1505 1512 newItem->element()->takeAllChildrenFrom(furthestBlock->element()); 1506 // 1 01513 // 13. 1507 1514 Element* furthestBlockElement = furthestBlock->element(); 1508 1515 // FIXME: All this creation / parserAddChild / attach business should 1509 // be in HTMLConstructionSite. My guess is that steps 8--121516 // be in HTMLConstructionSite. My guess is that steps 11--15 1510 1517 // should all be in some HTMLConstructionSite function. 1511 1518 furthestBlockElement->parserAddChild(newItem->element()); 1519 // FIXME: Why is this attach logic necessary? Style resolve should attach us if needed. 1512 1520 if (furthestBlockElement->attached() && !newItem->element()->attached()) { 1513 1521 // Notice that newItem->element() might already be attached if, for example, one of the reparented … … 1515 1523 newItem->element()->attach(); 1516 1524 } 1517 // 1 11525 // 14. 1518 1526 m_tree.activeFormattingElements()->swapTo(formattingElement, newItem, bookmark); 1519 // 1 21527 // 15. 1520 1528 m_tree.openElements()->remove(formattingElement); 1521 1529 m_tree.openElements()->insertAbove(newItem, furthestBlock);
Note: See TracChangeset
for help on using the changeset viewer.