[Gap Decorations]: Build Gap Intersection Points [chromium/src : main]

1 view
Skip to first unread message

Kurt Catti-Schmidt (Gerrit)

unread,
Feb 3, 2025, 4:43:05 PM2/3/25
to Sam Davis Omekara, Alison Maher, Kevin Babbitt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Alison Maher, Kevin Babbitt and Sam Davis Omekara

Kurt Catti-Schmidt voted and added 1 comment

Votes added by Kurt Catti-Schmidt

Code-Review+1

1 comment

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
Line 3950, Patchset 16 (Latest): const auto container_end = cross_tracks[cross_tracks.size() - 1];
Kurt Catti-Schmidt . unresolved

Is it possible for `cross_tracks` to be size 0? If so, these array accesses could be out-of-range.

Might be worth adding `DCHECK_GT(cross_tracks(), 0);` before these calls just to be safe. If it's possible to hit, you'll need an `if` statement that returns early.

Open in Gerrit

Related details

Attention is currently required from:
  • Alison Maher
  • Kevin Babbitt
  • Sam Davis Omekara
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
Gerrit-Change-Number: 6175331
Gerrit-PatchSet: 16
Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-CC: Javier Fernandez <jfern...@igalia.com>
Gerrit-CC: Oriol Brufau <obr...@igalia.com>
Gerrit-Attention: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Attention: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Attention: Alison Maher <alm...@microsoft.com>
Gerrit-Comment-Date: Mon, 03 Feb 2025 21:42:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Alison Maher (Gerrit)

unread,
Feb 3, 2025, 5:32:51 PM2/3/25
to Sam Davis Omekara, Kurt Catti-Schmidt, Kevin Babbitt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Kevin Babbitt and Sam Davis Omekara

Alison Maher added 5 comments

Commit Message
Line 7, Patchset 16 (Latest):[Gap Decorations]: Build Gap Intersection Points
Alison Maher . unresolved

High level question: will gap intersections be used in stead of gap geometry, or do we need both?

I somewhat figured the intersection points would inform the gap geometry we end up storing as opposed to the other way around

File third_party/blink/renderer/core/layout/gap_fragment_data.h
Line 48, Patchset 16 (Latest): // TODO(samomekarajr): Potential optimization. Consider if the list of
// intersection points needs to be stored for each `GapBoundary`. We can use
// two lists on the `GapGeometry` to store the intersection points for the
// entire grid. This will reduce the memory overhead. Intersection points
// are used to paint gap decorations. An intersection point occurs:
// 1. At the center of an intersection between a gap and the container edge.
// 2. At the center of an intersection between gaps in different directions.
Alison Maher . unresolved

nit: I might restructure this to move the TODO downward like so:

```
// Intersection points are used to paint gap decorations. An
// intersection point occurs:
// 1. At the center of an intersection between a gap and the container edge.
// 2. At the center of an intersection between gaps in different directions.
//
// TODO(samomekarajr): Potential optimization. Consider if the list of
// intersection points needs to be stored for each `GapBoundary`. We can use
// two lists on the `GapGeometry` to store the intersection points for the
// entire grid. This will reduce the memory overhead.
```

Also might be worth a link to spec for future reference

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
Line 3952, Patchset 16 (Latest): // TODO(samomekarajr): Potential optimization to consider here. Currently
Alison Maher . resolved

Can be done in a follow up, but this sounds like a nice optimization

Line 3958, Patchset 16 (Latest): for (auto& gap : gap_geometry->GetGapBoundaries(track_direction)) {
Alison Maher . unresolved

Is it possible to compute this info when we build up the gap geometry in `BuildGapGeometry()` instead of looping through them later?

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Line 254, Patchset 16 (Latest):TEST_F(GridLayoutAlgorithmTest, GridLayoutAlgorithmGapIntersections) {
Alison Maher . unresolved

It may be interesting to have items that span, as well, to test that scenario out

Open in Gerrit

Related details

Attention is currently required from:
Gerrit-Comment-Date: Mon, 03 Feb 2025 22:32:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Sam Davis Omekara (Gerrit)

unread,
Feb 4, 2025, 5:12:06 PM2/4/25
to Kurt Catti-Schmidt, Alison Maher, Kevin Babbitt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Alison Maher and Kevin Babbitt

Sam Davis Omekara added 5 comments

Commit Message
Line 7, Patchset 16:[Gap Decorations]: Build Gap Intersection Points
Alison Maher . unresolved

High level question: will gap intersections be used in stead of gap geometry, or do we need both?

I somewhat figured the intersection points would inform the gap geometry we end up storing as opposed to the other way around

Sam Davis Omekara

Hmm, I didn't quite see it that way. Here's the high-level design as I envision it:

1. GapGeometry: A container that holds gaps.
2. GapBoundary: Defines the start and end boundaries for each gap within the container.
3. GapIntersections: Points along each gap boundary where the gap intersects with either the container edges or other gaps.

File third_party/blink/renderer/core/layout/gap_fragment_data.h
Line 48, Patchset 16: // TODO(samomekarajr): Potential optimization. Consider if the list of

// intersection points needs to be stored for each `GapBoundary`. We can use
// two lists on the `GapGeometry` to store the intersection points for the
// entire grid. This will reduce the memory overhead. Intersection points
// are used to paint gap decorations. An intersection point occurs:
// 1. At the center of an intersection between a gap and the container edge.
// 2. At the center of an intersection between gaps in different directions.
Alison Maher . resolved

nit: I might restructure this to move the TODO downward like so:

```
// Intersection points are used to paint gap decorations. An
// intersection point occurs:
// 1. At the center of an intersection between a gap and the container edge.
// 2. At the center of an intersection between gaps in different directions.
//
// TODO(samomekarajr): Potential optimization. Consider if the list of
// intersection points needs to be stored for each `GapBoundary`. We can use
// two lists on the `GapGeometry` to store the intersection points for the
// entire grid. This will reduce the memory overhead.
```

Also might be worth a link to spec for future reference

Sam Davis Omekara

Done

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
Line 3950, Patchset 16: const auto container_end = cross_tracks[cross_tracks.size() - 1];
Kurt Catti-Schmidt . resolved

Is it possible for `cross_tracks` to be size 0? If so, these array accesses could be out-of-range.

Might be worth adding `DCHECK_GT(cross_tracks(), 0);` before these calls just to be safe. If it's possible to hit, you'll need an `if` statement that returns early.

Sam Davis Omekara

I think it's safe to say cross_tracks is always greater than 0.

Line 3958, Patchset 16: for (auto& gap : gap_geometry->GetGapBoundaries(track_direction)) {
Alison Maher . unresolved

Is it possible to compute this info when we build up the gap geometry in `BuildGapGeometry()` instead of looping through them later?

Sam Davis Omekara

Correct me if I'm wrong but this involves computing intersections on the fly without necessarily looking at the gaps on the cross axis.

If this is right, I was actually thinking about this along with my suggestion of having the intersections reside on the container `GapGeometry` rather than each `GapBoundary`. The idea of intersections residing in `GapGeometry` might work for grid and not flexbox since things don't align as well-defined as grids.


I have updated the code to compute on the fly but still populate to each gap boundary. A heads up is that for flex box I anticipate that we would have to construct gaps first then compute the intersections because we wouldn't know where they are going to lie.

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Line 254, Patchset 16:TEST_F(GridLayoutAlgorithmTest, GridLayoutAlgorithmGapIntersections) {
Alison Maher . unresolved

It may be interesting to have items that span, as well, to test that scenario out

Sam Davis Omekara

This wouldn't change anything about the intersection points (at least for grid). The intersection points for spanning and non spanning items are the same. The difference would be which intersection points we choose to draw from depending on the `*-rule-break` property. The next change will begin handling this.
See intersections in this example: https://drafts.csswg.org/css-gaps-1/#example-8907e768

Open in Gerrit

Related details

Attention is currently required from:
  • Alison Maher
  • Kevin Babbitt
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
Gerrit-Change-Number: 6175331
Gerrit-PatchSet: 17
Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-CC: Javier Fernandez <jfern...@igalia.com>
Gerrit-CC: Oriol Brufau <obr...@igalia.com>
Gerrit-Attention: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Attention: Alison Maher <alm...@microsoft.com>
Gerrit-Comment-Date: Tue, 04 Feb 2025 22:11:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Alison Maher <alm...@microsoft.com>
Comment-In-Reply-To: Kurt Catti-Schmidt <ksc...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Kevin Babbitt (Gerrit)

unread,
Feb 5, 2025, 12:22:42 PM2/5/25
to Sam Davis Omekara, Kurt Catti-Schmidt, Alison Maher, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Alison Maher and Sam Davis Omekara

Kevin Babbitt added 1 comment

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Line 254, Patchset 16:TEST_F(GridLayoutAlgorithmTest, GridLayoutAlgorithmGapIntersections) {
Alison Maher . unresolved

It may be interesting to have items that span, as well, to test that scenario out

Sam Davis Omekara

This wouldn't change anything about the intersection points (at least for grid). The intersection points for spanning and non spanning items are the same. The difference would be which intersection points we choose to draw from depending on the `*-rule-break` property. The next change will begin handling this.
See intersections in this example: https://drafts.csswg.org/css-gaps-1/#example-8907e768

Kevin Babbitt

This wouldn't change anything about the intersection points (at least for grid).

Shouldn't it though? Reference: https://drafts.csswg.org/css-gaps-1/#example-217ec7b6

Note that there is no intersection point between items 2 and 6 in the spot where both items span the same gap. Same for items 4 and 7. I would also expect a 2x2 spanner to suppress the gap intersection point in its "middle".

Open in Gerrit

Related details

Attention is currently required from:
  • Alison Maher
  • Sam Davis Omekara
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
Gerrit-Change-Number: 6175331
Gerrit-PatchSet: 17
Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-CC: Javier Fernandez <jfern...@igalia.com>
Gerrit-CC: Oriol Brufau <obr...@igalia.com>
Gerrit-Attention: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Attention: Alison Maher <alm...@microsoft.com>
Gerrit-Comment-Date: Wed, 05 Feb 2025 17:22:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Sam Davis Omekara <samome...@microsoft.com>
Comment-In-Reply-To: Alison Maher <alm...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Sam Davis Omekara (Gerrit)

unread,
Feb 5, 2025, 1:02:09 PM2/5/25
to Kurt Catti-Schmidt, Alison Maher, Kevin Babbitt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Alison Maher and Kevin Babbitt

Sam Davis Omekara added 1 comment

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Line 254, Patchset 16:TEST_F(GridLayoutAlgorithmTest, GridLayoutAlgorithmGapIntersections) {
Alison Maher . unresolved

It may be interesting to have items that span, as well, to test that scenario out

Sam Davis Omekara

This wouldn't change anything about the intersection points (at least for grid). The intersection points for spanning and non spanning items are the same. The difference would be which intersection points we choose to draw from depending on the `*-rule-break` property. The next change will begin handling this.
See intersections in this example: https://drafts.csswg.org/css-gaps-1/#example-8907e768

Kevin Babbitt

This wouldn't change anything about the intersection points (at least for grid).

Shouldn't it though? Reference: https://drafts.csswg.org/css-gaps-1/#example-217ec7b6

Note that there is no intersection point between items 2 and 6 in the spot where both items span the same gap. Same for items 4 and 7. I would also expect a 2x2 spanner to suppress the gap intersection point in its "middle".

Sam Davis Omekara

Yes, I believe we are on the same page. The data structure being built occurs during the layout phase, and my implementation is strictly based on the definition of an intersection point as described here:

```
A gap intersection point is defined to exist in each of the following locations:

  • The center of an intersection between a gap and the content edge of the container.
  • The center of an intersection between gaps in different directions.
  • ```

Note that there is no mention of spanning items.

The suppression of intersection points will be governed by the `*-rule-break` property, which I envision as occurring during the paint phase. In my view, suppression depends on whether we choose to draw from that intersection point or not, similar to [1]:
```
...
If break is spanning-item, and a line segment from the start to the first item in endpoints, with the same width as the gap, does not intersect a child item in the container.
...

```

So while these are intersection points during layout, they are not considered valid intersection points when constructing pairs (i.e., during the paint phase).

When the `*-rule-break` is set to `none`, every intersection point constructed during layout is considered a valid intersection point.

I think we are aligned in our understanding: we suppress or filter out intersection points during the paint phase. Please let me know if this is clear, and I am open to any suggestions you may have.

[1]: https://drafts.csswg.org/css-gaps-1/#determine-pairs-of-gap-decoration-endpoints

Open in Gerrit

Related details

Attention is currently required from:
  • Alison Maher
  • Kevin Babbitt
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
Gerrit-Change-Number: 6175331
Gerrit-PatchSet: 17
Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-CC: Javier Fernandez <jfern...@igalia.com>
Gerrit-CC: Oriol Brufau <obr...@igalia.com>
Gerrit-Attention: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Attention: Alison Maher <alm...@microsoft.com>
Gerrit-Comment-Date: Wed, 05 Feb 2025 18:01:54 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Kevin Babbitt <kbab...@microsoft.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Sam Davis Omekara (Gerrit)

unread,
Feb 5, 2025, 1:15:44 PM2/5/25
to Kurt Catti-Schmidt, Alison Maher, Kevin Babbitt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Sam Davis Omekara
Gerrit-Comment-Date: Wed, 05 Feb 2025 18:15:33 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Alison Maher (Gerrit)

unread,
Feb 5, 2025, 6:32:30 PM2/5/25
to Sam Davis Omekara, Kurt Catti-Schmidt, Kevin Babbitt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Kevin Babbitt and Sam Davis Omekara

Alison Maher added 6 comments

Commit Message
Line 7, Patchset 16:[Gap Decorations]: Build Gap Intersection Points
Alison Maher . unresolved

High level question: will gap intersections be used in stead of gap geometry, or do we need both?

I somewhat figured the intersection points would inform the gap geometry we end up storing as opposed to the other way around

Sam Davis Omekara

Hmm, I didn't quite see it that way. Here's the high-level design as I envision it:

1. GapGeometry: A container that holds gaps.
2. GapBoundary: Defines the start and end boundaries for each gap within the container.
3. GapIntersections: Points along each gap boundary where the gap intersects with either the container edges or other gaps.

Alison Maher

Maybe this will be clearer from later changes, but I think what isn't clear to me is why we need to store both the boundaries and the intersection points. I kind of would have thought the intersection points may have been enough to paint the gap decorations without needing both pieces of information.

File third_party/blink/renderer/core/layout/gap_fragment_data.h
Line 25, Patchset 17 (Latest): // Fragment 1: Fragment 2:
// +-----------------+ +-------------------+
// | Item 1| |Item 2 | | |
// | | | | | Gap End |
// |_______| |_______| |________ ________|
// | Gap Start | | Item 3 | | Item 4 |
// | | | | | |
// +-----------------+ +-------------------+
Alison Maher . resolved

nit: with the WG resolution, this will no longer be possible, but can be adjusted in a separate change.

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.h
Line 264, Patchset 17 (Latest): // Constructs gap geometry for Gap Decorations. Each gap boundary is
Alison Maher . unresolved

Likely worth adding to the comment about the intersections piece happening here.

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
Line 3934, Patchset 17 (Latest): HeapVector<LayoutUnit>& intersections,
Alison Maher . unresolved

Should this be called `intersection_points` for consistency

Line 3958, Patchset 16: for (auto& gap : gap_geometry->GetGapBoundaries(track_direction)) {
Alison Maher . resolved

Is it possible to compute this info when we build up the gap geometry in `BuildGapGeometry()` instead of looping through them later?

Sam Davis Omekara

Correct me if I'm wrong but this involves computing intersections on the fly without necessarily looking at the gaps on the cross axis.

If this is right, I was actually thinking about this along with my suggestion of having the intersections reside on the container `GapGeometry` rather than each `GapBoundary`. The idea of intersections residing in `GapGeometry` might work for grid and not flexbox since things don't align as well-defined as grids.


I have updated the code to compute on the fly but still populate to each gap boundary. A heads up is that for flex box I anticipate that we would have to construct gaps first then compute the intersections because we wouldn't know where they are going to lie.

Alison Maher

Acknowledged

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Alison Maher

Yeah I think we don't necessarily need to handle supression here, but still may be worth adding some tests around what initial intersection points are created when there are spanners mixed in, as well, since those don't line up with the non-spanners and is an interesting edge case to make sure we have the expected intersections.

Or, for example, as case like https://drafts.csswg.org/css-gaps-1/#example-883084bc would be interesting

Open in Gerrit

Related details

Attention is currently required from:
  • Kevin Babbitt
  • Sam Davis Omekara
Gerrit-Attention: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Comment-Date: Wed, 05 Feb 2025 23:32:19 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Kevin Babbitt (Gerrit)

unread,
Feb 6, 2025, 6:38:52 PM2/6/25
to Sam Davis Omekara, Kurt Catti-Schmidt, Alison Maher, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Sam Davis Omekara

Kevin Babbitt added 1 comment

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Kevin Babbitt

I pushed an [update](https://github.com/w3c/csswg-drafts/commit/f8b28b2155b69d07cf1fef3c6a169cdf83cdd59c) to the spec text to reflect my original intent, which is what was illustrated in the examples. But I don't think I fully understood Sam Davis's comment about suppressing intersection points during paint until after I made that push.

I could revert that update and instead change the algorithm for pairing gap intersection points, and change the examples to illustrate gap intersection points at every intersection. Personally, though, I find the concept of a "gap intersection point" more intuitive as it is with the update, i.e. when it only includes spots where there's a visible intersection between gaps. I'm open to feedback on that if others feel differently, or if it would significantly complicate implementation for some reason.

Open in Gerrit

Related details

Attention is currently required from:
  • Sam Davis Omekara
Gerrit-Attention: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Comment-Date: Thu, 06 Feb 2025 23:38:41 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Sam Davis Omekara (Gerrit)

unread,
Feb 10, 2025, 12:22:41 PM2/10/25
to Kurt Catti-Schmidt, Alison Maher, Kevin Babbitt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Alison Maher and Kevin Babbitt

Sam Davis Omekara added 5 comments

Commit Message
Line 7, Patchset 16:[Gap Decorations]: Build Gap Intersection Points
Alison Maher . resolved

High level question: will gap intersections be used in stead of gap geometry, or do we need both?

I somewhat figured the intersection points would inform the gap geometry we end up storing as opposed to the other way around

Sam Davis Omekara

Hmm, I didn't quite see it that way. Here's the high-level design as I envision it:

1. GapGeometry: A container that holds gaps.
2. GapBoundary: Defines the start and end boundaries for each gap within the container.
3. GapIntersections: Points along each gap boundary where the gap intersects with either the container edges or other gaps.

Alison Maher

Maybe this will be clearer from later changes, but I think what isn't clear to me is why we need to store both the boundaries and the intersection points. I kind of would have thought the intersection points may have been enough to paint the gap decorations without needing both pieces of information.

Sam Davis Omekara

Yeah, I think it'll be clearer. If we were storing the (inline, block) for intersection points there won't be any need for the gap boundaries; but in my opinion (or maybe because it's early on) Having them belong to a gap boundary makes things easier to reason about. It could be a potential optimization in the future. Added this to a TODO.

File third_party/blink/renderer/core/layout/gap_fragment_data.h
Line 25, Patchset 17: // Fragment 1: Fragment 2:

// +-----------------+ +-------------------+
// | Item 1| |Item 2 | | |
// | | | | | Gap End |
// |_______| |_______| |________ ________|
// | Gap Start | | Item 3 | | Item 4 |
// | | | | | |
// +-----------------+ +-------------------+
Alison Maher . resolved

nit: with the WG resolution, this will no longer be possible, but can be adjusted in a separate change.

Sam Davis Omekara

Will prepare a separate change to adjust this.

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.h
Line 264, Patchset 17: // Constructs gap geometry for Gap Decorations. Each gap boundary is
Alison Maher . resolved

Likely worth adding to the comment about the intersections piece happening here.

Sam Davis Omekara

Done

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
Line 3934, Patchset 17: HeapVector<LayoutUnit>& intersections,
Alison Maher . resolved

Should this be called `intersection_points` for consistency

Sam Davis Omekara

Done

File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
Line 254, Patchset 16:TEST_F(GridLayoutAlgorithmTest, GridLayoutAlgorithmGapIntersections) {
Alison Maher . resolved
Sam Davis Omekara

Followed up with Kevin offline and had a fruitful conversation concerning where things are headed. Also added the test for spanners. Closing thread for now. Feel free to open back up if need be.

Open in Gerrit

Related details

Attention is currently required from:
  • Alison Maher
  • Kevin Babbitt
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Review
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
Gerrit-Change-Number: 6175331
Gerrit-PatchSet: 18
Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
Gerrit-CC: Javier Fernandez <jfern...@igalia.com>
Gerrit-CC: Oriol Brufau <obr...@igalia.com>
Gerrit-Attention: Kevin Babbitt <kbab...@microsoft.com>
Gerrit-Attention: Alison Maher <alm...@microsoft.com>
Gerrit-Comment-Date: Mon, 10 Feb 2025 17:22:32 +0000
satisfied_requirement
open
diffy

Kevin Babbitt (Gerrit)

unread,
Feb 10, 2025, 12:36:55 PM2/10/25
to Sam Davis Omekara, Kurt Catti-Schmidt, Alison Maher, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
Attention needed from Alison Maher and Sam Davis Omekara

Kevin Babbitt voted and added 1 comment

Votes added by Kevin Babbitt

Code-Review+1

1 comment

File third_party/blink/renderer/core/layout/gap_fragment_data.h
Line 59, Patchset 18 (Latest): // block_offset), eliminating the need for the GaoBoundary data structure.
Kevin Babbitt . unresolved
```suggestion
// block_offset), eliminating the need for the GapBoundary data structure.
```
Open in Gerrit

Related details

Attention is currently required from:
  • Alison Maher
  • Sam Davis Omekara
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
    Gerrit-Change-Number: 6175331
    Gerrit-PatchSet: 18
    Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
    Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
    Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
    Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
    Gerrit-CC: Javier Fernandez <jfern...@igalia.com>
    Gerrit-CC: Oriol Brufau <obr...@igalia.com>
    Gerrit-Attention: Sam Davis Omekara <samome...@microsoft.com>
    Gerrit-Attention: Alison Maher <alm...@microsoft.com>
    Gerrit-Comment-Date: Mon, 10 Feb 2025 17:36:44 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Alison Maher (Gerrit)

    unread,
    Feb 10, 2025, 5:45:27 PM2/10/25
    to Sam Davis Omekara, Kevin Babbitt, Kurt Catti-Schmidt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org
    Attention needed from Sam Davis Omekara

    Alison Maher voted and added 1 comment

    Votes added by Alison Maher

    Code-Review+1

    1 comment

    File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.h
    Line 269, Patchset 18 (Latest): // `intersection_points`, which will be used to deetermine pairs for painting
    Alison Maher . unresolved

    nit: "determine"

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Sam Davis Omekara
    Gerrit-Comment-Date: Mon, 10 Feb 2025 22:45:15 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Sam Davis Omekara (Gerrit)

    unread,
    Feb 11, 2025, 6:26:12 PM2/11/25
    to Alison Maher, Kevin Babbitt, Kurt Catti-Schmidt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org

    Sam Davis Omekara added 2 comments

    File third_party/blink/renderer/core/layout/gap_fragment_data.h
    Line 59, Patchset 18: // block_offset), eliminating the need for the GaoBoundary data structure.
    Kevin Babbitt . resolved
    ```suggestion
    // block_offset), eliminating the need for the GapBoundary data structure.
    ```
    Sam Davis Omekara

    Done

    File third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.h
    Line 269, Patchset 18: // `intersection_points`, which will be used to deetermine pairs for painting
    Alison Maher . resolved

    nit: "determine"

    Sam Davis Omekara

    Done

    Open in Gerrit

    Related details

    Attention set is empty
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Review
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
    Gerrit-Change-Number: 6175331
    Gerrit-PatchSet: 19
    Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
    Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
    Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
    Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
    Gerrit-CC: Javier Fernandez <jfern...@igalia.com>
    Gerrit-CC: Oriol Brufau <obr...@igalia.com>
    Gerrit-Comment-Date: Tue, 11 Feb 2025 23:26:03 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Kevin Babbitt <kbab...@microsoft.com>
    Comment-In-Reply-To: Alison Maher <alm...@microsoft.com>
    satisfied_requirement
    open
    diffy

    Sam Davis Omekara (Gerrit)

    unread,
    Feb 11, 2025, 6:26:31 PM2/11/25
    to Alison Maher, Kevin Babbitt, Kurt Catti-Schmidt, Chromium LUCI CQ, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org

    Sam Davis Omekara voted Commit-Queue+2

    Commit-Queue+2
    Gerrit-Comment-Date: Tue, 11 Feb 2025 23:26:20 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Chromium LUCI CQ (Gerrit)

    unread,
    Feb 11, 2025, 7:11:26 PM2/11/25
    to Sam Davis Omekara, Alison Maher, Kevin Babbitt, Kurt Catti-Schmidt, AyeAye, Ian Kilpatrick, Ethan Jimenez, chromium...@chromium.org, Javier Fernandez, Oriol Brufau, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-revi...@chromium.org, blink-...@chromium.org, zol...@webkit.org

    Chromium LUCI CQ submitted the change with unreviewed changes

    Unreviewed changes

    18 is the latest approved patch-set.
    The change was submitted with unreviewed changes in the following files:

    ```
    The name of the file: third_party/blink/renderer/core/layout/gap_fragment_data.h
    Insertions: 1, Deletions: 1.

    @@ -56,7 +56,7 @@
    // use two lists on the `GapGeometry` to store the intersection points for
    // the entire grid. This might reduce the memory overhead. Also consider
    // storing the intersection points as a list of pairs (inline_offset,
    - // block_offset), eliminating the need for the GaoBoundary data structure.
    + // block_offset), eliminating the need for the GapBoundary data structure.

    HeapVector<LayoutUnit> intersection_points;
    };
    ```
    ```
    The name of the file: third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.h
    Insertions: 1, Deletions: 1.

    @@ -266,7 +266,7 @@
    // For column gaps, the offsets correspond to inline coordinates;
    // for row gaps, they correspond to block coordinates. The first track,
    // midpoint of each gap boundary, and last track are stored in
    - // `intersection_points`, which will be used to deetermine pairs for painting
    + // `intersection_points`, which will be used to determine pairs for painting
    // gap decorations.
    void BuildGapGeometry(GridTrackSizingDirection track_direction,
    const GridLayoutData& layout_data,
    ```

    Change information

    Commit message:
    [Gap Decorations]: Build Gap Intersection Points

    This CL introduces the construction of gap intersection points for gaps
    present in a grid. According to the spec[1], gap decorations are painted
    relative to pairs of gap intersection points and are defined to exist
    at: A) The center of an intersection between a gap and the content edge
    of the container. B) The center of an intersection between gaps in
    different directions.

    Future changes will include the parsing of the `*rule-break` property
    and the `*rule-outset` property. Following this, the painting code will
    be updated to use the intersection pairs.

    [1]: https://drafts.csswg.org/css-gaps-1/#layout-painting
    Bug: 357648037
    Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
    Reviewed-by: Kevin Babbitt <kbab...@microsoft.com>
    Commit-Queue: Sam Davis Omekara <samome...@microsoft.com>
    Reviewed-by: Alison Maher <alm...@microsoft.com>
    Reviewed-by: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Cr-Commit-Position: refs/heads/main@{#1418979}
    Files:
    • M third_party/blink/renderer/core/layout/gap_fragment_data.h
    • M third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
    • M third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.h
    • M third_party/blink/renderer/core/layout/grid/grid_layout_algorithm_test.cc
    Change size: M
    Delta: 4 files changed, 198 insertions(+), 13 deletions(-)
    Branch: refs/heads/main
    Submit Requirements:
    • requirement satisfiedCode-Review: +1 by Alison Maher, +1 by Kevin Babbitt, +1 by Kurt Catti-Schmidt
    Open in Gerrit
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: merged
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ib8bc341a7a4d2f53dedbc18511205aa6d4ab984c
    Gerrit-Change-Number: 6175331
    Gerrit-PatchSet: 20
    Gerrit-Owner: Sam Davis Omekara <samome...@microsoft.com>
    Gerrit-Reviewer: Alison Maher <alm...@microsoft.com>
    Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
    Gerrit-Reviewer: Ethan Jimenez <eth...@microsoft.com>
    Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
    Gerrit-Reviewer: Kevin Babbitt <kbab...@microsoft.com>
    Gerrit-Reviewer: Kurt Catti-Schmidt <ksc...@microsoft.com>
    Gerrit-Reviewer: Sam Davis Omekara <samome...@microsoft.com>
    open
    diffy
    satisfied_requirement
    Reply all
    Reply to author
    Forward
    0 new messages