Commit 58687e07 authored by Alex Clarke's avatar Alex Clarke Committed by Commit Bot

Fix video-poster-load-after-playing.html for scheduler change

We want to prioritize loading and compositing tasks until first
contentful paint. This breaks video-poster-load-after-playing.html
because that (introduces?) a race between
blink::HTMLVideoElement::SetDisplayMode which sets displaymode kPoster
and blink::LayoutVideo::ImageChanged() posted on frame_loading_tq
which only caches the image size if the display mode is kPoster.  When
loading tasks are prioritized this doesn't happen causing the image to
get stretched.

This patch changes the code to additionally cache the image size if
it's not set, which fixes the problem with the test with the new
scheduler policy.

Bug: 971191
Change-Id: Ic72d310c99d747258e7523fc069758538b35a337
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1787602
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: default avatarPhilip Rogers <pdr@chromium.org>
Reviewed-by: default avatarAlexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#695105}
parent 0b9d44a4
......@@ -110,9 +110,10 @@ void LayoutVideo::ImageChanged(WrappedImagePtr new_image,
// Cache the image intrinsic size so we can continue to use it to draw the
// image correctly even if we know the video intrinsic size but aren't able to
// draw video frames yet (we don't want to scale the poster to the video size
// without keeping aspect ratio).
if (VideoElement()->ShouldDisplayPosterImage())
cached_image_size_ = IntrinsicSize();
// without keeping aspect ratio). We do not need to check
// |ShouldDisplayPosterImage| because the image can be ready before we find
// out we actually need it.
cached_image_size_ = IntrinsicSize();
// The intrinsic size is now that of the image, but in case we already had the
// intrinsic size of the video we call this here to restore the video size.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment