1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-14 09:24:57 +00:00

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
3 changed files with 7 additions and 2 deletions

View file

@ -1 +1 @@
10,20
56,20

View file

@ -29,7 +29,6 @@ label {
input:not([type=submit], input[type=button], input[type=image], input[type=reset], input[type=color], input[type=checkbox], input[type=file], input[type=radio], input[type=range]), textarea {
border: 1px solid ButtonBorder;
min-height: 16px;
width: attr(size ch, 20ch);
cursor: text;
overflow: hidden;
}

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);
}