Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: Source/WebCore/html/parser/HTMLTreeBuilder.cpp

Issue 7693023: Merge 93032 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/html/process-end-tag-for-inbody-crash-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google, Inc. All Rights Reserved. 2 * Copyright (C) 2010 Google, Inc. All Rights Reserved.
3 * Copyright (C) 2011 Apple Inc. All rights reserved. 3 * Copyright (C) 2011 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 } 598 }
599 599
600 } 600 }
601 601
602 template <bool shouldClose(const ContainerNode*)> 602 template <bool shouldClose(const ContainerNode*)>
603 void HTMLTreeBuilder::processCloseWhenNestedTag(AtomicHTMLToken& token) 603 void HTMLTreeBuilder::processCloseWhenNestedTag(AtomicHTMLToken& token)
604 { 604 {
605 m_framesetOk = false; 605 m_framesetOk = false;
606 HTMLElementStack::ElementRecord* nodeRecord = m_tree.openElements()->topReco rd(); 606 HTMLElementStack::ElementRecord* nodeRecord = m_tree.openElements()->topReco rd();
607 while (1) { 607 while (1) {
608 ContainerNode* node = nodeRecord->node(); 608 RefPtr<ContainerNode> node = nodeRecord->node();
609 if (shouldClose(node)) { 609 if (shouldClose(node.get())) {
610 ASSERT(node->isElementNode()); 610 ASSERT(node->isElementNode());
611 processFakeEndTag(toElement(node)->tagQName()); 611 processFakeEndTag(toElement(node.get())->tagQName());
612 break; 612 break;
613 } 613 }
614 if (isSpecialNode(node) && !node->hasTagName(addressTag) && !node->hasTa gName(divTag) && !node->hasTagName(pTag)) 614 if (isSpecialNode(node.get()) && !node->hasTagName(addressTag) && !node- >hasTagName(divTag) && !node->hasTagName(pTag))
615 break; 615 break;
616 nodeRecord = nodeRecord->next(); 616 nodeRecord = nodeRecord->next();
617 } 617 }
618 processFakePEndTagIfPInButtonScope(); 618 processFakePEndTagIfPInButtonScope();
619 m_tree.insertHTMLElement(token); 619 m_tree.insertHTMLElement(token);
620 } 620 }
621 621
622 namespace { 622 namespace {
623 623
624 typedef HashMap<AtomicString, QualifiedName> PrefixedNameToQualifiedNameMap; 624 typedef HashMap<AtomicString, QualifiedName> PrefixedNameToQualifiedNameMap;
(...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 notImplemented(); // Emit a more specific parse error based on stack content s. 1549 notImplemented(); // Emit a more specific parse error based on stack content s.
1550 setInsertionMode(AfterBodyMode); 1550 setInsertionMode(AfterBodyMode);
1551 return true; 1551 return true;
1552 } 1552 }
1553 1553
1554 void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomicHTMLToken& token) 1554 void HTMLTreeBuilder::processAnyOtherEndTagForInBody(AtomicHTMLToken& token)
1555 { 1555 {
1556 ASSERT(token.type() == HTMLTokenTypes::EndTag); 1556 ASSERT(token.type() == HTMLTokenTypes::EndTag);
1557 HTMLElementStack::ElementRecord* record = m_tree.openElements()->topRecord() ; 1557 HTMLElementStack::ElementRecord* record = m_tree.openElements()->topRecord() ;
1558 while (1) { 1558 while (1) {
1559 ContainerNode* node = record->node(); 1559 RefPtr<ContainerNode> node = record->node();
1560 if (node->hasLocalName(token.name())) { 1560 if (node->hasLocalName(token.name())) {
1561 m_tree.generateImpliedEndTags(); 1561 m_tree.generateImpliedEndTags();
1562 // FIXME: The ElementRecord pointed to by record might be deleted by 1562 // FIXME: The ElementRecord pointed to by record might be deleted by
1563 // the preceding call. Perhaps we should hold a RefPtr so that it 1563 // the preceding call. Perhaps we should hold a RefPtr so that it
1564 // stays alive for the duration of record's scope. 1564 // stays alive for the duration of record's scope.
1565 record = 0; 1565 record = 0;
1566 if (!m_tree.currentNode()->hasLocalName(token.name())) { 1566 if (!m_tree.currentNode()->hasLocalName(token.name())) {
1567 parseError(token); 1567 parseError(token);
1568 // FIXME: This is either a bug in the spec, or a bug in our 1568 // FIXME: This is either a bug in the spec, or a bug in our
1569 // implementation. Filed a bug with HTML5: 1569 // implementation. Filed a bug with HTML5:
1570 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10080 1570 // http://www.w3.org/Bugs/Public/show_bug.cgi?id=10080
1571 // We might have already popped the node for the token in 1571 // We might have already popped the node for the token in
1572 // generateImpliedEndTags, just abort. 1572 // generateImpliedEndTags, just abort.
1573 if (!m_tree.openElements()->contains(toElement(node))) 1573 if (!m_tree.openElements()->contains(toElement(node.get())))
1574 return; 1574 return;
1575 } 1575 }
1576 m_tree.openElements()->popUntilPopped(toElement(node)); 1576 m_tree.openElements()->popUntilPopped(toElement(node.get()));
1577 return; 1577 return;
1578 } 1578 }
1579 if (isSpecialNode(node)) { 1579 if (isSpecialNode(node.get())) {
1580 parseError(token); 1580 parseError(token);
1581 return; 1581 return;
1582 } 1582 }
1583 record = record->next(); 1583 record = record->next();
1584 } 1584 }
1585 } 1585 }
1586 1586
1587 // FIXME: This probably belongs on HTMLElementStack. 1587 // FIXME: This probably belongs on HTMLElementStack.
1588 HTMLElementStack::ElementRecord* HTMLTreeBuilder::furthestBlockForFormattingElem ent(Element* formattingElement) 1588 HTMLElementStack::ElementRecord* HTMLTreeBuilder::furthestBlockForFormattingElem ent(Element* formattingElement)
1589 { 1589 {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 // 2. 1626 // 2.
1627 HTMLElementStack::ElementRecord* furthestBlock = furthestBlockForFormatt ingElement(formattingElement); 1627 HTMLElementStack::ElementRecord* furthestBlock = furthestBlockForFormatt ingElement(formattingElement);
1628 // 3. 1628 // 3.
1629 if (!furthestBlock) { 1629 if (!furthestBlock) {
1630 m_tree.openElements()->popUntilPopped(formattingElement); 1630 m_tree.openElements()->popUntilPopped(formattingElement);
1631 m_tree.activeFormattingElements()->remove(formattingElement); 1631 m_tree.activeFormattingElements()->remove(formattingElement);
1632 return; 1632 return;
1633 } 1633 }
1634 // 4. 1634 // 4.
1635 ASSERT(furthestBlock->isAbove(formattingElementRecord)); 1635 ASSERT(furthestBlock->isAbove(formattingElementRecord));
1636 ContainerNode* commonAncestor = formattingElementRecord->next()->node(); 1636 RefPtr<ContainerNode> commonAncestor = formattingElementRecord->next()-> node();
1637 // 5. 1637 // 5.
1638 HTMLFormattingElementList::Bookmark bookmark = m_tree.activeFormattingEl ements()->bookmarkFor(formattingElement); 1638 HTMLFormattingElementList::Bookmark bookmark = m_tree.activeFormattingEl ements()->bookmarkFor(formattingElement);
1639 // 6. 1639 // 6.
1640 HTMLElementStack::ElementRecord* node = furthestBlock; 1640 HTMLElementStack::ElementRecord* node = furthestBlock;
1641 HTMLElementStack::ElementRecord* nextNode = node->next(); 1641 HTMLElementStack::ElementRecord* nextNode = node->next();
1642 HTMLElementStack::ElementRecord* lastNode = furthestBlock; 1642 HTMLElementStack::ElementRecord* lastNode = furthestBlock;
1643 for (int i = 0; i < adoptionAgencyIterationLimit; ++i) { 1643 for (int i = 0; i < adoptionAgencyIterationLimit; ++i) {
1644 // 6.1 1644 // 6.1
1645 node = nextNode; 1645 node = nextNode;
1646 ASSERT(node); 1646 ASSERT(node);
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 } 2837 }
2838 2838
2839 bool HTMLTreeBuilder::pluginsEnabled(Frame* frame) 2839 bool HTMLTreeBuilder::pluginsEnabled(Frame* frame)
2840 { 2840 {
2841 if (!frame) 2841 if (!frame)
2842 return false; 2842 return false;
2843 return frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiate Plugin); 2843 return frame->loader()->subframeLoader()->allowPlugins(NotAboutToInstantiate Plugin);
2844 } 2844 }
2845 2845
2846 } 2846 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/html/process-end-tag-for-inbody-crash-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698