mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Relayout video elements when setting the initial size
A while ago, we removed the relayout upon rendering a new frame. In doing so, it became possible for the layout to remain stale after the video metadata had loaded, leaving the video drawn in a 0x0 box.
This commit is contained in:
committed by
Gregory Bertilson
parent
29d9667511
commit
9494f4e8c5
Notes:
github-actions[bot]
2026-04-22 00:13:29 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/9494f4e8c5c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9004
@@ -53,6 +53,7 @@ enum class ShouldComputeRole {
|
||||
X(HTMLCanvasElementWidthOrHeightChange) \
|
||||
X(HTMLImageElementReactToChangesInTheEnvironment) \
|
||||
X(HTMLImageElementUpdateTheImageData) \
|
||||
X(HTMLVideoElementResized) \
|
||||
X(HTMLVideoElementSetVideoTrack) \
|
||||
X(KeyframeEffect) \
|
||||
X(LayoutTreeUpdate) \
|
||||
|
||||
@@ -1701,6 +1701,7 @@ void HTMLMediaElement::on_metadata_parsed()
|
||||
if (m_selected_video_track && video_element) {
|
||||
video_element->set_video_height(m_selected_video_track->track_in_playback_manager().video_data().pixel_height);
|
||||
video_element->set_video_width(m_selected_video_track->track_in_playback_manager().video_data().pixel_width);
|
||||
video_element->set_needs_layout_update(DOM::SetNeedsLayoutReason::HTMLVideoElementResized);
|
||||
|
||||
queue_a_media_element_task([this] {
|
||||
dispatch_event(DOM::Event::create(this->realm(), HTML::EventNames::resize));
|
||||
|
||||
Reference in New Issue
Block a user