| 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/CanvasImageElementSource.h" | 32 #include "core/html/canvas/ImageElementBase.h" |
| 33 #include "core/imagebitmap/ImageBitmapSource.h" | |
| 34 #include "platform/graphics/GraphicsTypes.h" | 33 #include "platform/graphics/GraphicsTypes.h" |
| 35 #include "platform/loader/fetch/FetchParameters.h" | 34 #include "platform/loader/fetch/FetchParameters.h" |
| 36 #include "platform/loader/fetch/ResourceResponse.h" | 35 #include "platform/loader/fetch/ResourceResponse.h" |
| 37 | 36 |
| 38 namespace blink { | 37 namespace blink { |
| 39 | 38 |
| 40 class HTMLFormElement; | 39 class HTMLFormElement; |
| 41 class ImageCandidate; | 40 class ImageCandidate; |
| 42 class ShadowRoot; | 41 class ShadowRoot; |
| 43 class ImageBitmapOptions; | |
| 44 | 42 |
| 45 class CORE_EXPORT HTMLImageElement final | 43 class CORE_EXPORT HTMLImageElement final |
| 46 : public HTMLElement, | 44 : public HTMLElement, |
| 47 public CanvasImageElementSource, | 45 public ImageElementBase, |
| 48 public ImageBitmapSource, | |
| 49 public ActiveScriptWrappable<HTMLImageElement>, | 46 public ActiveScriptWrappable<HTMLImageElement>, |
| 50 public FormAssociated { | 47 public FormAssociated { |
| 51 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
| 52 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement); | 49 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement); |
| 53 | 50 |
| 54 public: | 51 public: |
| 55 class ViewportChangeListener; | 52 class ViewportChangeListener; |
| 56 | 53 |
| 57 static HTMLImageElement* Create(Document&); | 54 static HTMLImageElement* Create(Document&); |
| 58 static HTMLImageElement* Create(Document&, bool created_by_parser); | 55 static HTMLImageElement* Create(Document&, bool created_by_parser); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // public so that HTMLPictureElement can call this as well. | 123 // public so that HTMLPictureElement can call this as well. |
| 127 void SelectSourceURL(ImageLoader::UpdateFromElementBehavior); | 124 void SelectSourceURL(ImageLoader::UpdateFromElementBehavior); |
| 128 | 125 |
| 129 void SetIsFallbackImage() { is_fallback_image_ = true; } | 126 void SetIsFallbackImage() { is_fallback_image_ = true; } |
| 130 | 127 |
| 131 FetchParameters::ResourceWidth GetResourceWidth(); | 128 FetchParameters::ResourceWidth GetResourceWidth(); |
| 132 float SourceSize(Element&); | 129 float SourceSize(Element&); |
| 133 | 130 |
| 134 void ForceReload() const; | 131 void ForceReload() const; |
| 135 | 132 |
| 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 | |
| 144 FormAssociated* ToFormAssociatedOrNull() override { return this; }; | 133 FormAssociated* ToFormAssociatedOrNull() override { return this; }; |
| 145 void AssociateWith(HTMLFormElement*) override; | 134 void AssociateWith(HTMLFormElement*) override; |
| 146 | 135 |
| 147 protected: | 136 protected: |
| 148 // Controls how an image element appears in the layout. See: | 137 // Controls how an image element appears in the layout. See: |
| 149 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request | 138 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request |
| 150 enum class LayoutDisposition : uint8_t { | 139 enum class LayoutDisposition : uint8_t { |
| 151 // Displayed as a partially or completely loaded image. Corresponds to the | 140 // Displayed as a partially or completely loaded image. Corresponds to the |
| 152 // `current request` state being: `unavailable`, `partially available`, or | 141 // `current request` state being: `unavailable`, `partially available`, or |
| 153 // `completely available`. | 142 // `completely available`. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 unsigned form_was_set_by_parser_ : 1; | 202 unsigned form_was_set_by_parser_ : 1; |
| 214 unsigned element_created_by_parser_ : 1; | 203 unsigned element_created_by_parser_ : 1; |
| 215 unsigned is_fallback_image_ : 1; | 204 unsigned is_fallback_image_ : 1; |
| 216 | 205 |
| 217 ReferrerPolicy referrer_policy_; | 206 ReferrerPolicy referrer_policy_; |
| 218 }; | 207 }; |
| 219 | 208 |
| 220 } // namespace blink | 209 } // namespace blink |
| 221 | 210 |
| 222 #endif // HTMLImageElement_h | 211 #endif // HTMLImageElement_h |
| OLD | NEW |