mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1698751 [wpt PR 28030] - Skip layout shift tracking for more invisible elements, a=testonly
Automatic update from web-platform-tests Skip layout shift tracking for more invisible elements Besides the current conditions, e.g. visibility:hidden, opacity:0 (which is checked in PaintInvalidator instead of LayoutShiftTracker) etc., also ignore the following invisible elements: - For texts: - if the font is not renderable - if the text contains all whitespaces - For blocks: - if it doesn't have any decorations, and doesn't have any children. For performance and to reduce risk of false-negative of layout shift tracking, the conditions are kept simple. If a developer still get unexpected layout shift for invisible elements, we can suggest adding visibility:hidden to the element to explicitly disable layout shift tracking on the element. See https://ct.skia.org/results/cluster-telemetry/tasks/chromium_perf_runs/wangxianzhu-ChromiumPerf-5677/html/index.html for the change of overall CLS score with this CL. Bug: 1099350 Change-Id: Ib7e89e0331663572d1eef511976556e8b2a96a96 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2743811 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Steve Kobes <skobes@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Cr-Commit-Position: refs/heads/master@{#862593} -- wpt-commits: 48e5e3c75c9d0df0b18ee7628a98bbc85250eedd wpt-pr: 28030
This commit is contained in:
parent
8e5ffacf30
commit
7fcdc5f656
@ -3,7 +3,7 @@
|
||||
<title>Layout Instability entries are not available via the performance timeline</title>
|
||||
<body>
|
||||
<style>
|
||||
#myDiv { position: relative; width: 300px; height: 100px; }
|
||||
#myDiv { position: relative; width: 300px; height: 100px; background: blue; }
|
||||
</style>
|
||||
<div id='myDiv'></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<title>Layout Instability: PerformanceObserver sees entries with buffered flag</title>
|
||||
<body>
|
||||
<style>
|
||||
#myDiv { position: relative; width: 300px; height: 100px; }
|
||||
#myDiv { position: relative; width: 300px; height: 100px; background: blue; }
|
||||
</style>
|
||||
<div id='myDiv'></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<script src="resources/util.js"></script>
|
||||
<div id="parent" style="position: relative; width: 200px; height: 200px;
|
||||
border: 50px solid blue; overflow: hidden">
|
||||
<div id="child" style="width: 400px; height: 400px"></div>
|
||||
<div id="child" style="width: 400px; height: 400px; background: blue"></div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
<div id="parent" style="position: relative; width: 100px; height: 100px; border: 100px solid blue; overflow-x: clip">
|
||||
<div id="child" style="width: 1000px; height: 300px"></div>
|
||||
<div id="child" style="width: 1000px; height: 300px; background: blue"></div>
|
||||
</div>
|
||||
<script>
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
<title>Layout Instability: fully clipped by contain:paint</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div style="contain: paint; height: 0; position: relative">
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px"></div>
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; background: blue"></div>
|
||||
</div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
@ -40,8 +40,8 @@ promise_test(async () => {
|
||||
}
|
||||
</style>
|
||||
<div class=auto>
|
||||
<div style="width: 100px; height: 100px"></div>
|
||||
<div style="width: 100px; height: 100px; background: blue"></div>
|
||||
</div>
|
||||
<div id="target" class=auto style="position: relative; top: 100000px">
|
||||
<div style="width: 100px; height: 100px"></div>
|
||||
<div style="width: 100px; height: 100px; background: blue"></div>
|
||||
</div>
|
@ -23,5 +23,5 @@ promise_test(async () => {
|
||||
}
|
||||
</style>
|
||||
<div id=target>
|
||||
<div style="width: 100px; height: 100px"></div>
|
||||
<div style="width: 100px; height: 100px; background: blue"></div>
|
||||
</div>
|
||||
|
@ -24,6 +24,7 @@ promise_test(async () => {
|
||||
}
|
||||
.contained {
|
||||
height: 100px;
|
||||
background: blue;
|
||||
}
|
||||
</style>
|
||||
<div class=auto><div class=contained></div></div>
|
||||
|
@ -23,5 +23,5 @@ promise_test(async () => {
|
||||
}
|
||||
</style>
|
||||
<div id=target>
|
||||
<div style="width: 100px; height: 100px"></div>
|
||||
<div style="width: 100px; height: 100px; background: blue"></div>
|
||||
</div>
|
||||
|
@ -5,6 +5,7 @@
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: blue;
|
||||
}
|
||||
#target {
|
||||
transform: translateX(0);
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
body { margin: 0; }
|
||||
#clip { width: 0px; height: 600px; overflow: hidden; }
|
||||
#j { position: relative; width: 300px; height: 200px; }
|
||||
#j { position: relative; width: 300px; height: 200px; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id='clip'><div id='j'></div></div>
|
||||
|
@ -9,6 +9,7 @@ body { height: 2000px; }
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
left: 100px;
|
||||
background: yellow;
|
||||
}
|
||||
#f1 { top: 0; }
|
||||
#f2 { top: 150px; will-change: transform; }
|
||||
@ -18,6 +19,7 @@ body { height: 2000px; }
|
||||
height: 100px;
|
||||
left: 450px;
|
||||
top: 0;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -8,6 +8,7 @@
|
||||
position: relative;
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
background: blue;
|
||||
}
|
||||
|
||||
/* Disable the button's focus ring, which otherwise expands its visual rect by
|
||||
|
@ -4,7 +4,7 @@
|
||||
<style>
|
||||
|
||||
#c { position: relative; width: 300px; height: 100px; transform: scale(0.1); }
|
||||
#j { position: relative; width: 100px; height: 10px; }
|
||||
#j { position: relative; width: 100px; height: 10px; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id='c'>
|
||||
|
@ -13,6 +13,7 @@ body { margin: 0; }
|
||||
height: 100vh;
|
||||
left: -2000vw;
|
||||
top: -2000vh;
|
||||
background: blue;
|
||||
}
|
||||
</style>
|
||||
<div id="shifter"></div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<style>
|
||||
body { margin: 0; }
|
||||
#transformed { position: relative; transform: translateX(20px); width: 100px; height: 100px; }
|
||||
#transformed { position: relative; transform: translateX(20px); width: 100px; height: 100px; background: blue; }
|
||||
</style>
|
||||
<div id="transformed"></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -6,7 +6,7 @@
|
||||
body { margin: 0; }
|
||||
#outer { width: 200px; height: 600px; overflow: hidden; }
|
||||
#inner { width: 300px; height: 150px; overflow: hidden; }
|
||||
#j { position: relative; width: 300px; height: 600px; }
|
||||
#j { position: relative; width: 300px; height: 600px; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id='outer'><div id='inner'><div id='j'></div></div></div>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<title>Layout Instability: opacity:0</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px;">
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; background: blue;">
|
||||
</div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<title>Layout Instability: opacity:0</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div id="target" style="position: absolute; top: 0; width: 200px; height: 200px; opacity: 0"></div>
|
||||
<div id="target" style="position: absolute; top: 0; width: 200px; height: 200px; opacity: 0; background: blue"></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<!DOCTYPE html>
|
||||
<title>Layout Instability: opacity:0</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; opacity: 0">
|
||||
<div id="child" style="position: relative; top: 0; width: 200px; height: 200px; opacity: 0.5"></div>
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; opacity: 0; background: blue">
|
||||
<div id="child" style="position: relative; top: 0; width: 200px; height: 200px; opacity: 0.5; background: yellow"></div>
|
||||
</div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
<div id="target" style="width: 300px; height: 300px"></div>
|
||||
<div id="target" style="width: 300px; height: 300px; background: blue"></div>
|
||||
<script>
|
||||
promise_test(async () => {
|
||||
const watcher = new ScoreWatcher;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
body { margin: 0; }
|
||||
#clip { width: 150px; height: 600px; overflow: hidden; }
|
||||
#j { position: relative; width: 300px; height: 200px; }
|
||||
#j { position: relative; width: 300px; height: 200px; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id='clip'><div id='j'></div></div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<title>Layout Instability: observe after user input</title>
|
||||
<body>
|
||||
<style>
|
||||
#myDiv { position: relative; width: 300px; height: 100px; }
|
||||
#myDiv { position: relative; width: 300px; height: 100px; background: blue; }
|
||||
|
||||
/* Disable the button's focus ring, which otherwise expands its visual rect by
|
||||
* 1px on all sides, triggering a layout shift event.
|
||||
|
@ -3,7 +3,7 @@
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<style>
|
||||
|
||||
#shifter { position: relative; width: 100px; height: 100px; direction: rtl; }
|
||||
#shifter { position: relative; width: 100px; height: 100px; direction: rtl; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id='shifter'></div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<style>
|
||||
|
||||
body { margin: 0; }
|
||||
#j { position: absolute; width: 600px; height: 200px; top: 100%; }
|
||||
#j { position: absolute; width: 600px; height: 200px; top: 100%; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id='j'></div>
|
||||
|
@ -0,0 +1,22 @@
|
||||
<!DOCTYPE html>
|
||||
<title>Layout Instability: shift of invisible element not counted</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div id="target" style="width: 100px; height: 100px; position: relative"></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
<script>
|
||||
|
||||
promise_test(async () => {
|
||||
const watcher = new ScoreWatcher;
|
||||
|
||||
// Wait for the initial render to complete.
|
||||
await waitForAnimationFrames(2);
|
||||
|
||||
target.style.top = "200px";
|
||||
|
||||
await waitForAnimationFrames(3);
|
||||
assert_equals(watcher.score, 0);
|
||||
}, "Shift of invisible element not counted.");
|
||||
|
||||
</script>
|
@ -4,7 +4,7 @@
|
||||
<style>
|
||||
|
||||
body { margin: 0; }
|
||||
#j { position: absolute; width: 600px; height: 200px; top: 100%; }
|
||||
#j { position: absolute; width: 600px; height: 200px; top: 100%; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id='j'></div>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<style>
|
||||
|
||||
body { height: 2000px; margin: 0; }
|
||||
#shift { position: relative; width: 300px; height: 200px; }
|
||||
#shift { position: relative; width: 300px; height: 200px; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id="shift"></div>
|
||||
|
@ -6,7 +6,7 @@
|
||||
<script src="resources/test-adapter.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
<style>
|
||||
#shifter { position: relative; width: 300px; height: 200px; }
|
||||
#shifter { position: relative; width: 300px; height: 200px; background: blue; }
|
||||
</style>
|
||||
<div id="shifter"></div>
|
||||
<script>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<style>
|
||||
|
||||
body { margin: 10px; }
|
||||
#shifter { position: relative; width: 300px; height: 100px; }
|
||||
#shifter { position: relative; width: 300px; height: 100px; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id="shifter"></div>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<title>Layout Instability: toJSON</title>
|
||||
<body>
|
||||
<style>
|
||||
#myDiv { position: relative; width: 300px; height: 100px; }
|
||||
#myDiv { position: relative; width: 300px; height: 100px; background: blue; }
|
||||
</style>
|
||||
<div id='myDiv'></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<style>
|
||||
body { margin: 0; }
|
||||
#transformed { position: relative; transform: translateX(20px); width: 100px; height: 100px; }
|
||||
#transformed { position: relative; transform: translateX(20px); width: 100px; height: 100px; background: blue; }
|
||||
#child { width: 400px; height: 400px; }
|
||||
</style>
|
||||
<div id="transformed">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<style>
|
||||
body { margin: 0; }
|
||||
#transformed { position: relative; transform: translateX(20px); width: 100px; height: 100px; }
|
||||
#transformed { position: relative; transform: translateX(20px); width: 100px; height: 100px; background: blue; }
|
||||
#child { width: 400px; height: 400px; }
|
||||
</style>
|
||||
<div id="transformed">
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
body { margin: 0; }
|
||||
#container { transform: translateX(-300px) translateY(-40px); }
|
||||
#shifter { position: relative; width: 600px; height: 140px; }
|
||||
#shifter { position: relative; width: 600px; height: 140px; background: blue; }
|
||||
|
||||
</style>
|
||||
<div id="container">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<title>Layout Instability: visibility:hidden change with layout</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div id="target" style="position: absolute; top: 0; width: 200px; height: 200px; visibility: hidden"></div>
|
||||
<div id="target" style="position: absolute; top: 0; width: 200px; height: 200px; visibility: hidden; background: blue"></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<title>Layout Instability: visibility:hidden</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; visibility: hidden"></div>
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; visibility: hidden; background: blue"></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<title>Layout Instability: visibility:hidden</title>
|
||||
<link rel="help" href="https://wicg.github.io/layout-instability/" />
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px;"></div>
|
||||
<div id="target" style="position: absolute; top: 0; width: 400px; height: 400px; background: blue;"></div>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="resources/util.js"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user