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

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

Issue 2769823002: Add decode() functionality to image elements. (Closed)
Patch Set: diff plumbing 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 a85704f6f9d78973489f94032d4cdfaf13dd71cf..179ce6b7e4bb15efe41ccabfe6f9164695d4d455 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/FetchParameters.h"
#include "platform/loader/fetch/ResourceResponse.h"
@@ -102,6 +103,8 @@ class CORE_EXPORT HTMLImageElement final
int x() const;
int y() const;
+ ScriptPromise decode(ScriptState*, ExceptionState&);
+
bool complete() const;
bool HasPendingActivity() const final {
@@ -144,6 +147,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
@@ -196,6 +201,9 @@ class CORE_EXPORT HTMLImageElement final
bool IsInteractiveContent() const override;
Image* ImageContents() override;
+ void RequestDecode();
+ void DidDecode(uint32_t sequence_id, bool success);
+
void ResetFormOwner();
ImageCandidate FindBestFitImageFromPictureParent();
void SetBestFitURLAndDPRFromImageCandidate(const ImageCandidate&);
@@ -210,6 +218,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;

Powered by Google App Engine
This is Rietveld 408576698