| OLD | NEW |
| 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 265 } |
| 266 } | 266 } |
| 267 | 267 |
| 268 void HTMLConstructionSite::queueTask(const HTMLConstructionSiteTask& task) | 268 void HTMLConstructionSite::queueTask(const HTMLConstructionSiteTask& task) |
| 269 { | 269 { |
| 270 flushPendingText(FlushAlways); | 270 flushPendingText(FlushAlways); |
| 271 ASSERT(m_pendingText.isEmpty()); | 271 ASSERT(m_pendingText.isEmpty()); |
| 272 m_taskQueue.append(task); | 272 m_taskQueue.append(task); |
| 273 } | 273 } |
| 274 | 274 |
| 275 void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtrWillBeRa
wPtr<Node> prpChild, bool selfClosing) | 275 void HTMLConstructionSite::attachLater(ContainerNode* parent, RawPtr<Node> prpCh
ild, bool selfClosing) |
| 276 { | 276 { |
| 277 ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->
isElementNode() || !toScriptLoaderIfPossible(toElement(prpChild.get()))); | 277 ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->
isElementNode() || !toScriptLoaderIfPossible(toElement(prpChild.get()))); |
| 278 ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !isHTMLPlugInElement
(prpChild)); | 278 ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !isHTMLPlugInElement
(prpChild)); |
| 279 | 279 |
| 280 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); | 280 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); |
| 281 task.parent = parent; | 281 task.parent = parent; |
| 282 task.child = prpChild; | 282 task.child = prpChild; |
| 283 task.selfClosing = selfClosing; | 283 task.selfClosing = selfClosing; |
| 284 | 284 |
| 285 if (shouldFosterParent()) { | 285 if (shouldFosterParent()) { |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 m_attachmentRoot = nullptr; | 368 m_attachmentRoot = nullptr; |
| 369 } | 369 } |
| 370 | 370 |
| 371 void HTMLConstructionSite::setForm(HTMLFormElement* form) | 371 void HTMLConstructionSite::setForm(HTMLFormElement* form) |
| 372 { | 372 { |
| 373 // This method should only be needed for HTMLTreeBuilder in the fragment cas
e. | 373 // This method should only be needed for HTMLTreeBuilder in the fragment cas
e. |
| 374 ASSERT(!m_form); | 374 ASSERT(!m_form); |
| 375 m_form = form; | 375 m_form = form; |
| 376 } | 376 } |
| 377 | 377 |
| 378 PassRefPtrWillBeRawPtr<HTMLFormElement> HTMLConstructionSite::takeForm() | 378 RawPtr<HTMLFormElement> HTMLConstructionSite::takeForm() |
| 379 { | 379 { |
| 380 return m_form.release(); | 380 return m_form.release(); |
| 381 } | 381 } |
| 382 | 382 |
| 383 void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded() | 383 void HTMLConstructionSite::dispatchDocumentElementAvailableIfNeeded() |
| 384 { | 384 { |
| 385 ASSERT(m_document); | 385 ASSERT(m_document); |
| 386 if (m_document->frame() && !m_isParsingFragment) | 386 if (m_document->frame() && !m_isParsingFragment) |
| 387 m_document->frame()->loader().dispatchDocumentElementAvailable(); | 387 m_document->frame()->loader().dispatchDocumentElementAvailable(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* tok
en) | 390 void HTMLConstructionSite::insertHTMLHtmlStartTagBeforeHTML(AtomicHTMLToken* tok
en) |
| 391 { | 391 { |
| 392 ASSERT(m_document); | 392 ASSERT(m_document); |
| 393 RefPtrWillBeRawPtr<HTMLHtmlElement> element = HTMLHtmlElement::create(*m_doc
ument); | 393 RawPtr<HTMLHtmlElement> element = HTMLHtmlElement::create(*m_document); |
| 394 setAttributes(element.get(), token, m_parserContentPolicy); | 394 setAttributes(element.get(), token, m_parserContentPolicy); |
| 395 attachLater(m_attachmentRoot, element); | 395 attachLater(m_attachmentRoot, element); |
| 396 m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element, token)); | 396 m_openElements.pushHTMLHtmlElement(HTMLStackItem::create(element, token)); |
| 397 | 397 |
| 398 executeQueuedTasks(); | 398 executeQueuedTasks(); |
| 399 element->insertedByParser(); | 399 element->insertedByParser(); |
| 400 dispatchDocumentElementAvailableIfNeeded(); | 400 dispatchDocumentElementAvailableIfNeeded(); |
| 401 } | 401 } |
| 402 | 402 |
| 403 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken*
token, Element* element) | 403 void HTMLConstructionSite::mergeAttributesFromTokenIntoElement(AtomicHTMLToken*
token, Element* element) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 flush(FlushAlways); | 542 flush(FlushAlways); |
| 543 m_document->finishedParsing(); | 543 m_document->finishedParsing(); |
| 544 } | 544 } |
| 545 | 545 |
| 546 void HTMLConstructionSite::insertDoctype(AtomicHTMLToken* token) | 546 void HTMLConstructionSite::insertDoctype(AtomicHTMLToken* token) |
| 547 { | 547 { |
| 548 ASSERT(token->type() == HTMLToken::DOCTYPE); | 548 ASSERT(token->type() == HTMLToken::DOCTYPE); |
| 549 | 549 |
| 550 const String& publicId = StringImpl::create8BitIfPossible(token->publicIdent
ifier()); | 550 const String& publicId = StringImpl::create8BitIfPossible(token->publicIdent
ifier()); |
| 551 const String& systemId = StringImpl::create8BitIfPossible(token->systemIdent
ifier()); | 551 const String& systemId = StringImpl::create8BitIfPossible(token->systemIdent
ifier()); |
| 552 RefPtrWillBeRawPtr<DocumentType> doctype = DocumentType::create(m_document,
token->name(), publicId, systemId); | 552 RawPtr<DocumentType> doctype = DocumentType::create(m_document, token->name(
), publicId, systemId); |
| 553 attachLater(m_attachmentRoot, doctype.release()); | 553 attachLater(m_attachmentRoot, doctype.release()); |
| 554 | 554 |
| 555 // DOCTYPE nodes are only processed when parsing fragments w/o contextElemen
ts, which | 555 // DOCTYPE nodes are only processed when parsing fragments w/o contextElemen
ts, which |
| 556 // never occurs. However, if we ever chose to support such, this code is su
btly wrong, | 556 // never occurs. However, if we ever chose to support such, this code is su
btly wrong, |
| 557 // because context-less fragments can determine their own quirks mode, and t
hus change | 557 // because context-less fragments can determine their own quirks mode, and t
hus change |
| 558 // parsing rules (like <p> inside <table>). For now we ASSERT that we never
hit this code | 558 // parsing rules (like <p> inside <table>). For now we ASSERT that we never
hit this code |
| 559 // in a fragment, as changing the owning document's compatibility mode would
be wrong. | 559 // in a fragment, as changing the owning document's compatibility mode would
be wrong. |
| 560 ASSERT(!m_isParsingFragment); | 560 ASSERT(!m_isParsingFragment); |
| 561 if (m_isParsingFragment) | 561 if (m_isParsingFragment) |
| 562 return; | 562 return; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 592 { | 592 { |
| 593 ASSERT(!shouldFosterParent()); | 593 ASSERT(!shouldFosterParent()); |
| 594 m_head = HTMLStackItem::create(createHTMLElement(token), token); | 594 m_head = HTMLStackItem::create(createHTMLElement(token), token); |
| 595 attachLater(currentNode(), m_head->element()); | 595 attachLater(currentNode(), m_head->element()); |
| 596 m_openElements.pushHTMLHeadElement(m_head); | 596 m_openElements.pushHTMLHeadElement(m_head); |
| 597 } | 597 } |
| 598 | 598 |
| 599 void HTMLConstructionSite::insertHTMLBodyElement(AtomicHTMLToken* token) | 599 void HTMLConstructionSite::insertHTMLBodyElement(AtomicHTMLToken* token) |
| 600 { | 600 { |
| 601 ASSERT(!shouldFosterParent()); | 601 ASSERT(!shouldFosterParent()); |
| 602 RefPtrWillBeRawPtr<HTMLElement> body = createHTMLElement(token); | 602 RawPtr<HTMLElement> body = createHTMLElement(token); |
| 603 attachLater(currentNode(), body); | 603 attachLater(currentNode(), body); |
| 604 m_openElements.pushHTMLBodyElement(HTMLStackItem::create(body.release(), tok
en)); | 604 m_openElements.pushHTMLBodyElement(HTMLStackItem::create(body.release(), tok
en)); |
| 605 if (m_document && m_document->frame()) | 605 if (m_document && m_document->frame()) |
| 606 m_document->frame()->loader().client()->dispatchWillInsertBody(); | 606 m_document->frame()->loader().client()->dispatchWillInsertBody(); |
| 607 } | 607 } |
| 608 | 608 |
| 609 void HTMLConstructionSite::insertHTMLFormElement(AtomicHTMLToken* token, bool is
Demoted) | 609 void HTMLConstructionSite::insertHTMLFormElement(AtomicHTMLToken* token, bool is
Demoted) |
| 610 { | 610 { |
| 611 RefPtrWillBeRawPtr<HTMLElement> element = createHTMLElement(token); | 611 RawPtr<HTMLElement> element = createHTMLElement(token); |
| 612 ASSERT(isHTMLFormElement(element)); | 612 ASSERT(isHTMLFormElement(element)); |
| 613 m_form = static_pointer_cast<HTMLFormElement>(element.release()); | 613 m_form = static_pointer_cast<HTMLFormElement>(element.release()); |
| 614 m_form->setDemoted(isDemoted); | 614 m_form->setDemoted(isDemoted); |
| 615 attachLater(currentNode(), m_form.get()); | 615 attachLater(currentNode(), m_form.get()); |
| 616 m_openElements.push(HTMLStackItem::create(m_form.get(), token)); | 616 m_openElements.push(HTMLStackItem::create(m_form.get(), token)); |
| 617 } | 617 } |
| 618 | 618 |
| 619 void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token) | 619 void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token) |
| 620 { | 620 { |
| 621 RefPtrWillBeRawPtr<HTMLElement> element = createHTMLElement(token); | 621 RawPtr<HTMLElement> element = createHTMLElement(token); |
| 622 attachLater(currentNode(), element); | 622 attachLater(currentNode(), element); |
| 623 m_openElements.push(HTMLStackItem::create(element.release(), token)); | 623 m_openElements.push(HTMLStackItem::create(element.release(), token)); |
| 624 } | 624 } |
| 625 | 625 |
| 626 void HTMLConstructionSite::insertSelfClosingHTMLElementDestroyingToken(AtomicHTM
LToken* token) | 626 void HTMLConstructionSite::insertSelfClosingHTMLElementDestroyingToken(AtomicHTM
LToken* token) |
| 627 { | 627 { |
| 628 ASSERT(token->type() == HTMLToken::StartTag); | 628 ASSERT(token->type() == HTMLToken::StartTag); |
| 629 // Normally HTMLElementStack is responsible for calling finishParsingChildre
n, | 629 // Normally HTMLElementStack is responsible for calling finishParsingChildre
n, |
| 630 // but self-closing elements are never in the element stack so the stack | 630 // but self-closing elements are never in the element stack so the stack |
| 631 // doesn't get a chance to tell them that we're done parsing their children. | 631 // doesn't get a chance to tell them that we're done parsing their children. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 645 | 645 |
| 646 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) | 646 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken* token) |
| 647 { | 647 { |
| 648 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.h
tml#already-started | 648 // http://www.whatwg.org/specs/web-apps/current-work/multipage/scripting-1.h
tml#already-started |
| 649 // http://html5.org/specs/dom-parsing.html#dom-range-createcontextualfragmen
t | 649 // http://html5.org/specs/dom-parsing.html#dom-range-createcontextualfragmen
t |
| 650 // For createContextualFragment, the specifications say to mark it parser-in
serted and already-started and later unmark them. | 650 // For createContextualFragment, the specifications say to mark it parser-in
serted and already-started and later unmark them. |
| 651 // However, we short circuit that logic to avoid the subtree traversal to fi
nd script elements since scripts can never see | 651 // However, we short circuit that logic to avoid the subtree traversal to fi
nd script elements since scripts can never see |
| 652 // those flags or effects thereof. | 652 // those flags or effects thereof. |
| 653 const bool parserInserted = m_parserContentPolicy != AllowScriptingContentAn
dDoNotMarkAlreadyStarted; | 653 const bool parserInserted = m_parserContentPolicy != AllowScriptingContentAn
dDoNotMarkAlreadyStarted; |
| 654 const bool alreadyStarted = m_isParsingFragment && parserInserted; | 654 const bool alreadyStarted = m_isParsingFragment && parserInserted; |
| 655 RefPtrWillBeRawPtr<HTMLScriptElement> element = HTMLScriptElement::create(ow
nerDocumentForCurrentNode(), parserInserted, alreadyStarted); | 655 RawPtr<HTMLScriptElement> element = HTMLScriptElement::create(ownerDocumentF
orCurrentNode(), parserInserted, alreadyStarted); |
| 656 setAttributes(element.get(), token, m_parserContentPolicy); | 656 setAttributes(element.get(), token, m_parserContentPolicy); |
| 657 if (scriptingContentIsAllowed(m_parserContentPolicy)) | 657 if (scriptingContentIsAllowed(m_parserContentPolicy)) |
| 658 attachLater(currentNode(), element); | 658 attachLater(currentNode(), element); |
| 659 m_openElements.push(HTMLStackItem::create(element.release(), token)); | 659 m_openElements.push(HTMLStackItem::create(element.release(), token)); |
| 660 } | 660 } |
| 661 | 661 |
| 662 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At
omicString& namespaceURI) | 662 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At
omicString& namespaceURI) |
| 663 { | 663 { |
| 664 ASSERT(token->type() == HTMLToken::StartTag); | 664 ASSERT(token->type() == HTMLToken::StartTag); |
| 665 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. | 665 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. |
| 666 | 666 |
| 667 RefPtrWillBeRawPtr<Element> element = createElement(token, namespaceURI); | 667 RawPtr<Element> element = createElement(token, namespaceURI); |
| 668 if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptLoaderIfPos
sible(element.get())) | 668 if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptLoaderIfPos
sible(element.get())) |
| 669 attachLater(currentNode(), element, token->selfClosing()); | 669 attachLater(currentNode(), element, token->selfClosing()); |
| 670 if (!token->selfClosing()) | 670 if (!token->selfClosing()) |
| 671 m_openElements.push(HTMLStackItem::create(element.release(), token, name
spaceURI)); | 671 m_openElements.push(HTMLStackItem::create(element.release(), token, name
spaceURI)); |
| 672 } | 672 } |
| 673 | 673 |
| 674 void HTMLConstructionSite::insertTextNode(const String& string, WhitespaceMode w
hitespaceMode) | 674 void HTMLConstructionSite::insertTextNode(const String& string, WhitespaceMode w
hitespaceMode) |
| 675 { | 675 { |
| 676 HTMLConstructionSiteTask dummyTask(HTMLConstructionSiteTask::Insert); | 676 HTMLConstructionSiteTask dummyTask(HTMLConstructionSiteTask::Insert); |
| 677 dummyTask.parent = currentNode(); | 677 dummyTask.parent = currentNode(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 } | 721 } |
| 722 | 722 |
| 723 void HTMLConstructionSite::takeAllChildren(HTMLStackItem* newParent, HTMLElement
Stack::ElementRecord* oldParent) | 723 void HTMLConstructionSite::takeAllChildren(HTMLStackItem* newParent, HTMLElement
Stack::ElementRecord* oldParent) |
| 724 { | 724 { |
| 725 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::TakeAllChildren); | 725 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::TakeAllChildren); |
| 726 task.parent = newParent->node(); | 726 task.parent = newParent->node(); |
| 727 task.child = oldParent->node(); | 727 task.child = oldParent->node(); |
| 728 queueTask(task); | 728 queueTask(task); |
| 729 } | 729 } |
| 730 | 730 |
| 731 PassRefPtrWillBeRawPtr<Element> HTMLConstructionSite::createElement(AtomicHTMLTo
ken* token, const AtomicString& namespaceURI) | 731 RawPtr<Element> HTMLConstructionSite::createElement(AtomicHTMLToken* token, cons
t AtomicString& namespaceURI) |
| 732 { | 732 { |
| 733 QualifiedName tagName(nullAtom, token->name(), namespaceURI); | 733 QualifiedName tagName(nullAtom, token->name(), namespaceURI); |
| 734 RefPtrWillBeRawPtr<Element> element = ownerDocumentForCurrentNode().createEl
ement(tagName, true); | 734 RawPtr<Element> element = ownerDocumentForCurrentNode().createElement(tagNam
e, true); |
| 735 setAttributes(element.get(), token, m_parserContentPolicy); | 735 setAttributes(element.get(), token, m_parserContentPolicy); |
| 736 return element.release(); | 736 return element.release(); |
| 737 } | 737 } |
| 738 | 738 |
| 739 inline Document& HTMLConstructionSite::ownerDocumentForCurrentNode() | 739 inline Document& HTMLConstructionSite::ownerDocumentForCurrentNode() |
| 740 { | 740 { |
| 741 if (isHTMLTemplateElement(*currentNode())) | 741 if (isHTMLTemplateElement(*currentNode())) |
| 742 return toHTMLTemplateElement(currentElement())->content()->document(); | 742 return toHTMLTemplateElement(currentElement())->content()->document(); |
| 743 return currentNode()->document(); | 743 return currentNode()->document(); |
| 744 } | 744 } |
| 745 | 745 |
| 746 PassRefPtrWillBeRawPtr<HTMLElement> HTMLConstructionSite::createHTMLElement(Atom
icHTMLToken* token) | 746 RawPtr<HTMLElement> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* tok
en) |
| 747 { | 747 { |
| 748 Document& document = ownerDocumentForCurrentNode(); | 748 Document& document = ownerDocumentForCurrentNode(); |
| 749 // Only associate the element with the current form if we're creating the ne
w element | 749 // Only associate the element with the current form if we're creating the ne
w element |
| 750 // in a document with a browsing context (rather than in <template> contents
). | 750 // in a document with a browsing context (rather than in <template> contents
). |
| 751 HTMLFormElement* form = document.frame() ? m_form.get() : 0; | 751 HTMLFormElement* form = document.frame() ? m_form.get() : 0; |
| 752 // FIXME: This can't use HTMLConstructionSite::createElement because we | 752 // FIXME: This can't use HTMLConstructionSite::createElement because we |
| 753 // have to pass the current form element. We should rework form association | 753 // have to pass the current form element. We should rework form association |
| 754 // to occur after construction to allow better code sharing here. | 754 // to occur after construction to allow better code sharing here. |
| 755 RefPtrWillBeRawPtr<HTMLElement> element = HTMLElementFactory::createHTMLElem
ent(token->name(), document, form, true); | 755 RawPtr<HTMLElement> element = HTMLElementFactory::createHTMLElement(token->n
ame(), document, form, true); |
| 756 setAttributes(element.get(), token, m_parserContentPolicy); | 756 setAttributes(element.get(), token, m_parserContentPolicy); |
| 757 return element.release(); | 757 return element.release(); |
| 758 } | 758 } |
| 759 | 759 |
| 760 PassRefPtrWillBeRawPtr<HTMLStackItem> HTMLConstructionSite::createElementFromSav
edToken(HTMLStackItem* item) | 760 RawPtr<HTMLStackItem> HTMLConstructionSite::createElementFromSavedToken(HTMLStac
kItem* item) |
| 761 { | 761 { |
| 762 RefPtrWillBeRawPtr<Element> element; | 762 RawPtr<Element> element; |
| 763 // NOTE: Moving from item -> token -> item copies the Attribute vector twice
! | 763 // NOTE: Moving from item -> token -> item copies the Attribute vector twice
! |
| 764 AtomicHTMLToken fakeToken(HTMLToken::StartTag, item->localName(), item->attr
ibutes()); | 764 AtomicHTMLToken fakeToken(HTMLToken::StartTag, item->localName(), item->attr
ibutes()); |
| 765 if (item->namespaceURI() == HTMLNames::xhtmlNamespaceURI) | 765 if (item->namespaceURI() == HTMLNames::xhtmlNamespaceURI) |
| 766 element = createHTMLElement(&fakeToken); | 766 element = createHTMLElement(&fakeToken); |
| 767 else | 767 else |
| 768 element = createElement(&fakeToken, item->namespaceURI()); | 768 element = createElement(&fakeToken, item->namespaceURI()); |
| 769 return HTMLStackItem::create(element.release(), &fakeToken, item->namespaceU
RI()); | 769 return HTMLStackItem::create(element.release(), &fakeToken, item->namespaceU
RI()); |
| 770 } | 770 } |
| 771 | 771 |
| 772 bool HTMLConstructionSite::indexOfFirstUnopenFormattingElement(unsigned& firstUn
openElementIndex) const | 772 bool HTMLConstructionSite::indexOfFirstUnopenFormattingElement(unsigned& firstUn
openElementIndex) const |
| (...skipping 16 matching lines...) Expand all Loading... |
| 789 void HTMLConstructionSite::reconstructTheActiveFormattingElements() | 789 void HTMLConstructionSite::reconstructTheActiveFormattingElements() |
| 790 { | 790 { |
| 791 unsigned firstUnopenElementIndex; | 791 unsigned firstUnopenElementIndex; |
| 792 if (!indexOfFirstUnopenFormattingElement(firstUnopenElementIndex)) | 792 if (!indexOfFirstUnopenFormattingElement(firstUnopenElementIndex)) |
| 793 return; | 793 return; |
| 794 | 794 |
| 795 unsigned unopenEntryIndex = firstUnopenElementIndex; | 795 unsigned unopenEntryIndex = firstUnopenElementIndex; |
| 796 ASSERT(unopenEntryIndex < m_activeFormattingElements.size()); | 796 ASSERT(unopenEntryIndex < m_activeFormattingElements.size()); |
| 797 for (; unopenEntryIndex < m_activeFormattingElements.size(); ++unopenEntryIn
dex) { | 797 for (; unopenEntryIndex < m_activeFormattingElements.size(); ++unopenEntryIn
dex) { |
| 798 HTMLFormattingElementList::Entry& unopenedEntry = m_activeFormattingElem
ents.at(unopenEntryIndex); | 798 HTMLFormattingElementList::Entry& unopenedEntry = m_activeFormattingElem
ents.at(unopenEntryIndex); |
| 799 RefPtrWillBeRawPtr<HTMLStackItem> reconstructed = createElementFromSaved
Token(unopenedEntry.stackItem().get()); | 799 RawPtr<HTMLStackItem> reconstructed = createElementFromSavedToken(unopen
edEntry.stackItem().get()); |
| 800 attachLater(currentNode(), reconstructed->node()); | 800 attachLater(currentNode(), reconstructed->node()); |
| 801 m_openElements.push(reconstructed); | 801 m_openElements.push(reconstructed); |
| 802 unopenedEntry.replaceElement(reconstructed.release()); | 802 unopenedEntry.replaceElement(reconstructed.release()); |
| 803 } | 803 } |
| 804 } | 804 } |
| 805 | 805 |
| 806 void HTMLConstructionSite::generateImpliedEndTagsWithExclusion(const AtomicStrin
g& tagName) | 806 void HTMLConstructionSite::generateImpliedEndTagsWithExclusion(const AtomicStrin
g& tagName) |
| 807 { | 807 { |
| 808 while (hasImpliedEndTag(currentStackItem()) && !currentStackItem()->matchesH
TMLTag(tagName)) | 808 while (hasImpliedEndTag(currentStackItem()) && !currentStackItem()->matchesH
TMLTag(tagName)) |
| 809 m_openElements.pop(); | 809 m_openElements.pop(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 task.parent = lastTable->next()->element(); | 855 task.parent = lastTable->next()->element(); |
| 856 } | 856 } |
| 857 | 857 |
| 858 bool HTMLConstructionSite::shouldFosterParent() const | 858 bool HTMLConstructionSite::shouldFosterParent() const |
| 859 { | 859 { |
| 860 return m_redirectAttachToFosterParent | 860 return m_redirectAttachToFosterParent |
| 861 && currentStackItem()->isElementNode() | 861 && currentStackItem()->isElementNode() |
| 862 && currentStackItem()->causesFosterParenting(); | 862 && currentStackItem()->causesFosterParenting(); |
| 863 } | 863 } |
| 864 | 864 |
| 865 void HTMLConstructionSite::fosterParent(PassRefPtrWillBeRawPtr<Node> node) | 865 void HTMLConstructionSite::fosterParent(RawPtr<Node> node) |
| 866 { | 866 { |
| 867 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); | 867 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); |
| 868 findFosterSite(task); | 868 findFosterSite(task); |
| 869 task.child = node; | 869 task.child = node; |
| 870 ASSERT(task.parent); | 870 ASSERT(task.parent); |
| 871 queueTask(task); | 871 queueTask(task); |
| 872 } | 872 } |
| 873 | 873 |
| 874 DEFINE_TRACE(HTMLConstructionSite::PendingText) | 874 DEFINE_TRACE(HTMLConstructionSite::PendingText) |
| 875 { | 875 { |
| 876 visitor->trace(parent); | 876 visitor->trace(parent); |
| 877 visitor->trace(nextChild); | 877 visitor->trace(nextChild); |
| 878 } | 878 } |
| 879 | 879 |
| 880 } // namespace blink | 880 } // namespace blink |
| OLD | NEW |