Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(445)

Side by Side Diff: Source/core/css/CSSImageSetValue.cpp

Issue 1170503003: Remove resource type-specific fetching logic from ResourceFetcher (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null-check Document::loader() before calling startPreload() Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSFontFaceSrcValue.cpp ('k') | Source/core/css/CSSImageValue.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/core/css/CSSFontFaceSrcValue.cpp ('k') | Source/core/css/CSSImageValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698