Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: Source/core/loader/ImageLoader.cpp

Issue 1047803005: Allow the "img.src='';img.src='.." idiom to clear down images immediately. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/images/onload-event-when-reloading-image-after-interrupted-null-src-load-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698