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.
This commit is contained in:
Andreas Kling 2025-10-20 08:27:12 +02:00 committed by Andreas Kling
parent e8a9d23f92
commit 9e064bd3ff
Notes: github-actions[bot] 2025-10-21 14:43:23 +00:00
4 changed files with 12 additions and 9 deletions

View file

@ -802,7 +802,6 @@ static GC::Ref<CSS::CSSStyleProperties> placeholder_style_when_visible()
align-items: center; align-items: center;
text-overflow: clip; text-overflow: clip;
white-space: nowrap; white-space: nowrap;
display: inline;
)~~~"sv); )~~~"sv);
} }
return *style; return *style;

View file

@ -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 frag 0 from TextNode start: 0, length: 0, rect: [11,10 0x18] baseline: 13.796875
TextNode <#text> (not painted) 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 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 <div> 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 <div> 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 frag 0 from TextNode start: 0, length: 5, rect: [11,10 36.84375x18] baseline: 13.796875
"hello" "hello"
TextNode <#text> (not painted) TextNode <#text> (not painted)
@ -64,7 +65,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<DIV>) [11,10 0x18] PaintableWithLines (BlockContainer<DIV>) [11,10 0x18]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [11,10 36.84375x18] PaintableWithLines (BlockContainer(anonymous)) [11,10 36.84375x18]
PaintableWithLines (InlineNode<DIV>) [11,10 36.84375x18] PaintableWithLines (BlockContainer<DIV>) [11,10 36.84375x18]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TEXTAREA>) [218,8 166x36] PaintableWithLines (BlockContainer<TEXTAREA>) [218,8 166x36]

View file

@ -10,7 +10,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 0x80] baseline: 44.796875 frag 0 from TextNode start: 0, length: 0, rect: [11,10 0x80] baseline: 44.796875
TextNode <#text> (not painted) TextNode <#text> (not painted)
BlockContainer <(anonymous)> at [11,10] flex-item [0+0+0 89.90625 0+0+0] [0+0+0 80 0+0+0] [BFC] children: inline BlockContainer <(anonymous)> at [11,10] flex-item [0+0+0 89.90625 0+0+0] [0+0+0 80 0+0+0] [BFC] children: inline
InlineNode <div> at [11,10] [0+0+0 89.90625 0+0+0] [0+0+0 80 0+0+0] frag 0 from BlockContainer start: 0, length: 0, rect: [11,10 89.90625x80] baseline: 44.796875
BlockContainer <div> at [11,10] inline-block [0+0+0 89.90625 0+0+0] [0+0+0 80 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 11, rect: [11,10 89.90625x80] baseline: 44.796875 frag 0 from TextNode start: 0, length: 11, rect: [11,10 89.90625x80] baseline: 44.796875
"placeholder" "placeholder"
TextNode <#text> (not painted) TextNode <#text> (not painted)
@ -24,7 +25,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<DIV>) [11,10 0x80] PaintableWithLines (BlockContainer<DIV>) [11,10 0x80]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [11,10 89.90625x80] PaintableWithLines (BlockContainer(anonymous)) [11,10 89.90625x80]
PaintableWithLines (InlineNode<DIV>) [11,10 89.90625x80] PaintableWithLines (BlockContainer<DIV>) [11,10 89.90625x80]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)

View file

@ -22,7 +22,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: [223,10 0x23] baseline: 17.5 frag 0 from TextNode start: 0, length: 0, rect: [223,10 0x23] baseline: 17.5
TextNode <#text> (not painted) TextNode <#text> (not painted)
BlockContainer <(anonymous)> at [223,10] flex-item [0+0+0 344.546875 0+0+0] [0+0+0 23 0+0+0] [BFC] children: inline BlockContainer <(anonymous)> at [223,10] flex-item [0+0+0 344.546875 0+0+0] [0+0+0 23 0+0+0] [BFC] children: inline
InlineNode <div> at [223,10] [0+0+0 344.546875 0+0+0] [0+0+0 23 0+0+0] frag 0 from BlockContainer start: 0, length: 0, rect: [223,10 344.546875x23] baseline: 17.5
BlockContainer <div> at [223,10] inline-block [0+0+0 344.546875 0+0+0] [0+0+0 23 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 34, rect: [223,10 344.546875x23] baseline: 17.5 frag 0 from TextNode start: 0, length: 34, rect: [223,10 344.546875x23] baseline: 17.5
"This placeholder should be visible" "This placeholder should be visible"
TextNode <#text> (not painted) TextNode <#text> (not painted)
@ -40,7 +41,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,37 0x23] baseline: 17.5 frag 0 from TextNode start: 0, length: 0, rect: [11,37 0x23] baseline: 17.5
TextNode <#text> (not painted) TextNode <#text> (not painted)
BlockContainer <(anonymous)> at [11,37] flex-item [0+0+0 396.171875 0+0+0] [0+0+0 23 0+0+0] [BFC] children: inline BlockContainer <(anonymous)> at [11,37] flex-item [0+0+0 396.171875 0+0+0] [0+0+0 23 0+0+0] [BFC] children: inline
InlineNode <div> at [11,37] [0+0+0 396.171875 0+0+0] [0+0+0 23 0+0+0] frag 0 from BlockContainer start: 0, length: 0, rect: [11,37 396.171875x23] baseline: 17.5
BlockContainer <div> at [11,37] inline-block [0+0+0 396.171875 0+0+0] [0+0+0 23 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 39, rect: [11,37 396.171875x23] baseline: 17.5 frag 0 from TextNode start: 0, length: 39, rect: [11,37 396.171875x23] baseline: 17.5
"This placeholder should also be visible" "This placeholder should also be visible"
TextNode <#text> (not painted) TextNode <#text> (not painted)
@ -60,7 +62,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<DIV>) [223,10 0x23] PaintableWithLines (BlockContainer<DIV>) [223,10 0x23]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [223,10 344.546875x23] PaintableWithLines (BlockContainer(anonymous)) [223,10 344.546875x23]
PaintableWithLines (InlineNode<DIV>) [223,10 344.546875x23] PaintableWithLines (BlockContainer<DIV>) [223,10 344.546875x23]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<INPUT>) [432,8 202x27] PaintableWithLines (BlockContainer<INPUT>) [432,8 202x27]
@ -72,7 +74,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<DIV>) [11,37 0x23] PaintableWithLines (BlockContainer<DIV>) [11,37 0x23]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer(anonymous)) [11,37 396.171875x23] PaintableWithLines (BlockContainer(anonymous)) [11,37 396.171875x23]
PaintableWithLines (InlineNode<DIV>) [11,37 396.171875x23] PaintableWithLines (BlockContainer<DIV>) [11,37 396.171875x23]
TextPaintable (TextNode<#text>) TextPaintable (TextNode<#text>)
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto) SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)