| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 370 } |
| 371 | 371 |
| 372 // It would be nice to only redraw the decoded band of the image, but wi
th the current design | 372 // It would be nice to only redraw the decoded band of the image, but wi
th the current design |
| 373 // (decoding delayed until painting) that seems hard. | 373 // (decoding delayed until painting) that seems hard. |
| 374 notifyObservers(); | 374 notifyObservers(); |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 | 377 |
| 378 void CachedImage::finishOnePart() | 378 void CachedImage::finishOnePart() |
| 379 { | 379 { |
| 380 if (m_loadingMultipartContent) |
| 381 clear(); |
| 380 updateImage(true); | 382 updateImage(true); |
| 383 if (m_loadingMultipartContent) |
| 384 m_data.clear(); |
| 381 CachedResource::finishOnePart(); | 385 CachedResource::finishOnePart(); |
| 382 } | 386 } |
| 383 | 387 |
| 384 void CachedImage::error(CachedResource::Status status) | 388 void CachedImage::error(CachedResource::Status status) |
| 385 { | 389 { |
| 386 clear(); | 390 clear(); |
| 387 CachedResource::error(status); | 391 CachedResource::error(status); |
| 388 notifyObservers(); | 392 notifyObservers(); |
| 389 } | 393 } |
| 390 | 394 |
| 391 void CachedImage::responseReceived(const ResourceResponse& response) | 395 void CachedImage::responseReceived(const ResourceResponse& response) |
| 392 { | 396 { |
| 393 if (m_loadingMultipartContent) { | 397 if (m_loadingMultipartContent && m_data) |
| 394 if (m_data) | 398 finishOnePart(); |
| 395 finishOnePart(); | 399 else if (response.isMultipart()) |
| 396 clear(); | |
| 397 } else if (response.isMultipart()) | |
| 398 m_loadingMultipartContent = true; | 400 m_loadingMultipartContent = true; |
| 399 CachedResource::responseReceived(response); | 401 CachedResource::responseReceived(response); |
| 400 } | 402 } |
| 401 | 403 |
| 402 void CachedImage::destroyDecodedData() | 404 void CachedImage::destroyDecodedData() |
| 403 { | 405 { |
| 404 bool canDeleteImage = !m_image || (m_image->hasOneRef() && m_image->isBitmap
Image()); | 406 bool canDeleteImage = !m_image || (m_image->hasOneRef() && m_image->isBitmap
Image()); |
| 405 if (isSafeToMakePurgeable() && canDeleteImage && !isLoading()) { | 407 if (isSafeToMakePurgeable() && canDeleteImage && !isLoading()) { |
| 406 // Image refs the data buffer so we should not make it purgeable while t
he image is alive. | 408 // Image refs the data buffer so we should not make it purgeable while t
he image is alive. |
| 407 // Invoking addClient() will reconstruct the image object. | 409 // Invoking addClient() will reconstruct the image object. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 477 |
| 476 bool CachedImage::currentFrameKnownToBeOpaque(const RenderObject* renderer) | 478 bool CachedImage::currentFrameKnownToBeOpaque(const RenderObject* renderer) |
| 477 { | 479 { |
| 478 Image* image = imageForRenderer(renderer); | 480 Image* image = imageForRenderer(renderer); |
| 479 if (image->isBitmapImage()) | 481 if (image->isBitmapImage()) |
| 480 image->nativeImageForCurrentFrame(); // force decode | 482 image->nativeImageForCurrentFrame(); // force decode |
| 481 return image->currentFrameKnownToBeOpaque(); | 483 return image->currentFrameKnownToBeOpaque(); |
| 482 } | 484 } |
| 483 | 485 |
| 484 } // namespace WebCore | 486 } // namespace WebCore |
| OLD | NEW |