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

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

Issue 2723093004: Adds SVGImageElement as a CanvasImageSource (Closed)
Patch Set: Refactored Canvas code out Created 3 years, 9 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/CanvasImageSource.h" 32 #include "core/html/canvas/CanvasHTMLSVGImage.h"
33 #include "core/imagebitmap/ImageBitmapSource.h" 33 #include "core/imagebitmap/ImageBitmapSource.h"
34 #include "platform/graphics/GraphicsTypes.h" 34 #include "platform/graphics/GraphicsTypes.h"
35 #include "platform/loader/fetch/FetchRequest.h" 35 #include "platform/loader/fetch/FetchRequest.h"
36 #include "platform/network/ResourceResponse.h" 36 #include "platform/network/ResourceResponse.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 class HTMLFormElement; 40 class HTMLFormElement;
41 class ImageCandidate; 41 class ImageCandidate;
42 class ShadowRoot; 42 class ShadowRoot;
43 class ImageBitmapOptions; 43 class ImageBitmapOptions;
44 44
45 class CORE_EXPORT HTMLImageElement final 45 class CORE_EXPORT HTMLImageElement final
46 : public HTMLElement, 46 : public HTMLElement,
47 public CanvasImageSource, 47 public CanvasHTMLSVGImage,
48 public ImageBitmapSource, 48 public ImageBitmapSource,
49 public ActiveScriptWrappable<HTMLImageElement>, 49 public ActiveScriptWrappable<HTMLImageElement>,
50 public FormAssociated { 50 public FormAssociated {
51 DEFINE_WRAPPERTYPEINFO(); 51 DEFINE_WRAPPERTYPEINFO();
52 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement); 52 USING_GARBAGE_COLLECTED_MIXIN(HTMLImageElement);
53 53
54 public: 54 public:
55 class ViewportChangeListener; 55 class ViewportChangeListener;
56 56
57 static HTMLImageElement* create(Document&); 57 static HTMLImageElement* create(Document&);
(...skipping 16 matching lines...) Expand all
74 74
75 unsigned layoutBoxWidth() const; 75 unsigned layoutBoxWidth() const;
76 unsigned layoutBoxHeight() const; 76 unsigned layoutBoxHeight() const;
77 77
78 const String& currentSrc() const; 78 const String& currentSrc() const;
79 79
80 bool isServerMap() const; 80 bool isServerMap() const;
81 81
82 String altText() const final; 82 String altText() const final;
83 83
84 ImageResourceContent* cachedImage() const { return imageLoader().image(); } 84 ImageResourceContent* cachedImage() const override {
85 return imageLoader().image();
86 }
85 ImageResource* cachedImageResourceForImageDocument() const { 87 ImageResource* cachedImageResourceForImageDocument() const {
86 return imageLoader().imageResourceForImageDocument(); 88 return imageLoader().imageResourceForImageDocument();
87 } 89 }
88 void setImageResource(ImageResourceContent* i) { imageLoader().setImage(i); } 90 void setImageResource(ImageResourceContent* i) { imageLoader().setImage(i); }
89 91
90 void setLoadingImageDocument() { imageLoader().setLoadingImageDocument(); } 92 void setLoadingImageDocument() { imageLoader().setLoadingImageDocument(); }
91 93
92 void setHeight(unsigned); 94 void setHeight(unsigned);
93 95
94 KURL src() const; 96 KURL src() const;
(...skipping 14 matching lines...) Expand all
109 111
110 const AtomicString imageSourceURL() const override; 112 const AtomicString imageSourceURL() const override;
111 113
112 HTMLFormElement* formOwner() const override; 114 HTMLFormElement* formOwner() const override;
113 void formRemovedFromTree(const Node& formRoot); 115 void formRemovedFromTree(const Node& formRoot);
114 virtual void ensureCollapsedOrFallbackContent(); 116 virtual void ensureCollapsedOrFallbackContent();
115 virtual void ensureFallbackForGeneratedContent(); 117 virtual void ensureFallbackForGeneratedContent();
116 virtual void ensurePrimaryContent(); 118 virtual void ensurePrimaryContent();
117 bool isCollapsed() const; 119 bool isCollapsed() const;
118 120
119 // CanvasImageSource implementation 121 // CanvasHTMLSVGImage interface implementation.
120 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, 122 const Element* element() const override { return this; }
121 AccelerationHint, 123 bool imageLoaded() const override { return complete(); }
122 SnapshotReason,
123 const FloatSize&) const override;
124 bool isSVGSource() const override;
125 bool wouldTaintOrigin(SecurityOrigin*) const override;
126 FloatSize elementSize(const FloatSize&) const override;
127 FloatSize defaultDestinationSize(const FloatSize&) const override; 124 FloatSize defaultDestinationSize(const FloatSize&) const override;
128 const KURL& sourceURL() const override;
129 bool isAccelerated() const override { return false; }
130 bool isOpaque() const override;
131 int sourceWidth() override;
132 int sourceHeight() override;
133 125
134 // public so that HTMLPictureElement can call this as well. 126 // public so that HTMLPictureElement can call this as well.
135 void selectSourceURL(ImageLoader::UpdateFromElementBehavior); 127 void selectSourceURL(ImageLoader::UpdateFromElementBehavior);
136 128
137 void setIsFallbackImage() { m_isFallbackImage = true; } 129 void setIsFallbackImage() { m_isFallbackImage = true; }
138 130
139 FetchRequest::ResourceWidth getResourceWidth(); 131 FetchRequest::ResourceWidth getResourceWidth();
140 float sourceSize(Element&); 132 float sourceSize(Element&);
141 133
142 void forceReload() const; 134 void forceReload() const;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 unsigned m_formWasSetByParser : 1; 214 unsigned m_formWasSetByParser : 1;
223 unsigned m_elementCreatedByParser : 1; 215 unsigned m_elementCreatedByParser : 1;
224 unsigned m_isFallbackImage : 1; 216 unsigned m_isFallbackImage : 1;
225 217
226 ReferrerPolicy m_referrerPolicy; 218 ReferrerPolicy m_referrerPolicy;
227 }; 219 };
228 220
229 } // namespace blink 221 } // namespace blink
230 222
231 #endif // HTMLImageElement_h 223 #endif // HTMLImageElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698