ladybird/Tests/LibWeb/Layout/expected/input-placeholder-with-text-align.txt
Andreas Kling d17f666a8c LibWeb: Better CSS inheritance for nodes that represent a pseudo-element
When we compute style for elements inside a UA-internal shadow tree that
represent a pseudo-element (e.g ::placeholder), we actually run the
StyleComputer machinery for (host element :: pseudo-element).

While that lets us match the correct selectors, it was incorrectly
applying CSS inheritance, since we'd also then inherit from whatever was
above the host element in the tree.

This patch fixes the issue by introducing an inheritance override in
AbstractElement and then using that to force inheritance from whatever
is actually directly above in the DOM for these elements instead of
jumping all the way up past the host.

This fixes an issue where `text-align: center` on input type=text
elements would render the main text centered but placeholder text was
still left-aligned.
2025-10-21 16:42:00 +02:00

27 lines
1.8 KiB
Text

Viewport <#document> at [0,0] [0+0+0 800 0+0+0] [0+0+0 600 0+0+0] children: not-inline
BlockContainer <html> at [0,0] [0+0+0 800 0+0+0] [0+0+0 118 0+0+0] [BFC] children: not-inline
BlockContainer <body> at [8,8] [8+0+0 784 0+0+8] [8+0+0 102 0+0+8] children: inline
frag 0 from BlockContainer start: 0, length: 0, rect: [9,9 400x100] baseline: 55.796875
BlockContainer <input> at [9,9] inline-block [0+1+0 400 0+1+0] [0+1+0 100 0+1+0] [BFC] children: not-inline
Box <div> at [11,10] flex-container(row) [0+0+2 396 2+0+0] [0+0+1 100 1+0+0] [FFC] children: not-inline
BlockContainer <div> at [11,51] flex-item [0+0+0 0 0+0+0] [0+0+0 18 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 0, rect: [11,51 0x18] baseline: 13.796875
TextNode <#text> (not painted)
BlockContainer <div> at [11,51] flex-item [0+0+0 396 0+0+0] [0+0+0 18 0+0+0] [BFC] children: inline
frag 0 from TextNode start: 0, length: 3, rect: [195.140625,51 27.703125x18] baseline: 13.796875
"abc"
TextNode <#text> (not painted)
TextNode <#text> (not painted)
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x118]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x102]
PaintableWithLines (BlockContainer<INPUT>) [8,8 402x102] overflow: [9,9 400x102]
PaintableBox (Box<DIV>) [9,9 400x102]
PaintableWithLines (BlockContainer<DIV>) [11,51 0x18]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<DIV>) [11,51 396x18]
TextPaintable (TextNode<#text>)
SC for Viewport<#document> [0,0 800x600] [children: 1] (z-index: auto)
SC for BlockContainer<HTML> [0,0 800x118] [children: 0] (z-index: auto)