helper_scrollframe_activation_on_load.html (4221B)
1 <!DOCTYPE HTML> 2 <html id="root-element"> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1151663 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1151663, helper page</title> 9 <script type="application/javascript" src="apz_test_utils.js"></script> 10 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 11 <script src="/tests/SimpleTest/paint_listener.js"></script> 12 <script type="application/javascript"> 13 14 // In this test we have a simple page which is scrollable, with a 15 // scrollable <div> which is also scrollable. We test that the 16 // <div> does not get an initial APZC, since primary scrollable 17 // frame is the page's root scroll frame. 18 19 function test() { 20 // Reconstruct the APZC tree structure in the last paint. 21 var apzcTree = getLastApzcTree(); 22 23 // The apzc tree for this page should consist of a single root APZC, 24 // which either is the RCD with no child APZCs (e10s/B2G case) or has a 25 // single child APZC which is for the RCD (fennec case). If we activate 26 // all scrollframes then we expect there to be a child. 27 var rcd = findRcdNode(apzcTree); 28 ok(rcd != null, "found the RCD node"); 29 30 // For reference when I run this test locally when I modified it to 31 // handle activateAllScrollFrames I got the following values: 32 // rootElement.clientWidth 1280 33 // rootElement.clientHeight 863 34 // rootDisplayPort: {"x":0,"y":0,"w":1280,"h":3200} non wr 35 // rootDisplayPort: {"x":0,"y":0,"w":1280,"h":1792} wr 36 // At this time activateAllScrollFrames is only active with wr fission: 37 // div displayPort: {"x":0,"y":0,"w":50,"h":50} wr fission 38 // theDiv.clientWidth: 50 wr fission 39 // theDiv.clientHeight: 50 wr fission 40 41 let config = getHitTestConfig(); 42 43 let heightMultiplier = SpecialPowers.getCharPref("apz.y_stationary_size_multiplier"); 44 // The effective height multiplier can be reduced for alignment reasons. 45 // The reduction should be no more than a factor of two. 46 heightMultiplier /= 2; 47 info("effective displayport height multipler is " + heightMultiplier); 48 49 let rootDisplayPort = getLastContentDisplayportFor('root-element'); 50 let rootElement = document.getElementById('root-element'); 51 info("rootDisplayPort is " + JSON.stringify(rootDisplayPort)); 52 info("rootElement.clientWidth " + rootElement.clientWidth + 53 " rootElement.clientHeight " + rootElement.clientHeight); 54 ok(rootDisplayPort.width >= rootElement.clientWidth, "rootDisplayPort should be at least as wide as page"); 55 ok(rootDisplayPort.height >= heightMultiplier * rootElement.clientHeight, 56 "rootDisplayPort should be at least as tall as page times heightMultiplier"); 57 58 let displayPort = getLastContentDisplayportFor('thediv'); 59 if (config.activateAllScrollFrames) { 60 is(rcd.children.length, 1, "expected one child on the RCD"); 61 let theDiv = document.getElementById("thediv"); 62 ok(displayPort != null, "should have displayPort"); 63 info("div displayPort: " + JSON.stringify(displayPort)); 64 info("div width: " + theDiv.clientWidth); 65 info("div height: " + theDiv.clientHeight); 66 ok(displayPort.width <= theDiv.clientWidth + 1, "displayPort w should have empty margins"); 67 ok(displayPort.height <= theDiv.clientHeight + 1, "displayPort h should have empty margins"); 68 } else { 69 is(rcd.children.length, 0, "expected no children on the RCD"); 70 ok(displayPort == null, "should not have displayPort"); 71 } 72 } 73 waitUntilApzStable() 74 .then(forceLayerTreeToCompositor) 75 .then(test) 76 .then(subtestDone, subtestFailed); 77 </script> 78 </head> 79 <body> 80 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1151663">Mozilla Bug 1151663</a> 81 <div id="thediv" style="height: 50px; width: 50px; overflow: scroll"> 82 <!-- Put enough content into the subframe to make it have a nonzero scroll range --> 83 <div style="height: 100px; width: 50px"></div> 84 </div> 85 <!-- Put enough content into the page to make it have a nonzero scroll range --> 86 <div style="height: 5000px"></div> 87 </body> 88 </html>