From 63983bc1193f78f488ce32038202812ab68ea13e Mon Sep 17 00:00:00 2001 From: Yanling Wang Date: Fri, 5 Sep 2025 17:36:14 -0700 Subject: [PATCH] [Masonry] Adding support for Masonry out-of-flow items This CL implements out-of-flow support in masonry (outside of fragmentation). - Enhanced `placeOutOfFlowItems` to properly handle OOF items with correct containing block calculation, alignment offset computation, and static positioning. - Extended `out_of_flow_layout_part` to recognize masonry containers and delegate OOF item placement to the masonry-specific containing block calculation. Bug: 343257585 Change-Id: I0ecccb7b2e6c3a46a810bd01577a88d53b05d7a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6909974 Reviewed-by: Kurt Catti-Schmidt Commit-Queue: Yanling Wang Reviewed-by: Alison Maher Cr-Commit-Position: refs/heads/main@{#1511947} --- .../abspos/column-masonry-alignment-ref.html | 144 ++++++++++++++++++ .../abspos/column-masonry-alignment.html | 142 +++++++++++++++++ ...lumn-masonry-intrinsic-sizing-oof-ref.html | 51 +++++++ .../column-masonry-intrinsic-sizing-oof.html | 55 +++++++ .../column-masonry-out-of-flow-001-ref.html | 87 +++++++++++ .../column-masonry-out-of-flow-001.html | 86 +++++++++++ .../column-masonry-out-of-flow-002-ref.html | 83 ++++++++++ .../column-masonry-out-of-flow-002.html | 84 ++++++++++ .../column-masonry-out-of-flow-003-ref.html | 68 +++++++++ .../column-masonry-out-of-flow-003.html | 71 +++++++++ ...ry-positioned-item-dynamic-change-ref.html | 18 +++ ...asonry-positioned-item-dynamic-change.html | 39 +++++ .../abspos/row-masonry-alignment-ref.html | 144 ++++++++++++++++++ .../abspos/row-masonry-alignment.html | 143 +++++++++++++++++ .../row-masonry-intrinsic-sizing-oof-ref.html | 52 +++++++ .../row-masonry-intrinsic-sizing-oof.html | 57 +++++++ .../row-masonry-out-of-flow-001-ref.html | 88 +++++++++++ .../abspos/row-masonry-out-of-flow-001.html | 88 +++++++++++ .../row-masonry-out-of-flow-002-ref.html | 84 ++++++++++ .../abspos/row-masonry-out-of-flow-002.html | 86 +++++++++++ .../row-masonry-out-of-flow-003-ref.html | 68 +++++++++ .../abspos/row-masonry-out-of-flow-003.html | 72 +++++++++ 22 files changed, 1810 insertions(+) create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-alignment-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-alignment.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-alignment-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-alignment.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003-ref.html create mode 100644 css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003.html diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-alignment-ref.html b/css/css-grid/masonry/tentative/abspos/column-masonry-alignment-ref.html new file mode 100644 index 00000000000000..2565ced24f2130 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-alignment-ref.html @@ -0,0 +1,144 @@ + + + + + + + +
+
+
Item 1
+
Item 2
+
Item 3
+
align-self: start
+
align-self: end
+
align-self: center
+
Item 4
+
Item 5
+
justify-self: start
+
justify-self: end
+
justify-self: center
+
center + center
+
justify-self: safe end
+
justify-self: unsafe end
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-alignment.html b/css/css-grid/masonry/tentative/abspos/column-masonry-alignment.html new file mode 100644 index 00000000000000..1baa113856c0d3 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-alignment.html @@ -0,0 +1,142 @@ + + + + + CSS Masonry Test: Masonry layout alignment properties for absolutely positioned elements + + + + + + +
+
+
Item 1
+
Item 2
+
Item 3
+
align-self: start
+
align-self: end
+
align-self: center
+
Item 4
+
Item 5
+
justify-self: start
+
justify-self: end
+
justify-self: center
+
center + center
+
justify-self: safe end
+
justify-self: unsafe end
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof-ref.html b/css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof-ref.html new file mode 100644 index 00000000000000..db9300ad9b4283 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof-ref.html @@ -0,0 +1,51 @@ + + + + + + + +
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof.html b/css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof.html new file mode 100644 index 00000000000000..b0be4bff0aedc2 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-intrinsic-sizing-oof.html @@ -0,0 +1,55 @@ + + + + + CSS Masonry Test: Masonry layout intrinsic size with only OOF children + + + + + + + +
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001-ref.html b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001-ref.html new file mode 100644 index 00000000000000..9bf28dea91d723 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001-ref.html @@ -0,0 +1,87 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001.html b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001.html new file mode 100644 index 00000000000000..3eb9b27937f51e --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-001.html @@ -0,0 +1,86 @@ + + + + + CSS Masonry Test: Masonry layout out-of-flow positioning + + + + + + +
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002-ref.html b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002-ref.html new file mode 100644 index 00000000000000..498c307e0606b7 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002-ref.html @@ -0,0 +1,83 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002.html b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002.html new file mode 100644 index 00000000000000..c24b64dc555d23 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-002.html @@ -0,0 +1,84 @@ + + + + + CSS Masonry Test: Masonry layout out-of-flow positioning + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003-ref.html b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003-ref.html new file mode 100644 index 00000000000000..a9218014ca0fa6 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003-ref.html @@ -0,0 +1,68 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003.html b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003.html new file mode 100644 index 00000000000000..7dcd5f8eca0c9b --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-out-of-flow-003.html @@ -0,0 +1,71 @@ + + + + + CSS Masonry Test: Masonry layout out-of-flow positioning + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change-ref.html b/css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change-ref.html new file mode 100644 index 00000000000000..ab7661d01af86d --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change-ref.html @@ -0,0 +1,18 @@ + + + + + + + +
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change.html b/css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change.html new file mode 100644 index 00000000000000..d31621e9c82002 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/column-masonry-positioned-item-dynamic-change.html @@ -0,0 +1,39 @@ + + + + + CSS Masonry Layout Test: Masonry positioned item dynamic change. + + + + + + +
+
+
+
+
+ + + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-alignment-ref.html b/css/css-grid/masonry/tentative/abspos/row-masonry-alignment-ref.html new file mode 100644 index 00000000000000..b89eb293056fe2 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-alignment-ref.html @@ -0,0 +1,144 @@ + + + + + + + +
+
+
Item 1
+
Item 2
+
Item 3
+
align-self: start
+
align-self: end
+
align-self: center
+
Item 4
+
Item 5
+
justify-self: start
+
justify-self: end
+
justify-self: center
+
center + center
+
align-self: safe end
+
align-self: unsafe end
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-alignment.html b/css/css-grid/masonry/tentative/abspos/row-masonry-alignment.html new file mode 100644 index 00000000000000..5fb9b4b133e649 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-alignment.html @@ -0,0 +1,143 @@ + + + + + CSS Masonry Test: Masonry layout alignment properties for absolutely positioned elements + + + + + + +
+
+
Item 1
+
Item 2
+
Item 3
+
align-self: start
+
align-self: end
+
align-self: center
+
Item 4
+
Item 5
+
justify-self: start
+
justify-self: end
+
justify-self: center
+
center + center
+
align-self: safe end
+
align-self: unsafe end
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof-ref.html b/css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof-ref.html new file mode 100644 index 00000000000000..b418cbfb5ea0c3 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof-ref.html @@ -0,0 +1,52 @@ + + + + + + + +
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof.html b/css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof.html new file mode 100644 index 00000000000000..c9d0582d60b0a3 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-intrinsic-sizing-oof.html @@ -0,0 +1,57 @@ + + + + + CSS Masonry Test: Masonry layout intrinsic size with only OOF children + + + + + + + +
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001-ref.html b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001-ref.html new file mode 100644 index 00000000000000..49fe1967bae397 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001-ref.html @@ -0,0 +1,88 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001.html b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001.html new file mode 100644 index 00000000000000..4d5ecb6515474f --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-001.html @@ -0,0 +1,88 @@ + + + + + CSS Masonry Test: Masonry layout out-of-flow positioning + + + + + + +
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002-ref.html b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002-ref.html new file mode 100644 index 00000000000000..3efc256ec34260 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002-ref.html @@ -0,0 +1,84 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002.html b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002.html new file mode 100644 index 00000000000000..c93b9c2f60d8cd --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-002.html @@ -0,0 +1,86 @@ + + + + + CSS Masonry Test: Masonry layout out-of-flow positioning + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003-ref.html b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003-ref.html new file mode 100644 index 00000000000000..23391b5f4aac51 --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003-ref.html @@ -0,0 +1,68 @@ + + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ + diff --git a/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003.html b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003.html new file mode 100644 index 00000000000000..1706939bae958a --- /dev/null +++ b/css/css-grid/masonry/tentative/abspos/row-masonry-out-of-flow-003.html @@ -0,0 +1,72 @@ + + + + + CSS Masonry Test: Masonry layout out-of-flow positioning + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ +