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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 if (lastChild() && lastChild()->isBlockingFollowersFromCreatingDocument()) | 57 if (lastChild() && lastChild()->isBlockingFollowersFromCreatingDocument()) |
58 child->blockFromCreatingDocument(); | 58 child->blockFromCreatingDocument(); |
59 TreeNode<HTMLImport>::appendChild(child); | 59 TreeNode<HTMLImport>::appendChild(child); |
60 if (child->isCreatedByParser()) | 60 if (child->isCreatedByParser()) |
61 blockPredecessorsOf(child); | 61 blockPredecessorsOf(child); |
62 } | 62 } |
63 | 63 |
64 inline bool HTMLImport::isBlockedFromCreatingDocumentByPredecessors() const | 64 inline bool HTMLImport::isBlockedFromCreatingDocumentByPredecessors() const |
65 { | 65 { |
66 ASSERT(isBlockedFromCreatingDocument()); | 66 ASSERT(isBlockedFromCreatingDocument()); |
67 HTMLImport* elder = previousSibling(); | 67 HTMLImport* elder = previous(); |
68 return (elder && !elder->isDone()); | 68 return (elder && !elder->isDone()); |
69 } | 69 } |
70 | 70 |
71 bool HTMLImport::isBlockedFromRunningScriptByPredecessors() const | 71 bool HTMLImport::isBlockedFromRunningScriptByPredecessors() const |
72 { | 72 { |
73 HTMLImport* parent = this->parent(); | 73 HTMLImport* parent = this->parent(); |
74 if (!parent) | 74 if (!parent) |
75 return false; | 75 return false; |
76 | 76 |
77 for (HTMLImport* sibling = parent->firstChild(); sibling; sibling = sibling-
>nextSibling()) { | 77 for (HTMLImport* sibling = parent->firstChild(); sibling; sibling = sibling-
>next()) { |
78 if (sibling == this) | 78 if (sibling == this) |
79 break; | 79 break; |
80 if (sibling->isBlockingFollowersFromRunningScript()) | 80 if (sibling->isBlockingFollowersFromRunningScript()) |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 return false; | 84 return false; |
85 } | 85 } |
86 | 86 |
87 void HTMLImport::waitLoaderOrChildren() | 87 void HTMLImport::waitLoaderOrChildren() |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 | 177 |
178 bool HTMLImport::unblock(HTMLImport* import) | 178 bool HTMLImport::unblock(HTMLImport* import) |
179 { | 179 { |
180 ASSERT(!import->isBlockedFromRunningScriptByPredecessors()); | 180 ASSERT(!import->isBlockedFromRunningScriptByPredecessors()); |
181 | 181 |
182 if (import->isBlockedFromCreatingDocument() && import->isBlockedFromCreating
DocumentByPredecessors()) | 182 if (import->isBlockedFromCreatingDocument() && import->isBlockedFromCreating
DocumentByPredecessors()) |
183 return false; | 183 return false; |
184 import->unblockFromCreatingDocument(); | 184 import->unblockFromCreatingDocument(); |
185 | 185 |
186 for (HTMLImport* child = import->firstChild(); child; child = child->nextSib
ling()) { | 186 for (HTMLImport* child = import->firstChild(); child; child = child->next())
{ |
187 if (!unblock(child)) | 187 if (!unblock(child)) |
188 return false; | 188 return false; |
189 } | 189 } |
190 | 190 |
191 import->unblockFromRunningScript(); | 191 import->unblockFromRunningScript(); |
192 if (import->isDone()) | 192 if (import->isDone()) |
193 import->becomeReady(); | 193 import->becomeReady(); |
194 | 194 |
195 return !import->isBlockingFollowersFromRunningScript(); | 195 return !import->isBlockingFollowersFromRunningScript(); |
196 } | 196 } |
197 | 197 |
198 void HTMLImport::block(HTMLImport* import) | 198 void HTMLImport::block(HTMLImport* import) |
199 { | 199 { |
200 for (HTMLImport* child = import; child; child = traverseNext(*child, import)
) | 200 for (HTMLImport* child = import; child; child = traverseNext(child, import)) |
201 child->blockFromRunningScript(); | 201 child->blockFromRunningScript(); |
202 } | 202 } |
203 | 203 |
204 void HTMLImport::blockPredecessorsOf(HTMLImport* child) | 204 void HTMLImport::blockPredecessorsOf(HTMLImport* child) |
205 { | 205 { |
206 ASSERT(child->parent() == this); | 206 ASSERT(child->parent() == this); |
207 | 207 |
208 for (HTMLImport* sibling = lastChild(); sibling; sibling = sibling->previous
Sibling()) { | 208 for (HTMLImport* sibling = lastChild(); sibling; sibling = sibling->previous
()) { |
209 if (sibling == child) | 209 if (sibling == child) |
210 break; | 210 break; |
211 HTMLImport::block(sibling); | 211 HTMLImport::block(sibling); |
212 } | 212 } |
213 | 213 |
214 this->blockFromRunningScript(); | 214 this->blockFromRunningScript(); |
215 | 215 |
216 if (HTMLImport* parent = this->parent()) { | 216 if (HTMLImport* parent = this->parent()) { |
217 if (isCreatedByParser()) | 217 if (isCreatedByParser()) |
218 parent->blockPredecessorsOf(this); | 218 parent->blockPredecessorsOf(this); |
219 } | 219 } |
220 } | 220 } |
221 | 221 |
222 bool HTMLImport::isMaster(Document* document) | 222 bool HTMLImport::isMaster(Document* document) |
223 { | 223 { |
224 if (!document->import()) | 224 if (!document->import()) |
225 return true; | 225 return true; |
226 return (document->import()->master() == document); | 226 return (document->import()->master() == document); |
227 } | 227 } |
228 | 228 |
229 } // namespace WebCore | 229 } // namespace WebCore |
OLD | NEW |