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