Skip to content

Conversation

@chromium-wpt-export-bot
Copy link
Collaborator

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}

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}
Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The review process for this patch is being conducted in the Chromium project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants