| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <style> | |
| 5 iframe { | |
| 6 border: 10px solid black; | |
| 7 padding: 5px; | |
| 8 margin: 20px; | |
| 9 height: 150px; | |
| 10 width: 300px; | |
| 11 -webkit-box-shadow: 0 0 20px black; | |
| 12 } | |
| 13 | |
| 14 .container { | |
| 15 position: relative; | |
| 16 } | |
| 17 | |
| 18 .overlay { | |
| 19 position: absolute; | |
| 20 width: 50px; | |
| 21 height: 50px; | |
| 22 top: 5px; | |
| 23 left: 5px; | |
| 24 background-color: rgba(0, 0, 0, 0.2); | |
| 25 } | |
| 26 </style> | |
| 27 </head> | |
| 28 <body> | |
| 29 | |
| 30 <p> | |
| 31 This tests that layers are rebuilt properly after the page | |
| 32 is restored from the page cache. | |
| 33 </p> | |
| 34 | |
| 35 <!-- Some iframes with composited content. --> | |
| 36 <div class="container"> | |
| 37 <iframe src="resources/page-cache-iframe.html"></iframe> | |
| 38 <div class="overlay"></div> | |
| 39 </div> | |
| 40 <div class="container"> | |
| 41 <iframe src="resources/large-composited-subframe.html"></iframe> | |
| 42 <div class="overlay"></div> | |
| 43 </div> | |
| 44 | |
| 45 <!-- Dump the layer tree output here. --> | |
| 46 <pre id="output"></pre> | |
| 47 | |
| 48 <script> | |
| 49 if (window.testRunner) { | |
| 50 window.testRunner.dumpAsText(); | |
| 51 window.testRunner.waitUntilDone(); | |
| 52 window.testRunner.overridePreference("WebKitUsesPageCachePreferenceKey",
1); | |
| 53 } | |
| 54 | |
| 55 function finishTest() { | |
| 56 var output = document.getElementById("output"); | |
| 57 output.innerText = window.internals.layerTreeAsText(document); | |
| 58 | |
| 59 if (window.testRunner) | |
| 60 window.testRunner.notifyDone(); | |
| 61 } | |
| 62 | |
| 63 window.addEventListener("pageshow", function(event) { | |
| 64 alert("pageshow - " + (event.persisted ? "" : "not ") + "from cache"); | |
| 65 if (event.persisted) | |
| 66 setTimeout(finishTest, 0); | |
| 67 }, false); | |
| 68 | |
| 69 window.addEventListener("pagehide", function(event) { | |
| 70 alert("pagehide - " + (event.persisted ? "" : "not ") + "entering cache"
); | |
| 71 }, false); | |
| 72 | |
| 73 // Force a back navigation back to this page. | |
| 74 window.addEventListener("load", function(event) { | |
| 75 setTimeout(function() { | |
| 76 window.location.href = "resources/page-cache-helper.html"; | |
| 77 }, 0); | |
| 78 }, false); | |
| 79 </script> | |
| 80 | |
| 81 </body> | |
| 82 </html> | |
| OLD | NEW |