diff options
Diffstat (limited to 'WebKit/android/jni')
| -rw-r--r-- | WebKit/android/jni/JavaBridge.cpp | 40 | ||||
| -rw-r--r-- | WebKit/android/jni/MIMETypeRegistry.cpp | 60 | ||||
| -rwxr-xr-x | WebKit/android/jni/MockGeolocation.cpp | 4 | ||||
| -rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 38 | ||||
| -rw-r--r-- | WebKit/android/jni/WebCoreJni.cpp | 4 | ||||
| -rw-r--r-- | WebKit/android/jni/WebCoreJniOnLoad.cpp | 20 | ||||
| -rw-r--r-- | WebKit/android/jni/WebCoreResourceLoader.cpp | 14 | ||||
| -rw-r--r-- | WebKit/android/jni/WebHistory.cpp | 9 | ||||
| -rw-r--r-- | WebKit/android/jni/WebIconDatabase.cpp | 13 | ||||
| -rw-r--r-- | WebKit/android/jni/WebStorage.cpp | 11 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 70 | ||||
| -rw-r--r-- | WebKit/android/jni/WebViewCore.h | 7 |
12 files changed, 211 insertions, 79 deletions
diff --git a/WebKit/android/jni/JavaBridge.cpp b/WebKit/android/jni/JavaBridge.cpp index 049a7da..feca297 100644 --- a/WebKit/android/jni/JavaBridge.cpp +++ b/WebKit/android/jni/JavaBridge.cpp @@ -25,10 +25,11 @@ #define LOG_TAG "webcoreglue" -#include <config.h> -#include <wtf/Platform.h> +#include "config.h" +#include "AtomicString.h" #include "Cache.h" +#include "Connection.h" #include "CookieClient.h" #include "JavaSharedClient.h" #include "KeyGeneratorClient.h" @@ -39,17 +40,18 @@ #include "PluginDatabase.h" #include "Timer.h" #include "TimerClient.h" -#include "jni_utility.h" -#include "WebCoreJni.h" - #ifdef ANDROID_INSTRUMENT #include "TimeCounter.h" #endif +#include "WebCoreJni.h" -#include <jni.h> #include <JNIHelp.h> +#include <JNIUtility.h> #include <SkUtils.h> +#include <jni.h> #include <utils/misc.h> +#include <wtf/Platform.h> +#include <wtf/StdLibExtras.h> namespace android { @@ -96,6 +98,7 @@ public: static void SharedTimerFired(JNIEnv* env, jobject); static void SetCacheSize(JNIEnv* env, jobject obj, jint bytes); static void SetNetworkOnLine(JNIEnv* env, jobject obj, jboolean online); + static void SetNetworkType(JNIEnv* env, jobject obj, jstring type, jstring subtype); static void SetDeferringTimers(JNIEnv* env, jobject obj, jboolean defer); static void ServiceFuncPtrQueue(JNIEnv*); static void UpdatePluginDirectories(JNIEnv* env, jobject obj, jobjectArray array, jboolean reload); @@ -344,6 +347,29 @@ void JavaBridge::SetNetworkOnLine(JNIEnv* env, jobject obj, jboolean online) WebCore::networkStateNotifier().networkStateChange(online); } +void JavaBridge::SetNetworkType(JNIEnv* env, jobject obj, jstring javatype, jstring javasubtype) +{ + DEFINE_STATIC_LOCAL(AtomicString, wifi, ("wifi")); + DEFINE_STATIC_LOCAL(AtomicString, mobile, ("mobile")); + DEFINE_STATIC_LOCAL(AtomicString, mobileSupl, ("mobile_supl")); + DEFINE_STATIC_LOCAL(AtomicString, gprs, ("gprs")); + DEFINE_STATIC_LOCAL(AtomicString, edge, ("edge")); + DEFINE_STATIC_LOCAL(AtomicString, umts, ("umts")); + + String type = to_string(env, javatype); + String subtype = to_string(env, javasubtype); + Connection::ConnectionType connectionType = Connection::Unknown; + if (type == wifi) + connectionType = Connection::WiFi; + else if (type == mobile || type == mobileSupl) { + if (subtype == edge || subtype == gprs) + connectionType = Connection::Cell_2G; + else if (subtype == umts) + connectionType = Connection::Cell_3G; + } + WebCore::networkStateNotifier().networkTypeChange(connectionType); +} + void JavaBridge::ServiceFuncPtrQueue(JNIEnv*) { JavaSharedClient::ServiceFunctionPtrQueue(); @@ -383,6 +409,8 @@ static JNINativeMethod gWebCoreJavaBridgeMethods[] = { (void*) JavaBridge::SetCacheSize }, { "setNetworkOnLine", "(Z)V", (void*) JavaBridge::SetNetworkOnLine }, + { "setNetworkType", "(Ljava/lang/String;Ljava/lang/String;)V", + (void*) JavaBridge::SetNetworkType }, { "nativeServiceFuncPtrQueue", "()V", (void*) JavaBridge::ServiceFuncPtrQueue }, { "nativeUpdatePluginDirectories", "([Ljava/lang/String;Z)V", diff --git a/WebKit/android/jni/MIMETypeRegistry.cpp b/WebKit/android/jni/MIMETypeRegistry.cpp new file mode 100644 index 0000000..eec7af6 --- /dev/null +++ b/WebKit/android/jni/MIMETypeRegistry.cpp @@ -0,0 +1,60 @@ +/* + * Copyright 2010, The Android Open Source Project + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#define LOG_TAG "WebCore" + +#include "config.h" +#include "MIMETypeRegistry.h" + +#include "PlatformString.h" +#include "WebCoreJni.h" + +#include <JNIUtility.h> +#include <jni.h> +#include <utils/Log.h> + +namespace WebCore { + +String MIMETypeRegistry::getMIMETypeForExtension(const String& ext) +{ + JNIEnv* env = JSC::Bindings::getJNIEnv(); + jclass mimeClass = env->FindClass("android/webkit/MimeTypeMap"); + LOG_ASSERT(mimeClass, "Could not find class MimeTypeMap"); + jmethodID mimeTypeFromExtension = env->GetStaticMethodID(mimeClass, + "mimeTypeFromExtension", + "(Ljava/lang/String;)Ljava/lang/String;"); + LOG_ASSERT(mimeTypeFromExtension, + "Could not find method mimeTypeFromExtension"); + jstring extString = + env->NewString((const jchar*) ext.characters(), ext.length()); + jobject mimeType = env->CallStaticObjectMethod(mimeClass, + mimeTypeFromExtension, extString); + String result = android::to_string(env, (jstring) mimeType); + env->DeleteLocalRef(extString); + env->DeleteLocalRef(mimeType); + return result; +} + +} diff --git a/WebKit/android/jni/MockGeolocation.cpp b/WebKit/android/jni/MockGeolocation.cpp index e76b1c1..df580c3 100755 --- a/WebKit/android/jni/MockGeolocation.cpp +++ b/WebKit/android/jni/MockGeolocation.cpp @@ -28,14 +28,14 @@ #include "config.h" -#include <JNIHelp.h> #include "Coordinates.h" #include "GeolocationServiceMock.h" #include "Geoposition.h" #include "JavaSharedClient.h" -#include "jni_utility.h" #include "PositionError.h" #include "WebCoreJni.h" +#include <JNIHelp.h> +#include <JNIUtility.h> #include <wtf/CurrentTime.h> using namespace WebCore; diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index 150c428..6f11487 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -25,7 +25,7 @@ #define LOG_TAG "webcoreglue" -#include <config.h> +#include "config.h" #include <wtf/Platform.h> #include <wtf/CurrentTime.h> @@ -66,8 +66,8 @@ #include "JSDOMWindow.h" #include <runtime/JSLock.h> #elif USE(V8) -#include "jni_npobject.h" -#include "jni_instance.h" +#include "JavaNPObjectV8.h" +#include "JavaInstanceV8.h" #endif // USE(JSC) #include "KURL.h" @@ -99,11 +99,11 @@ #include <runtime_object.h> #endif // USE(JSC) -#include <jni_utility.h> +#include <JNIUtility.h> #include "jni.h" #if USE(JSC) -#include "jni_instance.h" +#include "JavaInstanceJSC.h" #endif // USE(JSC) #include <JNIHelp.h> @@ -871,7 +871,13 @@ static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAss WebCore::DragClient* dragC = new DragClientAndroid; InspectorClientAndroid* inspectorC = new InspectorClientAndroid; // Create a new page - WebCore::Page* page = new WebCore::Page(chromeC, contextMenuC, editorC, dragC, inspectorC, 0); + WebCore::Page* page = new WebCore::Page(chromeC, + contextMenuC, + editorC, + dragC, + inspectorC, + 0, // PluginHalterClient + 0); // GeolocationControllerClient // css files without explicit MIMETYPE is treated as generic text files in // the Java side. So we can't enforce CSS MIMETYPE. page->settings()->setEnforceCSSMIMETypeInStrictMode(false); @@ -1168,27 +1174,27 @@ private: { JNIEnv* env = getJNIEnv(); // JavaInstance creates a global ref to instance in its constructor. - env->DeleteGlobalRef(_instance->instance()); + env->DeleteGlobalRef(m_instance->instance()); // Set the object to a weak reference. - _instance->setInstance(env->NewWeakGlobalRef(instance)); + m_instance->setInstance(env->NewWeakGlobalRef(instance)); } ~WeakJavaInstance() { JNIEnv* env = getJNIEnv(); // Store the weak reference so we can delete it later. - jweak weak = _instance->instance(); + jweak weak = m_instance->instance(); // The JavaInstance destructor attempts to delete the global ref stored - // in _instance. Since we replaced it in our constructor with a weak + // in m_instance. Since we replaced it in our constructor with a weak // reference, restore the global ref here so the vm will not complain. - _instance->setInstance(env->NewGlobalRef( - getRealObject(env, _instance->instance()).get())); + m_instance->setInstance(env->NewGlobalRef( + getRealObject(env, m_instance->instance()).get())); // Delete the weak reference. env->DeleteWeakGlobalRef(weak); } virtual void virtualBegin() { - _weakRef = _instance->instance(); + _weakRef = m_instance->instance(); JNIEnv* env = getJNIEnv(); // This is odd. getRealObject returns an AutoJObject which is used to // cleanly create and delete a local reference. But, here we need to @@ -1197,7 +1203,7 @@ private: // and delete the local reference in virtualEnd(). _realObject = getRealObject(env, _weakRef).release(); // Point to the real object - _instance->setInstance(_realObject); + m_instance->setInstance(_realObject); // Call the base class method INHERITED::virtualBegin(); } @@ -1209,7 +1215,7 @@ private: // Get rid of the local reference to the real object. getJNIEnv()->DeleteLocalRef(_realObject); // Point back to the WeakReference. - _instance->setInstance(_weakRef); + m_instance->setInstance(_weakRef); } private: @@ -1518,7 +1524,7 @@ static void OrientationChanged(JNIEnv *env, jobject obj, int orientation) TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); #endif WebCore::Frame* pFrame = GET_NATIVE_FRAME(env, obj); - LOGE("Sending orientation: %d", orientation); + LOGV("Sending orientation: %d", orientation); pFrame->sendOrientationChangeEvent(orientation); } diff --git a/WebKit/android/jni/WebCoreJni.cpp b/WebKit/android/jni/WebCoreJni.cpp index ef33cc0..73acb7b 100644 --- a/WebKit/android/jni/WebCoreJni.cpp +++ b/WebKit/android/jni/WebCoreJni.cpp @@ -26,10 +26,10 @@ #define LOG_TAG "webcoreglue" #include "config.h" +#include "WebCoreJni.h" #include "NotImplemented.h" -#include "WebCoreJni.h" -#include "jni_utility.h" +#include <JNIUtility.h> #include <jni.h> #include <utils/Log.h> diff --git a/WebKit/android/jni/WebCoreJniOnLoad.cpp b/WebKit/android/jni/WebCoreJniOnLoad.cpp index d69177e..b5bf9dd 100644 --- a/WebKit/android/jni/WebCoreJniOnLoad.cpp +++ b/WebKit/android/jni/WebCoreJniOnLoad.cpp @@ -42,7 +42,6 @@ #include "InspectorClientAndroid.h" #include "IntRect.h" #include "JavaSharedClient.h" -#include "jni_utility.h" #include "Page.h" #include "PlatformGraphicsContext.h" #include "ResourceRequest.h" @@ -51,21 +50,19 @@ #include "SelectionController.h" #include "Settings.h" #include "SharedBuffer.h" +#include "SkBitmap.h" +#include "SkCanvas.h" +#include "SkImageEncoder.h" #include "SubstituteData.h" #include "TimerClient.h" #include "TextEncoding.h" #include "WebCoreViewBridge.h" #include "WebFrameView.h" #include "WebViewCore.h" - -#include "SkBitmap.h" -#include "SkCanvas.h" -#include "SkImageEncoder.h" - #include "benchmark/Intercept.h" #include "benchmark/MyJavaVM.h" -#include "jni_utility.h" +#include <JNIUtility.h> #include <jni.h> #include <utils/Log.h> @@ -189,8 +186,13 @@ EXPORT void benchmark(const char* url, int reloadCount, int width, int height) { // Create the page with all the various clients ChromeClientAndroid* chrome = new ChromeClientAndroid; EditorClientAndroid* editor = new EditorClientAndroid; - Page* page = new Page(chrome, new ContextMenuClientAndroid, editor, - new DragClientAndroid, new InspectorClientAndroid, NULL); + Page* page = new Page(chrome, + new ContextMenuClientAndroid, + editor, + new DragClientAndroid, + new InspectorClientAndroid, + 0, // PluginHalterClient + 0); // GeolocationControllerClient editor->setPage(page); // Create MyWebFrame that intercepts network requests diff --git a/WebKit/android/jni/WebCoreResourceLoader.cpp b/WebKit/android/jni/WebCoreResourceLoader.cpp index 55af52d..b17c9a7 100644 --- a/WebKit/android/jni/WebCoreResourceLoader.cpp +++ b/WebKit/android/jni/WebCoreResourceLoader.cpp @@ -25,12 +25,8 @@ #define LOG_TAG "webcoreglue" -#include <config.h> -#include <wtf/Platform.h> - -#include "jni_utility.h" +#include "config.h" #include "WebCoreResourceLoader.h" -#include "SkUtils.h" #include "CString.h" #include "ResourceError.h" @@ -38,16 +34,18 @@ #include "ResourceHandleClient.h" #include "ResourceHandleInternal.h" #include "ResourceResponse.h" -#include "WebCoreJni.h" - +#include "SkUtils.h" #ifdef ANDROID_INSTRUMENT #include "TimeCounter.h" #endif +#include "WebCoreJni.h" -#include <utils/misc.h> #include <JNIHelp.h> +#include <JNIUtility.h> #include <SkTypes.h> #include <stdlib.h> +#include <utils/misc.h> +#include <wtf/Platform.h> namespace android { diff --git a/WebKit/android/jni/WebHistory.cpp b/WebKit/android/jni/WebHistory.cpp index 76a310b..f5a0b63 100644 --- a/WebKit/android/jni/WebHistory.cpp +++ b/WebKit/android/jni/WebHistory.cpp @@ -25,10 +25,7 @@ #define LOG_TAG "webhistory" -#include <config.h> -#include <wtf/OwnPtr.h> -#include <wtf/Platform.h> - +#include "config.h" #include "WebHistory.h" #include "BackForwardList.h" @@ -45,11 +42,13 @@ #include "WebCoreFrameBridge.h" #include "WebCoreJni.h" #include "WebIconDatabase.h" -#include "jni_utility.h" #include <JNIHelp.h> +#include "JNIUtility.h" #include <SkUtils.h> #include <utils/misc.h> +#include <wtf/OwnPtr.h> +#include <wtf/Platform.h> namespace android { diff --git a/WebKit/android/jni/WebIconDatabase.cpp b/WebKit/android/jni/WebIconDatabase.cpp index 20258a4..840d161 100644 --- a/WebKit/android/jni/WebIconDatabase.cpp +++ b/WebKit/android/jni/WebIconDatabase.cpp @@ -25,26 +25,25 @@ #define LOG_TAG "favicons" -#include <config.h> -#include <wtf/Platform.h> - +#include "config.h" #include "WebIconDatabase.h" +#include "GraphicsJNI.h" #include "IconDatabase.h" #include "Image.h" #include "IntRect.h" #include "JavaSharedClient.h" -#include "jni_utility.h" #include "KURL.h" #include "WebCoreJni.h" -#include <pthread.h> -#include "GraphicsJNI.h" +#include <JNIHelp.h> +#include <JNIUtility.h> #include <SkBitmap.h> #include <SkImageDecoder.h> #include <SkTemplates.h> +#include <pthread.h> #include <utils/misc.h> -#include <JNIHelp.h> +#include <wtf/Platform.h> namespace android { diff --git a/WebKit/android/jni/WebStorage.cpp b/WebKit/android/jni/WebStorage.cpp index 07e4880..3ab16fd 100644 --- a/WebKit/android/jni/WebStorage.cpp +++ b/WebKit/android/jni/WebStorage.cpp @@ -27,17 +27,16 @@ #if ENABLE(DATABASE) -#include <JNIHelp.h> +#include "JavaSharedClient.h" +#include "KURL.h" +#include "WebCoreJni.h" +#include <JNIHelp.h> +#include <JNIUtility.h> #include <WebCore/loader/appcache/ApplicationCacheStorage.h> #include <WebCore/page/SecurityOrigin.h> #include <WebCore/storage/DatabaseTracker.h> -#include "JavaSharedClient.h" -#include "jni_utility.h" -#include "KURL.h" -#include "WebCoreJni.h" - namespace android { static jobject GetOrigins(JNIEnv* env, jobject obj) diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 8414068..5ebc8eb 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -25,7 +25,7 @@ #define LOG_TAG "webcoreglue" -#include <config.h> +#include "config.h" #include "WebViewCore.h" #include "AtomicString.h" @@ -65,7 +65,6 @@ #include "HTMLSelectElement.h" #include "HTMLTextAreaElement.h" #include "InlineTextBox.h" -#include <JNIHelp.h> #include "KeyboardCodes.h" #include "Navigator.h" #include "Node.h" @@ -102,8 +101,10 @@ #include "WebFrameView.h" #include "HistoryItem.h" #include "android_graphics.h" + +#include <JNIHelp.h> +#include <JNIUtility.h> #include <ui/KeycodeLabels.h> -#include "jni_utility.h" #include <wtf/CurrentTime.h> #if USE(V8) @@ -266,6 +267,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_screenWidth = 320; m_scale = 1; m_screenWidthScale = 1; + m_touchEventListenerCount = 0; LOG_ASSERT(m_mainFrame, "Uh oh, somehow a frameview was made without an initial frame!"); @@ -348,6 +350,9 @@ WebViewCore* WebViewCore::getWebViewCore(const WebCore::FrameView* view) WebViewCore* WebViewCore::getWebViewCore(const WebCore::ScrollView* view) { + if (!view) + return 0; + WebFrameView* webFrameView = static_cast<WebFrameView*>(view->platformWidget()); if (!webFrameView) return 0; @@ -991,15 +996,28 @@ void WebViewCore::restoreScreenWidthScale(int scale) checkException(env); } -void WebViewCore::needTouchEvents(bool need) +void WebViewCore::needTouchEvents(bool need, bool force) { DEBUG_NAV_UI_LOGD("%s", __FUNCTION__); LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!"); #if ENABLE(TOUCH_EVENTS) // Android - JNIEnv* env = JSC::Bindings::getJNIEnv(); - env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_needTouchEvents, need); - checkException(env); + bool needToUpdateJava = false; + if (need) { + if (++m_touchEventListenerCount == 1) + needToUpdateJava = true; + } else { + if (force) + m_touchEventListenerCount = 0; + else if (--m_touchEventListenerCount == 0) + needToUpdateJava = true; + } + + if (needToUpdateJava || force) { + JNIEnv* env = JSC::Bindings::getJNIEnv(); + env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_needTouchEvents, need); + checkException(env); + } #endif } @@ -1371,7 +1389,6 @@ void WebViewCore::drawPlugins() SkIRect dirty; if (w->isDirty(&dirty)) { w->draw(); - w->localToDocumentCoords(&dirty); inval.op(dirty, SkRegion::kUnion_Op); } } @@ -1910,29 +1927,47 @@ int WebViewCore::handleTouchEvent(int action, int x, int y) #endif #if ENABLE(TOUCH_EVENTS) // Android - WebCore::TouchEventType type = WebCore::TouchEventCancel; + WebCore::TouchEventType type = WebCore::TouchStart; + WebCore::PlatformTouchPoint::State touchState = WebCore::PlatformTouchPoint::TouchPressed; switch (action) { case 0: // MotionEvent.ACTION_DOWN - type = WebCore::TouchEventStart; + type = WebCore::TouchStart; break; case 1: // MotionEvent.ACTION_UP - type = WebCore::TouchEventEnd; + type = WebCore::TouchEnd; + touchState = WebCore::PlatformTouchPoint::TouchReleased; break; case 2: // MotionEvent.ACTION_MOVE - type = WebCore::TouchEventMove; + type = WebCore::TouchMove; + touchState = WebCore::PlatformTouchPoint::TouchMoved; break; case 3: // MotionEvent.ACTION_CANCEL - type = WebCore::TouchEventCancel; + type = WebCore::TouchCancel; + touchState = WebCore::PlatformTouchPoint::TouchCancelled; break; case 0x100: // WebViewCore.ACTION_LONGPRESS - type = WebCore::TouchEventLongPress; + type = WebCore::TouchLongPress; + touchState = WebCore::PlatformTouchPoint::TouchPressed; break; case 0x200: // WebViewCore.ACTION_DOUBLETAP - type = WebCore::TouchEventDoubleTap; + type = WebCore::TouchDoubleTap; + touchState = WebCore::PlatformTouchPoint::TouchPressed; + break; + default: + type = WebCore::TouchCancel; + touchState = WebCore::PlatformTouchPoint::TouchCancelled; break; } + + // Track previous touch and if stationary set the state. WebCore::IntPoint pt(x - m_scrollOffsetX, y - m_scrollOffsetY); - WebCore::PlatformTouchEvent te(pt, pt, type); + + if (type == WebCore::TouchMove && pt == m_lastTouchPoint) + touchState = WebCore::PlatformTouchPoint::TouchStationary; + + m_lastTouchPoint = pt; + + WebCore::PlatformTouchEvent te(pt, type, touchState); preventDefault = m_mainFrame->eventHandler()->handleTouchEvent(te); #endif @@ -2943,7 +2978,8 @@ static void FullScreenPluginHidden(JNIEnv* env, jobject obj, jint npp) { WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj); PluginWidgetAndroid* plugin = viewImpl->getPluginWidget((NPP)npp); - plugin->exitFullScreen(false); + if (plugin) + plugin->exitFullScreen(false); } static WebCore::IntRect jrect_to_webrect(JNIEnv* env, jobject obj) diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index 0569b4d..c662441 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -375,7 +375,7 @@ namespace android { Node* cursorNodeIsPlugin(); // Notify the Java side whether it needs to pass down the touch events - void needTouchEvents(bool); + void needTouchEvents(bool, bool); // Notify the Java side that webkit is requesting a keyboard void requestKeyboard(bool showKeyboard, bool isTextView); @@ -526,6 +526,11 @@ namespace android { bool handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* nodePtr); WebCore::HTMLAnchorElement* retrieveAnchorElement(WebCore::Frame* frame, WebCore::Node* node); +#if ENABLE(TOUCH_EVENTS) + int m_touchEventListenerCount; + IntPoint m_lastTouchPoint; +#endif + #if DEBUG_NAV_UI uint32_t m_now; #endif |
