Skip to content

Truly independent web browser

LibWeb: Allow tall fallback glyphs in single-line text inputs

sideshowbarker8d6d7c57a2b1
diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
index 78358ab4708..4550999c8d6 100644
--- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp
+++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp
@@ -917,7 +917,7 @@ static GC::Ref<CSS::CSSStyleProperties> placeholder_style_when_visible()
style->set_declarations_from_text(R"~~~(
display: block;
width: 100%;
- height: 1lh;
+ min-height: 1lh;
overflow: hidden;
text-overflow: clip;
white-space: nowrap;
@@ -1289,7 +1289,7 @@ void HTMLInputElement::create_text_input_shadow_tree()
style = CSS::CSSStyleProperties::create({}, {});
style->set_declarations_from_text(R"~~~(
width: 100%;
- height: 1lh;
+ min-height: 1lh;
overflow: auto;
scrollbar-width: none;
text-overflow: clip;
diff --git a/Tests/LibWeb/Ref/expected/text-input-tall-fallback-glyph-ref.html b/Tests/LibWeb/Ref/expected/text-input-tall-fallback-glyph-ref.html
new file mode 100644
index 00000000000..c29ad96689c
--- /dev/null
+++ b/Tests/LibWeb/Ref/expected/text-input-tall-fallback-glyph-ref.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<style>
+ @font-face { font-family: Primary; src: url("../data/fonts/Ahem.ttf"); unicode-range: U+0020, U+0061; }
+ @font-face { font-family: Tall; src: url("../data/fonts/Ahem.ttf"); size-adjust: 180%; }
+ input:not(.native), div { display: block; box-sizing: border-box; width: 200px; height: 60px; padding: 0; margin: 0;
+ border: 0; appearance: none; font: 20px/normal Primary, Tall; background: white; color: black; }
+ .native { display: block; box-sizing: border-box; width: 200px; height: 60px; font: 20px/normal Tall; }
+ input::placeholder { color: black; opacity: 1; }
+ div { align-content: center; }
+</style>
+<div>X</div><div>X</div>
+<input class="native" type="search" value="X"><input class="native" type="search" placeholder="X">
diff --git a/Tests/LibWeb/Ref/input/text-input-tall-fallback-glyph.html b/Tests/LibWeb/Ref/input/text-input-tall-fallback-glyph.html
new file mode 100644
index 00000000000..edeff4330fa
--- /dev/null
+++ b/Tests/LibWeb/Ref/input/text-input-tall-fallback-glyph.html
@@ -0,0 +1,13 @@
+<!doctype html>
+<style>
+ @font-face { font-family: Primary; src: url("../data/fonts/Ahem.ttf"); unicode-range: U+0020, U+0061; }
+ @font-face { font-family: Tall; src: url("../data/fonts/Ahem.ttf"); size-adjust: 180%; }
+ input:not(.native), div { display: block; box-sizing: border-box; width: 200px; height: 60px; padding: 0; margin: 0;
+ border: 0; appearance: none; font: 20px/normal Primary, Tall; background: white; color: black; }
+ .native { display: block; box-sizing: border-box; width: 200px; height: 60px; font: 20px/normal Primary, Tall; }
+ input::placeholder { color: black; opacity: 1; }
+ div { align-content: center; }
+</style>
+<link rel="match" href="../expected/text-input-tall-fallback-glyph-ref.html">
+<input value="X"><input placeholder="X">
+<input class="native" type="search" value="X"><input class="native" type="search" placeholder="X">
diff --git a/Tests/LibWeb/Text/input/css/element-reference-pseudo-inline-style-computed-values.html b/Tests/LibWeb/Text/input/css/element-reference-pseudo-inline-style-computed-values.html
index 71608e5b811..43a7cbaab7f 100644
--- a/Tests/LibWeb/Text/input/css/element-reference-pseudo-inline-style-computed-values.html
+++ b/Tests/LibWeb/Text/input/css/element-reference-pseudo-inline-style-computed-values.html
@@ -13,6 +13,6 @@
input.setAttribute("placeholder", "updated");
- println(placeholder.computedStyleMap().get("height").toString());
+ println(placeholder.computedStyleMap().get("min-height").toString());
});
</script>