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 12 matching lines...) Expand all Loading... |
23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "core/css/CSSImageSetValue.h" | 26 #include "core/css/CSSImageSetValue.h" |
27 | 27 |
28 #include "core/css/CSSImageValue.h" | 28 #include "core/css/CSSImageValue.h" |
29 #include "core/css/CSSPrimitiveValue.h" | 29 #include "core/css/CSSPrimitiveValue.h" |
30 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
31 #include "core/fetch/FetchInitiatorTypeNames.h" | 31 #include "core/fetch/FetchInitiatorTypeNames.h" |
32 #include "core/fetch/FetchRequest.h" | 32 #include "core/fetch/FetchRequest.h" |
33 #include "core/fetch/ImageResource.h" | 33 #include "core/fetch/ImageResourceContent.h" |
34 #include "core/fetch/ResourceFetcher.h" | 34 #include "core/fetch/ResourceFetcher.h" |
35 #include "core/fetch/ResourceLoaderOptions.h" | 35 #include "core/fetch/ResourceLoaderOptions.h" |
36 #include "core/frame/Settings.h" | 36 #include "core/frame/Settings.h" |
37 #include "core/style/StyleFetchedImageSet.h" | 37 #include "core/style/StyleFetchedImageSet.h" |
38 #include "core/style/StyleInvalidImage.h" | 38 #include "core/style/StyleInvalidImage.h" |
39 #include "platform/weborigin/KURL.h" | 39 #include "platform/weborigin/KURL.h" |
40 #include "platform/weborigin/SecurityPolicy.h" | 40 #include "platform/weborigin/SecurityPolicy.h" |
41 #include "wtf/text/StringBuilder.h" | 41 #include "wtf/text/StringBuilder.h" |
42 #include <algorithm> | 42 #include <algorithm> |
43 | 43 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 FetchRequest request(ResourceRequest(document.completeURL(image.imageURL)), | 113 FetchRequest request(ResourceRequest(document.completeURL(image.imageURL)), |
114 FetchInitiatorTypeNames::css); | 114 FetchInitiatorTypeNames::css); |
115 request.mutableResourceRequest().setHTTPReferrer(image.referrer); | 115 request.mutableResourceRequest().setHTTPReferrer(image.referrer); |
116 | 116 |
117 if (crossOrigin != CrossOriginAttributeNotSet) | 117 if (crossOrigin != CrossOriginAttributeNotSet) |
118 request.setCrossOriginAccessControl(document.getSecurityOrigin(), | 118 request.setCrossOriginAccessControl(document.getSecurityOrigin(), |
119 crossOrigin); | 119 crossOrigin); |
120 if (document.settings() && document.settings()->fetchImagePlaceholders()) | 120 if (document.settings() && document.settings()->fetchImagePlaceholders()) |
121 request.setAllowImagePlaceholder(); | 121 request.setAllowImagePlaceholder(); |
122 | 122 |
123 if (ImageResource* cachedImage = | 123 if (ImageResourceContent* cachedImage = |
124 ImageResource::fetch(request, document.fetcher())) | 124 ImageResourceContent::fetch(request, document.fetcher())) |
125 m_cachedImage = StyleFetchedImageSet::create( | 125 m_cachedImage = StyleFetchedImageSet::create( |
126 cachedImage, image.scaleFactor, this, request.url()); | 126 cachedImage, image.scaleFactor, this, request.url()); |
127 else | 127 else |
128 m_cachedImage = StyleInvalidImage::create(image.imageURL); | 128 m_cachedImage = StyleInvalidImage::create(image.imageURL); |
129 m_cachedScaleFactor = deviceScaleFactor; | 129 m_cachedScaleFactor = deviceScaleFactor; |
130 } | 130 } |
131 | 131 |
132 return m_cachedImage.get(); | 132 return m_cachedImage.get(); |
133 } | 133 } |
134 | 134 |
(...skipping 23 matching lines...) Expand all Loading... |
158 ++i; | 158 ++i; |
159 } | 159 } |
160 | 160 |
161 result.append(')'); | 161 result.append(')'); |
162 return result.toString(); | 162 return result.toString(); |
163 } | 163 } |
164 | 164 |
165 bool CSSImageSetValue::hasFailedOrCanceledSubresources() const { | 165 bool CSSImageSetValue::hasFailedOrCanceledSubresources() const { |
166 if (!m_cachedImage) | 166 if (!m_cachedImage) |
167 return false; | 167 return false; |
168 if (Resource* cachedResource = m_cachedImage->cachedImage()) | 168 if (ImageResourceContent* cachedResource = m_cachedImage->cachedImage()) |
169 return cachedResource->loadFailedOrCanceled(); | 169 return cachedResource->loadFailedOrCanceled(); |
170 return true; | 170 return true; |
171 } | 171 } |
172 | 172 |
173 DEFINE_TRACE_AFTER_DISPATCH(CSSImageSetValue) { | 173 DEFINE_TRACE_AFTER_DISPATCH(CSSImageSetValue) { |
174 visitor->trace(m_cachedImage); | 174 visitor->trace(m_cachedImage); |
175 CSSValueList::traceAfterDispatch(visitor); | 175 CSSValueList::traceAfterDispatch(visitor); |
176 } | 176 } |
177 | 177 |
178 CSSImageSetValue* CSSImageSetValue::valueWithURLsMadeAbsolute() { | 178 CSSImageSetValue* CSSImageSetValue::valueWithURLsMadeAbsolute() { |
179 CSSImageSetValue* value = CSSImageSetValue::create(); | 179 CSSImageSetValue* value = CSSImageSetValue::create(); |
180 for (auto& item : *this) | 180 for (auto& item : *this) |
181 item->isImageValue() | 181 item->isImageValue() |
182 ? value->append(*toCSSImageValue(*item).valueWithURLMadeAbsolute()) | 182 ? value->append(*toCSSImageValue(*item).valueWithURLMadeAbsolute()) |
183 : value->append(*item); | 183 : value->append(*item); |
184 return value; | 184 return value; |
185 } | 185 } |
186 | 186 |
187 } // namespace blink | 187 } // namespace blink |
OLD | NEW |