| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 if (m_pendingTask) { | 349 if (m_pendingTask) { |
| 350 m_pendingTask->clearLoader(); | 350 m_pendingTask->clearLoader(); |
| 351 m_pendingTask.clear(); | 351 m_pendingTask.clear(); |
| 352 } | 352 } |
| 353 | 353 |
| 354 KURL url = imageSourceToKURL(imageSourceURL); | 354 KURL url = imageSourceToKURL(imageSourceURL); |
| 355 if (shouldLoadImmediately(url)) { | 355 if (shouldLoadImmediately(url)) { |
| 356 doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior); | 356 doUpdateFromElement(DoNotBypassMainWorldCSP, updateBehavior); |
| 357 return; | 357 return; |
| 358 } | 358 } |
| 359 // Allow the idiom "img.src=''; img.src='.." to clear down the image before |
| 360 // an asynchronous load completes. |
| 361 if (imageSourceURL.isEmpty()) { |
| 362 ImageResource* image = m_image.get(); |
| 363 if (image) |
| 364 image->removeClient(this); |
| 365 m_image = nullptr; |
| 366 } |
| 359 enqueueImageLoadingMicroTask(updateBehavior); | 367 enqueueImageLoadingMicroTask(updateBehavior); |
| 360 } | 368 } |
| 361 | 369 |
| 362 KURL ImageLoader::imageSourceToKURL(AtomicString imageSourceURL) const | 370 KURL ImageLoader::imageSourceToKURL(AtomicString imageSourceURL) const |
| 363 { | 371 { |
| 364 KURL url; | 372 KURL url; |
| 365 | 373 |
| 366 // Don't load images for inactive documents. We don't want to slow down the | 374 // Don't load images for inactive documents. We don't want to slow down the |
| 367 // raw HTML parsing case by loading images we don't intend to display. | 375 // raw HTML parsing case by loading images we don't intend to display. |
| 368 Document& document = m_element->document(); | 376 Document& document = m_element->document(); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 #endif | 605 #endif |
| 598 } | 606 } |
| 599 | 607 |
| 600 #if ENABLE(OILPAN) | 608 #if ENABLE(OILPAN) |
| 601 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() | 609 ImageLoader::ImageLoaderClientRemover::~ImageLoaderClientRemover() |
| 602 { | 610 { |
| 603 m_loader.willRemoveClient(m_client); | 611 m_loader.willRemoveClient(m_client); |
| 604 } | 612 } |
| 605 #endif | 613 #endif |
| 606 } | 614 } |
| OLD | NEW |