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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css/sticky/sticky-style-change.html

Issue 2706673002: Mark elements as viewport constrained when they become sticky positioned (Closed)
Patch Set: Address reviewer comments Created 3 years, 9 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/sticky/sticky-style-change-expected.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script>
3 if (window.internals) {
4 internals.settings.setCSSStickyPositionEnabled(true);
5 }
6 </script>
7
8 <html>
9 <head>
10 <style>
11 body {
12 margin: 0;
13 overflow: hidden; /* hide scrollbars */
flackr 2017/02/22 15:43:02 I just noticed this, isn't this making the body an
smcgruer 2017/02/22 16:14:22 As per discussion, this is actually ok because the
14 }
15
16 .container {
17 height: 2000px;
18 }
19
20 .box {
21 height: 50px;
22 }
23
24 .sticky {
25 position: sticky;
26 top: 50px;
27 background-color: green;
28 }
29 </style>
30 <script>
31 if (window.testRunner)
32 testRunner.waitUntilDone()
33
34 function doTest()
35 {
36 const sticky = document.querySelector('.sticky');
37 sticky.style.position = 'relative';
38
39 // Force layout.
40 sticky.offsetTop;
41
42 sticky.style.position = 'sticky';
43
44 window.requestAnimationFrame(function() {
45 window.scrollTo(0, 100);
46 if (window.testRunner)
47 testRunner.notifyDone();
48 });
49 }
50
51 window.addEventListener('load', function() {
52 // We require the compositings inputs to be clean (and thus the initial
53 // sticky position to be calculated) before we stat changing things.
54 // Force this by waiting for a double rAF.
55 window.requestAnimationFrame(function() {
56 window.requestAnimationFrame(function() {
57 doTest();
flackr 2017/02/22 15:43:01 nit: just requestAnimationFrame(doTest); for the i
smcgruer 2017/02/22 16:14:22 Done.
58 });
59 });
60 });
61 </script>
62 </head>
63 <body>
64 <div class="container">
65 <div class="sticky box"></div>
66 </div>
67 </body>
68 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/css/sticky/sticky-style-change-expected.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698