Files
tubestation/testing/web-platform/tests/layout-instability/add-remove-position-fixed.html
Xianzhu Wang 70f8c11ea0 Bug 1690171 [wpt PR 27436] - Ignore layout shifts for adding/removing position:fixed, a=testonly
Automatic update from web-platform-tests
Ignore layout shifts for adding/removing position:fixed

- Treat position:fixed in scrolling LayoutView as layout shift root
  (by checking CompositingReason::kScrollDependentPosition, which
  also covers the previous sticky position condition).

- Check whether an object was a layout shift root at the
  beginning of PaintPropertyTreeBuilder::UpdateForSelf(). Previously
  was_layout_shift_root was incorrect if UpdateFragments() removed
  PaintProperties() of the FragmentData.

- Update layout_shift_root_changed in both UpdateForSelf() and
  UpdateForChildren(), so that the flag also applies to the object
  itself if any paint properties in UpdateForSelf() affected
  layout shift root status.

Bug: 1150657
Change-Id: I74a5e3bab93e66483b47eb27a04e7bf2277ee1c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2665761
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Commit-Queue: Xianzhu Wang <wangxianzhu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#849650}

--

wpt-commits: d47b8fbabcc1de1eca266a9aee12f6d348eee93f
wpt-pr: 27436
2021-02-04 12:08:30 +00:00

36 lines
1.0 KiB
HTML

<!DOCTYPE html>
<title>Layout Instability: no shift for adding/removing position:fixed</title>
<link rel="help" href="https://wicg.github.io/layout-instability/" />
<div id="target" style="width: 100px; height: 100px; background: green;
position: absolute; top: 200px"></div>
<div style="height: 2000px"></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);
window.scrollTo(0, 1000);
target.style.position = 'fixed';
target.style.top = 0;
await waitForAnimationFrames(3);
assert_equals(watcher.score, 0);
window.scrollTo(0, 100);
target.style.position = 'absolute';
target.style.top = '200px';
await waitForAnimationFrames(3);
assert_equals(watcher.score, 0);
}, "No shift for adding/removing position:fixed.");
</script>