author | Michael Comella <michael.l.comella@gmail.com> |
Mon, 08 Jun 2015 12:12:43 -0700 | |
changeset 248153 | c3e6440a410d4b9485c6e58f76fdbb78d9c1ef2e |
parent 248152 | 70924ca5242302f1e0d1a2e5f3dfcd33770154d2 |
child 248154 | 72c07a70fae79ca1fa7411b078919ee87b98d11e |
push id | 60888 |
push user | kwierso@gmail.com |
push date | Thu, 11 Jun 2015 01:38:38 +0000 |
treeherder | mozilla-inbound@39e638ed06bf [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | snorp |
bugs | 1168497 |
milestone | 41.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
|
mobile/android/base/gfx/LayerRenderer.java | file | annotate | diff | comparison | revisions | |
mobile/android/base/gfx/ScrollbarLayer.java | file | annotate | diff | comparison | revisions |
--- a/mobile/android/base/gfx/LayerRenderer.java +++ b/mobile/android/base/gfx/LayerRenderer.java @@ -388,17 +388,17 @@ public class LayerRenderer implements Ta } public Frame createFrame(ImmutableViewportMetrics metrics) { return new Frame(metrics); } class FadeRunnable implements Runnable { private boolean mStarted; - private long mRunAt; + long mRunAt; // Would be private but we need both file access and high performance. void scheduleStartFade(long delay) { mRunAt = SystemClock.elapsedRealtime() + delay; if (!mStarted) { mView.postDelayed(this, delay); mStarted = true; } } @@ -499,17 +499,19 @@ public class LayerRenderer implements Ta if (!mPageContext.fuzzyEquals(mLastPageContext) && !hideScrollbars) { // The viewport or page changed, so show the scrollbars again // as per UX decision. Don't do this if we're disabling scrolling due to // full-screen mode though. mVertScrollLayer.unfade(); mHorizScrollLayer.unfade(); mFadeRunnable.scheduleStartFade(ScrollbarLayer.FADE_DELAY); } else if (mFadeRunnable.timeToFade()) { - boolean stillFading = mVertScrollLayer.fade() | mHorizScrollLayer.fade(); + final long currentMillis = SystemClock.elapsedRealtime(); + final boolean stillFading = mVertScrollLayer.fade(mFadeRunnable.mRunAt, currentMillis) | + mHorizScrollLayer.fade(mFadeRunnable.mRunAt, currentMillis); if (stillFading) { mFadeRunnable.scheduleNextFadeFrame(); } } mLastPageContext = mPageContext; /* Update layers. */ if (rootLayer != null) {
--- a/mobile/android/base/gfx/ScrollbarLayer.java +++ b/mobile/android/base/gfx/ScrollbarLayer.java @@ -15,17 +15,17 @@ import android.util.Log; import java.nio.FloatBuffer; import java.nio.ByteBuffer; public class ScrollbarLayer extends Layer { private static final String LOGTAG = "GeckoScrollbarLayer"; public static final long FADE_DELAY = 500; // milliseconds before fade-out starts - private static final float FADE_AMOUNT = 0.03f; // how much (as a percent) the scrollbar should fade per frame + private static final float FADE_MILLIS = 250; // how long the scrollbar should take to fade private final boolean mVertical; private float mOpacity; private final Rect mDirtyRect; private IntSize mSize; private int[] mTextureIDs; @@ -136,26 +136,27 @@ public class ScrollbarLayer extends Laye private void deactivateProgram() { GLES20.glDisableVertexAttribArray(mTextureHandle); GLES20.glDisableVertexAttribArray(mPositionHandle); GLES20.glUseProgram(0); } /** - * Decrease the opacity of the scrollbar by one frame's worth. + * Set the opacity of the scrollbar depending on how much time has + * passed from the given start time, current time, and the constant duration. * Return true if the opacity was decreased, or false if the scrollbars * are already fully faded out. */ - public boolean fade() { + public boolean fade(final long startMillis, final long currentMillis) { if (FloatUtils.fuzzyEquals(mOpacity, 0.0f)) { return false; } beginTransaction(); // called on compositor thread - mOpacity = Math.max(mOpacity - FADE_AMOUNT, 0.0f); + mOpacity = Math.max(1 - (currentMillis - startMillis) / FADE_MILLIS, 0.0f); endTransaction(); return true; } /** * Restore the opacity of the scrollbar to fully opaque. * Return true if the opacity was changed, or false if the scrollbars * are already fully opaque.