diff options
-rw-r--r-- | V8Binding/V8Binding.derived.mk | 1 | ||||
-rw-r--r-- | V8Binding/binding/InitializeThreading.cpp | 45 | ||||
-rw-r--r-- | V8Binding/binding/InitializeThreading.h | 40 | ||||
-rw-r--r-- | WebCore/bindings/js/ScriptController.cpp | 6 | ||||
-rw-r--r-- | WebCore/bindings/js/ScriptController.h | 4 | ||||
-rw-r--r-- | WebCore/bindings/v8/DOMObjectsInclude.h | 36 | ||||
-rw-r--r-- | WebCore/bindings/v8/DerivedSourcesAllInOne.cpp | 122 | ||||
-rw-r--r-- | WebCore/bindings/v8/ScriptController.cpp | 9 | ||||
-rw-r--r-- | WebCore/bindings/v8/ScriptController.h | 3 | ||||
-rw-r--r-- | WebCore/bindings/v8/V8Index.cpp | 32 | ||||
-rw-r--r-- | WebCore/bindings/v8/V8Index.h | 38 | ||||
-rw-r--r-- | WebCore/loader/icon/IconDatabase.cpp | 13 | ||||
-rw-r--r-- | WebCore/page/Geolocation.cpp | 107 | ||||
-rw-r--r-- | WebCore/page/Geolocation.h | 34 | ||||
-rw-r--r-- | WebCore/storage/Database.cpp | 10 | ||||
-rw-r--r-- | WebKit/android/jni/WebCoreFrameBridge.cpp | 8 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 23 | ||||
-rw-r--r-- | WebKit/android/nav/CachedRoot.cpp | 4 | ||||
-rw-r--r-- | WebKit/android/nav/CachedRoot.h | 2 | ||||
-rw-r--r-- | WebKit/android/nav/WebView.cpp | 20 | ||||
-rw-r--r-- | perf/main.cpp | 12 |
21 files changed, 257 insertions, 312 deletions
diff --git a/V8Binding/V8Binding.derived.mk b/V8Binding/V8Binding.derived.mk index aec9982..0c21a1d 100644 --- a/V8Binding/V8Binding.derived.mk +++ b/V8Binding/V8Binding.derived.mk @@ -174,7 +174,6 @@ WEBCORE_SRC_FILES := $(WEBCORE_SRC_FILES) \ endif LOCAL_SRC_FILES := \ - binding/InitializeThreading.cpp \ jni/jni_class.cpp \ jni/jni_instance.cpp \ jni/jni_npobject.cpp \ diff --git a/V8Binding/binding/InitializeThreading.cpp b/V8Binding/binding/InitializeThreading.cpp deleted file mode 100644 index 8577369..0000000 --- a/V8Binding/binding/InitializeThreading.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 APPLE OR ITS 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. - */ - -#include "config.h" -#include "InitializeThreading.h" -#include <wtf/Threading.h> - -namespace V8 { - -void initializeThreading() { - static bool initializedThreading = false; - if (!initializedThreading) { - WTF::initializeThreading(); - initializedThreading = true; - } -} - -} // namespace JSC - - diff --git a/V8Binding/binding/InitializeThreading.h b/V8Binding/binding/InitializeThreading.h deleted file mode 100644 index 47b3957..0000000 --- a/V8Binding/binding/InitializeThreading.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2008 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. 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. - * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of - * its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 APPLE OR ITS 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. - */ - -#ifndef InitializeThreading_h -#define InitializeThreading_h - -namespace V8 { - - // This function must be called from the main thread. It is safe to call it repeatedly. - // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly. - void initializeThreading(); -} - -#endif // InitializeThreading_h - diff --git a/WebCore/bindings/js/ScriptController.cpp b/WebCore/bindings/js/ScriptController.cpp index 6de9b75..45f8c75 100644 --- a/WebCore/bindings/js/ScriptController.cpp +++ b/WebCore/bindings/js/ScriptController.cpp @@ -38,12 +38,18 @@ #include "npruntime_impl.h" #include "runtime_root.h" #include <debugger/Debugger.h> +#include <runtime/InitializeThreading.h> #include <runtime/JSLock.h> using namespace JSC; namespace WebCore { +void ScriptController::initializeThreading() +{ + JSC::initializeThreading(); +} + ScriptController::ScriptController(Frame* frame) : m_frame(frame) , m_handlerLineNumber(0) diff --git a/WebCore/bindings/js/ScriptController.h b/WebCore/bindings/js/ScriptController.h index 56e8f0c..9ae10fb 100644 --- a/WebCore/bindings/js/ScriptController.h +++ b/WebCore/bindings/js/ScriptController.h @@ -80,6 +80,10 @@ public: return m_windowShell->window(); } + // This function must be called from the main thread. It is safe to call it repeatedly. + // Darwin is an exception to this rule: it is OK to call this function from any thread, even reentrantly. + static void initializeThreading(); + ScriptValue evaluate(const ScriptSourceCode&); void evaluateInIsolatedWorld(unsigned worldID, const Vector<ScriptSourceCode>&); diff --git a/WebCore/bindings/v8/DOMObjectsInclude.h b/WebCore/bindings/v8/DOMObjectsInclude.h index ec5c466..fb7ba81 100644 --- a/WebCore/bindings/v8/DOMObjectsInclude.h +++ b/WebCore/bindings/v8/DOMObjectsInclude.h @@ -31,7 +31,6 @@ #ifndef DOMObjectsInclude_h #define DOMObjectsInclude_h -#include "AbstractWorker.h" #include "BarInfo.h" #include "BeforeLoadEvent.h" #include "CanvasArray.h" @@ -76,7 +75,6 @@ #include "CSSValueList.h" #include "CSSVariablesDeclaration.h" #include "CSSVariablesRule.h" -#include "Database.h" #include "DocumentType.h" #include "DocumentFragment.h" #include "DOMCoreException.h" @@ -137,18 +135,12 @@ #include "ScriptExecutionContext.h" #include "SecurityOrigin.h" #include "Settings.h" -#include "SharedWorker.h" -#include "SharedWorkerContext.h" -#include "SQLTransaction.h" -#include "SQLResultSet.h" -#include "SQLResultSetRowList.h" #include "StyleSheet.h" #include "StyleSheetList.h" #include "TextEvent.h" #include "TextMetrics.h" #include "TimeRanges.h" #include "TreeWalker.h" -#include "XSLTProcessor.h" #include "V8AbstractEventListener.h" #include "V8CustomEventListener.h" #include "V8DOMWindow.h" @@ -169,15 +161,18 @@ #include "XMLHttpRequestProgressEvent.h" #include "XMLHttpRequestUpload.h" #include "XMLSerializer.h" -#include "XPathException.h" -#include "XPathExpression.h" -#include "XPathNSResolver.h" -#include "XPathResult.h" #if ENABLE(OFFLINE_WEB_APPLICATIONS) #include "DOMApplicationCache.h" #endif +#if ENABLE(DATABASE) +#include "Database.h" +#include "SQLTransaction.h" +#include "SQLResultSet.h" +#include "SQLResultSetRowList.h" +#endif // DATABASE + #if ENABLE(DATAGRID) #include "DataGridColumn.h" #include "DataGridColumnList.h" @@ -246,6 +241,7 @@ #endif #if ENABLE(WORKERS) +#include "AbstractWorker.h" #include "DedicatedWorkerContext.h" #include "Worker.h" #include "WorkerContext.h" @@ -253,6 +249,11 @@ #include "WorkerNavigator.h" #endif // WORKERS +#if ENABLE(SHARED_WORKERS) +#include "SharedWorker.h" +#include "SharedWorkerContext.h" +#endif // SHARED_WORKERS + #if ENABLE(NOTIFICATIONS) #include "Notification.h" #include "NotificationCenter.h" @@ -260,14 +261,19 @@ #if ENABLE(XPATH) #include "XPathEvaluator.h" +#include "XPathException.h" +#include "XPathExpression.h" +#include "XPathNSResolver.h" +#include "XPathResult.h" #endif // XPATH -#if PLATFORM(ANDROID) -// TODO: Upstream INSPECTOR guard. +#if ENABLE(XSLT) +#include "XSLTProcessor.h" +#endif // XSLT + #if ENABLE(INSPECTOR) #include "InspectorBackend.h" #endif // INSPECTOR -#endif namespace WebCore { diff --git a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp index c56a695..98832f3 100644 --- a/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp +++ b/WebCore/bindings/v8/DerivedSourcesAllInOne.cpp @@ -28,11 +28,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if PLATFORM(ANDROID) // This source file coalesces the V8 derived sources into a single object file to -#else -// This source file coalesces the HTML elements into a single object file to -#endif // reduce bloat and allow us to link release builds on 32-bit Windows. #include "bindings/V8Attr.cpp" @@ -87,9 +83,6 @@ #include "bindings/V8Document.cpp" #include "bindings/V8DocumentFragment.cpp" #include "bindings/V8DocumentType.cpp" -#if ENABLE(OFFLINE_WEB_APPLICATIONS) -#include "bindings/V8DOMApplicationCache.cpp" -#endif #include "bindings/V8DOMCoreException.cpp" #include "bindings/V8DOMImplementation.cpp" #include "bindings/V8DOMParser.cpp" @@ -194,13 +187,6 @@ #include "bindings/V8NodeIterator.cpp" #include "bindings/V8NodeList.cpp" #include "bindings/V8Notation.cpp" -#if PLATFORM(ANDROID) -// TODO: Upstream NOTIFICATIONS guard. -#if ENABLE(NOTIFICATIONS) -#include "bindings/V8Notification.cpp" -#include "bindings/V8NotificationCenter.cpp" -#endif -#endif #include "bindings/V8OverflowEvent.cpp" #include "bindings/V8PageTransitionEvent.cpp" #include "bindings/V8Plugin.cpp" @@ -212,9 +198,42 @@ #include "bindings/V8Rect.cpp" #include "bindings/V8RGBColor.cpp" #include "bindings/V8Screen.cpp" +#include "bindings/V8StyleSheet.cpp" +#include "bindings/V8StyleSheetList.cpp" +#include "bindings/V8Text.cpp" +#include "bindings/V8TextEvent.cpp" +#include "bindings/V8TextMetrics.cpp" +#include "bindings/V8TimeRanges.cpp" +#include "bindings/V8TreeWalker.cpp" +#include "bindings/V8UIEvent.cpp" +#include "bindings/V8ValidityState.cpp" +#include "bindings/V8WebKitAnimationEvent.cpp" +#include "bindings/V8WebKitCSSKeyframeRule.cpp" +#include "bindings/V8WebKitCSSKeyframesRule.cpp" +#include "bindings/V8WebKitCSSMatrix.cpp" +#include "bindings/V8WebKitCSSTransformValue.cpp" +#include "bindings/V8WebKitPoint.cpp" +#include "bindings/V8WebKitTransitionEvent.cpp" +#include "bindings/V8WheelEvent.cpp" +#include "bindings/V8XMLHttpRequest.cpp" +#include "bindings/V8XMLHttpRequestException.cpp" +#include "bindings/V8XMLHttpRequestProgressEvent.cpp" +#include "bindings/V8XMLHttpRequestUpload.cpp" +#include "bindings/V8XMLSerializer.cpp" + +#if ENABLE(OFFLINE_WEB_APPLICATIONS) +#include "bindings/V8DOMApplicationCache.cpp" +#endif + +#if ENABLE(DOM_STORAGE) +#include "bindings/V8Storage.cpp" +#include "bindings/V8StorageEvent.cpp" +#endif + +#if ENABLE(WEB_SOCKETS) +#include "bindings/V8WebSocket.cpp" +#endif -#if PLATFORM(ANDROID) -// TODO: Upstream DATABASE guard. #if ENABLE(DATABASE) #include "bindings/V8Database.cpp" #include "bindings/V8SQLError.cpp" @@ -222,17 +241,20 @@ #include "bindings/V8SQLResultSetRowList.cpp" #include "bindings/V8SQLTransaction.cpp" #endif + +#if ENABLE(WORKERS) +#include "bindings/V8AbstractWorker.cpp" +#include "bindings/V8DedicatedWorkerContext.cpp" +#include "bindings/V8Worker.cpp" +#include "bindings/V8WorkerContext.cpp" +#include "bindings/V8WorkerLocation.cpp" +#include "bindings/V8WorkerNavigator.cpp" #endif -#if ENABLE(DOM_STORAGE) -#include "bindings/V8Storage.cpp" -#include "bindings/V8StorageEvent.cpp" +#if ENABLE(SHARED_WORKERS) +#include "bindings/V8SharedWorker.cpp" #endif -#include "bindings/V8StyleSheet.cpp" -#include "bindings/V8StyleSheetList.cpp" -#if PLATFORM(ANDROID) -// TODO: Upstream SVG guard. #if ENABLE(SVG) #include "bindings/V8SVGAElement.cpp" #include "bindings/V8SVGAltGlyphElement.cpp" @@ -344,48 +366,7 @@ #include "bindings/V8SVGViewElement.cpp" #include "bindings/V8SVGZoomEvent.cpp" #endif -#endif - -#include "bindings/V8Text.cpp" -#include "bindings/V8TextEvent.cpp" -#include "bindings/V8TextMetrics.cpp" -#include "bindings/V8TimeRanges.cpp" -#include "bindings/V8TreeWalker.cpp" -#include "bindings/V8UIEvent.cpp" -#include "bindings/V8ValidityState.cpp" -#include "bindings/V8WebKitAnimationEvent.cpp" -#include "bindings/V8WebKitCSSKeyframeRule.cpp" -#include "bindings/V8WebKitCSSKeyframesRule.cpp" -#include "bindings/V8WebKitCSSMatrix.cpp" -#include "bindings/V8WebKitCSSTransformValue.cpp" -#include "bindings/V8WebKitPoint.cpp" -#include "bindings/V8WebKitTransitionEvent.cpp" -#if ENABLE(WEB_SOCKETS) -#include "bindings/V8WebSocket.cpp" -#endif -#include "bindings/V8WheelEvent.cpp" - -#if PLATFORM(ANDROID) -// TODO: Upstream WORKERS guard. -#if ENABLE(WORKERS) -#include "bindings/V8AbstractWorker.cpp" -#include "bindings/V8DedicatedWorkerContext.cpp" -#include "bindings/V8SharedWorker.cpp" -#include "bindings/V8Worker.cpp" -#include "bindings/V8WorkerContext.cpp" -#include "bindings/V8WorkerLocation.cpp" -#include "bindings/V8WorkerNavigator.cpp" -#endif -#endif - -#include "bindings/V8XMLHttpRequest.cpp" -#include "bindings/V8XMLHttpRequestException.cpp" -#include "bindings/V8XMLHttpRequestProgressEvent.cpp" -#include "bindings/V8XMLHttpRequestUpload.cpp" -#include "bindings/V8XMLSerializer.cpp" -#if PLATFORM(ANDROID) -// TODO: Upstream XPATH guard. #if ENABLE(XPATH) #include "bindings/V8XPathEvaluator.cpp" #include "bindings/V8XPathException.cpp" @@ -393,18 +374,19 @@ #include "bindings/V8XPathNSResolver.cpp" #include "bindings/V8XPathResult.cpp" #endif -#endif -#if PLATFORM(ANDROID) -// TODO: Upstream XSLT guard. #if ENABLE(XSLT) #include "bindings/V8XSLTProcessor.cpp" #endif -#endif -#if PLATFORM(ANDROID) -// TODO: Upstream INSPECTOR guard. #if ENABLE(INSPECTOR) #include "bindings/V8InspectorBackend.cpp" #endif + +#if PLATFORM(ANDROID) +// TODO: Upstream NOTIFICATIONS guard. +#if ENABLE(NOTIFICATIONS) +#include "bindings/V8Notification.cpp" +#include "bindings/V8NotificationCenter.cpp" +#endif #endif diff --git a/WebCore/bindings/v8/ScriptController.cpp b/WebCore/bindings/v8/ScriptController.cpp index d2c1db2..85af072 100644 --- a/WebCore/bindings/v8/ScriptController.cpp +++ b/WebCore/bindings/v8/ScriptController.cpp @@ -60,6 +60,15 @@ namespace WebCore { +void ScriptController::initializeThreading() +{ + static bool initializedThreading = false; + if (!initializedThreading) { + WTF::initializeThreading(); + initializedThreading = true; + } +} + void ScriptController::setFlags(const char* string, int length) { v8::V8::SetFlagsFromString(string, length); diff --git a/WebCore/bindings/v8/ScriptController.h b/WebCore/bindings/v8/ScriptController.h index 9658b05..ec15103 100644 --- a/WebCore/bindings/v8/ScriptController.h +++ b/WebCore/bindings/v8/ScriptController.h @@ -59,6 +59,9 @@ namespace WebCore { // or this accessor should be made JSProxy* V8Proxy* proxy() { return m_proxy.get(); } + // This function must be called from the main thread. It is safe to call it repeatedly. + static void initializeThreading(); + // Evaluate a script file in the environment of this proxy. // If succeeded, 'succ' is set to true and result is returned // as a string. diff --git a/WebCore/bindings/v8/V8Index.cpp b/WebCore/bindings/v8/V8Index.cpp index 396c93f..2cbd16d 100644 --- a/WebCore/bindings/v8/V8Index.cpp +++ b/WebCore/bindings/v8/V8Index.cpp @@ -410,8 +410,6 @@ #include "V8CanvasUnsignedShortArray.h" #endif -#if PLATFORM(ANDROID) -// TODO: Upstream these guards to webkit.org #if ENABLE(DATABASE) #include "V8Database.h" #include "V8SQLError.h" @@ -420,25 +418,12 @@ #include "V8SQLTransaction.h" #endif -#if ENABLE(GEOLOCATION) -#include "V8Coordinates.h" -#include "V8Geolocation.h" -#include "V8Geoposition.h" -#include "V8PositionError.h" -#endif - -#if ENABLE(TOUCH_EVENTS) -#include "V8Touch.h" -#include "V8TouchList.h" -#include "V8TouchEvent.h" -#endif - #if ENABLE(XPATH) #include "V8XPathResult.h" #include "V8XPathException.h" #include "V8XPathExpression.h" -#include "V8XPathEvaluator.h" #include "V8XPathNSResolver.h" +#include "V8XPathEvaluator.h" #endif #if ENABLE(XSLT) @@ -449,6 +434,21 @@ #include "V8InspectorBackend.h" #endif +#if PLATFORM(ANDROID) +// TODO: Upstream these guards to webkit.org +#if ENABLE(GEOLOCATION) +#include "V8Coordinates.h" +#include "V8Geolocation.h" +#include "V8Geoposition.h" +#include "V8PositionError.h" +#endif + +#if ENABLE(TOUCH_EVENTS) +#include "V8Touch.h" +#include "V8TouchList.h" +#include "V8TouchEvent.h" +#endif + #include "V8VoidCallback.h" #endif // PLATFORM(ANDROID) diff --git a/WebCore/bindings/v8/V8Index.h b/WebCore/bindings/v8/V8Index.h index 6255079..179b963 100644 --- a/WebCore/bindings/v8/V8Index.h +++ b/WebCore/bindings/v8/V8Index.h @@ -83,7 +83,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #endif #if ENABLE(OFFLINE_WEB_APPLICATIONS) -#define APPLICATIONCACHE_NONNODE_WRAPPER_TYPES(V) \ +#define APPLICATIONCACHE_NONNODE_WRAPPER_TYPES(V) \ V(DOMAPPLICATIONCACHE, DOMApplicationCache) #else #define APPLICATIONCACHE_NONNODE_WRAPPER_TYPES(V) @@ -100,7 +100,9 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #if ENABLE(SHARED_WORKERS) #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V) \ V(SHAREDWORKER, SharedWorker) -#define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V) + +#define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V) \ + V(SHAREDWORKERCONTEXT, SharedWorkerContext) #else #define SHARED_WORKER_ACTIVE_OBJECT_WRAPPER_TYPES(V) #define SHARED_WORKER_NONNODE_WRAPPER_TYPES(V) @@ -363,7 +365,7 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); V(CANVASPIXELARRAY, CanvasPixelArray) \ V(KEYBOARDEVENT, KeyboardEvent) \ V(LOCATION, Location) \ - V(MEDIA, Media) \ + V(MEDIA, Media) \ V(MEDIALIST, MediaList) #define DOM_OBJECT_TYPES_2(V) \ @@ -463,17 +465,6 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #define DOM_OBJECT_3D_CANVAS_TYPES(V) #endif -#if PLATFORM(ANDROID) -// TODO: Upstream these guards. -#if ENABLE(TOUCH_EVENTS) -#define DOM_OBJECT_TOUCH_EVENT_TYPES(V) \ - V(TOUCHLIST, TouchList) \ - V(TOUCHEVENT, TouchEvent) \ - V(TOUCH, Touch) -#else -#define DOM_OBJECT_TOUCH_EVENT_TYPES(V) -#endif - #if ENABLE(XPATH) #define DOM_OBJECT_XPATH_TYPES(V) \ V(XPATHEVALUATOR, XPathEvaluator) \ @@ -492,6 +483,13 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #define DOM_OBJECT_XSLT_TYPES(V) #endif +#if ENABLE(INSPECTOR) +#define DOM_OBJECT_INSPECTOR_TYPES(V) \ + V(INSPECTORBACKEND, InspectorBackend) +#else +#define DOM_OBJECT_INSPECTOR_TYPES(V) +#endif + #if ENABLE(GEOLOCATION) #define DOM_OBJECT_GEOLOCATION_TYPES(V) \ V(COORDINATES, Coordinates) \ @@ -502,11 +500,15 @@ typedef v8::Persistent<v8::FunctionTemplate> (*FunctionTemplateFactory)(); #define DOM_OBJECT_GEOLOCATION_TYPES(V) #endif -#if ENABLE(INSPECTOR) -#define DOM_OBJECT_INSPECTOR_TYPES(V) \ - V(INSPECTORBACKEND, InspectorBackend) +#if PLATFORM(ANDROID) +// TODO: Upstream this guard. +#if ENABLE(TOUCH_EVENTS) +#define DOM_OBJECT_TOUCH_EVENT_TYPES(V) \ + V(TOUCHLIST, TouchList) \ + V(TOUCHEVENT, TouchEvent) \ + V(TOUCH, Touch) #else -#define DOM_OBJECT_INSPECTOR_TYPES(V) +#define DOM_OBJECT_TOUCH_EVENT_TYPES(V) #endif #endif diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp index 8982cda..5a9bfaa 100644 --- a/WebCore/loader/icon/IconDatabase.cpp +++ b/WebCore/loader/icon/IconDatabase.cpp @@ -36,6 +36,7 @@ #include "IconRecord.h" #include "IntSize.h" #include "Logging.h" +#include "ScriptController.h" #include "SQLiteStatement.h" #include "SQLiteTransaction.h" #include "SuddenTermination.h" @@ -43,12 +44,6 @@ #include <wtf/MainThread.h> #include <wtf/StdLibExtras.h> -#if USE(JSC) -#include <runtime/InitializeThreading.h> -#elif USE(V8) -#include "InitializeThreading.h" -#endif - // For methods that are meant to support API from the main thread - should not be called internally #define ASSERT_NOT_SYNC_THREAD() ASSERT(!m_syncThreadRunning || !IS_ICON_SYNC_THREAD()) @@ -98,11 +93,7 @@ static IconDatabaseClient* defaultClient() IconDatabase* iconDatabase() { if (!sharedIconDatabase) { -#if USE(JSC) - JSC::initializeThreading(); -#elif USE(V8) - V8::initializeThreading(); -#endif + ScriptController::initializeThreading(); sharedIconDatabase = new IconDatabase; } return sharedIconDatabase; diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp index ba3516d..74b3f79 100644 --- a/WebCore/page/Geolocation.cpp +++ b/WebCore/page/Geolocation.cpp @@ -41,7 +41,7 @@ namespace WebCore { -static const char* permissionDeniedErrorMessage = "User denied Geolocation"; +static const char permissionDeniedErrorMessage[] = "User denied Geolocation"; Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) : m_geolocation(geolocation) @@ -49,7 +49,6 @@ Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<Posit , m_errorCallback(errorCallback) , m_options(options) , m_timer(this, &Geolocation::GeoNotifier::timerFired) - , m_fatalError(0) { ASSERT(m_geolocation); ASSERT(m_successCallback); @@ -60,10 +59,17 @@ Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<Posit void Geolocation::GeoNotifier::setFatalError(PassRefPtr<PositionError> error) { + // This method is called at most once on a given GeoNotifier object. + ASSERT(!m_fatalError); m_fatalError = error; m_timer.startOneShot(0); } +bool Geolocation::GeoNotifier::hasZeroTimeout() const +{ + return m_options->hasTimeout() && m_options->timeout() == 0; +} + void Geolocation::GeoNotifier::setCachedPosition(Geoposition* cachedPosition) { // We do not take owenership from the caller, but add our own ref count. @@ -96,12 +102,52 @@ void Geolocation::GeoNotifier::timerFired(Timer<GeoNotifier>*) } if (m_errorCallback) { - RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, "Timed out"); + RefPtr<PositionError> error = PositionError::create(PositionError::TIMEOUT, "Timeout expired"); m_errorCallback->handleEvent(error.get()); } m_geolocation->requestTimedOut(this); } +void Geolocation::Watchers::set(int id, PassRefPtr<GeoNotifier> notifier) +{ + m_idToNotifierMap.set(id, notifier); + m_notifierToIdMap.set(notifier, id); +} + +void Geolocation::Watchers::remove(int id) +{ + IdToNotifierMap::iterator iter = m_idToNotifierMap.find(id); + if (iter == m_idToNotifierMap.end()) + return; + m_notifierToIdMap.remove(iter->second); + m_idToNotifierMap.remove(iter); +} + +void Geolocation::Watchers::remove(GeoNotifier* notifier) +{ + NotifierToIdMap::iterator iter = m_notifierToIdMap.find(notifier); + if (iter == m_notifierToIdMap.end()) + return; + m_idToNotifierMap.remove(iter->second); + m_notifierToIdMap.remove(iter); +} + +void Geolocation::Watchers::clear() +{ + m_idToNotifierMap.clear(); + m_notifierToIdMap.clear(); +} + +bool Geolocation::Watchers::isEmpty() const +{ + return m_idToNotifierMap.isEmpty(); +} + +void Geolocation::Watchers::getNotifiersVector(Vector<RefPtr<GeoNotifier> >& copy) const +{ + copyValuesToVector(m_idToNotifierMap, copy); +} + static const char* databaseName = "/CachedPosition.db"; class CachedPositionManager { @@ -275,7 +321,7 @@ void Geolocation::disconnectFrame() void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { - RefPtr<GeoNotifier> notifier = makeRequest(successCallback, errorCallback, options); + RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options); ASSERT(notifier); m_oneShots.add(notifier); @@ -283,24 +329,23 @@ void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallbac int Geolocation::watchPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { - RefPtr<GeoNotifier> notifier = makeRequest(successCallback, errorCallback, options); + RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options); ASSERT(notifier); - static int sIdentifier = 0; - m_watchers.set(++sIdentifier, notifier); - - return sIdentifier; + static int nextAvailableWatchId = 1; + m_watchers.set(nextAvailableWatchId, notifier.release()); + return nextAvailableWatchId++; } -PassRefPtr<Geolocation::GeoNotifier> Geolocation::makeRequest(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) +PassRefPtr<Geolocation::GeoNotifier> Geolocation::startRequest(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options) { RefPtr<GeoNotifier> notifier = GeoNotifier::create(this, successCallback, errorCallback, options); // Check whether permissions have already been denied. Note that if this is the case, // the permission state can not change again in the lifetime of this page. - if (isDenied()) { + if (isDenied()) notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); - } else { + else { if (haveSuitableCachedPosition(notifier->m_options.get())) { ASSERT(m_cachedPositionManager->cachedPosition()); if (isAllowed()) @@ -310,7 +355,7 @@ PassRefPtr<Geolocation::GeoNotifier> Geolocation::makeRequest(PassRefPtr<Positio requestPermission(); } } else { - if (m_service->startUpdating(notifier->m_options.get())) + if (notifier->hasZeroTimeout() || m_service->startUpdating(notifier->m_options.get())) notifier->startTimerIfNeeded(); else notifier->setFatalError(PositionError::create(PositionError::UNKNOWN_ERROR, "Failed to start Geolocation service")); @@ -324,12 +369,7 @@ void Geolocation::fatalErrorOccurred(Geolocation::GeoNotifier* notifier) { // This request has failed fatally. Remove it from our lists. m_oneShots.remove(notifier); - for (GeoNotifierMap::iterator iter = m_watchers.begin(); iter != m_watchers.end(); ++iter) { - if (iter->second == notifier) { - m_watchers.remove(iter); - break; - } - } + m_watchers.remove(notifier); if (!hasListeners()) m_service->stopUpdating(); @@ -400,7 +440,7 @@ void Geolocation::setIsAllowed(bool allowed) m_allowGeolocation = allowed ? Yes : No; if (!isAllowed()) { - RefPtr<WebCore::PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage); + RefPtr<PositionError> error = PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage); error->setIsFatal(true); handleError(error.get()); return; @@ -462,7 +502,7 @@ void Geolocation::stopTimersForOneShots() void Geolocation::stopTimersForWatchers() { Vector<RefPtr<GeoNotifier> > copy; - copyValuesToVector(m_watchers, copy); + m_watchers.getNotifiersVector(copy); stopTimer(copy); } @@ -476,15 +516,16 @@ void Geolocation::stopTimers() void Geolocation::handleError(PositionError* error) { ASSERT(error); - + Vector<RefPtr<GeoNotifier> > oneShotsCopy; copyToVector(m_oneShots, oneShotsCopy); Vector<RefPtr<GeoNotifier> > watchersCopy; - copyValuesToVector(m_watchers, watchersCopy); + m_watchers.getNotifiersVector(watchersCopy); // Clear the lists before we make the callbacks, to avoid clearing notifiers - // added by calls to Geolocation methods from the callbacks. + // added by calls to Geolocation methods from the callbacks, and to prevent + // further callbacks to these notifiers. m_oneShots.clear(); if (error->isFatal()) m_watchers.clear(); @@ -514,19 +555,20 @@ void Geolocation::requestPermission() page->chrome()->requestGeolocationPermissionForFrame(m_frame, this); } -void Geolocation::geolocationServicePositionChanged(GeolocationService*) +void Geolocation::geolocationServicePositionChanged(GeolocationService* service) { + ASSERT_UNUSED(service, service == m_service); ASSERT(m_service->lastPosition()); m_cachedPositionManager->setCachedPosition(m_service->lastPosition()); // Stop all currently running timers. stopTimers(); - + if (!isAllowed()) { // requestPermission() will ask the chrome for permission. This may be // implemented synchronously or asynchronously. In both cases, - // makeSucessCallbacks() will be called if permission is granted, so + // makeSuccessCallbacks() will be called if permission is granted, so // there's nothing more to do here. requestPermission(); return; @@ -539,15 +581,16 @@ void Geolocation::makeSuccessCallbacks() { ASSERT(m_service->lastPosition()); ASSERT(isAllowed()); - + Vector<RefPtr<GeoNotifier> > oneShotsCopy; copyToVector(m_oneShots, oneShotsCopy); - + Vector<RefPtr<GeoNotifier> > watchersCopy; - copyValuesToVector(m_watchers, watchersCopy); - + m_watchers.getNotifiersVector(watchersCopy); + // Clear the lists before we make the callbacks, to avoid clearing notifiers - // added by calls to Geolocation methods from the callbacks. + // added by calls to Geolocation methods from the callbacks, and to prevent + // further callbacks to these notifiers. m_oneShots.clear(); sendPosition(oneShotsCopy, m_service->lastPosition()); diff --git a/WebCore/page/Geolocation.h b/WebCore/page/Geolocation.h index 401189b..d9b23c4 100644 --- a/WebCore/page/Geolocation.h +++ b/WebCore/page/Geolocation.h @@ -82,7 +82,8 @@ private: public: static PassRefPtr<GeoNotifier> create(Geolocation* geolocation, PassRefPtr<PositionCallback> positionCallback, PassRefPtr<PositionErrorCallback> positionErrorCallback, PassRefPtr<PositionOptions> options) { return adoptRef(new GeoNotifier(geolocation, positionCallback, positionErrorCallback, options)); } - void setFatalError(PassRefPtr<PositionError> error); + void setFatalError(PassRefPtr<PositionError>); + bool hasZeroTimeout() const; void setCachedPosition(Geoposition* cachedPosition); void startTimerIfNeeded(); void timerFired(Timer<GeoNotifier>*); @@ -96,14 +97,29 @@ private: RefPtr<Geoposition> m_cachedPosition; private: - GeoNotifier(Geolocation* geolocation, PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); + GeoNotifier(Geolocation*, PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); + }; + + class Watchers { + public: + void set(int id, PassRefPtr<GeoNotifier>); + void remove(int id); + void remove(GeoNotifier*); + void clear(); + bool isEmpty() const; + void getNotifiersVector(Vector<RefPtr<GeoNotifier> >&) const; + private: + typedef HashMap<int, RefPtr<GeoNotifier> > IdToNotifierMap; + typedef HashMap<RefPtr<GeoNotifier>, int> NotifierToIdMap; + IdToNotifierMap m_idToNotifierMap; + NotifierToIdMap m_notifierToIdMap; }; bool hasListeners() const { return !m_oneShots.isEmpty() || !m_watchers.isEmpty(); } void sendError(Vector<RefPtr<GeoNotifier> >&, PositionError*); void sendPosition(Vector<RefPtr<GeoNotifier> >&, Geoposition*); - + static void stopTimer(Vector<RefPtr<GeoNotifier> >&); void stopTimersForOneShots(); void stopTimersForWatchers(); @@ -113,26 +129,26 @@ private: void handleError(PositionError*); void requestPermission(); - PassRefPtr<GeoNotifier> makeRequest(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); // GeolocationServiceClient virtual void geolocationServicePositionChanged(GeolocationService*); virtual void geolocationServiceErrorOccurred(GeolocationService*); + PassRefPtr<GeoNotifier> startRequest(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>); + // EventListener virtual bool operator==(const EventListener&); virtual void handleEvent(ScriptExecutionContext*, Event*); - void fatalErrorOccurred(GeoNotifier* notifier); - void requestTimedOut(GeoNotifier* notifier); - void requestReturnedCachedPosition(GeoNotifier* notifier); + void fatalErrorOccurred(GeoNotifier*); + void requestTimedOut(GeoNotifier*); + void requestReturnedCachedPosition(GeoNotifier*); bool haveSuitableCachedPosition(PositionOptions*); typedef HashSet<RefPtr<GeoNotifier> > GeoNotifierSet; - typedef HashMap<int, RefPtr<GeoNotifier> > GeoNotifierMap; GeoNotifierSet m_oneShots; - GeoNotifierMap m_watchers; + Watchers m_watchers; Frame* m_frame; OwnPtr<GeolocationService> m_service; diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp index 3a8225b..403e132 100644 --- a/WebCore/storage/Database.cpp +++ b/WebCore/storage/Database.cpp @@ -46,6 +46,7 @@ #include "NotImplemented.h" #include "Page.h" #include "OriginQuotaManager.h" +#include "ScriptController.h" #include "SQLiteDatabase.h" #include "SQLiteFileSystem.h" #include "SQLiteStatement.h" @@ -57,9 +58,6 @@ #if USE(JSC) #include "JSDOMWindow.h" -#include <runtime/InitializeThreading.h> -#elif USE(V8) -#include "InitializeThreading.h" #endif namespace WebCore { @@ -165,11 +163,7 @@ Database::Database(Document* document, const String& name, const String& expecte if (m_name.isNull()) m_name = ""; -#if USE(JSC) - JSC::initializeThreading(); -#elif USE(V8) - V8::initializeThreading(); -#endif + ScriptController::initializeThreading(); m_guid = guidForOriginAndName(m_securityOrigin->toString(), name); diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp index 803f1b1..d6aa3f6 100644 --- a/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -63,10 +63,8 @@ #if USE(JSC) #include "GCController.h" #include "JSDOMWindow.h" -#include <runtime/InitializeThreading.h> #include <runtime/JSLock.h> #elif USE(V8) -#include "InitializeThreading.h" #include "jni_npobject.h" #include "jni_instance.h" #endif // USE(JSC) @@ -867,11 +865,7 @@ static void CallPolicyFunction(JNIEnv* env, jobject obj, jint func, jint decisio static void CreateFrame(JNIEnv* env, jobject obj, jobject javaview, jobject jAssetManager, jobject historyList) { -#if USE(JSC) - JSC::initializeThreading(); -#elif USE(V8) - V8::initializeThreading(); -#endif + ScriptController::initializeThreading(); #ifdef ANDROID_INSTRUMENT TimeCounterAuto counter(TimeCounter::NativeCallbackTimeCounter); diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index d31d936..c574d5a 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -2023,35 +2023,16 @@ void WebViewCore::touchUp(int touchGeneration, " x=%d y=%d", m_touchGeneration, touchGeneration, x, y); return; // short circuit if a newer touch has been generated } + // This moves m_mousePos to the correct place, and handleMouseClick uses + // m_mousePos to determine where the click happens. moveMouse(frame, x, y); m_lastGeneration = touchGeneration; if (frame && CacheBuilder::validNode(m_mainFrame, frame, 0)) { frame->loader()->resetMultipleFormSubmissionProtection(); } - // If the click is on an unselected textfield/area we do not want to allow - // the click to change the selection, because we will set it ourselves - // elsewhere - beginning for textareas, end for textfields - bool needToIgnoreChangesToSelectedRange = true; - WebCore::Node* focusNode = currentFocus(); - if (focusNode) { - WebCore::RenderObject* renderer = focusNode->renderer(); - if (renderer && (renderer->isTextField() || renderer->isTextArea())) { - // Now check to see if the click is inside the focused textfield - if (focusNode->getRect().contains(x, y)) - needToIgnoreChangesToSelectedRange = false; - } - } - EditorClientAndroid* client = 0; - if (needToIgnoreChangesToSelectedRange) { - client = static_cast<EditorClientAndroid*>( - m_mainFrame->editor()->client()); - client->setShouldChangeSelectedRange(false); - } DBG_NAV_LOGD("touchGeneration=%d handleMouseClick frame=%p node=%p" " x=%d y=%d", touchGeneration, frame, node, x, y); handleMouseClick(frame, node); - if (needToIgnoreChangesToSelectedRange) - client->setShouldChangeSelectedRange(true); } // Common code for both clicking with the trackball and touchUp diff --git a/WebKit/android/nav/CachedRoot.cpp b/WebKit/android/nav/CachedRoot.cpp index 9fdd5dc..9608d64 100644 --- a/WebKit/android/nav/CachedRoot.cpp +++ b/WebKit/android/nav/CachedRoot.cpp @@ -866,7 +866,8 @@ int CachedRoot::getBlockLeftEdge(int x, int y, float scale) const return result; } -void CachedRoot::getSimulatedMousePosition(WebCore::IntPoint* point) const +void CachedRoot::getSimulatedMousePosition(const CachedNode* cursor, + WebCore::IntPoint* point) const { #ifndef NDEBUG ASSERT(CachedFrame::mDebug.mInUse); @@ -878,7 +879,6 @@ void CachedRoot::getSimulatedMousePosition(WebCore::IntPoint* point) const int height = mouseBounds.height(); point->setX(x + (width >> 1)); // default to box center point->setY(y + (height >> 1)); - const CachedNode* cursor = currentCursor(); if (cursor && cursor->bounds().contains(mHistory->mMouseBounds)) { if (cursor->isTextField()) // if text field, return end of line point->setX(x + width - 1); diff --git a/WebKit/android/nav/CachedRoot.h b/WebKit/android/nav/CachedRoot.h index 123e7d2..f84542c 100644 --- a/WebKit/android/nav/CachedRoot.h +++ b/WebKit/android/nav/CachedRoot.h @@ -67,7 +67,7 @@ public: int getAndResetSelectionEnd(); int getAndResetSelectionStart(); int getBlockLeftEdge(int x, int y, float scale) const; - void getSimulatedMousePosition(WebCore::IntPoint* ) const; + void getSimulatedMousePosition(const CachedNode* , WebCore::IntPoint* ) const; void init(WebCore::Frame* , CachedHistory* ); bool innerDown(const CachedNode* , BestData* ) const; bool innerLeft(const CachedNode* , BestData* ) const; diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp index 4b32516..20daafc 100644 --- a/WebKit/android/nav/WebView.cpp +++ b/WebKit/android/nav/WebView.cpp @@ -106,6 +106,7 @@ struct JavaGlue { jmethodID m_getScaledMaxYScroll; jmethodID m_getVisibleRect; jmethodID m_rebuildWebTextView; + jmethodID m_setOkayToNotMatch; jmethodID m_displaySoftKeyboard; jmethodID m_viewInvalidate; jmethodID m_viewInvalidateRect; @@ -134,6 +135,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl) m_javaGlue.m_getScaledMaxYScroll = GetJMethod(env, clazz, "getScaledMaxYScroll", "()I"); m_javaGlue.m_getVisibleRect = GetJMethod(env, clazz, "sendOurVisibleRect", "()Landroid/graphics/Rect;"); m_javaGlue.m_rebuildWebTextView = GetJMethod(env, clazz, "rebuildWebTextView", "()V"); + m_javaGlue.m_setOkayToNotMatch = GetJMethod(env, clazz, "setOkayNotToMatch", "()V"); m_javaGlue.m_displaySoftKeyboard = GetJMethod(env, clazz, "displaySoftKeyboard", "(Z)V"); m_javaGlue.m_viewInvalidate = GetJMethod(env, clazz, "viewInvalidate", "()V"); m_javaGlue.m_viewInvalidateRect = GetJMethod(env, clazz, "viewInvalidate", "(IIII)V"); @@ -739,7 +741,8 @@ void updateCursorBounds(const CachedRoot* root, const CachedFrame* cachedFrame, m_viewImpl->m_cursorBounds = cachedNode->bounds(); m_viewImpl->m_cursorHitBounds = cachedNode->hitBounds(); m_viewImpl->m_cursorFrame = cachedFrame->framePointer(); - root->getSimulatedMousePosition(&m_viewImpl->m_cursorLocation); + root->getSimulatedMousePosition(cachedNode, + &m_viewImpl->m_cursorLocation); m_viewImpl->m_cursorNode = cachedNode->nodePointer(); } m_viewImpl->gCursorBoundsMutex.unlock(); @@ -835,7 +838,7 @@ bool moveCursor(int keyCode, int count, bool ignoreScroll) void notifyProgressFinished() { DBG_NAV_LOGD("cursorIsTextInput=%d", cursorIsTextInput(DontAllowNewer)); - rebuildWebTextView(); + rebuildWebTextView(false); #if DEBUG_NAV_UI if (m_frameCacheUI) { const CachedNode* focus = m_frameCacheUI->currentFocus(); @@ -967,7 +970,7 @@ bool motionUp(int x, int y, int slop) } viewInvalidate(); if (result->isTextField() || result->isTextArea()) { - rebuildWebTextView(); + rebuildWebTextView(true); if (!result->isReadOnly()) { displaySoftKeyboard(true); } @@ -1267,7 +1270,7 @@ bool hasFocusNode() return focusNode; } -void rebuildWebTextView() +void rebuildWebTextView(bool needNotMatchFocus) { JNIEnv* env = JSC::Bindings::getJNIEnv(); AutoJObject obj = m_javaGlue.object(env); @@ -1277,6 +1280,10 @@ void rebuildWebTextView() return; env->CallVoidMethod(obj.get(), m_javaGlue.m_rebuildWebTextView); checkException(env); + if (needNotMatchFocus) { + env->CallVoidMethod(obj.get(), m_javaGlue.m_setOkayToNotMatch); + checkException(env); + } } void displaySoftKeyboard(bool isTextView) @@ -1455,7 +1462,7 @@ static jobject nativeCursorPosition(JNIEnv *env, jobject obj) const CachedRoot* root = view->getFrameCache(WebView::DontAllowNewer); WebCore::IntPoint pos = WebCore::IntPoint(0, 0); if (root) - root->getSimulatedMousePosition(&pos); + root->getSimulatedMousePosition(root->currentCursor(), &pos); jclass pointClass = env->FindClass("android/graphics/Point"); jmethodID init = env->GetMethodID(pointClass, "<init>", "(II)V"); jobject point = env->NewObject(pointClass, init, pos.x(), pos.y()); @@ -1922,11 +1929,12 @@ static void nativeMoveCursorToNextTextInput(JNIEnv *env, jobject obj) root->setCursor(const_cast<CachedFrame*>(frame), const_cast<CachedNode*>(next)); WebCore::IntPoint pos; - root->getSimulatedMousePosition(&pos); + root->getSimulatedMousePosition(next, &pos); view->sendMoveMouse(static_cast<WebCore::Frame*>(frame->framePointer()), static_cast<WebCore::Node*>(next->nodePointer()), pos.x(), pos.y()); view->scrollRectOnScreen(bounds.x(), bounds.y(), bounds.right(), bounds.bottom()); + view->getWebViewCore()->m_moveGeneration++; } static jint nativeTextFieldAction(JNIEnv *env, jobject obj) diff --git a/perf/main.cpp b/perf/main.cpp index 927f55e..e3cb5b3 100644 --- a/perf/main.cpp +++ b/perf/main.cpp @@ -39,11 +39,6 @@ #include "FrameView.h" #include "GraphicsContext.h" #include "HistoryItem.h" -#if USE(JSC) -#include "InitializeThreading.h" -#elif USE(V8) -#include "V8InitializeThreading.h" -#endif #include "InspectorClientAndroid.h" #include "Intercept.h" #include "IntRect.h" @@ -53,6 +48,7 @@ #include "Page.h" #include "PlatformGraphicsContext.h" #include "ResourceRequest.h" +#include "ScriptController.h" #include "SelectionController.h" #include "Settings.h" #include "SharedBuffer.h" @@ -121,11 +117,7 @@ int main(int argc, char** argv) { LOGE("Please supply a file to read\n"); return 1; } -#if USE(JSC) - JSC::initializeThreading(); -#elif USE(V8) - V8::initializeThreading(); -#endif + ScriptController::initializeThreading(); // Setting this allows data: urls to load from a local file. FrameLoader::setLocalLoadPolicy(FrameLoader::AllowLocalLoadsForAll); |