browser_APZ_domain.js (1758B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 "use strict"; 6 7 Services.scriptloader.loadSubScript( 8 "chrome://mochitests/content/browser/gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js", 9 this 10 ); 11 12 // CacheKey::VisualViewportOffset, CacheDomain::APZ 13 addAccessibleTask( 14 `<br><div id="test">test</div>`, 15 async function (browser, docAcc, contentDoc) { 16 // Request this on the top level doc, it won't be cached on any other doc 17 await testAttributeCachePresence( 18 contentDoc ? contentDoc : docAcc, 19 "voffset", 20 async () => { 21 // Call this to activate the APZ domain, if we don't do this 22 // first we will drop the queued cache update triggered by 23 // the subsequent pinchZoomInWithTouch 24 docAcc.getBounds({}, {}, {}, {}); 25 // Doing an APZ queries the visual viewport offset info. 26 info("Pinch zooming..."); 27 await SpecialPowers.spawn(browser, [], async () => { 28 const visualScrollPromise = new Promise(resolve => { 29 content.window.visualViewport.addEventListener("scroll", resolve, { 30 once: true, 31 }); 32 }); 33 const utils = SpecialPowers.getDOMWindowUtils(content.window); 34 utils.setResolutionAndScaleTo(2); 35 utils.scrollToVisual( 36 200, 37 200, 38 utils.UPDATE_TYPE_MAIN_THREAD, 39 utils.SCROLL_MODE_INSTANT 40 ); 41 await visualScrollPromise; 42 }); 43 } 44 ); 45 }, 46 { 47 topLevel: true, 48 iframe: true, 49 remoteIframe: true, 50 cacheDomains: CacheDomain.None, 51 } 52 );