summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/scrolling/scroll-to-origin-with-options-no-layout.html
blob: 5c759fa445a2c5680e3f12a7f181a4bf9a95cb9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<script src="../../resources/js-test.js"></script>
<div id="spanner"></div>
<script>
var styleCount, layoutCount;

function assertSyncLayout(sync) {
    if (window.internals) {
        styleCount = internals.updateStyleAndReturnAffectedElementCount();
        layoutCount = internals.needsLayoutCount();
        // scrollTo should have synchronously updated style and layout
        if (sync) {
            shouldBe("styleCount", "0");
            shouldBe("layoutCount", "0");
        } else {
            shouldNotBe("styleCount", "0");
            shouldNotBe("layoutCount", "0");
        }
    }
}

spanner.style.width = "3000px";
spanner.style.height = "3000px";
scrollTo({ left: 0, top: 1000});
assertSyncLayout(true);
shouldBe("window.scrollY", "1000");

scrollTo({ left: 1000, top: 1000});
assertSyncLayout(true);
shouldBe("window.scrollX", "1000");

spanner.style.height = "2000px";
scrollTo({ left: 0, top: 0});
assertSyncLayout(false);
shouldBe("window.scrollY", "0");

spanner.style.height = "1px";
scrollTo({ left: 0 });
assertSyncLayout(true);

spanner.style.height = "2px";
scrollTo({ top: 0 });
assertSyncLayout(true);

spanner.style.height = "3px";
scrollTo({ });
assertSyncLayout(true);
</script>