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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 load(fetcher, fetcher->defaultResourceOptions()); | 458 load(fetcher, fetcher->defaultResourceOptions()); |
459 } | 459 } |
460 | 460 |
461 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) | 461 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) |
462 { | 462 { |
463 if (!image || image != m_image) | 463 if (!image || image != m_image) |
464 return; | 464 return; |
465 notifyObservers(&rect); | 465 notifyObservers(&rect); |
466 } | 466 } |
467 | 467 |
468 void ImageResource::onePartInMultipartReceived(const ResourceResponse& response, bool isFirstPart) | 468 void ImageResource::onePartInMultipartReceived(const ResourceResponse& response) |
469 { | 469 { |
470 ASSERT(m_multipartParser); | 470 ASSERT(m_multipartParser); |
471 ++m_numParsedPartsInMultipart; | |
472 | |
471 m_response = response; | 473 m_response = response; |
472 if (m_data) { | 474 if (m_numParsedPartsInMultipart == 1) { |
473 clear(); | 475 // We have nothing to do because we don't have any data. |
474 updateImage(true); | 476 return; |
475 m_data.clear(); | 477 } |
478 clear(); | |
hiroshige
2016/03/15 21:38:37
nit: this CL removes |if (m_data)| check. Is this
| |
479 updateImage(true); | |
480 m_data.clear(); | |
481 | |
482 if (m_numParsedPartsInMultipart == 2) { | |
483 // Notify finished when the first part ends. | |
476 setLoading(false); | 484 setLoading(false); |
477 checkNotify(); | 485 checkNotify(); |
486 if (m_loader) | |
487 m_loader->didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEnc odedDataLength); | |
478 } | 488 } |
479 if (!isFirstPart && m_loader) | |
480 m_loader->didFinishLoadingOnePart(0, WebURLLoaderClient::kUnknownEncoded DataLength); | |
481 } | 489 } |
482 | 490 |
483 void ImageResource::multipartDataReceived(const char* bytes, size_t size) | 491 void ImageResource::multipartDataReceived(const char* bytes, size_t size) |
484 { | 492 { |
485 ASSERT(m_multipartParser); | 493 ASSERT(m_multipartParser); |
486 Resource::appendData(bytes, size); | 494 Resource::appendData(bytes, size); |
487 } | 495 } |
488 | 496 |
489 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) | 497 bool ImageResource::isAccessAllowed(SecurityOrigin* securityOrigin) |
490 { | 498 { |
491 if (response().wasFetchedViaServiceWorker()) | 499 if (response().wasFetchedViaServiceWorker()) |
492 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; | 500 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; |
493 if (!getImage()->currentFrameHasSingleSecurityOrigin()) | 501 if (!getImage()->currentFrameHasSingleSecurityOrigin()) |
494 return false; | 502 return false; |
495 if (passesAccessControlCheck(securityOrigin)) | 503 if (passesAccessControlCheck(securityOrigin)) |
496 return true; | 504 return true; |
497 return !securityOrigin->taintsCanvas(response().url()); | 505 return !securityOrigin->taintsCanvas(response().url()); |
498 } | 506 } |
499 | 507 |
500 } // namespace blink | 508 } // namespace blink |
OLD | NEW |