LibWeb: Move textarea cols rows attr size from css to create_layout_node

This commit is contained in:
Bastiaan van der Plaat 2024-03-07 07:58:25 +01:00 committed by Sam Atkins
parent 7e76358a99
commit 110e74b9c1
2 changed files with 6 additions and 2 deletions

View file

@ -38,8 +38,6 @@ textarea {
display: inline-block;
overflow: auto;
font-family: monospace;
width: attr(cols ch, 20ch);
height: attr(rows lh, 2lh);
}
input::placeholder, textarea::placeholder {

View file

@ -9,6 +9,7 @@
#include <LibWeb/Bindings/Intrinsics.h>
#include <LibWeb/CSS/StyleProperties.h>
#include <LibWeb/CSS/StyleValues/DisplayStyleValue.h>
#include <LibWeb/CSS/StyleValues/LengthStyleValue.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/ElementFactory.h>
#include <LibWeb/DOM/Event.h>
@ -37,6 +38,11 @@ JS::GCPtr<Layout::Node> HTMLTextAreaElement::create_layout_node(NonnullRefPtr<CS
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 (style->property(CSS::PropertyID::Width)->has_auto())
style->set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length(cols(), CSS::Length::Type::Ch)));
if (style->property(CSS::PropertyID::Height)->has_auto())
style->set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length(rows(), CSS::Length::Type::Lh)));
return Element::create_layout_node_for_display_type(document(), style->display(), style, this);
}