OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/html/imports/HTMLImportStateResolver.h" | 32 #include "core/html/imports/HTMLImportStateResolver.h" |
33 | 33 |
34 #include "core/html/imports/HTMLImport.h" | 34 #include "core/html/imports/HTMLImport.h" |
35 #include "core/html/imports/HTMLImportChild.h" | 35 #include "core/html/imports/HTMLImportChild.h" |
| 36 #include "core/html/imports/HTMLImportLoader.h" |
36 | 37 |
37 namespace WebCore { | 38 namespace WebCore { |
38 | 39 |
39 inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import) | 40 inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import) |
40 { | 41 { |
41 if (!import->isSync()) | 42 if (!import->isSync()) |
42 return false; | 43 return false; |
43 if (!toHTMLImportChild(import)->isFirst()) | 44 HTMLImportChild* child = toHTMLImportChild(import); |
| 45 if (!child->loader()->isFirstImport(child)) |
44 return false; | 46 return false; |
45 if (!import->loader()) | |
46 return true; | |
47 return !import->state().isReady(); | 47 return !import->state().isReady(); |
48 } | 48 } |
49 | 49 |
50 inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const | 50 inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const |
51 { | 51 { |
52 // FIXME: Memoize to make this faster. | 52 // FIXME: Memoize to make this faster. |
53 for (HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->parent(
)) { | 53 for (HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->parent(
)) { |
54 for (HTMLImport* predecessor = ancestor->previous(); predecessor; predec
essor = predecessor->previous()) { | 54 for (HTMLImport* predecessor = ancestor->previous(); predecessor; predec
essor = predecessor->previous()) { |
55 if (isBlockingFollowers(predecessor)) | 55 if (isBlockingFollowers(predecessor)) |
56 return true; | 56 return true; |
(...skipping 17 matching lines...) Expand all Loading... |
74 { | 74 { |
75 if (shouldBlockScriptExecution()) | 75 if (shouldBlockScriptExecution()) |
76 return HTMLImportState(HTMLImportState::BlockingScriptExecution); | 76 return HTMLImportState(HTMLImportState::BlockingScriptExecution); |
77 if (isActive()) | 77 if (isActive()) |
78 return HTMLImportState(HTMLImportState::Active); | 78 return HTMLImportState(HTMLImportState::Active); |
79 return HTMLImportState(HTMLImportState::Ready); | 79 return HTMLImportState(HTMLImportState::Ready); |
80 } | 80 } |
81 | 81 |
82 } | 82 } |
83 | 83 |
OLD | NEW |