Commit b28cf9b9 authored by smolnar's avatar smolnar
Browse files

Backed out changeset 457c6c1a18e3 (bug 1763570) for causing...

Backed out changeset 457c6c1a18e3 (bug 1763570) for causing layout/forms/test/test_bug644542.html CLOSED TREE
parent 9382dde8
Loading
Loading
Loading
Loading
+2 −8
Original line number Diff line number Diff line
@@ -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;
}
+4 −11
Original line number Diff line number Diff line
@@ -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": {
+0 −24
Original line number Diff line number Diff line
@@ -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
@@ -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)
@@ -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) {}
        })
    }
}
+0 −48
Original line number Diff line number Diff line
@@ -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