| 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/svg/graphics/SVGImage.h" | 32 #include "core/svg/graphics/SVGImage.h" |
| 33 #include "platform/Logging.h" | 33 #include "platform/Logging.h" |
| 34 #include "platform/RuntimeEnabledFeatures.h" | 34 #include "platform/RuntimeEnabledFeatures.h" |
| 35 #include "platform/SharedBuffer.h" | 35 #include "platform/SharedBuffer.h" |
| 36 #include "platform/TraceEvent.h" | 36 #include "platform/TraceEvent.h" |
| 37 #include "platform/graphics/BitmapImage.h" | 37 #include "platform/graphics/BitmapImage.h" |
| 38 #include "public/platform/Platform.h" | 38 #include "public/platform/Platform.h" |
| 39 #include "public/platform/WebCachePolicy.h" | 39 #include "public/platform/WebCachePolicy.h" |
| 40 #include "wtf/CurrentTime.h" | 40 #include "wtf/CurrentTime.h" |
| 41 #include "wtf/StdLibExtras.h" | 41 #include "wtf/StdLibExtras.h" |
| 42 #include <memory> |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 using ImageResourceObserverWalker = ResourceClientOrObserverWalker<ImageResource
Observer, ImageResourceObserver>; | 46 using ImageResourceObserverWalker = ResourceClientOrObserverWalker<ImageResource
Observer, ImageResourceObserver>; |
| 46 | 47 |
| 47 ImageResource* ImageResource::fetch(FetchRequest& request, ResourceFetcher* fetc
her) | 48 ImageResource* ImageResource::fetch(FetchRequest& request, ResourceFetcher* fetc
her) |
| 48 { | 49 { |
| 49 if (request.resourceRequest().requestContext() == WebURLRequest::RequestCont
extUnspecified) | 50 if (request.resourceRequest().requestContext() == WebURLRequest::RequestCont
extUnspecified) |
| 50 request.mutableResourceRequest().setRequestContext(WebURLRequest::Reques
tContextImage); | 51 request.mutableResourceRequest().setRequestContext(WebURLRequest::Reques
tContextImage); |
| 51 if (fetcher->context().pageDismissalEventBeingDispatched()) { | 52 if (fetcher->context().pageDismissalEventBeingDispatched()) { |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 | 399 |
| 399 void ImageResource::error(const ResourceError& error) | 400 void ImageResource::error(const ResourceError& error) |
| 400 { | 401 { |
| 401 if (m_multipartParser) | 402 if (m_multipartParser) |
| 402 m_multipartParser->cancel(); | 403 m_multipartParser->cancel(); |
| 403 clear(); | 404 clear(); |
| 404 Resource::error(error); | 405 Resource::error(error); |
| 405 notifyObservers(); | 406 notifyObservers(); |
| 406 } | 407 } |
| 407 | 408 |
| 408 void ImageResource::responseReceived(const ResourceResponse& response, PassOwnPt
r<WebDataConsumerHandle> handle) | 409 void ImageResource::responseReceived(const ResourceResponse& response, std::uniq
ue_ptr<WebDataConsumerHandle> handle) |
| 409 { | 410 { |
| 410 ASSERT(!handle); | 411 ASSERT(!handle); |
| 411 ASSERT(!m_multipartParser); | 412 ASSERT(!m_multipartParser); |
| 412 // If there's no boundary, just handle the request normally. | 413 // If there's no boundary, just handle the request normally. |
| 413 if (response.isMultipart() && !response.multipartBoundary().isEmpty()) | 414 if (response.isMultipart() && !response.multipartBoundary().isEmpty()) |
| 414 m_multipartParser = new MultipartImageResourceParser(response, response.
multipartBoundary(), this); | 415 m_multipartParser = new MultipartImageResourceParser(response, response.
multipartBoundary(), this); |
| 415 Resource::responseReceived(response, std::move(handle)); | 416 Resource::responseReceived(response, std::move(handle)); |
| 416 if (RuntimeEnabledFeatures::clientHintsEnabled()) { | 417 if (RuntimeEnabledFeatures::clientHintsEnabled()) { |
| 417 m_devicePixelRatioHeaderValue = m_response.httpHeaderField(HTTPNames::Co
ntent_DPR).toFloat(&m_hasDevicePixelRatioHeaderValue); | 418 m_devicePixelRatioHeaderValue = m_response.httpHeaderField(HTTPNames::Co
ntent_DPR).toFloat(&m_hasDevicePixelRatioHeaderValue); |
| 418 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue <
= 0.0) { | 419 if (!m_hasDevicePixelRatioHeaderValue || m_devicePixelRatioHeaderValue <
= 0.0) { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 if (response().wasFetchedViaServiceWorker()) | 550 if (response().wasFetchedViaServiceWorker()) |
| 550 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; | 551 return response().serviceWorkerResponseType() != WebServiceWorkerRespons
eTypeOpaque; |
| 551 if (!getImage()->currentFrameHasSingleSecurityOrigin()) | 552 if (!getImage()->currentFrameHasSingleSecurityOrigin()) |
| 552 return false; | 553 return false; |
| 553 if (passesAccessControlCheck(securityOrigin)) | 554 if (passesAccessControlCheck(securityOrigin)) |
| 554 return true; | 555 return true; |
| 555 return !securityOrigin->taintsCanvas(response().url()); | 556 return !securityOrigin->taintsCanvas(response().url()); |
| 556 } | 557 } |
| 557 | 558 |
| 558 } // namespace blink | 559 } // namespace blink |
| OLD | NEW |