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 11 matching lines...) Expand all Loading... | |
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF | 22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
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 <algorithm> | 28 #include <algorithm> |
29 #include "core/css/CSSImageValue.h" | 29 #include "core/css/CSSImageValue.h" |
30 #include "core/css/CSSPrimitiveValue.h" | 30 #include "core/css/CSSPrimitiveValue.h" |
31 #include "core/dom/Document.h" | 31 #include "core/dom/Document.h" |
32 #include "core/dom/TaskRunnerHelper.h" | |
32 #include "core/frame/Settings.h" | 33 #include "core/frame/Settings.h" |
33 #include "core/loader/resource/ImageResourceContent.h" | 34 #include "core/loader/resource/ImageResourceContent.h" |
34 #include "core/style/StyleFetchedImageSet.h" | 35 #include "core/style/StyleFetchedImageSet.h" |
35 #include "core/style/StyleInvalidImage.h" | 36 #include "core/style/StyleInvalidImage.h" |
36 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" | 37 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" |
37 #include "platform/loader/fetch/FetchParameters.h" | 38 #include "platform/loader/fetch/FetchParameters.h" |
38 #include "platform/loader/fetch/ResourceFetcher.h" | 39 #include "platform/loader/fetch/ResourceFetcher.h" |
39 #include "platform/loader/fetch/ResourceLoaderOptions.h" | 40 #include "platform/loader/fetch/ResourceLoaderOptions.h" |
40 #include "platform/weborigin/KURL.h" | 41 #include "platform/weborigin/KURL.h" |
41 #include "platform/weborigin/SecurityPolicy.h" | 42 #include "platform/weborigin/SecurityPolicy.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
116 FetchParameters params(resource_request, FetchInitiatorTypeNames::css); | 117 FetchParameters params(resource_request, FetchInitiatorTypeNames::css); |
117 | 118 |
118 if (cross_origin != kCrossOriginAttributeNotSet) { | 119 if (cross_origin != kCrossOriginAttributeNotSet) { |
119 params.SetCrossOriginAccessControl(document.GetSecurityOrigin(), | 120 params.SetCrossOriginAccessControl(document.GetSecurityOrigin(), |
120 cross_origin); | 121 cross_origin); |
121 } | 122 } |
122 if (document.GetSettings() && | 123 if (document.GetSettings() && |
123 document.GetSettings()->GetFetchImagePlaceholders()) | 124 document.GetSettings()->GetFetchImagePlaceholders()) |
124 params.SetAllowImagePlaceholder(); | 125 params.SetAllowImagePlaceholder(); |
125 | 126 |
126 if (ImageResourceContent* cached_image = | 127 // TODO(delphick): const_cast |
127 ImageResourceContent::Fetch(params, document.Fetcher())) { | 128 RefPtr<WebTaskRunner> task_runner = TaskRunnerHelper::Get( |
Sami
2017/04/27 17:38:17
Interesting, can TaskRunnerHelper be changed to ta
Dan Elphick
2017/05/03 09:41:06
not required now we're not using getting the sched
| |
129 TaskType::kAnimationTimer, const_cast<Document*>(&document)); | |
130 if (ImageResourceContent* cached_image = ImageResourceContent::Fetch( | |
131 task_runner, params, document.Fetcher())) { | |
128 cached_image_ = StyleFetchedImageSet::Create( | 132 cached_image_ = StyleFetchedImageSet::Create( |
129 cached_image, image.scale_factor, this, params.Url()); | 133 cached_image, image.scale_factor, this, params.Url()); |
130 } else { | 134 } else { |
131 cached_image_ = StyleInvalidImage::Create(image.image_url); | 135 cached_image_ = StyleInvalidImage::Create(image.image_url); |
132 } | 136 } |
133 cached_scale_factor_ = device_scale_factor; | 137 cached_scale_factor_ = device_scale_factor; |
134 } | 138 } |
135 | 139 |
136 return cached_image_.Get(); | 140 return cached_image_.Get(); |
137 } | 141 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 CSSImageSetValue* CSSImageSetValue::ValueWithURLsMadeAbsolute() { | 186 CSSImageSetValue* CSSImageSetValue::ValueWithURLsMadeAbsolute() { |
183 CSSImageSetValue* value = CSSImageSetValue::Create(); | 187 CSSImageSetValue* value = CSSImageSetValue::Create(); |
184 for (auto& item : *this) | 188 for (auto& item : *this) |
185 item->IsImageValue() | 189 item->IsImageValue() |
186 ? value->Append(*ToCSSImageValue(*item).ValueWithURLMadeAbsolute()) | 190 ? value->Append(*ToCSSImageValue(*item).ValueWithURLMadeAbsolute()) |
187 : value->Append(*item); | 191 : value->Append(*item); |
188 return value; | 192 return value; |
189 } | 193 } |
190 | 194 |
191 } // namespace blink | 195 } // namespace blink |
OLD | NEW |