OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights reserv
ed. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 updatedHasPendingEvent(); | 261 updatedHasPendingEvent(); |
262 } | 262 } |
263 | 263 |
264 void ImageLoader::updateFromElement(LoadType loadType) | 264 void ImageLoader::updateFromElement(LoadType loadType) |
265 { | 265 { |
266 AtomicString attr = m_element->imageSourceURL(); | 266 AtomicString attr = m_element->imageSourceURL(); |
267 | 267 |
268 if (!m_failedLoadURL.isEmpty() && attr == m_failedLoadURL) | 268 if (!m_failedLoadURL.isEmpty() && attr == m_failedLoadURL) |
269 return; | 269 return; |
270 | 270 |
| 271 // If we have a pending task, we have to clear it -- either we're |
| 272 // now loading immediately, or we need to reset the task's state. |
| 273 if (m_pendingTask) { |
| 274 m_pendingTask->clearLoader(); |
| 275 m_pendingTask.clear(); |
| 276 } |
| 277 |
271 KURL url = imageURL(); | 278 KURL url = imageURL(); |
272 if (!attr.isNull() && !url.isNull()) { | 279 if (!attr.isNull() && !url.isNull()) { |
273 // If we have a pending task, we have to clear it -- either we're | |
274 // now loading immediately, or we need to reset the task's state. | |
275 if (m_pendingTask) { | |
276 m_pendingTask->clearLoader(); | |
277 m_pendingTask.clear(); | |
278 } | |
279 bool loadImmediately = shouldLoadImmediately(url) || (loadType == ForceL
oadImmediately); | 280 bool loadImmediately = shouldLoadImmediately(url) || (loadType == ForceL
oadImmediately); |
280 if (loadImmediately) { | 281 if (loadImmediately) { |
281 doUpdateFromElement(false); | 282 doUpdateFromElement(false); |
282 } else { | 283 } else { |
283 OwnPtr<Task> task = adoptPtr(new Task(this)); | 284 OwnPtr<Task> task = adoptPtr(new Task(this)); |
284 m_pendingTask = task->createWeakPtr(); | 285 m_pendingTask = task->createWeakPtr(); |
285 Microtask::enqueueMicrotask(task.release()); | 286 Microtask::enqueueMicrotask(task.release()); |
286 m_delayLoad = adoptPtr(new IncrementLoadEventDelayCount(m_element->d
ocument())); | 287 m_delayLoad = adoptPtr(new IncrementLoadEventDelayCount(m_element->d
ocument())); |
287 return; | 288 return; |
288 } | 289 } |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } | 536 } |
536 | 537 |
537 #if ENABLE(OILPAN) | 538 #if ENABLE(OILPAN) |
538 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() | 539 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() |
539 { | 540 { |
540 m_loader.willRemoveClient(m_client); | 541 m_loader.willRemoveClient(m_client); |
541 } | 542 } |
542 #endif | 543 #endif |
543 | 544 |
544 } | 545 } |
OLD | NEW |