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

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

Issue 54273007: Use more references in ContainerNode code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix crashes 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
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); 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);
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
(...skipping 17 matching lines...) Expand all
133 { 133 {
134 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild) ; 134 ASSERT(task.operation == HTMLConstructionSiteTask::InsertAlreadyParsedChild) ;
135 135
136 insert(task); 136 insert(task);
137 } 137 }
138 138
139 static inline void executeTakeAllChildrenTask(HTMLConstructionSiteTask& task) 139 static inline void executeTakeAllChildrenTask(HTMLConstructionSiteTask& task)
140 { 140 {
141 ASSERT(task.operation == HTMLConstructionSiteTask::TakeAllChildren); 141 ASSERT(task.operation == HTMLConstructionSiteTask::TakeAllChildren);
142 142
143 task.parent->parserTakeAllChildrenFrom(task.oldParent()); 143 task.parent->parserTakeAllChildrenFrom(*task.oldParent());
144 } 144 }
145 145
146 void HTMLConstructionSite::executeTask(HTMLConstructionSiteTask& task) 146 void HTMLConstructionSite::executeTask(HTMLConstructionSiteTask& task)
147 { 147 {
148 ASSERT(m_taskQueue.isEmpty()); 148 ASSERT(m_taskQueue.isEmpty());
149 if (task.operation == HTMLConstructionSiteTask::Insert) 149 if (task.operation == HTMLConstructionSiteTask::Insert)
150 return executeInsertTask(task); 150 return executeInsertTask(task);
151 151
152 // All the cases below this point are only used by the adoption agency. 152 // All the cases below this point are only used by the adoption agency.
153 153
(...skipping 664 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