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

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

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: update 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void setHeight(unsigned); 92 void setHeight(unsigned);
93 93
94 KURL src() const; 94 KURL src() const;
95 void setSrc(const String&); 95 void setSrc(const String&);
96 96
97 void setWidth(unsigned); 97 void setWidth(unsigned);
98 98
99 int x() const; 99 int x() const;
100 int y() const; 100 int y() const;
101 101
102 ScriptPromise decode(ScriptState*, ExceptionState&);
103
102 bool complete() const; 104 bool complete() const;
103 105
104 bool hasPendingActivity() const final { 106 bool hasPendingActivity() const final {
105 return imageLoader().hasPendingActivity(); 107 return imageLoader().hasPendingActivity();
106 } 108 }
107 109
108 bool canContainRangeEndPoint() const override { return false; } 110 bool canContainRangeEndPoint() const override { return false; }
109 111
110 const AtomicString imageSourceURL() const override; 112 const AtomicString imageSourceURL() const override;
111 113
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 }; 172 };
171 173
172 explicit HTMLImageElement(Document&, 174 explicit HTMLImageElement(Document&,
173 bool createdByParser = false); 175 bool createdByParser = false);
174 176
175 void didMoveToNewDocument(Document& oldDocument) override; 177 void didMoveToNewDocument(Document& oldDocument) override;
176 178
177 void didAddUserAgentShadowRoot(ShadowRoot&) override; 179 void didAddUserAgentShadowRoot(ShadowRoot&) override;
178 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override; 180 PassRefPtr<ComputedStyle> customStyleForLayoutObject() override;
179 181
182 void defaultEventHandler(Event*) override;
183
180 private: 184 private:
181 bool areAuthorShadowsAllowed() const override { return false; } 185 bool areAuthorShadowsAllowed() const override { return false; }
182 186
183 void parseAttribute(const AttributeModificationParams&) override; 187 void parseAttribute(const AttributeModificationParams&) override;
184 bool isPresentationAttribute(const QualifiedName&) const override; 188 bool isPresentationAttribute(const QualifiedName&) const override;
185 void collectStyleForPresentationAttribute(const QualifiedName&, 189 void collectStyleForPresentationAttribute(const QualifiedName&,
186 const AtomicString&, 190 const AtomicString&,
187 MutableStylePropertySet*) override; 191 MutableStylePropertySet*) override;
188 void setLayoutDisposition(LayoutDisposition, bool forceReattach = false); 192 void setLayoutDisposition(LayoutDisposition, bool forceReattach = false);
189 193
(...skipping 15 matching lines...) Expand all
205 bool isInteractiveContent() const override; 209 bool isInteractiveContent() const override;
206 Image* imageContents() override; 210 Image* imageContents() override;
207 211
208 void resetFormOwner(); 212 void resetFormOwner();
209 ImageCandidate findBestFitImageFromPictureParent(); 213 ImageCandidate findBestFitImageFromPictureParent();
210 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&); 214 void setBestFitURLAndDPRFromImageCandidate(const ImageCandidate&);
211 HTMLImageLoader& imageLoader() const { return *m_imageLoader; } 215 HTMLImageLoader& imageLoader() const { return *m_imageLoader; }
212 void notifyViewportChanged(); 216 void notifyViewportChanged();
213 void createMediaQueryListIfDoesNotExist(); 217 void createMediaQueryListIfDoesNotExist();
214 218
219 void requestDecode();
220 void didDecode(bool success);
221
215 Member<HTMLImageLoader> m_imageLoader; 222 Member<HTMLImageLoader> m_imageLoader;
216 Member<ViewportChangeListener> m_listener; 223 Member<ViewportChangeListener> m_listener;
217 Member<HTMLFormElement> m_form; 224 Member<HTMLFormElement> m_form;
218 AtomicString m_bestFitImageURL; 225 AtomicString m_bestFitImageURL;
219 float m_imageDevicePixelRatio; 226 float m_imageDevicePixelRatio;
220 Member<HTMLSourceElement> m_source; 227 Member<HTMLSourceElement> m_source;
221 LayoutDisposition m_layoutDisposition; 228 LayoutDisposition m_layoutDisposition;
222 unsigned m_formWasSetByParser : 1; 229 unsigned m_formWasSetByParser : 1;
223 unsigned m_elementCreatedByParser : 1; 230 unsigned m_elementCreatedByParser : 1;
224 unsigned m_isFallbackImage : 1; 231 unsigned m_isFallbackImage : 1;
232 Member<ScriptPromiseResolver> m_decodePromiseResolver;
225 233
226 ReferrerPolicy m_referrerPolicy; 234 ReferrerPolicy m_referrerPolicy;
235
236 WTF::WeakPtrFactory<HTMLImageElement> m_weakPtrFactory;
227 }; 237 };
228 238
229 } // namespace blink 239 } // namespace blink
230 240
231 #endif // HTMLImageElement_h 241 #endif // HTMLImageElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698