mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-09 00:22:36 +02:00
LibWeb: Implement auto_content_box_size for textarea and input
This allows default and attribute-based sizing when an axis is auto, without overriding extrinsic sizing.
This commit is contained in:
committed by
Sam Atkins
parent
7c819460ce
commit
d3cdeb3ac5
Notes:
github-actions[bot]
2026-02-06 10:41:00 +00:00
Author: https://github.com/jonbgamble Commit: https://github.com/LadybirdBrowser/ladybird/commit/d3cdeb3ac5d Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7028 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/circl-lastname Reviewed-by: https://github.com/shannonbooth
@@ -21,6 +21,7 @@
|
||||
#include <LibWeb/HTML/HTMLTextAreaElement.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/Infra/Strings.h>
|
||||
#include <LibWeb/Layout/TextAreaBox.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
#include <LibWeb/Selection/Selection.h>
|
||||
#include <LibWeb/UIEvents/InputEvent.h>
|
||||
@@ -50,11 +51,6 @@ void HTMLTextAreaElement::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)));
|
||||
|
||||
if (style.property(CSS::PropertyID::Width).has_auto())
|
||||
style.set_property(CSS::PropertyID::Width, CSS::LengthStyleValue::create(CSS::Length(cols(), CSS::LengthUnit::Ch)));
|
||||
if (style.property(CSS::PropertyID::Height).has_auto())
|
||||
style.set_property(CSS::PropertyID::Height, CSS::LengthStyleValue::create(CSS::Length(rows(), CSS::LengthUnit::Lh)));
|
||||
}
|
||||
|
||||
void HTMLTextAreaElement::initialize(JS::Realm& realm)
|
||||
@@ -481,4 +477,9 @@ bool HTMLTextAreaElement::is_mutable() const
|
||||
return enabled() && !has_attribute(AttributeNames::readonly);
|
||||
}
|
||||
|
||||
GC::Ptr<Layout::Node> HTMLTextAreaElement::create_layout_node(GC::Ref<CSS::ComputedProperties> style)
|
||||
{
|
||||
return heap().allocate<Layout::TextAreaBox>(document(), *this, style);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user