Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 |
| OLD | NEW |