LibWeb: Rewrite audio elements without controls to display:none

This is part of the rendering spec, but we had neglected to do this
before. It causes one WPT check to fail, but other browsers get the
same result on that check, so I guess we can call that a win. :^)
This commit is contained in:
Zaggy1024
2026-02-20 23:04:33 -06:00
committed by Alexander Kalenik
parent 7bc9824578
commit bc60768cb0
Notes: github-actions[bot] 2026-02-23 06:29:01 +00:00
4 changed files with 19 additions and 14 deletions

View File

@@ -28,6 +28,15 @@ void HTMLAudioElement::initialize(JS::Realm& realm)
Base::initialize(realm);
}
void HTMLAudioElement::adjust_computed_style(CSS::ComputedProperties& style)
{
Base::adjust_computed_style(style);
// https://html.spec.whatwg.org/multipage/rendering.html#embedded-content-rendering-rules
if (!has_attribute(AttributeNames::controls))
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)));
}
GC::Ptr<Layout::Node> HTMLAudioElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
{
return heap().allocate<Layout::AudioBox>(document(), *this, style);