mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
LibWeb: Allow font-size: 0
Zero is a valid font-size value, and should result in no text being visible. We now match the behavior of other engines.
This commit is contained in:
parent
6a32634440
commit
e013306df8
3 changed files with 20 additions and 2 deletions
14
Tests/LibWeb/Layout/expected/font-size-zero.txt
Normal file
14
Tests/LibWeb/Layout/expected/font-size-zero.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x16 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
|
||||
BlockContainer <div> at (8,8) content-size 784x0 children: inline
|
||||
line 0 width: 0, height: 0, bottom: 0, baseline: 0
|
||||
frag 0 from TextNode start: 0, length: 21, rect: [8,8 0x0]
|
||||
"should not be visible"
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x16]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x0]
|
||||
PaintableWithLines (BlockContainer<DIV>) [8,8 784x0]
|
||||
TextPaintable (TextNode<#text>)
|
5
Tests/LibWeb/Layout/input/font-size-zero.html
Normal file
5
Tests/LibWeb/Layout/input/font-size-zero.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
<!doctype html><style>
|
||||
div {
|
||||
font-size: 0px;
|
||||
}
|
||||
</style><div>should not be visible
|
|
@ -2223,7 +2223,6 @@ RefPtr<Gfx::Font const> StyleComputer::compute_font_for_style_values(DOM::Elemen
|
|||
}
|
||||
if (maybe_length.has_value()) {
|
||||
auto px = maybe_length.value().to_px(length_resolution_context).to_int();
|
||||
if (px != 0)
|
||||
font_size_in_px = px;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue