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

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

Issue 49153006: Have ContainerNodeAlgorithms deal with references instead of pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 1 month 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
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 { 92 {
93 return string.isAllSpecialCharacters<isHTMLSpace<UChar> >(); 93 return string.isAllSpecialCharacters<isHTMLSpace<UChar> >();
94 } 94 }
95 95
96 static inline void insert(HTMLConstructionSiteTask& task) 96 static inline void insert(HTMLConstructionSiteTask& task)
97 { 97 {
98 if (task.parent->hasTagName(templateTag)) 98 if (task.parent->hasTagName(templateTag))
99 task.parent = toHTMLTemplateElement(task.parent.get())->content(); 99 task.parent = toHTMLTemplateElement(task.parent.get())->content();
100 100
101 if (ContainerNode* parent = task.child->parentNode()) 101 if (ContainerNode* parent = task.child->parentNode())
102 parent->parserRemoveChild(task.child.get()); 102 parent->parserRemoveChild(*task.child);
103 103
104 if (task.nextChild) 104 if (task.nextChild)
105 task.parent->parserInsertBefore(task.child.get(), task.nextChild.get()); 105 task.parent->parserInsertBefore(task.child.get(), task.nextChild.get());
106 else 106 else
107 task.parent->parserAppendChild(task.child.get()); 107 task.parent->parserAppendChild(task.child.get());
108 } 108 }
109 109
110 static inline void executeInsertTask(HTMLConstructionSiteTask& task) 110 static inline void executeInsertTask(HTMLConstructionSiteTask& task)
111 { 111 {
112 ASSERT(task.operation == HTMLConstructionSiteTask::Insert); 112 ASSERT(task.operation == HTMLConstructionSiteTask::Insert);
113 113
114 insert(task); 114 insert(task);
115 115
116 task.child->beginParsingChildren(); 116 task.child->beginParsingChildren();
117 117
118 if (task.selfClosing) 118 if (task.selfClosing)
119 task.child->finishParsingChildren(); 119 task.child->finishParsingChildren();
120 } 120 }
121 121
122 static inline void executeReparentTask(HTMLConstructionSiteTask& task) 122 static inline void executeReparentTask(HTMLConstructionSiteTask& task)
123 { 123 {
124 ASSERT(task.operation == HTMLConstructionSiteTask::Reparent); 124 ASSERT(task.operation == HTMLConstructionSiteTask::Reparent);
125 125
126 if (ContainerNode* parent = task.child->parentNode()) 126 if (ContainerNode* parent = task.child->parentNode())
127 parent->parserRemoveChild(task.child.get()); 127 parent->parserRemoveChild(*task.child);
128 128
129 task.parent->parserAppendChild(task.child); 129 task.parent->parserAppendChild(task.child);
130 } 130 }
131 131
132 static inline void executeInsertAlreadyParsedChildTask(HTMLConstructionSiteTask& task) 132 static inline void executeInsertAlreadyParsedChildTask(HTMLConstructionSiteTask& task)
133 { 133 {
134 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild) ; 134 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild) ;
135 135
136 insert(task); 136 insert(task);
137 } 137 }
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node) 818 void HTMLConstructionSite::fosterParent(PassRefPtr<Node> node)
819 { 819 {
820 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert); 820 HTMLConstructionSiteTask task(HTMLConstructionSiteTask::Insert);
821 findFosterSite(task); 821 findFosterSite(task);
822 task.child = node; 822 task.child = node;
823 ASSERT(task.parent); 823 ASSERT(task.parent);
824 queueTask(task); 824 queueTask(task);
825 } 825 }
826 826
827 } 827 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698