OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved. |
5 * Copyright (C) 2010 Google Inc. All rights reserved. | 5 * Copyright (C) 2010 Google Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 11 matching lines...) Expand all Loading... |
22 */ | 22 */ |
23 | 23 |
24 #ifndef HTMLImageElement_h | 24 #ifndef HTMLImageElement_h |
25 #define HTMLImageElement_h | 25 #define HTMLImageElement_h |
26 | 26 |
27 #include "bindings/core/v8/ActiveScriptWrappable.h" | 27 #include "bindings/core/v8/ActiveScriptWrappable.h" |
28 #include "core/CoreExport.h" | 28 #include "core/CoreExport.h" |
29 #include "core/html/FormAssociated.h" | 29 #include "core/html/FormAssociated.h" |
30 #include "core/html/HTMLElement.h" | 30 #include "core/html/HTMLElement.h" |
31 #include "core/html/HTMLImageLoader.h" | 31 #include "core/html/HTMLImageLoader.h" |
32 #include "core/html/canvas/ImageElementBase.h" | 32 #include "core/html/canvas/CanvasImageElementSource.h" |
| 33 #include "core/imagebitmap/ImageBitmapSource.h" |
33 #include "platform/graphics/GraphicsTypes.h" | 34 #include "platform/graphics/GraphicsTypes.h" |
34 #include "platform/loader/fetch/FetchParameters.h" | 35 #include "platform/loader/fetch/FetchParameters.h" |
35 #include "platform/loader/fetch/ResourceResponse.h" | 36 #include "platform/loader/fetch/ResourceResponse.h" |
36 | 37 |
37 namespace blink { | 38 namespace blink { |
38 | 39 |
39 class HTMLFormElement; | 40 class HTMLFormElement; |
40 class ImageCandidate; | 41 class ImageCandidate; |
41 class ShadowRoot; | 42 class ShadowRoot; |
| 43 class ImageBitmapOptions; |
42 | 44 |
43 class CORE_EXPORT HTMLImageElement final | 45 class CORE_EXPORT HTMLImageElement final |
44 : public HTMLElement, | 46 : public HTMLElement, |
45 public ImageElementBase, | 47 public CanvasImageElementSource, |
| 48 public ImageBitmapSource, |
46 public ActiveScriptWrappable<HTMLImageElement>, | 49 public ActiveScriptWrappable<HTMLImageElement>, |
47 public FormAssociated { | 50 public FormAssociated { |
48 DEFINE_WRAPPERTYPEINFO(); | 51 DEFINE_WRAPPERTYPEINFO(); |
49 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement); | 52 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement); |
50 | 53 |
51 public: | 54 public: |
52 class ViewportChangeListener; | 55 class ViewportChangeListener; |
53 | 56 |
54 static HTMLImageElement* Create(Document&); | 57 static HTMLImageElement* Create(Document&); |
55 static HTMLImageElement* Create(Document&, bool created_by_parser); | 58 static HTMLImageElement* Create(Document&, bool created_by_parser); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // public so that HTMLPictureElement can call this as well. | 126 // public so that HTMLPictureElement can call this as well. |
124 void SelectSourceURL(ImageLoader::UpdateFromElementBehavior); | 127 void SelectSourceURL(ImageLoader::UpdateFromElementBehavior); |
125 | 128 |
126 void SetIsFallbackImage() { is_fallback_image_ = true; } | 129 void SetIsFallbackImage() { is_fallback_image_ = true; } |
127 | 130 |
128 FetchParameters::ResourceWidth GetResourceWidth(); | 131 FetchParameters::ResourceWidth GetResourceWidth(); |
129 float SourceSize(Element&); | 132 float SourceSize(Element&); |
130 | 133 |
131 void ForceReload() const; | 134 void ForceReload() const; |
132 | 135 |
| 136 // ImageBitmapSource implementation |
| 137 IntSize BitmapSourceSize() const override; |
| 138 ScriptPromise CreateImageBitmap(ScriptState*, |
| 139 EventTarget&, |
| 140 Optional<IntRect> crop_rect, |
| 141 const ImageBitmapOptions&, |
| 142 ExceptionState&) override; |
| 143 |
133 FormAssociated* ToFormAssociatedOrNull() override { return this; }; | 144 FormAssociated* ToFormAssociatedOrNull() override { return this; }; |
134 void AssociateWith(HTMLFormElement*) override; | 145 void AssociateWith(HTMLFormElement*) override; |
135 | 146 |
136 protected: | 147 protected: |
137 // Controls how an image element appears in the layout. See: | 148 // Controls how an image element appears in the layout. See: |
138 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request | 149 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request |
139 enum class LayoutDisposition : uint8_t { | 150 enum class LayoutDisposition : uint8_t { |
140 // Displayed as a partially or completely loaded image. Corresponds to the | 151 // Displayed as a partially or completely loaded image. Corresponds to the |
141 // `current request` state being: `unavailable`, `partially available`, or | 152 // `current request` state being: `unavailable`, `partially available`, or |
142 // `completely available`. | 153 // `completely available`. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 unsigned form_was_set_by_parser_ : 1; | 213 unsigned form_was_set_by_parser_ : 1; |
203 unsigned element_created_by_parser_ : 1; | 214 unsigned element_created_by_parser_ : 1; |
204 unsigned is_fallback_image_ : 1; | 215 unsigned is_fallback_image_ : 1; |
205 | 216 |
206 ReferrerPolicy referrer_policy_; | 217 ReferrerPolicy referrer_policy_; |
207 }; | 218 }; |
208 | 219 |
209 } // namespace blink | 220 } // namespace blink |
210 | 221 |
211 #endif // HTMLImageElement_h | 222 #endif // HTMLImageElement_h |
OLD | NEW |