From 110e74b9c1c1542c92855f6a1c9491a80c19c161 Mon Sep 17 00:00:00 2001 From: Bastiaan van der Plaat Date: Thu, 7 Mar 2024 07:58:25 +0100 Subject: [PATCH] LibWeb: Move textarea cols rows attr size from css to create_layout_node --- Userland/Libraries/LibWeb/CSS/Default.css | 2 -- Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Default.css b/Userland/Libraries/LibWeb/CSS/Default.css index e10bdbfc387..7cb14010c40 100644 --- a/Userland/Libraries/LibWeb/CSS/Default.css +++ b/Userland/Libraries/LibWeb/CSS/Default.css @@ -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 { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index 3de54081b8e..4e15f7b2eb1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,11 @@ JS::GCPtr HTMLTextAreaElement::create_layout_node(NonnullRefPtrdisplay().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); }