| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // FIXME: In the future, we want to take much more than deviceScaleFacto
r into acount here. | 105 // FIXME: In the future, we want to take much more than deviceScaleFacto
r into acount here. |
| 106 // All forms of scale should be included: Page::pageScaleFactor(), Local
Frame::pageZoomFactor(), | 106 // All forms of scale should be included: Page::pageScaleFactor(), Local
Frame::pageZoomFactor(), |
| 107 // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698 | 107 // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698 |
| 108 ImageWithScale image = bestImageForScaleFactor(); | 108 ImageWithScale image = bestImageForScaleFactor(); |
| 109 FetchRequest request(ResourceRequest(document->completeURL(image.imageUR
L)), FetchInitiatorTypeNames::css, options); | 109 FetchRequest request(ResourceRequest(document->completeURL(image.imageUR
L)), FetchInitiatorTypeNames::css, options); |
| 110 request.mutableResourceRequest().setHTTPReferrer(image.referrer); | 110 request.mutableResourceRequest().setHTTPReferrer(image.referrer); |
| 111 | 111 |
| 112 if (options.corsEnabled == IsCORSEnabled) | 112 if (options.corsEnabled == IsCORSEnabled) |
| 113 request.setCrossOriginAccessControl(document->securityOrigin(), opti
ons.allowCredentials, options.credentialsRequested); | 113 request.setCrossOriginAccessControl(document->securityOrigin(), opti
ons.allowCredentials, options.credentialsRequested); |
| 114 | 114 |
| 115 if (ResourcePtr<ImageResource> cachedImage = document->fetcher()->fetchI
mage(request)) { | 115 if (ResourcePtr<ImageResource> cachedImage = ImageResource::fetch(reques
t, document->fetcher())) { |
| 116 m_imageSet = StyleFetchedImageSet::create(cachedImage.get(), image.s
caleFactor, this); | 116 m_imageSet = StyleFetchedImageSet::create(cachedImage.get(), image.s
caleFactor, this); |
| 117 m_accessedBestFitImage = true; | 117 m_accessedBestFitImage = true; |
| 118 } | 118 } |
| 119 } | 119 } |
| 120 | 120 |
| 121 return (m_imageSet && m_imageSet->isImageResourceSet()) ? toStyleFetchedImag
eSet(m_imageSet) : 0; | 121 return (m_imageSet && m_imageSet->isImageResourceSet()) ? toStyleFetchedImag
eSet(m_imageSet) : 0; |
| 122 } | 122 } |
| 123 | 123 |
| 124 StyleFetchedImageSet* CSSImageSetValue::cachedImageSet(Document* document, float
deviceScaleFactor) | 124 StyleFetchedImageSet* CSSImageSetValue::cachedImageSet(Document* document, float
deviceScaleFactor) |
| 125 { | 125 { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 bool CSSImageSetValue::hasFailedOrCanceledSubresources() const | 174 bool CSSImageSetValue::hasFailedOrCanceledSubresources() const |
| 175 { | 175 { |
| 176 if (!m_imageSet || !m_imageSet->isImageResourceSet()) | 176 if (!m_imageSet || !m_imageSet->isImageResourceSet()) |
| 177 return false; | 177 return false; |
| 178 if (Resource* cachedResource = toStyleFetchedImageSet(m_imageSet)->cachedIma
ge()) | 178 if (Resource* cachedResource = toStyleFetchedImageSet(m_imageSet)->cachedIma
ge()) |
| 179 return cachedResource->loadFailedOrCanceled(); | 179 return cachedResource->loadFailedOrCanceled(); |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |