LibWeb: Move input size attr width from css to create_layout_node

This commit is contained in:
Bastiaan van der Plaat 2024-03-07 07:57:57 +01:00 committed by Sam Atkins
parent 749dcac196
commit 7e76358a99
Notes: sideshowbarker 2024-07-17 09:41:18 +09:00
3 changed files with 7 additions and 2 deletions

View file

@ -12,6 +12,7 @@
#include <LibJS/Runtime/NativeFunction.h>
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
#include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h>
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/Event.h>
@ -101,6 +102,11 @@ JS::GCPtr<Layout::Node> HTMLInputElement::create_layout_node(NonnullRefPtr<CSS::
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)));
if (type_state() != TypeAttributeState::FileUpload) {
if (style->property(CSS::PropertyID::Width)->has_auto())
style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length(size(), CSS::Length::Type::Ch)));
}
return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
}