New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement HTMLImageElement decode #31269
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
🔨 Triggering try run (#8093180833) for Linux WPT layout-2020 |
Test results for linux-wpt-layout-2020 from try job (#8093180833): Flaky unexpected result (16)
Stable unexpected results that are known to be intermittent (18)
Stable unexpected results (7)
|
|
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
🛠 These changes could not be applied onto the latest upstream WPT. Servo's copy of the Web Platform Tests may be out of sync. |
Signed-off-by: Bentaimia Haddadi <haddadi.taym@gmail.com>
@Taym95 Do you mind taking a look at the failing tests? It seems that this change introduces some failure and timeouts. |
I pushed another commit after last |
🔨 Triggering try run (#8111488522) for Linux WPT |
Test results for linux-wpt-layout-2020 from try job (#8111488522): Flaky unexpected result (18)
Stable unexpected results that are known to be intermittent (15)
Stable unexpected results (4)
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great start! Some pointers for the next step. Note that this is actually simpler than what I wrote in the initial issue...
@@ -913,6 +917,53 @@ impl HTMLImageElement { | |||
} | |||
} | |||
|
|||
/// Step 2-2.2 of <https://html.spec.whatwg.org/multipage/#dom-img-decode> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this "The microtask part of decode(). With the link on the second line.
}; | ||
|
||
// Step 2.2 | ||
if document.is_fully_active() || !available { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say let's follow the spec more closely, and first return the error if not fully active or not available.
ref elem, | ||
ref promise, | ||
} => { | ||
elem.decode_image_data_sync(promise); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, here we need to break this into two parts:
- Step 2.1, which run immediately in the microtask.
- Step 2.2, which runs "in parallel".
For 2, we need to integrate with the extisting async worflow with the image cache that is setup within react_to_environment_changes_sync_steps
and which continues here.
I think this is best done by simply adding some state to the image element, so that a pending decoding can be noted and later continued. See for inspiration what is done with pending_request
.
This is actually simpler than I thought, because you don't need to do anything special with the image cache: just keep the decode promise, and then inside process_image_response_for_environment_change
, do the steps in 2.2(except the actual decoding, which happens in the image cache).
@Taym95 Any updates on this one? Is there some way that I can help you get this ready for review again? |
Sorry, @mrobinson, I was busy in previous weeks. I will continue working on this this week. |
./mach build -d
does not report any errors./mach test-tidy
does not report any errors