Bug 1472140 - 2. Set text input / accessibility views with the session; r=esawin
authorJim Chen <nchen@mozilla.com>
Mon, 30 Jul 2018 16:38:35 -0400
changeset 429277 932cc42e15c10e62960d9a269adcca0c36e7da6d
parent 429276 81459ed973a843ec63735073a6131cbf8aa7baa2
child 429278 42aff55fb6d5ac0d02764fd7d18d530cd244f34f
push id67096
push usernchen@mozilla.com
push dateMon, 30 Jul 2018 22:13:22 +0000
treeherderautoland@932cc42e15c1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersesawin
bugs1472140
milestone63.0a1
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
Bug 1472140 - 2. Set text input / accessibility views with the session; r=esawin Instead of changing the text input / accessibility views during window attachment / detachment, we should change them during session attachment / detachment because those views are associated with the session. MozReview-Commit-ID: G89rnc9ySS1
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoView.java
@@ -210,19 +210,29 @@ public class GeckoView extends FrameLayo
 
         // Cover the view while we are not drawing to the surface.
         coverUntilFirstPaint(Color.WHITE);
 
         GeckoSession session = mSession;
         mSession.releaseDisplay(mDisplay.release());
         mSession.getOverscrollEdgeEffect().setInvalidationCallback(null);
         mSession.getCompositorController().setFirstPaintCallback(null);
+
+        if (mSession.getAccessibility().getView() == this) {
+            mSession.getAccessibility().setView(null);
+        }
+
+        if (mSession.getTextInput().getView() == this) {
+            mSession.getTextInput().setView(null);
+        }
+
         if (session.getSelectionActionDelegate() == mSelectionActionDelegate) {
             mSession.setSelectionActionDelegate(null);
         }
+
         mSession = null;
         return session;
     }
 
     /**
      * Attach a session to this view. The session should be opened before
      * attaching.
      *
@@ -289,16 +299,24 @@ public class GeckoView extends FrameLayo
 
         session.getCompositorController().setFirstPaintCallback(new Runnable() {
             @Override
             public void run() {
                 coverUntilFirstPaint(Color.TRANSPARENT);
             }
         });
 
+        if (session.getTextInput().getView() == null) {
+            session.getTextInput().setView(this);
+        }
+
+        if (session.getAccessibility().getView() == null) {
+            session.getAccessibility().setView(this);
+        }
+
         if (session.getSelectionActionDelegate() == null && mSelectionActionDelegate != null) {
             session.setSelectionActionDelegate(mSelectionActionDelegate);
         }
     }
 
     public GeckoSession getSession() {
         return mSession;
     }
@@ -320,41 +338,27 @@ public class GeckoView extends FrameLayo
         if (mSession == null) {
             setSession(new GeckoSession(), GeckoRuntime.getDefault(getContext()));
         }
 
         if (!mSession.isOpen()) {
             mSession.open(mRuntime);
         }
 
-        if (mSession.getTextInput().getView() == null) {
-            mSession.getTextInput().setView(this);
-        }
-
-        mSession.getAccessibility().setView(this);
-
         super.onAttachedToWindow();
     }
 
     @Override
     public void onDetachedFromWindow() {
         super.onDetachedFromWindow();
 
         if (mSession == null) {
             return;
         }
 
-        if (mSession.getAccessibility().getView() == this) {
-            mSession.getAccessibility().setView(null);
-        }
-
-        if (mSession.getTextInput().getView() == this) {
-            mSession.getTextInput().setView(null);
-        }
-
         // If we saved state earlier, we don't want to close the window.
         if (!mStateSaved && mSession.isOpen()) {
             mSession.close();
         }
     }
 
     @Override
     public boolean gatherTransparentRegion(final Region region) {