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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 void HTMLImportsController::provideTo(Document& master) | 44 void HTMLImportsController::provideTo(Document& master) |
45 { | 45 { |
46 DEFINE_STATIC_LOCAL(const char*, name, ("HTMLImportsController")); | 46 DEFINE_STATIC_LOCAL(const char*, name, ("HTMLImportsController")); |
47 OwnPtr<HTMLImportsController> controller = adoptPtr(new HTMLImportsControlle
r(master)); | 47 OwnPtr<HTMLImportsController> controller = adoptPtr(new HTMLImportsControlle
r(master)); |
48 master.setImportsController(controller.get()); | 48 master.setImportsController(controller.get()); |
49 DocumentSupplement::provideTo(master, name, controller.release()); | 49 DocumentSupplement::provideTo(master, name, controller.release()); |
50 } | 50 } |
51 | 51 |
52 HTMLImportsController::HTMLImportsController(Document& master) | 52 HTMLImportsController::HTMLImportsController(Document& master) |
53 : m_master(&master) | 53 : HTMLImport(HTMLImport::Sync) |
| 54 , m_master(&master) |
54 , m_recalcTimer(this, &HTMLImportsController::recalcTimerFired) | 55 , m_recalcTimer(this, &HTMLImportsController::recalcTimerFired) |
55 { | 56 { |
56 recalcTreeState(this); // This recomputes initial state. | 57 recalcTreeState(this); // This recomputes initial state. |
57 } | 58 } |
58 | 59 |
59 HTMLImportsController::~HTMLImportsController() | 60 HTMLImportsController::~HTMLImportsController() |
60 { | 61 { |
61 ASSERT(!m_master); | 62 ASSERT(!m_master); |
62 } | 63 } |
63 | 64 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 ResourceFetcher* HTMLImportsController::fetcher() const | 138 ResourceFetcher* HTMLImportsController::fetcher() const |
138 { | 139 { |
139 return m_master->fetcher(); | 140 return m_master->fetcher(); |
140 } | 141 } |
141 | 142 |
142 LocalFrame* HTMLImportsController::frame() const | 143 LocalFrame* HTMLImportsController::frame() const |
143 { | 144 { |
144 return m_master->frame(); | 145 return m_master->frame(); |
145 } | 146 } |
146 | 147 |
147 HTMLImportRoot* HTMLImportsController::root() | |
148 { | |
149 return this; | |
150 } | |
151 | |
152 Document* HTMLImportsController::document() const | 148 Document* HTMLImportsController::document() const |
153 { | 149 { |
154 return m_master; | 150 return m_master; |
155 } | 151 } |
156 | 152 |
157 bool HTMLImportsController::shouldBlockScriptExecution(const Document& document)
const | 153 bool HTMLImportsController::shouldBlockScriptExecution(const Document& document)
const |
158 { | 154 { |
159 ASSERT(document.importsController() == this); | 155 ASSERT(document.importsController() == this); |
160 if (HTMLImportLoader* loader = loaderFor(document)) | 156 if (HTMLImportLoader* loader = loaderFor(document)) |
161 return loader->firstImport()->state().shouldBlockScriptExecution(); | 157 return loader->firstImport()->state().shouldBlockScriptExecution(); |
(...skipping 10 matching lines...) Expand all Loading... |
172 bool HTMLImportsController::hasLoader() const | 168 bool HTMLImportsController::hasLoader() const |
173 { | 169 { |
174 return true; | 170 return true; |
175 } | 171 } |
176 | 172 |
177 bool HTMLImportsController::isDone() const | 173 bool HTMLImportsController::isDone() const |
178 { | 174 { |
179 return !m_master->parsing() && m_master->styleEngine()->haveStylesheetsLoade
d(); | 175 return !m_master->parsing() && m_master->styleEngine()->haveStylesheetsLoade
d(); |
180 } | 176 } |
181 | 177 |
| 178 void HTMLImportsController::stateWillChange() |
| 179 { |
| 180 scheduleRecalcState(); |
| 181 } |
| 182 |
182 void HTMLImportsController::stateDidChange() | 183 void HTMLImportsController::stateDidChange() |
183 { | 184 { |
184 HTMLImport::stateDidChange(); | 185 HTMLImport::stateDidChange(); |
185 | 186 |
186 if (!state().isReady()) | 187 if (!state().isReady()) |
187 return; | 188 return; |
188 if (LocalFrame* frame = m_master->frame()) | 189 if (LocalFrame* frame = m_master->frame()) |
189 frame->loader().checkCompleted(); | 190 frame->loader().checkCompleted(); |
190 } | 191 } |
191 | 192 |
(...skipping 24 matching lines...) Expand all Loading... |
216 { | 217 { |
217 for (size_t i = 0; i < m_loaders.size(); ++i) { | 218 for (size_t i = 0; i < m_loaders.size(); ++i) { |
218 if (m_loaders[i]->document() == &document) | 219 if (m_loaders[i]->document() == &document) |
219 return m_loaders[i].get(); | 220 return m_loaders[i].get(); |
220 } | 221 } |
221 | 222 |
222 return 0; | 223 return 0; |
223 } | 224 } |
224 | 225 |
225 } // namespace WebCore | 226 } // namespace WebCore |
OLD | NEW |