Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLImageElement.h

Issue 2802813002: Adds SVGImageElement as a ImageBitmapSource (Closed)
Patch Set: tests Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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/HTMLAndSVGImageElementSource.h"
33 #include "core/imagebitmap/ImageBitmapSource.h"
34 #include "platform/graphics/GraphicsTypes.h" 33 #include "platform/graphics/GraphicsTypes.h"
35 #include "platform/loader/fetch/FetchRequest.h" 34 #include "platform/loader/fetch/FetchRequest.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 HTMLAndSVGImageElementSource,
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&, 55 static HTMLImageElement* create(Document&,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // public so that HTMLPictureElement can call this as well. 120 // public so that HTMLPictureElement can call this as well.
124 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); 121 void selectSourceURL(ImageLoader::UpdateFromElementBehavior);
125 122
126 void setIsFallbackImage() { m_isFallbackImage = true; } 123 void setIsFallbackImage() { m_isFallbackImage = true; }
127 124
128 FetchRequest::ResourceWidth getResourceWidth(); 125 FetchRequest::ResourceWidth getResourceWidth();
129 float sourceSize(Element&); 126 float sourceSize(Element&);
130 127
131 void forceReload() const; 128 void forceReload() const;
132 129
133 // ImageBitmapSource implementation
134 IntSize bitmapSourceSize() const override;
135 ScriptPromise createImageBitmap(ScriptState*,
136 EventTarget&,
137 Optional<IntRect> cropRect,
138 const ImageBitmapOptions&,
139 ExceptionState&) override;
140
141 FormAssociated* toFormAssociatedOrNull() override { return this; }; 130 FormAssociated* toFormAssociatedOrNull() override { return this; };
142 void associateWith(HTMLFormElement*) override; 131 void associateWith(HTMLFormElement*) override;
143 132
144 protected: 133 protected:
145 // Controls how an image element appears in the layout. See: 134 // Controls how an image element appears in the layout. See:
146 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request 135 // https://html.spec.whatwg.org/multipage/embedded-content.html#image-request
147 enum class LayoutDisposition : uint8_t { 136 enum class LayoutDisposition : uint8_t {
148 // Displayed as a partially or completely loaded image. Corresponds to the 137 // Displayed as a partially or completely loaded image. Corresponds to the
149 // `current request` state being: `unavailable`, `partially available`, or 138 // `current request` state being: `unavailable`, `partially available`, or
150 // `completely available`. 139 // `completely available`.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 unsigned m_formWasSetByParser : 1; 200 unsigned m_formWasSetByParser : 1;
212 unsigned m_elementCreatedByParser : 1; 201 unsigned m_elementCreatedByParser : 1;
213 unsigned m_isFallbackImage : 1; 202 unsigned m_isFallbackImage : 1;
214 203
215 ReferrerPolicy m_referrerPolicy; 204 ReferrerPolicy m_referrerPolicy;
216 }; 205 };
217 206
218 } // namespace blink 207 } // namespace blink
219 208
220 #endif // HTMLImageElement_h 209 #endif // HTMLImageElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698