summaryrefslogtreecommitdiffstats
path: root/WebKit
diff options
context:
space:
mode:
authorCary Clark <cary@android.com>2010-08-24 10:52:43 -0400
committerCary Clark <cary@android.com>2010-08-24 15:33:14 -0400
commit016ea440f1b61a966483fc809a078dd28b784e46 (patch)
tree07052cb749cb1352f7b27e13a17cd7f4f6244463 /WebKit
parentc570a147a94b126d4172c30914f53dea17b4c8f5 (diff)
downloadexternal_webkit-016ea440f1b61a966483fc809a078dd28b784e46.zip
external_webkit-016ea440f1b61a966483fc809a078dd28b784e46.tar.gz
external_webkit-016ea440f1b61a966483fc809a078dd28b784e46.tar.bz2
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 frameworks/base Change-Id: I78846214048b038cd8d0401dad103d451cd5a269 http://b/2621902
Diffstat (limited to 'WebKit')
-rw-r--r--WebKit/android/jni/WebViewCore.cpp26
-rw-r--r--WebKit/android/jni/WebViewCore.h2
2 files changed, 28 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 3b4872f..e81e335 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -210,6 +210,7 @@ struct WebViewCoreFields {
jfieldID m_viewportUserScalable;
jfieldID m_viewportDensityDpi;
jfieldID m_webView;
+ jfieldID m_drawIsPaused;
} gWebViewCoreFields;
// ----------------------------------------------------------------------------
@@ -918,6 +919,13 @@ void WebViewCore::contentInvalidate(const WebCore::IntRect &r)
contentDraw();
}
+void WebViewCore::contentInvalidateAll()
+{
+ WebCore::FrameView* view = m_mainFrame->view();
+ contentInvalidate(WebCore::IntRect(0, 0,
+ view->contentsWidth(), view->contentsHeight()));
+}
+
void WebViewCore::offInvalidate(const WebCore::IntRect &r)
{
// FIXME: these invalidates are offscreen, and can be throttled or
@@ -2858,6 +2866,13 @@ void WebViewCore::notifyWebAppCanBeInstalled()
checkException(env);
}
+bool WebViewCore::drawIsPaused() const
+{
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ return env->GetBooleanField(m_javaGlue->object(env).get(),
+ gWebViewCoreFields.m_drawIsPaused);
+}
+
//----------------------------------------------------------------------
// Native JNI methods
//----------------------------------------------------------------------
@@ -2952,6 +2967,11 @@ static void Click(JNIEnv *env, jobject obj, int framePtr, int nodePtr)
reinterpret_cast<WebCore::Node*>(nodePtr));
}
+static void ContentInvalidateAll(JNIEnv *env, jobject obj)
+{
+ GET_NATIVE_VIEW(env, obj)->contentInvalidateAll();
+}
+
static void DeleteSelection(JNIEnv *env, jobject obj, jint start, jint end,
jint textGeneration)
{
@@ -3512,6 +3532,8 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) Key },
{ "nativeClick", "(II)V",
(void*) Click },
+ { "nativeContentInvalidateAll", "()V",
+ (void*) ContentInvalidateAll },
{ "nativeSendListBoxChoices", "([ZI)V",
(void*) SendListBoxChoices },
{ "nativeSendListBoxChoice", "(I)V",
@@ -3639,6 +3661,10 @@ int register_webviewcore(JNIEnv* env)
"mWebView", "Landroid/webkit/WebView;");
LOG_ASSERT(gWebViewCoreFields.m_webView,
"Unable to find android/webkit/WebViewCore.mWebView");
+ gWebViewCoreFields.m_drawIsPaused = env->GetFieldID(widget,
+ "mDrawIsPaused", "Z");
+ LOG_ASSERT(gWebViewCoreFields.m_drawIsPaused,
+ "Unable to find android/webkit/WebViewCore.mDrawIsPaused");
return jniRegisterNativeMethods(env, "android/webkit/WebViewCore",
gJavaWebViewCoreMethods, NELEM(gJavaWebViewCoreMethods));
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 11a7228..89cdc8a 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -131,6 +131,7 @@ namespace android {
* Record the invalid rectangle
*/
void contentInvalidate(const WebCore::IntRect &rect);
+ void contentInvalidateAll();
/**
* Satisfy any outstanding invalidates, so that the current state
@@ -494,6 +495,7 @@ namespace android {
WTF::Vector<Container> m_buttons;
bool isPaused() const { return m_isPaused; }
void setIsPaused(bool isPaused) { m_isPaused = isPaused; }
+ bool drawIsPaused() const;
// end of shared members
// internal functions