tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 12c0174f140e69163218aface4a3fe75dd347841
parent fb8b5f1f5ac28a2ccf800dc335cb83e886119d5e
Author: Ian Kilpatrick <ikilpatrick@chromium.org>
Date:   Fri, 19 Dec 2025 09:16:27 +0000

Bug 2006555 [wpt PR 56781] - [layout] Merge anonymous objects more correctly., a=testonly

Automatic update from web-platform-tests
[layout] Merge anonymous objects more correctly.

Previously we had ad-hoc logic within LayoutBlockFlow and
LayoutFlexibleBox to merge (some) anonymous objects. This logic was
incomplete, and didn't work for all types which needed this behaviour
(e.g. LayoutGrid).

A complex case for this patch is:

```
<div style="display: table-cell;">1</div>
<span id="remove"></span>
<div style="display: table-cell;">2</div>
<script>remove.remove();</script>
```

Before removal the table-cells are each within their own anonymous
table, section, and row. After removal, they should be within the same
table, section, and row.

To do this we attempt to merge objects directly after an object has been
removed from LayoutObjectChildList.

Objects are merged if they they are anonymous, and compatible with the
other object (e.g. the same type typically).

This check is implemented as LayoutBoxModelObject::CanMergeWith.

Document destruction is a useful stress-test of this new code as
removing objects during this phase tests more of the merging code.

As such - this patch depends on the DisableDocumentBeingDestroyed
feature.

All behaviour changes should be behind the flag:
LayoutMergeAnonymousFix

Bug: 468061895
Change-Id: Ic9ac47529509b65943481e114f563ed535c849f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7244131
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1559408}

--

wpt-commits: 70576d87ba2b5c92d0121a5c263ea89a941fcbc0
wpt-pr: 56781

Diffstat:
Atesting/web-platform/tests/css/css-grid/grid-items/anonymous-grid-item-002.html | 10++++++++++
Atesting/web-platform/tests/css/css-grid/grid-items/anonymous-grid-items-002-ref.html | 3+++
2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/testing/web-platform/tests/css/css-grid/grid-items/anonymous-grid-item-002.html b/testing/web-platform/tests/css/css-grid/grid-items/anonymous-grid-item-002.html @@ -0,0 +1,10 @@ +<!DOCTYPE html> +<title>Tests merging of anonymous grid-items</title> +<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-items"> +<link rel="match" href="anonymous-grid-items-002-ref.html"> +<p>There should be a space between "two" and "words" below.</p> +<div style="display:grid">two <span id="remove"></span>words</div> +<script> +document.body.offsetTop; +remove.remove(); +</script> diff --git a/testing/web-platform/tests/css/css-grid/grid-items/anonymous-grid-items-002-ref.html b/testing/web-platform/tests/css/css-grid/grid-items/anonymous-grid-items-002-ref.html @@ -0,0 +1,3 @@ +<!DOCTYPE html> +<p>There should be a space between "two" and "words" below.</p> +<div style="display:grid">two words</div>