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

Side by Side Diff: Source/core/html/imports/HTMLImportChild.cpp

Issue 274213003: HTML Imports: Make sure new imports being added to the "first child" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Ready to review Created 6 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/html/imports/HTMLImportChild.h ('k') | Source/core/html/imports/HTMLImportLoader.h » ('j') | 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 m_client = 0; 207 m_client = 0;
208 } 208 }
209 209
210 HTMLLinkElement* HTMLImportChild::link() const 210 HTMLLinkElement* HTMLImportChild::link() const
211 { 211 {
212 if (!m_client) 212 if (!m_client)
213 return 0; 213 return 0;
214 return m_client->link(); 214 return m_client->link();
215 } 215 }
216 216
217 // Ensuring following invariants against the import tree:
218 // - HTMLImportChild::firstImport() is the "first import" of the DFS order of th e import tree.
219 // - The "first import" manages all the children that is loaded by the document.
220 void HTMLImportChild::normalize()
dglazkov 2014/05/12 17:32:37 I apologize, I am trying to (re)learn how this wor
221 {
222 if (!loader()->isFirstImport(this) && this->precedes(loader()->firstImport() )) {
223 HTMLImportChild* oldFirst = loader()->firstImport();
224 loader()->moveToFirst(this);
225 takeChildrenFrom(oldFirst);
226 }
227
228 for (HTMLImport* child = firstChild(); child; child = child->next())
229 toHTMLImportChild(child)->normalize();
230 }
231
217 #if !defined(NDEBUG) 232 #if !defined(NDEBUG)
218 void HTMLImportChild::showThis() 233 void HTMLImportChild::showThis()
219 { 234 {
235 bool isFirst = loader() ? loader()->isFirstImport(this) : false;
220 HTMLImport::showThis(); 236 HTMLImport::showThis();
221 fprintf(stderr, " loader=%p step=%p sync=%s url=%s", 237 fprintf(stderr, " loader=%p first=%d, step=%p sync=%s url=%s",
222 m_loader, 238 m_loader,
239 isFirst,
223 m_customElementMicrotaskStep.get(), 240 m_customElementMicrotaskStep.get(),
224 isSync() ? "Y" : "N", 241 isSync() ? "Y" : "N",
225 url().string().utf8().data()); 242 url().string().utf8().data());
226 } 243 }
227 #endif 244 #endif
228 245
229 } // namespace WebCore 246 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/imports/HTMLImportChild.h ('k') | Source/core/html/imports/HTMLImportLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698