Bug 1635702 [wpt PR 23413] - Move some internal scroll anchoring tests to wpt, a=testonly
authorBlink WPT Bot <blink-w3c-test-autoroller@chromium.org>
Wed, 13 May 2020 10:02:21 +0000
changeset 531197 1bf83997f32c558dfd201f2142cb54427c9f3914
parent 531196 309e5ac122204a54c3c477cb30d651e178da6060
child 531198 742dba3065f5d30fe17728d6c64e8fc758552229
push id37435
push userapavel@mozilla.com
push dateWed, 20 May 2020 15:28:23 +0000
treeherdermozilla-central@5415da14ec9a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1635702, 23413, 2182735, 765973
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1635702 [wpt PR 23413] - Move some internal scroll anchoring tests to wpt, a=testonly Automatic update from web-platform-tests Move some internal scroll anchoring tests to wpt (#23413) Change-Id: Ic7e3183b490c1f68a3b79f147d00593341b286c8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2182735 Reviewed-by: Nick Burris <nburris@chromium.org> Commit-Queue: Navid Zolghadr <nzolghadr@chromium.org> Cr-Commit-Position: refs/heads/master@{#765973} Co-authored-by: Navid Zolghadr <nzolghadr@chromium.org> -- wpt-commits: 4334e99c203a10db1fa0d23af2b00f04d78283ed wpt-pr: 23413
testing/web-platform/tests/css/css-scroll-anchoring/fragment-scrolling-anchors.html
testing/web-platform/tests/css/css-scroll-anchoring/history-restore-anchors.html
testing/web-platform/tests/css/css-scroll-anchoring/table-collapsed-borders-crash.html
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-anchoring/fragment-scrolling-anchors.html
@@ -0,0 +1,54 @@
+<link rel="help" href="https://drafts.csswg.org/css-scroll-anchoring/">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+  body {
+    margin: 0px;
+    height: 2000px;
+    width: 2000px;
+  }
+
+  #first {
+    height: 1000px;
+    background-color: #FFA5D2;
+  }
+
+  #anchor {
+    position: absolute;
+    background-color: #84BE6A;
+    height: 600px;
+    width: 100%;
+  }
+
+  #fragment {
+    position: relative;
+    background-color: orange;
+    height: 200px;
+    width: 200px;
+    margin: 10px;
+  }
+</style>
+
+<div id="first"></div>
+<div id="changer"></div>
+<div id="anchor">
+    <div id="fragment" name="fragment"></div>
+</div>
+
+<script>
+  test(function(t) {
+    // Note that this test passes even without scroll anchoring because of
+    // fragment anchoring.
+    window.location.hash = 'fragment';
+    // Height of first + fragment margin-top.
+    assert_equals(window.scrollY, 1010);
+
+    // Change height of content above fragment.
+    var ch = document.getElementById('changer');
+    ch.style.height = 100;
+
+    // Height of first + height changer + fragment margin-top.
+    assert_equals(window.scrollY, 1110);
+  }, 'Verify scroll anchoring interaction with fragment scrolls');
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-anchoring/history-restore-anchors.html
@@ -0,0 +1,50 @@
+<link rel="help" href="https://drafts.csswg.org/css-scroll-anchoring/">
+
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+  body {
+    margin: 0px;
+    height: 2000px;
+    width: 2000px;
+  }
+
+  #first {
+    height: 1000px;
+    background-color: #FFA5D2;
+  }
+
+  #anchor {
+    position: absolute;
+    background-color: #84BE6A;
+    height: 600px;
+    width: 100%;
+  }
+</style>
+
+<div id="first"></div>
+<div id="changer"></div>
+<div id="anchor"></div>
+
+<script>
+  // Navigation steps:
+  // 1- page gets loaded and anchor element gets scrolled into view.
+  // 2- loaded page refreshed.
+  async_test(function(t) {
+    if (window.name == 'second/load') {
+      assert_equals(window.scrollY, 1000);
+      // Change height of content above anchor.
+      var ch = document.getElementById('changer');
+      ch.style.height = 100;
+      // Height of first + height changer.
+      assert_equals(window.scrollY, 1100)
+      t.done();
+    } else {
+      var anchor = document.getElementById('anchor');
+      anchor.scrollIntoView();
+      assert_equals(window.scrollY, 1000);
+      window.name = "second/load";
+      window.location.reload();
+    }
+  }, 'Verify scroll anchoring interaction with history restoration');
+</script>
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-anchoring/table-collapsed-borders-crash.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<html class="test-wait">
+<link rel="help" href="https://drafts.csswg.org/css-scroll-anchoring/">
+<link rel="help" href="https://bugs.chromium.org/p/chromium/issues/detail?id=746570">
+<meta name="assert" content="No crash when a table with dirty internal layout is the scroll anchor."/>
+<style>
+body {
+  height:200vh;
+}
+table {
+  height: 200px;
+  width: 200px;
+  background-color: lime;
+  border-collapse: collapse; /* triggers problematic border calculation */
+}
+</style>
+
+<table id=table1></table>
+
+<script>
+  window.scrollBy(0, 10);
+  table1.innerHTML = "<tr><td style='background-color:lightblue'></td></tr>";
+  document.documentElement.classList.remove('test-wait');
+</script>
+</html>