| 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 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/html/parser/HTMLTreeBuilder.h" | 28 #include "core/html/parser/HTMLTreeBuilder.h" |
| 29 | 29 |
| 30 #include "HTMLElementFactory.h" | 30 #include "HTMLElementFactory.h" |
| 31 #include "HTMLNames.h" | 31 #include "HTMLNames.h" |
| 32 #include "core/dom/Comment.h" | 32 #include "core/dom/Comment.h" |
| 33 #include "core/dom/DocumentFragment.h" | 33 #include "core/dom/DocumentFragment.h" |
| 34 #include "core/dom/DocumentType.h" | 34 #include "core/dom/DocumentType.h" |
| 35 #include "core/dom/Element.h" | 35 #include "core/dom/Element.h" |
| 36 #include "core/dom/ScriptLoader.h" |
| 36 #include "core/dom/Text.h" | 37 #include "core/dom/Text.h" |
| 37 #include "core/html/HTMLFormElement.h" | 38 #include "core/html/HTMLFormElement.h" |
| 38 #include "core/html/HTMLHtmlElement.h" | 39 #include "core/html/HTMLHtmlElement.h" |
| 39 #include "core/html/HTMLScriptElement.h" | 40 #include "core/html/HTMLScriptElement.h" |
| 40 #include "core/html/HTMLTemplateElement.h" | 41 #include "core/html/HTMLTemplateElement.h" |
| 41 #include "core/html/parser/AtomicHTMLToken.h" | 42 #include "core/html/parser/AtomicHTMLToken.h" |
| 42 #include "core/html/parser/HTMLParserIdioms.h" | 43 #include "core/html/parser/HTMLParserIdioms.h" |
| 43 #include "core/html/parser/HTMLStackItem.h" | 44 #include "core/html/parser/HTMLStackItem.h" |
| 44 #include "core/html/parser/HTMLToken.h" | 45 #include "core/html/parser/HTMLToken.h" |
| 45 #include "core/loader/FrameLoader.h" | 46 #include "core/loader/FrameLoader.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return executeReparentTask(task); | 169 return executeReparentTask(task); |
| 169 | 170 |
| 170 if (task.operation == HTMLConstructionSiteTask::TakeAllChildren) | 171 if (task.operation == HTMLConstructionSiteTask::TakeAllChildren) |
| 171 return executeTakeAllChildrenTask(task); | 172 return executeTakeAllChildrenTask(task); |
| 172 | 173 |
| 173 ASSERT_NOT_REACHED(); | 174 ASSERT_NOT_REACHED(); |
| 174 } | 175 } |
| 175 | 176 |
| 176 void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> p
rpChild, bool selfClosing) | 177 void HTMLConstructionSite::attachLater(ContainerNode* parent, PassRefPtr<Node> p
rpChild, bool selfClosing) |
| 177 { | 178 { |
| 178 ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->
isElementNode() || !toScriptElementIfPossible(toElement(prpChild.get()))); | 179 ASSERT(scriptingContentIsAllowed(m_parserContentPolicy) || !prpChild.get()->
isElementNode() || !toScriptLoaderIfPossible(toElement(prpChild.get()))); |
| 179 ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !prpChild->isPluginE
lement()); | 180 ASSERT(pluginContentIsAllowed(m_parserContentPolicy) || !prpChild->isPluginE
lement()); |
| 180 | 181 |
| 181 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); | 182 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); |
| 182 task.parent = parent; | 183 task.parent = parent; |
| 183 task.child = prpChild; | 184 task.child = prpChild; |
| 184 task.selfClosing = selfClosing; | 185 task.selfClosing = selfClosing; |
| 185 | 186 |
| 186 if (shouldFosterParent()) { | 187 if (shouldFosterParent()) { |
| 187 fosterParent(task.child); | 188 fosterParent(task.child); |
| 188 return; | 189 return; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 attachLater(currentNode(), element); | 526 attachLater(currentNode(), element); |
| 526 m_openElements.push(HTMLStackItem::create(element.release(), token)); | 527 m_openElements.push(HTMLStackItem::create(element.release(), token)); |
| 527 } | 528 } |
| 528 | 529 |
| 529 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At
omicString& namespaceURI) | 530 void HTMLConstructionSite::insertForeignElement(AtomicHTMLToken* token, const At
omicString& namespaceURI) |
| 530 { | 531 { |
| 531 ASSERT(token->type() == HTMLToken::StartTag); | 532 ASSERT(token->type() == HTMLToken::StartTag); |
| 532 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. | 533 notImplemented(); // parseError when xmlns or xmlns:xlink are wrong. |
| 533 | 534 |
| 534 RefPtr<Element> element = createElement(token, namespaceURI); | 535 RefPtr<Element> element = createElement(token, namespaceURI); |
| 535 if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptElementIfPo
ssible(element.get())) | 536 if (scriptingContentIsAllowed(m_parserContentPolicy) || !toScriptLoaderIfPos
sible(element.get())) |
| 536 attachLater(currentNode(), element, token->selfClosing()); | 537 attachLater(currentNode(), element, token->selfClosing()); |
| 537 if (!token->selfClosing()) | 538 if (!token->selfClosing()) |
| 538 m_openElements.push(HTMLStackItem::create(element.release(), token, name
spaceURI)); | 539 m_openElements.push(HTMLStackItem::create(element.release(), token, name
spaceURI)); |
| 539 } | 540 } |
| 540 | 541 |
| 541 void HTMLConstructionSite::insertTextNode(const String& characters, WhitespaceMo
de whitespaceMode) | 542 void HTMLConstructionSite::insertTextNode(const String& characters, WhitespaceMo
de whitespaceMode) |
| 542 { | 543 { |
| 543 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); | 544 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); |
| 544 task.parent = currentNode(); | 545 task.parent = currentNode(); |
| 545 | 546 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 { | 759 { |
| 759 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); | 760 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); |
| 760 findFosterSite(task); | 761 findFosterSite(task); |
| 761 task.child = node; | 762 task.child = node; |
| 762 ASSERT(task.parent); | 763 ASSERT(task.parent); |
| 763 | 764 |
| 764 m_taskQueue.append(task); | 765 m_taskQueue.append(task); |
| 765 } | 766 } |
| 766 | 767 |
| 767 } | 768 } |
| OLD | NEW |