Bug 1549576 - Store fixed layer margin in session and send to compositor when ready. r=geckoview-reviewers,snorp
authorEitan Isaacson <eitan@monotonous.org>
Tue, 07 May 2019 21:13:29 +0000
changeset 534850 5c8c1f93843a8114a6576bee2989ee0558f52be4
parent 534849 0119df88bee8139c1e4ddadb53ac3faaa6701fd2
child 534851 0bbf778dd16af468eaad9c3d12f8ff823de1a845
push id2082
push userffxbld-merge
push dateMon, 01 Jul 2019 08:34:18 +0000
treeherdermozilla-release@2fb19d0466d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgeckoview-reviewers, snorp
bugs1549576
milestone68.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 1549576 - Store fixed layer margin in session and send to compositor when ready. r=geckoview-reviewers,snorp Differential Revision: https://phabricator.services.mozilla.com/D30132
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java
mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoDisplay.java
@@ -114,17 +114,17 @@ public class GeckoDisplay {
      *
      * @param clippingHeight The height of the bottom clipped space in screen pixels.
      */
     @UiThread
     public void setVerticalClipping(final int clippingHeight) {
         ThreadUtils.assertOnUiThread();
 
         if (mSession != null) {
-            mSession.mCompositor.setFixedBottomOffset(clippingHeight);
+            mSession.setFixedBottomOffset(clippingHeight);
         }
     }
 
     /**
      * Return whether the display should be pinned on the screen.
      *
      * When pinned, the display should not be moved on the screen due to animation, scrolling, etc.
      * A common reason for the display being pinned is when the user is dragging a selection caret
--- a/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoSession.java
@@ -128,16 +128,17 @@ public class GeckoSession implements Par
     private int mLeft;
     private int mTop; // Top of the surface (including toolbar);
     private int mClientTop; // Top of the client area (i.e. excluding toolbar);
     private int mOffsetX;
     private int mOffsetY;
     private int mWidth;
     private int mHeight; // Height of the surface (including toolbar);
     private int mClientHeight; // Height of the client area (i.e. excluding toolbar);
+    private int mFixedBottomOffset; // The margin for fixed elements attached to the bottom of the viewport.
     private float mViewportLeft;
     private float mViewportTop;
     private float mViewportZoom = 1.0f;
 
     //
     // NOTE: These values are also defined in
     // gfx/layers/ipc/UiCompositorControllerMessageTypes.h and must be kept in sync. Any
     // new AnimatorMessageType added here must also be added there.
@@ -4745,16 +4746,25 @@ public class GeckoSession implements Par
             return;
         }
 
         mLeft = left;
         mTop = top;
         onWindowBoundsChanged();
     }
 
+    /* package */ void setFixedBottomOffset(final int offset) {
+        mFixedBottomOffset = offset;
+
+        if (mCompositorReady) {
+            mCompositor.setFixedBottomOffset(mFixedBottomOffset);
+        }
+    }
+
+
     /* package */ void onCompositorAttached() {
         if (DEBUG) {
             ThreadUtils.assertOnUiThread();
         }
 
         mAttachedCompositor = true;
         mCompositor.attachNPZC(mPanZoomController.mNative);
 
@@ -4865,16 +4875,18 @@ public class GeckoSession implements Par
             // compositor now that the compositor is ready.
             onSurfaceChanged(mSurface, mOffsetX, mOffsetY, mWidth, mHeight);
             mSurface = null;
         }
 
         if (mToolbar != null) {
             mToolbar.onCompositorReady();
         }
+
+        mCompositor.setFixedBottomOffset(mFixedBottomOffset);
     }
 
     /* package */ void updateOverscrollVelocity(final float x, final float y) {
         if (DEBUG) {
             ThreadUtils.assertOnUiThread();
         }
 
         if (mOverscroll == null) {