diff options
Diffstat (limited to 'WebKit')
-rw-r--r-- | WebKit/android/jni/WebSettings.cpp | 5 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 43 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 4 | ||||
-rw-r--r-- | WebKit/android/plugins/ANPSoundInterface.cpp | 4 |
4 files changed, 51 insertions, 5 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp index 7d2b12d..73ebf63 100644 --- a/WebKit/android/jni/WebSettings.cpp +++ b/WebKit/android/jni/WebSettings.cpp @@ -92,6 +92,7 @@ struct FieldIds { #if ENABLE(OFFLINE_WEB_APPLICATIONS) mAppCacheEnabled = env->GetFieldID(clazz, "mAppCacheEnabled", "Z"); mAppCachePath = env->GetFieldID(clazz, "mAppCachePath", "Ljava/lang/String;"); + mAppCacheMaxSize = env->GetFieldID(clazz, "mAppCacheMaxSize", "J"); #endif mJavaScriptCanOpenWindowsAutomatically = env->GetFieldID(clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); @@ -123,6 +124,7 @@ struct FieldIds { #if ENABLE(OFFLINE_WEB_APPLICATIONS) LOG_ASSERT(mAppCacheEnabled, "Could not find field mAppCacheEnabled"); LOG_ASSERT(mAppCachePath, "Could not find field mAppCachePath"); + LOG_ASSERT(mAppCacheMaxSize, "Could not find field mAppCacheMaxSize"); #endif LOG_ASSERT(mJavaScriptCanOpenWindowsAutomatically, "Could not find field mJavaScriptCanOpenWindowsAutomatically"); @@ -164,6 +166,7 @@ struct FieldIds { #if ENABLE(OFFLINE_WEB_APPLICATIONS) jfieldID mAppCacheEnabled; jfieldID mAppCachePath; + jfieldID mAppCacheMaxSize; #endif jfieldID mJavaScriptCanOpenWindowsAutomatically; jfieldID mUseWideViewport; @@ -299,6 +302,8 @@ public: WebCore::cacheStorage().setCacheDirectory(path); } } + jlong maxsize = env->GetIntField(obj, gFieldIds->mAppCacheMaxSize); + WebCore::cacheStorage().setMaximumSize(maxsize); #endif flag = env->GetBooleanField(obj, gFieldIds->mJavaScriptCanOpenWindowsAutomatically); s->setJavaScriptCanOpenWindowsAutomatically(flag); diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index f9dfa61..51293b8 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -1372,11 +1372,17 @@ WebCore::String WebViewCore::getSelection(SkRegion* selRgn) DBG_NAV_LOG("!node"); return result; } - WebCore::IntPoint endPt = WebCore::IntPoint(rect.fRight - 2, cy); + WebCore::IntPoint endPt = WebCore::IntPoint(rect.fRight - 1, cy); hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(endPt, false); WebCore::Node* endNode = hitTestResult.innerNode(); if (!endNode) { - DBG_NAV_LOG("!endNode"); + DBG_NAV_LOG("!endNode (right-1)"); + endPt = WebCore::IntPoint(rect.fRight - 2, cy); + hitTestResult = m_mainFrame->eventHandler()->hitTestResultAtPoint(endPt, false); + endNode = hitTestResult.innerNode(); + } + if (!endNode) { + DBG_NAV_LOG("!endNode (right-2)"); return result; } int start = findTextBoxIndex(node, startPt); @@ -1511,6 +1517,26 @@ void WebViewCore::passToJs(int generation, const WebCore::String& current, updateTextfield(focus, false, test); } +void WebViewCore::scrollFocusedTextInput(int x, int y) +{ + WebCore::Node* focus = currentFocus(); + if (!focus) { + DBG_NAV_LOG("!focus"); + clearTextEntry(); + return; + } + WebCore::RenderObject* renderer = focus->renderer(); + if (!renderer || (!renderer->isTextField() && !renderer->isTextArea())) { + DBG_NAV_LOGD("renderer==%p || not text", renderer); + clearTextEntry(); + return; + } + WebCore::RenderTextControl* renderText = + static_cast<WebCore::RenderTextControl*>(renderer); + renderText->setScrollLeft(x); + renderText->setScrollTop(y); +} + void WebViewCore::setFocusControllerActive(bool active) { m_mainFrame->page()->focusController()->setActive(active); @@ -2174,6 +2200,15 @@ static void PassToJs(JNIEnv *env, jobject obj, PlatformKeyboardEvent(keyCode, keyValue, 0, down, cap, fn, sym)); } +static void ScrollFocusedTextInput(JNIEnv *env, jobject obj, jint x, jint y) +{ +#ifdef ANDROID_INSTRUMENT + TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter); +#endif + WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); + viewImpl->scrollFocusedTextInput(x, y); +} + static void SetFocusControllerActive(JNIEnv *env, jobject obj, jboolean active) { #ifdef ANDROID_INSTRUMENT @@ -2624,7 +2659,9 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { { "nativeMoveMouseIfLatest", "(IIII)V", (void*) MoveMouseIfLatest }, { "passToJs", "(ILjava/lang/String;IIZZZZ)V", - (void*) PassToJs } , + (void*) PassToJs }, + { "nativeScrollFocusedTextInput", "(II)V", + (void*) ScrollFocusedTextInput }, { "nativeSetFocusControllerActive", "(Z)V", (void*) SetFocusControllerActive }, { "nativeSaveDocumentState", "(I)V", diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 66ef470..be08830 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -266,6 +266,10 @@ namespace android { int textGeneration); void passToJs(int generation, const WebCore::String& , const WebCore::PlatformKeyboardEvent& ); + /** + * Scroll the focused textfield to (x, y) in document space + */ + void scrollFocusedTextInput(int x, int y); void setFocusControllerActive(bool active); void saveDocumentState(WebCore::Frame* frame); diff --git a/WebKit/android/plugins/ANPSoundInterface.cpp b/WebKit/android/plugins/ANPSoundInterface.cpp index 6b019d1..c4bec1c 100644 --- a/WebKit/android/plugins/ANPSoundInterface.cpp +++ b/WebKit/android/plugins/ANPSoundInterface.cpp @@ -46,7 +46,7 @@ static ANPSampleFormat toANPFormat(int fm) { } } -static android::AudioSystem::audio_format fromANPFormat(ANPSampleFormat fm) { +static int fromANPFormat(ANPSampleFormat fm) { switch (fm) { case kPCM16Bit_ANPSampleFormat: return android::AudioSystem::PCM_16_BIT; @@ -97,7 +97,7 @@ static ANPAudioTrack* ANPCreateTrack(uint32_t sampleRate, track->mTrack = new android::AudioTrack(android::AudioSystem::MUSIC, sampleRate, fromANPFormat(format), - channelCount, + (channelCount > 1) ? android::AudioSystem::CHANNEL_OUT_STEREO : android::AudioSystem::CHANNEL_OUT_MONO, 0, // frameCount 0, // flags callbackProc, |