Bug 1671331. Create a new test-only pref that disables the zoom part of ZoomToFocusedInput and use it in layout/base/tests/ mochitests. r=botond

layout/base/tests/test_bug332655-1.html calls focus on an element, this triggers a call to zoomToFocusedInput. This can zoom the parent document of the test, the mochitest harness.

Then test layout/base/tests/test_bug667512.html runs. It ends by synthesizing a left arrow key and then a right arrow key. With the old scrollbar code this results in no scrolling because there is no layout scrolling that can be done either in the test or the parent document. With the new scrollbar code we can scroll the visual viewport using the keyboard so this scrolls the visual viewport of the test harness (because it got zoomed from a previous test).

The test harness being scrolled means that the synthesized click in the next test test_bug677878 can not hit its intended target.

Using the pref apz.zoom-to-focused-input.enabled to disable zoom to focused input in this directory does work to fix this, but I'm tired of doing that.

I think the proper fix here would be to disable scrolling/zooming of the test harness document. Since it's the root content document and it is not scrollable if not zoomed this is equivalent to disabling the zooming part of zoom to focused input (except for tests that open their own window). To test the zooming part of zoom to focused input we can use a test that opens it's own window: we have gfx/layers/apz/test/mochitest/test_group_zoomToFocusedInput.html for this.

We already have the pref formhelper.autozoom would seems like it would work for this purpose, except it is entangled with java stuff in mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java that I don't really understand that means setting the pref in mochitest.ini doesn't seem to take affect.

So I created a new pref we can use specifically for this purpose. Hopefully we can use it instead of fully disabling the zoom to focused input, so we more closely test what we ship.

Differential Revision: https://phabricator.services.mozilla.com/D95423
This commit is contained in:
Timothy Nikkel 2020-10-30 23:32:09 +00:00
parent 781c73b968
commit 2cabfdfe65
3 changed files with 6 additions and 1 deletions

View File

@ -2686,7 +2686,9 @@ nsDOMWindowUtils::ZoomToFocusedInput() {
} }
uint32_t flags = layers::DISABLE_ZOOM_OUT; uint32_t flags = layers::DISABLE_ZOOM_OUT;
if (!Preferences::GetBool("formhelper.autozoom")) { if (!Preferences::GetBool("formhelper.autozoom") ||
Preferences::GetBool("formhelper.autozoom.force-disable.test-only",
/* aFallback = */ false)) {
flags |= layers::PAN_INTO_VIEW_ONLY; flags |= layers::PAN_INTO_VIEW_ONLY;
} else { } else {
flags |= layers::ONLY_ZOOM_TO_DEFAULT_SCALE; flags |= layers::ONLY_ZOOM_TO_DEFAULT_SCALE;

View File

@ -1,6 +1,7 @@
[DEFAULT] [DEFAULT]
prefs = prefs =
plugin.load_flash_only=false plugin.load_flash_only=false
formhelper.autozoom.force-disable.test-only=true
support-files = support-files =
Ahem.ttf Ahem.ttf
file_bug842853.html file_bug842853.html

View File

@ -582,6 +582,8 @@ pref("apz.overscroll.stretch_factor", "0.35");
pref("apz.zoom-to-focused-input.enabled", true); pref("apz.zoom-to-focused-input.enabled", true);
pref("formhelper.autozoom.force-disable.test-only", false);
#ifdef XP_MACOSX #ifdef XP_MACOSX
// Whether to run in native HiDPI mode on machines with "Retina"/HiDPI // Whether to run in native HiDPI mode on machines with "Retina"/HiDPI
// display. // display.