1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 03:47:34 +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

@ -3,22 +3,22 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <body> at (10,10) content-size 780x62 children: not-inline
Box <div.flex-container> at (11,11) content-size 778x60 flex-container(row) [FFC] children: not-inline
BlockContainer <div.flex-item> at (12,12) content-size 386x28 flex-item [BFC] children: inline
line 0 width: 58.398437, height: 21.835937, bottom: 21.835937, baseline: 16.914062
frag 0 from TextNode start: 0, length: 6, rect: [12,12 58.398437x21.835937]
line 0 width: 58.390625, height: 21.828125, bottom: 21.828125, baseline: 16.890625
frag 0 from TextNode start: 0, length: 6, rect: [12,12 58.390625x21.828125]
"Item 1"
TextNode <#text>
BlockContainer <div.flex-item> at (401,12) content-size 386x28 flex-item [BFC] children: inline
line 0 width: 61.484375, height: 21.835937, bottom: 21.835937, baseline: 16.914062
frag 0 from TextNode start: 0, length: 6, rect: [401,12 61.484375x21.835937]
line 0 width: 61.484375, height: 21.828125, bottom: 21.828125, baseline: 16.890625
frag 0 from TextNode start: 0, length: 6, rect: [401,12 61.484375x21.828125]
"Item 2"
TextNode <#text>
BlockContainer <div.flex-item> at (12,42) content-size 386x28 flex-item [BFC] children: inline
line 0 width: 61.835937, height: 21.835937, bottom: 21.835937, baseline: 16.914062
frag 0 from TextNode start: 0, length: 6, rect: [12,42 61.835937x21.835937]
line 0 width: 61.828125, height: 21.828125, bottom: 21.828125, baseline: 16.890625
frag 0 from TextNode start: 0, length: 6, rect: [12,42 61.828125x21.828125]
"Item 3"
TextNode <#text>
BlockContainer <div.flex-item> at (401,42) content-size 386x28 flex-item [BFC] children: inline
line 0 width: 60.15625, height: 21.835937, bottom: 21.835937, baseline: 16.914062
frag 0 from TextNode start: 0, length: 6, rect: [401,42 60.15625x21.835937]
line 0 width: 60.15625, height: 21.828125, bottom: 21.828125, baseline: 16.890625
frag 0 from TextNode start: 0, length: 6, rect: [401,42 60.15625x21.828125]
"Item 4"
TextNode <#text>

View file

@ -1,27 +1,27 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x245.09375 [BFC] children: not-inline
BlockContainer <body> at (10,10) content-size 780x227.09375 children: not-inline
Box <div.outer.flex.flex-wrap> at (11,11) content-size 778x225.09375 flex-container(row) [FFC] children: not-inline
BlockContainer <div.inner> at (12,62) content-size 776x123.09375 flex-item [BFC] children: inline
BlockContainer <html> at (1,1) content-size 798x244.28125 [BFC] children: not-inline
BlockContainer <body> at (10,10) content-size 780x226.28125 children: not-inline
Box <div.outer.flex.flex-wrap> at (11,11) content-size 778x224.28125 flex-container(row) [FFC] children: not-inline
BlockContainer <div.inner> at (12,62) content-size 776x122.28125 flex-item [BFC] children: inline
line 0 width: 741.640625, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 90, rect: [12,62 741.640625x17.46875]
"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus interdum libero et urna"
line 1 width: 765.03125, height: 17.9375, bottom: 35.40625, baseline: 13.53125
frag 0 from TextNode start: 91, length: 95, rect: [12,79 765.03125x17.46875]
line 1 width: 765.03125, height: 17.46875, bottom: 34.9375, baseline: 13.53125
frag 0 from TextNode start: 91, length: 95, rect: [12,79.46875 765.03125x17.46875]
"sodales auctor. Nullam sodales bibendum turpis quis blandit. Ut fringilla erat et erat laoreet,"
line 2 width: 747.5625, height: 18.40625, bottom: 53.34375, baseline: 13.53125
frag 0 from TextNode start: 187, length: 90, rect: [12,96 747.5625x17.46875]
line 2 width: 747.5625, height: 17.46875, bottom: 52.40625, baseline: 13.53125
frag 0 from TextNode start: 187, length: 90, rect: [12,96.9375 747.5625x17.46875]
"faucibus rhoncus orci hendrerit. Etiam at sagittis diam. Etiam nec neque non dolor iaculis"
line 3 width: 732.109375, height: 17.875, bottom: 70.28125, baseline: 13.53125
frag 0 from TextNode start: 278, length: 90, rect: [12,114 732.109375x17.46875]
line 3 width: 732.109375, height: 17.46875, bottom: 69.875, baseline: 13.53125
frag 0 from TextNode start: 278, length: 90, rect: [12,114.40625 732.109375x17.46875]
"finibus euismod eget erat. Pellentesque vitae purus vitae nisi vehicula vestibulum quis ut"
line 4 width: 759.453125, height: 18.34375, bottom: 88.21875, baseline: 13.53125
frag 0 from TextNode start: 369, length: 95, rect: [12,131 759.453125x17.46875]
line 4 width: 759.453125, height: 17.46875, bottom: 87.34375, baseline: 13.53125
frag 0 from TextNode start: 369, length: 95, rect: [12,131.875 759.453125x17.46875]
"diam. Integer convallis, justo ullamcorper sollicitudin varius, enim enim pellentesque erat, eu"
line 5 width: 767.1875, height: 17.8125, bottom: 105.15625, baseline: 13.53125
frag 0 from TextNode start: 465, length: 94, rect: [12,149 767.1875x17.46875]
line 5 width: 767.1875, height: 17.46875, bottom: 104.8125, baseline: 13.53125
frag 0 from TextNode start: 465, length: 94, rect: [12,149.34375 767.1875x17.46875]
"pellentesque sem arcu eu purus. Phasellus id erat sed felis luctus mollis eget sit amet dolor."
line 6 width: 765.578125, height: 18.28125, bottom: 123.09375, baseline: 13.53125
frag 0 from TextNode start: 560, length: 95, rect: [12,166 765.578125x17.46875]
line 6 width: 765.578125, height: 17.46875, bottom: 122.28125, baseline: 13.53125
frag 0 from TextNode start: 560, length: 95, rect: [12,166.8125 765.578125x17.46875]
"Pellentesque eget justo nulla. Duis consectetur imperdiet nisi, ac tincidunt urna blandit quis."
TextNode <#text>

View file

@ -9,14 +9,14 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <div.buttons> at (394.625,11) content-size 114.375x50 flex-item [BFC] children: inline
line 0 width: 114.375, height: 19.46875, bottom: 19.46875, baseline: 14.53125
frag 0 from BlockContainer start: 0, length: 0, rect: [395.625,12 57.046875x17.46875]
frag 1 from BlockContainer start: 0, length: 0, rect: [454.625,12 53.328125x17.46875]
frag 1 from BlockContainer start: 0, length: 0, rect: [454.671875,12 53.328125x17.46875]
BlockContainer <div.button> at (395.625,12) content-size 57.046875x17.46875 inline-block [BFC] children: inline
line 0 width: 57.046875, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [395.625,12 57.046875x17.46875]
"Accept"
TextNode <#text>
BlockContainer <div.button> at (454.625,12) content-size 53.328125x17.46875 inline-block [BFC] children: inline
BlockContainer <div.button> at (454.671875,12) content-size 53.328125x17.46875 inline-block [BFC] children: inline
line 0 width: 53.328125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 6, rect: [454.625,12 53.328125x17.46875]
frag 0 from TextNode start: 0, length: 6, rect: [454.671875,12 53.328125x17.46875]
"Reject"
TextNode <#text>

View file

@ -1,15 +1,15 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x69.34375 [BFC] children: not-inline
Box <body.pink> at (8,8) content-size 784x53.34375 flex-container(row) [FFC] children: not-inline
Box <div.orange> at (8,8) content-size 194.71875x53.34375 flex-container(row) flex-item [FFC] children: not-inline
BlockContainer <div.lime> at (8,8) content-size 87.358999x53.34375 flex-item [BFC] children: inline
BlockContainer <html> at (0,0) content-size 800x68.40625 [BFC] children: not-inline
Box <body.pink> at (8,8) content-size 784x52.40625 flex-container(row) [FFC] children: not-inline
Box <div.orange> at (8,8) content-size 194.71875x52.40625 flex-container(row) flex-item [FFC] children: not-inline
BlockContainer <div.lime> at (8,8) content-size 87.34375x52.40625 flex-item [BFC] children: inline
line 0 width: 74.75, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 9, rect: [8,8 74.75x17.46875]
"This is a"
line 1 width: 71.828125, height: 17.9375, bottom: 35.40625, baseline: 13.53125
frag 0 from TextNode start: 10, length: 8, rect: [8,25 71.828125x17.46875]
line 1 width: 71.828125, height: 17.46875, bottom: 34.9375, baseline: 13.53125
frag 0 from TextNode start: 10, length: 8, rect: [8,25.46875 71.828125x17.46875]
"bunch of"
line 2 width: 32.140625, height: 18.40625, bottom: 53.34375, baseline: 13.53125
frag 0 from TextNode start: 19, length: 4, rect: [8,42 32.140625x17.46875]
line 2 width: 32.140625, height: 17.46875, bottom: 52.40625, baseline: 13.53125
frag 0 from TextNode start: 19, length: 4, rect: [8,42.9375 32.140625x17.46875]
"text"
TextNode <#text>

View file

@ -1,6 +1,6 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (1,1) content-size 798x70 [BFC] children: not-inline
Box <body> at (10,10) content-size 780x52 flex-container(row) [FFC] children: not-inline
ImageBox <img> at (11,11) content-size 66.666668x50 flex-item children: not-inline
BlockContainer <html> at (1,1) content-size 798x69.96875 [BFC] children: not-inline
Box <body> at (10,10) content-size 780x51.96875 flex-container(row) [FFC] children: not-inline
ImageBox <img> at (11,11) content-size 66.65625x49.984375 flex-item children: not-inline
BlockContainer <(anonymous)> (not painted) [BFC] children: inline
TextNode <#text>

View file

@ -2,37 +2,37 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x616 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x600 children: not-inline
Box <div.outer.row> at (8,8) content-size 150x150 flex-container(row) [FFC] children: not-inline
BlockContainer <div.inner> at (12.619791,8) content-size 30.078125x150 flex-item [BFC] children: inline
BlockContainer <div.inner> at (12.609375,8) content-size 30.078125x150 flex-item [BFC] children: inline
line 0 width: 30.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 4, rect: [12.619791,8 30.078125x17.46875]
frag 0 from TextNode start: 0, length: 4, rect: [12.609375,8 30.078125x17.46875]
"Well"
TextNode <#text>
BlockContainer <div.inner> at (51.9375,8) content-size 36.84375x150 flex-item [BFC] children: inline
BlockContainer <div.inner> at (51.921875,8) content-size 36.84375x150 flex-item [BFC] children: inline
line 0 width: 36.84375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 5, rect: [51.9375,8 36.84375x17.46875]
frag 0 from TextNode start: 0, length: 5, rect: [51.921875,8 36.84375x17.46875]
"hello"
TextNode <#text>
BlockContainer <div.inner> at (98.020833,8) content-size 55.359375x150 flex-item [BFC] children: inline
BlockContainer <div.inner> at (98,8) content-size 55.359375x150 flex-item [BFC] children: inline
line 0 width: 55.359375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 7, rect: [98.020833,8 55.359375x17.46875]
frag 0 from TextNode start: 0, length: 7, rect: [98,8 55.359375x17.46875]
"friends"
TextNode <#text>
BlockContainer <(anonymous)> at (8,158) content-size 784x0 children: inline
TextNode <#text>
Box <div.outer.row-reverse> at (8,158) content-size 150x150 flex-container(row-reverse) [FFC] children: not-inline
BlockContainer <div.inner> at (123.302083,158) content-size 30.078125x150 flex-item [BFC] children: inline
BlockContainer <div.inner> at (123.3125,158) content-size 30.078125x150 flex-item [BFC] children: inline
line 0 width: 30.078125, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 4, rect: [123.302083,158 30.078125x17.46875]
frag 0 from TextNode start: 0, length: 4, rect: [123.3125,158 30.078125x17.46875]
"Well"
TextNode <#text>
BlockContainer <div.inner> at (77.21875,158) content-size 36.84375x150 flex-item [BFC] children: inline
BlockContainer <div.inner> at (77.234375,158) content-size 36.84375x150 flex-item [BFC] children: inline
line 0 width: 36.84375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 5, rect: [77.21875,158 36.84375x17.46875]
frag 0 from TextNode start: 0, length: 5, rect: [77.234375,158 36.84375x17.46875]
"hello"
TextNode <#text>
BlockContainer <div.inner> at (12.619791,158) content-size 55.359375x150 flex-item [BFC] children: inline
BlockContainer <div.inner> at (12.640625,158) content-size 55.359375x150 flex-item [BFC] children: inline
line 0 width: 55.359375, height: 17.46875, bottom: 17.46875, baseline: 13.53125
frag 0 from TextNode start: 0, length: 7, rect: [12.619791,158 55.359375x17.46875]
frag 0 from TextNode start: 0, length: 7, rect: [12.640625,158 55.359375x17.46875]
"friends"
TextNode <#text>
BlockContainer <(anonymous)> at (8,308) content-size 784x0 children: inline

View file

@ -4,7 +4,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
Box <div.flex> at (11,11) content-size 300x200 flex-container(row) [FFC] children: not-inline
BlockContainer <div> at (12,12) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (114,12) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (12,95.333333) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (114,95.333333) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (12,178.666666) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (114,178.666666) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (12,95.328125) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (114,95.328125) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (12,178.65625) content-size 100x20 flex-item [BFC] children: not-inline
BlockContainer <div> at (114,178.65625) content-size 100x20 flex-item [BFC] children: not-inline