OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/html/canvas/ImageElementBase.h" | 5 #include "core/html/canvas/ImageElementBase.h" |
6 | 6 |
7 #include "core/frame/ImageBitmap.h" | 7 #include "core/frame/ImageBitmap.h" |
8 #include "core/frame/LocalDOMWindow.h" | 8 #include "core/frame/LocalDOMWindow.h" |
9 #include "core/layout/LayoutObject.h" | 9 #include "core/layout/LayoutObject.h" |
10 #include "core/loader/ImageLoader.h" | 10 #include "core/loader/ImageLoader.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } | 21 } |
22 | 22 |
23 bool ImageElementBase::IsSVGSource() const { | 23 bool ImageElementBase::IsSVGSource() const { |
24 return CachedImage() && CachedImage()->GetImage()->IsSVGImage(); | 24 return CachedImage() && CachedImage()->GetImage()->IsSVGImage(); |
25 } | 25 } |
26 | 26 |
27 PassRefPtr<Image> ImageElementBase::GetSourceImageForCanvas( | 27 PassRefPtr<Image> ImageElementBase::GetSourceImageForCanvas( |
28 SourceImageStatus* status, | 28 SourceImageStatus* status, |
29 AccelerationHint, | 29 AccelerationHint, |
30 SnapshotReason, | 30 SnapshotReason, |
31 const FloatSize& default_object_size) const { | 31 const FloatSize& default_object_size) { |
32 if (!GetImageLoader().ImageComplete() || !CachedImage()) { | 32 if (!GetImageLoader().ImageComplete() || !CachedImage()) { |
33 *status = kIncompleteSourceImageStatus; | 33 *status = kIncompleteSourceImageStatus; |
34 return nullptr; | 34 return nullptr; |
35 } | 35 } |
36 | 36 |
37 if (CachedImage()->ErrorOccurred()) { | 37 if (CachedImage()->ErrorOccurred()) { |
38 *status = kUndecodableSourceImageStatus; | 38 *status = kUndecodableSourceImageStatus; |
39 return nullptr; | 39 return nullptr; |
40 } | 40 } |
41 | 41 |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return ScriptPromise(); | 153 return ScriptPromise(); |
154 if (!ImageBitmap::IsResizeOptionValid(options, exception_state)) | 154 if (!ImageBitmap::IsResizeOptionValid(options, exception_state)) |
155 return ScriptPromise(); | 155 return ScriptPromise(); |
156 return ImageBitmapSource::FulfillImageBitmap( | 156 return ImageBitmapSource::FulfillImageBitmap( |
157 script_state, ImageBitmap::Create( | 157 script_state, ImageBitmap::Create( |
158 this, crop_rect, | 158 this, crop_rect, |
159 event_target.ToLocalDOMWindow()->document(), options)); | 159 event_target.ToLocalDOMWindow()->document(), options)); |
160 } | 160 } |
161 | 161 |
162 } // namespace blink | 162 } // namespace blink |
OLD | NEW |