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

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

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: rebase Created 3 years, 7 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 6caecfaec7899e9d0cb2ce59095a53e64c2f27ca..c8e0200465f574d9d70d37e6ea810fe12da31248 100644
--- a/third_party/WebKit/Source/core/html/HTMLImageElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLImageElement.h
@@ -31,6 +31,7 @@
#include "core/html/canvas/ImageElementBase.h"
#include "platform/bindings/ActiveScriptWrappable.h"
#include "platform/graphics/GraphicsTypes.h"
+#include "platform/heap/HeapAllocator.h"
#include "platform/loader/fetch/FetchParameters.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 {
@@ -133,6 +136,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
@@ -185,6 +190,13 @@ class CORE_EXPORT HTMLImageElement final
bool IsInteractiveContent() const override;
Image* ImageContents() override;
+ // Issues a request to decode the image to the chrome client.
+ void RequestDecode();
+ // A callback that is called when the image with the given sequence id has
+ // been decoded (either successfully or not). This is a signal to
+ // resolve/reject the promises that have been handed out.
+ void DecodeRequestFinished(uint32_t sequence_id, bool success);
+
void ResetFormOwner();
ImageCandidate FindBestFitImageFromPictureParent();
void SetBestFitURLAndDPRFromImageCandidate(const ImageCandidate&);
@@ -199,6 +211,8 @@ class CORE_EXPORT HTMLImageElement final
float image_device_pixel_ratio_;
Member<HTMLSourceElement> source_;
LayoutDisposition layout_disposition_;
+ HeapVector<Member<ScriptPromiseResolver>> decode_promise_resolvers_;
+ uint32_t decode_sequence_id_;
unsigned form_was_set_by_parser_ : 1;
unsigned element_created_by_parser_ : 1;
unsigned is_fallback_image_ : 1;
« no previous file with comments | « third_party/WebKit/Source/core/frame/WebFrameWidgetBase.cpp ('k') | third_party/WebKit/Source/core/html/HTMLImageElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698