Backed out changeset 155c1005c388 (bug 1396951)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 22 Sep 2017 11:48:36 +0200
changeset 382397 c24ad4171417a4d7bb10381152432794b5e03acd
parent 382396 866ee4c0900f538827535cf97070530e499878c8
child 382398 ee035fc58bfa813da94d31d22a701c63cc283390
push id32556
push userarchaeopteryx@coole-files.de
push dateFri, 22 Sep 2017 09:49:33 +0000
treeherdermozilla-central@2cd3752963fc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1396951
milestone58.0a1
backs out155c1005c388da8a8a9b5f45d148905eba542a95
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 155c1005c388 (bug 1396951) MozReview-Commit-ID: Egbc73sWnEB
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoView.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -1579,16 +1579,31 @@ public class GeckoAppShell
 
     /* Called by JNI from AndroidBridge, and by reflection from tests/BaseTest.java.in */
     @WrapForJNI(calledFrom = "gecko")
     @RobocopTarget
     public static boolean isTablet() {
         return HardwareUtils.isTablet();
     }
 
+    private static boolean sImeWasEnabledOnLastResize = false;
+    public static void viewSizeChanged() {
+        GeckoView v = (GeckoView) getLayerView();
+        if (v == null) {
+            return;
+        }
+        boolean imeIsEnabled = v.isIMEEnabled();
+        if (imeIsEnabled && !sImeWasEnabledOnLastResize) {
+            // The IME just came up after not being up, so let's scroll
+            // to the focused input.
+            EventDispatcher.getInstance().dispatch("ScrollTo:FocusedInput", null);
+        }
+        sImeWasEnabledOnLastResize = imeIsEnabled;
+    }
+
     @WrapForJNI(calledFrom = "gecko")
     private static double[] getCurrentNetworkInformation() {
         return GeckoNetworkManager.getInstance().getCurrentInformation();
     }
 
     @WrapForJNI(calledFrom = "gecko")
     private static void enableNetworkNotifications() {
         ThreadUtils.postToUiThread(new Runnable() {
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoView.java
@@ -746,18 +746,17 @@ public class GeckoView extends LayerView
     public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
         if (super.onKeyMultiple(keyCode, repeatCount, event)) {
             return true;
         }
         return mInputConnectionListener != null &&
                 mInputConnectionListener.onKeyMultiple(keyCode, repeatCount, event);
     }
 
-    @Override
-    public boolean isIMEEnabled() {
+    /* package */ boolean isIMEEnabled() {
         return mInputConnectionListener != null &&
                 mInputConnectionListener.isIMEEnabled();
     }
 
     public void importScript(final String url) {
         if (url.startsWith("resource://android/assets/")) {
             final GeckoBundle data = new GeckoBundle(1);
             data.putString("scriptURL", url);
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/GeckoLayerClient.java
@@ -28,17 +28,16 @@ class GeckoLayerClient implements LayerV
 {
     private static final String LOGTAG = "GeckoLayerClient";
 
     private final Context mContext;
     private IntSize mScreenSize;
     private IntSize mWindowSize;
 
     private boolean mForceRedraw;
-    private boolean mImeWasEnabledOnLastResize;
 
     /* The current viewport metrics.
      * This is volatile so that we can read and write to it from different threads.
      * We avoid synchronization to make getting the viewport metrics from
      * the compositor as cheap as possible. The viewport is immutable so
      * we don't need to worry about anyone mutating it while we're reading from it.
      * Specifically:
      * 1) reading mViewportMetrics from any thread is fine without synchronization
@@ -149,23 +148,17 @@ class GeckoLayerClient implements LayerV
             // here we send gecko a resize message. The code in browser.js is responsible for
             // picking up on that resize event, modifying the viewport as necessary, and informing
             // us of the new viewport.
             sendResizeEventIfNecessary(true);
 
             // the following call also sends gecko a message, which will be processed after the resize
             // message above has updated the viewport. this message ensures that if we have just put
             // focus in a text field, we scroll the content so that the text field is in view.
-            final boolean imeIsEnabled = mView.isIMEEnabled();
-            if (imeIsEnabled && !mImeWasEnabledOnLastResize) {
-                // The IME just came up after not being up, so let's scroll
-                // to the focused input.
-                EventDispatcher.getInstance().dispatch("ScrollTo:FocusedInput", null);
-            }
-            mImeWasEnabledOnLastResize = imeIsEnabled;
+            GeckoAppShell.viewSizeChanged();
         }
         return true;
     }
 
     PanZoomController getPanZoomController() {
         return mPanZoomController;
     }
 
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/LayerView.java
@@ -819,14 +819,10 @@ public class LayerView extends FrameLayo
             });
             return;
         }
 
         mDefaultClearColor = color;
         if (isCompositorReady()) {
             mCompositor.setDefaultClearColor(mDefaultClearColor);
         }
-    }
-
-    public boolean isIMEEnabled() {
-        return false;
-    }
+   }
 }