mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:17:47 +00:00
LibWeb: Add Length::resolved()
overload for CSSPixels
Since we always pass the px value as an argument to resolved(), we can pass it directly as CSSPixels instead of wrapping it in Length. This approach allows us to avoid converting to a double, resulting in fewer precision issues.
This commit is contained in:
parent
5eb0f65cc0
commit
0fb571c1c2
14 changed files with 154 additions and 75 deletions
|
@ -7,7 +7,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
TextNode <#text>
|
||||
BlockContainer <dl> at (25,25) content-size 470x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <dt> at (40,40) content-size 50x280 floating [BFC] children: inline
|
||||
BlockContainer <dt> at (40,40) content-size 49.984375x280 floating [BFC] children: inline
|
||||
line 0 width: 28.3125, height: 10, bottom: 10, baseline: 8
|
||||
frag 0 from TextNode start: 0, length: 6, rect: [40,40 28.3125x10]
|
||||
"toggle"
|
||||
|
@ -24,21 +24,21 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
"the way"
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
BlockContainer <li#bar> at (235,55) content-size 139.984375x90 floating [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (235,55) content-size 139.984375x0 children: inline
|
||||
BlockContainer <li#bar> at (235,55) content-size 139.96875x90 floating [BFC] children: not-inline
|
||||
BlockContainer <(anonymous)> at (235,55) content-size 139.96875x0 children: inline
|
||||
TextNode <#text>
|
||||
BlockContainer <p> at (235,55) content-size 139.984375x10 children: inline
|
||||
BlockContainer <p> at (235,55) content-size 139.96875x10 children: inline
|
||||
line 0 width: 74.3125, height: 10, bottom: 10, baseline: 8
|
||||
frag 0 from TextNode start: 0, length: 14, rect: [235,55 74.3125x10]
|
||||
"the world ends"
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (235,65) content-size 139.984375x0 children: inline
|
||||
BlockContainer <(anonymous)> at (235,65) content-size 139.96875x0 children: inline
|
||||
TextNode <#text>
|
||||
InlineNode <form>
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
BlockContainer <p> at (235,65) content-size 139.984375x19 children: inline
|
||||
BlockContainer <p> at (235,65) content-size 139.96875x19 children: inline
|
||||
line 0 width: 39.484375, height: 19, bottom: 19, baseline: 12.5
|
||||
frag 0 from TextNode start: 1, length: 5, rect: [235,65 27.484375x19]
|
||||
"bang "
|
||||
|
@ -46,7 +46,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
TextNode <#text>
|
||||
RadioButton <input> at (262,65) content-size 12x12 inline-block children: not-inline
|
||||
TextNode <#text>
|
||||
BlockContainer <p> at (235,84) content-size 139.984375x19 children: inline
|
||||
BlockContainer <p> at (235,84) content-size 139.96875x19 children: inline
|
||||
line 0 width: 57.15625, height: 19, bottom: 19, baseline: 12.5
|
||||
frag 0 from TextNode start: 1, length: 8, rect: [235,84 45.15625x19]
|
||||
"whimper "
|
||||
|
@ -54,15 +54,15 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
|||
TextNode <#text>
|
||||
RadioButton <input> at (280,84) content-size 12x12 inline-block children: not-inline
|
||||
TextNode <#text>
|
||||
BlockContainer <(anonymous)> at (235,103) content-size 139.984375x0 children: inline
|
||||
BlockContainer <(anonymous)> at (235,103) content-size 139.96875x0 children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
BlockContainer <li> at (409.984375,60) content-size 50x90 floating [BFC] children: inline
|
||||
BlockContainer <li> at (409.96875,60) content-size 50x90 floating [BFC] children: inline
|
||||
line 0 width: 31.578125, height: 10, bottom: 10, baseline: 8
|
||||
frag 0 from TextNode start: 0, length: 6, rect: [409.984375,60 31.578125x10]
|
||||
frag 0 from TextNode start: 0, length: 6, rect: [409.96875,60 31.578125x10]
|
||||
"i grow"
|
||||
line 1 width: 14.03125, height: 10, bottom: 20, baseline: 8
|
||||
frag 0 from TextNode start: 7, length: 3, rect: [409.984375,70 14.03125x10]
|
||||
frag 0 from TextNode start: 7, length: 3, rect: [409.96875,70 14.03125x10]
|
||||
"old"
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
@ -140,27 +140,27 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
|||
PaintableWithLines (BlockContainer<BODY>) [15,15 490x390]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [20,20 480x0]
|
||||
PaintableWithLines (BlockContainer<DL>) [20,20 480x10]
|
||||
PaintableWithLines (BlockContainer<DT>) [25,25 80x310]
|
||||
PaintableWithLines (BlockContainer<DT>) [25,25 79.984375x310]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer<DD>) [115,25 380x310]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [135,45 340x0]
|
||||
PaintableWithLines (BlockContainer<UL>) [135,45 340x0]
|
||||
PaintableWithLines (BlockContainer<LI>) [135,45 80x120]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer<LI>#bar) [225,45 159.984375x110]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [235,55 139.984375x0]
|
||||
PaintableWithLines (BlockContainer<P>) [235,55 139.984375x10]
|
||||
PaintableWithLines (BlockContainer<LI>#bar) [225,45 159.96875x110]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [235,55 139.96875x0]
|
||||
PaintableWithLines (BlockContainer<P>) [235,55 139.96875x10]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer(anonymous)) [235,65 139.984375x0]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [235,65 139.96875x0]
|
||||
InlinePaintable (InlineNode<FORM>)
|
||||
PaintableWithLines (BlockContainer<P>) [235,65 139.984375x19]
|
||||
PaintableWithLines (BlockContainer<P>) [235,65 139.96875x19]
|
||||
TextPaintable (TextNode<#text>)
|
||||
RadioButtonPaintable (RadioButton<INPUT>) [262,65 12x12]
|
||||
PaintableWithLines (BlockContainer<P>) [235,84 139.984375x19]
|
||||
PaintableWithLines (BlockContainer<P>) [235,84 139.96875x19]
|
||||
TextPaintable (TextNode<#text>)
|
||||
RadioButtonPaintable (RadioButton<INPUT>) [280,84 12x12]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [235,103 139.984375x0]
|
||||
PaintableWithLines (BlockContainer<LI>) [394.984375,45 80x120]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [235,103 139.96875x0]
|
||||
PaintableWithLines (BlockContainer<LI>) [394.96875,45 80x120]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer<LI>#baz) [135,175 120x120]
|
||||
TextPaintable (TextNode<#text>)
|
||||
|
@ -181,4 +181,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
|||
InlinePaintable (InlineNode<A>)
|
||||
TextPaintable (TextNode<#text>)
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer(anonymous)) [20,400 480x0]
|
||||
PaintableWithLines (BlockContainer(anonymous)) [20,400 480x0]
|
|
@ -0,0 +1,35 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x208 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x0 children: not-inline
|
||||
BlockContainer <div> at (15.828125,8) content-size 376.3125x100 floating [BFC] children: inline
|
||||
line 0 width: 27.703125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 3, rect: [15.828125,8 27.703125x17.46875]
|
||||
"abc"
|
||||
TextNode <#text>
|
||||
BlockContainer <div> at (407.796875,8) content-size 376.3125x100 floating [BFC] children: inline
|
||||
line 0 width: 23.015625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 3, rect: [407.796875,8 23.015625x17.46875]
|
||||
"def"
|
||||
TextNode <#text>
|
||||
BlockContainer <div> at (15.828125,108) content-size 376.3125x100 floating [BFC] children: inline
|
||||
line 0 width: 21.421875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 3, rect: [15.828125,108 21.421875x17.46875]
|
||||
"ghi"
|
||||
TextNode <#text>
|
||||
BlockContainer <div> at (407.796875,108) content-size 376.3125x100 floating [BFC] children: inline
|
||||
line 0 width: 18.40625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
|
||||
frag 0 from TextNode start: 0, length: 3, rect: [407.796875,108 18.40625x17.46875]
|
||||
"jkl"
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x208]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x0] overflow: [15.828125,8 768.28125x200]
|
||||
PaintableWithLines (BlockContainer<DIV>) [15.828125,8 376.3125x100]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer<DIV>) [407.796875,8 376.3125x100]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer<DIV>) [15.828125,108 376.3125x100]
|
||||
TextPaintable (TextNode<#text>)
|
||||
PaintableWithLines (BlockContainer<DIV>) [407.796875,108 376.3125x100]
|
||||
TextPaintable (TextNode<#text>)
|
|
@ -0,0 +1,10 @@
|
|||
<!doctype html><style>
|
||||
* { outline: 1px solid black; }
|
||||
div {
|
||||
float: left;
|
||||
width: 48%;
|
||||
margin-left: 1%;
|
||||
margin-right: 1%;
|
||||
height: 100px;
|
||||
}
|
||||
</style><body><div>abc</div><div>def</div><div>ghi</div><div>jkl</div>
|
Loading…
Add table
Add a link
Reference in a new issue