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 19 matching lines...) Expand all Loading... |
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 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import) | 38 inline bool HTMLImportStateResolver::isBlockingFollowers(HTMLImport* import) |
39 { | 39 { |
| 40 if (!import->isSync()) |
| 41 return false; |
40 if (!import->loader()) | 42 if (!import->loader()) |
41 return true; | 43 return true; |
42 return !import->state().isReady(); | 44 return !import->state().isReady(); |
43 } | 45 } |
44 | 46 |
45 inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const | 47 inline bool HTMLImportStateResolver::shouldBlockScriptExecution() const |
46 { | 48 { |
47 for (const HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->p
arent()) { | 49 for (const HTMLImport* ancestor = m_import; ancestor; ancestor = ancestor->p
arent()) { |
48 if (ancestor->previous() && isBlockingFollowers(ancestor->previous())) | 50 if (ancestor->previous() && isBlockingFollowers(ancestor->previous())) |
49 return true; | 51 return true; |
50 } | 52 } |
51 | 53 |
52 for (HTMLImport* child = m_import->firstChild(); child; child = child->next(
)) { | 54 for (HTMLImport* child = m_import->firstChild(); child; child = child->next(
)) { |
53 if (child->isSync() && isBlockingFollowers(child)) | 55 if (isBlockingFollowers(child)) |
54 return true; | 56 return true; |
55 } | 57 } |
56 | 58 |
57 return false; | 59 return false; |
58 } | 60 } |
59 | 61 |
60 inline bool HTMLImportStateResolver::isActive() const | 62 inline bool HTMLImportStateResolver::isActive() const |
61 { | 63 { |
62 return !m_import->isDone(); | 64 return !m_import->isDone(); |
63 } | 65 } |
64 | 66 |
65 HTMLImportState HTMLImportStateResolver::resolve() const | 67 HTMLImportState HTMLImportStateResolver::resolve() const |
66 { | 68 { |
67 if (shouldBlockScriptExecution()) | 69 if (shouldBlockScriptExecution()) |
68 return HTMLImportState(HTMLImportState::BlockingScriptExecution); | 70 return HTMLImportState(HTMLImportState::BlockingScriptExecution); |
69 if (isActive()) | 71 if (isActive()) |
70 return HTMLImportState(HTMLImportState::Active); | 72 return HTMLImportState(HTMLImportState::Active); |
71 return HTMLImportState(HTMLImportState::Ready); | 73 return HTMLImportState(HTMLImportState::Ready); |
72 } | 74 } |
73 | 75 |
74 } | 76 } |
75 | 77 |
OLD | NEW |