Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
| 14 * | 14 * |
| 15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
| 16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
| 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
| 19 */ | 19 */ |
| 20 | 20 |
| 21 #include "core/css/CSSImageValue.h" | 21 #include "core/css/CSSImageValue.h" |
| 22 | 22 |
| 23 #include "core/css/CSSMarkup.h" | 23 #include "core/css/CSSMarkup.h" |
| 24 #include "core/dom/Document.h" | 24 #include "core/dom/Document.h" |
| 25 #include "core/dom/TaskRunnerHelper.h" | |
| 25 #include "core/frame/Settings.h" | 26 #include "core/frame/Settings.h" |
| 26 #include "core/loader/resource/ImageResourceContent.h" | 27 #include "core/loader/resource/ImageResourceContent.h" |
| 27 #include "core/style/StyleFetchedImage.h" | 28 #include "core/style/StyleFetchedImage.h" |
| 28 #include "core/style/StyleInvalidImage.h" | 29 #include "core/style/StyleInvalidImage.h" |
| 29 #include "platform/CrossOriginAttributeValue.h" | 30 #include "platform/CrossOriginAttributeValue.h" |
| 30 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" | 31 #include "platform/loader/fetch/FetchInitiatorTypeNames.h" |
| 31 #include "platform/loader/fetch/FetchParameters.h" | 32 #include "platform/loader/fetch/FetchParameters.h" |
| 32 #include "platform/loader/fetch/ResourceFetcher.h" | 33 #include "platform/loader/fetch/ResourceFetcher.h" |
| 33 #include "platform/weborigin/KURL.h" | 34 #include "platform/weborigin/KURL.h" |
| 34 #include "platform/weborigin/SecurityPolicy.h" | 35 #include "platform/weborigin/SecurityPolicy.h" |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 65 : initiator_name_); | 66 : initiator_name_); |
| 66 | 67 |
| 67 if (cross_origin != kCrossOriginAttributeNotSet) { | 68 if (cross_origin != kCrossOriginAttributeNotSet) { |
| 68 params.SetCrossOriginAccessControl(document.GetSecurityOrigin(), | 69 params.SetCrossOriginAccessControl(document.GetSecurityOrigin(), |
| 69 cross_origin); | 70 cross_origin); |
| 70 } | 71 } |
| 71 if (document.GetSettings() && | 72 if (document.GetSettings() && |
| 72 document.GetSettings()->GetFetchImagePlaceholders()) | 73 document.GetSettings()->GetFetchImagePlaceholders()) |
| 73 params.SetAllowImagePlaceholder(); | 74 params.SetAllowImagePlaceholder(); |
| 74 | 75 |
| 75 if (ImageResourceContent* cached_image = | 76 RefPtr<WebTaskRunner> task_runner = TaskRunnerHelper::Get( |
| 76 ImageResourceContent::Fetch(params, document.Fetcher())) { | 77 TaskType::kAnimationTimer, const_cast<Document*>(&document)); |
|
Dan Elphick
2017/04/27 14:41:39
more const_cast here:(
| |
| 78 if (ImageResourceContent* cached_image = ImageResourceContent::Fetch( | |
| 79 task_runner, params, document.Fetcher())) { | |
| 77 cached_image_ = | 80 cached_image_ = |
| 78 StyleFetchedImage::Create(cached_image, document, params.Url()); | 81 StyleFetchedImage::Create(cached_image, document, params.Url()); |
| 79 } else { | 82 } else { |
| 80 cached_image_ = StyleInvalidImage::Create(Url()); | 83 cached_image_ = StyleInvalidImage::Create(Url()); |
| 81 } | 84 } |
| 82 } | 85 } |
| 83 | 86 |
| 84 return cached_image_.Get(); | 87 return cached_image_.Get(); |
| 85 } | 88 } |
| 86 | 89 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 void CSSImageValue::ReResolveURL(const Document& document) const { | 132 void CSSImageValue::ReResolveURL(const Document& document) const { |
| 130 KURL url = document.CompleteURL(relative_url_); | 133 KURL url = document.CompleteURL(relative_url_); |
| 131 AtomicString url_string(url.GetString()); | 134 AtomicString url_string(url.GetString()); |
| 132 if (url_string == absolute_url_) | 135 if (url_string == absolute_url_) |
| 133 return; | 136 return; |
| 134 absolute_url_ = url_string; | 137 absolute_url_ = url_string; |
| 135 cached_image_.Clear(); | 138 cached_image_.Clear(); |
| 136 } | 139 } |
| 137 | 140 |
| 138 } // namespace blink | 141 } // namespace blink |
| OLD | NEW |