1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-29 10:57:35 +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,7 +1,7 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x458.28125 [BFC] children: not-inline
BlockContainer <body> at (10,10) content-size 780x440.28125 children: not-inline
Box <div.grid> at (11,11) content-size 500x438.28125 [GFC] children: not-inline
BlockContainer <html> at (1,1) content-size 798x457.25 [BFC] children: not-inline
BlockContainer <body> at (10,10) content-size 780x439.25 children: not-inline
Box <div.grid> at (11,11) content-size 500x437.25 [GFC] children: not-inline
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
BlockContainer <div.left-margin-auto.right-margin-auto> at (99.71875,12) content-size 322.5625x17.46875 [BFC] children: inline
@ -25,9 +25,9 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
BlockContainer <div.left-margin-auto.right-margin-auto.fit-content-width> at (75.257812,70.40625) content-size 371.484375x17.46875 [BFC] children: inline
BlockContainer <div.left-margin-auto.right-margin-auto.fit-content-width> at (75.25,70.40625) content-size 371.484375x17.46875 [BFC] children: inline
line 0 width: 371.484375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 45, rect: [75.257812,70.40625 371.484375x17.46875]
frag 0 from TextNode start: 0, length: 45, rect: [75.25,70.40625 371.484375x17.46875]
"auto horizontal margins and fit-content width"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
@ -46,71 +46,71 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
TextNode <#text>
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
BlockContainer <div.left-margin-auto.right-margin-auto.fixed-width> at (236,128.8125) content-size 50x105.15625 [BFC] children: inline
BlockContainer <div.left-margin-auto.right-margin-auto.fixed-width> at (236,128.8125) content-size 50x104.8125 [BFC] children: inline
line 0 width: 36.328125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 4, rect: [236,128.8125 36.328125x17.46875]
"auto"
line 1 width: 81.84375, height: 17.9375, bottom: 35.40625, baseline: 13.53125
frag 0 from TextNode start: 5, length: 10, rect: [236,145.8125 81.84375x17.46875]
line 1 width: 81.84375, height: 17.46875, bottom: 34.9375, baseline: 13.53125
frag 0 from TextNode start: 5, length: 10, rect: [236,146.28125 81.84375x17.46875]
"horizontal"
line 2 width: 61.453125, height: 18.40625, bottom: 53.34375, baseline: 13.53125
frag 0 from TextNode start: 16, length: 7, rect: [236,162.8125 61.453125x17.46875]
line 2 width: 61.453125, height: 17.46875, bottom: 52.40625, baseline: 13.53125
frag 0 from TextNode start: 16, length: 7, rect: [236,163.75 61.453125x17.46875]
"margins"
line 3 width: 26.8125, height: 17.875, bottom: 70.28125, baseline: 13.53125
frag 0 from TextNode start: 24, length: 3, rect: [236,180.8125 26.8125x17.46875]
line 3 width: 26.8125, height: 17.46875, bottom: 69.875, baseline: 13.53125
frag 0 from TextNode start: 24, length: 3, rect: [236,181.21875 26.8125x17.46875]
"and"
line 4 width: 37.28125, height: 18.34375, bottom: 88.21875, baseline: 13.53125
frag 0 from TextNode start: 28, length: 5, rect: [236,197.8125 37.28125x17.46875]
line 4 width: 37.28125, height: 17.46875, bottom: 87.34375, baseline: 13.53125
frag 0 from TextNode start: 28, length: 5, rect: [236,198.6875 37.28125x17.46875]
"fixed"
line 5 width: 39.796875, height: 17.8125, bottom: 105.15625, baseline: 13.53125
frag 0 from TextNode start: 34, length: 5, rect: [236,215.8125 39.796875x17.46875]
line 5 width: 39.796875, height: 17.46875, bottom: 104.8125, baseline: 13.53125
frag 0 from TextNode start: 34, length: 5, rect: [236,216.15625 39.796875x17.46875]
"width"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
BlockContainer <div.left-margin-auto.fixed-width> at (460,235.96875) content-size 50x105.15625 [BFC] children: inline
BlockContainer <div.left-margin-auto.fixed-width> at (460,235.625) content-size 50x104.8125 [BFC] children: inline
line 0 width: 36.328125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 4, rect: [460,235.96875 36.328125x17.46875]
frag 0 from TextNode start: 0, length: 4, rect: [460,235.625 36.328125x17.46875]
"auto"
line 1 width: 26.25, height: 17.9375, bottom: 35.40625, baseline: 13.53125
frag 0 from TextNode start: 5, length: 4, rect: [460,252.96875 26.25x17.46875]
line 1 width: 26.25, height: 17.46875, bottom: 34.9375, baseline: 13.53125
frag 0 from TextNode start: 5, length: 4, rect: [460,253.09375 26.25x17.46875]
"left"
line 2 width: 52.109375, height: 18.40625, bottom: 53.34375, baseline: 13.53125
frag 0 from TextNode start: 10, length: 6, rect: [460,269.96875 52.109375x17.46875]
line 2 width: 52.109375, height: 17.46875, bottom: 52.40625, baseline: 13.53125
frag 0 from TextNode start: 10, length: 6, rect: [460,270.5625 52.109375x17.46875]
"margin"
line 3 width: 26.8125, height: 17.875, bottom: 70.28125, baseline: 13.53125
frag 0 from TextNode start: 17, length: 3, rect: [460,287.96875 26.8125x17.46875]
line 3 width: 26.8125, height: 17.46875, bottom: 69.875, baseline: 13.53125
frag 0 from TextNode start: 17, length: 3, rect: [460,288.03125 26.8125x17.46875]
"and"
line 4 width: 37.28125, height: 18.34375, bottom: 88.21875, baseline: 13.53125
frag 0 from TextNode start: 21, length: 5, rect: [460,304.96875 37.28125x17.46875]
line 4 width: 37.28125, height: 17.46875, bottom: 87.34375, baseline: 13.53125
frag 0 from TextNode start: 21, length: 5, rect: [460,305.5 37.28125x17.46875]
"fixed"
line 5 width: 39.796875, height: 17.8125, bottom: 105.15625, baseline: 13.53125
line 5 width: 39.796875, height: 17.46875, bottom: 104.8125, baseline: 13.53125
frag 0 from TextNode start: 27, length: 5, rect: [460,322.96875 39.796875x17.46875]
"width"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
BlockContainer <div.right-margin-auto.fixed-width> at (12,343.125) content-size 50x105.15625 [BFC] children: inline
BlockContainer <div.right-margin-auto.fixed-width> at (12,342.4375) content-size 50x104.8125 [BFC] children: inline
line 0 width: 36.328125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 4, rect: [12,343.125 36.328125x17.46875]
frag 0 from TextNode start: 0, length: 4, rect: [12,342.4375 36.328125x17.46875]
"auto"
line 1 width: 37.109375, height: 17.9375, bottom: 35.40625, baseline: 13.53125
frag 0 from TextNode start: 5, length: 5, rect: [12,360.125 37.109375x17.46875]
line 1 width: 37.109375, height: 17.46875, bottom: 34.9375, baseline: 13.53125
frag 0 from TextNode start: 5, length: 5, rect: [12,359.90625 37.109375x17.46875]
"right"
line 2 width: 52.109375, height: 18.40625, bottom: 53.34375, baseline: 13.53125
frag 0 from TextNode start: 11, length: 6, rect: [12,377.125 52.109375x17.46875]
line 2 width: 52.109375, height: 17.46875, bottom: 52.40625, baseline: 13.53125
frag 0 from TextNode start: 11, length: 6, rect: [12,377.375 52.109375x17.46875]
"margin"
line 3 width: 26.8125, height: 17.875, bottom: 70.28125, baseline: 13.53125
frag 0 from TextNode start: 18, length: 3, rect: [12,395.125 26.8125x17.46875]
line 3 width: 26.8125, height: 17.46875, bottom: 69.875, baseline: 13.53125
frag 0 from TextNode start: 18, length: 3, rect: [12,394.84375 26.8125x17.46875]
"and"
line 4 width: 37.28125, height: 18.34375, bottom: 88.21875, baseline: 13.53125
frag 0 from TextNode start: 22, length: 5, rect: [12,412.125 37.28125x17.46875]
line 4 width: 37.28125, height: 17.46875, bottom: 87.34375, baseline: 13.53125
frag 0 from TextNode start: 22, length: 5, rect: [12,412.3125 37.28125x17.46875]
"fixed"
line 5 width: 39.796875, height: 17.8125, bottom: 105.15625, baseline: 13.53125
frag 0 from TextNode start: 28, length: 5, rect: [12,430.125 39.796875x17.46875]
line 5 width: 39.796875, height: 17.46875, bottom: 104.8125, baseline: 13.53125
frag 0 from TextNode start: 28, length: 5, rect: [12,429.78125 39.796875x17.46875]
"width"
TextNode <#text>
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>
BlockContainer <(anonymous)> at (10,450.28125) content-size 780x0 children: inline
BlockContainer <(anonymous)> at (10,449.25) content-size 780x0 children: inline
TextNode <#text>