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 | 4 * Copyright (C) 2004, 2005, 2006, 2007, 2009, 2010 Apple Inc. All rights |
5 * reserved. | 5 * reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
418 ReferrerPolicy referrer_policy) { | 418 ReferrerPolicy referrer_policy) { |
419 AtomicString image_source_url = element_->ImageSourceURL(); | 419 AtomicString image_source_url = element_->ImageSourceURL(); |
420 suppress_error_events_ = (update_behavior == kUpdateSizeChanged); | 420 suppress_error_events_ = (update_behavior == kUpdateSizeChanged); |
421 | 421 |
422 if (update_behavior == kUpdateIgnorePreviousError) | 422 if (update_behavior == kUpdateIgnorePreviousError) |
423 ClearFailedLoadURL(); | 423 ClearFailedLoadURL(); |
424 | 424 |
425 if (!failed_load_url_.IsEmpty() && image_source_url == failed_load_url_) | 425 if (!failed_load_url_.IsEmpty() && image_source_url == failed_load_url_) |
426 return; | 426 return; |
427 | 427 |
428 if (loading_image_document_ && update_behavior == kUpdateForcedReload) { | |
429 // Prepares for reloading ImageDocument. | |
kinuko
2017/05/12 08:28:33
nit: I think we generally use imperative format fo
| |
430 // We turn the ImageLoader into non-ImageDocument here, and proceed to | |
431 // reloading just like an ordinary <img> element below. | |
432 loading_image_document_ = false; | |
433 image_resource_for_image_document_ = nullptr; | |
434 ClearImage(); | |
435 } | |
436 | |
428 // Prevent the creation of a ResourceLoader (and therefore a network request) | 437 // Prevent the creation of a ResourceLoader (and therefore a network request) |
429 // for ImageDocument loads. In this case, the image contents have already been | 438 // for ImageDocument loads. In this case, the image contents have already been |
430 // requested as a main resource and ImageDocumentParser will take care of | 439 // requested as a main resource and ImageDocumentParser will take care of |
431 // funneling the main resource bytes into image_, so just create an | 440 // funneling the main resource bytes into image_, so just create an |
432 // ImageResource to be populated later. | 441 // ImageResource to be populated later. |
433 if (loading_image_document_ && update_behavior != kUpdateForcedReload) { | 442 if (loading_image_document_) { |
434 ImageResource* image_resource = ImageResource::Create( | 443 ImageResource* image_resource = ImageResource::Create( |
435 ResourceRequest(ImageSourceToKURL(element_->ImageSourceURL()))); | 444 ResourceRequest(ImageSourceToKURL(element_->ImageSourceURL()))); |
436 image_resource->SetStatus(ResourceStatus::kPending); | 445 image_resource->SetStatus(ResourceStatus::kPending); |
437 image_resource->NotifyStartLoad(); | 446 image_resource->NotifyStartLoad(); |
438 SetImageForImageDocument(image_resource); | 447 SetImageForImageDocument(image_resource); |
439 return; | 448 return; |
440 } | 449 } |
441 | 450 |
442 // If we have a pending task, we have to clear it -- either we're now loading | 451 // If we have a pending task, we have to clear it -- either we're now loading |
443 // immediately, or we need to reset the task's state. | 452 // immediately, or we need to reset the task's state. |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
668 } | 677 } |
669 | 678 |
670 void ImageLoader::ElementDidMoveToNewDocument() { | 679 void ImageLoader::ElementDidMoveToNewDocument() { |
671 if (load_delay_counter_) | 680 if (load_delay_counter_) |
672 load_delay_counter_->DocumentChanged(element_->GetDocument()); | 681 load_delay_counter_->DocumentChanged(element_->GetDocument()); |
673 ClearFailedLoadURL(); | 682 ClearFailedLoadURL(); |
674 ClearImage(); | 683 ClearImage(); |
675 } | 684 } |
676 | 685 |
677 } // namespace blink | 686 } // namespace blink |
OLD | NEW |