From 75796bbef7cc2cc510460790afd7a6abc6034e98 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Tue, 24 Aug 2010 14:59:58 -0400 Subject: [PATCH] communicate drawing pause to webkit to pause gif animation Gif frames continue even if the webkit changes aren't drawn. When we suspend drawing, suspend the gif animation as well. This is accomplished by fooling webkit into thinking the browser window is offscreen. When the webkit drawing is resumed, invalidate the entire content so the gif animations start up once more. requires companion change in external/webkit http://b/2621902 Change-Id: I1814aa41630820872d62752b75ae94383fdcc5fc --- core/java/android/webkit/WebViewCore.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java index a009d89a10987..fad432323ddf8 100644 --- a/core/java/android/webkit/WebViewCore.java +++ b/core/java/android/webkit/WebViewCore.java @@ -441,6 +441,8 @@ final class WebViewCore { */ private native void nativeClearContent(); + private native void nativeContentInvalidateAll(); + /** * Redraw a portion of the picture set. The Point wh returns the * width and height of the overall picture. @@ -1880,10 +1882,10 @@ final class WebViewCore { synchronized (core) { core.mDrawIsPaused = false; - if (core.mDrawIsScheduled) { - core.mDrawIsScheduled = false; - core.contentDraw(); - } + // always redraw on resume to reenable gif animations + core.mDrawIsScheduled = false; + core.nativeContentInvalidateAll(); + core.contentDraw(); } } }