Backed out changeset 457c6c1a18e3 (bug 1763570) for causing layout/forms/test/test_bug644542.html CLOSED TREE
This commit is contained in:
@@ -1473,19 +1473,13 @@ bool BrowserChild::NotifyAPZStateChange(
|
|||||||
const layers::GeckoContentController::APZStateChange& aChange,
|
const layers::GeckoContentController::APZStateChange& aChange,
|
||||||
const int& aArg) {
|
const int& aArg) {
|
||||||
mAPZEventState->ProcessAPZStateChange(aViewId, aChange, aArg);
|
mAPZEventState->ProcessAPZStateChange(aViewId, aChange, aArg);
|
||||||
nsCOMPtr<nsIObserverService> observerService =
|
|
||||||
mozilla::services::GetObserverService();
|
|
||||||
if (aChange ==
|
if (aChange ==
|
||||||
layers::GeckoContentController::APZStateChange::eTransformEnd) {
|
layers::GeckoContentController::APZStateChange::eTransformEnd) {
|
||||||
// This is used by tests to determine when the APZ is done doing whatever
|
// This is used by tests to determine when the APZ is done doing whatever
|
||||||
// it's doing. XXX generify this as needed when writing additional tests.
|
// it's doing. XXX generify this as needed when writing additional tests.
|
||||||
|
nsCOMPtr<nsIObserverService> observerService =
|
||||||
|
mozilla::services::GetObserverService();
|
||||||
observerService->NotifyObservers(nullptr, "APZ:TransformEnd", nullptr);
|
observerService->NotifyObservers(nullptr, "APZ:TransformEnd", nullptr);
|
||||||
observerService->NotifyObservers(nullptr, "PanZoom:StateChange",
|
|
||||||
u"NOTHING");
|
|
||||||
} else if (aChange ==
|
|
||||||
layers::GeckoContentController::APZStateChange::eTransformBegin) {
|
|
||||||
observerService->NotifyObservers(nullptr, "PanZoom:StateChange",
|
|
||||||
u"PANNING");
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,18 +48,11 @@ class GeckoViewAutoFillChild extends GeckoViewActorChild {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "focusin": {
|
case "focusin": {
|
||||||
const element = aEvent.composedTarget;
|
if (
|
||||||
if (!this.contentWindow.HTMLInputElement.isInstance(element)) {
|
this.contentWindow.HTMLInputElement.isInstance(aEvent.composedTarget)
|
||||||
break;
|
) {
|
||||||
|
this.onFocus(aEvent.composedTarget);
|
||||||
}
|
}
|
||||||
GeckoViewUtils.waitForPanZoomState(this.contentWindow).finally(() => {
|
|
||||||
const focusedElement =
|
|
||||||
Services.focus.focusedElement ||
|
|
||||||
element.ownerDocument?.activeElement;
|
|
||||||
if (element == focusedElement) {
|
|
||||||
this.onFocus(focusedElement);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "focusout": {
|
case "focusout": {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ package org.mozilla.geckoview.test
|
|||||||
|
|
||||||
import androidx.test.filters.MediumTest
|
import androidx.test.filters.MediumTest
|
||||||
import android.util.SparseArray
|
import android.util.SparseArray
|
||||||
import android.view.KeyEvent
|
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import org.hamcrest.Matchers.*
|
import org.hamcrest.Matchers.*
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -14,7 +13,6 @@ import org.junit.runner.RunWith
|
|||||||
import org.junit.runners.Parameterized
|
import org.junit.runners.Parameterized
|
||||||
import org.mozilla.geckoview.Autofill
|
import org.mozilla.geckoview.Autofill
|
||||||
import org.mozilla.geckoview.GeckoSession
|
import org.mozilla.geckoview.GeckoSession
|
||||||
import org.mozilla.geckoview.GeckoSession.TextInputDelegate
|
|
||||||
import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.*
|
import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.*
|
||||||
|
|
||||||
@RunWith(Parameterized::class)
|
@RunWith(Parameterized::class)
|
||||||
@@ -512,26 +510,4 @@ class AutofillDelegateTest : BaseSessionTest() {
|
|||||||
assertThat("autofill hint count",
|
assertThat("autofill hint count",
|
||||||
checkAutofillChild(root), equalTo(6))
|
checkAutofillChild(root), equalTo(6))
|
||||||
}
|
}
|
||||||
|
|
||||||
@WithDisplay(width = 100, height = 100)
|
|
||||||
@Test fun autofillWaitForKeyboard() {
|
|
||||||
// Wait for the accessibility nodes to populate.
|
|
||||||
mainSession.loadUri(pageUrl)
|
|
||||||
mainSession.waitForPageStop()
|
|
||||||
|
|
||||||
mainSession.pressKey(KeyEvent.KEYCODE_CTRL_LEFT)
|
|
||||||
mainSession.evaluateJS("document.querySelector('#pass2').focus()")
|
|
||||||
|
|
||||||
sessionRule.waitUntilCalled(object : Autofill.Delegate, TextInputDelegate {
|
|
||||||
@AssertCalled(order = [2])
|
|
||||||
override fun onNodeFocus(session: GeckoSession,
|
|
||||||
node: Autofill.Node,
|
|
||||||
data: Autofill.NodeData) {
|
|
||||||
assertThat("ID should be valid", node, notNullValue())
|
|
||||||
}
|
|
||||||
|
|
||||||
@AssertCalled(order = [1])
|
|
||||||
override fun showSoftInput(session: GeckoSession) {}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,54 +326,6 @@ var GeckoViewUtils = {
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Return promise for waiting for finishing PanZoomState.
|
|
||||||
*
|
|
||||||
* @param aWindow a DOM window.
|
|
||||||
* @return promise
|
|
||||||
*/
|
|
||||||
waitForPanZoomState(aWindow) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
if (
|
|
||||||
!aWindow?.windowUtils.asyncPanZoomEnabled ||
|
|
||||||
!Services.prefs.getBoolPref("apz.zoom-to-focused-input.enabled")
|
|
||||||
) {
|
|
||||||
// No zoomToFocusedInput.
|
|
||||||
resolve();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let timerId = 0;
|
|
||||||
|
|
||||||
const panZoomState = (aSubject, aTopic, aData) => {
|
|
||||||
if (timerId != 0) {
|
|
||||||
// aWindow may be dead object now.
|
|
||||||
try {
|
|
||||||
aWindow.clearTimeout(timerId);
|
|
||||||
} catch (e) {}
|
|
||||||
timerId = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aData === "NOTHING") {
|
|
||||||
Services.obs.removeObserver(panZoomState, "PanZoom:StateChange");
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
Services.obs.addObserver(panZoomState, "PanZoom:StateChange");
|
|
||||||
|
|
||||||
// "GeckoView:ZoomToInput" has the timeout as 500ms when window isn't
|
|
||||||
// resized (it means on-screen-keyboard is already shown).
|
|
||||||
// So after up to 500ms, APZ event is sent. So we need to wait for more
|
|
||||||
// 500ms.
|
|
||||||
timerId = aWindow.setTimeout(() => {
|
|
||||||
// PanZoom state isn't changed. zoomToFocusedInput will return error.
|
|
||||||
Services.obs.removeObserver(panZoomState, "PanZoom:StateChange");
|
|
||||||
reject();
|
|
||||||
}, 600);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add logging functions to the specified scope that forward to the given
|
* Add logging functions to the specified scope that forward to the given
|
||||||
* Log.jsm logger. Currently "debug" and "warn" functions are supported. To
|
* Log.jsm logger. Currently "debug" and "warn" functions are supported. To
|
||||||
|
|||||||
Reference in New Issue
Block a user