| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "core/html/HTMLScriptElement.h" | 43 #include "core/html/HTMLScriptElement.h" |
| 44 #include "core/html/HTMLTemplateElement.h" | 44 #include "core/html/HTMLTemplateElement.h" |
| 45 #include "core/html/parser/AtomicHTMLToken.h" | 45 #include "core/html/parser/AtomicHTMLToken.h" |
| 46 #include "core/html/parser/HTMLParserIdioms.h" | 46 #include "core/html/parser/HTMLParserIdioms.h" |
| 47 #include "core/html/parser/HTMLStackItem.h" | 47 #include "core/html/parser/HTMLStackItem.h" |
| 48 #include "core/html/parser/HTMLToken.h" | 48 #include "core/html/parser/HTMLToken.h" |
| 49 #include "core/loader/FrameLoader.h" | 49 #include "core/loader/FrameLoader.h" |
| 50 #include "core/loader/FrameLoaderClient.h" | 50 #include "core/loader/FrameLoaderClient.h" |
| 51 #include "core/svg/SVGScriptElement.h" | 51 #include "core/svg/SVGScriptElement.h" |
| 52 #include "platform/NotImplemented.h" | 52 #include "platform/NotImplemented.h" |
| 53 #include "platform/ScriptForbiddenScope.h" | |
| 54 #include "platform/text/TextBreakIterator.h" | 53 #include "platform/text/TextBreakIterator.h" |
| 55 #include <limits> | 54 #include <limits> |
| 56 | 55 |
| 57 namespace blink { | 56 namespace blink { |
| 58 | 57 |
| 59 using namespace HTMLNames; | 58 using namespace HTMLNames; |
| 60 | 59 |
| 61 static const unsigned maximumHTMLParserDOMTreeDepth = 512; | 60 static const unsigned maximumHTMLParserDOMTreeDepth = 512; |
| 62 | 61 |
| 63 static inline void setAttributes(Element* element, AtomicHTMLToken* token, Parse
rContentPolicy parserContentPolicy) | 62 static inline void setAttributes(Element* element, AtomicHTMLToken* token, Parse
rContentPolicy parserContentPolicy) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 static inline bool isAllWhitespace(const String& string) | 95 static inline bool isAllWhitespace(const String& string) |
| 97 { | 96 { |
| 98 return string.isAllSpecialCharacters<isHTMLSpace<UChar>>(); | 97 return string.isAllSpecialCharacters<isHTMLSpace<UChar>>(); |
| 99 } | 98 } |
| 100 | 99 |
| 101 static inline void insert(HTMLConstructionSiteTask& task) | 100 static inline void insert(HTMLConstructionSiteTask& task) |
| 102 { | 101 { |
| 103 if (isHTMLTemplateElement(*task.parent)) | 102 if (isHTMLTemplateElement(*task.parent)) |
| 104 task.parent = toHTMLTemplateElement(task.parent.get())->content(); | 103 task.parent = toHTMLTemplateElement(task.parent.get())->content(); |
| 105 | 104 |
| 106 if (ContainerNode* parent = task.child->parentNode()) { | 105 if (ContainerNode* parent = task.child->parentNode()) |
| 107 ScriptForbiddenScope forbidScript; | |
| 108 parent->parserRemoveChild(*task.child); | 106 parent->parserRemoveChild(*task.child); |
| 109 } | |
| 110 | 107 |
| 111 if (task.nextChild) | 108 if (task.nextChild) |
| 112 task.parent->parserInsertBefore(task.child.get(), *task.nextChild); | 109 task.parent->parserInsertBefore(task.child.get(), *task.nextChild); |
| 113 else | 110 else |
| 114 task.parent->parserAppendChild(task.child.get()); | 111 task.parent->parserAppendChild(task.child.get()); |
| 115 } | 112 } |
| 116 | 113 |
| 117 static inline void executeInsertTask(HTMLConstructionSiteTask& task) | 114 static inline void executeInsertTask(HTMLConstructionSiteTask& task) |
| 118 { | 115 { |
| 119 ASSERT(task.operation == HTMLConstructionSiteTask::Insert); | 116 ASSERT(task.operation == HTMLConstructionSiteTask::Insert); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 146 } | 143 } |
| 147 } | 144 } |
| 148 | 145 |
| 149 insert(task); | 146 insert(task); |
| 150 } | 147 } |
| 151 | 148 |
| 152 static inline void executeReparentTask(HTMLConstructionSiteTask& task) | 149 static inline void executeReparentTask(HTMLConstructionSiteTask& task) |
| 153 { | 150 { |
| 154 ASSERT(task.operation == HTMLConstructionSiteTask::Reparent); | 151 ASSERT(task.operation == HTMLConstructionSiteTask::Reparent); |
| 155 | 152 |
| 156 if (ContainerNode* parent = task.child->parentNode()) { | 153 if (ContainerNode* parent = task.child->parentNode()) |
| 157 ScriptForbiddenScope forbidScript; | |
| 158 parent->parserRemoveChild(*task.child); | 154 parent->parserRemoveChild(*task.child); |
| 159 } | |
| 160 | 155 |
| 161 task.parent->parserAppendChild(task.child); | 156 task.parent->parserAppendChild(task.child); |
| 162 } | 157 } |
| 163 | 158 |
| 164 static inline void executeInsertAlreadyParsedChildTask(HTMLConstructionSiteTask&
task) | 159 static inline void executeInsertAlreadyParsedChildTask(HTMLConstructionSiteTask&
task) |
| 165 { | 160 { |
| 166 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild)
; | 161 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild)
; |
| 167 | 162 |
| 168 insert(task); | 163 insert(task); |
| 169 } | 164 } |
| (...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 } | 879 } |
| 885 | 880 |
| 886 DEFINE_TRACE(HTMLConstructionSite::PendingText) | 881 DEFINE_TRACE(HTMLConstructionSite::PendingText) |
| 887 { | 882 { |
| 888 visitor->trace(parent); | 883 visitor->trace(parent); |
| 889 visitor->trace(nextChild); | 884 visitor->trace(nextChild); |
| 890 } | 885 } |
| 891 | 886 |
| 892 | 887 |
| 893 } | 888 } |
| OLD | NEW |