From 9df71afdb3e751b853b6b36ef15f776bb78e964b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 4 May 2020 22:43:00 +0200 Subject: LibWeb: Respect the attribute a bit more :^) We now use the size attribute to determine the width of a text input. --- Libraries/LibWeb/DOM/HTMLInputElement.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Libraries/LibWeb/DOM') diff --git a/Libraries/LibWeb/DOM/HTMLInputElement.cpp b/Libraries/LibWeb/DOM/HTMLInputElement.cpp index 34be76773f..66e58b036e 100644 --- a/Libraries/LibWeb/DOM/HTMLInputElement.cpp +++ b/Libraries/LibWeb/DOM/HTMLInputElement.cpp @@ -75,6 +75,13 @@ RefPtr HTMLInputElement::create_layout_node(const StyleProperties*) const_cast(this)->set_attribute("value", static_cast(widget).text()); }; int text_width = Gfx::Font::default_font().width(value()); + auto size_value = attribute("size"); + if (!size_value.is_null()) { + bool ok; + auto size = size_value.to_int(ok); + if (ok && size >= 0) + text_width = Gfx::Font::default_font().glyph_width('x') * size; + } text_box.set_relative_rect(0, 0, text_width + 20, 20); widget = text_box; } -- cgit v1.2.3