forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consider transform change countering layout shift
This is to ignore layout shift when transform and location change at the same time, and visual representation is kept unchanged. This happens in many websites containing carousel UI. Summary of layout_shift.cluster_telemetry https://ct.skia.org/results/cluster-telemetry/tasks/chromium_perf_runs/wangxianzhu-ChromiumPerf-5629/html/index.html: mainFrameCumulativeLayoutShift -4.5% overallCumulativeLayoutShift -2.5% Bug: 1169326 Change-Id: Icb8f5748e927753ef244429699cc1396d8cb7f71 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2673965 Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Reviewed-by: Steve Kobes <skobes@chromium.org> Cr-Commit-Position: refs/heads/master@{#854104}
- Loading branch information
1 parent
b69b75d
commit af4f44f
Showing
9 changed files
with
147 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
...party/blink/web_tests/external/wpt/layout-instability/transform-counter-layout-shift.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<title>Layout Instability: no layout shift if transform change counters location change</title> | ||
<link rel="help" href="https://wicg.github.io/layout-instability/" /> | ||
<style> | ||
body { margin: 0; } | ||
#transformed { position: relative; transform: translateX(20px); width: 100px; height: 100px; } | ||
#child { width: 400px; height: 400px; } | ||
</style> | ||
<div id="transformed"> | ||
<div id="child"></div> | ||
</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); | ||
|
||
// Modify the transform and the location at the same time, and the values | ||
// cancel each other visually, for which no shift should be reported. | ||
transformed.style.transform = 'translateY(100px)'; | ||
transformed.style.top = '-100px'; | ||
transformed.style.left = '20px'; | ||
// Change size of child, for which no shift should be reported, either. | ||
child.style.width = '300px'; | ||
|
||
await waitForAnimationFrames(2); | ||
// No shift should be reported. | ||
assert_equals(watcher.score, 0); | ||
}, 'no layout shift if transform change counters location change'); | ||
|
||
</script> |