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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 ASSERT(!shouldFosterParent()); | 589 ASSERT(!shouldFosterParent()); |
590 RefPtr<Element> body = createHTMLElement(token); | 590 RefPtr<Element> body = createHTMLElement(token); |
591 attachLater(currentNode(), body); | 591 attachLater(currentNode(), body); |
592 m_openElements.pushHTMLBodyElement(HTMLStackItem::create(body.release(), tok en)); | 592 m_openElements.pushHTMLBodyElement(HTMLStackItem::create(body.release(), tok en)); |
593 if (LocalFrame* frame = m_document->frame()) | 593 if (LocalFrame* frame = m_document->frame()) |
594 frame->loader().client()->dispatchWillInsertBody(); | 594 frame->loader().client()->dispatchWillInsertBody(); |
595 } | 595 } |
596 | 596 |
597 void HTMLConstructionSite::insertHTMLFormElement(AtomicHTMLToken* token, bool is Demoted) | 597 void HTMLConstructionSite::insertHTMLFormElement(AtomicHTMLToken* token, bool is Demoted) |
598 { | 598 { |
599 RefPtr<Element> element = createHTMLElement(token); | 599 RefPtrWillBeRawPtr<Element> element = createHTMLElement(token); |
600 ASSERT(isHTMLFormElement(element)); | 600 ASSERT(isHTMLFormElement(element)); |
601 m_form = static_pointer_cast<HTMLFormElement>(element.release()); | 601 m_form = static_pointer_cast<HTMLFormElement>(element.release()); |
602 m_form->setDemoted(isDemoted); | 602 m_form->setDemoted(isDemoted); |
603 attachLater(currentNode(), m_form); | 603 attachLater(currentNode(), m_form.get()); |
604 m_openElements.push(HTMLStackItem::create(m_form, token)); | 604 m_openElements.push(HTMLStackItem::create(m_form.get(), token)); |
605 } | 605 } |
606 | 606 |
607 void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token) | 607 void HTMLConstructionSite::insertHTMLElement(AtomicHTMLToken* token) |
608 { | 608 { |
609 RefPtr<Element> element = createHTMLElement(token); | 609 RefPtr<Element> element = createHTMLElement(token); |
610 attachLater(currentNode(), element); | 610 attachLater(currentNode(), element); |
611 m_openElements.push(HTMLStackItem::create(element.release(), token)); | 611 m_openElements.push(HTMLStackItem::create(element.release(), token)); |
612 } | 612 } |
613 | 613 |
614 void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken* token) | 614 void HTMLConstructionSite::insertSelfClosingHTMLElement(AtomicHTMLToken* token) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
724 return element.release(); | 724 return element.release(); |
725 } | 725 } |
726 | 726 |
727 inline Document& HTMLConstructionSite::ownerDocumentForCurrentNode() | 727 inline Document& HTMLConstructionSite::ownerDocumentForCurrentNode() |
728 { | 728 { |
729 if (isHTMLTemplateElement(*currentNode())) | 729 if (isHTMLTemplateElement(*currentNode())) |
730 return toHTMLTemplateElement(currentElement())->content()->document(); | 730 return toHTMLTemplateElement(currentElement())->content()->document(); |
731 return currentNode()->document(); | 731 return currentNode()->document(); |
732 } | 732 } |
733 | 733 |
734 PassRefPtr<Element> HTMLConstructionSite::createHTMLElement(AtomicHTMLToken* tok en) | 734 PassRefPtrWillBeRawPtr<Element> HTMLConstructionSite::createHTMLElement(AtomicHT MLToken* token) |
735 { | 735 { |
736 Document& document = ownerDocumentForCurrentNode(); | 736 Document& document = ownerDocumentForCurrentNode(); |
737 // Only associate the element with the current form if we're creating the ne w element | 737 // Only associate the element with the current form if we're creating the ne w element |
738 // in a document with a browsing context (rather than in <template> contents ). | 738 // in a document with a browsing context (rather than in <template> contents ). |
739 HTMLFormElement* form = document.frame() ? m_form.get() : 0; | 739 HTMLFormElement* form = document.frame() ? m_form.get() : 0; |
740 // FIXME: This can't use HTMLConstructionSite::createElement because we | 740 // FIXME: This can't use HTMLConstructionSite::createElement because we |
741 // have to pass the current form element. We should rework form association | 741 // have to pass the current form element. We should rework form association |
742 // to occur after construction to allow better code sharing here. | 742 // to occur after construction to allow better code sharing here. |
743 #if ENABLE(OILPAN) | |
744 // FIXME: HTMLElementFactory::createHTMLElement should return a raw pointer. | |
haraken
2014/05/09 09:27:34
FIXME: Oilpan:
zerny-chromium
2014/05/09 09:37:59
Yes. Or just leave the RefPtr which we will change
tkent
2014/05/09 09:46:31
Added Oilpan:.
I'd like to remove RefPtr<> as muc
| |
745 RawPtr<Element> element = HTMLElementFactory::createHTMLElement(token->name( ), document, form, true).get(); | |
746 #else | |
743 RefPtr<Element> element = HTMLElementFactory::createHTMLElement(token->name( ), document, form, true); | 747 RefPtr<Element> element = HTMLElementFactory::createHTMLElement(token->name( ), document, form, true); |
748 #endif | |
744 setAttributes(element.get(), token, m_parserContentPolicy); | 749 setAttributes(element.get(), token, m_parserContentPolicy); |
745 ASSERT(element->isHTMLElement()); | 750 ASSERT(element->isHTMLElement()); |
746 return element.release(); | 751 return element.release(); |
747 } | 752 } |
748 | 753 |
749 PassRefPtr<HTMLStackItem> HTMLConstructionSite::createElementFromSavedToken(HTML StackItem* item) | 754 PassRefPtr<HTMLStackItem> HTMLConstructionSite::createElementFromSavedToken(HTML StackItem* item) |
750 { | 755 { |
751 RefPtr<Element> element; | 756 RefPtr<Element> element; |
752 // NOTE: Moving from item -> token -> item copies the Attribute vector twice ! | 757 // NOTE: Moving from item -> token -> item copies the Attribute vector twice ! |
753 AtomicHTMLToken fakeToken(HTMLToken::StartTag, item->localName(), item->attr ibutes()); | 758 AtomicHTMLToken fakeToken(HTMLToken::StartTag, item->localName(), item->attr ibutes()); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
851 void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node) | 856 void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node) |
852 { | 857 { |
853 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); | 858 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); |
854 findFosterSite(task); | 859 findFosterSite(task); |
855 task.child = node; | 860 task.child = node; |
856 ASSERT(task.parent); | 861 ASSERT(task.parent); |
857 queueTask(task); | 862 queueTask(task); |
858 } | 863 } |
859 | 864 |
860 } | 865 } |
OLD | NEW |