From c05a0067e88ca0469f960d5bfe61fab56cdc5f7e Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sat, 6 Jan 2024 06:08:23 +0100 Subject: [PATCH] LibWeb: Remove rounding division for CSSPixels Reverts 98926b487c349c21b189d596915fad82375c9117 that regressed (thrashing layout while window resizing): Tests/LibWeb/Layout/input/block-and-inline/small-percentage-margin.html Unfortunately, we currently can't capture such problems with layout tests, so this bug went unnoticed for quite a long time. Fixes https://github.com/SerenityOS/serenity/issues/22610 --- .../abspos-box-with-replaced-element.txt | 12 ++-- Tests/LibWeb/Layout/expected/acid1.txt | 40 ++++++------ .../button-baseline-align.txt | 30 ++++----- ...tton-with-block-content-baseline-align.txt | 38 ++++++------ ...d-right-with-justified-text-in-between.txt | 44 ++++++------- .../small-percentage-margin.txt | 26 ++++---- .../Layout/expected/css-font-size-math.txt | 2 +- .../css-namespace-tag-name-selector.txt | 14 ++--- ...-intrinsic-aspect-ratio-and-max-height.txt | 12 ++-- ...ut-with-space-between-and-space-around.txt | 36 +++++------ .../grid-item-horizontal-margins-auto.txt | 6 +- .../grid/grid-item-percentage-width.txt | 4 +- .../Layout/expected/grid/image-in-grid.txt | 12 ++-- .../expected/grid/item-column-span-2.txt | 8 +-- .../Layout/expected/grid/justify-items.txt | 6 +- .../Layout/expected/grid/justify-self.txt | 6 +- .../Layout/expected/grid/place-self.txt | 6 +- Tests/LibWeb/Layout/expected/inline-size.txt | 24 ++++---- .../place-content-shorthand-property.txt | 6 +- .../Layout/expected/svg-text-with-viewbox.txt | 16 ++--- .../expected/svg-transforms-and-viewboxes.txt | 12 ++-- .../svg/svg-different-types-of-opacity.txt | 4 +- .../table/fixed-layout-percentage-width.txt | 58 +++++++++--------- .../row-outer-size-with-computed-size.txt | 12 ++-- .../table/row-span-and-nested-tables.txt | 16 ++--- .../reference/images/css-backgrounds-ref.png | Bin 54040 -> 138634 bytes .../reference/images/object-fit-position.png | Bin 519156 -> 701829 bytes .../svg-background-no-natural-size-ref.png | Bin 449 -> 4363 bytes Userland/Libraries/LibWeb/PixelUnits.h | 14 +---- 29 files changed, 228 insertions(+), 236 deletions(-) diff --git a/Tests/LibWeb/Layout/expected/abspos-box-with-replaced-element.txt b/Tests/LibWeb/Layout/expected/abspos-box-with-replaced-element.txt index abf2663800ad120..2d5f6823f75b881 100644 --- a/Tests/LibWeb/Layout/expected/abspos-box-with-replaced-element.txt +++ b/Tests/LibWeb/Layout/expected/abspos-box-with-replaced-element.txt @@ -1,13 +1,13 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline BlockContainer at (1,1) content-size 798x0 [BFC] children: not-inline BlockContainer at (10,10) content-size 500x100 positioned [BFC] children: not-inline - BlockContainer at (261,11) content-size 248x28.484375 positioned [BFC] children: inline - line 0 width: 250, height: 28.484375, bottom: 28.484375, baseline: 28.484375 - frag 0 from ImageBox start: 0, length: 0, rect: [262,12 248x26.484375] - ImageBox at (262,12) content-size 248x26.484375 children: not-inline + BlockContainer at (261,11) content-size 248x28.46875 positioned [BFC] children: inline + line 0 width: 250, height: 28.46875, bottom: 28.46875, baseline: 28.46875 + frag 0 from ImageBox start: 0, length: 0, rect: [262,12 248x26.46875] + ImageBox at (262,12) content-size 248x26.46875 children: not-inline ViewportPaintable (Viewport<#document>) [0,0 800x600] PaintableWithLines (BlockContainer) [0,0 800x2] overflow: [9,9 502x102] PaintableWithLines (BlockContainer) [9,9 502x102] - PaintableWithLines (BlockContainer
.image-container) [260,10 250x30.484375] overflow: [261,11 249x28.484375] - ImagePaintable (ImageBox) [261,11 250x28.484375] + PaintableWithLines (BlockContainer
.image-container) [260,10 250x30.46875] overflow: [261,11 249x28.46875] + ImagePaintable (ImageBox) [261,11 250x28.46875] diff --git a/Tests/LibWeb/Layout/expected/acid1.txt b/Tests/LibWeb/Layout/expected/acid1.txt index d76ed21f4a463ef..b7c258d83ffbd48 100644 --- a/Tests/LibWeb/Layout/expected/acid1.txt +++ b/Tests/LibWeb/Layout/expected/acid1.txt @@ -7,7 +7,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline TextNode <#text> BlockContainer
at (25,25) content-size 470x0 children: inline TextNode <#text> - BlockContainer
at (40,40) content-size 50x280 floating [BFC] children: inline + BlockContainer
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 at (235,55) content-size 139.984375x90 floating [BFC] children: not-inline - BlockContainer <(anonymous)> at (235,55) content-size 139.984375x0 children: inline + BlockContainer 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

at (235,55) content-size 139.984375x10 children: inline + BlockContainer

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

TextNode <#text> TextNode <#text> TextNode <#text> - BlockContainer

at (235,65) content-size 139.984375x19 children: inline + BlockContainer

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 at (262,65) content-size 12x12 inline-block children: not-inline TextNode <#text> - BlockContainer

at (235,84) content-size 139.984375x19 children: inline + BlockContainer

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 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

  • at (409.984375,60) content-size 50x90 floating [BFC] children: inline + BlockContainer
  • 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) [15,15 490x390] PaintableWithLines (BlockContainer(anonymous)) [20,20 480x0] PaintableWithLines (BlockContainer
    ) [20,20 480x10] - PaintableWithLines (BlockContainer
    ) [25,25 80x310] + PaintableWithLines (BlockContainer
    ) [25,25 79.984375x310] TextPaintable (TextNode<#text>) PaintableWithLines (BlockContainer
    ) [115,25 380x310] PaintableWithLines (BlockContainer(anonymous)) [135,45 340x0] PaintableWithLines (BlockContainer