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