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

Unified Diff: third_party/WebKit/Source/core/html/HTMLImageElement.h

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: update 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/HTMLImageElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLImageElement.h b/third_party/WebKit/Source/core/html/HTMLImageElement.h
index f4a5c8c901d8695641345da02626b0bb2929f7e4..00648aba18c68015f8def1aebf910bfbe6043d01 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLImageElement.h
@@ -32,6 +32,7 @@
#include "core/html/canvas/CanvasImageElementSource.h"
#include "core/imagebitmap/ImageBitmapSource.h"
#include "platform/graphics/GraphicsTypes.h"
+#include "platform/heap/HeapAllocator.h"
#include "platform/loader/fetch/FetchRequest.h"
#include "platform/loader/fetch/ResourceResponse.h"
@@ -99,6 +100,8 @@ class CORE_EXPORT HTMLImageElement final
int x() const;
int y() const;
+ ScriptPromise decode(ScriptState*, ExceptionState&);
+
bool complete() const;
bool hasPendingActivity() const final {
@@ -141,6 +144,8 @@ class CORE_EXPORT HTMLImageElement final
FormAssociated* toFormAssociatedOrNull() override { return this; };
void associateWith(HTMLFormElement*) override;
+ void imageNotifyFinished(bool success);
+
protected:
// Controls how an image element appears in the layout. See:
// https://html.spec.whatwg.org/multipage/embedded-content.html#image-request
@@ -201,6 +206,9 @@ class CORE_EXPORT HTMLImageElement final
void notifyViewportChanged();
void createMediaQueryListIfDoesNotExist();
+ void requestDecode();
+ void didDecode(bool success);
+
Member<HTMLImageLoader> m_imageLoader;
Member<ViewportChangeListener> m_listener;
Member<HTMLFormElement> m_form;
@@ -211,8 +219,11 @@ class CORE_EXPORT HTMLImageElement final
unsigned m_formWasSetByParser : 1;
unsigned m_elementCreatedByParser : 1;
unsigned m_isFallbackImage : 1;
+ HeapVector<Member<ScriptPromiseResolver>> m_decodePromiseResolvers;
ReferrerPolicy m_referrerPolicy;
+
+ WTF::WeakPtrFactory<HTMLImageElement> m_weakPtrFactory;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698