diff options
Diffstat (limited to 'Source/WebKit/android/jni')
-rw-r--r-- | Source/WebKit/android/jni/WebSettings.cpp | 30 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 21 |
2 files changed, 49 insertions, 2 deletions
diff --git a/Source/WebKit/android/jni/WebSettings.cpp b/Source/WebKit/android/jni/WebSettings.cpp index 1bd3e36..6aff63e 100644 --- a/Source/WebKit/android/jni/WebSettings.cpp +++ b/Source/WebKit/android/jni/WebSettings.cpp @@ -1,5 +1,7 @@ /* * Copyright 2007, The Android Open Source Project + * Copyright (c) 2011, 2012 Code Aurora Forum. All rights reserved. + * Copyright (C) 2011, Sony Ericsson Mobile Communications AB * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -133,6 +135,9 @@ struct FieldIds { mSyntheticLinksEnabled = env->GetFieldID(clazz, "mSyntheticLinksEnabled", "Z"); mUseDoubleTree = env->GetFieldID(clazz, "mUseDoubleTree", "Z"); mPageCacheCapacity = env->GetFieldID(clazz, "mPageCacheCapacity", "I"); +#if ENABLE(WEBGL) + mWebGLEnabled = env->GetFieldID(clazz, "mWebGLEnabled", "Z"); +#endif #if ENABLE(WEB_AUTOFILL) mAutoFillEnabled = env->GetFieldID(clazz, "mAutoFillEnabled", "Z"); mAutoFillProfile = env->GetFieldID(clazz, "mAutoFillProfile", "Landroid/webkit/WebSettingsClassic$AutoFillProfile;"); @@ -197,6 +202,9 @@ struct FieldIds { ALOG_ASSERT(mPageCacheCapacity, "Could not find field mPageCacheCapacity"); ALOG_ASSERT(mPasswordEchoEnabled, "Could not find field mPasswordEchoEnabled"); ALOG_ASSERT(mMediaPlaybackRequiresUserGesture, "Could not find field mMediaPlaybackRequiresUserGesture"); +#if ENABLE(WEBGL) + ALOG_ASSERT(mWebGLEnabled, "Could not find field mWebGLEnabled"); +#endif jclass enumClass = env->FindClass("java/lang/Enum"); ALOG_ASSERT(enumClass, "Could not find Enum class!"); @@ -247,6 +255,9 @@ struct FieldIds { jfieldID mSyntheticLinksEnabled; jfieldID mUseDoubleTree; jfieldID mPageCacheCapacity; +#if ENABLE(WEBGL) + jfieldID mWebGLEnabled; +#endif // Ordinal() method and value field for enums jmethodID mOrdinal; jfieldID mTextSizeValue; @@ -584,6 +595,11 @@ public: } else s->setUsesPageCache(false); +#if ENABLE(WEBGL) + flag = env->GetBooleanField(obj, gFieldIds->mWebGLEnabled); + s->setWebGLEnabled(flag); +#endif + #if ENABLE(WEB_AUTOFILL) flag = env->GetBooleanField(obj, gFieldIds->mAutoFillEnabled); // TODO: This updates the Settings WebCore side with the user's @@ -623,8 +639,16 @@ public: flag = env->GetBooleanField(obj, gFieldIds->mMediaPlaybackRequiresUserGesture); s->setMediaPlaybackRequiresUserGesture(flag); } -}; + static bool IsWebGLAvailable(JNIEnv* env, jobject obj) + { +#if !ENABLE(WEBGL) + return false; +#else + return true; +#endif + } +}; //------------------------------------------------------------- // JNI registration @@ -632,7 +656,9 @@ public: static JNINativeMethod gWebSettingsMethods[] = { { "nativeSync", "(I)V", - (void*) WebSettings::Sync } + (void*) WebSettings::Sync }, + { "nativeIsWebGLAvailable", "()Z", + (void*) WebSettings::IsWebGLAvailable } }; int registerWebSettings(JNIEnv* env) diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index aa38222..5f3390b 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -1,5 +1,8 @@ /* * Copyright 2006, The Android Open Source Project + * Copyright (C) 2011, 2012 Code Aurora Forum. All rights reserved. + * Copyright (C) 2012 Sony Ericsson Mobile Communications AB. + * Copyright (C) 2012 Sony Mobile Communications AB * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -4859,6 +4862,15 @@ static void Pause(JNIEnv* env, jobject obj, jint nativeClass) WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); Frame* mainFrame = viewImpl->mainFrame(); + + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) { +#if ENABLE(WEBGL) + Document* document = frame->document(); + if (document) + document->suspendDocument(); +#endif + } + if (mainFrame) mainFrame->settings()->setMinDOMTimerInterval(BACKGROUND_TIMER_INTERVAL); @@ -4875,6 +4887,15 @@ static void Resume(JNIEnv* env, jobject obj, jint nativeClass) { WebViewCore* viewImpl = reinterpret_cast<WebViewCore*>(nativeClass); Frame* mainFrame = viewImpl->mainFrame(); + + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) { +#if ENABLE(WEBGL) + Document* document = frame->document(); + if (document) + document->resumeDocument(); +#endif + } + if (mainFrame) mainFrame->settings()->setMinDOMTimerInterval(FOREGROUND_TIMER_INTERVAL); |