From 9e064bd3ff54b91fbdc5d80f09fc4787f4f8faa7 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 20 Oct 2025 08:27:12 +0200 Subject: [PATCH] LibWeb: Make input type=text placeholder render as a block-level element This will make the width: 100% we already apply actually do something useful to the placeholders. --- Libraries/LibWeb/HTML/HTMLInputElement.cpp | 1 - .../Layout/expected/empty-editable-shows-cursor.txt | 5 +++-- .../expected/input-placeholder-with-line-height.txt | 5 +++-- Tests/LibWeb/Layout/expected/input-placeholder.txt | 10 ++++++---- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 990aab8c878..fc747e13522 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -802,7 +802,6 @@ static GC::Ref placeholder_style_when_visible() align-items: center; text-overflow: clip; white-space: nowrap; - display: inline; )~~~"sv); } return *style; diff --git a/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt b/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt index 4314a45f942..042f2ce1d02 100644 --- a/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt +++ b/Tests/LibWeb/Layout/expected/empty-editable-shows-cursor.txt @@ -24,7 +24,8 @@ Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] children: not- frag 0 from TextNode start: 0, length: 0, rect: [11,10 0x18] baseline: 13.796875 TextNode <#text> (not painted) BlockContainer <(anonymous)> at [11,10] flex-item [0+0+0 36.84375 0+0+0] [0+0+0 18 0+0+0] [BFC] children: inline - InlineNode
at [11,10] [0+0+0 36.84375 0+0+0] [0+0+0 18 0+0+0] + frag 0 from BlockContainer start: 0, length: 0, rect: [11,10 36.84375x18] baseline: 13.796875 + BlockContainer
at [11,10] inline-block [0+0+0 36.84375 0+0+0] [0+0+0 18 0+0+0] [BFC] children: inline frag 0 from TextNode start: 0, length: 5, rect: [11,10 36.84375x18] baseline: 13.796875 "hello" TextNode <#text> (not painted) @@ -64,7 +65,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer
) [11,10 0x18] TextPaintable (TextNode<#text>) PaintableWithLines (BlockContainer(anonymous)) [11,10 36.84375x18] - PaintableWithLines (InlineNode
) [11,10 36.84375x18] + PaintableWithLines (BlockContainer
) [11,10 36.84375x18] TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>) PaintableWithLines (BlockContainer