forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoverlay-remove-reinsert-view.html
87 lines (75 loc) · 2.3 KB
/
overlay-remove-reinsert-view.html
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<html>
<style>
body {
height: 5000px;
width: 5000px;
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
function getWaitForPresentationUpdateUIScript()
{
return `
(function() {
uiController.doAfterPresentationUpdate(function() {
uiController.uiScriptComplete('');
});
})();`
}
function getUnparentUIScript()
{
return `
(function() {
uiController.removeViewFromWindow(function() {
uiController.uiScriptComplete('');
});
})();`
}
function getReinsertUIScript()
{
return `
(function() {
uiController.addViewToWindow(function() {
uiController.uiScriptComplete('');
});
})();`
}
function dumpLayers(outputId)
{
if (window.internals) {
document.getElementById(outputId).innerText = window.internals.pageOverlayLayerTreeAsText(internals.LAYER_TREE_INCLUDES_TILE_CACHES);
}
}
function doTest()
{
if (!window.testRunner || !testRunner.runUIScript)
return;
internals.installMockPageOverlay("document");
internals.installMockPageOverlay("view");
// Waiting for a presentation update is needed to get the document overlay to become tiled.
testRunner.runUIScript(getWaitForPresentationUpdateUIScript(), function(result) {
dumpLayers('before-layers');
testRunner.runUIScript(getUnparentUIScript(), function(result) {
dumpLayers('view-removed-layers');
testRunner.runUIScript(getReinsertUIScript(), function(result) {
dumpLayers('view-reinsertion-layers');
if (window.testRunner)
testRunner.notifyDone();
});
});
});
}
window.addEventListener('load', doTest, false);
</script>
<body>
<h2>Initial layers</h2>
<pre id="before-layers">Layer tree goes here</pre>
<h2>Layers after removal</h2>
<pre id="view-removed-layers">Layer tree goes here</pre>
<h2>Layers after re-insertion</h2>
<pre id="view-reinsertion-layers">Layer tree goes here</pre>
</body>
</html>