Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/fragment-scrolling-anchors.html

Issue 1895293002: Test fragment scrolling and history restoration interaction w/ scroll anchoring. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/fragment-scrolling-anchors.html
diff --git a/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/fragment-scrolling-anchors.html b/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/fragment-scrolling-anchors.html
new file mode 100644
index 0000000000000000000000000000000000000000..a432afc2a1ea4c01de576ed97642807ea8a508d4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/fragment-scrolling-anchors.html
@@ -0,0 +1,57 @@
+<script src="../../../resources/js-test.js"></script>
+<style>
+ body {
+ margin: 0px; height: 2000px; width: 2000px;
ojan 2016/04/19 21:34:24 Not a big deal, but the de facto standard for test
ymalik 2016/04/22 20:41:05 Done.
+ }
+
+ #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>
+
+<script>
+window.jsTestIsAsync = true;
+setPrintTestResultsLazily();
+
+description("This test ensures that scroll anchoring interacts correctly with\
ojan 2016/04/19 21:34:24 We don't usually have a line length limit on layou
ymalik 2016/04/22 20:41:05 This is removed in the new test.
+ fragment scrolls.");
+
+onload = function() {
+ if (!window.internals) {
+ finishJSTest();
+ return;
+ }
+
+ internals.settings.setScrollAnchoringEnabled(true);
+
+ // Scroll to fragment.
+ window.location.hash = 'fragment';
+ requestAnimationFrame(function() {
+ // Height of first + fragment margin-top.
+ shouldBe('document.scrollingElement.scrollTop', '1010');
+
+ // Change height of content above fragment.
+ var ch = document.getElementById('changer');
+ ch.style.height = 100;
+ // Height of first + height changer + fragment margin-top.
+ shouldBe('document.scrollingElement.scrollTop', '1110');
+ finishJSTest();
+ });
+}
+</script>
+
+<div id="first"></div>
+<div id="changer"></div>
+<div id="anchor">
+ <div id="fragment" name="fragment"></div>
+</div>

Powered by Google App Engine
This is Rietveld 408576698