A content-visibility: hidden element (the display-lock
holder) stops dirty-bit propagation at itself. A descendant that calls
SetNeedsLayout() marks the holder as
ChildNeedsFullLayout but leaves the chain above it clean.
When the lock is removed,
DisplayLockContext::MarkForLayoutIfNeeded() calls
layout_object->SetChildNeedsLayout() on the holder. That
helper early-returns from MarkContainerChainForLayout() if the
object was already child-dirty -- so ancestors stay clean, the unlocked
subtree is unreachable from the next layout, and
LayoutObject::AssertLaidOut() trips in debug builds.
Call MarkContainerChainForLayout() explicitly in the
child_layout_was_blocked_ branch of
MarkForLayoutIfNeeded(), gated on the
MarkAncestorsOnDisplayLockUnlock runtime flag
(status: "stable", default on, kill switch).
if (child_layout_was_blocked_ || HasStashedScrollOffset()) {
layout_object->SetChildNeedsLayout();
child_layout_was_blocked_ = false;
if (RuntimeEnabledFeatures::MarkAncestorsOnDisplayLockUnlockEnabled()) {
// SetChildNeedsLayout() skips the ancestors when this object was
// already child-dirty, but dirty-bit propagation from the locked
// subtree stopped here, so they are clean.
layout_object->MarkContainerChainForLayout();
}
}
outer clean
lock (c-v:hidden) child-dirty <-- propagation stops here
inner needs-layout <-- the actual dirty node
without the fix, after unlock:
outer still clean <-- not visited by layout
lock child-dirty
inner needs-layout <-- unreachable -> AssertLaidOut (debug)
The sampler at sampler.html?step=3
sets up outer > lock > inner, drops
content-visibility: hidden on lock, mutates
inner.style.width inside the locked subtree, removes the lock,
and reports inner.getBoundingClientRect().width.
inner width.
content_shell
the final layout settles to the same visible state with or without
the fix -- a later paint invalidation re-dirties the chain -- so
the bug is only directly observable as the AssertLaidOut
DCHECK trip in debug.
AssertLaidOut() is a DCHECK-only guard. In a
release build the unlocked subtree still gets laid out eventually -- any
subsequent paint-invalidation walker re-dirties the chain -- so the final
pixels match. The direct observable regression is the debug-build DCHECK
firing, pinned by the two unit tests
(UnlockWithBlockedChildLayoutMarksAncestors and its
...Disabled twin) that assert ChildNeedsFullLayout
on the common ancestor right after unlock.
DisplayLockContextTest.* pass locally.