Bug 1697253 - Hide VisualViewport interface behind the existing pref r=edgar

Bug 1357785 accidentally omitted the flag on the interface itself. This patch makes thing consistent to prevent potential confusion in feature detection.

Differential Revision: https://phabricator.services.mozilla.com/D107742
This commit is contained in:
Kagami Sascha Rosylight 2021-03-11 20:51:51 +00:00
parent 9c3cb69ebc
commit 46f609593d
14 changed files with 49 additions and 18 deletions

View File

@ -33,6 +33,9 @@ function getScrollPosition(bc) {
* for an average page without any frames.
*/
add_task(async function test_scroll() {
// Needed for setScrollPosition()
await pushPrefs(["dom.visualviewport.enabled", true]);
let tab = BrowserTestUtils.addTab(gBrowser, URL);
let browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
@ -83,6 +86,9 @@ add_task(async function test_scroll() {
* for multiple frames of pages with framesets.
*/
add_task(async function test_scroll_nested() {
// Needed for setScrollPosition()
await pushPrefs(["dom.visualviewport.enabled", true]);
let tab = BrowserTestUtils.addTab(gBrowser, URL_FRAMESET);
let browser = tab.linkedBrowser;
await promiseBrowserLoaded(browser);
@ -155,7 +161,11 @@ add_task(async function test_scroll_nested() {
* are preserved as well (bug 1265818).
*/
add_task(async function test_scroll_background_tabs() {
pushPrefs(["browser.sessionstore.restore_on_demand", true]);
await pushPrefs(
["browser.sessionstore.restore_on_demand", true],
// Needed for setScrollPosition()
["dom.visualviewport.enabled", true]
);
let newWin = await BrowserTestUtils.openNewBrowserWindow();
let tab = BrowserTestUtils.addTab(newWin.gBrowser, URL);

View File

@ -19,7 +19,11 @@ requestLongerTimeout(2);
* tabs in a restored window (bug 1153393).
*/
add_task(async function test_scroll_background_about_reader_tabs() {
pushPrefs(["browser.sessionstore.restore_on_demand", true]);
await pushPrefs(
["browser.sessionstore.restore_on_demand", true],
// Needed for setScrollPosition()
["dom.visualviewport.enabled", true]
);
let newWin = await BrowserTestUtils.openNewBrowserWindow();
let tab = BrowserTestUtils.addTab(newWin.gBrowser, READER_MODE_URL);

View File

@ -93,7 +93,9 @@ function test_getUnanimatedComputedStyle() {
}
function test_setDynamicToolbarMaxHeight() {
window.open("file_domwindowutils_dynamic_toolbar.html");
SpecialPowers.pushPrefEnv({
set: [["dom.visualviewport.enabled", true]]
}).then(() => window.open("file_domwindowutils_dynamic_toolbar.html"));
}
var tests = [

View File

@ -12,6 +12,7 @@ SpecialPowers.pushPrefEnv({
"set": [
["apz.allow_zooming", true],
["dom.meta-viewport.enabled", true],
["dom.visualviewport.enabled", true],
]
}, () => {
// We need to open a new window to avoid running tests in an iframe since

View File

@ -1316,7 +1316,7 @@ var interfaceNamesInGlobalScope = [
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "VideoPlaybackQuality", insecureContext: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "VisualViewport", insecureContext: true },
{ name: "VisualViewport", insecureContext: true, android: true },
// IMPORTANT: Do not change this list without review from a DOM peer!
{ name: "VRDisplay", releaseNonWindowsAndMac: false },
// IMPORTANT: Do not change this list without review from a DOM peer!

View File

@ -7,7 +7,8 @@
* https://wicg.github.io/visual-viewport/#the-visualviewport-interface
*/
[Exposed=Window]
[Pref="dom.visualviewport.enabled",
Exposed=Window]
interface VisualViewport : EventTarget {
readonly attribute double offsetLeft;
readonly attribute double offsetTop;

View File

@ -22,8 +22,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1285070
{"file": "helper_bug1502010_unconsumed_pan.html"},
{"file": "helper_bug1544966_zoom_on_touch_action_none.html", "prefs": [...touch_action_prefs]},
{"file": "helper_bug1648491_no_pointercancel_with_dtc.html", "prefs": [...touch_action_prefs]},
{"file": "helper_bug1663731_no_pointercancel_on_second_touchstart.html", "prefs": [...touch_action_prefs]},
{"file": "helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html", "prefs": [...touch_action_prefs]},
{"file": "helper_bug1663731_no_pointercancel_on_second_touchstart.html",
"prefs": [["dom.visualviewport.enabled", true], ...touch_action_prefs]},
{"file": "helper_bug1682170_pointercancel_on_touchaction_pinchzoom.html",
"prefs": [["dom.visualviewport.enabled", true], ...touch_action_prefs]},
];
if (isApzEnabled()) {

View File

@ -15,13 +15,19 @@ var subtests = [
// clicking on element with :active::after CSS property
{"file": "helper_bug1473108.html"},
// Resetting isFirstPaint shouldn't clobber the visual viewport
{"file": "helper_bug1509575.html", "prefs": [["apz.allow_zooming", true],
...getPrefs("TOUCH_EVENTS:PAN")]},
{"file": "helper_bug1509575.html", "prefs": [
["apz.allow_zooming", true],
["dom.visualviewport.enabled", true],
...getPrefs("TOUCH_EVENTS:PAN")
]},
// Exercise one of the main-thread touch-action determination codepaths.
{"file": "helper_bug1506497_touch_action_fixed_on_fixed.html", "prefs": touch_action_prefs},
{"file": "helper_bug1637113_main_thread_hit_test.html", "prefs": [["apz.allow_zooming", true]]},
{"file": "helper_bug1638458_contextmenu.html", "prefs": [["apz.allow_zooming", true]]},
{"file": "helper_bug1638441_fixed_pos_hit_test.html", "prefs": [["apz.allow_zooming", true]]},
{"file": "helper_bug1637113_main_thread_hit_test.html",
"prefs": [["apz.allow_zooming", true], ["dom.visualviewport.enabled", true]]},
{"file": "helper_bug1638458_contextmenu.html",
"prefs": [["apz.allow_zooming", true], ["dom.visualviewport.enabled", true]]},
{"file": "helper_bug1638441_fixed_pos_hit_test.html",
"prefs": [["apz.allow_zooming", true], ["dom.visualviewport.enabled", true]]},
{"file": "helper_bug1637135_narrow_viewport.html", "prefs": [["apz.allow_zooming", true],
["dom.meta-viewport.enabled", true]]},

View File

@ -13,7 +13,10 @@ var basic_pan_prefs = getPrefs("TOUCH_EVENTS:PAN");
var subtests = [
// Simple tests to exercise basic panning behaviour
{"file": "helper_basic_pan.html", "prefs": basic_pan_prefs},
{"file": "helper_basic_pan.html", "prefs": [
["dom.visualviewport.enabled", true],
...basic_pan_prefs
]},
{"file": "helper_div_pan.html", "prefs": basic_pan_prefs},
{"file": "helper_iframe_pan.html", "prefs": basic_pan_prefs},

View File

@ -40,7 +40,8 @@ var prefs = [
// Disable touch resampling so that touch events are processed without delay
// and we don't zoom more than expected due to overprediction.
["android.touch_resampling.enabled", false],
// Tests depend on window.visualViewport
["dom.visualviewport.enabled", true],
];
var instant_repaint_prefs = [

View File

@ -35,6 +35,8 @@ var prefs = [
// Disable touch resampling so that touch events are processed without delay
// and we don't zoom more than expected due to overprediction.
["android.touch_resampling.enabled", false],
// Tests depend on window.visualViewport
["dom.visualviewport.enabled", true],
];
// Increase the tap timeouts so the one-touch-pinch gesture is still detected

View File

@ -9,7 +9,8 @@
<script type="application/javascript">
var subtests = [
{"file": "helper_zoomToFocusedInput_scroll.html"},
{"file": "helper_zoomToFocusedInput_scroll.html",
"prefs": [["dom.visualviewport.enabled", true]]},
{"file": "helper_zoomToFocusedInput_multiline.html"},
{"file": "helper_zoomToFocusedInput_iframe.html"},
];

View File

@ -13,7 +13,7 @@ add_task(async () => {
set: [
["apz.allow_zooming", true],
["dom.meta-viewport.enabled", true],
["dom.visualviewport.enabled,", true],
["dom.visualviewport.enabled", true],
],
});

View File

@ -29,5 +29,3 @@ user_pref("dom.gamepad.non_standard_events.enabled", true);
user_pref("extensions.formautofill.available", "on");
// Enable CSS clip-path `path()` for testing
user_pref("layout.css.clip-path-path.enabled", true);
// Enable visualviewport for testing
user_pref("dom.visualviewport.enabled", true);