Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: Source/core/html/parser/HTMLConstructionSite.cpp

Issue 1117973003: parserInsertBefore and parserRemoveChild should check newChild for a parent. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Update comment. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 static inline bool isAllWhitespace(const String& string) 95 static inline bool isAllWhitespace(const String& string)
96 { 96 {
97 return string.isAllSpecialCharacters<isHTMLSpace<UChar>>(); 97 return string.isAllSpecialCharacters<isHTMLSpace<UChar>>();
98 } 98 }
99 99
100 static inline void insert(HTMLConstructionSiteTask& task) 100 static inline void insert(HTMLConstructionSiteTask& task)
101 { 101 {
102 if (isHTMLTemplateElement(*task.parent)) 102 if (isHTMLTemplateElement(*task.parent))
103 task.parent = toHTMLTemplateElement(task.parent.get())->content(); 103 task.parent = toHTMLTemplateElement(task.parent.get())->content();
104 104
105 if (ContainerNode* parent = task.child->parentNode())
106 parent->parserRemoveChild(*task.child);
107
108 if (task.nextChild) 105 if (task.nextChild)
109 task.parent->parserInsertBefore(task.child.get(), *task.nextChild); 106 task.parent->parserInsertBefore(task.child.get(), *task.nextChild);
110 else 107 else
111 task.parent->parserAppendChild(task.child.get()); 108 task.parent->parserAppendChild(task.child.get());
112 } 109 }
113 110
114 static inline void executeInsertTask(HTMLConstructionSiteTask& task) 111 static inline void executeInsertTask(HTMLConstructionSiteTask& task)
115 { 112 {
116 ASSERT(task.operation == HTMLConstructionSiteTask::Insert); 113 ASSERT(task.operation == HTMLConstructionSiteTask::Insert);
117 114
(...skipping 25 matching lines...) Expand all
143 } 140 }
144 } 141 }
145 142
146 insert(task); 143 insert(task);
147 } 144 }
148 145
149 static inline void executeReparentTask(HTMLConstructionSiteTask& task) 146 static inline void executeReparentTask(HTMLConstructionSiteTask& task)
150 { 147 {
151 ASSERT(task.operation == HTMLConstructionSiteTask::Reparent); 148 ASSERT(task.operation == HTMLConstructionSiteTask::Reparent);
152 149
153 if (ContainerNode* parent = task.child->parentNode())
154 parent->parserRemoveChild(*task.child);
155
156 task.parent->parserAppendChild(task.child); 150 task.parent->parserAppendChild(task.child);
157 } 151 }
158 152
159 static inline void executeInsertAlreadyParsedChildTask(HTMLConstructionSiteTask& task) 153 static inline void executeInsertAlreadyParsedChildTask(HTMLConstructionSiteTask& task)
160 { 154 {
161 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild) ; 155 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild) ;
162 156
163 insert(task); 157 insert(task);
164 } 158 }
165 159
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
879 } 873 }
880 874
881 DEFINE_TRACE(HTMLConstructionSite::PendingText) 875 DEFINE_TRACE(HTMLConstructionSite::PendingText)
882 { 876 {
883 visitor->trace(parent); 877 visitor->trace(parent);
884 visitor->trace(nextChild); 878 visitor->trace(nextChild);
885 } 879 }
886 880
887 881
888 } 882 }
OLDNEW
« no previous file with comments | « Source/core/dom/ContainerNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698