Commit b0660507 authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

DL: Skip placing children in NG Block layout under display-lock.

This patch ensures that we don't try to copy fragment data or set
children positions for a block node that is display-locked.

The added test (adapted from the referenced bug) causes a DCHECK without
code changes and passes with code changes.

R=mstensho@chromium.org, chrishtr@chromium.org, ikilpatrick@chromium.org

Bug: 1006545
Change-Id: I0833d306edd17f893bdb31a327bcfece376fd48d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1822197Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Commit-Queue: vmpstr <vmpstr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699952}
parent 862b001e
......@@ -802,22 +802,27 @@ void NGBlockNode::CopyFragmentDataToLayoutBox(
auto* block_flow = DynamicTo<LayoutBlockFlow>(box_);
LayoutMultiColumnFlowThread* flow_thread = GetFlowThread(block_flow);
if (UNLIKELY(flow_thread)) {
PlaceChildrenInFlowThread(physical_fragment);
} else {
PhysicalOffset offset_from_start;
if (UNLIKELY(constraint_space.HasBlockFragmentation())) {
// Need to include any block space that this container has used in
// previous fragmentainers. The offset of children will be relative to
// the container, in flow thread coordinates, i.e. the model where
// everything is represented as one single strip, rather than being
// sliced and translated into columns.
// TODO(mstensho): writing modes
if (previous_break_token)
offset_from_start.top = previous_break_token->ConsumedBlockSize();
// Position the children inside the box. We skip this if display-lock prevents
// child layout.
if (!LayoutBlockedByDisplayLock(DisplayLockLifecycleTarget::kChildren)) {
if (UNLIKELY(flow_thread)) {
PlaceChildrenInFlowThread(physical_fragment);
} else {
PhysicalOffset offset_from_start;
if (UNLIKELY(constraint_space.HasBlockFragmentation())) {
// Need to include any block space that this container has used in
// previous fragmentainers. The offset of children will be relative to
// the container, in flow thread coordinates, i.e. the model where
// everything is represented as one single strip, rather than being
// sliced and translated into columns.
// TODO(mstensho): writing modes
if (previous_break_token)
offset_from_start.top = previous_break_token->ConsumedBlockSize();
}
PlaceChildrenInLayoutBox(physical_fragment, offset_from_start);
}
PlaceChildrenInLayoutBox(physical_fragment, offset_from_start);
}
LayoutBlock* block = DynamicTo<LayoutBlock>(box_);
......
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: scroll child into view, and adopt to a document</title>
<link rel="author" title="Vladimir Levin" href="mailto:vmpstr@chromium.org">
<link rel="help" href="https://github.com/WICG/display-locking">
<link rel="match" href="pass-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="resources/utils.js"></script>
<div id=log></div>
<div id=container>
<div id=child></div>
</div>
<script>
function finishTest(status_string) {
if (document.getElementById("log").innerHTML === "")
document.getElementById("log").innerHTML = status_string;
takeScreenshot();
}
function moveChild() {
child.scrollIntoView();
document.implementation.createDocument( "", null).adoptNode(child);
finishTest("PASS");
}
async function runTest() {
await setInvisible(container);
requestAnimationFrame(moveChild);
}
window.onload = requestAnimationFrame(runTest);
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment