Skip to content

layout: Pass poster_url for LargestContentfulPaint Entry - #43376

Merged
TimvdLippe merged 3 commits into
servo:mainfrom
shubhamg13:poster_url
Aug 5, 2026
Merged

TimvdLippe merged 3 commits into
servo:mainfrom
shubhamg13:poster_url

Conversation

@shubhamg13

@shubhamg13 shubhamg13 commented Mar 18, 2026 •

Copy link
Copy Markdown
Member

Fetches the poster_url from HTMLVideoElement and pass it for LargestContentfulPaint

Testing: More WPT Passed
Fixes: Part of #42000

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Mar 18, 2026
@shubhamg13
shubhamg13 marked this pull request as draft March 18, 2026 03:33
@shubhamg13
shubhamg13 marked this pull request as ready for review July 31, 2026 09:05
@shubhamg13
shubhamg13 marked this pull request as draft July 31, 2026 09:09
@shubhamg13
shubhamg13 requested a review from mrobinson July 31, 2026 09:15
@shubhamg13
shubhamg13 marked this pull request as ready for review July 31, 2026 09:17
@shubhamg13
shubhamg13 requested a review from jdm July 31, 2026 09:19
@shubhamg13
shubhamg13 marked this pull request as draft August 1, 2026 07:52
@shubhamg13
shubhamg13 marked this pull request as ready for review August 2, 2026 03:24
self.downcast::<HTMLVideoElement>()
.expect("not a video!")
.poster_url()
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of this method, we can add the poster URL to HTMLMediaData.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aye Aye! Added to HTMLMediaData

Comment thread components/layout/dom.rs Outdated
Some((
VideoInfo {
image_key: data.current_frame.map(|frame| frame.image_key),
poster_url: self.poster_url(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be data.poster_url instead.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha!

},
};

*self.poster_url.borrow_mut() = Some(poster_url.url());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to clear this value at the start of this method in case we take an early return. Clearing the poster URL attribute should also clear this cached value.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified few more things to follow spec keywords. Please let me know what do you think of it.

@servo-highfive servo-highfive added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Aug 4, 2026
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Aug 5, 2026
@servo-highfive servo-highfive added S-needs-rebase There are merge conflict errors. and removed S-needs-rebase There are merge conflict errors. labels Aug 5, 2026
@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Aug 5, 2026
@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Aug 5, 2026
@shubhamg13
shubhamg13 marked this pull request as draft August 5, 2026 02:56
Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
@shubhamg13
shubhamg13 marked this pull request as ready for review August 5, 2026 03:56
{
Ok(url) => url,
Err(_) => {
let poster_url = {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good progress! My final suggestion here looks like this:

*self.poster_url.safe_borrow_mut(cx.no_gc()) = None;
let Some(url) = ... else { .. };

let Ok(poster_url) = match self.owner_document().encoding_parse...() else {
    self.htmlmediaelement.set_poster_frame(..);
    return;
};
*self.poster_url.safe_borrow_mut(cx.no_gc()) = Some(poster_url.clone());

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Integrated your suggestion, Please take a look

@shubhamg13
shubhamg13 marked this pull request as draft August 5, 2026 04:23
Signed-off-by: Shubham Gupta <shubhamg13.work@gmail.com>
@shubhamg13
shubhamg13 marked this pull request as ready for review August 5, 2026 05:42

@jdm jdm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thanks for taking the time to clean it up!

@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Aug 5, 2026
@jdm
jdm dismissed mrobinson’s stale review August 5, 2026 06:14

Addressed.

@jdm
jdm added this pull request to the merge queue Aug 5, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 5, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 5, 2026
@servo-highfive servo-highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Aug 5, 2026
@shubhamg13

Copy link
Copy Markdown
Member Author

Whaaaaat!

I think it TIMEDOUT. Re-try Please

@TimvdLippe
TimvdLippe added this pull request to the merge queue Aug 5, 2026
@servo-highfive servo-highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-tests-failed The changes caused existing tests to fail. labels Aug 5, 2026
Merged via the queue into servo:main with commit dce660c Aug 5, 2026
39 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Aug 5, 2026
@shubhamg13
shubhamg13 deleted the poster_url branch August 5, 2026 22:27
RichardTjokroutomo pushed a commit to RichardTjokroutomo/servo that referenced this pull request Oct 6, 2026
…3376)

Fetches the `poster_url` from `HTMLVideoElement` and pass it for
`LargestContentfulPaint`

Testing: More WPT Passed
Fixes: Part of servo#42000

---------

Signed-off-by: Shubham Gupta <shubham.gupta@chromium.org>
Signed-off-by: Shubham Gupta <shubhamg13.work@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants