Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d0051c06 authored by Chris Craik's avatar Chris Craik
Browse files

Send animation start notification back to webkit from ui thread

bug:5239801

depends on external/webkit CL: https://android-git.corp.google.com/g/#/c/152559/

Change-Id: I647b5a82680f570c918227dbf57521b862dcfe25
parent 9b518d93
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -4604,13 +4604,14 @@ public class WebView extends AbsoluteLayout
        boolean UIAnimationsRunning = false;
        // Currently for each draw we compute the animation values;
        // We may in the future decide to do that independently.
        if (mNativeClass != 0 && nativeEvaluateLayersAnimations(mNativeClass)) {
        if (mNativeClass != 0 && !canvas.isHardwareAccelerated()
                && nativeEvaluateLayersAnimations(mNativeClass)) {
            UIAnimationsRunning = true;
            // If we have unfinished (or unstarted) animations,
            // we ask for a repaint. We only need to do this in software
            // rendering (with hardware rendering we already have a different
            // method of requesting a repaint)
            if (!canvas.isHardwareAccelerated())
            mWebViewCore.sendMessage(EventHub.NOTIFY_ANIMATION_STARTED);
            invalidate();
        }

@@ -8796,10 +8797,13 @@ public class WebView extends AbsoluteLayout

    /** @hide Called by JNI when pages are swapped (only occurs with hardware
     * acceleration) */
    protected void pageSwapCallback() {
    protected void pageSwapCallback(boolean notifyAnimationStarted) {
        if (inEditingMode()) {
            didUpdateWebTextViewDimensions(ANYWHERE);
        }
        if (notifyAnimationStarted) {
            mWebViewCore.sendMessage(EventHub.NOTIFY_ANIMATION_STARTED);
        }
    }

    void setNewPicture(final WebViewCore.DrawData draw, boolean updateBaseLayer) {
+13 −2
Original line number Diff line number Diff line
@@ -519,7 +519,12 @@ public final class WebViewCore {
    /**
     * Update the layers' content
     */
    private native boolean nativeUpdateLayers(int baseLayer);
    private native boolean nativeUpdateLayers(int nativeClass, int baseLayer);

    /**
     * Notify webkit that animations have begun (on the hardware accelerated content)
     */
    private native void nativeNotifyAnimationStarted(int nativeClass);

    private native boolean nativeFocusBoundsChanged();

@@ -1035,6 +1040,8 @@ public final class WebViewCore {

        static final int PLUGIN_SURFACE_READY = 195;

        static final int NOTIFY_ANIMATION_STARTED = 196;

        // private message ids
        private static final int DESTROY =     200;

@@ -1594,6 +1601,10 @@ public final class WebViewCore {
                            nativePluginSurfaceReady();
                            break;

                        case NOTIFY_ANIMATION_STARTED:
                            nativeNotifyAnimationStarted(mNativeClass);
                            break;

                        case ADD_PACKAGE_NAMES:
                            if (BrowserFrame.sJavaBridge == null) {
                                throw new IllegalStateException("No WebView " +
@@ -2015,7 +2026,7 @@ public final class WebViewCore {
            return;
        }
        // Directly update the layers we last passed to the UI side
        if (nativeUpdateLayers(mLastDrawData.mBaseLayer)) {
        if (nativeUpdateLayers(mNativeClass, mLastDrawData.mBaseLayer)) {
            // If anything more complex than position has been touched, let's do a full draw
            webkitDraw();
        }
+2 −2
Original line number Diff line number Diff line
@@ -110,9 +110,9 @@ public class ProfiledWebView extends WebView {
     * been redrawn.
     */
    @Override
    protected void pageSwapCallback() {
    protected void pageSwapCallback(boolean startAnim) {
        mContentInvalMillis = System.currentTimeMillis() - mContentInvalMillis;
        super.pageSwapCallback();
        super.pageSwapCallback(startAnim);
        Log.d("ProfiledWebView", "REDRAW TOOK " + mContentInvalMillis
                + "millis");
        mIsTesting = true;