mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
LibWeb: Move video/audio adjust_computed_style to HTMLMediaElement
These are the same code, so we may as well move them up the chain. This becomes useful in a later commit, where it will be used to rewrite inline-flow to inline-block for layout of shadow DOM.
This commit is contained in:
committed by
Alexander Kalenik
parent
5a615009ff
commit
ab0a358a98
Notes:
github-actions[bot]
2026-02-23 06:29:22 +00:00
Author: https://github.com/Zaggy1024 Commit: https://github.com/LadybirdBrowser/ladybird/commit/ab0a358a986 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8056 Reviewed-by: https://github.com/kalenikaliaksandr ✅ Reviewed-by: https://github.com/konradekk
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2020, the SerenityOS developers.
|
||||
* Copyright (c) 2023-2024, Tim Flynn <trflynn89@serenityos.org>
|
||||
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
|
||||
* Copyright (c) 2025-2026, Gregory Bertilson <gregory@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
@@ -13,6 +13,8 @@
|
||||
#include <LibMedia/Track.h>
|
||||
#include <LibWeb/Bindings/HTMLMediaElementPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/CSS/ComputedProperties.h>
|
||||
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/DocumentObserver.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
@@ -89,6 +91,13 @@ void HTMLMediaElement::finalize()
|
||||
document().page().unregister_media_element({}, unique_id());
|
||||
}
|
||||
|
||||
void HTMLMediaElement::adjust_computed_style(CSS::ComputedProperties& style)
|
||||
{
|
||||
// https://drafts.csswg.org/css-display-3/#unbox
|
||||
if (style.display().is_contents())
|
||||
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)));
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/media.html#queue-a-media-element-task
|
||||
void HTMLMediaElement::queue_a_media_element_task(Function<void()> steps)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user