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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/layout/scroll-anchoring/fixed-using-top.html

Issue 2002623003: Exclude position:absolute elements when picking an anchor for ScrollAnchoring (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <script src="resources/scroll-anchoring-test.js"></script>
5 <style>
6 body {
7 margin: 0px;
8 height: 1500px;
9 }
10 #a {
11 height: 200px;
12 }
13 #b {
14 position: absolute;
15 left: 50px;
16 height:200px;
17 width: 200px;
18 background-color: #fcc;
19 }
20 </style>
21
22 <div id="a"></div>
23 <div id="b"></div>
24
25 <script>
26 internals.runtimeFlags.scrollAnchoringEnabled = true;
27
28 // We start of by scrolling #b out of the viewport by 20px. The scroll handler
29 // fixes #b to the viewport by updating its style.top value. This triggers
30 // layout during which we anchor to #b. Because the scroll handler moves #b
31 // back into the viewport, we make an incorrect adjustment. This adjustment
32 // fires the handler and triggers another layout as #b is scrolled out of the
33 // viewport.
34
35 // The current solution here is for ScrollAnchor to not anchor to absolute
36 // positioned elements.
37
38 var b = document.querySelector('#b');
39 // The initial position of b relative to the document.
40 var initialTop = 200;
41
42 onscroll = function() {
43 var y = scrollY;
44 if (y > initialTop)
45 b.style.top = (y + 10) + 'px';
46 else
47 b.style.top = '';
48 };
49
50 promise_test(function() {
51 var scrollBy = initialTop + 20;
52 return Promise.resolve()
53 .then(() => { eventSender.continuousMouseScrollBy(0, -scrollBy); })
54 .then(() => scrollSettlesAt(scrollBy));
55 }, "Scroll anchoring position fixed using scroll top");
56
57 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698