LibWeb: Reset line-height for select elements

This commit is contained in:
Tim Ledbetter 2026-02-04 10:30:53 +00:00 committed by Jelle Raaijmakers
parent 8975fd7d06
commit d41f77be64
Notes: github-actions[bot] 2026-02-06 10:33:25 +00:00
3 changed files with 18 additions and 0 deletions

View file

@ -11,6 +11,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/ComputedProperties.h>
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
#include <LibWeb/CSS/StyleValues/KeywordStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/Event.h>
@ -85,6 +86,9 @@ void HTMLSelectElement::adjust_computed_style(CSS::ComputedProperties& style)
// This is required for the internal shadow tree to work correctly in layout.
if (style.display().is_inline_outside() && style.display().is_flow_inside())
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::InlineBlock)));
// AD-HOC: Enforce normal line-height for select elements. This matches the behavior of other engines.
style.set_property(CSS::PropertyID::LineHeight, CSS::KeywordStyleValue::create(CSS::Keyword::Normal));
}
// https://html.spec.whatwg.org/multipage/form-elements.html#concept-select-size