| OLD | NEW |
| 1 /* | 1 /* |
| 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) | 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) |
| 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) | 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) |
| 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) | 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) |
| 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 7 | 7 |
| 8 This library is free software; you can redistribute it and/or | 8 This library is free software; you can redistribute it and/or |
| 9 modify it under the terms of the GNU Library General Public | 9 modify it under the terms of the GNU Library General Public |
| 10 License as published by the Free Software Foundation; either | 10 License as published by the Free Software Foundation; either |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 Resource::didRemoveClient(c); | 114 Resource::didRemoveClient(c); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void ImageResource::switchClientsToRevalidatedResource() | 117 void ImageResource::switchClientsToRevalidatedResource() |
| 118 { | 118 { |
| 119 ASSERT(resourceToRevalidate()); | 119 ASSERT(resourceToRevalidate()); |
| 120 ASSERT(resourceToRevalidate()->isImage()); | 120 ASSERT(resourceToRevalidate()->isImage()); |
| 121 // Pending container size requests need to be transferred to the revalidated
resource. | 121 // Pending container size requests need to be transferred to the revalidated
resource. |
| 122 if (!m_pendingContainerSizeRequests.isEmpty()) { | 122 if (!m_pendingContainerSizeRequests.isEmpty()) { |
| 123 // A copy of pending size requests is needed as they are deleted during
Resource::switchClientsToRevalidateResouce(). | 123 // A copy of pending size requests is needed as they are deleted during
Resource::switchClientsToRevalidateResource(). |
| 124 ContainerSizeRequests switchContainerSizeRequests; | 124 ContainerSizeRequests switchContainerSizeRequests; |
| 125 for (const auto& containerSizeRequest : m_pendingContainerSizeRequests) | 125 for (const auto& containerSizeRequest : m_pendingContainerSizeRequests) |
| 126 switchContainerSizeRequests.set(containerSizeRequest.key, containerS
izeRequest.value); | 126 switchContainerSizeRequests.set(containerSizeRequest.key, containerS
izeRequest.value); |
| 127 Resource::switchClientsToRevalidatedResource(); | 127 Resource::switchClientsToRevalidatedResource(); |
| 128 ImageResource* revalidatedImageResource = toImageResource(resourceToReva
lidate()); | 128 ImageResource* revalidatedImageResource = toImageResource(resourceToReva
lidate()); |
| 129 for (const auto& containerSizeRequest : switchContainerSizeRequests) | 129 for (const auto& containerSizeRequest : switchContainerSizeRequests) |
| 130 revalidatedImageResource->setContainerSizeForRenderer(containerSizeR
equest.key, containerSizeRequest.value.first, containerSizeRequest.value.second)
; | 130 revalidatedImageResource->setContainerSizeForRenderer(containerSizeR
equest.key, containerSizeRequest.value.first, containerSizeRequest.value.second)
; |
| 131 return; | 131 return; |
| 132 } | 132 } |
| 133 | 133 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 334 } |
| 335 m_pendingContainerSizeRequests.clear(); | 335 m_pendingContainerSizeRequests.clear(); |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 inline void ImageResource::clearImage() | 339 inline void ImageResource::clearImage() |
| 340 { | 340 { |
| 341 // If our Image has an observer, it's always us so we need to clear the back
pointer | 341 // If our Image has an observer, it's always us so we need to clear the back
pointer |
| 342 // before dropping our reference. | 342 // before dropping our reference. |
| 343 if (m_image) | 343 if (m_image) |
| 344 m_image->setImageObserver(0); | 344 m_image->setImageObserver(nullptr); |
| 345 m_image.clear(); | 345 m_image.clear(); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void ImageResource::appendData(const char* data, unsigned length) | 348 void ImageResource::appendData(const char* data, unsigned length) |
| 349 { | 349 { |
| 350 Resource::appendData(data, length); | 350 Resource::appendData(data, length); |
| 351 if (!m_loadingMultipartContent) | 351 if (!m_loadingMultipartContent) |
| 352 updateImage(false); | 352 updateImage(false); |
| 353 } | 353 } |
| 354 | 354 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 380 } | 380 } |
| 381 | 381 |
| 382 // It would be nice to only redraw the decoded band of the image, but wi
th the current design | 382 // It would be nice to only redraw the decoded band of the image, but wi
th the current design |
| 383 // (decoding delayed until painting) that seems hard. | 383 // (decoding delayed until painting) that seems hard. |
| 384 notifyObservers(); | 384 notifyObservers(); |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 | 387 |
| 388 void ImageResource::updateBitmapImages(HashSet<ImageResource*>& images, bool red
ecodeImages) | 388 void ImageResource::updateBitmapImages(HashSet<ImageResource*>& images, bool red
ecodeImages) |
| 389 { | 389 { |
| 390 for (const auto& imageResource : images) { | 390 for (ImageResource* imageResource : images) { |
| 391 if (!imageResource->hasImage() || imageResource->image()->isNull()) | 391 if (!imageResource->hasImage() || imageResource->image()->isNull()) |
| 392 continue; | 392 continue; |
| 393 BitmapImage* image = toBitmapImage(imageResource->image()); | 393 BitmapImage* image = toBitmapImage(imageResource->image()); |
| 394 if (redecodeImages) | 394 if (redecodeImages) |
| 395 image->resetDecoder(); | 395 image->resetDecoder(); |
| 396 imageResource->updateImage(image->isAllDataReceived()); | 396 imageResource->updateImage(image->isAllDataReceived()); |
| 397 } | 397 } |
| 398 } | 398 } |
| 399 | 399 |
| 400 void ImageResource::finishOnePart() | 400 void ImageResource::finishOnePart() |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) | 488 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) |
| 489 { | 489 { |
| 490 if (!image()->currentFrameHasSingleSecurityOrigin()) | 490 if (!image()->currentFrameHasSingleSecurityOrigin()) |
| 491 return false; | 491 return false; |
| 492 if (passesAccessControlCheck(securityOrigin)) | 492 if (passesAccessControlCheck(securityOrigin)) |
| 493 return true; | 493 return true; |
| 494 return !securityOrigin->taintsCanvas(response().url()); | 494 return !securityOrigin->taintsCanvas(response().url()); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace blink | 497 } // namespace blink |
| OLD | NEW |