summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML
diff options
context:
space:
mode:
authorSimon Wanner <simon+git@skyrising.xyz>2023-03-18 17:54:06 +0100
committerAndreas Kling <kling@serenityos.org>2023-03-18 20:14:52 +0100
commita13c21c80761127cd5913a766dc8d55f4c04ad0e (patch)
tree038088197ba9570c0c73925a1dbc14708073f929 /Userland/Libraries/LibWeb/HTML
parenta5a3913e39b7a4272feb3a01fef0ea41cf5202e3 (diff)
downloadserenity-a13c21c80761127cd5913a766dc8d55f4c04ad0e.zip
LibWeb: Specify height as 1lh to fix the size of empty text boxes
Previously, empty text boxes would fall back to the min-height: 16px set on the <input> element. As soon as there is any content they would usually gain height because the line height of that text is more than 16px (depending on the font/font-size used). Now they use height: 1lh for the inner div (which contains the actual text), which matches the exact height of 1 line of content.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
-rw-r--r--Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 3b2ba90978..a23519abe8 100644
--- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -394,7 +394,7 @@ void HTMLInputElement::create_shadow_tree_if_needed()
if (initial_value.is_null())
initial_value = DeprecatedString::empty();
auto element = document().create_element(HTML::TagNames::div).release_value();
- MUST(element->set_attribute(HTML::AttributeNames::style, "white-space: pre; padding-top: 1px; padding-bottom: 1px; padding-left: 2px; padding-right: 2px"));
+ MUST(element->set_attribute(HTML::AttributeNames::style, "white-space: pre; padding-top: 1px; padding-bottom: 1px; padding-left: 2px; padding-right: 2px; height: 1lh;"));
m_text_node = heap().allocate<DOM::Text>(realm(), document(), initial_value).release_allocated_value_but_fixme_should_propagate_errors();
m_text_node->set_always_editable(m_type != TypeAttributeState::FileUpload);
m_text_node->set_owner_input_element({}, *this);