Commit 98175c8a authored by Vladimir Levin's avatar Vladimir Levin Committed by Commit Bot

DL: Add more early outs for inline children paint under display lock.

This patch adds more early outs that were missed during paint. That is
we still paint the self element, but also need to skip child paint,
particularly inline only children which was not done previously.

R=chrishtr@chromium.org

Change-Id: Ib2442ab361447940c1c0e1b4c54b1ee8273d9563
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1720795
Commit-Queue: vmpstr <vmpstr@chromium.org>
Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681872}
parent 8222074e
...@@ -221,7 +221,8 @@ void BlockPainter::PaintObject(const PaintInfo& paint_info, ...@@ -221,7 +221,8 @@ void BlockPainter::PaintObject(const PaintInfo& paint_info,
// above). // above).
if (paint_phase != PaintPhase::kSelfOutlineOnly && if (paint_phase != PaintPhase::kSelfOutlineOnly &&
paint_phase != PaintPhase::kSelfBlockBackgroundOnly && paint_phase != PaintPhase::kSelfBlockBackgroundOnly &&
paint_phase != PaintPhase::kMask) { paint_phase != PaintPhase::kMask &&
!layout_block_.PaintBlockedByDisplayLock(DisplayLockContext::kChildren)) {
// Actually paint the contents. // Actually paint the contents.
if (layout_block_.IsLayoutBlockFlow()) { if (layout_block_.IsLayoutBlockFlow()) {
// All floating descendants will be LayoutBlockFlow objects, and will get // All floating descendants will be LayoutBlockFlow objects, and will get
......
...@@ -273,7 +273,9 @@ void NGBoxFragmentPainter::PaintObject( ...@@ -273,7 +273,9 @@ void NGBoxFragmentPainter::PaintObject(
} }
if (paint_phase != PaintPhase::kSelfOutlineOnly && if (paint_phase != PaintPhase::kSelfOutlineOnly &&
!physical_box_fragment.Children().empty()) { !physical_box_fragment.Children().empty() &&
!box_fragment_.GetLayoutObject()->PaintBlockedByDisplayLock(
DisplayLockContext::kChildren)) {
if (physical_box_fragment.ChildrenInline()) { if (physical_box_fragment.ChildrenInline()) {
DCHECK(paint_fragment_); DCHECK(paint_fragment_);
if (paint_phase != PaintPhase::kFloat) { if (paint_phase != PaintPhase::kFloat) {
......
<!doctype HTML>
<html class="reftest-wait">
<meta charset="utf8">
<title>Display Locking: iframe locking</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-if-nothing-below-ref.html">
<script src="/common/reftest-wait.js"></script>
<style>
div {
contain: style layout;
}
div > div {
contain: style layout;
position: absolute;
top: 50px;
left: 10px;
}
div > div > div {
float: left;
background: red;
width: 10px;
height: 10px;
}
</style>
The test passes if there's nothing below.
<div>
<div id=target1><span>This should not be painted.</span></div>
<div id=target2><div>float div should be hidden too</div></div>
</div>
<script>
async function runTest() {
const target1 = document.getElementById("target1");
const target2 = document.getElementById("target2");
let promises = [];
promises.push(target1.displayLock.acquire({ timeout: Infinity, activatable: true }));
promises.push(target2.displayLock.acquire({ timeout: Infinity, activatable: true }));
await Promise.all(promises);
takeScreenshot();
}
window.onload = () => {
requestAnimationFrame(() => {
requestAnimationFrame(runTest);
});
};
</script>
</html>
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