LibWeb: Add a button to the built-in media player to toggle fullscreen

This commit is contained in:
Timothy Flynn
2026-02-27 18:15:06 -05:00
committed by Gregory Bertilson
parent 2282636f98
commit 24aacfea48
Notes: github-actions[bot] 2026-03-01 21:42:56 +00:00
5 changed files with 89 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
/*
* Copyright (c) 2020, the SerenityOS developers.
* Copyright (c) 2023-2024, Tim Flynn <trflynn89@serenityos.org>
* Copyright (c) 2023-2026, Tim Flynn <trflynn89@ladybird.org>
* Copyright (c) 2025-2026, Gregory Bertilson <gregory@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
@@ -476,6 +476,16 @@ void HTMLMediaElement::set_muted(bool muted)
set_needs_style_update(true);
}
void HTMLMediaElement::toggle_fullscreen()
{
auto& document = this->document();
if (document.fullscreen_element() == this)
document.exit_fullscreen();
else
request_fullscreen();
}
// https://html.spec.whatwg.org/multipage/media.html#user-interface:dom-media-volume-3
void HTMLMediaElement::volume_or_muted_attribute_changed()
{