1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 03:17:36 +00:00

LibWeb: Use fixed-point saturated arithmetics for CSSPixels

Using fixed-point saturated arithmetics for CSSPixels allows to avoid
accumulating floating-point errors.

This implementation is not complete yet: currently saturated
arithmetics implemented only for addition. But it is enough to not
regress any of layout tests we have :)

See https://github.com/SerenityOS/serenity/issues/18566
This commit is contained in:
Aliaksandr Kalenik 2023-07-23 01:09:39 +02:00 committed by Andreas Kling
parent 5cdd03fc53
commit bec07d4af7
136 changed files with 1938 additions and 1844 deletions

View file

@ -1,15 +1,15 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x419.999999 [BFC] children: not-inline
BlockContainer <html> at (0,0) content-size 800x419.921875 [BFC] children: not-inline
BlockContainer <(anonymous)> at (0,0) content-size 800x0 children: inline
TextNode <#text>
BlockContainer <body> at (20,20) content-size 480x379.999999 children: not-inline
BlockContainer <body> at (20,20) content-size 480x379.921875 children: not-inline
BlockContainer <(anonymous)> at (20,20) content-size 480x0 children: inline
TextNode <#text>
BlockContainer <dl> at (25,25) content-size 470x0 children: inline
TextNode <#text>
BlockContainer <dt> at (40,40) content-size 49.999x280 floating [BFC] children: inline
line 0 width: 28.310546, height: 10, bottom: 10, baseline: 7.998046
frag 0 from TextNode start: 0, length: 6, rect: [40,40 28.310546x10]
BlockContainer <dt> at (40,40) content-size 49.984375x280 floating [BFC] children: inline
line 0 width: 28.296875, height: 10, bottom: 10, baseline: 7.984375
frag 0 from TextNode start: 0, length: 6, rect: [40,40 28.296875x10]
"toggle"
TextNode <#text>
TextNode <#text>
@ -19,56 +19,56 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <ul> at (135,45) content-size 340x0 children: inline
TextNode <#text>
BlockContainer <li> at (150,60) content-size 50x90 floating [BFC] children: inline
line 0 width: 37.880859, height: 10, bottom: 10, baseline: 7.998046
frag 0 from TextNode start: 0, length: 7, rect: [150,60 37.880859x10]
line 0 width: 37.875, height: 10, bottom: 10, baseline: 7.984375
frag 0 from TextNode start: 0, length: 7, rect: [150,60 37.875x10]
"the way"
TextNode <#text>
TextNode <#text>
BlockContainer <li#bar> at (235,55) content-size 139.978x90 floating [BFC] children: not-inline
BlockContainer <(anonymous)> at (235,55) content-size 139.978x0 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.978x10 children: inline
line 0 width: 74.316406, height: 10, bottom: 10, baseline: 7.998046
frag 0 from TextNode start: 0, length: 14, rect: [235,55 74.316406x10]
BlockContainer <p> at (235,55) content-size 139.96875x10 children: inline
line 0 width: 74.3125, height: 10, bottom: 10, baseline: 7.984375
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.978x0 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.978x18.999999 children: inline
line 0 width: 39.490234, height: 18.999999, bottom: 18.999999, baseline: 12.498046
frag 0 from TextNode start: 1, length: 5, rect: [235,65 27.490234x18.999999]
BlockContainer <p> at (235,65) content-size 139.96875x18.984375 children: inline
line 0 width: 39.484375, height: 18.984375, bottom: 18.984375, baseline: 12.46875
frag 0 from TextNode start: 1, length: 5, rect: [235,65 27.484375x18.984375]
"bang "
frag 1 from RadioButton start: 0, length: 0, rect: [262,65 12x12]
frag 1 from RadioButton start: 0, length: 0, rect: [262.484375,65.46875 12x12]
TextNode <#text>
RadioButton <input> at (262,65) content-size 12x12 inline-block children: not-inline
RadioButton <input> at (262.484375,65.46875) content-size 12x12 inline-block children: not-inline
TextNode <#text>
BlockContainer <p> at (235,83.999999) content-size 139.978x18.999999 children: inline
line 0 width: 57.15625, height: 18.999999, bottom: 18.999999, baseline: 12.498046
frag 0 from TextNode start: 1, length: 8, rect: [235,83.999999 45.15625x18.999999]
BlockContainer <p> at (235,83.984375) content-size 139.96875x18.984375 children: inline
line 0 width: 57.15625, height: 18.984375, bottom: 18.984375, baseline: 12.46875
frag 0 from TextNode start: 1, length: 8, rect: [235,83.984375 45.15625x18.984375]
"whimper "
frag 1 from RadioButton start: 0, length: 0, rect: [280,83.999999 12x12]
frag 1 from RadioButton start: 0, length: 0, rect: [280.15625,84.453125 12x12]
TextNode <#text>
RadioButton <input> at (280,83.999999) content-size 12x12 inline-block children: not-inline
RadioButton <input> at (280.15625,84.453125) content-size 12x12 inline-block children: not-inline
TextNode <#text>
BlockContainer <(anonymous)> at (235,102.999999) content-size 139.978x0 children: inline
BlockContainer <(anonymous)> at (235,102.96875) content-size 139.96875x0 children: inline
TextNode <#text>
TextNode <#text>
BlockContainer <li> at (409.978,60) content-size 50x90 floating [BFC] children: inline
line 0 width: 31.582031, height: 10, bottom: 10, baseline: 7.998046
frag 0 from TextNode start: 0, length: 6, rect: [409.978,60 31.582031x10]
BlockContainer <li> at (409.96875,60) content-size 50x90 floating [BFC] children: inline
line 0 width: 31.5625, height: 10, bottom: 10, baseline: 7.984375
frag 0 from TextNode start: 0, length: 6, rect: [409.96875,60 31.5625x10]
"i grow"
line 1 width: 14.033203, height: 10, bottom: 20, baseline: 7.998046
frag 0 from TextNode start: 7, length: 3, rect: [409.978,70 14.033203x10]
line 1 width: 14.03125, height: 10, bottom: 20, baseline: 7.984375
frag 0 from TextNode start: 7, length: 3, rect: [409.96875,70 14.03125x10]
"old"
TextNode <#text>
TextNode <#text>
BlockContainer <li#baz> at (145,185) content-size 100x100 floating [BFC] children: inline
line 0 width: 29.423828, height: 10, bottom: 10, baseline: 7.998046
frag 0 from TextNode start: 0, length: 6, rect: [145,185 29.423828x10]
line 0 width: 29.421875, height: 10, bottom: 10, baseline: 7.984375
frag 0 from TextNode start: 0, length: 6, rect: [145,185 29.421875x10]
"pluot?"
TextNode <#text>
TextNode <#text>
@ -78,51 +78,51 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <(anonymous)> at (280,195) content-size 50x0 children: inline
TextNode <#text>
BlockContainer <address> at (280,195) content-size 50x20 children: inline
line 0 width: 17.275390, height: 10, bottom: 10, baseline: 7.998046
frag 0 from TextNode start: 0, length: 3, rect: [280,195 17.275390x10]
line 0 width: 17.265625, height: 10, bottom: 10, baseline: 7.984375
frag 0 from TextNode start: 0, length: 3, rect: [280,195 17.265625x10]
"bar"
line 1 width: 30.224609, height: 10, bottom: 20, baseline: 7.998046
frag 0 from TextNode start: 4, length: 6, rect: [280,205 30.224609x10]
line 1 width: 30.21875, height: 10, bottom: 20, baseline: 7.984375
frag 0 from TextNode start: 4, length: 6, rect: [280,205 30.21875x10]
"maids,"
TextNode <#text>
BlockContainer <(anonymous)> at (280,215) content-size 50x0 children: inline
TextNode <#text>
TextNode <#text>
BlockContainer <h1> at (365,185) content-size 100x100 floating [BFC] children: inline
line 0 width: 56.416015, height: 10, bottom: 10, baseline: 7.998046
frag 0 from TextNode start: 0, length: 11, rect: [365,185 56.416015x10]
line 0 width: 56.390625, height: 10, bottom: 10, baseline: 7.984375
frag 0 from TextNode start: 0, length: 11, rect: [365,185 56.390625x10]
"sing to me,"
line 1 width: 65.449218, height: 10, bottom: 20, baseline: 7.998046
frag 0 from TextNode start: 12, length: 12, rect: [365,195 65.449218x10]
line 1 width: 65.4375, height: 10, bottom: 20, baseline: 7.984375
frag 0 from TextNode start: 12, length: 12, rect: [365,195 65.4375x10]
"erbarme dich"
TextNode <#text>
TextNode <#text>
TextNode <#text>
BlockContainer <(anonymous)> at (20,30) content-size 480x0 children: inline
TextNode <#text>
BlockContainer <p> at (20,335) content-size 480x64.999999 children: inline
line 0 width: 473.642578, height: 12.999999, bottom: 12.999999, baseline: 9.498046
frag 0 from TextNode start: 1, length: 90, rect: [20,335 473.642578x12.999999]
BlockContainer <p> at (20,335) content-size 480x64.921875 children: inline
line 0 width: 473.5625, height: 12.984375, bottom: 12.984375, baseline: 9.46875
frag 0 from TextNode start: 1, length: 90, rect: [20,335 473.5625x12.984375]
"This is a nonsensical document, but syntactically valid HTML 4.0. All 100%-conformant CSS1"
line 1 width: 396.953125, height: 13, bottom: 25.999999, baseline: 9.498046
frag 0 from TextNode start: 92, length: 74, rect: [20,348 396.953125x12.999999]
line 1 width: 396.859375, height: 12.984375, bottom: 25.96875, baseline: 9.46875
frag 0 from TextNode start: 92, length: 74, rect: [20,347.984375 396.859375x12.984375]
"agents should be able to render the document elements above this paragraph"
line 2 width: 470.585937, height: 13, bottom: 38.999999, baseline: 9.498046
frag 0 from TextNode start: 167, length: 43, rect: [20,361 207.900390x12.999999]
line 2 width: 470.5, height: 12.984375, bottom: 38.953125, baseline: 9.46875
frag 0 from TextNode start: 167, length: 43, rect: [20,360.96875 207.875x12.984375]
"indistinguishably (to the pixel) from this "
frag 1 from TextNode start: 0, length: 20, rect: [228,361 103.007812x12.999999]
frag 1 from TextNode start: 0, length: 20, rect: [227.875,360.96875 102.984375x12.984375]
"reference rendering,"
frag 2 from TextNode start: 0, length: 31, rect: [331,361 159.677734x12.999999]
frag 2 from TextNode start: 0, length: 31, rect: [330.859375,360.96875 159.640625x12.984375]
" (except font rasterization and"
line 3 width: 465.019531, height: 13.000000, bottom: 51.999999, baseline: 9.498046
frag 0 from TextNode start: 32, length: 89, rect: [20,374 465.019531x12.999999]
line 3 width: 464.9375, height: 12.984375, bottom: 51.9375, baseline: 9.46875
frag 0 from TextNode start: 32, length: 89, rect: [20,373.953125 464.9375x12.984375]
"form widgets). All discrepancies should be traceable to CSS1 implementation shortcomings."
line 4 width: 408.164062, height: 13.000001, bottom: 64.999999, baseline: 9.498046
frag 0 from TextNode start: 122, length: 67, rect: [20,387 345.556640x12.999999]
line 4 width: 408.046875, height: 12.984375, bottom: 64.921875, baseline: 9.46875
frag 0 from TextNode start: 122, length: 67, rect: [20,386.9375 345.46875x12.984375]
"Once you have finished evaluating this test, you can return to the "
frag 1 from TextNode start: 0, length: 11, rect: [366,387 59.892578x12.999999]
frag 1 from TextNode start: 0, length: 11, rect: [365.46875,386.9375 59.875x12.984375]
"parent page"
frag 2 from TextNode start: 0, length: 1, rect: [425,387 2.714843x12.999999]
frag 2 from TextNode start: 0, length: 1, rect: [425.34375,386.9375 2.703125x12.984375]
"."
TextNode <#text>
InlineNode <a>
@ -131,5 +131,5 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
InlineNode <a>
TextNode <#text>
TextNode <#text>
BlockContainer <(anonymous)> at (20,399.999999) content-size 480x0 children: inline
BlockContainer <(anonymous)> at (20,399.921875) content-size 480x0 children: inline
TextNode <#text>