Closed Bug 1907674 Opened 11 months ago Closed 11 months ago

[wpt-sync] Sync PR 47118 - [line-clamp] Make `line-clamp: auto` account for margins

Categories

(Core :: Layout: Scrolling and Overflow, task, P4)

task

Tracking

()

RESOLVED FIXED
130 Branch
Tracking Status
firefox130 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 47118 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/47118
Details from upstream follow.

Andreu Botella <abotella@igalia.com> wrote:

[line-clamp] Make line-clamp: auto account for margins

In order for line-clamp: auto to properly clamp lines in nested
block elements, their bottom margin/padding/border must be accounted
for. Our previous patch, https://crrev.com/c/5547983, accounted for
paddings and borders, but margins are more complicated due to margin
collapsing.

Fortunately, some of the complications inherent in margin collapsing
don't apply to line-clamp. Since no boxes that start after the clamp
point should affect the layout, and it doesn't make sense to clamp
inside a self-collapsing box (although it does after one), we don't
need to handle self-collapse as part of line-clamp.

However, because a box's bottom margin can collapse with its
ancestors' bottom margins, the ancestor's bottom margin strut must be
propagated to its children. Rather than computing an end margin strut
inwards-out, as happens during normal layout, we need to have this
data before a box's layout start; so we pass the expected end margin
strut outwards-in, into a box's descendants, which we do by adding
LineClampEndMarginStrut to the constraint space.

Finally, when computing the clamp BFC offset for a box, we know the
ancestors' contribution to the bottom margin has already been
accounted for, so we only account for this box's margin contribution.
Similarly, when checking after layout whether a line or box is past
the clamp point, we compute its margin contribution. We do this by
computing the difference between the margin strut sum the parent
accounted for, and the one that we would get including the current
box's bottom margin.

Bug: 40336192
Change-Id: I1e634a3aeaa071c3355277bdf00c3a44e6eca4a4
Reviewed-on: https://chromium-review.googlesource.com/5690174
WPT-Export-Revision: f7e75bd6a8214b8e7de346f72d1691f5da22a3ee

Component: web-platform-tests → Layout: Scrolling and Overflow
Product: Testing → Core

CI Results

Ran 0 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 6 tests

Status Summary

Firefox

FAIL : 6

Chrome

CRASH: 3
FAIL : 3

Safari

FAIL : 6

Links

GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/453fd47f3a87 [wpt PR 47118] - [line-clamp] Make `line-clamp: auto` account for margins, a=testonly https://hg.mozilla.org/integration/autoland/rev/72037c59c997 [wpt PR 47118] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → 130 Branch
You need to log in before you can comment on or make changes to this bug.