Loading dom/ipc/BrowserChild.cpp +2 −8 Original line number Diff line number Diff line Loading @@ -1473,19 +1473,13 @@ bool BrowserChild::NotifyAPZStateChange( const layers::GeckoContentController::APZStateChange& aChange, const int& aArg) { mAPZEventState->ProcessAPZStateChange(aViewId, aChange, aArg); nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); if (aChange == layers::GeckoContentController::APZStateChange::eTransformEnd) { // 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. nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); 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; } Loading mobile/android/actors/GeckoViewAutoFillChild.jsm +4 −11 Original line number Diff line number Diff line Loading @@ -48,18 +48,11 @@ class GeckoViewAutoFillChild extends GeckoViewActorChild { break; } case "focusin": { const element = aEvent.composedTarget; if (!this.contentWindow.HTMLInputElement.isInstance(element)) { break; } GeckoViewUtils.waitForPanZoomState(this.contentWindow).finally(() => { const focusedElement = Services.focus.focusedElement || element.ownerDocument?.activeElement; if (element == focusedElement) { this.onFocus(focusedElement); if ( this.contentWindow.HTMLInputElement.isInstance(aEvent.composedTarget) ) { this.onFocus(aEvent.composedTarget); } }); break; } case "focusout": { Loading mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AutofillDelegateTest.kt +0 −24 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ package org.mozilla.geckoview.test import androidx.test.filters.MediumTest import android.util.SparseArray import android.view.KeyEvent import android.view.View import org.hamcrest.Matchers.* import org.junit.Test Loading @@ -14,7 +13,6 @@ import org.junit.runner.RunWith import org.junit.runners.Parameterized import org.mozilla.geckoview.Autofill import org.mozilla.geckoview.GeckoSession import org.mozilla.geckoview.GeckoSession.TextInputDelegate import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.* @RunWith(Parameterized::class) Loading Loading @@ -512,26 +510,4 @@ class AutofillDelegateTest : BaseSessionTest() { assertThat("autofill hint count", 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) {} }) } } mobile/android/modules/geckoview/GeckoViewUtils.jsm +0 −48 Original line number Diff line number Diff line Loading @@ -326,54 +326,6 @@ var GeckoViewUtils = { 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 * Log.jsm logger. Currently "debug" and "warn" functions are supported. To Loading Loading
dom/ipc/BrowserChild.cpp +2 −8 Original line number Diff line number Diff line Loading @@ -1473,19 +1473,13 @@ bool BrowserChild::NotifyAPZStateChange( const layers::GeckoContentController::APZStateChange& aChange, const int& aArg) { mAPZEventState->ProcessAPZStateChange(aViewId, aChange, aArg); nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); if (aChange == layers::GeckoContentController::APZStateChange::eTransformEnd) { // 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. nsCOMPtr<nsIObserverService> observerService = mozilla::services::GetObserverService(); 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; } Loading
mobile/android/actors/GeckoViewAutoFillChild.jsm +4 −11 Original line number Diff line number Diff line Loading @@ -48,18 +48,11 @@ class GeckoViewAutoFillChild extends GeckoViewActorChild { break; } case "focusin": { const element = aEvent.composedTarget; if (!this.contentWindow.HTMLInputElement.isInstance(element)) { break; } GeckoViewUtils.waitForPanZoomState(this.contentWindow).finally(() => { const focusedElement = Services.focus.focusedElement || element.ownerDocument?.activeElement; if (element == focusedElement) { this.onFocus(focusedElement); if ( this.contentWindow.HTMLInputElement.isInstance(aEvent.composedTarget) ) { this.onFocus(aEvent.composedTarget); } }); break; } case "focusout": { Loading
mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AutofillDelegateTest.kt +0 −24 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ package org.mozilla.geckoview.test import androidx.test.filters.MediumTest import android.util.SparseArray import android.view.KeyEvent import android.view.View import org.hamcrest.Matchers.* import org.junit.Test Loading @@ -14,7 +13,6 @@ import org.junit.runner.RunWith import org.junit.runners.Parameterized import org.mozilla.geckoview.Autofill import org.mozilla.geckoview.GeckoSession import org.mozilla.geckoview.GeckoSession.TextInputDelegate import org.mozilla.geckoview.test.rule.GeckoSessionTestRule.* @RunWith(Parameterized::class) Loading Loading @@ -512,26 +510,4 @@ class AutofillDelegateTest : BaseSessionTest() { assertThat("autofill hint count", 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) {} }) } }
mobile/android/modules/geckoview/GeckoViewUtils.jsm +0 −48 Original line number Diff line number Diff line Loading @@ -326,54 +326,6 @@ var GeckoViewUtils = { 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 * Log.jsm logger. Currently "debug" and "warn" functions are supported. To Loading