| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 void HTMLImportLoader::didFinishLoading() | 175 void HTMLImportLoader::didFinishLoading() |
| 176 { | 176 { |
| 177 for (size_t i = 0; i < m_imports.size(); ++i) | 177 for (size_t i = 0; i < m_imports.size(); ++i) |
| 178 m_imports[i]->didFinishLoading(); | 178 m_imports[i]->didFinishLoading(); |
| 179 | 179 |
| 180 clearResource(); | 180 clearResource(); |
| 181 | 181 |
| 182 ASSERT(!m_importedDocument || !m_importedDocument->parsing()); | 182 ASSERT(!m_importedDocument || !m_importedDocument->parsing()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void HTMLImportLoader::moveToFirst(HTMLImportChild* import) |
| 186 { |
| 187 size_t position = m_imports.find(import); |
| 188 ASSERT(kNotFound != position); |
| 189 m_imports.remove(position); |
| 190 m_imports.insert(0, import); |
| 191 } |
| 192 |
| 185 void HTMLImportLoader::addImport(HTMLImportChild* import) | 193 void HTMLImportLoader::addImport(HTMLImportChild* import) |
| 186 { | 194 { |
| 187 ASSERT(kNotFound == m_imports.find(import)); | 195 ASSERT(kNotFound == m_imports.find(import)); |
| 188 | 196 |
| 189 // Ensuring firstImport() manages all children that is loaded by the documen
t. | 197 m_imports.append(import); |
| 190 // | 198 import->normalize(); |
| 191 // FIXME: | |
| 192 // This is a design flaw. | |
| 193 // Import children should be managed by HTMLImportLoader, not by HTMLImpor
t. | |
| 194 if (!m_imports.isEmpty() && import->precedes(firstImport())) { | |
| 195 import->takeChildrenFrom(firstImport()); | |
| 196 m_imports.insert(0, import); | |
| 197 } else { | |
| 198 m_imports.append(import); | |
| 199 } | |
| 200 | |
| 201 if (isDone()) | 199 if (isDone()) |
| 202 import->didFinishLoading(); | 200 import->didFinishLoading(); |
| 203 } | 201 } |
| 204 | 202 |
| 205 void HTMLImportLoader::removeImport(HTMLImportChild* client) | 203 void HTMLImportLoader::removeImport(HTMLImportChild* client) |
| 206 { | 204 { |
| 207 ASSERT(kNotFound != m_imports.find(client)); | 205 ASSERT(kNotFound != m_imports.find(client)); |
| 208 m_imports.remove(m_imports.find(client)); | 206 m_imports.remove(m_imports.find(client)); |
| 209 } | 207 } |
| 210 | 208 |
| 211 bool HTMLImportLoader::shouldBlockScriptExecution() const | 209 bool HTMLImportLoader::shouldBlockScriptExecution() const |
| 212 { | 210 { |
| 213 for (size_t i = 0; i < m_imports.size(); ++i) { | 211 for (size_t i = 0; i < m_imports.size(); ++i) { |
| 214 if (!m_imports[i]->state().shouldBlockScriptExecution()) | 212 if (!m_imports[i]->state().shouldBlockScriptExecution()) |
| 215 return false; | 213 return false; |
| 216 } | 214 } |
| 217 | 215 |
| 218 return true; | 216 return true; |
| 219 } | 217 } |
| 220 | 218 |
| 221 PassRefPtr<CustomElementMicrotaskQueue> HTMLImportLoader::microtaskQueue() const | 219 PassRefPtr<CustomElementMicrotaskQueue> HTMLImportLoader::microtaskQueue() const |
| 222 { | 220 { |
| 223 return m_microtaskQueue; | 221 return m_microtaskQueue; |
| 224 } | 222 } |
| 225 | 223 |
| 226 } // namespace WebCore | 224 } // namespace WebCore |
| OLD | NEW |