LOCAL_C_INCLUDES := \
$(JNI_H_INCLUDE) \
$(LOCAL_PATH)/WebKit/android/icu \
+ bionic/ \
external/ \
external/icu4c/common \
external/icu4c/i18n \
$(LOCAL_PATH)/WebKit/android/WebCoreSupport \
$(LOCAL_PATH)/WebKit/android/jni \
$(LOCAL_PATH)/WebKit/android/nav \
- $(LOCAL_PATH)/WebKit/android/plugins \
- $(LOCAL_PATH)/WebKit/android/stl
+ $(LOCAL_PATH)/WebKit/android/plugins
LOCAL_C_INCLUDES := $(LOCAL_C_INCLUDES) \
$(LOCAL_PATH)/JavaScriptCore \
$(LOCAL_PATH)/bridge/jni \
$(LOCAL_PATH)/bridge/jni/v8
JNI_SRC_FILES := \
- jni_class.cpp \
- jni_instance.cpp \
- jni_npobject.cpp \
jni_runtime.cpp
WEBKIT_SRC_FILES += $(addprefix $(JNI_PATH)/,$(JNI_SRC_FILES))
endif
LOCAL_CFLAGS += -fno-strict-aliasing
LOCAL_CFLAGS += -include "WebCorePrefix.h"
LOCAL_CFLAGS += -fvisibility=hidden
+LOCAL_CFLAGS += -D__SGI_STL_INTERNAL_PAIR_H
ifeq ($(TARGET_ARCH),arm)
LOCAL_CFLAGS += -Darm
# We have to use the android version of libdl when we are not on the simulator
ifneq ($(TARGET_SIMULATOR),true)
LOCAL_SHARED_LIBRARIES += libdl
+LOCAL_C_INCLUDES += \
+ external/stlport
endif
# Build the list of static libraries
#if PLATFORM(ANDROID)
#define WTF_USE_PTHREADS 1
-#define WTF_PLATFORM_SGL 1
+#define WTF_PLATFORM_SKIA 1
#define USE_SYSTEM_MALLOC 1
#define ENABLE_MAC_JAVA_BRIDGE 1
#define LOG_DISABLED 1
#endif
#if PLATFORM(ANDROID)
-#include "jni_utility.h"
+#include "JNIUtility.h"
#endif
namespace WTF {
/*
- * Copyright 2007, The Android Open Source Project
+ * Copyright 2009, The Android Open Source Project
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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 APPLE COMPUTER, INC. OR
+ * 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
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef AndroidThreading_h
+#define AndroidThreading_h
+
+namespace WTF {
+
+// An interface to the embedding layer, which provides threading support.
+class AndroidThreading {
+public:
+ static void scheduleDispatchFunctionsOnMainThread();
+};
+
+} // namespace WTF
+
+#endif // AndroidThreading_h
#include "config.h"
#include "MainThread.h"
-#include "JavaSharedClient.h"
-
-using namespace android;
+#include "AndroidThreading.h"
namespace WTF {
-// Callback in the main thread.
-static void timeoutFired(void*)
-{
- dispatchFunctionsFromMainThread();
-}
-
void initializeMainThreadPlatform()
{
}
void scheduleDispatchFunctionsOnMainThread()
{
- JavaSharedClient::EnqueueFunctionPtr(timeoutFired, 0);
+ AndroidThreading::scheduleDispatchFunctionsOnMainThread();
}
} // namespace WTF
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- * Copyright 2009, The Android Open Source Project
+ * 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
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
-
#include "jni_runtime.h"
-#include "jni_utility.h"
+
+#include "JNIUtility.h"
using namespace JSC::Bindings;
-JavaParameter::JavaParameter (JNIEnv *env, jstring type)
+JavaParameter::JavaParameter(JNIEnv* env, jstring type)
{
- _type = JavaString (env, type);
- _JNIType = JNITypeFromClassName (_type.UTF8String());
+ m_type = JavaString(env, type);
+ m_JNIType = JNITypeFromClassName(m_type.UTF8String());
}
-
-JavaField::JavaField (JNIEnv *env, jobject aField)
+JavaField::JavaField(JNIEnv* env, jobject aField)
{
// Get field type
jobject fieldType = callJNIMethod<jobject>(aField, "getType", "()Ljava/lang/Class;");
- jstring fieldTypeName = (jstring)callJNIMethod<jobject>(fieldType, "getName", "()Ljava/lang/String;");
- _type = JavaString(env, fieldTypeName);
- _JNIType = JNITypeFromClassName (_type.UTF8String());
+ jstring fieldTypeName = static_cast<jstring>(callJNIMethod<jobject>(fieldType, "getName", "()Ljava/lang/String;"));
+ m_type = JavaString(env, fieldTypeName);
+ m_JNIType = JNITypeFromClassName(m_type.UTF8String());
// Get field name
- jstring fieldName = (jstring)callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;");
- _name = JavaString(env, fieldName);
+ jstring fieldName = static_cast<jstring>(callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;"));
+ m_name = JavaString(env, fieldName);
- _field = new JObjectWrapper(aField);
+ m_field = new JObjectWrapper(aField);
}
-
-JavaMethod::JavaMethod (JNIEnv *env, jobject aMethod)
+JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod)
{
// Get return type
jobject returnType = callJNIMethod<jobject>(aMethod, "getReturnType", "()Ljava/lang/Class;");
- jstring returnTypeName = (jstring)callJNIMethod<jobject>(returnType, "getName", "()Ljava/lang/String;");
- _returnType =JavaString (env, returnTypeName);
- _JNIReturnType = JNITypeFromClassName (_returnType.UTF8String());
- env->DeleteLocalRef (returnType);
- env->DeleteLocalRef (returnTypeName);
+ jstring returnTypeName = static_cast<jstring>(callJNIMethod<jobject>(returnType, "getName", "()Ljava/lang/String;"));
+ m_returnType = JavaString(env, returnTypeName);
+ m_JNIReturnType = JNITypeFromClassName(m_returnType.UTF8String());
+ env->DeleteLocalRef(returnType);
+ env->DeleteLocalRef(returnTypeName);
// Get method name
- jstring methodName = (jstring)callJNIMethod<jobject>(aMethod, "getName", "()Ljava/lang/String;");
- _name = JavaString (env, methodName);
- env->DeleteLocalRef (methodName);
+ jstring methodName = static_cast<jstring>(callJNIMethod<jobject>(aMethod, "getName", "()Ljava/lang/String;"));
+ m_name = JavaString(env, methodName);
+ env->DeleteLocalRef(methodName);
// Get parameters
- jarray jparameters = (jarray)callJNIMethod<jobject>(aMethod, "getParameterTypes", "()[Ljava/lang/Class;");
- _numParameters = env->GetArrayLength (jparameters);
- _parameters = new JavaParameter[_numParameters];
-
- int i;
- for (i = 0; i < _numParameters; i++) {
- jobject aParameter = env->GetObjectArrayElement ((jobjectArray)jparameters, i);
- jstring parameterName = (jstring)callJNIMethod<jobject>(aParameter, "getName", "()Ljava/lang/String;");
- _parameters[i] = JavaParameter(env, parameterName);
- env->DeleteLocalRef (aParameter);
- env->DeleteLocalRef (parameterName);
+ jarray jparameters = static_cast<jarray>(callJNIMethod<jobject>(aMethod, "getParameterTypes", "()[Ljava/lang/Class;"));
+ m_numParameters = env->GetArrayLength(jparameters);
+ m_parameters = new JavaParameter[m_numParameters];
+
+ for (int i = 0; i < m_numParameters; i++) {
+ jobject aParameter = env->GetObjectArrayElement(static_cast<jobjectArray>(jparameters), i);
+ jstring parameterName = static_cast<jstring>(callJNIMethod<jobject>(aParameter, "getName", "()Ljava/lang/String;"));
+ m_parameters[i] = JavaParameter(env, parameterName);
+ env->DeleteLocalRef(aParameter);
+ env->DeleteLocalRef(parameterName);
}
- env->DeleteLocalRef (jparameters);
+ env->DeleteLocalRef(jparameters);
// Created lazily.
- _signature = 0;
- _methodID = 0;
-
+ m_signature = 0;
+ m_methodID = 0;
+
jclass modifierClass = env->FindClass("java/lang/reflect/Modifier");
int modifiers = callJNIMethod<jint>(aMethod, "getModifiers", "()I");
- _isStatic = (bool)callJNIStaticMethod<jboolean>(modifierClass, "isStatic", "(I)Z", modifiers);
+ m_isStatic = static_cast<bool>(callJNIStaticMethod<jboolean>(modifierClass, "isStatic", "(I)Z", modifiers));
env->DeleteLocalRef(modifierClass);
}
-JavaMethod::~JavaMethod()
+JavaMethod::~JavaMethod()
{
- if (_signature)
- free(_signature);
- delete [] _parameters;
+ if (m_signature)
+ free(m_signature);
+ delete[] m_parameters;
};
explicit SignatureBuilder(int init_size) {
if (init_size <= 0)
init_size = 16;
- size_ = init_size;
- length_ = 0;
- storage_ = (char*)malloc(size_ * sizeof(char));
+ m_size = init_size;
+ m_length = 0;
+ m_storage = (char*)malloc(m_size * sizeof(char));
}
~SignatureBuilder() {
- free(storage_);
+ free(m_storage);
}
void append(const char* s) {
int l = strlen(s);
expandIfNeeded(l);
- memcpy(storage_ + length_, s, l);
- length_ += l;
+ memcpy(m_storage + m_length, s, l);
+ m_length += l;
}
// JNI method signatures use '/' between components of a class name, but
int l = strlen(className);
expandIfNeeded(l);
- char* sp = storage_ + length_;
+ char* sp = m_storage + m_length;
const char* cp = className;
-
+
while (*cp) {
if (*cp == '.')
*sp = '/';
sp++;
}
- length_ += l;
+ m_length += l;
}
// make a duplicated copy of the content.
char* ascii() {
- if (length_ == 0)
+ if (m_length == 0)
return NULL;
- storage_[length_] = '\0';
- return strndup(storage_, length_);
+ m_storage[m_length] = '\0';
+ return strndup(m_storage, m_length);
}
private:
void expandIfNeeded(int l) {
// expand storage if needed
- if (l + length_ >= size_) {
- int new_size = 2 * size_;
- if (l + length_ >= new_size)
- new_size = l + length_ + 1;
+ if (l + m_length >= m_size) {
+ int new_size = 2 * m_size;
+ if (l + m_length >= new_size)
+ new_size = l + m_length + 1;
char* new_storage = (char*)malloc(new_size * sizeof(char));
- memcpy(new_storage, storage_, length_);
- size_ = new_size;
- free(storage_);
- storage_ = new_storage;
+ memcpy(new_storage, m_storage, m_length);
+ m_size = new_size;
+ free(m_storage);
+ m_storage = new_storage;
}
}
- int size_;
- int length_;
- char* storage_;
+ int m_size;
+ int m_length;
+ char* m_storage;
};
-const char *JavaMethod::signature() const
+const char* JavaMethod::signature() const
{
- if (!_signature) {
+ if (!m_signature) {
SignatureBuilder signatureBuilder(64);
signatureBuilder.append("(");
- for (int i = 0; i < _numParameters; i++) {
+ for (int i = 0; i < m_numParameters; i++) {
JavaParameter* aParameter = parameterAt(i);
- JNIType _JNIType = aParameter->getJNIType();
- if (_JNIType == array_type)
+ JNIType type = aParameter->getJNIType();
+ if (type == array_type)
signatureBuilder.appendClassName(aParameter->type());
else {
- signatureBuilder.append(signatureFromPrimitiveType(_JNIType));
- if (_JNIType == object_type) {
+ signatureBuilder.append(signatureFromPrimitiveType(type));
+ if (type == object_type) {
signatureBuilder.appendClassName(aParameter->type());
signatureBuilder.append(";");
}
}
}
signatureBuilder.append(")");
-
- const char *returnType = _returnType.UTF8String();
- if (_JNIReturnType == array_type) {
+
+ const char* returnType = m_returnType.UTF8String();
+ if (m_JNIReturnType == array_type)
signatureBuilder.appendClassName(returnType);
- } else {
- signatureBuilder.append(signatureFromPrimitiveType(_JNIReturnType));
- if (_JNIReturnType == object_type) {
+ else {
+ signatureBuilder.append(signatureFromPrimitiveType(m_JNIReturnType));
+ if (m_JNIReturnType == object_type) {
signatureBuilder.appendClassName(returnType);
signatureBuilder.append(";");
}
}
-
- _signature = signatureBuilder.ascii();
+
+ m_signature = signatureBuilder.ascii();
}
-
- return _signature;
+
+ return m_signature;
}
JNIType JavaMethod::JNIReturnType() const
{
- return _JNIReturnType;
+ return m_JNIReturnType;
}
-jmethodID JavaMethod::methodID (jobject obj) const
+jmethodID JavaMethod::methodID(jobject obj) const
{
- if (_methodID == 0) {
- _methodID = getMethodID (obj, _name.UTF8String(), signature());
- }
- return _methodID;
+ if (!m_methodID)
+ m_methodID = getMethodID(obj, m_name.UTF8String(), signature());
+ return m_methodID;
}
-
-
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- * Copyright 2009, The Android Open Source Project
+ * 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
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _JNI_RUNTIME_H_
-#define _JNI_RUNTIME_H_
+#ifndef jni_runtime_h
+#define jni_runtime_h
-#include "jni_utility.h"
-#include "jni_instance.h"
+#include "JNIUtility.h"
+#include "JavaInstanceV8.h"
-#include "CString.h"
+#if USE(V8)
+#include "JavaStringV8.h"
+#endif
-namespace JSC
-{
+namespace JSC {
-namespace Bindings
-{
+namespace Bindings {
-class JavaString
-{
+class JavaString {
public:
- JavaString() { }
-
- void _commonInit (JNIEnv *e, jstring s)
+ JavaString()
{
- int size = e->GetStringLength(s);
- const char* cs = getCharactersFromJStringInEnv(e, s);
- {
- _utf8String = WebCore::CString(cs, size);
- }
- releaseCharactersForJStringInEnv (e, s, cs);
- }
-
- JavaString (JNIEnv *e, jstring s) {
- _commonInit (e, s);
+ m_impl.init();
}
-
- JavaString (jstring s) {
- _commonInit (getJNIEnv(), s);
+
+ JavaString(JNIEnv* e, jstring s)
+ {
+ m_impl.init(e, s);
}
-
- ~JavaString() { }
-
- int length() const { return _utf8String.length(); }
-
- const char* UTF8String() const {
- return _utf8String.data();
+
+ JavaString(jstring s)
+ {
+ m_impl.init(getJNIEnv(), s);
}
+ const char* UTF8String() const { return m_impl.UTF8String(); }
+ const jchar* uchars() const { return m_impl.uchars(); }
+ int length() const { return m_impl.length(); }
+
private:
- WebCore::CString _utf8String;
+ JavaStringImpl m_impl;
};
-
-class JavaParameter
-{
+class JavaParameter {
public:
- JavaParameter () : _JNIType(invalid_type) {};
- JavaParameter (JNIEnv *env, jstring type);
+ JavaParameter() : m_JNIType(invalid_type) { }
+ JavaParameter(JNIEnv*, jstring type);
virtual ~JavaParameter() { }
- const char* type() const { return _type.UTF8String(); }
- JNIType getJNIType() const { return _JNIType; }
-
+ const char* type() const { return m_type.UTF8String(); }
+ JNIType getJNIType() const { return m_JNIType; }
+
private:
- JavaString _type;
- JNIType _JNIType;
+ JavaString m_type;
+ JNIType m_JNIType;
};
-class JavaField
-{
+class JavaField {
public:
- JavaField (JNIEnv *env, jobject aField);
+ JavaField(JNIEnv*, jobject aField);
- const char* name() const { return _name.UTF8String(); }
- const char* type() const { return _type.UTF8String(); }
+ const JavaString& name() const { return m_name; }
+ const char* type() const { return m_type.UTF8String(); }
+
+ JNIType getJNIType() const { return m_JNIType; }
- JNIType getJNIType() const { return _JNIType; }
-
private:
- JavaString _name;
- JavaString _type;
- JNIType _JNIType;
- RefPtr<JObjectWrapper> _field;
+ JavaString m_name;
+ JavaString m_type;
+ JNIType m_JNIType;
+ RefPtr<JObjectWrapper> m_field;
};
-class JavaMethod
-{
+class JavaMethod {
public:
- JavaMethod(JNIEnv* env, jobject aMethod);
+ JavaMethod(JNIEnv*, jobject aMethod);
~JavaMethod();
- const char* name() const { return _name.UTF8String(); }
- const char* returnType() const { return _returnType.UTF8String(); };
- JavaParameter* parameterAt(int i) const { return &_parameters[i]; };
- int numParameters() const { return _numParameters; };
-
- const char *signature() const;
+ const JavaString& name() const { return m_name; }
+ const char* returnType() const { return m_returnType.UTF8String(); }
+ JavaParameter* parameterAt(int i) const { return &m_parameters[i]; }
+ int numParameters() const { return m_numParameters; }
+
+ const char* signature() const;
JNIType JNIReturnType() const;
- jmethodID methodID (jobject obj) const;
-
- bool isStatic() const { return _isStatic; }
+ jmethodID methodID(jobject obj) const;
+
+ bool isStatic() const { return m_isStatic; }
private:
- JavaParameter* _parameters;
- int _numParameters;
- JavaString _name;
- mutable char* _signature;
- JavaString _returnType;
- JNIType _JNIReturnType;
- mutable jmethodID _methodID;
- bool _isStatic;
+ JavaParameter* m_parameters;
+ int m_numParameters;
+ JavaString m_name;
+ mutable char* m_signature;
+ JavaString m_returnType;
+ JNIType m_JNIReturnType;
+ mutable jmethodID m_methodID;
+ bool m_isStatic;
};
} // namespace Bindings
} // namespace JSC
-#endif // _JNI_RUNTIME_H_
+#endif // jni_runtime_h
# page
GEN := \
$(intermediates)/page/JSBarInfo.h \
+ $(intermediates)/page/JSConnection.h \
$(intermediates)/page/JSConsole.h \
$(intermediates)/page/JSCoordinates.h \
$(intermediates)/page/JSDOMSelection.h \
# page
GEN := \
$(intermediates)/bindings/V8BarInfo.h \
+ $(intermediates)/bindings/V8Connection.h \
$(intermediates)/bindings/V8Console.h \
$(intermediates)/bindings/V8Coordinates.h \
$(intermediates)/bindings/V8DOMSelection.h \
$(LOCAL_PATH)/bridge/c \
$(LOCAL_PATH)/bridge/jni \
$(LOCAL_PATH)/bridge/jni/jsc \
+ $(LOCAL_PATH)/bridge/jsc \
\
$(JAVASCRIPTCORE_PATH)/API \
$(JAVASCRIPTCORE_PATH)/assembler \
\
bindings/ScriptControllerBase.cpp \
\
- bridge/Bridge.cpp \
bridge/IdentifierRep.cpp \
bridge/NP_jsobject.cpp \
bridge/c/c_class.cpp \
bridge/c/c_instance.cpp \
bridge/c/c_runtime.cpp \
bridge/c/c_utility.cpp \
- bridge/jni/jni_runtime.cpp \
- bridge/jni/jni_utility.cpp \
+ bridge/jni/JNIBridge.cpp \
+ bridge/jni/JNIUtility.cpp \
+ bridge/jni/jsc/JNIUtilityPrivate.cpp \
bridge/jni/jsc/JavaClassJSC.cpp \
bridge/jni/jsc/JavaInstanceJSC.cpp \
- bridge/jni/jsc/jni_utility_private.cpp \
+ bridge/jsc/BridgeJSC.cpp \
bridge/npruntime.cpp \
bridge/runtime_array.cpp \
bridge/runtime_method.cpp \
\
page/BarInfo.cpp \
page/Chrome.cpp \
+ page/Connection.cpp \
page/Console.cpp \
page/ContextMenuController.cpp \
page/DOMSelection.cpp \
platform/android/GeolocationServiceBridge.cpp \
platform/android/KeyEventAndroid.cpp \
platform/android/LocalizedStringsAndroid.cpp \
+ platform/android/PlatformTouchEventAndroid.cpp \
+ platform/android/PlatformTouchPointAndroid.cpp \
platform/android/PopupMenuAndroid.cpp \
platform/android/RenderThemeAndroid.cpp \
platform/android/ScreenAndroid.cpp \
platform/network/ResourceRequestBase.cpp \
platform/network/ResourceResponseBase.cpp \
\
- platform/network/android/Cookie.cpp \
+ platform/network/android/CookieJarAndroid.cpp \
platform/network/android/NetworkStateNotifierAndroid.cpp \
platform/network/android/ResourceHandleAndroid.cpp \
platform/network/android/ResourceRequestAndroid.cpp \
bindings/v8/custom/V8XMLSerializerConstructor.cpp
LOCAL_SRC_FILES += \
- bridge/jni/jni_utility.cpp \
- bridge/jni/v8/jni_utility_private.cpp
+ bridge/jni/JNIUtility.cpp \
+ bridge/jni/v8/JNIUtilityPrivate.cpp \
+ bridge/jni/v8/JavaNPObjectV8.cpp \
+ bridge/jni/v8/JavaClassV8.cpp \
+ bridge/jni/v8/JavaInstanceV8.cpp
+2010-01-21 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Move bridge interfaces Field, Class, Instance and Array from Bridge to BridgeJSC
+ https://bugs.webkit.org/show_bug.cgi?id=33589
+
+ These interfaces use JSC-specific types, so are moved out of Bridge.h to allow the file to
+ be used with both JSC and V8.
+
+ No new tests, refactoring only.
+
+ * Android.jscbindings.mk: Modified. Removed Bridge.cpp and added BridgeJSC.cpp
+ * GNUmakefile.am: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
+ * WebCore.pro: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
+ * WebCore.xcodeproj/project.pbxproj: Modified. Removed Bridge.cpp and added BridgeJSC.[cpp|h]
+ * WebCoreSources.bkl: Modified. Removed Bridge.cpp and added BridgeJSC.cpp
+ * bridge/Bridge.cpp: Removed.
+ * bridge/Bridge.h: Modfied. Moved Field, Class, Instance and Array interfaces to BridgeJSC.h
+ * bridge/jsc: Added.
+ * bridge/jsc/BridgeJSC.cpp: Copied from WebCore/bridge/Bridge.cpp.
+ * bridge/jsc/BridgeJSC.h: Copied from WebCore/bridge/Bridge.h.
+
+2010-01-21 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Fixes style in WebCore/bridge/jni/JNIBridge
+ https://bugs.webkit.org/show_bug.cgi?id=33914
+
+ No new tests, style fixes only.
+
+ * bridge/jni/JNIBridge.cpp:
+ * bridge/jni/JNIBridge.h:
+
+2010-01-20 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Renames jni_runtime.[cpp|h] to JNIBridge.[cpp|h]
+ https://bugs.webkit.org/show_bug.cgi?id=33899
+
+ No new tests, refactoring only.
+
+ * Android.jscbindings.mk: Modified. Removes jni_runtime.cpp and adds JNIBridge.cpp
+ * GNUmakefile.am: Modified. Removes jni_runtime.h and adds JNIBridge.h
+ * WebCore.xcodeproj/project.pbxproj: Modified. Removes jni_runtime.[cpp|h] and adds JNIBridge.[cpp|h]
+ * bridge/jni/JNIBridge.cpp: Copied from WebCore/bridge/jni/jni_runtime.cpp.
+ * bridge/jni/JNIBridge.h: Copied from WebCore/bridge/jni/jni_runtime.h.
+ * bridge/jni/jni_jsobject.mm: Modified. Updated to include JNIBridge.h
+ * bridge/jni/jni_runtime.cpp: Removed.
+ * bridge/jni/jni_runtime.h: Removed.
+ * bridge/jni/jsc/JNIUtilityPrivate.cpp: Modified. Updated to include JNIBridge.h
+ * bridge/jni/jsc/JavaClassJSC.cpp: Modified. Removed superfluous include
+ * bridge/jni/jsc/JavaClassJSC.h: Modified. Updated to include JNIBridge.h
+ * bridge/jni/jsc/JavaInstanceJSC.cpp: Modified. Updated to include JNIBridge.h
+
2010-01-20 Steve Block <steveblock@google.com>
Reviewed by David Levin.
Reviewed by David Levin.
+ Fixes style in WebCore/bridge/JNIUtility
+ https://bugs.webkit.org/show_bug.cgi?id=33870
+
+ No new tests, style fixes only.
+
+ * bridge/jni/JNIUtility.cpp:
+ * bridge/jni/JNIUtility.h:
+
+2010-01-19 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
+ Renames jni_utility and jni_utility_private to JNIUtility and JNIUtilityPrivate
+ https://bugs.webkit.org/show_bug.cgi?id=33843
+
+ No new tests, refactoring only.
+
+ * Android.jscbindings.mk:
+ * Android.v8bindings.mk:
+ * GNUmakefile.am:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bridge/jni/JNIUtility.cpp: Copied from WebCore/bridge/jni/jni_utility.cpp.
+ * bridge/jni/JNIUtility.h: Copied from WebCore/bridge/jni/jni_utility.h.
+ * bridge/jni/jni_jsobject.mm:
+ * bridge/jni/jni_objc.mm:
+ * bridge/jni/jni_runtime.cpp:
+ * bridge/jni/jni_runtime.h:
+ * bridge/jni/jni_utility.cpp: Removed.
+ * bridge/jni/jni_utility.h: Removed.
+ * bridge/jni/jsc/JNIUtilityPrivate.cpp: Copied from WebCore/bridge/jni/jsc/jni_utility_private.cpp.
+ (JSC::Bindings::convertValueToJValue):
+ * bridge/jni/jsc/JNIUtilityPrivate.h: Copied from WebCore/bridge/jni/jsc/jni_utility_private.h.
+ * bridge/jni/jsc/JavaClassJSC.cpp:
+ * bridge/jni/jsc/JavaInstanceJSC.cpp:
+ * bridge/jni/jsc/JavaStringJSC.h:
+ * bridge/jni/jsc/jni_utility_private.cpp: Removed.
+ * bridge/jni/jsc/jni_utility_private.h: Removed.
+ * platform/android/GeolocationServiceBridge.cpp:
+ * platform/android/GeolocationServiceBridge.h:
+ * platform/android/TemporaryLinkStubs.cpp:
+
+2010-01-19 Steve Block <steveblock@google.com>
+
+ Reviewed by David Levin.
+
Fixes style in WebCore/bridge/jni/jsc/JavaClassJSC
https://bugs.webkit.org/show_bug.cgi?id=33819
* bridge/jni/jsc/JavaInstanceJSC.cpp: Copied from WebCore/bridge/jni/jni_instance.cpp.
* bridge/jni/jsc/JavaInstanceJSC.h: Copied from WebCore/bridge/jni/jni_instance.h.
+2009-12-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=32499
+ Add client based Geolocation provider
+
+ Add first cut of a client based Geolocation provider. This is guarded by
+ ENABLE(CLIENT_BASED_GEOLOCATION) and is off by default for now. This adds a
+ GeolocationControllerClient interface that no-one currently implements,
+ but will in a subsequent patch.
+
+ * GNUmakefile.am:
+ * WebCore.base.exp:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * WebCoreSources.bkl:
+ * page/Geolocation.cpp:
+ (WebCore::createGeopositionFromGeolocationPosition):
+ (WebCore::createPositionErrorFromGeolocationError):
+ (WebCore::Geolocation::Geolocation):
+ (WebCore::Geolocation::~Geolocation):
+ (WebCore::Geolocation::disconnectFrame):
+ (WebCore::Geolocation::lastPosition):
+ (WebCore::Geolocation::startRequest):
+ (WebCore::Geolocation::fatalErrorOccurred):
+ (WebCore::Geolocation::requestTimedOut):
+ (WebCore::Geolocation::clearWatch):
+ (WebCore::Geolocation::handleError):
+ (WebCore::Geolocation::positionChanged):
+ (WebCore::Geolocation::makeSuccessCallbacks):
+ (WebCore::Geolocation::errorOccurred):
+ (WebCore::Geolocation::geolocationServicePositionChanged):
+ (WebCore::Geolocation::geolocationServiceErrorOccurred):
+ (WebCore::Geolocation::startUpdating):
+ (WebCore::Geolocation::stopUpdating):
+ * page/Geolocation.h:
+ * page/GeolocationController.cpp: Added.
+ (WebCore::GeolocationController::GeolocationController):
+ (WebCore::GeolocationController::~GeolocationController):
+ (WebCore::GeolocationController::addObserver):
+ (WebCore::GeolocationController::removeObserver):
+ (WebCore::GeolocationController::positionChanged):
+ (WebCore::GeolocationController::errorOccurred):
+ (WebCore::GeolocationController::lastPosition):
+ * page/GeolocationController.h: Added.
+ * page/GeolocationControllerClient.h: Added.
+ (WebCore::GeolocationControllerClient::~GeolocationControllerClient):
+ * page/GeolocationError.h: Added.
+ (WebCore::GeolocationError::):
+ (WebCore::GeolocationError::create):
+ (WebCore::GeolocationError::code):
+ (WebCore::GeolocationError::message):
+ * page/GeolocationPosition.h: Added.
+ (WebCore::GeolocationPosition::create):
+ (WebCore::GeolocationPosition::timestamp):
+ (WebCore::GeolocationPosition::latitude):
+ (WebCore::GeolocationPosition::longitude):
+ (WebCore::GeolocationPosition::accuracy):
+ (WebCore::GeolocationPosition::altitude):
+ (WebCore::GeolocationPosition::altitudeAccuracy):
+ (WebCore::GeolocationPosition::heading):
+ (WebCore::GeolocationPosition::speed):
+ (WebCore::GeolocationPosition::canProvideAltitude):
+ (WebCore::GeolocationPosition::canProvideAltitudeAccuracy):
+ (WebCore::GeolocationPosition::canProvideHeading):
+ (WebCore::GeolocationPosition::canProvideSpeed):
+ (WebCore::GeolocationPosition::GeolocationPosition):
+ * page/Geoposition.h:
+ (WebCore::Geoposition::create):
+ * page/Page.cpp:
+ (WebCore::Page::Page):
+ * page/Page.h:
+ (WebCore::Page::geolocationController):
+ * svg/graphics/SVGImage.cpp:
+ (WebCore::SVGImage::dataChanged):
+
2009-12-10 Alexey Proskuryakov <ap@apple.com>
Reviewed by Darin Adler.
WebCore/bindings/js/SerializedScriptValue.h \
WebCore/bindings/js/StringSourceProvider.h \
WebCore/bindings/ScriptControllerBase.cpp \
- WebCore/bridge/Bridge.cpp \
WebCore/bridge/Bridge.h \
WebCore/bridge/IdentifierRep.cpp \
WebCore/bridge/IdentifierRep.h \
WebCore/bridge/c/c_runtime.h \
WebCore/bridge/c/c_utility.cpp \
WebCore/bridge/c/c_utility.h \
+ WebCore/bridge/jni/JNIBridge.h \
+ WebCore/bridge/jni/JNIUtility.h \
WebCore/bridge/jni/jni_jsobject.h \
- WebCore/bridge/jni/jni_runtime.h \
- WebCore/bridge/jni/jni_utility.h \
WebCore/bridge/jni/jsc/JavaClassJSC.h \
WebCore/bridge/jni/jsc/JavaInstanceJSC.h \
+ WebCore/bridge/jsc/BridgeJSC.h \
+ WebCore/bridge/jsc/BridgeJSC.cpp \
WebCore/bridge/npapi.h \
WebCore/bridge/npruntime.cpp \
WebCore/bridge/npruntime.h \
WebCore/page/FrameView.h \
WebCore/page/Geolocation.cpp \
WebCore/page/Geolocation.h \
+ WebCore/page/GeolocationController.cpp \
+ WebCore/page/GeolocationController.h \
+ WebCore/page/GeolocationControllerClient.h \
+ WebCore/page/GeolocationError.h \
+ WebCore/page/GeolocationPosition.h \
WebCore/page/Geoposition.h \
WebCore/page/HaltablePlugin.h \
WebCore/page/History.cpp \
__ZN7WebCore14ResourceHandle20forceContentSniffingEv
__ZN7WebCore14ResourceLoader14cancelledErrorEv
__ZN7WebCore14ResourceLoader19setShouldBufferDataEb
+__ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE
__ZN7WebCore14SecurityOrigin16createFromStringERKNS_6StringE
__ZN7WebCore14SecurityOrigin18setLocalLoadPolicyENS0_15LocalLoadPolicyE
__ZN7WebCore14SecurityOrigin18shouldHideReferrerERKNS_4KURLERKNS_6StringE
__ZN7WebCore21JavaScriptDebugServer6sharedEv
__ZN7WebCore21PlatformKeyboardEvent24disambiguateKeyDownEventENS0_4TypeEb
__ZN7WebCore21PlatformKeyboardEventC1EP7NSEvent
+__ZN7WebCore21SVGDocumentExtensions21sampleAnimationAtTimeERKNS_6StringEPNS_14SVGSMILElementEd
__ZN7WebCore21SerializedScriptValue11deserializeEPK15OpaqueJSContextPPK13OpaqueJSValue
__ZN7WebCore21SerializedScriptValue6createEPK15OpaqueJSContextPK13OpaqueJSValuePS6_
__ZN7WebCore21SerializedScriptValueD1Ev
__ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE
__ZN7WebCore4Page9goForwardEv
__ZN7WebCore4Page9initGroupEv
-__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientEPNS_15InspectorClientEPNS_18PluginHalterClientE
+__ZN7WebCore4PageC1EPNS_12ChromeClientEPNS_17ContextMenuClientEPNS_12EditorClientEPNS_10DragClientEPNS_15InspectorClientEPNS_18PluginHalterClientEPNS_27GeolocationControllerClientE
__ZN7WebCore4PageD1Ev
__ZN7WebCore4coreEP20NSURLProtectionSpace
__ZN7WebCore5Cache11setDisabledEb
__ZN7WebCore7nsColorERKNS_5ColorE
__ZN7WebCore8Document11createRangeEv
__ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
+__ZN7WebCore8Document13svgExtensionsEv
__ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
__ZN7WebCore8Document17getFocusableNodesERN3WTF6VectorINS1_6RefPtrINS_4NodeEEELm0EEE
+__ZN7WebCore8Document19accessSVGExtensionsEv
__ZN7WebCore8Document22createDocumentFragmentEv
__ZN7WebCore8Document23renderedRectsForMarkersENS_14DocumentMarker10MarkerTypeE
__ZN7WebCore8Document24setShouldCreateRenderersEb
__ZN7WebCore8Settings20setFantasyFontFamilyERKNS_12AtomicStringE
__ZN7WebCore8Settings20setJavaScriptEnabledEb
__ZN7WebCore8Settings20setXSSAuditorEnabledEb
+__ZN7WebCore8Settings21setShowRepaintCounterEb
__ZN7WebCore8Settings21setStandardFontFamilyERKNS_12AtomicStringE
__ZN7WebCore8Settings21setWebSecurityEnabledEb
-__ZN7WebCore8Settings21setShowRepaintCounterEb
__ZN7WebCore8Settings22setLocalStorageEnabledEb
__ZN7WebCore8Settings22setSansSerifFontFamilyERKNS_12AtomicStringE
__ZN7WebCore8Settings22setShowsURLsInToolTipsEb
__ZNK7WebCore8Document4bodyEv
__ZNK7WebCore8Document6domainEv
__ZNK7WebCore8IntPointcv8_NSPointEv
+__ZNK7WebCore8Position10downstreamENS0_27EditingBoundaryCrossingRuleE
__ZNK7WebCore8Position25leadingWhitespacePositionENS_9EAffinityEb
__ZNK7WebCore8Position26trailingWhitespacePositionENS_9EAffinityEb
-__ZNK7WebCore8Position10downstreamENS0_27EditingBoundaryCrossingRuleE
__ZNK7WebCore8Position8upstreamENS0_27EditingBoundaryCrossingRuleE
__ZNK7WebCore9DOMWindow27pendingUnloadEventListenersEv
__ZNK7WebCore9FloatRectcv7_NSRectEv
__ZTVN7WebCore17FileChooserClientE
__ZTVN7WebCore17FrameLoaderClientE
__ZTVN7WebCore25HistoryPropertyListWriterE
-__ZN7WebCore14SVGSMILElement13isSMILElementEPNS_4NodeE
-__ZN7WebCore21SVGDocumentExtensions21sampleAnimationAtTimeERKNS_6StringEPNS_14SVGSMILElementEd
-__ZN7WebCore8Document19accessSVGExtensionsEv
-__ZN7WebCore8Document13svgExtensionsEv
_filenameByFixingIllegalCharacters
_hasCaseInsensitiveSubstring
_hasCaseInsensitiveSuffix
'page/FrameView.h',
'page/Geolocation.cpp',
'page/Geolocation.h',
+ 'page/GeolocationController.cpp'
+ 'page/GeolocationController.h'
+ 'page/GeolocationControllerClient.h'
+ 'page/GeolocationError.h'
+ 'page/GeolocationPosition.h'
'page/Geoposition.h',
'page/HaltablePlugin.h',
'page/History.cpp',
bindings/js/ScheduledAction.cpp \
bindings/js/SerializedScriptValue.cpp \
bindings/ScriptControllerBase.cpp \
- bridge/Bridge.cpp \
bridge/IdentifierRep.cpp \
bridge/NP_jsobject.cpp \
bridge/npruntime.cpp \
bridge/c/c_instance.cpp \
bridge/c/c_runtime.cpp \
bridge/c/c_utility.cpp \
+ bridge/jsc/BridgeJSC.cpp \
css/CSSBorderImageValue.cpp \
css/CSSCanvasValue.cpp \
css/CSSCharsetRule.cpp \
page/FrameTree.cpp \
page/FrameView.cpp \
page/Geolocation.cpp \
+ page/GeolocationController.cpp \
page/History.cpp \
page/Location.cpp \
page/MouseEventWithHitTestResults.cpp \
bridge/c/c_instance.h \
bridge/c/c_runtime.h \
bridge/c/c_utility.h \
+ bridge/jsc/BridgeJSC.h \
bridge/IdentifierRep.h \
bridge/NP_jsobject.h \
bridge/npruntime.h \
<File\r
RelativePath="..\page\Geolocation.cpp"\r
>\r
+ RelativePath="..\page\GeolocationController.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\page\GeolocationController.h"
+ >
+ </File>
+ <File
+ RelativePath="..\page\GeolocationControllerClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\page\GeolocationError.h"
+ >
+ </File>
+ <File
+ RelativePath="..\page\GeolocationPosition.h"
+ >
+ </File>
+ <File
</File>\r
<File\r
RelativePath="..\page\Geolocation.h"\r
1A569D030D7E2B82007C3983 /* jni_jsobject.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CD30D7E2B82007C3983 /* jni_jsobject.mm */; };
1A569D040D7E2B82007C3983 /* jni_jsobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CD40D7E2B82007C3983 /* jni_jsobject.h */; settings = {ATTRIBUTES = (Private, ); }; };
1A569D050D7E2B82007C3983 /* jni_objc.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CD50D7E2B82007C3983 /* jni_objc.mm */; };
- 1A569D060D7E2B82007C3983 /* jni_runtime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CD60D7E2B82007C3983 /* jni_runtime.cpp */; };
- 1A569D070D7E2B82007C3983 /* jni_runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CD70D7E2B82007C3983 /* jni_runtime.h */; };
- 1A569D080D7E2B82007C3983 /* jni_utility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CD80D7E2B82007C3983 /* jni_utility.cpp */; };
- 1A569D090D7E2B82007C3983 /* jni_utility.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CD90D7E2B82007C3983 /* jni_utility.h */; };
1A569D0A0D7E2B82007C3983 /* NP_jsobject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A569CDA0D7E2B82007C3983 /* NP_jsobject.cpp */; };
1A569D0B0D7E2B82007C3983 /* NP_jsobject.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CDB0D7E2B82007C3983 /* NP_jsobject.h */; };
1A569D0C0D7E2B82007C3983 /* npapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A569CDC0D7E2B82007C3983 /* npapi.h */; settings = {ATTRIBUTES = (Private, ); }; };
54C50F7B0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 54C50F7A0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp */; };
550A0BC9085F6039007353D6 /* QualifiedName.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 550A0BC7085F6039007353D6 /* QualifiedName.cpp */; };
550A0BCA085F6039007353D6 /* QualifiedName.h in Headers */ = {isa = PBXBuildFile; fileRef = 550A0BC8085F6039007353D6 /* QualifiedName.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 599D1E3210C97D6E00E0EF12 /* jni_utility_private.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 599D1E3010C97D6E00E0EF12 /* jni_utility_private.cpp */; };
- 599D1E3310C97D6E00E0EF12 /* jni_utility_private.h in Headers */ = {isa = PBXBuildFile; fileRef = 599D1E3110C97D6E00E0EF12 /* jni_utility_private.h */; };
+ 5913953B110758450083EC55 /* JNIBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5913953A110758450083EC55 /* JNIBridge.h */; };
+ 5913953D1107584E0083EC55 /* JNIBridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5913953C1107584E0083EC55 /* JNIBridge.cpp */; };
599E759011055A1F00D904FA /* Bridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 599E758F11055A1F00D904FA /* Bridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
599E759211055A2A00D904FA /* Bridge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 599E759111055A2A00D904FA /* Bridge.cpp */; };
59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */; };
59C77F2B10545B3B00506104 /* GeolocationServiceMock.h in Headers */ = {isa = PBXBuildFile; fileRef = 59C77F2910545B3B00506104 /* GeolocationServiceMock.h */; settings = {ATTRIBUTES = (Private, ); }; };
59E560A71105336600AA1258 /* JavaClassJSC.h in Headers */ = {isa = PBXBuildFile; fileRef = 59E560A61105336600AA1258 /* JavaClassJSC.h */; };
59E560A91105336F00AA1258 /* JavaClassJSC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59E560A81105336F00AA1258 /* JavaClassJSC.cpp */; };
+ 59EE122C1106080500885116 /* JNIUtilityPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59EE122B1106080500885116 /* JNIUtilityPrivate.cpp */; };
+ 59EE122E1106080F00885116 /* JNIUtilityPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EE122D1106080F00885116 /* JNIUtilityPrivate.h */; };
+ 59EE12301106081F00885116 /* JNIUtility.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 59EE122F1106081F00885116 /* JNIUtility.cpp */; };
+ 59EE12321106082900885116 /* JNIUtility.h in Headers */ = {isa = PBXBuildFile; fileRef = 59EE12311106082900885116 /* JNIUtility.h */; };
5D15E3AB0F9E6AC1009E0E3F /* XMLTokenizerScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */; };
5D15E3AC0F9E6AC1009E0E3F /* XMLTokenizerScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D15E3AA0F9E6AC1009E0E3F /* XMLTokenizerScope.h */; };
5D874F130D161D3200796C3B /* NetscapePlugInStreamLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DD0AF589AD00D48324 /* NetscapePlugInStreamLoader.cpp */; };
BC53C6080DA56C570021EB5D /* Gradient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53C6070DA56C570021EB5D /* Gradient.cpp */; };
BC53C60B0DA56CF10021EB5D /* GradientCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC53C60A0DA56CF10021EB5D /* GradientCG.cpp */; };
BC53C6920DA591140021EB5D /* CSSGradientValue.h in Headers */ = {isa = PBXBuildFile; fileRef = BC53C6910DA591140021EB5D /* CSSGradientValue.h */; };
+ BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC56CB1C10D5AC8000A77C64 /* GeolocationController.cpp */; };
+ BC56CB2210D5AC8000A77C64 /* GeolocationController.h in Headers */ = {isa = PBXBuildFile; fileRef = BC56CB1D10D5AC8000A77C64 /* GeolocationController.h */; };
+ BC56CB2310D5AC8000A77C64 /* GeolocationControllerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC56CB1E10D5AC8000A77C64 /* GeolocationControllerClient.h */; };
+ BC56CB2410D5AC8000A77C64 /* GeolocationError.h in Headers */ = {isa = PBXBuildFile; fileRef = BC56CB1F10D5AC8000A77C64 /* GeolocationError.h */; };
+ BC56CB2510D5AC8000A77C64 /* GeolocationPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = BC56CB2010D5AC8000A77C64 /* GeolocationPosition.h */; };
BC5823F50C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */; };
BC5825F30C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */; };
BC588AF00BFA6CF900EE679E /* HTMLParserErrorCodes.h in Headers */ = {isa = PBXBuildFile; fileRef = BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */; };
1A569CD30D7E2B82007C3983 /* jni_jsobject.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = jni_jsobject.mm; sourceTree = "<group>"; };
1A569CD40D7E2B82007C3983 /* jni_jsobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni_jsobject.h; sourceTree = "<group>"; };
1A569CD50D7E2B82007C3983 /* jni_objc.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = jni_objc.mm; sourceTree = "<group>"; };
- 1A569CD60D7E2B82007C3983 /* jni_runtime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jni_runtime.cpp; sourceTree = "<group>"; };
- 1A569CD70D7E2B82007C3983 /* jni_runtime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni_runtime.h; sourceTree = "<group>"; };
- 1A569CD80D7E2B82007C3983 /* jni_utility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jni_utility.cpp; sourceTree = "<group>"; };
- 1A569CD90D7E2B82007C3983 /* jni_utility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = jni_utility.h; sourceTree = "<group>"; };
1A569CDA0D7E2B82007C3983 /* NP_jsobject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NP_jsobject.cpp; path = bridge/NP_jsobject.cpp; sourceTree = "<group>"; };
1A569CDB0D7E2B82007C3983 /* NP_jsobject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NP_jsobject.h; path = bridge/NP_jsobject.h; sourceTree = "<group>"; };
1A569CDC0D7E2B82007C3983 /* npapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = npapi.h; path = bridge/npapi.h; sourceTree = "<group>"; };
54C50F7A0E801DF3009832A0 /* XMLTokenizerLibxml2.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizerLibxml2.cpp; sourceTree = "<group>"; };
550A0BC7085F6039007353D6 /* QualifiedName.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = QualifiedName.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
550A0BC8085F6039007353D6 /* QualifiedName.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = QualifiedName.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
- 599D1E3010C97D6E00E0EF12 /* jni_utility_private.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = jni_utility_private.cpp; path = jsc/jni_utility_private.cpp; sourceTree = "<group>"; };
- 599D1E3110C97D6E00E0EF12 /* jni_utility_private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = jni_utility_private.h; path = jsc/jni_utility_private.h; sourceTree = "<group>"; };
+ 5913953A110758450083EC55 /* JNIBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIBridge.h; sourceTree = "<group>"; };
+ 5913953C1107584E0083EC55 /* JNIBridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JNIBridge.cpp; sourceTree = "<group>"; };
599E758F11055A1F00D904FA /* Bridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Bridge.h; path = bridge/Bridge.h; sourceTree = "<group>"; };
599E759111055A2A00D904FA /* Bridge.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Bridge.cpp; path = bridge/Bridge.cpp; sourceTree = "<group>"; };
59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaInstanceJSC.cpp; path = jsc/JavaInstanceJSC.cpp; sourceTree = "<group>"; };
59C77F2910545B3B00506104 /* GeolocationServiceMock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GeolocationServiceMock.h; path = mock/GeolocationServiceMock.h; sourceTree = "<group>"; };
59E560A61105336600AA1258 /* JavaClassJSC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JavaClassJSC.h; path = jsc/JavaClassJSC.h; sourceTree = "<group>"; };
59E560A81105336F00AA1258 /* JavaClassJSC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JavaClassJSC.cpp; path = jsc/JavaClassJSC.cpp; sourceTree = "<group>"; };
+ 59EE122B1106080500885116 /* JNIUtilityPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JNIUtilityPrivate.cpp; path = jsc/JNIUtilityPrivate.cpp; sourceTree = "<group>"; };
+ 59EE122D1106080F00885116 /* JNIUtilityPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JNIUtilityPrivate.h; path = jsc/JNIUtilityPrivate.h; sourceTree = "<group>"; };
+ 59EE122F1106081F00885116 /* JNIUtility.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JNIUtility.cpp; sourceTree = "<group>"; };
+ 59EE12311106082900885116 /* JNIUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JNIUtility.h; sourceTree = "<group>"; };
5D15E3A90F9E6AC1009E0E3F /* XMLTokenizerScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLTokenizerScope.cpp; sourceTree = "<group>"; };
5D15E3AA0F9E6AC1009E0E3F /* XMLTokenizerScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLTokenizerScope.h; sourceTree = "<group>"; };
5D925B650F64D4DD00B847F0 /* ScrollBehavior.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollBehavior.cpp; sourceTree = "<group>"; };
BC53C6070DA56C570021EB5D /* Gradient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Gradient.cpp; sourceTree = "<group>"; };
BC53C60A0DA56CF10021EB5D /* GradientCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GradientCG.cpp; sourceTree = "<group>"; };
BC53C6910DA591140021EB5D /* CSSGradientValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSGradientValue.h; sourceTree = "<group>"; };
+ BC56CB1C10D5AC8000A77C64 /* GeolocationController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GeolocationController.cpp; sourceTree = "<group>"; };
+ BC56CB1D10D5AC8000A77C64 /* GeolocationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationController.h; sourceTree = "<group>"; };
+ BC56CB1E10D5AC8000A77C64 /* GeolocationControllerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationControllerClient.h; sourceTree = "<group>"; };
+ BC56CB1F10D5AC8000A77C64 /* GeolocationError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationError.h; sourceTree = "<group>"; };
+ BC56CB2010D5AC8000A77C64 /* GeolocationPosition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeolocationPosition.h; sourceTree = "<group>"; };
BC5823F40C0A98DF0053F1B5 /* JSHTMLElementCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLElementCustom.cpp; sourceTree = "<group>"; };
BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCSSStyleDeclarationCustom.cpp; sourceTree = "<group>"; };
BC588AEF0BFA6CF900EE679E /* HTMLParserErrorCodes.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLParserErrorCodes.h; sourceTree = "<group>"; };
1A569CCE0D7E2B82007C3983 /* jni */ = {
isa = PBXGroup;
children = (
+ 5913953C1107584E0083EC55 /* JNIBridge.cpp */,
+ 5913953A110758450083EC55 /* JNIBridge.h */,
+ 59EE12311106082900885116 /* JNIUtility.h */,
+ 59EE122F1106081F00885116 /* JNIUtility.cpp */,
599D1E2F10C97D4C00E0EF12 /* jsc */,
1A569CD40D7E2B82007C3983 /* jni_jsobject.h */,
1A569CD30D7E2B82007C3983 /* jni_jsobject.mm */,
1A569CD50D7E2B82007C3983 /* jni_objc.mm */,
- 1A569CD60D7E2B82007C3983 /* jni_runtime.cpp */,
- 1A569CD70D7E2B82007C3983 /* jni_runtime.h */,
- 1A569CD80D7E2B82007C3983 /* jni_utility.cpp */,
- 1A569CD90D7E2B82007C3983 /* jni_utility.h */,
);
name = jni;
path = bridge/jni;
599D1E2F10C97D4C00E0EF12 /* jsc */ = {
isa = PBXGroup;
children = (
+ 59EE122D1106080F00885116 /* JNIUtilityPrivate.h */,
+ 59EE122B1106080500885116 /* JNIUtilityPrivate.cpp */,
59BC393E11054A1300FD85DB /* JavaStringJSC.h */,
59E560A81105336F00AA1258 /* JavaClassJSC.cpp */,
59E560A61105336600AA1258 /* JavaClassJSC.h */,
59A9E7B11104759400DFB4C1 /* JavaInstanceJSC.h */,
59A9E7AF1104758800DFB4C1 /* JavaInstanceJSC.cpp */,
- 599D1E3010C97D6E00E0EF12 /* jni_utility_private.cpp */,
- 599D1E3110C97D6E00E0EF12 /* jni_utility_private.h */,
);
name = jsc;
sourceTree = "<group>";
FE80D7B70E9C1F25000D6F75 /* Geolocation.cpp */,
FE80D7B80E9C1F25000D6F75 /* Geolocation.h */,
FE80D7B90E9C1F25000D6F75 /* Geolocation.idl */,
+ BC56CB1C10D5AC8000A77C64 /* GeolocationController.cpp */,
+ BC56CB1D10D5AC8000A77C64 /* GeolocationController.h */,
+ BC56CB1E10D5AC8000A77C64 /* GeolocationControllerClient.h */,
+ BC56CB1F10D5AC8000A77C64 /* GeolocationError.h */,
+ BC56CB2010D5AC8000A77C64 /* GeolocationPosition.h */,
FE80D7BB0E9C1F25000D6F75 /* Geoposition.h */,
FE80D7BC0E9C1F25000D6F75 /* Geoposition.idl */,
7693BACE106C2DCA007B0823 /* HaltablePlugin.h */,
1C81BA010E9733CB00266E07 /* JavaScriptProfile.h in Headers */,
1C81B9FF0E9733CB00266E07 /* JavaScriptProfileNode.h in Headers */,
1A569D040D7E2B82007C3983 /* jni_jsobject.h in Headers */,
- 1A569D070D7E2B82007C3983 /* jni_runtime.h in Headers */,
- 1A569D090D7E2B82007C3983 /* jni_utility.h in Headers */,
93309DF4099E64920056E581 /* JoinTextNodesCommand.h in Headers */,
418F88050FF957AF0080F045 /* JSAbstractWorker.h in Headers */,
65DF31DB09D1C123000BE325 /* JSAttr.h in Headers */,
7A0E770F10C00A8800A0276E /* InspectorFrontendHost.h in Headers */,
7A0E771F10C00DB100A0276E /* JSInspectorFrontendHost.h in Headers */,
F4EAF4AF10C742B1009100D3 /* OpenTypeSanitizer.h in Headers */,
- 599D1E3310C97D6E00E0EF12 /* jni_utility_private.h in Headers */,
7ADE722610CBBB9B006B3B3A /* ContextMenuSelectionHandler.h in Headers */,
0C3F1F5B10C8871200D72CE1 /* WebGLUniformLocation.h in Headers */,
0C45342810CDBBFA00869157 /* JSWebGLUniformLocation.h in Headers */,
+ BC56CB2210D5AC8000A77C64 /* GeolocationController.h in Headers */,
+ BC56CB2310D5AC8000A77C64 /* GeolocationControllerClient.h in Headers */,
+ BC56CB2410D5AC8000A77C64 /* GeolocationError.h in Headers */,
+ BC56CB2510D5AC8000A77C64 /* GeolocationPosition.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
939D050109D9FF6B00984996 /* Check For Global Initializers */,
599E759011055A1F00D904FA /* Bridge.h in Headers */,
933457E60EBFDF6B00B80894 /* Check For Exit Time Destructors */,
+ 5913953B110758450083EC55 /* JNIBridge.h in Headers */,
+ 59EE122E1106080F00885116 /* JNIUtilityPrivate.h in Headers */,
+ 59EE12321106082900885116 /* JNIUtility.h in Headers */,
5D0D540D0E9862F60029E223 /* Check For Weak VTables */,
);
buildRules = (
1C81BA000E9733CB00266E07 /* JavaScriptProfileNode.cpp in Sources */,
1A569D030D7E2B82007C3983 /* jni_jsobject.mm in Sources */,
1A569D050D7E2B82007C3983 /* jni_objc.mm in Sources */,
- 1A569D060D7E2B82007C3983 /* jni_runtime.cpp in Sources */,
- 1A569D080D7E2B82007C3983 /* jni_utility.cpp in Sources */,
93309DF3099E64920056E581 /* JoinTextNodesCommand.cpp in Sources */,
418F88040FF957AE0080F045 /* JSAbstractWorker.cpp in Sources */,
415B7C570FF598E6006770F7 /* JSAbstractWorkerCustom.cpp in Sources */,
7A0E771E10C00DB100A0276E /* JSInspectorFrontendHost.cpp in Sources */,
F4EAF4AE10C742B1009100D3 /* OpenTypeSanitizer.cpp in Sources */,
D01A27AD10C9BFD800026A42 /* SpaceSplitString.cpp in Sources */,
- 599D1E3210C97D6E00E0EF12 /* jni_utility_private.cpp in Sources */,
0C3F1F5A10C8871200D72CE1 /* WebGLUniformLocation.cpp in Sources */,
0C45342710CDBBFA00869157 /* JSWebGLUniformLocation.cpp in Sources */,
+ BC56CB2110D5AC8000A77C64 /* GeolocationController.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXTargetDependency section */
599E759211055A2A00D904FA /* Bridge.cpp in Sources */,
+ 59EE122C1106080500885116 /* JNIUtilityPrivate.cpp in Sources */,
+ 59EE12301106081F00885116 /* JNIUtility.cpp in Sources */,
+ 5913953D1107584E0083EC55 /* JNIBridge.cpp in Sources */,
/* Begin PBXVariantGroup section */
BCC64F5F0DCFB84E0081EF3B /* localizedStrings.js */ = {
isa = PBXVariantGroup;
</set>
<set append="1" var="WEBCORE_SOURCES_BRIDGE">
- bridge/Bridge.cpp
bridge/IdentifierRep.cpp
bridge/NP_jsobject.cpp
bridge/c/c_class.cpp
bridge/c/c_instance.cpp
bridge/c/c_runtime.cpp
bridge/c/c_utility.cpp
+ bridge/jsc/BridgeJSC.cpp
bridge/npruntime.cpp
bridge/runtime_array.cpp
bridge/runtime_method.cpp
page/FrameTree.cpp
page/FrameView.cpp
page/Geolocation.cpp
+ page/GeolocationController.cpp
page/History.cpp
page/Location.cpp
page/MouseEventWithHitTestResults.cpp
#include "SVGZoomEvent.h"
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
#include "JSTouchEvent.h"
#include "TouchEvent.h"
#endif
#endif
else if (event->isCompositionEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, CompositionEvent, event);
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
else if (event->isTouchEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, TouchEvent, event);
#endif
// keyboard events
|| type == eventNames().keydownEvent || type == eventNames().keypressEvent
|| type == eventNames().keyupEvent
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
// touch events
|| type == eventNames().touchstartEvent || type == eventNames().touchmoveEvent
|| type == eventNames().touchendEvent || type == eventNames().touchcancelEvent
class ChildThreadDOMData : public DOMData {
public:
ChildThreadDOMData();
-#if PLATFORM(ANDROID)
- virtual ~ChildThreadDOMData() { }
-#endif
DOMDataStore& getStore();
{
}
+DOMData::~DOMData()
+{
+}
+
DOMData* DOMData::getCurrent()
{
if (WTF::isMainThread())
class DOMData : public Noncopyable {
public:
DOMData();
-#if PLATFORM(ANDROID)
- virtual ~DOMData() { }
-#endif
+ virtual ~DOMData();
static DOMData* getCurrent();
virtual DOMDataStore& getStore() = 0;
#endif // SVG
#if PLATFORM(ANDROID)
+#include "Connection.h"
// TODO: Upstream TOUCH_EVENTS guard.
#if ENABLE(TOUCH_EVENTS)
#include "Touch.h"
typedef Vector<GrouperItem> GrouperList;
-#if PLATFORM(ANDROID)
-// Android's implementation of std::sort seems unable to do the necessary
-// template matching to pick up operator< for GrouperItem, so we have to
-// manually pass a comparison function.
-static bool compareGrouperItem(const GrouperItem& a, const GrouperItem& b)
-{
- return a < b;
-}
-#endif
-
class ObjectGrouperVisitor : public DOMWrapperMap<Node>::Visitor {
public:
ObjectGrouperVisitor()
void applyGrouping()
{
// Group by sorting by the group id.
-#if PLATFORM(ANDROID)
- std::sort(m_grouper.begin(), m_grouper.end(), compareGrouperItem);
-#else
std::sort(m_grouper.begin(), m_grouper.end());
-#endif
// FIXME Should probably work in iterators here, but indexes were easier for my simple mind.
for (size_t i = 0; i < m_grouper.size(); ) {
#include "V8PositionError.h"
#if PLATFORM(ANDROID)
+#include "V8Connection.h"
// TODO: Upstream these guards to webkit.org
#if ENABLE(TOUCH_EVENTS)
#include "V8Touch.h"
#else
#define DOM_OBJECT_TOUCH_EVENT_TYPES(V)
#endif
+#define DOM_OBJECT_CONNECTION_TYPES(V) \
+ V(CONNECTION, Connection)
#endif
#if PLATFORM(ANDROID)
DOM_OBJECT_INSPECTOR_TYPES(V) \
DOM_OBJECT_GEOLOCATION_TYPES(V) \
DOM_OBJECT_TOUCH_EVENT_TYPES(V) \
+ DOM_OBJECT_CONNECTION_TYPES(V) \
DOM_OBJECT_VOIDCALLBACK_TYPES(V)
#endif
/*
* Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved.
+ * 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
#ifndef Bridge_h
#define Bridge_h
-#include <runtime/JSString.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
+#include "BridgeJSC.h"
namespace JSC {
-class ArgList;
-class Identifier;
-class JSGlobalObject;
-class PropertyNameArray;
-class RuntimeObjectImp;
-
namespace Bindings {
-class Instance;
-class Method;
-class RootObject;
-
-typedef Vector<Method*> MethodList;
-
-class Field {
-public:
- virtual JSValue valueFromInstance(ExecState*, const Instance*) const = 0;
- virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const = 0;
-
- virtual ~Field() { }
-};
-
class Method : public Noncopyable {
public:
virtual int numParameters() const = 0;
virtual ~Method() { }
};
-class Class : public Noncopyable {
-public:
- virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0;
- virtual Field* fieldNamed(const Identifier&, Instance*) const = 0;
- virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); }
-
- virtual ~Class() { }
-};
-
-typedef void (*KJSDidExecuteFunctionPtr)(ExecState*, JSObject* rootObject);
-
-class Instance : public RefCounted<Instance> {
-public:
- Instance(PassRefPtr<RootObject>);
-
- static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func);
- static KJSDidExecuteFunctionPtr didExecuteFunction();
-
- // These functions are called before and after the main entry points into
- // the native implementations. They can be used to establish and cleanup
- // any needed state.
- void begin();
- void end();
-
- virtual Class* getClass() const = 0;
- RuntimeObjectImp* createRuntimeObject(ExecState*);
- void willInvalidateRuntimeObject();
- void willDestroyRuntimeObject();
-
- // Returns false if the value was not set successfully.
- virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; }
-
- virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0;
-
- virtual bool supportsInvokeDefaultMethod() const { return false; }
- virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); }
-
- virtual bool supportsConstruct() const { return false; }
- virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); }
-
- virtual void getPropertyNames(ExecState*, PropertyNameArray&) { }
-
- virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0;
-
- virtual JSValue valueOf(ExecState* exec) const = 0;
-
- RootObject* rootObject() const;
-
- virtual ~Instance();
-
- virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&) { return false; }
- virtual bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) { return false; }
- virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&) { }
-
-protected:
- virtual void virtualBegin() { }
- virtual void virtualEnd() { }
- virtual RuntimeObjectImp* newRuntimeObject(ExecState*);
-
- RefPtr<RootObject> m_rootObject;
-
-private:
- RuntimeObjectImp* m_runtimeObject;
-};
-
-class Array : public Noncopyable {
-public:
- Array(PassRefPtr<RootObject>);
- virtual ~Array();
-
- virtual void setValueAt(ExecState*, unsigned index, JSValue) const = 0;
- virtual JSValue valueAt(ExecState*, unsigned index) const = 0;
- virtual unsigned int getLength() const = 0;
-
-protected:
- RefPtr<RootObject> m_rootObject;
-};
-
-const char* signatureForParameters(const ArgList&);
-
-typedef HashMap<RefPtr<UString::Rep>, MethodList*> MethodListMap;
-typedef HashMap<RefPtr<UString::Rep>, Method*> MethodMap;
-typedef HashMap<RefPtr<UString::Rep>, Field*> FieldMap;
-
} // namespace Bindings
} // namespace JSC
--- /dev/null
+/*
+ * Copyright (C) 2003, 2004, 2005, 2007, 2009 Apple Inc. All rights reserved.
+ * 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:
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. 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.
+ */
+
+#include "config.h"
+#include "JNIBridge.h"
+
+#if ENABLE(MAC_JAVA_BRIDGE)
+
+#include "CString.h"
+#include "JNIUtility.h"
+#include "JNIUtilityPrivate.h"
+#include "StringBuilder.h"
+#include "runtime_array.h"
+#include "runtime_object.h"
+#include "runtime_root.h"
+#include <runtime/Error.h>
+#include <runtime/JSLock.h>
+
+#ifdef NDEBUG
+#define JS_LOG(formatAndArgs...) ((void)0)
+#else
+#define JS_LOG(formatAndArgs...) { \
+ fprintf(stderr, "%s:%d -- %s: ", __FILE__, __LINE__, __FUNCTION__); \
+ fprintf(stderr, formatAndArgs); \
+}
+#endif
+
+using namespace JSC;
+using namespace JSC::Bindings;
+using namespace WebCore;
+
+
+JavaParameter::JavaParameter(JNIEnv* env, jstring type)
+{
+ m_type = JavaString(env, type);
+ m_JNIType = JNITypeFromClassName(m_type.UTF8String());
+}
+
+JavaField::JavaField(JNIEnv* env, jobject aField)
+{
+ // Get field type
+ jobject fieldType = callJNIMethod<jobject>(aField, "getType", "()Ljava/lang/Class;");
+ jstring fieldTypeName = static_cast<jstring>(callJNIMethod<jobject>(fieldType, "getName", "()Ljava/lang/String;"));
+ m_type = JavaString(env, fieldTypeName);
+ m_JNIType = JNITypeFromClassName(m_type.UTF8String());
+
+ // Get field name
+ jstring fieldName = static_cast<jstring>(callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;"));
+ m_name = JavaString(env, fieldName);
+
+ m_field = new JObjectWrapper(aField);
+}
+
+JSValue JavaArray::convertJObjectToArray(ExecState* exec, jobject anObject, const char* type, PassRefPtr<RootObject> rootObject)
+{
+ if (type[0] != '[')
+ return jsUndefined();
+
+ return new (exec) RuntimeArray(exec, new JavaArray(anObject, type, rootObject));
+}
+
+jvalue JavaField::dispatchValueFromInstance(ExecState* exec, const JavaInstance* instance, const char* name, const char* sig, JNIType returnType) const
+{
+ jobject jinstance = instance->javaInstance();
+ jobject fieldJInstance = m_field->m_instance;
+ JNIEnv* env = getJNIEnv();
+ jvalue result;
+
+ bzero(&result, sizeof(jvalue));
+ jclass cls = env->GetObjectClass(fieldJInstance);
+ if (cls) {
+ jmethodID mid = env->GetMethodID(cls, name, sig);
+ if (mid) {
+ RootObject* rootObject = instance->rootObject();
+ if (rootObject && rootObject->nativeHandle()) {
+ JSValue exceptionDescription;
+ jvalue args[1];
+
+ args[0].l = jinstance;
+ dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription);
+ if (exceptionDescription)
+ throwError(exec, GeneralError, exceptionDescription.toString(exec));
+ }
+ }
+ }
+ return result;
+}
+
+JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const
+{
+ const JavaInstance* instance = static_cast<const JavaInstance*>(i);
+
+ JSValue jsresult = jsUndefined();
+
+ switch (m_JNIType) {
+ case array_type:
+ case object_type:
+ {
+ jvalue result = dispatchValueFromInstance(exec, instance, "get", "(Ljava/lang/Object;)Ljava/lang/Object;", object_type);
+ jobject anObject = result.l;
+
+ const char* arrayType = type();
+ if (arrayType[0] == '[')
+ jsresult = JavaArray::convertJObjectToArray(exec, anObject, arrayType, instance->rootObject());
+ else if (anObject)
+ jsresult = JavaInstance::create(anObject, instance->rootObject())->createRuntimeObject(exec);
+ }
+ break;
+
+ case boolean_type:
+ jsresult = jsBoolean(dispatchValueFromInstance(exec, instance, "getBoolean", "(Ljava/lang/Object;)Z", boolean_type).z);
+ break;
+
+ case byte_type:
+ case char_type:
+ case short_type:
+
+ case int_type:
+ {
+ jint value;
+ jvalue result = dispatchValueFromInstance(exec, instance, "getInt", "(Ljava/lang/Object;)I", int_type);
+ value = result.i;
+ jsresult = jsNumber(exec, static_cast<int>(value));
+ }
+ break;
+
+ case long_type:
+ case float_type:
+ case double_type:
+ {
+ jdouble value;
+ jvalue result = dispatchValueFromInstance(exec, instance, "getDouble", "(Ljava/lang/Object;)D", double_type);
+ value = result.i;
+ jsresult = jsNumber(exec, static_cast<double>(value));
+ }
+ break;
+ default:
+ break;
+ }
+
+ JS_LOG("getting %s = %s\n", UString(name()).UTF8String().c_str(), jsresult.toString(exec).ascii());
+
+ return jsresult;
+}
+
+void JavaField::dispatchSetValueToInstance(ExecState* exec, const JavaInstance* instance, jvalue javaValue, const char* name, const char* sig) const
+{
+ jobject jinstance = instance->javaInstance();
+ jobject fieldJInstance = m_field->m_instance;
+ JNIEnv* env = getJNIEnv();
+
+ jclass cls = env->GetObjectClass(fieldJInstance);
+ if (cls) {
+ jmethodID mid = env->GetMethodID(cls, name, sig);
+ if (mid) {
+ RootObject* rootObject = instance->rootObject();
+ if (rootObject && rootObject->nativeHandle()) {
+ JSValue exceptionDescription;
+ jvalue args[2];
+ jvalue result;
+
+ args[0].l = jinstance;
+ args[1] = javaValue;
+ dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription);
+ if (exceptionDescription)
+ throwError(exec, GeneralError, exceptionDescription.toString(exec));
+ }
+ }
+ }
+}
+
+void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue aValue) const
+{
+ const JavaInstance* instance = static_cast<const JavaInstance*>(i);
+ jvalue javaValue = convertValueToJValue(exec, aValue, m_JNIType, type());
+
+ JS_LOG("setting value %s to %s\n", UString(name()).UTF8String().c_str(), aValue.toString(exec).ascii());
+
+ switch (m_JNIType) {
+ case array_type:
+ case object_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V");
+ }
+ break;
+
+ case boolean_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setBoolean", "(Ljava/lang/Object;Z)V");
+ }
+ break;
+
+ case byte_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setByte", "(Ljava/lang/Object;B)V");
+ }
+ break;
+
+ case char_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setChar", "(Ljava/lang/Object;C)V");
+ }
+ break;
+
+ case short_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setShort", "(Ljava/lang/Object;S)V");
+ }
+ break;
+
+ case int_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setInt", "(Ljava/lang/Object;I)V");
+ }
+ break;
+
+ case long_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setLong", "(Ljava/lang/Object;J)V");
+ }
+ break;
+
+ case float_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setFloat", "(Ljava/lang/Object;F)V");
+ }
+ break;
+
+ case double_type:
+ {
+ dispatchSetValueToInstance(exec, instance, javaValue, "setDouble", "(Ljava/lang/Object;D)V");
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod)
+{
+ // Get return type
+ jobject returnType = callJNIMethod<jobject>(aMethod, "getReturnType", "()Ljava/lang/Class;");
+ jstring returnTypeName = static_cast<jstring>(callJNIMethod<jobject>(returnType, "getName", "()Ljava/lang/String;"));
+ m_returnType = JavaString(env, returnTypeName);
+ m_JNIReturnType = JNITypeFromClassName(m_returnType.UTF8String());
+ env->DeleteLocalRef(returnType);
+ env->DeleteLocalRef(returnTypeName);
+
+ // Get method name
+ jstring methodName = static_cast<jstring>(callJNIMethod<jobject>(aMethod, "getName", "()Ljava/lang/String;"));
+ m_name = JavaString(env, methodName);
+ env->DeleteLocalRef(methodName);
+
+ // Get parameters
+ jarray jparameters = static_cast<jarray>(callJNIMethod<jobject>(aMethod, "getParameterTypes", "()[Ljava/lang/Class;"));
+ m_numParameters = env->GetArrayLength(jparameters);
+ m_parameters = new JavaParameter[m_numParameters];
+
+ for (int i = 0; i < m_numParameters; i++) {
+ jobject aParameter = env->GetObjectArrayElement(static_cast<jobjectArray>(jparameters), i);
+ jstring parameterName = static_cast<jstring>(callJNIMethod<jobject>(aParameter, "getName", "()Ljava/lang/String;"));
+ m_parameters[i] = JavaParameter(env, parameterName);
+ env->DeleteLocalRef(aParameter);
+ env->DeleteLocalRef(parameterName);
+ }
+ env->DeleteLocalRef(jparameters);
+
+ // Created lazily.
+ m_signature = 0;
+ m_methodID = 0;
+
+ jclass modifierClass = env->FindClass("java/lang/reflect/Modifier");
+ int modifiers = callJNIMethod<jint>(aMethod, "getModifiers", "()I");
+ m_isStatic = static_cast<bool>(callJNIStaticMethod<jboolean>(modifierClass, "isStatic", "(I)Z", modifiers));
+ env->DeleteLocalRef(modifierClass);
+}
+
+JavaMethod::~JavaMethod()
+{
+ if (m_signature)
+ free(m_signature);
+ delete[] m_parameters;
+};
+
+// JNI method signatures use '/' between components of a class name, but
+// we get '.' between components from the reflection API.
+static void appendClassName(StringBuilder& builder, const char* className)
+{
+ ASSERT(JSLock::lockCount() > 0);
+
+ char* c = strdup(className);
+
+ char* result = c;
+ while (*c) {
+ if (*c == '.')
+ *c = '/';
+ c++;
+ }
+
+ builder.append(result);
+
+ free(result);
+}
+
+const char* JavaMethod::signature() const
+{
+ if (!m_signature) {
+ JSLock lock(SilenceAssertionsOnly);
+
+ StringBuilder signatureBuilder;
+ signatureBuilder.append("(");
+ for (int i = 0; i < m_numParameters; i++) {
+ JavaParameter* aParameter = parameterAt(i);
+ JNIType type = aParameter->getJNIType();
+ if (type == array_type)
+ appendClassName(signatureBuilder, aParameter->type());
+ else {
+ signatureBuilder.append(signatureFromPrimitiveType(type));
+ if (type == object_type) {
+ appendClassName(signatureBuilder, aParameter->type());
+ signatureBuilder.append(";");
+ }
+ }
+ }
+ signatureBuilder.append(")");
+
+ const char* returnType = m_returnType.UTF8String();
+ if (m_JNIReturnType == array_type)
+ appendClassName(signatureBuilder, returnType);
+ else {
+ signatureBuilder.append(signatureFromPrimitiveType(m_JNIReturnType));
+ if (m_JNIReturnType == object_type) {
+ appendClassName(signatureBuilder, returnType);
+ signatureBuilder.append(";");
+ }
+ }
+
+ String signatureString = signatureBuilder.toString();
+ m_signature = strdup(signatureString.utf8().data());
+ }
+
+ return m_signature;
+}
+
+JNIType JavaMethod::JNIReturnType() const
+{
+ return m_JNIReturnType;
+}
+
+jmethodID JavaMethod::methodID(jobject obj) const
+{
+ if (!m_methodID)
+ m_methodID = getMethodID(obj, m_name.UTF8String(), signature());
+ return m_methodID;
+}
+
+
+JavaArray::JavaArray(jobject array, const char* type, PassRefPtr<RootObject> rootObject)
+ : Array(rootObject)
+{
+ m_array = new JObjectWrapper(array);
+ // Java array are fixed length, so we can cache length.
+ JNIEnv* env = getJNIEnv();
+ m_length = env->GetArrayLength(static_cast<jarray>(m_array->m_instance));
+ m_type = strdup(type);
+ m_rootObject = rootObject;
+}
+
+JavaArray::~JavaArray()
+{
+ free(const_cast<char*>(m_type));
+}
+
+RootObject* JavaArray::rootObject() const
+{
+ return m_rootObject && m_rootObject->isValid() ? m_rootObject.get() : 0;
+}
+
+void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValue aValue) const
+{
+ JNIEnv* env = getJNIEnv();
+ char* javaClassName = 0;
+
+ JNIType arrayType = JNITypeFromPrimitiveType(m_type[1]);
+ if (m_type[1] == 'L') {
+ // The type of the array will be something like:
+ // "[Ljava.lang.string;". This is guaranteed, so no need
+ // for extra sanity checks.
+ javaClassName = strdup(&m_type[2]);
+ javaClassName[strchr(javaClassName, ';')-javaClassName] = 0;
+ }
+ jvalue aJValue = convertValueToJValue(exec, aValue, arrayType, javaClassName);
+
+ switch (arrayType) {
+ case object_type:
+ {
+ env->SetObjectArrayElement(static_cast<jobjectArray>(javaArray()), index, aJValue.l);
+ break;
+ }
+
+ case boolean_type:
+ {
+ env->SetBooleanArrayRegion(static_cast<jbooleanArray>(javaArray()), index, 1, &aJValue.z);
+ break;
+ }
+
+ case byte_type:
+ {
+ env->SetByteArrayRegion(static_cast<jbyteArray>(javaArray()), index, 1, &aJValue.b);
+ break;
+ }
+
+ case char_type:
+ {
+ env->SetCharArrayRegion(static_cast<jcharArray>(javaArray()), index, 1, &aJValue.c);
+ break;
+ }
+
+ case short_type:
+ {
+ env->SetShortArrayRegion(static_cast<jshortArray>(javaArray()), index, 1, &aJValue.s);
+ break;
+ }
+
+ case int_type:
+ {
+ env->SetIntArrayRegion(static_cast<jintArray>(javaArray()), index, 1, &aJValue.i);
+ break;
+ }
+
+ case long_type:
+ {
+ env->SetLongArrayRegion(static_cast<jlongArray>(javaArray()), index, 1, &aJValue.j);
+ }
+
+ case float_type:
+ {
+ env->SetFloatArrayRegion(static_cast<jfloatArray>(javaArray()), index, 1, &aJValue.f);
+ break;
+ }
+
+ case double_type:
+ {
+ env->SetDoubleArrayRegion(static_cast<jdoubleArray>(javaArray()), index, 1, &aJValue.d);
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (javaClassName)
+ free(const_cast<char*>(javaClassName));
+}
+
+
+JSValue JavaArray::valueAt(ExecState* exec, unsigned index) const
+{
+ JNIEnv* env = getJNIEnv();
+ JNIType arrayType = JNITypeFromPrimitiveType(m_type[1]);
+ switch (arrayType) {
+ case object_type:
+ {
+ jobjectArray objectArray = static_cast<jobjectArray>(javaArray());
+ jobject anObject;
+ anObject = env->GetObjectArrayElement(objectArray, index);
+
+ // No object?
+ if (!anObject)
+ return jsNull();
+
+ // Nested array?
+ if (m_type[1] == '[')
+ return JavaArray::convertJObjectToArray(exec, anObject, m_type + 1, rootObject());
+ // or array of other object type?
+ return JavaInstance::create(anObject, rootObject())->createRuntimeObject(exec);
+ }
+
+ case boolean_type:
+ {
+ jbooleanArray booleanArray = static_cast<jbooleanArray>(javaArray());
+ jboolean aBoolean;
+ env->GetBooleanArrayRegion(booleanArray, index, 1, &aBoolean);
+ return jsBoolean(aBoolean);
+ }
+
+ case byte_type:
+ {
+ jbyteArray byteArray = static_cast<jbyteArray>(javaArray());
+ jbyte aByte;
+ env->GetByteArrayRegion(byteArray, index, 1, &aByte);
+ return jsNumber(exec, aByte);
+ }
+
+ case char_type:
+ {
+ jcharArray charArray = static_cast<jcharArray>(javaArray());
+ jchar aChar;
+ env->GetCharArrayRegion(charArray, index, 1, &aChar);
+ return jsNumber(exec, aChar);
+ break;
+ }
+
+ case short_type:
+ {
+ jshortArray shortArray = static_cast<jshortArray>(javaArray());
+ jshort aShort;
+ env->GetShortArrayRegion(shortArray, index, 1, &aShort);
+ return jsNumber(exec, aShort);
+ }
+
+ case int_type:
+ {
+ jintArray intArray = static_cast<jintArray>(javaArray());
+ jint anInt;
+ env->GetIntArrayRegion(intArray, index, 1, &anInt);
+ return jsNumber(exec, anInt);
+ }
+
+ case long_type:
+ {
+ jlongArray longArray = static_cast<jlongArray>(javaArray());
+ jlong aLong;
+ env->GetLongArrayRegion(longArray, index, 1, &aLong);
+ return jsNumber(exec, aLong);
+ }
+
+ case float_type:
+ {
+ jfloatArray floatArray = static_cast<jfloatArray>(javaArray());
+ jfloat aFloat;
+ env->GetFloatArrayRegion(floatArray, index, 1, &aFloat);
+ return jsNumber(exec, aFloat);
+ }
+
+ case double_type:
+ {
+ jdoubleArray doubleArray = static_cast<jdoubleArray>(javaArray());
+ jdouble aDouble;
+ env->GetDoubleArrayRegion(doubleArray, index, 1, &aDouble);
+ return jsNumber(exec, aDouble);
+ }
+ default:
+ break;
+ }
+ return jsUndefined();
+}
+
+unsigned int JavaArray::getLength() const
+{
+ return m_length;
+}
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
--- /dev/null
+/*
+ * Copyright (C) 2003, 2004, 2005, 2007, 2009, 2010 Apple Inc. All rights reserved.
+ * 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:
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. 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.
+ */
+
+#ifndef JNIBridge_h
+#define JNIBridge_h
+
+#if ENABLE(MAC_JAVA_BRIDGE)
+
+#include "JNIUtility.h"
+#include "JavaInstanceJSC.h"
+
+#if USE(JSC)
+#include "JavaStringJSC.h"
+#endif
+
+namespace JSC {
+
+namespace Bindings {
+
+typedef const char* RuntimeType;
+
+class JavaString {
+public:
+ JavaString()
+ {
+ m_impl.init();
+ }
+
+ JavaString(JNIEnv* e, jstring s)
+ {
+ m_impl.init(e, s);
+ }
+
+ JavaString(jstring s)
+ {
+ m_impl.init(getJNIEnv(), s);
+ }
+
+ const char* UTF8String() const { return m_impl.UTF8String(); }
+ const jchar* uchars() const { return m_impl.uchars(); }
+ int length() const { return m_impl.length(); }
+#if USE(JSC)
+ operator UString() const { return m_impl.uString(); }
+#endif
+
+private:
+ JavaStringImpl m_impl;
+};
+
+class JavaParameter {
+public:
+ JavaParameter() : m_JNIType(invalid_type) { }
+ JavaParameter(JNIEnv*, jstring type);
+ virtual ~JavaParameter() { }
+
+ RuntimeType type() const { return m_type.UTF8String(); }
+ JNIType getJNIType() const { return m_JNIType; }
+
+private:
+ JavaString m_type;
+ JNIType m_JNIType;
+};
+
+
+class JavaField : public Field {
+public:
+ JavaField(JNIEnv*, jobject aField);
+
+ virtual JSValue valueFromInstance(ExecState*, const Instance*) const;
+ virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const;
+
+ const JavaString& name() const { return m_name; }
+ virtual RuntimeType type() const { return m_type.UTF8String(); }
+
+ JNIType getJNIType() const { return m_JNIType; }
+
+private:
+ void dispatchSetValueToInstance(ExecState*, const JavaInstance*, jvalue, const char* name, const char* sig) const;
+ jvalue dispatchValueFromInstance(ExecState*, const JavaInstance*, const char* name, const char* sig, JNIType returnType) const;
+
+ JavaString m_name;
+ JavaString m_type;
+ JNIType m_JNIType;
+ RefPtr<JObjectWrapper> m_field;
+};
+
+
+class JavaMethod : public Method {
+public:
+ JavaMethod(JNIEnv*, jobject aMethod);
+ ~JavaMethod();
+
+ const JavaString& name() const { return m_name; }
+ RuntimeType returnType() const { return m_returnType.UTF8String(); }
+ JavaParameter* parameterAt(int i) const { return &m_parameters[i]; }
+ int numParameters() const { return m_numParameters; }
+
+ const char* signature() const;
+ JNIType JNIReturnType() const;
+
+ jmethodID methodID(jobject obj) const;
+
+ bool isStatic() const { return m_isStatic; }
+
+private:
+ JavaParameter* m_parameters;
+ int m_numParameters;
+ JavaString m_name;
+ mutable char* m_signature;
+ JavaString m_returnType;
+ JNIType m_JNIReturnType;
+ mutable jmethodID m_methodID;
+ bool m_isStatic;
+};
+
+class JavaArray : public Array {
+public:
+ JavaArray(jobject array, const char* type, PassRefPtr<RootObject>);
+ virtual ~JavaArray();
+
+ RootObject* rootObject() const;
+
+ virtual void setValueAt(ExecState*, unsigned int index, JSValue) const;
+ virtual JSValue valueAt(ExecState*, unsigned int index) const;
+ virtual unsigned int getLength() const;
+
+ jobject javaArray() const { return m_array->m_instance; }
+
+ static JSValue convertJObjectToArray(ExecState*, jobject, const char* type, PassRefPtr<RootObject>);
+
+private:
+ RefPtr<JObjectWrapper> m_array;
+ unsigned int m_length;
+ const char* m_type;
+};
+
+} // namespace Bindings
+
+} // namespace JSC
+
+#endif // ENABLE(MAC_JAVA_BRIDGE)
+
+#endif // JNIBridge_h
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
-#include "jni_utility.h"
+#include "JNIUtility.h"
#if ENABLE(MAC_JAVA_BRIDGE)
namespace Bindings {
-static jint KJS_GetCreatedJavaVMs(JavaVM** vmBuf, jsize bufLen, jsize* nVMs)
+static jint KJSGetCreatedJavaVMs(JavaVM** vmBuf, jsize bufLen, jsize* nVMs)
{
static void* javaVMFramework = 0;
if (!javaVMFramework)
if (!javaVMFramework)
return JNI_ERR;
- static jint(*functionPointer)(JavaVM**, jsize, jsize *) = 0;
+ typedef jint(*FunctionPointerType)(JavaVM**, jsize, jsize*);
+ static FunctionPointerType functionPointer = 0;
if (!functionPointer)
- functionPointer = (jint(*)(JavaVM**, jsize, jsize *))dlsym(javaVMFramework, "JNI_GetCreatedJavaVMs");
+ functionPointer = reinterpret_cast<FunctionPointerType>(dlsym(javaVMFramework, "JNI_GetCreatedJavaVMs"));
if (!functionPointer)
return JNI_ERR;
return functionPointer(vmBuf, bufLen, nVMs);
}
-static JavaVM *jvm = 0;
+static JavaVM* jvm = 0;
// Provide the ability for an outside component to specify the JavaVM to use
-// If the jvm value is set, the getJavaVM function below will just return.
+// If the jvm value is set, the getJavaVM function below will just return.
// In getJNIEnv(), if AttachCurrentThread is called to a VM that is already
// attached, the result is a no-op.
-void setJavaVM(JavaVM *javaVM)
+void setJavaVM(JavaVM* javaVM)
{
jvm = javaVM;
}
-JavaVM *getJavaVM()
+JavaVM* getJavaVM()
{
if (jvm)
return jvm;
- JavaVM *jvmArray[1];
+ JavaVM* jvmArray[1];
jsize bufLen = 1;
jsize nJVMs = 0;
jint jniError = 0;
// Assumes JVM is already running ..., one per process
- jniError = KJS_GetCreatedJavaVMs(jvmArray, bufLen, &nJVMs);
- if ( jniError == JNI_OK && nJVMs > 0 ) {
+ jniError = KJSGetCreatedJavaVMs(jvmArray, bufLen, &nJVMs);
+ if (jniError == JNI_OK && nJVMs > 0)
jvm = jvmArray[0];
- }
- else
- fprintf(stderr, "%s: JNI_GetCreatedJavaVMs failed, returned %ld\n", __PRETTY_FUNCTION__, (long)jniError);
-
+ else
+ fprintf(stderr, "%s: JNI_GetCreatedJavaVMs failed, returned %ld\n", __PRETTY_FUNCTION__, static_cast<long>(jniError));
+
return jvm;
}
} u;
jint jniError = 0;
- jniError = (getJavaVM())->AttachCurrentThread(&u.dummy, NULL);
+ jniError = getJavaVM()->AttachCurrentThread(&u.dummy, 0);
if (jniError == JNI_OK)
return u.env;
- else
- fprintf(stderr, "%s: AttachCurrentThread failed, returned %ld\n", __PRETTY_FUNCTION__, (long)jniError);
- return NULL;
+ fprintf(stderr, "%s: AttachCurrentThread failed, returned %ld\n", __PRETTY_FUNCTION__, static_cast<long>(jniError));
+ return 0;
}
-jmethodID getMethodID (jobject obj, const char *name, const char *sig)
+jmethodID getMethodID(jobject obj, const char* name, const char* sig)
{
- JNIEnv *env = getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jmethodID mid = 0;
-
- if ( env != NULL) {
- jclass cls = env->GetObjectClass(obj);
- if ( cls != NULL ) {
+
+ if (env) {
+ jclass cls = env->GetObjectClass(obj);
+ if (cls) {
mid = env->GetMethodID(cls, name, sig);
if (!mid) {
env->ExceptionClear();
mid = env->GetStaticMethodID(cls, name, sig);
- if (!mid) {
+ if (!mid)
env->ExceptionClear();
- }
}
}
env->DeleteLocalRef(cls);
return mid;
}
-const char *getCharactersFromJString (jstring aJString)
+const char* getCharactersFromJString(jstring aJString)
{
- return getCharactersFromJStringInEnv (getJNIEnv(), aJString);
+ return getCharactersFromJStringInEnv(getJNIEnv(), aJString);
}
-void releaseCharactersForJString (jstring aJString, const char *s)
+void releaseCharactersForJString(jstring aJString, const char* s)
{
- releaseCharactersForJStringInEnv (getJNIEnv(), aJString, s);
+ releaseCharactersForJStringInEnv(getJNIEnv(), aJString, s);
}
-const char *getCharactersFromJStringInEnv (JNIEnv *env, jstring aJString)
+const char* getCharactersFromJStringInEnv(JNIEnv* env, jstring aJString)
{
jboolean isCopy;
- const char *s = env->GetStringUTFChars((jstring)aJString, &isCopy);
+ const char* s = env->GetStringUTFChars(aJString, &isCopy);
if (!s) {
env->ExceptionDescribe();
env->ExceptionClear();
- fprintf (stderr, "\n");
+ fprintf(stderr, "\n");
}
return s;
}
-void releaseCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const char *s)
+void releaseCharactersForJStringInEnv(JNIEnv* env, jstring aJString, const char* s)
{
- env->ReleaseStringUTFChars (aJString, s);
+ env->ReleaseStringUTFChars(aJString, s);
}
-const jchar *getUCharactersFromJStringInEnv (JNIEnv *env, jstring aJString)
+const jchar* getUCharactersFromJStringInEnv(JNIEnv* env, jstring aJString)
{
jboolean isCopy;
- const jchar *s = env->GetStringChars((jstring)aJString, &isCopy);
+ const jchar* s = env->GetStringChars(aJString, &isCopy);
if (!s) {
env->ExceptionDescribe();
env->ExceptionClear();
- fprintf (stderr, "\n");
+ fprintf(stderr, "\n");
}
return s;
}
-void releaseUCharactersForJStringInEnv (JNIEnv *env, jstring aJString, const jchar *s)
+void releaseUCharactersForJStringInEnv(JNIEnv* env, jstring aJString, const jchar* s)
{
- env->ReleaseStringChars (aJString, s);
+ env->ReleaseStringChars(aJString, s);
}
-JNIType JNITypeFromClassName(const char *name)
+JNIType JNITypeFromClassName(const char* name)
{
JNIType type;
-
- if (strcmp("byte",name) == 0)
+
+ if (!strcmp("byte", name))
type = byte_type;
- else if (strcmp("short",name) == 0)
+ else if (!strcmp("short", name))
type = short_type;
- else if (strcmp("int",name) == 0)
+ else if (!strcmp("int", name))
type = int_type;
- else if (strcmp("long",name) == 0)
+ else if (!strcmp("long", name))
type = long_type;
- else if (strcmp("float",name) == 0)
+ else if (!strcmp("float", name))
type = float_type;
- else if (strcmp("double",name) == 0)
+ else if (!strcmp("double", name))
type = double_type;
- else if (strcmp("char",name) == 0)
+ else if (!strcmp("char", name))
type = char_type;
- else if (strcmp("boolean",name) == 0)
+ else if (!strcmp("boolean", name))
type = boolean_type;
- else if (strcmp("void",name) == 0)
+ else if (!strcmp("void", name))
type = void_type;
- else if ('[' == name[0])
+ else if ('[' == name[0])
type = array_type;
else
type = object_type;
-
+
return type;
}
-const char *signatureFromPrimitiveType(JNIType type)
+const char* signatureFromPrimitiveType(JNIType type)
{
- switch (type){
- case void_type:
- return "V";
-
- case array_type:
- return "[";
-
- case object_type:
- return "L";
-
- case boolean_type:
- return "Z";
-
- case byte_type:
- return "B";
-
- case char_type:
- return "C";
-
- case short_type:
- return "S";
-
- case int_type:
- return "I";
-
- case long_type:
- return "J";
-
- case float_type:
- return "F";
-
- case double_type:
- return "D";
-
- case invalid_type:
- default:
+ switch (type) {
+ case void_type:
+ return "V";
+
+ case array_type:
+ return "[";
+
+ case object_type:
+ return "L";
+
+ case boolean_type:
+ return "Z";
+
+ case byte_type:
+ return "B";
+
+ case char_type:
+ return "C";
+
+ case short_type:
+ return "S";
+
+ case int_type:
+ return "I";
+
+ case long_type:
+ return "J";
+
+ case float_type:
+ return "F";
+
+ case double_type:
+ return "D";
+
+ case invalid_type:
+ default:
break;
}
return "";
JNIType JNITypeFromPrimitiveType(char type)
{
- switch (type){
- case 'V':
- return void_type;
-
- case 'L':
- return object_type;
-
- case '[':
- return array_type;
-
- case 'Z':
- return boolean_type;
-
- case 'B':
- return byte_type;
-
- case 'C':
- return char_type;
-
- case 'S':
- return short_type;
-
- case 'I':
- return int_type;
-
- case 'J':
- return long_type;
-
- case 'F':
- return float_type;
-
- case 'D':
- return double_type;
-
- default:
+ switch (type) {
+ case 'V':
+ return void_type;
+
+ case 'L':
+ return object_type;
+
+ case '[':
+ return array_type;
+
+ case 'Z':
+ return boolean_type;
+
+ case 'B':
+ return byte_type;
+
+ case 'C':
+ return char_type;
+
+ case 'S':
+ return short_type;
+
+ case 'I':
+ return int_type;
+
+ case 'J':
+ return long_type;
+
+ case 'F':
+ return float_type;
+
+ case 'D':
+ return double_type;
+
+ default:
break;
}
return invalid_type;
}
-jvalue getJNIField( jobject obj, JNIType type, const char *name, const char *signature)
+jvalue getJNIField(jobject obj, JNIType type, const char* name, const char* signature)
{
- JavaVM *jvm = getJavaVM();
- JNIEnv *env = getJNIEnv();
+ JavaVM* jvm = getJavaVM();
+ JNIEnv* env = getJNIEnv();
jvalue result;
- bzero (&result, sizeof(jvalue));
- if ( obj != NULL && jvm != NULL && env != NULL) {
+ bzero(&result, sizeof(jvalue));
+ if (obj && jvm && env) {
jclass cls = env->GetObjectClass(obj);
- if ( cls != NULL ) {
+ if (cls) {
jfieldID field = env->GetFieldID(cls, name, signature);
- if ( field != NULL ) {
+ if (field) {
switch (type) {
case array_type:
case object_type:
result.d = env->functions->GetDoubleField(env, obj, field);
break;
default:
- fprintf(stderr, "%s: invalid field type (%d)\n", __PRETTY_FUNCTION__, (int)type);
+ fprintf(stderr, "%s: invalid field type (%d)\n", __PRETTY_FUNCTION__, static_cast<int>(type));
}
- }
- else
- {
+ } else {
fprintf(stderr, "%s: Could not find field: %s\n", __PRETTY_FUNCTION__, name);
env->ExceptionDescribe();
env->ExceptionClear();
- fprintf (stderr, "\n");
+ fprintf(stderr, "\n");
}
env->DeleteLocalRef(cls);
- }
- else {
+ } else
fprintf(stderr, "%s: Could not find class for object\n", __PRETTY_FUNCTION__);
- }
}
return result;
}
-} // end of namespace Bindings
+} // namespace Bindings
-} // end of namespace JSC
+} // namespace JSC
#endif // ENABLE(MAC_JAVA_BRIDGE)
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2003, 2004, 2005, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _JNI_UTILITY_H_
-#define _JNI_UTILITY_H_
+#ifndef JNIUtility_h
+#define JNIUtility_h
#if ENABLE(MAC_JAVA_BRIDGE)
class JavaParameter;
-const char *getCharactersFromJString(jstring aJString);
-void releaseCharactersForJString(jstring aJString, const char *s);
+const char* getCharactersFromJString(jstring);
+void releaseCharactersForJString(jstring, const char*);
-const char *getCharactersFromJStringInEnv(JNIEnv *env, jstring aJString);
-void releaseCharactersForJStringInEnv(JNIEnv *env, jstring aJString, const char *s);
-const jchar *getUCharactersFromJStringInEnv(JNIEnv *env, jstring aJString);
-void releaseUCharactersForJStringInEnv(JNIEnv *env, jstring aJString, const jchar *s);
+const char* getCharactersFromJStringInEnv(JNIEnv*, jstring);
+void releaseCharactersForJStringInEnv(JNIEnv*, jstring, const char*);
+const jchar* getUCharactersFromJStringInEnv(JNIEnv*, jstring);
+void releaseUCharactersForJStringInEnv(JNIEnv*, jstring, const jchar*);
-JNIType JNITypeFromClassName(const char *name);
+JNIType JNITypeFromClassName(const char* name);
JNIType JNITypeFromPrimitiveType(char type);
-const char *signatureFromPrimitiveType(JNIType type);
+const char* signatureFromPrimitiveType(JNIType);
-jvalue getJNIField(jobject obj, JNIType type, const char *name, const char *signature);
+jvalue getJNIField(jobject, JNIType, const char* name, const char* signature);
-jmethodID getMethodID(jobject obj, const char *name, const char *sig);
+jmethodID getMethodID(jobject, const char* name, const char* sig);
JNIEnv* getJNIEnv();
JavaVM* getJavaVM();
void setJavaVM(JavaVM*);
-
-
+
+
template <typename T> struct JNICaller;
template<> struct JNICaller<void> {
static jobject callV(jobject obj, jmethodID mid, va_list args)
{
return getJNIEnv()->CallObjectMethodV(obj, mid, args);
- }
+ }
};
template<> struct JNICaller<jboolean> {
{
return getJNIEnv()->CallStaticBooleanMethod(cls, mid, args);
}
-
};
template<> struct JNICaller<jbyte> {
static jchar callV(jobject obj, jmethodID mid, va_list args)
{
return getJNIEnv()->CallCharMethodV(obj, mid, args);
- }
+ }
};
template<> struct JNICaller<jshort> {
{
return JNICaller<T>::callA(obj, mid, args);
}
-
+
template<typename T>
-static T callJNIMethodV(jobject obj, const char *name, const char *sig, va_list args)
+static T callJNIMethodV(jobject obj, const char* name, const char* sig, va_list args)
{
- JavaVM *jvm = getJavaVM();
- JNIEnv *env = getJNIEnv();
-
- if ( obj != NULL && jvm != NULL && env != NULL) {
+ JavaVM* jvm = getJavaVM();
+ JNIEnv* env = getJNIEnv();
+
+ if (obj && jvm && env) {
jclass cls = env->GetObjectClass(obj);
- if ( cls != NULL ) {
+ if (cls) {
jmethodID mid = env->GetMethodID(cls, name, sig);
- if ( mid != NULL )
- {
+ if (mid) {
// Avoids references to cls without popping the local frame.
env->DeleteLocalRef(cls);
return JNICaller<T>::callV(obj, mid, args);
}
- else
- {
- fprintf(stderr, "%s: Could not find method: %s for %p\n", __PRETTY_FUNCTION__, name, obj);
- env->ExceptionDescribe();
- env->ExceptionClear();
- fprintf (stderr, "\n");
- }
+ fprintf(stderr, "%s: Could not find method: %s for %p\n", __PRETTY_FUNCTION__, name, obj);
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ fprintf(stderr, "\n");
env->DeleteLocalRef(cls);
- }
- else {
+ } else
fprintf(stderr, "%s: Could not find class for %p\n", __PRETTY_FUNCTION__, obj);
- }
}
return 0;
{
va_list args;
va_start(args, methodSignature);
-
- T result= callJNIMethodV<T>(obj, methodName, methodSignature, args);
-
+
+ T result = callJNIMethodV<T>(obj, methodName, methodSignature, args);
+
va_end(args);
-
+
return result;
}
-
+
template<typename T>
T callJNIStaticMethod(jclass cls, const char* methodName, const char* methodSignature, ...)
{
- JavaVM *jvm = getJavaVM();
- JNIEnv *env = getJNIEnv();
+ JavaVM* jvm = getJavaVM();
+ JNIEnv* env = getJNIEnv();
va_list args;
-
+
va_start(args, methodSignature);
-
+
T result = 0;
-
- if (cls != NULL && jvm != NULL && env != NULL) {
+
+ if (cls && jvm && env) {
jmethodID mid = env->GetStaticMethodID(cls, methodName, methodSignature);
- if (mid != NULL)
+ if (mid)
result = JNICaller<T>::callStaticV(cls, mid, args);
else {
fprintf(stderr, "%s: Could not find method: %s for %p\n", __PRETTY_FUNCTION__, methodName, cls);
env->ExceptionDescribe();
env->ExceptionClear();
- fprintf (stderr, "\n");
+ fprintf(stderr, "\n");
}
}
-
+
va_end(args);
-
+
return result;
}
-
+
} // namespace Bindings
} // namespace JSC
#endif // ENABLE(MAC_JAVA_BRIDGE)
-#endif // _JNI_UTILITY_H_
+#endif // JNIUtility_h
#if ENABLE(MAC_JAVA_BRIDGE)
#include "Frame.h"
+#include "JNIBridge.h"
+#include "JNIUtility.h"
+#include "JNIUtilityPrivate.h"
#include "JSDOMBinding.h"
#include "ScriptController.h"
#include "StringSourceProvider.h"
#include "WebCoreFrameView.h"
-#include "jni_runtime.h"
-#include "jni_utility.h"
-#include "jni_utility_private.h"
#include "runtime_object.h"
#include "runtime_root.h"
#include <interpreter/CallFrame.h>
#if ENABLE(MAC_JAVA_BRIDGE)
#import <Foundation/Foundation.h>
-#import "jni_utility.h"
-#import "jni_utility_private.h"
+#import "JNIUtility.h"
+#import "JNIUtilityPrivate.h"
#import "objc_utility.h"
#include <runtime/JSLock.h>
+++ /dev/null
-/*
- * Copyright (C) 2003 Apple Computer, 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. 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.
- */
-
-#include "config.h"
-#include <jni_runtime.h>
-
-#if ENABLE(MAC_JAVA_BRIDGE)
-
-#include "CString.h"
-#include "StringBuilder.h"
-#include "jni_utility.h"
-#include "jni_utility_private.h"
-#include "runtime_array.h"
-#include "runtime_object.h"
-#include "runtime_root.h"
-#include <runtime/Error.h>
-#include <runtime/JSLock.h>
-
-#ifdef NDEBUG
-#define JS_LOG(formatAndArgs...) ((void)0)
-#else
-#define JS_LOG(formatAndArgs...) { \
- fprintf (stderr, "%s:%d -- %s: ", __FILE__, __LINE__, __FUNCTION__); \
- fprintf(stderr, formatAndArgs); \
-}
-#endif
-
-using namespace JSC;
-using namespace JSC::Bindings;
-using namespace WebCore;
-
-
-JavaParameter::JavaParameter (JNIEnv *env, jstring type)
-{
- _type = JavaString (env, type);
- _JNIType = JNITypeFromClassName (_type.UTF8String());
-}
-
-JavaField::JavaField (JNIEnv *env, jobject aField)
-{
- // Get field type
- jobject fieldType = callJNIMethod<jobject>(aField, "getType", "()Ljava/lang/Class;");
- jstring fieldTypeName = (jstring)callJNIMethod<jobject>(fieldType, "getName", "()Ljava/lang/String;");
- _type = JavaString(env, fieldTypeName);
- _JNIType = JNITypeFromClassName (_type.UTF8String());
-
- // Get field name
- jstring fieldName = (jstring)callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;");
- _name = JavaString(env, fieldName);
-
- _field = new JObjectWrapper(aField);
-}
-
-JSValue JavaArray::convertJObjectToArray(ExecState* exec, jobject anObject, const char* type, PassRefPtr<RootObject> rootObject)
-{
- if (type[0] != '[')
- return jsUndefined();
-
- return new (exec) RuntimeArray(exec, new JavaArray((jobject)anObject, type, rootObject));
-}
-
-jvalue JavaField::dispatchValueFromInstance(ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const
-{
- jobject jinstance = instance->javaInstance();
- jobject fieldJInstance = _field->m_instance;
- JNIEnv *env = getJNIEnv();
- jvalue result;
-
- bzero (&result, sizeof(jvalue));
- jclass cls = env->GetObjectClass(fieldJInstance);
- if ( cls != NULL ) {
- jmethodID mid = env->GetMethodID(cls, name, sig);
- if ( mid != NULL )
- {
- RootObject* rootObject = instance->rootObject();
- if (rootObject && rootObject->nativeHandle()) {
- JSValue exceptionDescription;
- jvalue args[1];
-
- args[0].l = jinstance;
- dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, returnType, mid, args, result, 0, exceptionDescription);
- if (exceptionDescription)
- throwError(exec, GeneralError, exceptionDescription.toString(exec));
- }
- }
- }
- return result;
-}
-
-JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const
-{
- const JavaInstance *instance = static_cast<const JavaInstance *>(i);
-
- JSValue jsresult = jsUndefined();
-
- switch (_JNIType) {
- case array_type:
- case object_type: {
- jvalue result = dispatchValueFromInstance (exec, instance, "get", "(Ljava/lang/Object;)Ljava/lang/Object;", object_type);
- jobject anObject = result.l;
-
- const char *arrayType = type();
- if (arrayType[0] == '[') {
- jsresult = JavaArray::convertJObjectToArray(exec, anObject, arrayType, instance->rootObject());
- }
- else if (anObject != 0){
- jsresult = JavaInstance::create(anObject, instance->rootObject())->createRuntimeObject(exec);
- }
- }
- break;
-
- case boolean_type:
- jsresult = jsBoolean(dispatchValueFromInstance(exec, instance, "getBoolean", "(Ljava/lang/Object;)Z", boolean_type).z);
- break;
-
- case byte_type:
- case char_type:
- case short_type:
-
- case int_type: {
- jint value;
- jvalue result = dispatchValueFromInstance (exec, instance, "getInt", "(Ljava/lang/Object;)I", int_type);
- value = result.i;
- jsresult = jsNumber(exec, (int)value);
- }
- break;
-
- case long_type:
- case float_type:
- case double_type: {
- jdouble value;
- jvalue result = dispatchValueFromInstance (exec, instance, "getDouble", "(Ljava/lang/Object;)D", double_type);
- value = result.i;
- jsresult = jsNumber(exec, (double)value);
- }
- break;
- default:
- break;
- }
-
- JS_LOG ("getting %s = %s\n", UString(name()).UTF8String().c_str(), jsresult.toString(exec).ascii());
-
- return jsresult;
-}
-
-void JavaField::dispatchSetValueToInstance(ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const
-{
- jobject jinstance = instance->javaInstance();
- jobject fieldJInstance = _field->m_instance;
- JNIEnv *env = getJNIEnv();
-
- jclass cls = env->GetObjectClass(fieldJInstance);
- if ( cls != NULL ) {
- jmethodID mid = env->GetMethodID(cls, name, sig);
- if ( mid != NULL )
- {
- RootObject* rootObject = instance->rootObject();
- if (rootObject && rootObject->nativeHandle()) {
- JSValue exceptionDescription;
- jvalue args[2];
- jvalue result;
-
- args[0].l = jinstance;
- args[1] = javaValue;
- dispatchJNICall(exec, rootObject->nativeHandle(), fieldJInstance, false, void_type, mid, args, result, 0, exceptionDescription);
- if (exceptionDescription)
- throwError(exec, GeneralError, exceptionDescription.toString(exec));
- }
- }
- }
-}
-
-void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue aValue) const
-{
- const JavaInstance *instance = static_cast<const JavaInstance *>(i);
- jvalue javaValue = convertValueToJValue (exec, aValue, _JNIType, type());
-
- JS_LOG ("setting value %s to %s\n", UString(name()).UTF8String().c_str(), aValue.toString(exec).ascii());
-
- switch (_JNIType) {
- case array_type:
- case object_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "set", "(Ljava/lang/Object;Ljava/lang/Object;)V");
- }
- break;
-
- case boolean_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setBoolean", "(Ljava/lang/Object;Z)V");
- }
- break;
-
- case byte_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setByte", "(Ljava/lang/Object;B)V");
- }
- break;
-
- case char_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setChar", "(Ljava/lang/Object;C)V");
- }
- break;
-
- case short_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setShort", "(Ljava/lang/Object;S)V");
- }
- break;
-
- case int_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setInt", "(Ljava/lang/Object;I)V");
- }
- break;
-
- case long_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setLong", "(Ljava/lang/Object;J)V");
- }
- break;
-
- case float_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setFloat", "(Ljava/lang/Object;F)V");
- }
- break;
-
- case double_type: {
- dispatchSetValueToInstance (exec, instance, javaValue, "setDouble", "(Ljava/lang/Object;D)V");
- }
- break;
- default:
- break;
- }
-}
-
-JavaMethod::JavaMethod (JNIEnv *env, jobject aMethod)
-{
- // Get return type
- jobject returnType = callJNIMethod<jobject>(aMethod, "getReturnType", "()Ljava/lang/Class;");
- jstring returnTypeName = (jstring)callJNIMethod<jobject>(returnType, "getName", "()Ljava/lang/String;");
- _returnType =JavaString (env, returnTypeName);
- _JNIReturnType = JNITypeFromClassName (_returnType.UTF8String());
- env->DeleteLocalRef (returnType);
- env->DeleteLocalRef (returnTypeName);
-
- // Get method name
- jstring methodName = (jstring)callJNIMethod<jobject>(aMethod, "getName", "()Ljava/lang/String;");
- _name = JavaString (env, methodName);
- env->DeleteLocalRef (methodName);
-
- // Get parameters
- jarray jparameters = (jarray)callJNIMethod<jobject>(aMethod, "getParameterTypes", "()[Ljava/lang/Class;");
- _numParameters = env->GetArrayLength (jparameters);
- _parameters = new JavaParameter[_numParameters];
-
- int i;
- for (i = 0; i < _numParameters; i++) {
- jobject aParameter = env->GetObjectArrayElement ((jobjectArray)jparameters, i);
- jstring parameterName = (jstring)callJNIMethod<jobject>(aParameter, "getName", "()Ljava/lang/String;");
- _parameters[i] = JavaParameter(env, parameterName);
- env->DeleteLocalRef (aParameter);
- env->DeleteLocalRef (parameterName);
- }
- env->DeleteLocalRef (jparameters);
-
- // Created lazily.
- _signature = 0;
- _methodID = 0;
-
- jclass modifierClass = env->FindClass("java/lang/reflect/Modifier");
- int modifiers = callJNIMethod<jint>(aMethod, "getModifiers", "()I");
- _isStatic = (bool)callJNIStaticMethod<jboolean>(modifierClass, "isStatic", "(I)Z", modifiers);
- env->DeleteLocalRef(modifierClass);
-}
-
-JavaMethod::~JavaMethod()
-{
- if (_signature)
- free(_signature);
- delete [] _parameters;
-};
-
-// JNI method signatures use '/' between components of a class name, but
-// we get '.' between components from the reflection API.
-static void appendClassName(StringBuilder& builder, const char* className)
-{
- ASSERT(JSLock::lockCount() > 0);
-
- char *result, *cp = strdup(className);
-
- result = cp;
- while (*cp) {
- if (*cp == '.')
- *cp = '/';
- cp++;
- }
-
- builder.append(result);
-
- free(result);
-}
-
-const char *JavaMethod::signature() const
-{
- if (!_signature) {
- JSLock lock(SilenceAssertionsOnly);
-
- StringBuilder signatureBuilder;
- signatureBuilder.append("(");
- for (int i = 0; i < _numParameters; i++) {
- JavaParameter* aParameter = parameterAt(i);
- JNIType _JNIType = aParameter->getJNIType();
- if (_JNIType == array_type)
- appendClassName(signatureBuilder, aParameter->type());
- else {
- signatureBuilder.append(signatureFromPrimitiveType(_JNIType));
- if (_JNIType == object_type) {
- appendClassName(signatureBuilder, aParameter->type());
- signatureBuilder.append(";");
- }
- }
- }
- signatureBuilder.append(")");
-
- const char *returnType = _returnType.UTF8String();
- if (_JNIReturnType == array_type) {
- appendClassName(signatureBuilder, returnType);
- } else {
- signatureBuilder.append(signatureFromPrimitiveType(_JNIReturnType));
- if (_JNIReturnType == object_type) {
- appendClassName(signatureBuilder, returnType);
- signatureBuilder.append(";");
- }
- }
-
- String signatureString = signatureBuilder.toString();
- _signature = strdup(signatureString.utf8().data());
- }
-
- return _signature;
-}
-
-JNIType JavaMethod::JNIReturnType() const
-{
- return _JNIReturnType;
-}
-
-jmethodID JavaMethod::methodID (jobject obj) const
-{
- if (_methodID == 0) {
- _methodID = getMethodID (obj, _name.UTF8String(), signature());
- }
- return _methodID;
-}
-
-
-JavaArray::JavaArray(jobject array, const char* type, PassRefPtr<RootObject> rootObject)
- : Array(rootObject)
-{
- _array = new JObjectWrapper(array);
- // Java array are fixed length, so we can cache length.
- JNIEnv *env = getJNIEnv();
- _length = env->GetArrayLength((jarray)_array->m_instance);
- _type = strdup(type);
- m_rootObject = rootObject;
-}
-
-JavaArray::~JavaArray ()
-{
- free ((void *)_type);
-}
-
-RootObject* JavaArray::rootObject() const
-{
- return m_rootObject && m_rootObject->isValid() ? m_rootObject.get() : 0;
-}
-
-void JavaArray::setValueAt(ExecState* exec, unsigned index, JSValue aValue) const
-{
- JNIEnv *env = getJNIEnv();
- char *javaClassName = 0;
-
- JNIType arrayType = JNITypeFromPrimitiveType(_type[1]);
- if (_type[1] == 'L'){
- // The type of the array will be something like:
- // "[Ljava.lang.string;". This is guaranteed, so no need
- // for extra sanity checks.
- javaClassName = strdup(&_type[2]);
- javaClassName[strchr(javaClassName, ';')-javaClassName] = 0;
- }
- jvalue aJValue = convertValueToJValue (exec, aValue, arrayType, javaClassName);
-
- switch (arrayType) {
- case object_type: {
- env->SetObjectArrayElement((jobjectArray)javaArray(), index, aJValue.l);
- break;
- }
-
- case boolean_type: {
- env->SetBooleanArrayRegion((jbooleanArray)javaArray(), index, 1, &aJValue.z);
- break;
- }
-
- case byte_type: {
- env->SetByteArrayRegion((jbyteArray)javaArray(), index, 1, &aJValue.b);
- break;
- }
-
- case char_type: {
- env->SetCharArrayRegion((jcharArray)javaArray(), index, 1, &aJValue.c);
- break;
- }
-
- case short_type: {
- env->SetShortArrayRegion((jshortArray)javaArray(), index, 1, &aJValue.s);
- break;
- }
-
- case int_type: {
- env->SetIntArrayRegion((jintArray)javaArray(), index, 1, &aJValue.i);
- break;
- }
-
- case long_type: {
- env->SetLongArrayRegion((jlongArray)javaArray(), index, 1, &aJValue.j);
- }
-
- case float_type: {
- env->SetFloatArrayRegion((jfloatArray)javaArray(), index, 1, &aJValue.f);
- break;
- }
-
- case double_type: {
- env->SetDoubleArrayRegion((jdoubleArray)javaArray(), index, 1, &aJValue.d);
- break;
- }
- default:
- break;
- }
-
- if (javaClassName)
- free ((void *)javaClassName);
-}
-
-
-JSValue JavaArray::valueAt(ExecState* exec, unsigned index) const
-{
- JNIEnv *env = getJNIEnv();
- JNIType arrayType = JNITypeFromPrimitiveType(_type[1]);
- switch (arrayType) {
- case object_type: {
- jobjectArray objectArray = (jobjectArray)javaArray();
- jobject anObject;
- anObject = env->GetObjectArrayElement(objectArray, index);
-
- // No object?
- if (!anObject) {
- return jsNull();
- }
-
- // Nested array?
- if (_type[1] == '[') {
- return JavaArray::convertJObjectToArray(exec, anObject, _type+1, rootObject());
- }
- // or array of other object type?
- return JavaInstance::create(anObject, rootObject())->createRuntimeObject(exec);
- }
-
- case boolean_type: {
- jbooleanArray booleanArray = (jbooleanArray)javaArray();
- jboolean aBoolean;
- env->GetBooleanArrayRegion(booleanArray, index, 1, &aBoolean);
- return jsBoolean(aBoolean);
- }
-
- case byte_type: {
- jbyteArray byteArray = (jbyteArray)javaArray();
- jbyte aByte;
- env->GetByteArrayRegion(byteArray, index, 1, &aByte);
- return jsNumber(exec, aByte);
- }
-
- case char_type: {
- jcharArray charArray = (jcharArray)javaArray();
- jchar aChar;
- env->GetCharArrayRegion(charArray, index, 1, &aChar);
- return jsNumber(exec, aChar);
- break;
- }
-
- case short_type: {
- jshortArray shortArray = (jshortArray)javaArray();
- jshort aShort;
- env->GetShortArrayRegion(shortArray, index, 1, &aShort);
- return jsNumber(exec, aShort);
- }
-
- case int_type: {
- jintArray intArray = (jintArray)javaArray();
- jint anInt;
- env->GetIntArrayRegion(intArray, index, 1, &anInt);
- return jsNumber(exec, anInt);
- }
-
- case long_type: {
- jlongArray longArray = (jlongArray)javaArray();
- jlong aLong;
- env->GetLongArrayRegion(longArray, index, 1, &aLong);
- return jsNumber(exec, aLong);
- }
-
- case float_type: {
- jfloatArray floatArray = (jfloatArray)javaArray();
- jfloat aFloat;
- env->GetFloatArrayRegion(floatArray, index, 1, &aFloat);
- return jsNumber(exec, aFloat);
- }
-
- case double_type: {
- jdoubleArray doubleArray = (jdoubleArray)javaArray();
- jdouble aDouble;
- env->GetDoubleArrayRegion(doubleArray, index, 1, &aDouble);
- return jsNumber(exec, aDouble);
- }
- default:
- break;
- }
- return jsUndefined();
-}
-
-unsigned int JavaArray::getLength() const
-{
- return _length;
-}
-
-#endif // ENABLE(MAC_JAVA_BRIDGE)
+++ /dev/null
-/*
- * Copyright (C) 2003 Apple Computer, 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.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. 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.
- */
-
-#ifndef _JNI_RUNTIME_H_
-#define _JNI_RUNTIME_H_
-
-#if ENABLE(MAC_JAVA_BRIDGE)
-
-#include "JavaInstanceJSC.h"
-#include "jni_utility.h"
-
-#if USE(JSC)
-#include "JavaStringJSC.h"
-#endif
-
-namespace JSC
-{
-
-namespace Bindings
-{
-
-typedef const char* RuntimeType;
-
-class JavaString
-{
-public:
- JavaString()
- {
- m_impl.init();
- }
-
- JavaString(JNIEnv* e, jstring s)
- {
- m_impl.init(e, s);
- }
-
- JavaString(jstring s)
- {
- m_impl.init(getJNIEnv(), s);
- }
-
- const char* UTF8String() const { return m_impl.UTF8String(); }
- const jchar* uchars() const { return m_impl.uchars(); }
- int length() const { return m_impl.length(); }
-#if USE(JSC)
- operator UString() const { return m_impl.uString(); }
-#endif
-
-private:
- JavaStringImpl m_impl;
-};
-
-class JavaParameter
-{
-public:
- JavaParameter () : _JNIType(invalid_type) {};
- JavaParameter (JNIEnv *env, jstring type);
- virtual ~JavaParameter() { }
-
- RuntimeType type() const { return _type.UTF8String(); }
- JNIType getJNIType() const { return _JNIType; }
-
-private:
- JavaString _type;
- JNIType _JNIType;
-};
-
-
-class JavaField : public Field
-{
-public:
- JavaField (JNIEnv *env, jobject aField);
-
- virtual JSValue valueFromInstance(ExecState *exec, const Instance *instance) const;
- virtual void setValueToInstance(ExecState *exec, const Instance *instance, JSValue aValue) const;
-
- const JavaString& name() const { return _name; }
- virtual RuntimeType type() const { return _type.UTF8String(); }
-
- JNIType getJNIType() const { return _JNIType; }
-
-private:
- void dispatchSetValueToInstance(ExecState *exec, const JavaInstance *instance, jvalue javaValue, const char *name, const char *sig) const;
- jvalue dispatchValueFromInstance(ExecState *exec, const JavaInstance *instance, const char *name, const char *sig, JNIType returnType) const;
-
- JavaString _name;
- JavaString _type;
- JNIType _JNIType;
- RefPtr<JObjectWrapper> _field;
-};
-
-
-class JavaMethod : public Method
-{
-public:
- JavaMethod(JNIEnv* env, jobject aMethod);
- ~JavaMethod();
-
- const JavaString& name() const { return _name; }
- RuntimeType returnType() const { return _returnType.UTF8String(); };
- JavaParameter* parameterAt(int i) const { return &_parameters[i]; };
- int numParameters() const { return _numParameters; };
-
- const char *signature() const;
- JNIType JNIReturnType() const;
-
- jmethodID methodID (jobject obj) const;
-
- bool isStatic() const { return _isStatic; }
-
-private:
- JavaParameter* _parameters;
- int _numParameters;
- JavaString _name;
- mutable char* _signature;
- JavaString _returnType;
- JNIType _JNIReturnType;
- mutable jmethodID _methodID;
- bool _isStatic;
-};
-
-class JavaArray : public Array
-{
-public:
- JavaArray(jobject array, const char* type, PassRefPtr<RootObject>);
- virtual ~JavaArray();
-
- RootObject* rootObject() const;
-
- virtual void setValueAt(ExecState *exec, unsigned int index, JSValue aValue) const;
- virtual JSValue valueAt(ExecState *exec, unsigned int index) const;
- virtual unsigned int getLength() const;
-
- jobject javaArray() const { return _array->m_instance; }
-
- static JSValue convertJObjectToArray (ExecState* exec, jobject anObject, const char* type, PassRefPtr<RootObject>);
-
-private:
- RefPtr<JObjectWrapper> _array;
- unsigned int _length;
- const char *_type;
-};
-
-} // namespace Bindings
-
-} // namespace JSC
-
-#endif // ENABLE(MAC_JAVA_BRIDGE)
-
-#endif // _JNI_RUNTIME_H_
*/
#include "config.h"
-#include "jni_utility_private.h"
+#include "JNIUtilityPrivate.h"
#if ENABLE(MAC_JAVA_BRIDGE)
-#include "jni_runtime.h"
+#include "JNIBridge.h"
#include "runtime_array.h"
#include "runtime_object.h"
#include <runtime/JSArray.h>
if (instance)
result.l = instance->javaInstance();
} else if (objectImp->classInfo() == &RuntimeArray::s_info) {
- // Input is a JavaScript Array that was originally created from a Java Array
+ // Input is a JavaScript Array that was originally created from a Java Array
RuntimeArray* imp = static_cast<RuntimeArray*>(objectImp);
JavaArray* array = static_cast<JavaArray*>(imp->getConcreteArray());
result.l = array->javaArray();
return result;
}
-} // end of namespace Bindings
+} // end of namespace Bindings
} // end of namespace JSC
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _JNI_UTILITY_PRIVATE_H_
-#define _JNI_UTILITY_PRIVATE_H_
+#ifndef JNIUtilityPrivate_h
+#define JNIUtilityPrivate_h
#if ENABLE(MAC_JAVA_BRIDGE)
-#include "jni_utility.h"
+#include "JNIUtility.h"
#include <runtime/JSValue.h>
namespace JSC {
#endif // ENABLE(MAC_JAVA_BRIDGE)
-#endif // _JNI_UTILITY_H_
+#endif // JNIUtilityPrivate_h
#if ENABLE(MAC_JAVA_BRIDGE)
+#include "JNIUtility.h"
#include "JSDOMWindow.h"
-#include "jni_runtime.h"
-#include "jni_utility.h"
#include <runtime/Identifier.h>
#include <runtime/JSLock.h>
#if ENABLE(MAC_JAVA_BRIDGE)
-#include "jni_runtime.h"
+#include "JNIBridge.h"
#include <wtf/HashMap.h>
namespace JSC {
#if ENABLE(MAC_JAVA_BRIDGE)
+#include "JNIBridge.h"
+#include "JNIUtility.h"
+#include "JNIUtilityPrivate.h"
#include "JavaClassJSC.h"
-#include "jni_runtime.h"
-#include "jni_utility.h"
-#include "jni_utility_private.h"
#include "runtime_object.h"
#include "runtime_root.h"
#include <runtime/ArgList.h>
#ifndef JavaStringJSC_h
#define JavaStringJSC_h
+#include "JNIUtility.h"
#include "JavaInstanceJSC.h"
-#include "jni_utility.h"
#include <runtime/JSLock.h>
*/
#include "config.h"
-#include "jni_utility_private.h"
+#include "JNIUtilityPrivate.h"
+#include "JavaNPObjectV8.h"
#include "jni_runtime.h"
-#include "jni_npobject.h"
namespace JSC {
case array_type:
case object_type:
{
- result.l = (jobject)0;
+ result.l = static_cast<jobject>(0);
// First see if we have a Java instance.
if (type == NPVariantType_Object) {
// Now convert value to a string if the target type is a java.lang.string, and we're not
// converting from a Null.
- if (result.l == 0 && strcmp(javaClassName, "java.lang.String") == 0) {
+ if (!result.l && !strcmp(javaClassName, "java.lang.String")) {
#ifdef CONVERT_NULL_TO_EMPTY_STRING
if (type == NPVariantType_Null) {
- JNIEnv *env = getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jchar buf[2];
- jobject javaString = env->functions->NewString (env, buf, 0);
+ jobject javaString = env->functions->NewString(env, buf, 0);
result.l = javaString;
- }
- else
+ } else
#else
- if (type == NPVariantType_String) {
+ if (type == NPVariantType_String)
#endif
+ {
NPString src = NPVARIANT_TO_STRING(value);
- JNIEnv *env = getJNIEnv();
+ JNIEnv* env = getJNIEnv();
jobject javaString = env->NewStringUTF(src.UTF8Characters);
result.l = javaString;
}
- } else if (result.l == 0)
- bzero (&result, sizeof(jvalue)); // Handle it the same as a void case
+ } else if (!result.l)
+ bzero(&result, sizeof(jvalue)); // Handle it the same as a void case
}
break;
if (type == NPVariantType_Bool)
result.z = NPVARIANT_TO_BOOLEAN(value);
else
- bzero(&result, sizeof(jvalue)); // as void case
+ bzero(&result, sizeof(jvalue)); // as void case
}
break;
case byte_type:
{
if (type == NPVariantType_Int32)
- result.b = (char)NPVARIANT_TO_INT32(value);
+ result.b = static_cast<char>(NPVARIANT_TO_INT32(value));
else
bzero(&result, sizeof(jvalue));
}
case char_type:
{
if (type == NPVariantType_Int32)
- result.c = (char)NPVARIANT_TO_INT32(value);
+ result.c = static_cast<char>(NPVARIANT_TO_INT32(value));
else
bzero(&result, sizeof(jvalue));
}
case short_type:
{
if (type == NPVariantType_Int32)
- result.s = (jshort)NPVARIANT_TO_INT32(value);
+ result.s = static_cast<jshort>(NPVARIANT_TO_INT32(value));
else
bzero(&result, sizeof(jvalue));
}
case int_type:
{
if (type == NPVariantType_Int32)
- result.i = (jint)NPVARIANT_TO_INT32(value);
+ result.i = static_cast<jint>(NPVARIANT_TO_INT32(value));
else
bzero(&result, sizeof(jvalue));
}
case long_type:
{
if (type == NPVariantType_Int32)
- result.j = (jlong)NPVARIANT_TO_INT32(value);
+ result.j = static_cast<jlong>(NPVARIANT_TO_INT32(value));
else if (type == NPVariantType_Double)
- result.j = (jlong)NPVARIANT_TO_DOUBLE(value);
+ result.j = static_cast<jlong>(NPVARIANT_TO_DOUBLE(value));
else
bzero(&result, sizeof(jvalue));
}
case float_type:
{
if (type == NPVariantType_Int32)
- result.j = (jfloat)NPVARIANT_TO_INT32(value);
+ result.j = static_cast<jfloat>(NPVARIANT_TO_INT32(value));
else if (type == NPVariantType_Double)
- result.j = (jfloat)NPVARIANT_TO_DOUBLE(value);
+ result.j = static_cast<jfloat>(NPVARIANT_TO_DOUBLE(value));
else
bzero(&result, sizeof(jvalue));
}
case double_type:
{
if (type == NPVariantType_Int32)
- result.j = (jdouble)NPVARIANT_TO_INT32(value);
+ result.j = static_cast<jdouble>(NPVARIANT_TO_INT32(value));
else if (type == NPVariantType_Double)
- result.j = (jdouble)NPVARIANT_TO_DOUBLE(value);
+ result.j = static_cast<jdouble>(NPVARIANT_TO_DOUBLE(value));
else
bzero(&result, sizeof(jvalue));
}
case object_type:
{
- if (value.l != 0) {
- if (strcmp(javaTypeName, "java.lang.String") == 0) {
- const char* v = getCharactersFromJString((jstring)value.l);
+ if (value.l) {
+ if (!strcmp(javaTypeName, "java.lang.String")) {
+ const char* v = getCharactersFromJString(static_cast<jstring>(value.l));
// s is freed in NPN_ReleaseVariantValue (see npruntime.cpp)
const char* s = strdup(v);
- releaseCharactersForJString((jstring)value.l, v);
+ releaseCharactersForJString(static_cast<jstring>(value.l), v);
STRINGZ_TO_NPVARIANT(s, *result);
- } else {
+ } else
OBJECT_TO_NPVARIANT(JavaInstanceToNPObject(new JavaInstance(value.l)), *result);
- }
}
- else {
+ else
VOID_TO_NPVARIANT(*result);
- }
}
break;
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _JNI_UTILITY_PRIVATE_H_
-#define _JNI_UTILITY_PRIVATE_H_
+#ifndef JNIUtilityPrivate_h
+#define JNIUtilityPrivate_h
-#include "jni_utility.h"
+#include "JNIUtility.h"
#include "npruntime.h"
namespace JSC {
} // namespace JSC
-#endif // _JNI_UTILITY_H_
+#endif // JNIUtilityPrivate_h
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- * Copyright 2009, The Android Open Source Project
+ * Copyright (C) 2010 Apple Computer, Inc. All rights reserved.
+ * 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:
- * 1. Redistributions of source code must retain the above copyright
+ * * 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
+ * * 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 APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * 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 APPLE COMPUTER, INC. OR
+ * 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
+#include "JavaClassV8.h"
-#include "jni_class.h"
-#include "jni_utility.h"
+#include "JNIUtility.h"
#include "jni_runtime.h"
using namespace JSC::Bindings;
JavaClass::JavaClass(jobject anInstance)
{
jobject aClass = callJNIMethod<jobject>(anInstance, "getClass", "()Ljava/lang/Class;");
-
+
if (!aClass) {
fprintf(stderr, "%s: unable to call getClass on instance %p\n", __PRETTY_FUNCTION__, anInstance);
return;
}
-
+
jstring className = (jstring)callJNIMethod<jobject>(aClass, "getName", "()Ljava/lang/String;");
- const char *classNameC = getCharactersFromJString(className);
- _name = strdup(classNameC);
+ const char* classNameC = getCharactersFromJString(className);
+ m_name = strdup(classNameC);
releaseCharactersForJString(className, classNameC);
int i;
- JNIEnv *env = getJNIEnv();
+ JNIEnv* env = getJNIEnv();
// Get the fields
jarray fields = (jarray)callJNIMethod<jobject>(aClass, "getFields", "()[Ljava/lang/reflect/Field;");
- int numFields = env->GetArrayLength(fields);
+ int numFields = env->GetArrayLength(fields);
for (i = 0; i < numFields; i++) {
jobject aJField = env->GetObjectArrayElement((jobjectArray)fields, i);
- JavaField *aField = new JavaField(env, aJField); // deleted in the JavaClass destructor
+ JavaField* aField = new JavaField(env, aJField); // deleted in the JavaClass destructor
{
- _fields.set(aField->name(), aField);
+ m_fields.set(aField->name().UTF8String(), aField);
}
env->DeleteLocalRef(aJField);
}
int numMethods = env->GetArrayLength(methods);
for (i = 0; i < numMethods; i++) {
jobject aJMethod = env->GetObjectArrayElement((jobjectArray)methods, i);
- JavaMethod *aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor
+ JavaMethod* aMethod = new JavaMethod(env, aJMethod); // deleted in the JavaClass destructor
MethodList* methodList;
{
- methodList = _methods.get(aMethod->name());
+ methodList = m_methods.get(aMethod->name().UTF8String());
if (!methodList) {
methodList = new MethodList();
- _methods.set(aMethod->name(), methodList);
+ m_methods.set(aMethod->name().UTF8String(), methodList);
}
}
methodList->append(aMethod);
env->DeleteLocalRef(aJMethod);
- }
+ }
env->DeleteLocalRef(fields);
env->DeleteLocalRef(methods);
env->DeleteLocalRef(aClass);
}
-JavaClass::~JavaClass() {
- free((void *)_name);
+JavaClass::~JavaClass()
+{
+ free((void*)m_name);
- deleteAllValues(_fields);
- _fields.clear();
+ deleteAllValues(m_fields);
+ m_fields.clear();
- MethodListMap::const_iterator end = _methods.end();
- for (MethodListMap::const_iterator it = _methods.begin(); it != end; ++it) {
+ MethodListMap::const_iterator end = m_methods.end();
+ for (MethodListMap::const_iterator it = m_methods.begin(); it != end; ++it) {
const MethodList* methodList = it->second;
deleteAllValues(*methodList);
delete methodList;
}
- _methods.clear();
+ m_methods.clear();
}
MethodList JavaClass::methodsNamed(const char* name) const
{
- MethodList *methodList = _methods.get(name);
-
+ MethodList* methodList = m_methods.get(name);
+
if (methodList)
return *methodList;
return MethodList();
JavaField* JavaClass::fieldNamed(const char* name) const
{
- return _fields.get(name);
+ return m_fields.get(name);
}
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- * Copyright 2009, The Android Open Source Project
+ * Copyright (C) 2010 Apple Computer, Inc. All rights reserved.
+ * 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:
- * 1. Redistributions of source code must retain the above copyright
+ * * 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
+ * * 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 APPLE COMPUTER, INC. ``AS IS'' AND ANY
+ * 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 APPLE COMPUTER, INC. OR
+ * 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JNI_CLASS_H_
-#define JNI_CLASS_H_
+#ifndef JavaClassV8_h
+#define JavaClassV8_h
-#include <jni_runtime.h>
-#include <wtf/HashMap.h>
-#include <wtf/Vector.h>
#include "PlatformString.h"
#include "StringHash.h"
+#include "jni_runtime.h"
+#include <wtf/HashMap.h>
+#include <wtf/Vector.h>
namespace JSC {
class JavaClass {
public:
- JavaClass (jobject anInstance);
- ~JavaClass ();
+ JavaClass(jobject anInstance);
+ ~JavaClass();
- MethodList methodsNamed(const char* name) const;
+ MethodList methodsNamed(const char* name) const;
JavaField* fieldNamed(const char* name) const;
private:
- const char *_name;
- MethodListMap _methods;
- FieldMap _fields;
+ const char* m_name;
+ MethodListMap m_methods;
+ FieldMap m_fields;
};
} // namespace Bindings
} // namespace JSC
-#endif // JNI_CLASS_H_
+#endif // JavaClassV8_h
/*
- * Copyright (C) 2003, 2008 Apple Inc. All rights reserved.
- * Copyright 2009, The Android Open Source Project
+ * 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
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define LOG_TAG "v8binding"
-
#include "config.h"
+#include "JavaInstanceV8.h"
-#include "jni_class.h"
-#include "jni_instance.h"
+#include "JNIUtility.h"
+#include "JavaClassV8.h"
#include "jni_runtime.h"
-#include "jni_utility.h"
#include <assert.h>
#include <utils/Log.h>
+#define LOG_TAG "v8binding"
+
using namespace JSC::Bindings;
-JavaInstance::JavaInstance (jobject instance)
+JavaInstance::JavaInstance(jobject instance)
{
m_instance = new JObjectWrapper(instance);
- _class = 0;
+ m_class = 0;
}
-JavaInstance::~JavaInstance ()
+JavaInstance::~JavaInstance()
{
m_instance = 0;
- delete _class;
+ delete m_class;
}
-JavaClass* JavaInstance::getClass() const
+JavaClass* JavaInstance::getClass() const
{
- if (_class == 0) {
- _class = new JavaClass(javaInstance());
+ if (!m_class) {
+ m_class = new JavaClass(javaInstance());
}
- return _class;
+ return m_class;
}
bool JavaInstance::invokeMethod(const char* methodName, const NPVariant* args, int count, NPVariant* resultValue)
{
- int i;
- jvalue *jArgs;
- JavaMethod *method = 0;
-
VOID_TO_NPVARIANT(*resultValue);
MethodList methodList = getClass()->methodsNamed(methodName);
size_t numMethods = methodList.size();
-
- // Try to find a good match for the overloaded method. The
+
+ // Try to find a good match for the overloaded method. The
// fundamental problem is that JavaScript doesn have the
- // notion of method overloading and Java does. We could
+ // notion of method overloading and Java does. We could
// get a bit more sophisticated and attempt to does some
// type checking as we as checking the number of parameters.
- JavaMethod *aMethod;
+ JavaMethod* aMethod;
+ JavaMethod* method = 0;
for (size_t methodIndex = 0; methodIndex < numMethods; methodIndex++) {
aMethod = methodList[methodIndex];
if (aMethod->numParameters() == count) {
break;
}
}
- if (method == 0) {
+ if (!method) {
LOGW("unable to find an appropiate method\n");
return false;
}
-
- const JavaMethod *jMethod = static_cast<const JavaMethod*>(method);
-
- if (count > 0) {
- jArgs = (jvalue *)malloc (count * sizeof(jvalue));
- }
- else
- jArgs = 0;
-
- for (i = 0; i < count; i++) {
+
+ const JavaMethod* jMethod = static_cast<const JavaMethod*>(method);
+
+ jvalue* jArgs = 0;
+ if (count > 0)
+ jArgs = (jvalue*)malloc (count * sizeof(jvalue));
+
+ for (int i = 0; i < count; i++) {
JavaParameter* aParameter = jMethod->parameterAt(i);
jArgs[i] = convertNPVariantToJValue(args[i], aParameter->getJNIType(), aParameter->type());
}
-
+
jvalue result;
// The following code can be conditionally removed once we have a Tiger update that
// contains the new Java plugin. It is needed for builds prior to Tiger.
- {
+ {
jobject obj = javaInstance();
- switch (jMethod->JNIReturnType()){
- case void_type:
- callJNIMethodIDA<void>(obj, jMethod->methodID(obj), jArgs);
- break;
- case object_type:
- result.l = callJNIMethodIDA<jobject>(obj, jMethod->methodID(obj), jArgs);
- break;
- case boolean_type:
- result.z = callJNIMethodIDA<jboolean>(obj, jMethod->methodID(obj), jArgs);
- break;
- case byte_type:
- result.b = callJNIMethodIDA<jbyte>(obj, jMethod->methodID(obj), jArgs);
- break;
- case char_type:
- result.c = callJNIMethodIDA<jchar>(obj, jMethod->methodID(obj), jArgs);
- break;
- case short_type:
- result.s = callJNIMethodIDA<jshort>(obj, jMethod->methodID(obj), jArgs);
- break;
- case int_type:
- result.i = callJNIMethodIDA<jint>(obj, jMethod->methodID(obj), jArgs);
- break;
-
- case long_type:
- result.j = callJNIMethodIDA<jlong>(obj, jMethod->methodID(obj), jArgs);
- break;
- case float_type:
- result.f = callJNIMethodIDA<jfloat>(obj, jMethod->methodID(obj), jArgs);
- break;
- case double_type:
- result.d = callJNIMethodIDA<jdouble>(obj, jMethod->methodID(obj), jArgs);
- break;
- case invalid_type:
- default:
- break;
+ switch (jMethod->JNIReturnType()) {
+ case void_type:
+ callJNIMethodIDA<void>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case object_type:
+ result.l = callJNIMethodIDA<jobject>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case boolean_type:
+ result.z = callJNIMethodIDA<jboolean>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case byte_type:
+ result.b = callJNIMethodIDA<jbyte>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case char_type:
+ result.c = callJNIMethodIDA<jchar>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case short_type:
+ result.s = callJNIMethodIDA<jshort>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case int_type:
+ result.i = callJNIMethodIDA<jint>(obj, jMethod->methodID(obj), jArgs);
+ break;
+
+ case long_type:
+ result.j = callJNIMethodIDA<jlong>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case float_type:
+ result.f = callJNIMethodIDA<jfloat>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case double_type:
+ result.d = callJNIMethodIDA<jdouble>(obj, jMethod->methodID(obj), jArgs);
+ break;
+ case invalid_type:
+ default:
+ break;
}
}
-
+
convertJValueToNPVariant(result, jMethod->JNIReturnType(), jMethod->returnType(), resultValue);
- free (jArgs);
+ free(jArgs);
return true;
}
JObjectWrapper::JObjectWrapper(jobject instance)
-: _refCount(0)
+ : m_refCount(0)
{
- assert (instance != 0);
+ assert(instance);
// Cache the JNIEnv used to get the global ref for this java instanace.
// It'll be used to delete the reference.
- _env = getJNIEnv();
+ m_env = getJNIEnv();
- _instance = _env->NewGlobalRef(instance);
+ m_instance = m_env->NewGlobalRef(instance);
- LOGV("new global ref %p for %p\n", _instance, instance);
+ LOGV("new global ref %p for %p\n", m_instance, instance);
- if (_instance == NULL) {
+ if (!m_instance)
fprintf (stderr, "%s: could not get GlobalRef for %p\n", __PRETTY_FUNCTION__, instance);
- }
}
JObjectWrapper::~JObjectWrapper() {
- LOGV("deleting global ref %p\n", _instance);
- _env->DeleteGlobalRef(_instance);
+ LOGV("deleting global ref %p\n", m_instance);
+ m_env->DeleteGlobalRef(m_instance);
}
/*
- * Copyright (C) 2003 Apple Computer, Inc. All rights reserved.
- * Copyright 2009, The Android Open Source Project
+ * 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
* 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.
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef _JNI_INSTANCE_H_
-#define _JNI_INSTANCE_H_
+#ifndef JavaInstanceV8_h
+#define JavaInstanceV8_h
-#include "jni_utility_private.h"
+#include "JNIUtilityPrivate.h"
#include <JavaVM/jni.h>
#include <wtf/RefCounted.h>
class JavaClass;
-class JObjectWrapper
-{
+class JObjectWrapper {
friend class RefPtr<JObjectWrapper>;
friend class JavaField;
friend class JavaInstance;
public:
- jobject instance() const { return _instance; }
- void setInstance(jobject instance) { _instance = instance; }
+ jobject instance() const { return m_instance; }
+ void setInstance(jobject instance) { m_instance = instance; }
protected:
- JObjectWrapper(jobject instance);
+ JObjectWrapper(jobject instance);
~JObjectWrapper();
-
- void ref() { _refCount++; }
- void deref()
- {
- if (--_refCount == 0)
- delete this;
+
+ void ref() { m_refCount++; }
+ void deref()
+ {
+ if (!(--m_refCount))
+ delete this;
}
- jobject _instance;
+ jobject m_instance;
private:
- JNIEnv *_env;
- unsigned int _refCount;
+ JNIEnv* m_env;
+ unsigned int m_refCount;
};
-class JavaInstance : public RefCounted<JavaInstance>
-{
+class JavaInstance : public RefCounted<JavaInstance> {
public:
JavaInstance(jobject instance);
virtual ~JavaInstance();
bool invokeMethod(const char* name, const NPVariant* args, int argsCount, NPVariant* result);
- jobject javaInstance() const { return m_instance->_instance; }
+ jobject javaInstance() const { return m_instance->m_instance; }
// These functions are called before and after the main entry points into
// the native implementations. They can be used to establish and cleanup
protected:
RefPtr<JObjectWrapper> m_instance;
- mutable JavaClass* _class;
+ mutable JavaClass* m_class;
virtual void virtualBegin() {}
virtual void virtualEnd() {}
} // namespace JSC
-#endif // _JNI_INSTANCE_H_
+#endif // JavaInstanceV8_h
#include "config.h"
+#include "JavaNPObjectV8.h"
-#include "jni_npobject.h"
-#include "jni_class.h"
-#include "jni_instance.h"
+#include "JNIUtility.h"
+#include "JavaClassV8.h"
+#include "JavaInstanceV8.h"
#include "jni_runtime.h"
-#include "jni_utility.h"
-// This source file should be in bridge/jni, so it's OK to use the private
-// NPAPI header from here.
#include "npruntime_impl.h"
-namespace JSC { namespace Bindings {
+namespace JSC {
+
+namespace Bindings {
+
static NPObject* AllocJavaNPObject(NPP, NPClass*)
{
- JavaNPObject* obj =
- static_cast<JavaNPObject*>(malloc(sizeof(JavaNPObject)));
- if (obj == 0)
+ JavaNPObject* obj = static_cast<JavaNPObject*>(malloc(sizeof(JavaNPObject)));
+ if (!obj)
return 0;
bzero(obj, sizeof(JavaNPObject));
return reinterpret_cast<NPObject*>(obj);
static void FreeJavaNPObject(NPObject* npobj)
{
JavaNPObject* obj = reinterpret_cast<JavaNPObject*>(npobj);
- obj->_instance = 0; // free does not call the destructor
+ obj->m_instance = 0; // free does not call the destructor
free(obj);
}
NPObject* JavaInstanceToNPObject(JavaInstance* instance) {
JavaNPObject* object = reinterpret_cast<JavaNPObject*>(_NPN_CreateObject(0, &JavaNPObjectClass));
- object->_instance = instance;
+ object->m_instance = instance;
return reinterpret_cast<NPObject*>(object);
}
// Returns null if obj is not a wrapper of JavaInstance
JavaInstance* ExtractJavaInstance(NPObject* obj) {
if (obj->_class == &JavaNPObjectClass) {
- return reinterpret_cast<JavaNPObject*>(obj)->_instance.get();
+ return reinterpret_cast<JavaNPObject*>(obj)->m_instance.get();
}
return 0;
}
bool JavaNPObject_HasMethod(NPObject* obj, NPIdentifier identifier) {
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
return result;
}
-bool JavaNPObject_Invoke(NPObject* obj, NPIdentifier identifier,
- const NPVariant* args, uint32_t argCount, NPVariant* result) {
+bool JavaNPObject_Invoke(NPObject* obj, NPIdentifier identifier, const NPVariant* args, uint32_t argCount, NPVariant* result) {
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
// TODO: use NPN_MemFree
free(name);
return r;
-
}
bool JavaNPObject_HasProperty(NPObject* obj, NPIdentifier identifier) {
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
- bool result = instance->getClass()->fieldNamed(name) != 0;
+ bool result = instance->getClass()->fieldNamed(name);
instance->end();
free(name);
return result;
bool JavaNPObject_GetProperty(NPObject* obj, NPIdentifier identifier, NPVariant* result) {
VOID_TO_NPVARIANT(*result);
JavaInstance* instance = ExtractJavaInstance(obj);
- if (instance == 0)
+ if (!instance)
return false;
NPUTF8* name = _NPN_UTF8FromIdentifier(identifier);
- if (name == 0)
+ if (!name)
return false;
instance->begin();
instance->end();
free(name); // TODO: use NPN_MemFree
- if (field == 0) {
+ if (!field)
return false;
- }
jvalue value = getJNIField(instance->javaInstance(),
field->getJNIType(),
- field->name(),
+ field->name().UTF8String(),
field->type());
convertJValueToNPVariant(value, field->getJNIType(), field->type(), result);
return true;
}
-}} // namespace
+} // namespace Bindings
+
+} // namespace JSC
/*
- * Copyright 2009, The Android Open Source Project
+ * 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
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef JNI_NPOBJECT_H_
-#define JNI_NPOBJECT_H_
+#ifndef JavaNPObjectV8_h
+#define JavaNPObjectV8_h
-#include "npruntime.h"
#include "jni_runtime.h"
-
-#include <wtf/RefPtr.h>
+#include "npruntime.h"
#include <JavaVM/jni.h>
+#include <wtf/RefPtr.h>
-namespace JSC { namespace Bindings {
+
+namespace JSC {
+
+namespace Bindings {
+
+class JavaInstance;
struct JavaNPObject {
- NPObject _object;
- RefPtr<JavaInstance> _instance;
+ NPObject m_object;
+ RefPtr<JavaInstance> m_instance;
};
-NPObject* JavaInstanceToNPObject(JavaInstance* instance);
-JavaInstance* ExtractJavaInstance(NPObject* obj);
+NPObject* JavaInstanceToNPObject(JavaInstance*);
+JavaInstance* ExtractJavaInstance(NPObject*);
+
+bool JavaNPObject_HasMethod(NPObject*, NPIdentifier name);
+bool JavaNPObject_Invoke(NPObject*, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result);
+bool JavaNPObject_HasProperty(NPObject*, NPIdentifier name);
+bool JavaNPObject_GetProperty(NPObject*, NPIdentifier name, NPVariant* result);
-bool JavaNPObject_HasMethod(NPObject* obj, NPIdentifier name);
-bool JavaNPObject_Invoke(NPObject* obj, NPIdentifier methodName, const NPVariant* args, uint32_t argCount, NPVariant* result);
-bool JavaNPObject_HasProperty(NPObject* obj, NPIdentifier name);
-bool JavaNPObject_GetProperty(NPObject* obj, NPIdentifier name, NPVariant* ressult);
+} // namespace Bindings
-} }
+} // namespace JSC
-#endif JNI_NPOBJECT_H_
+#endif // JavaNPObjectV8_h
/*
- * Copyright 2007, The Android Open Source Project
+ * Copyright (C) 2010 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
+#ifndef JavaStringV8_h
+#define JavaStringV8_h
-#include "CookieClient.h"
-#include "JavaSharedClient.h"
+#include "CString.h"
+#include "JNIUtility.h"
-using namespace android;
-namespace WebCore {
+namespace JSC {
-class Document;
+namespace Bindings {
-void setCookies(Document*, const KURL& url, const String& value)
-{
- if (JavaSharedClient::GetCookieClient())
- JavaSharedClient::GetCookieClient()->setCookies(url, value);
-}
+class JavaStringImpl {
+public:
+ void init() {}
-String cookies(const Document* , const KURL& url)
-{
- if (JavaSharedClient::GetCookieClient())
- return JavaSharedClient::GetCookieClient()->cookies(url);
- return String();
-}
+ void init(JNIEnv* e, jstring s)
+ {
+ int size = e->GetStringLength(s);
+ const char* cs = getCharactersFromJStringInEnv(e, s);
+ {
+ m_utf8String = WebCore::CString(cs, size);
+ }
+ releaseCharactersForJStringInEnv(e, s, cs);
+ }
-bool cookiesEnabled(const Document* )
-{
- if (JavaSharedClient::GetCookieClient())
- return JavaSharedClient::GetCookieClient()->cookiesEnabled();
- return false;
-}
+ const char* UTF8String() const { return m_utf8String.data(); }
+ const jchar* uchars() const { return 0; } // Not implemented
+ int length() const { return m_utf8String.length(); }
-}
+private:
+ WebCore::CString m_utf8String;
+};
+
+} // namespace Bindings
+
+} // namespace JSC
+
+#endif // JavaStringV8_h
/*
* Copyright (C) 2003, 2006, 2008 Apple Inc. All rights reserved.
+ * 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
*/
#include "config.h"
-#include "Bridge.h"
+#include "BridgeJSC.h"
#include "runtime_object.h"
#include "runtime_root.h"
--- /dev/null
+/*
+ * Copyright (C) 2003, 2008, 2009 Apple Inc. All rights reserved.
+ * 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:
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. 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.
+ */
+
+#ifndef BridgeJSC_h
+#define BridgeJSC_h
+
+#if USE(JSC)
+
+#include <runtime/JSString.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/Vector.h>
+
+namespace JSC {
+
+class ArgList;
+class Identifier;
+class JSGlobalObject;
+class PropertyNameArray;
+class RuntimeObjectImp;
+
+namespace Bindings {
+
+class Instance;
+class Method;
+class RootObject;
+
+typedef Vector<Method*> MethodList;
+
+class Field {
+public:
+ virtual JSValue valueFromInstance(ExecState*, const Instance*) const = 0;
+ virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const = 0;
+
+ virtual ~Field() { }
+};
+
+class Class : public Noncopyable {
+public:
+ virtual MethodList methodsNamed(const Identifier&, Instance*) const = 0;
+ virtual Field* fieldNamed(const Identifier&, Instance*) const = 0;
+ virtual JSValue fallbackObject(ExecState*, Instance*, const Identifier&) { return jsUndefined(); }
+
+ virtual ~Class() { }
+};
+
+typedef void (*KJSDidExecuteFunctionPtr)(ExecState*, JSObject* rootObject);
+
+class Instance : public RefCounted<Instance> {
+public:
+ Instance(PassRefPtr<RootObject>);
+
+ static void setDidExecuteFunction(KJSDidExecuteFunctionPtr func);
+ static KJSDidExecuteFunctionPtr didExecuteFunction();
+
+ // These functions are called before and after the main entry points into
+ // the native implementations. They can be used to establish and cleanup
+ // any needed state.
+ void begin();
+ void end();
+
+ virtual Class* getClass() const = 0;
+ RuntimeObjectImp* createRuntimeObject(ExecState*);
+ void willInvalidateRuntimeObject();
+ void willDestroyRuntimeObject();
+
+ // Returns false if the value was not set successfully.
+ virtual bool setValueOfUndefinedField(ExecState*, const Identifier&, JSValue) { return false; }
+
+ virtual JSValue invokeMethod(ExecState*, const MethodList&, const ArgList& args) = 0;
+
+ virtual bool supportsInvokeDefaultMethod() const { return false; }
+ virtual JSValue invokeDefaultMethod(ExecState*, const ArgList&) { return jsUndefined(); }
+
+ virtual bool supportsConstruct() const { return false; }
+ virtual JSValue invokeConstruct(ExecState*, const ArgList&) { return JSValue(); }
+
+ virtual void getPropertyNames(ExecState*, PropertyNameArray&) { }
+
+ virtual JSValue defaultValue(ExecState*, PreferredPrimitiveType) const = 0;
+
+ virtual JSValue valueOf(ExecState* exec) const = 0;
+
+ RootObject* rootObject() const;
+
+ virtual ~Instance();
+
+ virtual bool getOwnPropertySlot(JSObject*, ExecState*, const Identifier&, PropertySlot&) { return false; }
+ virtual bool getOwnPropertyDescriptor(JSObject*, ExecState*, const Identifier&, PropertyDescriptor&) { return false; }
+ virtual void put(JSObject*, ExecState*, const Identifier&, JSValue, PutPropertySlot&) { }
+
+protected:
+ virtual void virtualBegin() { }
+ virtual void virtualEnd() { }
+ virtual RuntimeObjectImp* newRuntimeObject(ExecState*);
+
+ RefPtr<RootObject> m_rootObject;
+
+private:
+ RuntimeObjectImp* m_runtimeObject;
+};
+
+class Array : public Noncopyable {
+public:
+ Array(PassRefPtr<RootObject>);
+ virtual ~Array();
+
+ virtual void setValueAt(ExecState*, unsigned index, JSValue) const = 0;
+ virtual JSValue valueAt(ExecState*, unsigned index) const = 0;
+ virtual unsigned int getLength() const = 0;
+
+protected:
+ RefPtr<RootObject> m_rootObject;
+};
+
+const char* signatureForParameters(const ArgList&);
+
+typedef HashMap<RefPtr<UString::Rep>, MethodList*> MethodListMap;
+typedef HashMap<RefPtr<UString::Rep>, Method*> MethodMap;
+typedef HashMap<RefPtr<UString::Rep>, Field*> FieldMap;
+
+} // namespace Bindings
+
+} // namespace JSC
+
+#endif // USE(JSC)
+
+#endif
#define WEBCORE_NAVIGATOR_VENDOR "Google Inc."
// This must be defined before we include FastMalloc.h, below.
#define USE_SYSTEM_MALLOC 1
-#define ANDROID_MOBILE // change can be merged back to WebKit.org for MOBILE
#define LOG_DISABLED 1
#include <wtf/Assertions.h>
// Central place to set which optional features Android uses.
#include "SVGStyleElement.h"
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
-#include "TouchEvent.h"
#if PLATFORM(ANDROID)
+// FIXME: We shouldn't be including this from WebCore!
#include "WebViewCore.h"
#endif
-#endif
#ifdef ANDROID_META_SUPPORT
#include "Settings.h"
#include "TimeCounter.h"
#endif
+#if ENABLE(TOUCH_EVENTS)
+#include "ChromeClient.h"
+#include "TouchEvent.h"
+#endif
+
#if ENABLE(WML)
#include "WMLDocument.h"
#include "WMLElement.h"
, m_hasOpenDatabases(false)
#endif
, m_usingGeolocation(false)
-#ifdef ANDROID_MOBILE
- , mExtraLayoutDelay(0)
-#endif
#if ENABLE(WML)
, m_containsWMLContent(false)
#endif
m_processingLoadEvent = false;
m_startTime = currentTime();
m_overMinimumLayoutThreshold = false;
+ m_extraLayoutDelay = 0;
initSecurityContext();
initDNSPrefetch();
FrameView* view = m_frame->view();
if (view)
view->detachCustomScrollbars();
-
-#if ENABLE(TOUCH_EVENTS) // Android
- // clean up for the top document
- Page* ownerPage = page();
- if (ownerPage && (m_frame == ownerPage->mainFrame())) {
- m_touchEventListeners.clear();
-#if PLATFORM(ANDROID)
- if (view)
- android::WebViewCore::getWebViewCore(view)->needTouchEvents(false);
-#endif
- }
-#endif
}
// indicate destruction mode, i.e. attached() but renderer == 0
int Document::minimumLayoutDelay()
{
if (m_overMinimumLayoutThreshold)
- return 0;
+ return m_extraLayoutDelay;
int elapsed = elapsedTime();
m_overMinimumLayoutThreshold = elapsed > cLayoutScheduleThreshold;
// We'll want to schedule the timer to fire at the minimum layout threshold.
- return max(0, cLayoutScheduleThreshold - elapsed);
+ return max(0, cLayoutScheduleThreshold - elapsed) + m_extraLayoutDelay;
}
int Document::elapsedTime() const
String key(buffer.substring(keyBegin, keyEnd - keyBegin));
String value(buffer.substring(valueBegin, valueEnd - valueBegin));
- frame()->settings()->setMetadataSettings(key, value);
+ if (frame())
+ frame()->settings()->setMetadataSettings(key, value);
}
}
#endif
else if (eventType == "SVGZoomEvents")
event = SVGZoomEvent::create();
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
else if (eventType == "TouchEvent")
event = TouchEvent::create();
#endif
addListenerType(TRANSITIONEND_LISTENER);
else if (eventType == eventNames().beforeloadEvent)
addListenerType(BEFORELOAD_LISTENER);
+ else if (eventType == eventNames().touchstartEvent
+ || eventType == eventNames().touchmoveEvent
+ || eventType == eventNames().touchendEvent
+ || eventType == eventNames().touchcancelEvent) {
+ addListenerType(TOUCH_LISTENER);
+ if (Page* page = this->page())
+ page->chrome()->client()->needTouchEvents(true);
+ }
}
CSSStyleDeclaration* Document::getOverrideStyle(Element*, const String&)
m_haveExplicitlyDisabledDNSPrefetch = true;
}
-#if ENABLE(TOUCH_EVENTS) // Android
-void Document::addTouchEventListener(Node* node)
-{
- // Note: we only keep track of touch listener in the top frame
- if (m_frame && m_frame->tree()->parent()) {
- m_frame->page()->mainFrame()->document()->addTouchEventListener(node);
- } else {
-#if PLATFORM(ANDROID)
- if (m_frame && m_frame->view() && m_touchEventListeners.isEmpty())
- android::WebViewCore::getWebViewCore(m_frame->view())->needTouchEvents(true);
-#endif
- m_touchEventListeners.add(node, 0);
- }
-}
-
-void Document::removeTouchEventListener(Node* node)
-{
- // Note: we only keep track of touch listener in the top frame
- if (m_frame && m_frame->tree()->parent()) {
- m_frame->page()->mainFrame()->document()->removeTouchEventListener(node);
- } else {
-#if PLATFORM(ANDROID)
- if (m_frame && m_frame->view() && m_touchEventListeners.size() == 1 &&
- m_touchEventListeners.contains(node))
- android::WebViewCore::getWebViewCore(m_frame->view())->needTouchEvents(false);
-#endif
- m_touchEventListeners.remove(node);
- }
-}
-
-#endif
-
void Document::reportException(const String& errorMessage, int lineNumber, const String& sourceURL)
{
if (DOMWindow* window = domWindow())
DEFINE_ATTRIBUTE_EVENT_LISTENER(reset);
DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart);
+#if ENABLE(TOUCH_EVENTS)
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
+#endif
DocumentType* doctype() const { return m_docType.get(); }
void setParsing(bool);
bool parsing() const { return m_bParsing; }
int minimumLayoutDelay();
+
+ // This method is used by Android.
+ void setExtraLayoutDelay(int delay) { m_extraLayoutDelay = delay; }
+
bool shouldScheduleLayout();
int elapsedTime() const;
ANIMATIONSTART_LISTENER = 0x200,
ANIMATIONITERATION_LISTENER = 0x400,
TRANSITIONEND_LISTENER = 0x800,
- BEFORELOAD_LISTENER = 0x1000
+ BEFORELOAD_LISTENER = 0x1000,
+ TOUCH_LISTENER = 0x2000
};
bool hasListenerType(ListenerType listenerType) const { return (m_listenerTypes & listenerType); }
void updateFocusAppearanceSoon();
void cancelFocusAppearanceUpdate();
-#ifdef ANDROID_MOBILE
- void setExtraLayoutDelay(int delay) { mExtraLayoutDelay = delay; }
- int extraLayoutDelay() { return mExtraLayoutDelay; }
-#endif
-
// FF method for accessing the selection added for compatability.
DOMSelection* getSelection() const;
void clearXMLVersion() { m_xmlVersion = String(); }
-#if ENABLE(TOUCH_EVENTS) // Android
-public:
- typedef HashMap<Node*, unsigned > TouchListenerMap;
-
- void addTouchEventListener(Node*);
- void removeTouchEventListener(Node*);
- const TouchListenerMap& touchEventListeners() const { return m_touchEventListeners; }
-
-private:
- TouchListenerMap m_touchEventListeners;
-#endif // ENABLE(TOUCH_EVENTS)
private:
virtual bool isDocument() const { return true; }
typedef std::pair<Vector<DocumentMarker>, Vector<IntRect> > MarkerMapVectorPair;
typedef HashMap<RefPtr<Node>, MarkerMapVectorPair*> MarkerMap;
MarkerMap m_markers;
+
#if !PLATFORM(ANDROID)
mutable AXObjectCache* m_axObjectCache;
#endif
+
Timer<Document> m_updateFocusAppearanceTimer;
Element* m_cssTarget;
HashSet<RefPtr<HistoryItem> > m_associatedHistoryItems;
double m_startTime;
bool m_overMinimumLayoutThreshold;
+ // This is used to increase the minimum delay between re-layouts. It is set
+ // using setExtraLayoutDelay to modify the minimum delay used at different
+ // points during the lifetime of the Document.
+ int m_extraLayoutDelay;
Vector<std::pair<ScriptElementData*, CachedResourceHandle<CachedScript> > > m_scriptsToExecuteSoon;
Timer<Document> m_executeScriptSoonTimer;
#if ENABLE(XBL)
OwnPtr<XBLBindingManager> m_bindingManager; // The access point through which documents and elements communicate with XBL.
#endif
-
+
typedef HashMap<AtomicStringImpl*, HTMLMapElement*> ImageMapsByName;
ImageMapsByName m_imageMapsByName;
bool m_usingGeolocation;
-#ifdef ANDROID_MOBILE
- int mExtraLayoutDelay;
-#endif
-
#if ENABLE(WML)
bool m_containsWMLContent;
#endif
attribute [DontEnum] EventListener onscroll;
attribute [DontEnum] EventListener onselect;
attribute [DontEnum] EventListener onsubmit;
-#if ENABLE_TOUCH_EVENTS
- attribute [DontEnum] EventListener ontouchstart;
- attribute [DontEnum] EventListener ontouchend;
- attribute [DontEnum] EventListener ontouchmove;
- attribute [DontEnum] EventListener ontouchcancel;
-#endif
// attribute [DontEnum] EventListener oncanplay;
// attribute [DontEnum] EventListener oncanplaythrough;
attribute [DontEnum] EventListener onreset;
attribute [DontEnum] EventListener onsearch;
attribute [DontEnum] EventListener onselectstart;
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+ attribute [DontEnum] EventListener ontouchstart;
+ attribute [DontEnum] EventListener ontouchmove;
+ attribute [DontEnum] EventListener ontouchend;
+ attribute [DontEnum] EventListener ontouchcancel;
+#endif
#endif
#endif
};
DEFINE_ATTRIBUTE_EVENT_LISTENER(reset);
DEFINE_ATTRIBUTE_EVENT_LISTENER(search);
DEFINE_ATTRIBUTE_EVENT_LISTENER(selectstart);
-
+#if ENABLE(TOUCH_EVENTS)
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
+#endif
const AtomicString& getIDAttribute() const;
bool hasAttribute(const QualifiedName&) const;
const AtomicString& getAttribute(const QualifiedName&) const;
attribute [DontEnum] EventListener onscroll;
attribute [DontEnum] EventListener onselect;
attribute [DontEnum] EventListener onsubmit;
-#if ENABLE_TOUCH_EVENTS
- attribute [DontEnum] EventListener ontouchstart;
- attribute [DontEnum] EventListener ontouchend;
- attribute [DontEnum] EventListener ontouchmove;
- attribute [DontEnum] EventListener ontouchcancel;
-#endif
// attribute [DontEnum] EventListener oncanplay;
// attribute [DontEnum] EventListener oncanplaythrough;
attribute [DontEnum] EventListener onreset;
attribute [DontEnum] EventListener onsearch;
attribute [DontEnum] EventListener onselectstart;
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+ attribute [DontEnum] EventListener ontouchstart;
+ attribute [DontEnum] EventListener ontouchmove;
+ attribute [DontEnum] EventListener ontouchend;
+ attribute [DontEnum] EventListener ontouchcancel;
+#endif
#endif
#endif
};
}
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
-bool Event::isTouchEvent() const
+#if ENABLE(WORKERS)
+bool Event::isErrorEvent() const
{
return false;
}
#endif
-#if ENABLE(WORKERS)
-bool Event::isErrorEvent() const
+#if ENABLE(TOUCH_EVENTS)
+bool Event::isTouchEvent() const
{
return false;
}
#endif
-
+
bool Event::storesResultAsString() const
{
return false;
#if ENABLE(DOM_STORAGE)
virtual bool isStorageEvent() const;
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
- virtual bool isTouchEvent() const;
-#endif
#if ENABLE(WORKERS)
virtual bool isErrorEvent() const;
#endif
+#if ENABLE(TOUCH_EVENTS)
+ virtual bool isTouchEvent() const;
+#endif
bool propagationStopped() const { return m_propagationStopped; }
macro(storage) \
macro(submit) \
macro(textInput) \
-/* #if ENABLE(TOUCH_EVENTS) // Android */ \
- macro(touchstart) \
- macro(touchmove) \
- macro(touchend) \
- macro(touchcancel) \
- macro(touchlongpress) \
- macro(touchdoubletap) \
-/* #endif */ \
macro(unload) \
macro(updateready) \
macro(zoom) \
\
macro(orientationchange) \
\
+ macro(touchstart) \
+ macro(touchmove) \
+ macro(touchend) \
+ macro(touchcancel) \
+/* #if PLATFORM(ANDROID) */ \
+ macro(touchlongpress) \
+ macro(touchdoubletap) \
+/* #endif */ \
+ \
// end of DOM_EVENT_NAMES_FOR_EACH
class EventNames : public Noncopyable {
#include "HTMLNoScriptElement.h"
#endif
+#if ENABLE(TOUCH_EVENTS)
+#include "ChromeClient.h"
+#endif
+
#define DUMP_NODE_STATISTICS 0
using namespace std;
if (Document* document = this->document())
document->addListenerTypeIfNeeded(eventType);
- updateSVGElementInstancesAfterEventListenerChange(this);
-#if ENABLE(TOUCH_EVENTS) // Android
- if (this->document() &&
- (eventType == eventNames().touchstartEvent ||
- eventType == eventNames().touchendEvent ||
- eventType == eventNames().touchmoveEvent ||
- eventType == eventNames().touchcancelEvent))
- this->document()->addTouchEventListener(this);
-#endif
+ updateSVGElementInstancesAfterEventListenerChange(this);
return true;
}
updateSVGElementInstancesAfterEventListenerChange(this);
-#if ENABLE(TOUCH_EVENTS) // Android
- if (this->document() &&
- (eventType == eventNames().touchstartEvent ||
- eventType == eventNames().touchendEvent ||
- eventType == eventNames().touchmoveEvent ||
- eventType == eventNames().touchcancelEvent))
- this->document()->removeTouchEventListener(this);
+#if ENABLE(TOUCH_EVENTS)
+ if (Document* document = this->document()) {
+ if (document->page()
+ && (eventType == eventNames().touchstartEvent
+ || eventType == eventNames().touchmoveEvent
+ || eventType == eventNames().touchendEvent
+ || eventType == eventNames().touchcancelEvent))
+ // Note the corresponding needTouchEvents(true) is called in Document::addListenerTypeIfNeeded().
+ document->page()->chrome()->client()->needTouchEvents(false);
+
+ }
#endif
return true;
}
*/
virtual bool disabled() const;
-#if ENABLE(TOUCH_EVENTS) // Android
- DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
-#endif
-
using TreeShared<Node>::ref;
using TreeShared<Node>::deref;
#include "config.h"
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
#include "Touch.h"
FrameView* frameView = frame->view();
if (!frameView)
return 0;
- return frameView->scrollX();
+ return frameView->scrollX() / frame->pageZoomFactor();
}
static int contentsY(Frame* frame)
FrameView* frameView = frame->view();
if (!frameView)
return 0;
- return frameView->scrollY();
+ return frameView->scrollY() / frame->pageZoomFactor();
}
Touch::Touch(Frame* frame, EventTarget* target, unsigned identifier,
#ifndef TOUCH_H_
#define TOUCH_H_
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
#include "EventTarget.h"
#include "Frame.h"
namespace WebCore {
- class Touch : public RefCounted<Touch> {
- public:
- static PassRefPtr<Touch> create(Frame* frame, EventTarget* target,
- unsigned identifier, int screenX, int screenY, int pageX, int pageY)
- {
- return adoptRef(new Touch(frame, target, identifier, screenX,
- screenY, pageX, pageY));
- }
+class Touch : public RefCounted<Touch> {
+public:
+ static PassRefPtr<Touch> create(Frame* frame, EventTarget* target,
+ unsigned identifier, int screenX, int screenY, int pageX, int pageY)
+ {
+ return adoptRef(new Touch(frame, target, identifier, screenX,
+ screenY, pageX, pageY));
+ }
- void updateLocation(int screenX, int screenY, int pageX, int pageY);
+ void updateLocation(int screenX, int screenY, int pageX, int pageY);
- Frame* frame() const { return m_frame.get(); }
- EventTarget* target() const { return m_target.get(); }
- unsigned identifier() const { return m_identifier; }
- int clientX() const { return m_clientX; }
- int clientY() const { return m_clientY; }
- int screenX() const { return m_screenX; }
- int screenY() const { return m_screenY; }
- int pageX() const { return m_pageX; }
- int pageY() const { return m_pageY; }
+ Frame* frame() const { return m_frame.get(); }
+ EventTarget* target() const { return m_target.get(); }
+ unsigned identifier() const { return m_identifier; }
+ int clientX() const { return m_clientX; }
+ int clientY() const { return m_clientY; }
+ int screenX() const { return m_screenX; }
+ int screenY() const { return m_screenY; }
+ int pageX() const { return m_pageX; }
+ int pageY() const { return m_pageY; }
- private:
- Touch(Frame* frame, EventTarget* target, unsigned identifier,
- int screenX, int screenY, int pageX, int pageY);
+private:
+ Touch(Frame* frame, EventTarget* target, unsigned identifier,
+ int screenX, int screenY, int pageX, int pageY);
- RefPtr<Frame> m_frame;
- RefPtr<EventTarget> m_target;
- unsigned m_identifier;
- int m_clientX;
- int m_clientY;
- int m_screenX;
- int m_screenY;
- int m_pageX;
- int m_pageY;
- };
+ RefPtr<Frame> m_frame;
+ RefPtr<EventTarget> m_target;
+ unsigned m_identifier;
+ int m_clientX;
+ int m_clientY;
+ int m_screenX;
+ int m_screenY;
+ int m_pageX;
+ int m_pageY;
+};
} // namespace WebCore
#include "config.h"
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
#include "TouchEvent.h"
TouchEvent::TouchEvent(TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY)
+ PassRefPtr<AbstractView> view, int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
: MouseRelatedEvent(type, true, true, view, 0, screenX, screenY, pageX, pageY,
- false, false, false, false)
+ ctrlKey, altKey, shiftKey, metaKey)
, m_touches(touches)
, m_targetTouches(targetTouches)
, m_changedTouches(changedTouches)
+#if PLATFORM(ANDROID)
, m_longPressPrevented(false)
, m_doubleTapPrevented(false)
+#endif
{
}
void TouchEvent::initTouchEvent(TouchList* touches, TouchList* targetTouches,
TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY)
+ PassRefPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
{
if (dispatched())
return;
m_screenX = screenX;
m_screenY = screenY;
+ m_ctrlKey = ctrlKey;
+ m_altKey = altKey;
+ m_shiftKey = shiftKey;
+ m_metaKey = metaKey;
initCoordinates(clientX, clientY);
}
#ifndef TouchEvent_h
#define TouchEvent_h
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
#include "MouseRelatedEvent.h"
#include "TouchList.h"
namespace WebCore {
- class TouchEvent : public MouseRelatedEvent {
- public:
- static PassRefPtr<TouchEvent> create()
- {
- return adoptRef(new TouchEvent);
- }
- static PassRefPtr<TouchEvent> create(TouchList* touches,
- TouchList* targetTouches, TouchList* changedTouches,
- const AtomicString& type, PassRefPtr<AbstractView> view,
- int screenX, int screenY, int pageX, int pageY)
- {
- return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
- type, view, screenX, screenY, pageX, pageY));
- }
-
- void initTouchEvent(TouchList* touches, TouchList* targetTouches,
- TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView> view, int screenX, int screenY,
- int clientX, int clientY);
-
- TouchList* touches() const {return m_touches.get();}
- TouchList* targetTouches() const {return m_targetTouches.get();}
- TouchList* changedTouches() const {return m_changedTouches.get();}
-
- bool longPressPrevented() const { return m_longPressPrevented; }
- void preventLongPress() { m_longPressPrevented = true; }
- void setLongPressPrevented(bool prevented) { m_longPressPrevented = prevented; }
-
- bool doubleTapPrevented() const { return m_doubleTapPrevented; }
- void preventDoubleTap() { m_doubleTapPrevented = true; }
- void setDoubleTapPrevented(bool prevented) { m_doubleTapPrevented = prevented; }
-
- private:
- TouchEvent() {}
- TouchEvent(TouchList* touches, TouchList* targetTouches,
- TouchList* changedTouches, const AtomicString& type,
- PassRefPtr<AbstractView>, int screenX, int screenY, int pageX,
- int pageY);
-
- virtual bool isTouchEvent() const {return true;}
-
- RefPtr<TouchList> m_touches;
- RefPtr<TouchList> m_targetTouches;
- RefPtr<TouchList> m_changedTouches;
-
- bool m_longPressPrevented;
- bool m_doubleTapPrevented;
- };
+class TouchEvent : public MouseRelatedEvent {
+public:
+ static PassRefPtr<TouchEvent> create()
+ {
+ return adoptRef(new TouchEvent);
+ }
+ static PassRefPtr<TouchEvent> create(TouchList* touches,
+ TouchList* targetTouches, TouchList* changedTouches,
+ const AtomicString& type, PassRefPtr<AbstractView> view,
+ int screenX, int screenY, int pageX, int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey)
+ {
+ return adoptRef(new TouchEvent(touches, targetTouches, changedTouches,
+ type, view, screenX, screenY, pageX, pageY,
+ ctrlKey, altKey, shiftKey, metaKey));
+ }
+
+ void initTouchEvent(TouchList* touches, TouchList* targetTouches,
+ TouchList* changedTouches, const AtomicString& type,
+ PassRefPtr<AbstractView> view, int screenX, int screenY,
+ int clientX, int clientY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+
+ TouchList* touches() const { return m_touches.get(); }
+ TouchList* targetTouches() const { return m_targetTouches.get(); }
+ TouchList* changedTouches() const { return m_changedTouches.get(); }
+
+#if PLATFORM(ANDROID)
+ bool longPressPrevented() const { return m_longPressPrevented; }
+ void preventLongPress() { m_longPressPrevented = true; }
+ void setLongPressPrevented(bool prevented) { m_longPressPrevented = prevented; }
+
+ bool doubleTapPrevented() const { return m_doubleTapPrevented; }
+ void preventDoubleTap() { m_doubleTapPrevented = true; }
+ void setDoubleTapPrevented(bool prevented) { m_doubleTapPrevented = prevented; }
+#endif
+
+private:
+ TouchEvent() {}
+ TouchEvent(TouchList* touches, TouchList* targetTouches,
+ TouchList* changedTouches, const AtomicString& type,
+ PassRefPtr<AbstractView>, int screenX, int screenY, int pageX,
+ int pageY,
+ bool ctrlKey, bool altKey, bool shiftKey, bool metaKey);
+
+ virtual bool isTouchEvent() const { return true; }
+
+ RefPtr<TouchList> m_touches;
+ RefPtr<TouchList> m_targetTouches;
+ RefPtr<TouchList> m_changedTouches;
+
+#if PLATFORM(ANDROID)
+ bool m_longPressPrevented;
+ bool m_doubleTapPrevented;
+#endif
+};
} // namespace WebCore
readonly attribute TouchList touches;
readonly attribute TouchList targetTouches;
readonly attribute TouchList changedTouches;
+ readonly attribute boolean ctrlKey;
+ readonly attribute boolean shiftKey;
+ readonly attribute boolean altKey;
+ readonly attribute boolean metaKey;
void initTouchEvent(in TouchList touches,
in TouchList targetTouches,
in long screenX,
in long screenY,
in long clientX,
- in long clientY);
+ in long clientY,
+ in boolean ctrlKey,
+ in boolean altKey,
+ in boolean shiftKey,
+ in boolean metaKey);
};
}
#include "config.h"
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
#include "TouchList.h"
#ifndef TOUCHLIST_H_
#define TOUCHLIST_H_
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
#include <wtf/RefCounted.h>
#include <wtf/Vector.h>
namespace WebCore {
- class TouchList : public RefCounted<TouchList> {
- public:
- static PassRefPtr<TouchList> create()
- {
- return adoptRef(new TouchList);
- }
+class TouchList : public RefCounted<TouchList> {
+public:
+ static PassRefPtr<TouchList> create()
+ {
+ return adoptRef(new TouchList);
+ }
- unsigned length() const { return m_values.size(); }
+ unsigned length() const { return m_values.size(); }
- Touch* item (unsigned);
+ Touch* item(unsigned);
- void append(const PassRefPtr<Touch> touch) { m_values.append(touch); }
+ void append(const PassRefPtr<Touch> touch) { m_values.append(touch); }
- private:
- TouchList() {}
+private:
+ TouchList() {}
- Vector<RefPtr<Touch> > m_values;
- };
+ Vector<RefPtr<Touch> > m_values;
+};
} // namespace WebCore
onsuspend
onsubmit
ontimeupdate
-/* #if ENABLE(TOUCH_EVENTS) // Android */
ontouchstart
ontouchmove
ontouchend
ontouchcancel
-/* #endif */
onunload
onvolumechange
onwaiting
setAttributeEventListener(eventNames().webkitAnimationEndEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == onwebkittransitionendAttr) {
setAttributeEventListener(eventNames().webkitTransitionEndEvent, createAttributeEventListener(this, attr));
-#if ENABLE(TOUCH_EVENTS) // Android
+ } else if (attr->name() == oninputAttr) {
+ setAttributeEventListener(eventNames().inputEvent, createAttributeEventListener(this, attr));
+ } else if (attr->name() == oninvalidAttr) {
+ setAttributeEventListener(eventNames().invalidEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == ontouchstartAttr) {
setAttributeEventListener(eventNames().touchstartEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ontouchendAttr) {
- setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == ontouchmoveAttr) {
setAttributeEventListener(eventNames().touchmoveEvent, createAttributeEventListener(this, attr));
+ } else if (attr->name() == ontouchendAttr) {
+ setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attr));
} else if (attr->name() == ontouchcancelAttr) {
setAttributeEventListener(eventNames().touchcancelEvent, createAttributeEventListener(this, attr));
-#endif
- } else if (attr->name() == oninputAttr) {
- setAttributeEventListener(eventNames().inputEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == oninvalidAttr) {
- setAttributeEventListener(eventNames().invalidEvent, createAttributeEventListener(this, attr));
}
}
// double's fractional part size is DBL_MAN_DIG-bit. If the current
// value is greater than step*2^DBL_MANT_DIG, the following fmod() makes
// no sense.
- if (doubleValue / pow(2, DBL_MANT_DIG) > step)
+ if (doubleValue / pow(2.0, DBL_MANT_DIG) > step)
return false;
double remainder = fmod(doubleValue, step);
// Accepts errors in lower 7-bit.
- double acceptableError = step / pow(2, DBL_MANT_DIG - 7);
+ double acceptableError = step / pow(2.0, DBL_MANT_DIG - 7);
return acceptableError < remainder && remainder < (step - acceptableError);
}
// Non-RANGE types should be rejected by getAllowedValueStep().
void HTMLTextAreaElement::restoreFormControlState(const String& state)
{
- setDefaultValue(state);
+ setValue(state);
}
void HTMLTextAreaElement::childrenChanged(bool changedByParser, Node* beforeChange, Node* afterChange, int childCountDelta)
printf("Beginning timer write at time %d\n", m_doc->elapsedTime());
#endif
-#ifdef ANDROID_MOBILE
- if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay() && !m_doc->extraLayoutDelay()) {
-#else
if (m_doc->view() && m_doc->view()->layoutPending() && !m_doc->minimumLayoutDelay()) {
-#endif
// Restart the timer and let layout win. This is basically a way of ensuring that the layout
// timer has higher priority than our timer.
m_timer.startOneShot(0);
}
#endif
m_image = BitmapImage::create(this);
-#if PLATFORM(SGL)
+#if PLATFORM(ANDROID)
m_image->setURL(url());
#endif
}
// This does the same kind of work that didOpenURL does, except it relies on the fact
// that a higher level already checked that the URLs match and the scrolling is the right thing to do.
-#if PLATFORM(ANDROID)
-// TODO: Upstream to webkit.org
-void FrameLoader::loadInSameDocument(const KURL& url, SerializedScriptValue* stateObject, bool isNewNavigation, bool suppressAddToHistory)
-#else
void FrameLoader::loadInSameDocument(const KURL& url, SerializedScriptValue* stateObject, bool isNewNavigation)
-#endif
{
// If we have a state object, we cannot also be a new navigation.
ASSERT(!stateObject || (stateObject && !isNewNavigation));
// Update the data source's request with the new URL to fake the URL change
m_frame->document()->setURL(url);
documentLoader()->replaceRequestURLForSameDocumentNavigation(url);
-#if PLATFORM(ANDROID)
- // TODO: Upstream to webkit.org
- if (isNewNavigation && !shouldTreatURLAsSameAsCurrent(url) && !stateObject && !suppressAddToHistory) {
-#else
if (isNewNavigation && !shouldTreatURLAsSameAsCurrent(url) && !stateObject) {
-#endif
// NB: must happen after replaceRequestURLForSameDocumentNavigation(), since we add
// based on the current request. Must also happen before we openURL and displace the
// scroll position, since adding the BF item will save away scroll state.
return;
bool isRedirect = m_quickRedirectComing || policyChecker()->loadType() == FrameLoadTypeRedirectWithLockedBackForwardList;
-#ifdef ANDROID_USER_GESTURE
- // Do not add history items for a fragment scroll not initiated by the
- // user. http://bugs.webkit.org/show_bug.cgi?id=30224
- bool isUserInitiated = isProcessingUserGesture() || request.getUserGesture();
- loadInSameDocument(request.url(), 0, !isRedirect, !isUserInitiated);
-#else
loadInSameDocument(request.url(), 0, !isRedirect);
-#endif
}
bool FrameLoader::shouldScrollToAnchor(bool isFormSubmission, FrameLoadType loadType, const KURL& url)
history()->setCurrentItem(item);
// loadInSameDocument() actually changes the URL and notifies load delegates of a "fake" load
-#if PLATFORM(ANDROID)
- // TODO: Upstream to webkit.org
- loadInSameDocument(item->url(), item->stateObject(), false, false);
-#else
loadInSameDocument(item->url(), item->stateObject(), false);
-#endif
// Restore user view state from the current history item here since we don't do a normal load.
// Even though we just manually set the current history item, this ASSERT verifies nothing
Frame* loadSubframe(HTMLFrameOwnerElement*, const KURL&, const String& name, const String& referrer);
-#if PLATFORM(ANDROID)
- // TODO: Upstream to webkit.org
- void loadInSameDocument(const KURL&, SerializedScriptValue* stateObject, bool isNewNavigation, bool suppressAddToHistory);
-#else
void loadInSameDocument(const KURL&, SerializedScriptValue* stateObject, bool isNewNavigation);
-#endif
void provisionalLoadStarted();
virtual void willPopUpMenu(NSMenu *) { }
#endif
+#if ENABLE(TOUCH_EVENTS)
+ virtual void needTouchEvents(bool, bool force = false) = 0;
+#endif
+
protected:
virtual ~ChromeClient() { }
};
/*
- * Copyright 2007, The Android Open Source Project
+ * 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
* 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 APPLE COMPUTER, INC. OR
+ * 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
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __ANDROID_LIMITS
-#define __ANDROID_LIMITS
+#include "config.h"
-#include <limits.h>
+#include "Connection.h"
-#endif // __ANDROID_LIMITS
+#include "NetworkStateNotifier.h"
+
+namespace WebCore {
+
+Connection::ConnectionType Connection::type() const
+{
+ return networkStateNotifier().type();
+}
+
+};
\ No newline at end of file
--- /dev/null
+/*
+ * 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.
+ */
+
+#ifndef Connection_h
+#define Connection_h
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+
+namespace WebCore {
+
+class Connection : public RefCounted<Connection> {
+public:
+ enum ConnectionType {
+ Unknown = 0,
+ Ethernet = 1,
+ WiFi = 2,
+ Cell_2G = 3,
+ Cell_3G = 4,
+ };
+
+ static PassRefPtr<Connection> create() { return adoptRef(new Connection()); }
+
+ ConnectionType type() const;
+
+private:
+ Connection() { }
+};
+
+} // namespace WebCore
+
+#endif // Connection_h
--- /dev/null
+/*
+ * 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.
+ */
+
+ module core {
+
+ interface Connection {
+ readonly attribute unsigned short type;
+
+ const unsigned short UNKNOWN = 0;
+ const unsigned short ETHERNET = 1;
+ const unsigned short WIFI = 2;
+ const unsigned short CELL_2G = 3;
+ const unsigned short CELL_3G = 4;
+ };
+
+}
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkitanimationend, webkitAnimationEnd);
DEFINE_MAPPED_ATTRIBUTE_EVENT_LISTENER(webkittransitionend, webkitTransitionEnd);
-#if ENABLE(TOUCH_EVENTS) // Android
+#if ENABLE(TOUCH_EVENTS)
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchstart);
- DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchmove);
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(touchend);
DEFINE_ATTRIBUTE_EVENT_LISTENER(touchcancel);
#endif
-
void captureEvents();
void releaseEvents();
raises(DOMException);
// Events
-#if ENABLE_TOUCH_EVENTS
- attribute EventListener ontouchstart;
- attribute EventListener ontouchend;
- attribute EventListener ontouchmove;
- attribute EventListener ontouchcancel;
-#endif
attribute EventListener onabort;
attribute EventListener onbeforeunload;
#if defined(ENABLE_ORIENTATION_EVENTS) && ENABLE_ORIENTATION_EVENTS
attribute EventListener onorientationchange;
#endif
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+ attribute [DontEnum] EventListener ontouchstart;
+ attribute [DontEnum] EventListener ontouchmove;
+ attribute [DontEnum] EventListener ontouchend;
+ attribute [DontEnum] EventListener ontouchcancel;
+#endif
// EventTarget interface
[Custom] void addEventListener(in DOMString type,
attribute WheelEventConstructor WheelEvent;
attribute MessageEventConstructor MessageEvent;
attribute EventExceptionConstructor EventException;
-#if ENABLE_TOUCH_EVENTS
- attribute TouchEventConstructor TouchEvent;
-#endif
attribute WebKitCSSKeyframeRuleConstructor WebKitCSSKeyframeRule;
attribute WebKitCSSKeyframesRuleConstructor WebKitCSSKeyframesRule;
#endif
#endif
+#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
+ attribute TouchEventConstructor TouchEvent;
+#endif
+
#endif // defined(LANGUAGE_JAVASCRIPT)
#if defined(V8_BINDING) && V8_BINDING
#include "Page.h"
#include "PlatformKeyboardEvent.h"
#include "PlatformWheelEvent.h"
+#include "PluginView.h"
#include "RenderFrameSet.h"
#include "RenderTextControlSingleLine.h"
#include "RenderView.h"
#include "SVGUseElement.h"
#endif
-#if ENABLE(TOUCH_EVENTS) // Android
-#include "TouchEvent.h"
+#if ENABLE(TOUCH_EVENTS)
#include "PlatformTouchEvent.h"
+#include "TouchEvent.h"
#endif
#if defined(ANDROID_PLUGINS)
m_lastScrollbarUnderMouse = 0;
m_clickCount = 0;
m_clickNode = 0;
-#if ENABLE(TOUCH_EVENTS) // Android
- m_touch = 0;
+#if ENABLE(TOUCH_EVENTS)
+ m_touchEventTarget = 0;
+ if (Document* doc = m_frame->document()) {
+ if (Page* page = doc->page()) {
+ // We are clearing event handlers, which includes any touch
+ // event handlers so force webkit to tell the chrome client to
+ // stop forwarding the events.
+ page->chrome()->client()->needTouchEvents(false, true);
+ }
+ }
#endif
m_frameSetBeingResized = 0;
#if ENABLE(DRAG_SUPPORT)
return scrollbar->mouseDown(mev.event());
}
-#if ENABLE(TOUCH_EVENTS) // Android
-int EventHandler::handleTouchEvent(const PlatformTouchEvent& e)
+// If scrollbar (under mouse) is different from last, send a mouse exited. Set
+// last to scrollbar if setLast is true; else set last to 0.
+void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setLast)
{
- // only handle the touch event in the top frame handler
- if (m_frame->tree()->parent(true))
- return m_frame->tree()->parent()->eventHandler()->handleTouchEvent(e);
-
- Document* doc = m_frame->document();
- if (!doc)
- return 0;
-
- RenderObject* docRenderer = doc->renderer();
- if (!docRenderer)
- return 0;
-
- if (doc->touchEventListeners().size() == 0)
- return 0;
+ if (m_lastScrollbarUnderMouse != scrollbar) {
+ // Send mouse exited to the old scrollbar.
+ if (m_lastScrollbarUnderMouse)
+ m_lastScrollbarUnderMouse->mouseExited();
+ m_lastScrollbarUnderMouse = setLast ? scrollbar : 0;
+ }
+}
- TouchEventType type = e.eventType();
- if (type == TouchEventStart || type == TouchEventLongPress || type == TouchEventDoubleTap) {
- Frame* frame = m_frame;
- IntPoint vPoint = frame->view()->windowToContents(e.pos());
- HitTestRequest request(HitTestRequest::ReadOnly);
- HitTestResult result(vPoint);
- frame->contentRenderer()->layer()->hitTest(request, result);
- Node* node = result.innerNode();
- if (node) {
- RenderObject* target = node->renderer();
- while (target && target->isWidget()) {
- Widget* widget = static_cast<RenderWidget*>(target)->widget();
- if (widget->isFrameView()) {
- frame = static_cast<FrameView*>(widget)->frame();
- vPoint = frame->view()->windowToContents(e.pos());
- HitTestResult ret(vPoint);
- frame->contentRenderer()->layer()->hitTest(request, ret);
- node = ret.innerNode();
- if (!node)
- break;
- else
- target = node->renderer();
- } else
- // plugin view??
- break;
- }
+#if ENABLE(TOUCH_EVENTS)
+#if PLATFORM(ANDROID)
+// TODO(benm): On Android we return an int back to Java to signify whether the default actions
+// for longpress/doubletap in the Browser should be prevented. I think that before upstreaming
+// to webkit.org we can refactor the Java side to not require this.
+int EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
+#else
+bool EventHandler::handleTouchEvent(const PlatformTouchEvent& event)
+#endif
+{
+ RefPtr<TouchList> touches = TouchList::create();
+ RefPtr<TouchList> pressedTouches = TouchList::create();
+ RefPtr<TouchList> releasedTouches = TouchList::create();
+ RefPtr<TouchList> movedTouches = TouchList::create();
+ RefPtr<TouchList> targetTouches = TouchList::create();
+ RefPtr<TouchList> cancelTouches = TouchList::create();
+
+ const Vector<PlatformTouchPoint>& points = event.touchPoints();
+ AtomicString* eventName = 0;
+
+ for (int i = 0; i < points.size(); ++i) {
+ const PlatformTouchPoint& point = points[i];
+ IntPoint framePoint = documentPointForWindowPoint(m_frame, point.pos());
+ HitTestResult result = hitTestResultAtPoint(framePoint, /*allowShadowContent*/ false);
+ Node* target = result.innerNode();
+
+ // Touch events should not go to text nodes
+ if (target && target->isTextNode())
+ target = target->parentNode();
+
+ Document* doc = target->document();
+ if (!doc)
+ continue;
+ if (!doc->hasListenerType(Document::TOUCH_LISTENER))
+ continue;
+
+ int adjustedPageX = lroundf(framePoint.x() / m_frame->pageZoomFactor());
+ int adjustedPageY = lroundf(framePoint.y() / m_frame->pageZoomFactor());
+
+ if ( (event.type() == TouchStart
+#if PLATFORM(ANDROID)
+ || event.type() == TouchDoubleTap
+ || event.type() == TouchLongPress
+#endif
+ ) && !i) {
+ m_touchEventTarget = target;
+ m_firstTouchScreenPos = point.screenPos();
+ m_firstTouchPagePos = framePoint;
}
- if (!node) {
- // reset to the top document node
- node = doc;
- frame = m_frame;
- vPoint = frame->view()->windowToContents(e.pos());
- }
+ RefPtr<Touch> touch = Touch::create(m_frame, m_touchEventTarget.get(), point.id(),
+ point.screenPos().x(), point.screenPos().y(),
+ adjustedPageX, adjustedPageY);
- m_touch = Touch::create(frame, node, 0,
- e.x(), e.y(), vPoint.x(), vPoint.y());
- } else if (m_touch) {
- if ((type == TouchEventMove) && (e.x() == m_touch->screenX()) &&
- (e.y() == m_touch->screenY())) {
- // don't trigger the event if it hasn't really moved
- return 0;
+ if (point.state() == PlatformTouchPoint::TouchReleased)
+ releasedTouches->append(touch);
+ else if (point.state() == PlatformTouchPoint::TouchCancelled)
+ cancelTouches->append(touch);
+ else {
+ if (point.state() == PlatformTouchPoint::TouchPressed)
+ pressedTouches->append(touch);
+ else {
+ touches->append(touch);
+ if (m_touchEventTarget == target)
+ targetTouches->append(touch);
+ if (point.state() == PlatformTouchPoint::TouchMoved)
+ movedTouches->append(touch);
+ }
}
+ }
- IntPoint vPoint = m_touch->frame()->view()->windowToContents(e.pos());
- m_touch->updateLocation(e.x(), e.y(), vPoint.x(), vPoint.y());
- } else {
+ if (!m_touchEventTarget)
+#if PLATFORM(ANDROID)
return 0;
- }
+#else
+ return false;
+#endif
- RefPtr<TouchList> touchList = TouchList::create();
- touchList->append(m_touch);
- // For TouchEventEnd, touches and targetTouches are empty list
- RefPtr<TouchList> emptyList = TouchList::create();
- RefPtr<TouchEvent> te;
- switch(type) {
- case TouchEventStart:
- te = TouchEvent::create(touchList.get(), touchList.get(), touchList.get(),
- eventNames().touchstartEvent, m_touch->frame()->document()->defaultView(),
- m_touch->screenX(), m_touch->screenY(), m_touch->pageX(), m_touch->pageY());
- break;
+ bool defaultPrevented = false;
+#if PLATFORM(ANDROID)
+ // TODO (benm): We should be able to remove this prior to upstreaming once Java side refactorings to make
+ // preventDeault work better are complete.
+ bool longPressPrevented = false;
+ bool doubleTapPrevented = false;
+#endif
- case TouchEventEnd:
- te = TouchEvent::create(emptyList.get(), emptyList.get(), touchList.get(),
- eventNames().touchendEvent, m_touch->frame()->document()->defaultView(),
- m_touch->screenX(), m_touch->screenY(), m_touch->pageX(), m_touch->pageY());
- break;
+ if (event.type() == TouchCancel) {
+ eventName = &eventNames().touchcancelEvent;
+ RefPtr<TouchEvent> cancelEv =
+ TouchEvent::create(TouchList::create().get(), TouchList::create().get(), cancelTouches.get(),
+ *eventName, m_touchEventTarget->document()->defaultView(),
+ m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
+ m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(),
+ event.metaKey());
+
+ ExceptionCode ec = 0;
+ m_touchEventTarget->dispatchEvent(cancelEv.get(), ec);
+ defaultPrevented |= cancelEv->defaultPrevented();
+ }
+
+ if (releasedTouches->length() > 0) {
+ eventName = &eventNames().touchendEvent;
+
+ RefPtr<TouchEvent> endEv =
+ TouchEvent::create(touches.get(), targetTouches.get(), releasedTouches.get(),
+ *eventName, m_touchEventTarget->document()->defaultView(),
+ m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
+ m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(),
+ event.metaKey());
+
+ ExceptionCode ec = 0;
+ m_touchEventTarget->dispatchEvent(endEv.get(), ec);
+ defaultPrevented |= endEv->defaultPrevented();
+ }
+
+ if (pressedTouches->length() > 0) {
+ // Add pressed touchpoints to touches and targetTouches.
+ for (int i = 0; i < pressedTouches->length(); ++i) {
+ touches->append(pressedTouches->item(i));
+ if (m_touchEventTarget == pressedTouches->item(i)->target())
+ targetTouches->append(pressedTouches->item(i));
+ }
- case TouchEventMove:
- te = TouchEvent::create(touchList.get(), touchList.get(), touchList.get(),
- eventNames().touchmoveEvent, m_touch->frame()->document()->defaultView(),
- m_touch->screenX(), m_touch->screenY(), m_touch->pageX(), m_touch->pageY());
- break;
+#if PLATFORM(ANDROID)
+ if (event.type() == TouchLongPress) {
+ eventName = &eventNames().touchlongpressEvent;
+ RefPtr<TouchEvent> longpressEv =
+ TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(),
+ *eventName, m_touchEventTarget->document()->defaultView(),
+ m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
+ m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(),
+ event.metaKey());
+
+ ExceptionCode ec = 0;
+ m_touchEventTarget->dispatchEvent(longpressEv.get(), ec);
+ defaultPrevented |= longpressEv->defaultPrevented();
+ } else if (event.type() == TouchDoubleTap) {
+ eventName = &eventNames().touchdoubletapEvent;
+ RefPtr<TouchEvent> doubleTapEv =
+ TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(),
+ *eventName, m_touchEventTarget->document()->defaultView(),
+ m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
+ m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(),
+ event.metaKey());
+
+ ExceptionCode ec = 0;
+ m_touchEventTarget->dispatchEvent(doubleTapEv.get(), ec);
+ defaultPrevented |= doubleTapEv->defaultPrevented();
+ } else {
+#endif
+ eventName = &eventNames().touchstartEvent;
+ RefPtr<TouchEvent> startEv =
+ TouchEvent::create(touches.get(), targetTouches.get(), pressedTouches.get(),
+ *eventName, m_touchEventTarget->document()->defaultView(),
+ m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
+ m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(),
+ event.metaKey());
+ ExceptionCode ec = 0;
+ m_touchEventTarget->dispatchEvent(startEv.get(), ec);
+ defaultPrevented |= startEv->defaultPrevented();
+#if PLATFORM(ANDROID)
+ longPressPrevented |= startEv->longPressPrevented();
+ doubleTapPrevented |= startEv->doubleTapPrevented();
+ }
+#endif
+ }
- case TouchEventCancel:
- te = TouchEvent::create(touchList.get(), touchList.get(), touchList.get(),
- eventNames().touchcancelEvent, m_touch->frame()->document()->defaultView(),
- m_touch->screenX(), m_touch->screenY(), m_touch->pageX(), m_touch->pageY());
- break;
+ if (movedTouches->length() > 0) {
+ eventName = &eventNames().touchmoveEvent;
+ RefPtr<TouchEvent> moveEv =
+ TouchEvent::create(touches.get(), targetTouches.get(), movedTouches.get(),
+ *eventName, m_touchEventTarget->document()->defaultView(),
+ m_firstTouchScreenPos.x(), m_firstTouchScreenPos.y(),
+ m_firstTouchPagePos.x(), m_firstTouchPagePos.y(),
+ event.ctrlKey(), event.altKey(), event.shiftKey(),
+ event.metaKey());
+ ExceptionCode ec = 0;
+ m_touchEventTarget->dispatchEvent(moveEv.get(), ec);
+ defaultPrevented |= moveEv->defaultPrevented();
+ }
- case TouchEventLongPress:
- te = TouchEvent::create(touchList.get(), touchList.get(), touchList.get(),
- eventNames().touchlongpressEvent, m_touch->frame()->document()->defaultView(),
- m_touch->screenX(), m_touch->screenY(), m_touch->pageX(), m_touch->pageY());
- break;
- case TouchEventDoubleTap:
- te = TouchEvent::create(touchList.get(), touchList.get(), touchList.get(),
- eventNames().touchdoubletapEvent, m_touch->frame()->document()->defaultView(),
- m_touch->screenX(), m_touch->screenY(), m_touch->pageX(), m_touch->pageY());
- break;
+ if (event.type() == TouchEnd || event.type() == TouchCancel)
+ m_touchEventTarget = 0;
- default:
- return false;
- }
- ExceptionCode ec = 0;
- m_touch->target()->dispatchEvent(te.get(), ec);
- if (type == TouchEventEnd || type == TouchEventCancel)
- m_touch = 0;
- if (type == TouchEventLongPress || type == TouchEventDoubleTap)
+#if PLATFORM(ANDROID)
+ // TODO (benm): We should be able to remove this prior to upstreaming once Java side refactorings to make
+ // preventDefault work better are complete.
+ if (event.type() == TouchLongPress || event.type() == TouchDoubleTap)
return 0;
- return (te->defaultPrevented() ? preventTouch : 0)
- | (te->longPressPrevented() ? preventLongPress : 0)
- | (te->doubleTapPrevented() ? preventDoubleTap : 0);
-}
-#endif
-// If scrollbar (under mouse) is different from last, send a mouse exited. Set
-// last to scrollbar if setLast is true; else set last to 0.
-void EventHandler::updateLastScrollbarUnderMouse(Scrollbar* scrollbar, bool setLast)
-{
- if (m_lastScrollbarUnderMouse != scrollbar) {
- // Send mouse exited to the old scrollbar.
- if (m_lastScrollbarUnderMouse)
- m_lastScrollbarUnderMouse->mouseExited();
- m_lastScrollbarUnderMouse = setLast ? scrollbar : 0;
- }
+ return (defaultPrevented ? preventTouch : 0)
+ | (longPressPrevented ? preventLongPress : 0)
+ | (doubleTapPrevented ? preventDoubleTap : 0);
+#else
+ return defaultPrevented;
+#endif
}
+#endif
}
class MouseEventWithHitTestResults;
class Node;
class PlatformKeyboardEvent;
+class PlatformTouchEvent;
class PlatformWheelEvent;
class RenderLayer;
class RenderObject;
class String;
class SVGElementInstance;
class TextEvent;
+class TouchEvent;
class Widget;
-#if ENABLE(TOUCH_EVENTS) // Android
-class PlatformTouchEvent;
-class Touch;
-#endif
#if ENABLE(DRAG_SUPPORT)
extern const int LinkDragHysteresis;
enum HitTestScrollbars { ShouldHitTestScrollbars, DontHitTestScrollbars };
-#if ENABLE(TOUCH_EVENTS) // Android
+#if PLATFORM(ANDROID)
+// TODO (benm): I think with some Java refactoring we can remove this before upstreaming to webkit.org.
+#if ENABLE(TOUCH_EVENTS)
enum TouchResultMask {
preventTouch = 1 << 0,
preventLongPress = 1 << 1,
preventDoubleTap = 1 << 2,
};
#endif
+#endif
class EventHandler : public Noncopyable {
public:
bool handleMouseReleaseEvent(const PlatformMouseEvent&);
bool handleWheelEvent(PlatformWheelEvent&);
-#if ENABLE(TOUCH_EVENTS) // Android
- // See TouchResultMask for the return value options
- int handleTouchEvent(const PlatformTouchEvent&);
-#endif
-
#if ENABLE(CONTEXT_MENUS)
bool sendContextMenuEvent(const PlatformMouseEvent&);
#endif
static NSEvent *currentNSEvent();
#endif
+#if ENABLE(TOUCH_EVENTS)
+#if PLATFORM(ANDROID)
+ int handleTouchEvent(const PlatformTouchEvent&);
+#else
+ bool handleTouchEvent(const PlatformTouchEvent&);
+#endif
+#endif
+
private:
#if ENABLE(DRAG_SUPPORT)
enum DragAndDropHandleType {
int m_clickCount;
RefPtr<Node> m_clickNode;
-#if ENABLE(TOUCH_EVENTS) // Android
- RefPtr<Touch> m_touch;
-#endif
#if ENABLE(DRAG_SUPPORT)
RefPtr<Node> m_dragTarget;
bool m_sendingEventToSubview;
int m_activationEventNumber;
#endif
+#if ENABLE(TOUCH_EVENTS)
+ RefPtr<Node> m_touchEventTarget;
+ IntPoint m_firstTouchScreenPos;
+ IntPoint m_firstTouchPagePos;
+#endif
+
};
} // namespace WebCore
m_frame->ownerRenderer()->setNeedsLayoutAndPrefWidthsRecalc();
#endif
-#ifdef ANDROID_MOBILE
- int delay = m_frame->document()->minimumLayoutDelay() + m_frame->document()->extraLayoutDelay();
-#else
int delay = m_frame->document()->minimumLayoutDelay();
-#endif
if (m_layoutTimer.isActive() && m_delayedLayout && !delay)
unscheduleRelayout();
if (m_layoutTimer.isActive())
}
}
} else {
-#ifdef ANDROID_MOBILE
- int delay = m_frame->document()->minimumLayoutDelay() + m_frame->document()->extraLayoutDelay();
-#else
int delay = m_frame->document()->minimumLayoutDelay();
-#endif
m_layoutRoot = relayoutRoot;
m_delayedLayout = delay != 0;
m_layoutTimer.startOneShot(delay * 0.001);
#include "SQLValue.h"
#include <wtf/CurrentTime.h>
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#include "Coordinates.h"
+#include "GeolocationController.h"
+#include "GeolocationError.h"
+#include "GeolocationPosition.h"
+#include "Geoposition.h"
+#include "PositionError.h"
+#endif
+
namespace WebCore {
static const char permissionDeniedErrorMessage[] = "User denied Geolocation";
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+static PassRefPtr<Geoposition> createGeoposition(GeolocationPosition* position)
+{
+ RefPtr<Coordinates> coordinates = Coordinates::create(position->latitude(), position->longitude(), position->canProvideAltitude(), position->altitude(),
+ position->accuracy(), position->canProvideAltitudeAccuracy(), position->altitudeAccuracy(),
+ position->canProvideHeading(), position->heading(), position->canProvideSpeed(), position->speed());
+ return Geoposition::create(coordinates.release(), position->timestamp());
+}
+
+static PassRefPtr<PositionError> createPositionError(GeolocationError* error)
+{
+ PositionError::ErrorCode code = PositionError::POSITION_UNAVAILABLE;
+ switch (error->code()) {
+ case GeolocationError::PermissionDenied:
+ code = PositionError::PERMISSION_DENIED;
+ break;
+ case GeolocationError::PositionUnavailable:
+ code = PositionError::POSITION_UNAVAILABLE;
+ break;
+ }
+
+ return PositionError::create(code, error->message());
+}
+#endif
+
Geolocation::GeoNotifier::GeoNotifier(Geolocation* geolocation, PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options)
: m_geolocation(geolocation)
, m_successCallback(successCallback)
Geolocation::Geolocation(Frame* frame)
: EventListener(GeolocationEventListenerType)
, m_frame(frame)
+#if !ENABLE(CLIENT_BASED_GEOLOCATION)
, m_service(GeolocationService::create(this))
+#endif
, m_allowGeolocation(Unknown)
, m_shouldClearCache(false)
, m_cachedPositionManager(new CachedPositionManager)
void Geolocation::disconnectFrame()
{
- m_service->stopUpdating();
+ stopUpdating();
if (m_frame && m_frame->document())
m_frame->document()->setUsingGeolocation(false);
m_frame = 0;
delete m_cachedPositionManager;
}
+Geoposition* Geolocation::lastPosition()
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ if (!m_frame)
+ return 0;
+
+ Page* page = m_frame->page();
+ if (!page)
+ return 0;
+
+ m_lastPosition = createGeoposition(page->geolocationController()->lastPosition());
+#else
+ m_lastPosition = m_service->lastPosition();
+#endif
+
+ return m_lastPosition.get();
+}
+
void Geolocation::getCurrentPosition(PassRefPtr<PositionCallback> successCallback, PassRefPtr<PositionErrorCallback> errorCallback, PassRefPtr<PositionOptions> options)
{
RefPtr<GeoNotifier> notifier = startRequest(successCallback, errorCallback, options);
m_watchers.remove(notifier);
if (!hasListeners())
- m_service->stopUpdating();
+ stopUpdating();
}
void Geolocation::requestTimedOut(GeoNotifier* notifier)
m_oneShots.remove(notifier);
if (!hasListeners())
- m_service->stopUpdating();
+ stopUpdating();
}
void Geolocation::requestReturnedCachedPosition(GeoNotifier* notifier)
// If this is a one-shot request, stop it.
m_oneShots.remove(notifier);
if (!hasListeners())
- m_service->stopUpdating();
+ stopUpdating();
// Otherwise, if the watch still exists, start the service to get updates.
if (m_watchers.contains(notifier)) {
- if (notifier->hasZeroTimeout() || m_service->startUpdating(notifier->m_options.get()))
+ if (notifier->hasZeroTimeout() || startUpdating(notifier->m_options.get()))
notifier->startTimerIfNeeded();
else
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, "Failed to start Geolocation service"));
m_watchers.remove(watchId);
if (!hasListeners())
- m_service->stopUpdating();
+ stopUpdating();
}
void Geolocation::suspend()
RefPtr<GeoNotifier> notifier = *it;
ASSERT(notifier->m_successCallback);
- notifier->m_timer.stop();
notifier->m_successCallback->handleEvent(position);
}
}
sendError(watchersCopy, error);
if (!hasListeners())
- m_service->stopUpdating();
+ stopUpdating();
}
void Geolocation::requestPermission()
page->chrome()->requestGeolocationPermissionForFrame(m_frame, this);
}
-void Geolocation::geolocationServicePositionChanged(GeolocationService* service)
+void Geolocation::positionChanged(PassRefPtr<Geoposition> newPosition)
{
- ASSERT_UNUSED(service, service == m_service);
- ASSERT(m_service->lastPosition());
+ m_currentPosition = newPosition;
- m_cachedPositionManager->setCachedPosition(m_service->lastPosition());
+ m_cachedPositionManager->setCachedPosition(m_currentPosition.get());
// Stop all currently running timers.
stopTimers();
void Geolocation::makeSuccessCallbacks()
{
- ASSERT(m_service->lastPosition());
+ ASSERT(m_currentPosition);
ASSERT(isAllowed());
Vector<RefPtr<GeoNotifier> > oneShotsCopy;
// further callbacks to these notifiers.
m_oneShots.clear();
- sendPosition(oneShotsCopy, m_service->lastPosition());
- sendPosition(watchersCopy, m_service->lastPosition());
+ sendPosition(oneShotsCopy, m_currentPosition.get());
+ sendPosition(watchersCopy, m_currentPosition.get());
if (!hasListeners())
- m_service->stopUpdating();
+ stopUpdating();
+}
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+void Geolocation::setPosition(GeolocationPosition* position)
+{
+ positionChanged(createGeoposition(position));
+}
+
+void Geolocation::setError(GeolocationError* error)
+{
+ RefPtr<PositionError> positionError = createPositionError(error);
+ handleError(positionError.get());
+}
+
+#else
+
+void Geolocation::geolocationServicePositionChanged(GeolocationService* service)
+{
+ ASSERT_UNUSED(service, service == m_service);
+ ASSERT(m_service->lastPosition());
+
+ positionChanged(m_service->lastPosition());
}
void Geolocation::geolocationServiceErrorOccurred(GeolocationService* service)
{
ASSERT(service->lastError());
-
+
// Note that we do not stop timers here. For one-shots, the request is
// cleared in handleError. For watchers, the spec requires that the timer is
// not cleared.
handleError(service->lastError());
}
+#endif
+
+bool Geolocation::startUpdating(PositionOptions* options)
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ // FIXME: Pass options to client.
+ UNUSED_PARAM(options);
+
+ if (!m_frame)
+ return false;
+
+ Page* page = m_frame->page();
+ if (!page)
+ return false;
+
+ page->geolocationController()->addObserver(this);
+ return true;
+#else
+ return m_service->startUpdating(options);
+#endif
+}
+
+void Geolocation::stopUpdating()
+{
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ if (!m_frame)
+ return;
+
+ Page* page = m_frame->page();
+ if (!page)
+ return;
+
+ page->geolocationController()->removeObserver(this);
+#else
+ m_service->stopUpdating();
+#endif
+
+}
+
bool Geolocation::operator==(const EventListener& listener)
{
if (listener.type() != GeolocationEventListenerType)
class Frame;
class CachedPositionManager;
-
-class Geolocation : public GeolocationServiceClient, public EventListener {
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+class GeolocationPosition;
+class GeolocationError;
+#endif
+
+class Geolocation : public EventListener
+#if !ENABLE(CLIENT_BASED_GEOLOCATION)
+ , public GeolocationServiceClient
+#endif
+{
public:
static PassRefPtr<Geolocation> create(Frame* frame) { return adoptRef(new Geolocation(frame)); }
void disconnectFrame();
- Geoposition* lastPosition() const { return m_service->lastPosition(); }
+ Geoposition* lastPosition();
void getCurrentPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
int watchPosition(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
void setShouldClearCache(bool shouldClearCache) { m_shouldClearCache = shouldClearCache; }
bool shouldClearCache() const { return m_shouldClearCache; }
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ void setPostion(GeolocationPosition*);
+ void setError(GeolocationError*);
+#endif
+
static void setDatabasePath(String);
private:
void stopTimersForWatchers();
void stopTimers();
+ void positionChanged(PassRefPtr<Geoposition>);
void makeSuccessCallbacks();
void handleError(PositionError*);
void requestPermission();
+ bool startUpdating(PositionOptions*);
+ void stopUpdating();
+
+#if !ENABLE(CLIENT_BASED_GEOLOCATION)
// GeolocationServiceClient
virtual void geolocationServicePositionChanged(GeolocationService*);
virtual void geolocationServiceErrorOccurred(GeolocationService*);
+#endif
PassRefPtr<GeoNotifier> startRequest(PassRefPtr<PositionCallback>, PassRefPtr<PositionErrorCallback>, PassRefPtr<PositionOptions>);
GeoNotifierSet m_oneShots;
Watchers m_watchers;
Frame* m_frame;
+#if !ENABLE(CLIENT_BASED_GEOLOCATION)
OwnPtr<GeolocationService> m_service;
+#endif
+ RefPtr<Geoposition> m_lastPosition;
+ RefPtr<Geoposition> m_currentPosition;
enum {
Unknown,
--- /dev/null
+/*
+ * Copyright (C) 2009 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 "GeolocationController.h"
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#include "GeolocationControllerClient.h"
+
+namespace WebCore {
+
+GeolocationController::GeolocationController(Page* page, GeolocationControllerClient* client)
+ : m_page(page)
+ , m_client(client)
+{
+}
+
+GeolocationController::~GeolocationController()
+{
+}
+
+void GeolocationController::addObserver(Geolocation* observer)
+{
+ ASSERT(!m_observers.contains(observer));
+
+ bool wasEmpty = m_observers.isEmpty();
+ m_observers.add(observer);
+ if (wasEmpty)
+ m_client->startUpdating();
+}
+
+void GeolocationController::removeObserver(Geolocation* observer)
+{
+ ASSERT(m_observers.contains(observer));
+
+ m_observers.remove(observer);
+ if (m_observers.isEmpty())
+ m_client->stopUpdating();
+}
+
+void GeolocationController::positionChanged(GeolocationPosition* position)
+{
+ HashSet<RefPtr<Geolocation> >::const_iterator end = m_observers.end();
+ for (HashSet<RefPtr<Geolocation> >::const_iterator it = m_observers.begin(); it != end; ++it)
+ (*it)->setPosition(position);
+}
+
+void GeolocationController::errorOccurred(GeolocationError* error)
+{
+ HashSet<RefPtr<Geolocation> >::const_iterator end = m_observers.end();
+ for (HashSet<RefPtr<Geolocation> >::const_iterator it = m_observers.begin(); it != end; ++it)
+ (*it)->setError(error);
+}
+
+GeolocationPosition* GeolocationController::lastPosition()
+{
+ return m_client->lastPosition();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(CLIENT_BASED_GEOLOCATION)
--- /dev/null
+/*
+ * Copyright (C) 2009 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 GeolocationController_h
+#define GeolocationController_h
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#include "Geolocation.h"
+#include <wtf/HashSet.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GeolocationControllerClient;
+class GeolocationError;
+class GeolocationPosition;
+class Page;
+
+class GeolocationController : public Noncopyable {
+public:
+ GeolocationController(Page*, GeolocationControllerClient*);
+ ~GeolocationController();
+
+ void addObserver(Geolocation*);
+ void removeObserver(Geolocation*);
+
+ void positionChanged(GeolocationPosition*);
+ void errorOccurred(GeolocationError*);
+
+ GeolocationPosition* lastPosition();
+
+private:
+ Page* m_page;
+ GeolocationControllerClient* m_client;
+
+ HashSet<RefPtr<Geolocation> > m_observers;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#endif // GeolocationController_h
--- /dev/null
+/*
+ * Copyright (C) 2009 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 GeolocationControllerClient_h
+#define GeolocationControllerClient_h
+
+namespace WebCore {
+
+class GeolocationPosition;
+
+class GeolocationControllerClient {
+public:
+ virtual void startUpdating() = 0;
+ virtual void stopUpdating() = 0;
+ virtual GeolocationPosition* lastPosition() = 0;
+
+protected:
+ virtual ~GeolocationControllerClient() { }
+};
+
+} // namespace WebCore
+
+#endif // GeolocationControllerClient_h
--- /dev/null
+/*
+ * Copyright (C) 2009 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 GeolocationError_h
+#define GeolocationError_h
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GeolocationError : public RefCounted<GeolocationError> {
+public:
+ enum ErrorCode {
+ PermissionDenied,
+ PositionUnavailable
+ };
+
+ static PassRefPtr<GeolocationError> create(ErrorCode code, const String& message) { return adoptRef(new GeolocationError(code, message)); }
+
+ ErrorCode code() const { return m_code; }
+ const String& message() const { return m_message; }
+
+private:
+ GeolocationError(ErrorCode code, const String& message);
+
+ ErrorCode m_code;
+ String m_message;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#endif // GeolocationError_h
--- /dev/null
+/*
+ * Copyright (C) 2009 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. 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 INC. 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 GeolocationPosition_h
+#define GeolocationPosition_h
+
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class GeolocationPosition : public RefCounted<GeolocationPosition> {
+public:
+ static PassRefPtr<GeolocationPosition> create(double timestamp, double latitude, double longitude, double accuracy) { return adoptRef(new GeolocationPosition(timestamp, latitude, longitude, accuracy)); }
+
+ static PassRefPtr<GeolocationPosition> create(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) { return adoptRef(new GeolocationPosition(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed)); }
+
+ double timestamp() const { return m_timestamp; }
+
+ double latitude() const { return m_latitude; }
+ double longitude() const { return m_longitude; }
+ double accuracy() const { return m_accuracy; }
+ double altitude() const { return m_altitude; }
+ double altitudeAccuracy() const { return m_altitudeAccuracy; }
+ double heading() const { return m_heading; }
+ double speed() const { return m_speed; }
+
+ bool canProvideAltitude() const { return m_canProvideAltitude; }
+ bool canProvideAltitudeAccuracy() const { return m_canProvideAltitudeAccuracy; }
+ bool canProvideHeading() const { return m_canProvideHeading; }
+ bool canProvideSpeed() const { return m_canProvideSpeed; }
+
+private:
+ GeolocationPosition(double timestamp, double latitude, double longitude, double accuracy)
+ : m_timestamp(timestamp)
+ , m_latitude(latitude)
+ , m_longitude(longitude)
+ , m_accuracy(accuracy)
+ , m_altitude(0)
+ , m_altitudeAccuracy(0)
+ , m_heading(0)
+ , m_speed(0)
+ , m_canProvideAltitude(false)
+ , m_canProvideAltitudeAccuracy(false)
+ , m_canProvideHeading(false)
+ , m_canProvideSpeed(false)
+ {
+ }
+
+ GeolocationPosition(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed)
+ : m_timestamp(timestamp)
+ , m_latitude(latitude)
+ , m_longitude(longitude)
+ , m_accuracy(accuracy)
+ , m_altitude(altitude)
+ , m_altitudeAccuracy(altitudeAccuracy)
+ , m_heading(heading)
+ , m_speed(speed)
+ , m_canProvideAltitude(providesAltitude)
+ , m_canProvideAltitudeAccuracy(providesAltitudeAccuracy)
+ , m_canProvideHeading(providesHeading)
+ , m_canProvideSpeed(providesSpeed)
+ {
+ }
+
+ double m_timestamp;
+
+ double m_latitude;
+ double m_longitude;
+ double m_accuracy;
+ double m_altitude;
+ double m_altitudeAccuracy;
+ double m_heading;
+ double m_speed;
+
+ bool m_canProvideAltitude;
+ bool m_canProvideAltitudeAccuracy;
+ bool m_canProvideHeading;
+ bool m_canProvideSpeed;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(CLIENT_BASED_GEOLOCATION)
+
+#endif // GeolocationPosition_h
class Geoposition : public RefCounted<Geoposition> {
public:
- static PassRefPtr<Geoposition> create(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp) { return adoptRef(new Geoposition(coordinates, timestamp)); }
-
+ static PassRefPtr<Geoposition> create(PassRefPtr<Coordinates> coordinates, DOMTimeStamp timestamp)
+ {
+ return adoptRef(new Geoposition(coordinates, timestamp));
+ }
+
DOMTimeStamp timestamp() const { return m_timestamp; }
Coordinates* coords() const { return m_coordinates.get(); }
#include "Navigator.h"
#include "CookieJar.h"
+#if PLATFORM(ANDROID)
+#include "Connection.h"
+#endif
#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameLoader.h"
return m_geolocation.get();
}
+#if PLATFORM(ANDROID)
+Connection* Navigator::connection() const
+{
+ if (!m_connection)
+ m_connection = Connection::create();
+ return m_connection.get();
+}
+#endif
+
#if ENABLE(DOM_STORAGE)
void Navigator::getStorageUpdates()
{
namespace WebCore {
+#if PLATFORM(ANDROID)
+ class Connection;
+#endif
class Frame;
class Geolocation;
class MimeTypeArray;
// This is used for GC marking.
Geolocation* optionalGeolocation() const { return m_geolocation.get(); }
+#if PLATFORM(ANDROID)
+ Connection* connection() const;
+#endif
+
#if ENABLE(DOM_STORAGE)
// Relinquishes the storage lock, if one exists.
void getStorageUpdates();
mutable RefPtr<PluginArray> m_plugins;
mutable RefPtr<MimeTypeArray> m_mimeTypes;
mutable RefPtr<Geolocation> m_geolocation;
+#if PLATFORM(ANDROID)
+ mutable RefPtr<Connection> m_connection;
+#endif
};
}
readonly attribute boolean onLine;
+ // ANDROID-only for now, upstreaming in progress.
+ readonly attribute Connection connection;
+
#if defined(ENABLE_GEOLOCATION) && ENABLE_GEOLOCATION
readonly attribute Geolocation geolocation;
#endif
#include "WMLPageState.h"
#endif
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+#include "GeolocationController.h"
+#endif
+
namespace WebCore {
static HashSet<Page*>* allPages;
frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false));
}
-Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient, PluginHalterClient* pluginHalterClient)
+Page::Page(ChromeClient* chromeClient, ContextMenuClient* contextMenuClient, EditorClient* editorClient, DragClient* dragClient, InspectorClient* inspectorClient, PluginHalterClient* pluginHalterClient, GeolocationControllerClient* geolocationControllerClient)
: m_chrome(new Chrome(this, chromeClient))
, m_dragCaretController(new SelectionController(0, true))
#if ENABLE(DRAG_SUPPORT)
#if ENABLE(INSPECTOR)
, m_inspectorController(new InspectorController(this, inspectorClient))
#endif
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ , m_geolocationController(new GeolocationController(this, geolocationControllerClient))
+#endif
, m_settings(new Settings(this))
, m_progress(new ProgressTracker)
, m_backForwardList(BackForwardList::create(this))
#if !ENABLE(INSPECTOR)
UNUSED_PARAM(inspectorClient);
#endif
+#if !ENABLE(CLIENT_BASED_GEOLOCATION)
+ UNUSED_PARAM(geolocationControllerClient);
+#endif
+
if (!allPages) {
allPages = new HashSet<Page*>;
class EditorClient;
class FocusController;
class Frame;
+ class GeolocationController;
+ class GeolocationControllerClient;
class HaltablePlugin;
class InspectorClient;
class InspectorController;
public:
static void setNeedsReapplyStyles();
- Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*, PluginHalterClient*);
+ Page(ChromeClient*, ContextMenuClient*, EditorClient*, DragClient*, InspectorClient*, PluginHalterClient*, GeolocationControllerClient*);
~Page();
RenderTheme* theme() const { return m_theme.get(); };
#if ENABLE(INSPECTOR)
InspectorController* inspectorController() const { return m_inspectorController.get(); }
#endif
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ GeolocationController* geolocationController() const { return m_geolocationController.get(); }
+#endif
Settings* settings() const { return m_settings.get(); }
ProgressTracker* progress() const { return m_progress.get(); }
#if ENABLE(INSPECTOR)
OwnPtr<InspectorController> m_inspectorController;
#endif
+#if ENABLE(CLIENT_BASED_GEOLOCATION)
+ OwnPtr<GeolocationController> m_geolocationController;
+#endif
OwnPtr<Settings> m_settings;
OwnPtr<ProgressTracker> m_progress;
/*
- * Copyright 2008, 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 APPLE COMPUTER, INC. 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.
- */
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
#ifndef PlatformTouchEvent_h
#define PlatformTouchEvent_h
-#if ENABLE(TOUCH_EVENTS) // Android
+#include "PlatformTouchPoint.h"
+#include <wtf/Vector.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#if PLATFORM(QT)
+QT_BEGIN_NAMESPACE
+class QTouchEvent;
+QT_END_NAMESPACE
+#endif
+#if PLATFORM(ANDROID)
#include "IntPoint.h"
+#endif
namespace WebCore {
- enum TouchEventType {TouchEventStart, TouchEventMove, TouchEventEnd, TouchEventCancel, TouchEventLongPress, TouchEventDoubleTap};
-
- class PlatformTouchEvent {
- public:
- PlatformTouchEvent()
- : m_eventType(TouchEventCancel)
- {
- }
-
- PlatformTouchEvent(const IntPoint& pos, const IntPoint& globalPos, TouchEventType eventType)
- : m_position(pos)
- , m_globalPosition(globalPos)
- , m_eventType(eventType)
- {
- }
-
- const IntPoint& pos() const { return m_position; }
- int x() const { return m_position.x(); }
- int y() const { return m_position.y(); }
- int globalX() const { return m_globalPosition.x(); }
- int globalY() const { return m_globalPosition.y(); }
- TouchEventType eventType() const { return m_eventType; }
-
- private:
- IntPoint m_position;
- IntPoint m_globalPosition;
- TouchEventType m_eventType;
- };
-
-} // namespace WebCore
+enum TouchEventType {
+ TouchStart
+ , TouchMove
+ , TouchEnd
+ , TouchCancel
+#if PLATFORM(ANDROID)
+ , TouchLongPress
+ , TouchDoubleTap
+#endif
+};
+
+class PlatformTouchEvent {
+public:
+ PlatformTouchEvent()
+ : m_type(TouchStart)
+ , m_ctrlKey(false)
+ , m_altKey(false)
+ , m_shiftKey(false)
+ , m_metaKey(false)
+ {}
+#if PLATFORM(QT)
+ PlatformTouchEvent(QTouchEvent*);
+#elif PLATFORM(ANDROID)
+ PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType, PlatformTouchPoint::State);
+#endif
+
+ TouchEventType type() const { return m_type; }
+ const Vector<PlatformTouchPoint>& touchPoints() const { return m_touchPoints; }
+
+ bool ctrlKey() const { return m_ctrlKey; }
+ bool altKey() const { return m_altKey; }
+ bool shiftKey() const { return m_shiftKey; }
+ bool metaKey() const { return m_metaKey; }
+
+private:
+ TouchEventType m_type;
+ Vector<PlatformTouchPoint> m_touchPoints;
+ bool m_ctrlKey;
+ bool m_altKey;
+ bool m_shiftKey;
+ bool m_metaKey;
+};
+
+}
#endif // ENABLE(TOUCH_EVENTS)
--- /dev/null
+/*
+ Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+*/
+
+#ifndef PlatformTouchPoint_h
+#define PlatformTouchPoint_h
+
+#include "IntPoint.h"
+#include <wtf/Platform.h>
+#include <wtf/Vector.h>
+
+#if ENABLE(TOUCH_EVENTS)
+
+#if PLATFORM(QT)
+#include <QTouchEvent>
+#endif
+
+namespace WebCore {
+
+class PlatformTouchEvent;
+
+class PlatformTouchPoint {
+public:
+ enum State {
+ TouchReleased,
+ TouchPressed,
+ TouchMoved,
+ TouchStationary,
+ TouchCancelled
+ };
+
+#if PLATFORM(QT)
+ PlatformTouchPoint(const QTouchEvent::TouchPoint&);
+#elif PLATFORM(ANDROID)
+ PlatformTouchPoint(const IntPoint& absolutePagePos, State);
+#endif
+
+ int id() const { return m_id; }
+ State state() const { return m_state; }
+ IntPoint screenPos() const { return m_screenPos; }
+ IntPoint pos() const { return m_pos; }
+
+private:
+ int m_id;
+ State m_state;
+ IntPoint m_screenPos;
+ IntPoint m_pos;
+};
+
+}
+
+#endif // ENABLE(TOUCH_EVENTS)
+
+#endif // PlatformTouchPoint_h
#include <wtf/HashSet.h>
#include <wtf/Vector.h>
-#if PLATFORM(ANDROID)
-#include "stl_iterator_base.h"
-#include "heap.h"
-#endif
-
using namespace std;
namespace WebCore {
#include "GeolocationServiceBridge.h"
#include "Geoposition.h"
+#include "PlatformBridge.h"
#include "PositionError.h"
#include "PositionOptions.h"
if (options->enableHighAccuracy())
m_javaBridge->setEnableGps(true);
- if (!haveJavaBridge)
- m_javaBridge->start();
+ // We need only start the service when it's first created.
+ if (!haveJavaBridge) {
+ // If the browser is paused, don't start the service. It will be started
+ // when we get the call to resume.
+ if (!PlatformBridge::isWebViewPaused())
+ m_javaBridge->start();
+ }
return true;
}
#include "PositionError.h"
#include "WebViewCore.h"
#include <JNIHelp.h>
-#include <jni_utility.h>
namespace WebCore {
#ifndef GeolocationServiceBridge_h
#define GeolocationServiceBridge_h
-#include <jni_utility.h>
+#include "JNIUtility.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
// KeyGenerator
static WTF::Vector<String> getSupportedKeyStrengthList();
static String getSignedPublicKeyAndChallengeString(unsigned index, const String& challenge, const KURL&);
+ // Cookies
+ static void setCookies(const KURL&, const String& value);
+ static String cookies(const KURL&);
+ static bool cookiesEnabled();
// These ids need to be in sync with the constants in BrowserFrame.java
enum rawResId {
NoDomain = 1,
static void immediateRepaint(const FrameView* view);
#endif // USE(ACCELERATED_COMPOSITING)
+ // Whether the WebView is paused.
+ static bool isWebViewPaused();
};
+
}
#endif // PlatformBridge_h
--- /dev/null
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "PlatformTouchEvent.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+namespace WebCore {
+
+PlatformTouchEvent::PlatformTouchEvent(const IntPoint& absolutePagePos, TouchEventType type, PlatformTouchPoint::State state)
+ : m_type(type)
+ , m_ctrlKey(false)
+ , m_altKey(false)
+ , m_shiftKey(false)
+ , m_metaKey(false)
+{
+ m_touchPoints.append(PlatformTouchPoint(absolutePagePos, state));
+}
+
+}
+
+#endif
--- /dev/null
+/*
+ * 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.
+ */
+
+#include "config.h"
+#include "PlatformTouchPoint.h"
+
+#if ENABLE(TOUCH_EVENTS)
+
+namespace WebCore {
+
+PlatformTouchPoint::PlatformTouchPoint(const IntPoint& absolutePagePos, State state)
+ : m_id(0)
+ , m_state(state)
+ , m_screenPos(absolutePagePos)
+ , m_pos(absolutePagePos) { }
+
+}
+
+#endif
#if USE(JSC)
#include "API/JSClassRef.h"
+#include "JNIUtilityPrivate.h"
#include "JavaScriptCallFrame.h"
#include "JavaScriptDebugServer.h"
#include "JavaScriptProfile.h"
-#include "jni_utility_private.h"
#endif
using namespace WebCore;
virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE);
#endif
-#if PLATFORM(SGL)
+#if PLATFORM(ANDROID)
virtual void setURL(const String& str);
#endif
operator BPoint() const;
#endif
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
operator SkPoint() const;
FloatPoint(const SkPoint&);
#endif
class BRect;
#endif
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
struct SkRect;
#endif
operator BRect() const;
#endif
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
FloatRect(const SkRect&);
operator SkRect() const;
#endif
setPlatformGradientSpaceTransform(gradientSpaceTransformation);
}
-#if !PLATFORM(SKIA)
+#if !(PLATFORM(SKIA) && !PLATFORM(ANDROID))
void Gradient::setPlatformGradientSpaceTransform(const TransformationMatrix&)
{
}
#elif PLATFORM(CAIRO)
typedef struct _cairo_pattern cairo_pattern_t;
typedef cairo_pattern_t* PlatformGradient;
-#elif PLATFORM(ANDROID) && PLATFORM(SGL)
+#elif PLATFORM(SKIA)
+#if PLATFORM(ANDROID)
#include "SkShader.h"
typedef class PlatformGradientRec* PlatformGradient;
-#elif PLATFORM(SKIA)
+#else
class SkShader;
typedef class SkShader* PlatformGradient;
typedef class SkShader* PlatformPattern;
+#endif
#else
typedef void* PlatformGradient;
#endif
struct ColorStop;
const Vector<ColorStop>& getStops() const;
#else
-
-#if PLATFORM(ANDROID) && PLATFORM(SGL)
+#if PLATFORM(ANDROID)
SkShader* getShader(SkShader::TileMode);
#endif
PlatformGradient platformGradient();
#endif
-
struct ColorStop {
float stop;
float red;
generator.fill(this, rect);
}
-#if !PLATFORM(SKIA)
+#if !(PLATFORM(SKIA) && !PLATFORM(ANDROID))
void GraphicsContext::setPlatformFillGradient(Gradient*)
{
}
}
#endif
-#if !PLATFORM(CG) && !PLATFORM(SKIA)
+#if !PLATFORM(CG) && !(PLATFORM(SKIA) && !PLATFORM(ANDROID))
// Implement this if you want to go ahead and push the drawing mode into your native context
// immediately.
void GraphicsContext::setPlatformTextDrawingMode(int mode)
}
#endif
-#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !PLATFORM(SKIA) && !PLATFORM(HAIKU)
+#if !PLATFORM(QT) && !PLATFORM(CAIRO) && !(PLATFORM(SKIA) && !PLATFORM(ANDROID)) && !PLATFORM(HAIKU)
void GraphicsContext::setPlatformStrokeStyle(const StrokeStyle&)
{
}
class QPainter;
QT_END_NAMESPACE
typedef QPainter PlatformGraphicsContext;
-#elif PLATFORM(SGL)
-namespace WebCore {
-class PlatformGraphicsContext;
-}
-class SkPaint;
-struct SkPoint;
#elif PLATFORM(WX)
class wxGCDC;
class wxWindowDC;
typedef wxWindowDC PlatformGraphicsContext;
#endif
#elif PLATFORM(SKIA)
+#if PLATFORM(ANDROID)
+namespace WebCore {
+class PlatformGraphicsContext;
+}
+class SkPaint;
+struct SkPoint;
+#else
typedef class PlatformContextSkia PlatformGraphicsContext;
+#endif
#elif PLATFORM(HAIKU)
class BView;
typedef BView PlatformGraphicsContext;
void applyFillPattern();
#endif
-#if PLATFORM(SGL)
+#if PLATFORM(ANDROID)
// initialize a paint for bitmaps
void setupBitmapPaint(SkPaint*);
// initialize a paint for filling
bool willFill() const;
// returns true if there is a valid (non-transparent) stroke color
bool willStroke() const;
-
+
// may return NULL, since we lazily allocate the path. This is the path
// that is drawn by drawPath()
const SkPath* getCurrPath() const;
virtual bool getHBITMAPOfSize(HBITMAP, LPSIZE) { return false; }
#endif
-#if PLATFORM(SGL)
+#if PLATFORM(ANDROID)
virtual void setURL(const String& str) {}
#endif
#elif PLATFORM(CAIRO)
struct _cairo_surface;
typedef struct _cairo_surface cairo_surface_t;
-#elif PLATFORM(ANDROID) && PLATFORM(SGL)
+#elif PLATFORM(SKIA)
+#if PLATFORM(ANDROID)
#include "SkString.h"
class SkBitmapRef;
class PrivateAndroidImageSourceRec;
-#elif PLATFORM(SKIA)
+#else
class NativeImageSkia;
+#endif
#elif PLATFORM(HAIKU)
class BBitmap;
#elif PLATFORM(WINCE)
class ImageDecoderQt;
typedef ImageDecoderQt* NativeImageSourcePtr;
typedef QPixmap* NativeImagePtr;
-#elif PLATFORM(ANDROID)
-#if PLATFORM(SGL)
+#elif PLATFORM(SKIA)
+#if PLATFORM(ANDROID)
class String;
#ifdef ANDROID_ANIMATED_GIF
class ImageDecoder;
#endif
struct NativeImageSourcePtr {
- SkString m_url;
+ SkString m_url;
PrivateAndroidImageSourceRec* m_image;
#ifdef ANDROID_ANIMATED_GIF
ImageDecoder* m_gifDecoder;
};
typedef const Vector<char>* NativeBytePtr;
typedef SkBitmapRef* NativeImagePtr;
-#elif PLATFORM(SKIA) // ANDROID
+#else
class ImageDecoder;
typedef ImageDecoder* NativeImageSourcePtr;
typedef NativeImageSkia* NativeImagePtr;
#endif
#elif PLATFORM(CAIRO)
typedef cairo_surface_t* NativeImagePtr;
-#elif PLATFORM(SKIA)
-typedef NativeImageSkia* NativeImagePtr;
#elif PLATFORM(HAIKU)
typedef BBitmap* NativeImagePtr;
#elif PLATFORM(WINCE)
bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded.
#if PLATFORM(ANDROID)
-#if PLATFORM(SGL)
void clearURL();
void setURL(const String& url);
#endif
-#endif
private:
#if PLATFORM(ANDROID)
// FIXME: This is protected only to allow ImageSourceSkia to set ICO decoder
class wxPoint;
#endif
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
struct SkPoint;
struct SkIPoint;
#endif
operator wxPoint() const;
#endif
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
IntPoint(const SkIPoint&);
operator SkIPoint() const;
operator SkPoint() const;
class wxRect;
#endif
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
struct SkRect;
struct SkIRect;
#endif
operator CGRect() const;
#endif
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
IntRect(const SkIRect&);
operator SkRect() const;
operator SkIRect() const;
class QPainterPath;
QT_END_NAMESPACE
typedef QPainterPath PlatformPath;
-#elif PLATFORM(SGL)
-class SkPath;
-typedef SkPath PlatformPath;
#elif PLATFORM(WX) && USE(WXGC)
class wxGraphicsPath;
typedef wxGraphicsPath PlatformPath;
#elif PLATFORM(CAIRO)
#include <cairo.h>
typedef cairo_pattern_t* PlatformPatternPtr;
-#elif PLATFORM(SKIA) || PLATFORM(SGL)
+#elif PLATFORM(SKIA)
class SkShader;
typedef SkShader* PlatformPatternPtr;
#elif PLATFORM(QT)
MLOG("(%x) setFinalOpacity: %.2f=>%.2f (%.2f)", this,
opacity, clampedOpacity, m_opacity);
GraphicsLayer::setOpacity(clampedOpacity);
+ m_contentLayer->setOpacity(clampedOpacity);
askForSync();
}
void onPrepared(int duration, int width, int height);
void onEnded();
void onPosterFetched(SkBitmap*);
+ void onTimeupdate(int position);
private:
// Android-specific methods and fields.
static MediaPlayerPrivateInterface* create(MediaPlayer* player);
float m_currentTime;
bool m_paused;
+ bool m_hasVideo;
MediaPlayer::ReadyState m_readyState;
MediaPlayer::NetworkState m_networkState;
#include "config.h"
-#if PLATFORM(SKIA)
+#if !PLATFORM(ANDROID)
#include "skia/ext/image_operations.h"
#endif
SkBitmap NativeImageSkia::resizedBitmap(int w, int h) const
{
-#if PLATFORM(SKIA)
+#if !PLATFORM(ANDROID)
if (m_resizedImage.width() != w || m_resizedImage.height() != h)
m_resizedImage = skia::ImageOperations::Resize(*this, skia::ImageOperations::RESIZE_LANCZOS3, w, h);
#endif
+
return m_resizedImage;
}
#include <cairo.h>
#elif PLATFORM(QT)
#include <QTransform>
-#elif PLATFORM(SKIA) || PLATFORM(SGL)
+#elif PLATFORM(SKIA)
#include <SkMatrix.h>
#elif PLATFORM(WX) && USE(WXGC)
#include <wx/graphics.h>
operator cairo_matrix_t() const;
#elif PLATFORM(QT)
operator QTransform() const;
-#elif PLATFORM(SKIA) || PLATFORM(SGL)
+#elif PLATFORM(SKIA)
operator SkMatrix() const;
#elif PLATFORM(WX) && USE(WXGC)
operator wxGraphicsMatrix() const;
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
-// TODO(benm): ANDROID: Can we define PLATFORM(SKIA) instead of PLATFORM(SGL) before upstreaming?
+#if PLATFORM(SKIA)
#include "NativeImageSkia.h"
#elif PLATFORM(QT)
#include <QImage>
DisposeOverwriteBgcolor, // Clear frame to transparent
DisposeOverwritePrevious, // Clear frame to previous framebuffer contents
};
-#if (PLATFORM(SKIA) || PLATFORM(QT) || PLATFORM(SGL))
+#if PLATFORM(SKIA) || PLATFORM(QT)
typedef uint32_t PixelData;
#else
typedef unsigned PixelData;
memcpy(getAddr(startX, destY), startAddr, rowBytes);
}
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(ANDROID)
NativeImageSkia& bitmap() { return m_bitmap; }
const NativeImageSkia& bitmap() const { return m_bitmap; }
#endif
inline PixelData* getAddr(int x, int y)
{
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
return m_bitmap.getAddr32(x, y);
#elif PLATFORM(QT)
return reinterpret_cast<QRgb*>(m_image.scanLine(y)) + x;
}
}
-#if (PLATFORM(SKIA) || PLATFORM(SGL))
+#if PLATFORM(SKIA)
NativeImageSkia m_bitmap;
#elif PLATFORM(QT)
mutable QImage m_image;
#include "config.h"
#include "ImageDecoder.h"
-
-#if PLATFORM(SGL)
+#if PLATFORM(ANDROID)
#include "SkBitmapRef.h"
#endif
NativeImagePtr RGBA32Buffer::asNewNativeImage() const
{
-#if PLATFORM(SGL)
+#if PLATFORM(ANDROID)
return new SkBitmapRef(m_bitmap);
#else
return new NativeImageSkia(m_bitmap);
#define NetworkStateNotifier_h
#include <wtf/Noncopyable.h>
+#if PLATFORM(ANDROID)
+#include "Connection.h"
+#endif
#if PLATFORM(MAC)
void setNetworkStateChangedFunction(void (*)());
bool onLine() const { return m_isOnLine; }
+#if PLATFORM(ANDROID)
+ Connection::ConnectionType type() const { return m_type; }
+#endif
private:
bool m_isOnLine;
+#if PLATFORM(ANDROID)
+ Connection::ConnectionType m_type;
+#endif
void (*m_networkStateChangedFunction)();
void updateState();
HANDLE m_waitHandle;
OVERLAPPED m_overlapped;
-#elif PLATFORM(ANDROID)
-public:
- void networkStateChange(bool online);
-
#elif PLATFORM(CHROMIUM)
NetworkStateNotifierPrivate p;
+
+#elif PLATFORM(ANDROID)
+public:
+ void networkStateChange(bool online);
+ void networkTypeChange(Connection::ConnectionType type);
#endif
};
inline NetworkStateNotifier::NetworkStateNotifier()
: m_isOnLine(true)
+#if PLATFORM(ANDROID)
+ , m_type(Connection::Unknown)
+#endif
, m_networkStateChangedFunction(0)
{
}
friend LRESULT __stdcall ResourceHandleWndProc(HWND, unsigned message, WPARAM, LPARAM);
#endif
-#if PLATFORM(QT) || USE(CURL) || USE(SOUP) || defined(ANDROID)
+#if PLATFORM(QT) || USE(CURL) || USE(SOUP) || PLATFORM(ANDROID)
ResourceHandleInternal* getInternal() { return d.get(); }
#endif
, m_needsSiteSpecificQuirks(false)
, m_currentMacChallenge(nil)
#endif
-#if PLATFORM(ANDROID)
- , m_loader(0)
-#endif
, m_failureTimer(loader, &ResourceHandle::fireFailure)
{
const KURL& url = m_request.url();
namespace WebCore {
-class ResourceHandle;
-
class AuthenticationChallenge : public AuthenticationChallengeBase {
};
--- /dev/null
+/*
+ * Copyright 2007, 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.
+ */
+
+#include "config.h"
+
+#include "CookieJar.h"
+
+#include "PlatformBridge.h"
+
+namespace WebCore {
+
+void setCookies(Document*, const KURL& url, const String& value)
+{
+ PlatformBridge::setCookies(url, value);
+}
+
+String cookies(const Document*, const KURL& url)
+{
+ return PlatformBridge::cookies(url);
+}
+
+bool cookiesEnabled(const Document*)
+{
+ return PlatformBridge::cookiesEnabled();
+}
+
+}
m_networkStateChangedFunction();
}
+void NetworkStateNotifier::networkTypeChange(Connection::ConnectionType type)
+{
+ if (m_type == type)
+ return;
+
+ m_type = type;
+
+ if (m_networkStateChangedFunction)
+ m_networkStateChangedFunction();
+}
+
}
#include "npruntime_internal.h"
#include <wtf/HashMap.h>
#include <wtf/RefCounted.h>
-#if defined(ANDROID_PLUGINS)
-#include <nativehelper/jni.h>
-#endif
#if PLATFORM(SYMBIAN)
class QPluginLoader;
Timer<PluginPackage> m_freeLibraryTimer;
PluginQuirkSet m_quirks;
-
-#if defined(ANDROID_PLUGINS)
- // Java Plugin object.
- jobject m_pluginObject;
-#endif
};
struct PluginPackageHash {
*/
#include "config.h"
-#include "PluginDatabase.h"
#include "PluginPackage.h"
#ifdef ANDROID_PLUGINS
-#include "Timer.h"
+#include "CString.h"
+#include "JNIUtility.h"
#include "PlatformString.h"
+#include "PluginDatabase.h"
+#include "PluginDebug.h"
+#include "PluginDebugAndroid.h"
#include "PluginMainThreadScheduler.h"
-#include "CString.h"
-#include "jni_utility.h"
-#include "npruntime_impl.h"
+#include "Timer.h"
#include "npfunctions.h"
+#include "npruntime_impl.h"
#include <dlfcn.h>
#include <errno.h>
-#include "PluginDebug.h"
-#include "PluginDebugAndroid.h"
-
#define LOG_TAG "WebKit"
namespace WebCore {
funcs->enumerate = _NPN_Enumerate;
}
-static jobject createPluginObject(const char *name,
- const char *path,
- const char *fileName,
- const char *description)
-{
- JNIEnv *env = JSC::Bindings::getJNIEnv();
- // Create a Java "class Plugin" object instance
- jclass pluginClass = env->FindClass("android/webkit/Plugin");
- if(!pluginClass) {
- PLUGIN_LOG("Couldn't find class android.webkit.Plugin\n");
- return 0;
- }
- // Get Plugin(String, String, String, String, Context)
- jmethodID pluginConstructor = env->GetMethodID(
- pluginClass,
- "<init>",
- "(Ljava/lang/String;"
- "Ljava/lang/String;"
- "Ljava/lang/String;"
- "Ljava/lang/String;)V");
- if(!pluginConstructor) {
- PLUGIN_LOG("Couldn't get android.webkit.Plugin constructor\n");
- return 0;
- }
- // Make Java strings of name, path, fileName, description
- jstring javaName = env->NewStringUTF(name);
- jstring javaPath = env->NewStringUTF(path);
- jstring javaFileName = env->NewStringUTF(fileName);
- jstring javaDescription = env->NewStringUTF(description);
- // Make a plugin instance
- jobject pluginObject = env->NewObject(pluginClass,
- pluginConstructor,
- javaName,
- javaPath,
- javaFileName,
- javaDescription);
- return pluginObject;
-}
-
bool PluginPackage::load()
{
PLUGIN_LOG("tid:%d isActive:%d isLoaded:%d loadCount:%d\n",
m_pluginFuncs.size = sizeof(m_pluginFuncs);
if(NP_Initialize(&m_browserFuncs,
&m_pluginFuncs,
- JSC::Bindings::getJNIEnv(),
- m_pluginObject) != NPERR_NO_ERROR) {
+ JSC::Bindings::getJNIEnv()) != NPERR_NO_ERROR) {
PLUGIN_LOG("Couldn't initialize plugin\n");
return false;
}
m_mimeToDescriptions.set(mimeType, description);
}
- // Create a new Java Plugin object, this object is an instance of
- // android.os.WebView.Plugin
- CString path = m_path.utf8();
- CString filename = m_fileName.utf8();
- jobject pluginObject = createPluginObject(name,
- path.data(),
- filename.data(),
- description);
- if(!pluginObject) {
- PLUGIN_LOG("Couldn't create Java Plugin\n");
- return false;
- }
-
- // Retain the Java Plugin object
- m_pluginObject = JSC::Bindings::getJNIEnv()->NewGlobalRef(pluginObject);
-
PLUGIN_LOG("Fetch Info Loaded plugin details ok \"%s\"\n",
m_path.utf8().data());
#include "PlatformKeyboardEvent.h"
#include "PluginMainThreadScheduler.h"
#include "PluginPackage.h"
+#include "Touch.h"
#include "TouchEvent.h"
+#include "TouchList.h"
#include "android_graphics.h"
#include "SkCanvas.h"
#include "npruntime_impl.h"
evt.data.touch.modifiers = 0; // todo
- // convert to coordinates that are relative to the plugin.
- IntPoint localPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(
- IntPoint(event->pageX(), event->pageY())));
+ // In the event of a touchend (up) event, we must ask the changedTouch for the
+ // co-ordinates as there is no touch in touches anymore.
+ TouchList* touches = (evt.data.touch.action == kUp_ANPTouchAction) ?
+ event->changedTouches() : event->touches();
+
+ // Convert to coordinates that are relative to the plugin.
+ // We only support single touch points at the moment, so we want to look at index 0 only.
+ IntPoint localPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(IntPoint(touches->item(0)->pageX(), touches->item(0)->pageY())));
evt.data.touch.x = localPos.x();
evt.data.touch.y = localPos.y();
SkANP::InitEvent(&evt, kMouse_ANPEventType);
evt.data.mouse.action = isUp ? kUp_ANPMouseAction : kDown_ANPMouseAction;
- // convert to coordinates that are relative to the plugin.
- IntPoint localPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(
- IntPoint(event->pageX(), event->pageY())));
+ // Convert to coordinates that are relative to the plugin.
+ IntPoint localPos = roundedIntPoint(m_element->renderer()->absoluteToLocal(event->absoluteLocation()));
evt.data.mouse.x = localPos.x();
evt.data.mouse.y = localPos.y();
+
if (isDown) {
// The plugin needs focus to receive keyboard events
if (Page* page = m_parentFrame->page())
typedef EXPORTED_CALLBACK(NPError, NP_InitializeFuncPtr)(NPNetscapeFuncs*, NPPluginFuncs*);
typedef EXPORTED_CALLBACK(char*, NP_GetMIMEDescriptionFuncPtr)(void);
#elif defined(ANDROID_PLUGINS)
-typedef EXPORTED_CALLBACK(NPError, NP_InitializeFuncPtr)(NPNetscapeFuncs*, NPPluginFuncs*, JNIEnv *java_environment, jobject application_context);
+typedef EXPORTED_CALLBACK(NPError, NP_InitializeFuncPtr)(NPNetscapeFuncs*, NPPluginFuncs*, JNIEnv *java_environment);
typedef EXPORTED_CALLBACK(char*, NP_GetMIMEDescriptionFuncPtr)(void);
#else
typedef EXPORTED_CALLBACK(NPError, NP_InitializeFuncPtr)(NPNetscapeFuncs*);
// and text align is auto, or justify or left in LTR, or right in RTL, we
// will wrap text around screen width so that it doesn't need to scroll
// horizontally when reading a paragraph.
+ // In case the line height is less than the font size, we skip
+ // the text wrapping since this will cause text overlapping.
const Settings* settings = document()->settings();
bool doTextWrap = settings && settings->layoutAlgorithm() == Settings::kLayoutFitColumnToScreen;
if (doTextWrap) {
// width as it may cause text to overlap.
bool positioned = isPositioned();
EFloat cssfloat = style()->floating();
+ const int lineHeight = style()->computedLineHeight();
+ const int fontSize = style()->fontSize();
doTextWrap = autowrap && !positioned &&
+ (fontSize <= lineHeight) &&
(((dir == LTR && cssfloat != FRIGHT) ||
(dir == RTL && cssfloat != FLEFT)) &&
((ta == TAAUTO) || (ta == JUSTIFY) ||
#ifdef FLATTEN_IFRAME
RenderPart::calcWidth();
RenderPart::calcHeight();
+ // Calculate the styled dimensions by subtracting the border and padding.
+ int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight();
+ int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom();
+ int styleWidth = width() - extraWidth;
+ int styleHeight = height() - extraHeight;
// Some IFrames have a width and/or height of 1 when they are meant to be
// hidden. If that is the case, do not try to expand.
- if (node()->hasTagName(iframeTag) && widget() && widget()->isFrameView()
- && width() > 1 && height() > 1) {
+ if (node()->hasTagName(iframeTag) && widget() && widget()->isFrameView() &&
+ styleWidth > 1 && styleHeight > 1) {
HTMLIFrameElement* element = static_cast<HTMLIFrameElement*>(node());
bool scrolling = element->scrollingMode() != ScrollbarAlwaysOff;
bool widthIsFixed = style()->width().isFixed();
if (scrolling || !widthIsFixed || !heightIsFixed) {
FrameView* view = static_cast<FrameView*>(widget());
RenderView* root = view ? view->frame()->contentRenderer() : NULL;
- RenderPart* owner = view->frame()->ownerRenderer();
- if (root && style()->visibility() != HIDDEN
- && (!owner || owner->style()->visibility() != HIDDEN)) {
+ if (root && style()->visibility() != HIDDEN) {
// Update the dimensions to get the correct minimum preferred
// width
updateWidgetPosition();
- int extraWidth = paddingLeft() + paddingRight() + borderLeft() + borderRight();
- int extraHeight = paddingTop() + paddingBottom() + borderTop() + borderBottom();
// Use the preferred width if it is larger and only if
// scrollbars are visible or the width style is not fixed.
if (scrolling || !widthIsFixed)
// FIXME: If this SVG ends up loading itself, we might leak the world.
// The comment said that the Cache code does not know about CachedImages
// holding Frames and won't know to break the cycle. But
- m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, 0));
+ m_page.set(new Page(m_chromeClient.get(), dummyContextMenuClient, dummyEditorClient, dummyDragClient, dummyInspectorClient, 0, 0));
m_page->settings()->setJavaScriptEnabled(false);
m_page->settings()->setPluginsEnabled(false);
#include "SVGStyledElement.h"
#include "SVGURIReference.h"
-#if PLATFORM(SKIA)
+#if PLATFORM(SKIA) && !PLATFORM(ANDROID)
#include "PlatformContextSkia.h"
#endif
context->strokePath();
}
-#if PLATFORM(SKIA)
+#if PLATFORM(SKIA) && !PLATFORM(ANDROID)
void SVGPaintServer::teardown(GraphicsContext*& context, const RenderObject*, SVGPaintTargetType, bool) const
{
// FIXME: Move this into the GraphicsContext
android/RenderSkinCombo.cpp \
android/RenderSkinRadio.cpp \
android/TimeCounter.cpp \
- android/sort.cpp \
\
android/benchmark/Intercept.cpp \
android/benchmark/MyJavaVM.cpp \
#include <utils/Log.h>
#include <wtf/CurrentTime.h>
+#include <sys/time.h>
+#include <time.h>
+
#if USE(JSC)
#include "JSDOMWindow.h"
#include <runtime/JSGlobalObject.h>
m_quotaThreadCondition.signal();
}
+#if ENABLE(TOUCH_EVENTS)
+void ChromeClientAndroid::needTouchEvents(bool needTouchEvents, bool force)
+{
+ FrameView* frameView = m_webFrame->page()->mainFrame()->view();
+ android::WebViewCore* core = android::WebViewCore::getWebViewCore(frameView);
+ if (core)
+ core->needTouchEvents(needTouchEvents, force);
+}
+#endif
+
}
virtual void populateVisitedLinks();
+#if ENABLE(TOUCH_EVENTS)
+ virtual void needTouchEvents(bool, bool);
+#endif
+
// Methods used to request and provide Geolocation permissions.
virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
// Android-specific
#ifndef COOKIE_CLIENT_H
#define COOKIE_CLIENT_H
-#include "KURL.h"
-#include "PlatformString.h"
+#include <KURL.h>
+#include <PlatformString.h>
using namespace WebCore;
*/
#include "config.h"
+#include "MediaPlayerPrivateAndroid.h"
#if ENABLE(VIDEO)
#include "GraphicsContext.h"
-#include "MediaPlayerPrivateAndroid.h"
#include "SkiaUtils.h"
#include "TimeRanges.h"
#include "WebCoreJni.h"
#include "WebViewCore.h"
-#include "jni_utility.h"
#include <GraphicsJNI.h>
#include <JNIHelp.h>
+#include <JNIUtility.h>
#include <SkBitmap.h>
using namespace android;
bool MediaPlayerPrivate::hasVideo() const
{
- return false;
+ return m_hasVideo;
}
void MediaPlayerPrivate::setVisible(bool visible)
m_duration(6000),
m_currentTime(0),
m_paused(true),
+ m_hasVideo(false),
m_readyState(MediaPlayer::HaveNothing),
m_networkState(MediaPlayer::Empty),
m_poster(0),
m_duration = duration / 1000.0f;
m_naturalSize = IntSize(width, height);
m_naturalSizeUnknown = false;
+ m_hasVideo = true;
m_player->durationChanged();
m_player->sizeChanged();
}
m_player->timeChanged();
m_paused = true;
m_currentTime = 0;
+ m_hasVideo = false;
m_networkState = MediaPlayer::Idle;
m_readyState = MediaPlayer::HaveNothing;
}
}
}
+void MediaPlayerPrivate::onTimeupdate(int position) {
+ m_currentTime = position / 1000.0f;
+ m_player->timeChanged();
+}
+
}
namespace android {
player->onPosterFetched(posterNative);
}
+static void OnTimeupdate(JNIEnv* env, jobject obj, int position, int pointer) {
+ if (pointer) {
+ WebCore::MediaPlayerPrivate* player = reinterpret_cast<WebCore::MediaPlayerPrivate*>(pointer);
+ player->onTimeupdate(position);
+ }
+}
+
/*
* JNI registration
*/
(void*) OnEnded },
{ "nativeOnPosterFetched", "(Landroid/graphics/Bitmap;I)V",
(void*) OnPosterFetched },
+ { "nativeOnTimeupdate", "(II)V",
+ (void*) OnTimeupdate },
};
int register_mediaplayer(JNIEnv* env)
*/
#include "config.h"
-#include "PlatformBridge.h"
+#include <PlatformBridge.h>
+#include "CookieClient.h"
#include "JavaSharedClient.h"
#include "KeyGeneratorClient.h"
#include "WebViewCore.h"
+#include <wtf/android/AndroidThreading.h>
+#include <wtf/MainThread.h>
using namespace android;
return client->getSignedPublicKeyAndChallengeString(index, challenge, url);
}
+void PlatformBridge::setCookies(const KURL& url, const String& value)
+{
+ CookieClient* client = JavaSharedClient::GetCookieClient();
+ if (!client)
+ return;
+
+ client->setCookies(url, value);
+}
+
+String PlatformBridge::cookies(const KURL& url)
+{
+ CookieClient* client = JavaSharedClient::GetCookieClient();
+ if (!client)
+ return String();
+
+ return client->cookies(url);
+}
+
+bool PlatformBridge::cookiesEnabled()
+{
+ CookieClient* client = JavaSharedClient::GetCookieClient();
+ if (!client)
+ return false;
+
+ return client->cookiesEnabled();
}
+
+bool PlatformBridge::isWebViewPaused()
+{
+ return WebViewCore::isPaused();
+}
+
+} // namespace WebCore
+
+
+// This is the implementation of AndroidThreading, which is declared in
+// JavaScriptCore/wtf/android/AndroidThreading.h. It is provided here, rather
+// than in its own source file, to avoid linker problems.
+//
+// By default, when building a shared library, the linker strips from static
+// libraries any compilation units which do not contain any code referenced from
+// that static library. Since
+// AndroidThreading::scheduleDispatchFunctionsOnMainThread is not referenced
+// from libwebcore.a, implementing it in its own compilation unit results in it
+// being stripped. This stripping can be avoided by using the linker option
+// --whole-archive for libwebcore.a, but this adds considerably to the size of
+// libwebcore.so.
+
+namespace WTF {
+
+// Callback in the main thread.
+static void timeoutFired(void*)
+{
+ dispatchFunctionsFromMainThread();
+}
+
+void AndroidThreading::scheduleDispatchFunctionsOnMainThread()
+{
+ JavaSharedClient::EnqueueFunctionPtr(timeoutFired, 0);
+}
+
+} // namespace WTF
#ifndef INTERCEPT_H
#define INTERCEPT_H
-#include "jni_utility.h"
#include "MyJavaVM.h"
#include "PlatformString.h"
#include "Timer.h"
#include "WebCoreFrameBridge.h"
#include "WebCoreResourceLoader.h"
+#include <JNIUtility.h>
#include <wtf/Vector.h>
namespace WebCore {
*/
#include "config.h"
-
#include "MyJavaVM.h"
-#include "jni_utility.h"
+#include <JNIUtility.h>
#include <jni.h>
static JNIEnv* s_env;
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+// BEGIN android-added
+// Add config.h to avoid compiler error in uobject.h
+// ucnv.h includes uobject.h indirectly and uobjetcs.h defines new/delete.
+// new/delete are also defined in WebCorePrefix.h which auto included in Android make.
+//
+// config.h has to be on top of the include list.
+#include "config.h"
+// END android-added
+
#include "EmojiFont.h"
#include <icu4c/common/unicode/ucnv.h>
#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"
#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 {
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);
private:
- jobject mJavaObject;
+ jweak mJavaObject;
jmethodID mSetSharedTimer;
jmethodID mStopSharedTimer;
jmethodID mSetCookies;
JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
{
- mJavaObject = adoptGlobalRef(env, obj);
+ mJavaObject = env->NewWeakGlobalRef(obj);
jclass clazz = env->GetObjectClass(obj);
mSetSharedTimer = env->GetMethodID(clazz, "setSharedTimer", "(J)V");
{
if (mJavaObject) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(mJavaObject);
+ env->DeleteWeakGlobalRef(mJavaObject);
mJavaObject = 0;
}
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mSetSharedTimer, timemillis);
}
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mStopSharedTimer);
}
JavaBridge::setCookies(WebCore::KURL const& url, WebCore::String const& value)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
const WebCore::String& urlStr = url.string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
jstring jValueStr = env->NewString(value.characters(), value.length());
+ AutoJObject obj = getRealObject(env, mJavaObject);
env->CallVoidMethod(obj.get(), mSetCookies, jUrlStr, jValueStr);
env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jValueStr);
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
const WebCore::String& urlStr = url.string();
- AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return WebCore::String();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
+
+ AutoJObject obj = getRealObject(env, mJavaObject);
jstring string = (jstring)(env->CallObjectMethod(obj.get(), mCookies, jUrlStr));
WebCore::String ret = to_string(env, string);
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return false;
jboolean ret = env->CallBooleanMethod(obj.get(), mCookiesEnabled);
return (ret != 0);
}
WTF::Vector<WebCore::String> directories;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return directories;
jobjectArray array = (jobjectArray)
env->CallObjectMethod(obj.get(), mGetPluginDirectories);
int count = env->GetArrayLength(array);
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return WebCore::String();
jstring ret = (jstring)env->CallObjectMethod(obj.get(), mGetPluginSharedDataDirectory);
WebCore::String path = to_string(env, ret);
checkException(env);
// environment is setup.
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mSignalFuncPtrQueue);
}
WTF::Vector<WebCore::String> list;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return list;
jobjectArray array = (jobjectArray) env->CallObjectMethod(obj.get(),
mGetKeyStrengthList);
int count = env->GetArrayLength(array);
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();
(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",
void JavaSharedClient::ServiceFunctionPtrQueue()
{
for (;;) {
- void (*proc)(void*);
- void* payload;
+ void (*proc)(void*) = 0;
+ void* payload = 0;
const FuncPtrRec* rec;
// we have to copy the proc/payload (if present). we do this so we
// don't call the proc inside the mutex (possible deadlock!)
gFuncPtrQMutex.acquire();
rec = (const FuncPtrRec*)gFuncPtrQ.front();
- if (NULL != rec) {
+ if (rec) {
proc = rec->fProc;
payload = rec->fPayload;
gFuncPtrQ.pop_front();
}
gFuncPtrQMutex.release();
- if (NULL == rec) {
+ if (!rec)
break;
- }
proc(payload);
}
}
#define LOG_TAG "WebCore"
#include "config.h"
-
#include "MIMETypeRegistry.h"
+
#include "PlatformString.h"
-#include "jni_utility.h"
#include "WebCoreJni.h"
+#include <JNIUtility.h>
#include <jni.h>
#include <utils/Log.h>
#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;
#define LOG_TAG "webcoreglue"
-#include <config.h>
+#include "config.h"
#include <wtf/Platform.h>
#include <wtf/CurrentTime.h>
#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"
#include <runtime_object.h>
#endif // USE(JSC)
-#include <jni_utility.h>
+#include <JNIUtility.h>
#include "jni.h"
#if USE(JSC)
struct WebFrame::JavaBrowserFrame
{
- jobject mObj;
- jobject mHistoryList; // WebBackForwardList object
+ jweak mObj;
+ jweak mHistoryList; // WebBackForwardList object
jmethodID mStartLoadingResource;
jmethodID mLoadStarted;
jmethodID mTransitionToCommitted;
{
jclass clazz = env->GetObjectClass(obj);
mJavaFrame = new JavaBrowserFrame;
- mJavaFrame->mObj = adoptGlobalRef(env, obj);
- mJavaFrame->mHistoryList = adoptGlobalRef(env, historyList);
+ mJavaFrame->mObj = env->NewWeakGlobalRef(obj);
+ mJavaFrame->mHistoryList = env->NewWeakGlobalRef(historyList);
mJavaFrame->mStartLoadingResource = env->GetMethodID(clazz, "startLoadingResource",
"(ILjava/lang/String;Ljava/lang/String;Ljava/util/HashMap;[BJIZZZ)Landroid/webkit/LoadListener;");
mJavaFrame->mLoadStarted = env->GetMethodID(clazz, "loadStarted",
{
if (mJavaFrame->mObj) {
JNIEnv* env = getJNIEnv();
- env->DeleteGlobalRef(mJavaFrame->mObj);
- env->DeleteGlobalRef(mJavaFrame->mHistoryList);
+ env->DeleteWeakGlobalRef(mJavaFrame->mObj);
+ env->DeleteWeakGlobalRef(mJavaFrame->mHistoryList);
mJavaFrame->mObj = 0;
}
delete mJavaFrame;
WebCore::HTTPHeaderMap headers = request.httpHeaderFields();
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return 0;
-
WebCore::String urlStr = request.url().string();
int colon = urlStr.find(':');
bool allLower = true;
jMethodStr = env->NewString(method.characters(), method.length());
jbyteArray jPostDataStr = NULL;
WebCore::FormData* formdata = request.httpBody();
+ AutoJObject obj = mJavaFrame->frame(env);
if (formdata) {
// We can use the formdata->flatten() but it will result in two
// memcpys, first through loading up the vector with the form data
jobject jLoadListener =
env->CallObjectMethod(obj.get(), mJavaFrame->mStartLoadingResource,
- (int)loader, jUrlStr, jMethodStr, jHeaderMap,
- jPostDataStr, formdata ? formdata->identifier(): 0,
- cacheMode, mainResource, request.getUserGesture(),
- synchronous);
+ (int)loader, jUrlStr, jMethodStr, jHeaderMap,
+ jPostDataStr, formdata ? formdata->identifier(): 0,
+ cacheMode, mainResource, request.getUserGesture(),
+ synchronous);
env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jMethodStr);
#endif
LOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data());
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring descStr = env->NewString((unsigned short*)description.characters(), description.length());
jstring failUrl = env->NewString((unsigned short*)failingUrl.characters(), failingUrl.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mReportError, errorCode, descStr, failUrl);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mReportError,
+ errorCode, descStr, failUrl);
env->DeleteLocalRef(descStr);
env->DeleteLocalRef(failUrl);
}
return;
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::String urlString(url.string());
// If this is the main frame and we already have a favicon in the database,
// send it along with the page started notification.
}
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mLoadStarted, urlStr, favicon,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadStarted, urlStr, favicon,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::FrameLoadType loadType = frame->loader()->loadType();
bool isMainFrame = (!frame->tree() || !frame->tree()->parent());
- env->CallVoidMethod(obj.get(), mJavaFrame->mTransitionToCommitted,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mTransitionToCommitted,
(int)loadType, isMainFrame);
checkException(env);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::FrameLoader* loader = frame->loader();
const WebCore::KURL& url = loader->activeDocumentLoader()->url();
if (url.isEmpty())
WebCore::FrameLoadType loadType = loader->loadType();
WebCore::String urlString(url.string());
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mLoadFinished, urlStr,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadFinished, urlStr,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
LOGV("setTitle(%s)", title.ascii().data());
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring jTitleStr = env->NewString((unsigned short *)title.characters(), title.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mSetTitle,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetTitle,
jTitleStr);
checkException(env);
env->DeleteLocalRef(jTitleStr);
#endif
LOGV("::WebCore:: windowObjectCleared");
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mWindowObjectCleared, (int)frame);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mWindowObjectCleared, (int)frame);
checkException(env);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
int progress = (int) (100 * newProgress);
- env->CallVoidMethod(obj.get(), mJavaFrame->mSetProgress, progress);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetProgress, progress);
checkException(env);
}
#endif
LOG_ASSERT(icon, "DidReceiveIcon called without an image!");
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jobject bitmap = webcoreImageToJavaBitmap(env, icon);
if (!bitmap)
return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mDidReceiveIcon, bitmap);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDidReceiveIcon, bitmap);
env->DeleteLocalRef(bitmap);
checkException(env);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring jUrlStr = env->NewString((unsigned short*)url.characters(),
url.length());
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mDidReceiveTouchIconUrl, jUrlStr, precomposed);
checkException(env);
}
#endif
WebCore::String urlStr(url.string());
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
-
jstring jUrlStr = env->NewString((unsigned short*)urlStr.characters(), urlStr.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
checkException(env);
}
if (url.isEmpty())
return true;
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return true;
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
// check to see whether browser app wants to hijack url loading.
// if browser app handles the url, we will return false to bail out WebCore loading
- jboolean ret = env->CallBooleanMethod(obj.get(), mJavaFrame->mHandleUrl, jUrlStr);
+ jboolean ret = env->CallBooleanMethod(mJavaFrame->frame(env).get(), mJavaFrame->mHandleUrl, jUrlStr);
checkException(env);
return (ret == 0);
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return NULL;
- jobject jobj = env->CallObjectMethod(obj.get(),
+ jobject obj = env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mCreateWindow, dialog, userGesture);
- if (jobj) {
- WebCore::Frame* frame = GET_NATIVE_FRAME(env, jobj);
+ if (obj) {
+ WebCore::Frame* frame = GET_NATIVE_FRAME(env, obj);
return frame;
}
return NULL;
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mRequestFocus);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestFocus);
checkException(env);
}
#endif
assert(webViewCore);
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mCloseWindow,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mCloseWindow,
webViewCore->getJavaObject().get());
}
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
PolicyFunctionWrapper* p = new PolicyFunctionWrapper;
p->func = func;
- env->CallVoidMethod(obj.get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
}
WebCore::String
WebFrame::getRawResourceFilename(WebCore::PlatformBridge::rawResId id) const
{
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return WebCore::String();
- jstring ret = (jstring) env->CallObjectMethod(obj.get(),
+ jstring ret = (jstring) env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mGetRawResFilename, (int)id);
return to_string(env, ret);
WebFrame::density() const
{
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return 1.0;
- jfloat dpi = env->CallFloatMethod(obj.get(), mJavaFrame->mDensity);
+ jfloat dpi = env->CallFloatMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDensity);
checkException(env);
return dpi;
}
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);
JNIEnv* env = getJNIEnv();
// JavaInstance creates a global ref to instance in its constructor.
env->DeleteGlobalRef(m_instance->instance());
- // Set the object to our WeakReference wrapper.
- m_instance->setInstance(adoptGlobalRef(env, instance));
+ // Set the object to a weak reference.
+ m_instance->setInstance(env->NewWeakGlobalRef(instance));
+ }
+ ~WeakJavaInstance()
+ {
+ JNIEnv* env = getJNIEnv();
+ // Store the weak reference so we can delete it later.
+ jweak weak = m_instance->instance();
+ // The JavaInstance destructor attempts to delete the global ref stored
+ // 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.
+ m_instance->setInstance(env->NewGlobalRef(
+ getRealObject(env, m_instance->instance()).get()));
+ // Delete the weak reference.
+ env->DeleteWeakGlobalRef(weak);
}
virtual void virtualBegin()
private:
typedef JavaInstance INHERITED;
jobject _realObject;
- jobject _weakRef;
+ jweak _weakRef;
};
static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePointer,
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);
}
#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>
namespace android {
-// Class, constructor, and get method on WeakReference
-jclass gWeakRefClass;
-jmethodID gWeakRefInit;
-jmethodID gWeakRefGet;
-
-jobject adoptGlobalRef(JNIEnv* env, jobject obj)
-{
- // Create a WeakReference object
- jobject ref = env->NewObject(gWeakRefClass, gWeakRefInit, obj);
- // Increment the ref count of the WeakReference
- ref = env->NewGlobalRef(ref);
- return ref;
-}
-
AutoJObject getRealObject(JNIEnv* env, jobject obj)
{
- jobject real = env->CallObjectMethod(obj, gWeakRefGet);
- if (!real)
- LOGE("The real object has been deleted");
+ jobject real = env->NewLocalRef(obj);
+ LOG_ASSERT(real, "The real object has been deleted!");
return AutoJObject(env, real);
}
return ret;
}
-int register_webcorejni(JNIEnv* env) {
- // Instantiate the WeakReference fields.
- jclass weakRef = env->FindClass("java/lang/ref/WeakReference");
- LOG_ASSERT(weakRef, "Could not find WeakReference");
- android::gWeakRefClass = (jclass)env->NewGlobalRef(weakRef);
- android::gWeakRefInit = env->GetMethodID(android::gWeakRefClass,
- "<init>", "(Ljava/lang/Object;)V");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find constructor for WeakReference");
- android::gWeakRefGet = env->GetMethodID(android::gWeakRefClass, "get",
- "()Ljava/lang/Object;");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find get method for WeakReference");
- return JNI_OK;
-}
-
}
friend AutoJObject getRealObject(JNIEnv*, jobject);
};
-// Get the real object stored in the WeakReference returned as an
+// Get the real object stored in the weak reference returned as an
// AutoJObject.
AutoJObject getRealObject(JNIEnv*, jobject);
-// Convert the given jobject to a WeakReference and create a new global
-// reference to that WeakReference.
-jobject adoptGlobalRef(JNIEnv*, jobject);
-
// Helper method for check java exceptions. Returns true if an exception
// occurred and logs the exception.
bool checkException(JNIEnv* env);
#include "InspectorClientAndroid.h"
#include "IntRect.h"
#include "JavaSharedClient.h"
-#include "jni_utility.h"
#include "Page.h"
#include "PlatformGraphicsContext.h"
#include "ResourceRequest.h"
#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>
extern int register_webicondatabase(JNIEnv*);
extern int register_websettings(JNIEnv*);
extern int register_webview(JNIEnv*);
-extern int register_webcorejni(JNIEnv*);
#if ENABLE(DATABASE)
extern int register_webstorage(JNIEnv*);
#endif
{ "JavaBridge", android::register_javabridge },
{ "WebFrame", android::register_webframe },
{ "WebCoreResourceLoader", android::register_resource_loader },
- { "WebCoreJni", android::register_webcorejni },
{ "WebViewCore", android::register_webviewcore },
{ "WebHistory", android::register_webhistory },
{ "WebIconDatabase", android::register_webicondatabase },
// 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
#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"
#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 {
#define LOG_TAG "webhistory"
-#include <config.h>
-#include <wtf/OwnPtr.h>
-#include <wtf/Platform.h>
-
+#include "config.h"
#include "WebHistory.h"
#include "BackForwardList.h"
#include "TextEncoding.h"
#include "WebCoreFrameBridge.h"
#include "WebCoreJni.h"
-#include "jni_utility.h"
+#include "WebIconDatabase.h"
#include <JNIHelp.h>
+#include "JNIUtility.h"
#include <SkUtils.h>
#include <utils/misc.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/Platform.h>
namespace android {
WebHistoryItem::WebHistoryItem(JNIEnv* env, jobject obj,
WebCore::HistoryItem* item) : WebCore::AndroidWebHistoryBridge(item) {
- m_object = adoptGlobalRef(env, obj);
+ m_object = env->NewWeakGlobalRef(obj);
m_parent = 0;
}
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
- env->DeleteGlobalRef(m_object);
+ env->DeleteWeakGlobalRef(m_object);
}
}
WebHistoryItem* parent() const { return m_parent.get(); }
private:
RefPtr<WebHistoryItem> m_parent;
- jobject m_object;
+ jweak m_object;
};
};
#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 {
// XXX: Called by the IconDatabase thread
void WebIconDatabase::dispatchDidAddIconForPageURL(const WebCore::String& pageURL)
{
- // If there are no clients currently, drop this message.
- if (mClients.size() == 0)
- return;
-
mNotificationsMutex.lock();
mNotifications.append(pageURL);
if (!mDeliveryRequested) {
// Called in the WebCore thread
void WebIconDatabase::RegisterForIconNotification(WebIconDatabaseClient* client)
{
- gIconDatabaseClient->mClientsMutex.lock();
+ WebIconDatabase* db = gIconDatabaseClient;
+ for (unsigned i = 0; i < db->mClients.size(); ++i) {
+ // Do not add the same client twice.
+ if (db->mClients[i] == client)
+ return;
+ }
gIconDatabaseClient->mClients.append(client);
- gIconDatabaseClient->mClientsMutex.unlock();
}
// Called in the WebCore thread
void WebIconDatabase::UnregisterForIconNotification(WebIconDatabaseClient* client)
{
WebIconDatabase* db = gIconDatabaseClient;
- db->mClientsMutex.lock();
for (unsigned i = 0; i < db->mClients.size(); ++i) {
if (db->mClients[i] == client) {
db->mClients.remove(i);
break;
}
}
- db->mClientsMutex.unlock();
}
// Called in the WebCore thread
// Swap the clients queue
Vector<WebIconDatabaseClient*> clients;
- mClientsMutex.lock();
clients.swap(mClients);
- mClientsMutex.unlock();
for (unsigned i = 0; i < queue.size(); ++i) {
for (unsigned j = 0; j < clients.size(); ++j) {
// Deliver all the icon notifications
void deliverNotifications();
- // List of clients and a mutex to protect it.
+ // List of clients.
Vector<WebIconDatabaseClient*> mClients;
- android::Mutex mClientsMutex;
// Queue of page urls that have received an icon.
Vector<WebCore::String> mNotifications;
#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)
if (manifestOrigin.get() == 0)
continue;
if (manifestOrigin->isSameSchemeHostPort(securityOrigin.get())) {
- int64_t size = 0;
- WebCore::cacheStorage().cacheGroupSize(manifestUrls[i].string(), &size);
- usage += size;
+ int64_t cacheSize = 0;
+ WebCore::cacheStorage().cacheGroupSize(manifestUrls[i].string(), &cacheSize);
+ usage += cacheSize;
}
}
return usage;
#define LOG_TAG "webcoreglue"
-#include <config.h>
+#include "config.h"
#include "WebViewCore.h"
#include "AtomicString.h"
#include "HTMLSelectElement.h"
#include "HTMLTextAreaElement.h"
#include "InlineTextBox.h"
-#include <JNIHelp.h>
#include "KeyboardCodes.h"
#include "Navigator.h"
#include "Node.h"
#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)
namespace android {
+bool WebViewCore::s_isPaused = false;
+
static SkTDArray<WebViewCore*> gInstanceList;
void WebViewCore::addInstance(WebViewCore* inst) {
// ----------------------------------------------------------------------------
struct WebViewCore::JavaGlue {
- jobject m_obj;
+ jweak m_obj;
jmethodID m_spawnScrollTo;
jmethodID m_scrollTo;
jmethodID m_scrollBy;
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!");
jclass clazz = env->GetObjectClass(javaWebViewCore);
m_javaGlue = new JavaGlue;
- m_javaGlue->m_obj = adoptGlobalRef(env, javaWebViewCore);
+ m_javaGlue->m_obj = env->NewWeakGlobalRef(javaWebViewCore);
m_javaGlue->m_spawnScrollTo = GetJMethod(env, clazz, "contentSpawnScrollTo", "(II)V");
m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(II)V");
m_javaGlue->m_scrollBy = GetJMethod(env, clazz, "contentScrollBy", "(IIZ)V");
if (m_javaGlue->m_obj) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(m_javaGlue->m_obj);
+ env->DeleteWeakGlobalRef(m_javaGlue->m_obj);
m_javaGlue->m_obj = 0;
}
delete m_javaGlue;
WebViewCore* WebViewCore::getWebViewCore(const WebCore::ScrollView* view)
{
+ if (!view)
+ return 0;
+
WebFrameView* webFrameView = static_cast<WebFrameView*>(view->platformWidget());
if (!webFrameView)
return 0;
DBG_NAV_LOG("call updateFrameCache");
updateFrameCache();
if (m_findIsUp) {
+ LOG_ASSERT(m_javaGlue->m_obj,
+ "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_sendFindAgain);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_sendFindAgain);
checkException(env);
}
}
// LOGD("WebViewCore::scrollTo(%d %d)\n", x, y);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo, x, y);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo,
+ x, y);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_sendNotifyProgressFinished);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendNotifyProgressFinished);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_sendViewInvalidate,
rect.x(), rect.y(), rect.right(), rect.bottom());
checkException(env);
if (!(dx | dy))
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_scrollBy,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_scrollBy,
dx, dy, animate);
checkException(env);
}
void WebViewCore::contentDraw()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_contentDraw);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_contentDraw);
checkException(env);
}
WebCore::FrameLoadType loadType = loader->loadType();
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_didFirstLayout,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_didFirstLayout,
loadType == WebCore::FrameLoadTypeStandard
// When redirect with locked history, we would like to reset the
// scale factor. This is important for www.yahoo.com as it is
// redirected to www.yahoo.com/?rs=1 on load.
|| loadType == WebCore::FrameLoadTypeRedirectWithLockedBackForwardList);
checkException(env);
+
DBG_NAV_LOG("call updateFrameCache");
m_check_domtree_version = false;
updateFrameCache();
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateViewport);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateViewport);
checkException(env);
}
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScale, scale);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_restoreScale, scale);
checkException(env);
}
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScreenWidthScale, scale);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_restoreScreenWidthScale, 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();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.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
}
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestKeyboard, showKeyboard,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_requestKeyboard, showKeyboard,
isTextView);
checkException(env);
}
updateCacheOnNodeChange();
}
-static int findTextBoxIndex(WebCore::Node* node, const WebCore::IntPoint& pt)
-{
- if (!node->isTextNode()) {
- DBG_NAV_LOGD("node=%p pt=(%d,%d) isText=false", node, pt.x(), pt.y());
- return -2; // error
- }
- WebCore::RenderText* renderText = (WebCore::RenderText*) node->renderer();
- if (!renderText) {
- DBG_NAV_LOGD("node=%p pt=(%d,%d) renderText=0", node, pt.x(), pt.y());
- return -3; // error
- }
- FloatPoint absPt = renderText->localToAbsolute();
- WebCore::InlineTextBox *textBox = renderText->firstTextBox();
- int globalX, globalY;
- CacheBuilder::GetGlobalOffset(node, &globalX, &globalY);
- int x = pt.x() - globalX;
- int y = pt.y() - globalY;
- do {
- int textBoxStart = textBox->start();
- int textBoxEnd = textBoxStart + textBox->len();
- if (textBoxEnd <= textBoxStart) {
- DBG_NAV_LOGD("textBoxStart=%d <= textBoxEnd=%d", textBoxStart,
- textBoxEnd);
- continue;
- }
- WebCore::IntRect bounds = textBox->selectionRect(absPt.x(), absPt.y(),
- textBoxStart, textBoxEnd);
- if (!bounds.contains(x, y)) {
- DBG_NAV_LOGD("[absPt=(%g,%g) textBoxStart=%d textBoxEnd=%d]"
- " !contains (x=%d, y=%d)",
- absPt.x(), absPt.y(), textBoxStart, textBoxEnd, x, y);
- continue;
- }
- int offset = textBox->offsetForPosition(x - absPt.x());
-#if DEBUG_NAV_UI
- int prior = offset > 0 ? textBox->positionForOffset(offset - 1) : -1;
- int current = textBox->positionForOffset(offset);
- int next = textBox->positionForOffset(offset + 1);
- DBG_NAV_LOGD("offset=%d pt.x=%d globalX=%d renderX=%g x=%d "
- "textBox->x()=%d textBox->start()=%d prior=%d current=%d next=%d",
- offset, pt.x(), globalX, absPt.x(), x,
- textBox->x(), textBox->start(), prior, current, next
- );
-#endif
- return textBox->start() + offset;
- } while ((textBox = textBox->nextTextBox()));
- return -1; // couldn't find point, may have walked off end
-}
-
-static inline bool isPunctuation(UChar c)
-{
- return WTF::Unicode::category(c) & (0
- | WTF::Unicode::Punctuation_Dash
- | WTF::Unicode::Punctuation_Open
- | WTF::Unicode::Punctuation_Close
- | WTF::Unicode::Punctuation_Connector
- | WTF::Unicode::Punctuation_Other
- | WTF::Unicode::Punctuation_InitialQuote
- | WTF::Unicode::Punctuation_FinalQuote
- );
-}
-
-static int centerX(const SkIRect& rect)
-{
- return (rect.fLeft + rect.fRight) >> 1;
-}
-
-static int centerY(const SkIRect& rect)
-{
- return (rect.fTop + rect.fBottom) >> 1;
-}
-
-static void ShowNode(Node* node)
-{
-#if DEBUG_NAV_UI
- WebCore::Node* match = node->document();
- int index = 1;
- while (match != node && (match = match->traverseNextNode()))
- index++;
- if (match != node)
- index = -1;
- const char* name = "text";
- WebCore::CString cstr;
- if (!node->isTextNode()) {
- cstr = node->localName().string().utf8();
- name = cstr.data();
- }
- node->getRect();
- const WebCore::IntRect& b = node->getRect();
- DBG_NAV_LOGD("%s %p (%d) (%d,%d,w=%d,h=%d)", name, node, index,
- b.x(), b.y(), b.width(), b.height());
-#endif
-}
-
-static WebCore::Node* ChildIsTextNode(WebCore::Node* node)
-{
- WebCore::Node* child = node;
- while (child && !child->isTextNode()) {
- ShowNode(child);
- child = child->traverseNextNode(node);
- }
- return child;
-}
-
-WebCore::String WebViewCore::getSelection(SkRegion* selRgn)
-{
- SkRegion::Iterator iter(*selRgn);
- // FIXME: switch this to use StringBuilder instead
- WebCore::String result;
- WebCore::Node* lastStartNode = 0;
- int lastStartEnd = -1;
- UChar lastChar = 0xffff;
- for (; !iter.done(); iter.next()) {
- const SkIRect& rect = iter.rect();
- DBG_NAV_LOGD("rect=(%d, %d, %d, %d)", rect.fLeft, rect.fTop,
- rect.fRight, rect.fBottom);
- int cy = centerY(rect);
- WebCore::IntPoint startPt, endPt;
- WebCore::Node* node, * endNode;
- for (int top = rect.fTop + 2; top != cy; top = cy) {
- startPt = WebCore::IntPoint(rect.fLeft + 1, top);
- WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()->
- hitTestResultAtPoint(startPt, false);
- node = ChildIsTextNode(hitTestResult.innerNode());
- if (node)
- break;
- DBG_NAV_LOGD("node=%p (%s)", node, top != cy ? "top+1" : "cy");
- }
- if (!node) {
- DBG_NAV_LOG("!node");
- return result;
- }
- for (int bottom = rect.fBottom - 1; bottom != cy; bottom = cy) {
- for (int right = rect.fRight - 1; right != rect.fRight-2; --right) {
- endPt = WebCore::IntPoint(right, bottom);
- WebCore::HitTestResult hitTestResult = m_mainFrame->
- eventHandler()->hitTestResultAtPoint(endPt, false);
- endNode = ChildIsTextNode(hitTestResult.innerNode());
- if (endNode)
- break;
- DBG_NAV_LOGD("!endNode=%p (%s) (right-%d)", node,
- bottom != cy ? "bottom-1" : "cy", rect.fRight - right);
- }
- }
- if (!endNode) {
- DBG_NAV_LOG("!endNode");
- return result;
- }
- int start = findTextBoxIndex(node, startPt);
- if (start < 0)
- continue;
- int end = findTextBoxIndex(endNode, endPt);
- if (end < -1) // use node if endNode is not valid
- endNode = node;
- if (end <= 0)
- end = static_cast<WebCore::Text*>(endNode)->dataImpl()->length();
- DBG_NAV_LOGD("node=%p start=%d endNode=%p end=%d", node, start, endNode, end);
- WebCore::Node* startNode = node;
- do {
- if (!node->isTextNode())
- continue;
- if (node->getRect().isEmpty())
- continue;
- WebCore::Text* textNode = static_cast<WebCore::Text*>(node);
- WebCore::StringImpl* string = textNode->dataImpl();
- if (!string->length())
- continue;
- const UChar* chars = string->characters();
- int newLength = node == endNode ? end : string->length();
- if (node == startNode) {
- #if DEBUG_NAV_UI
- if (node == lastStartNode)
- DBG_NAV_LOGD("start=%d last=%d", start, lastStartEnd);
- #endif
- if (node == lastStartNode && start < lastStartEnd)
- break; // skip rect if text overlaps already written text
- lastStartNode = node;
- lastStartEnd = newLength - start;
- }
- if (newLength < start) {
- DBG_NAV_LOGD("newLen=%d < start=%d", newLength, start);
- break;
- }
- if (!isPunctuation(chars[start]))
- result.append(' ');
- result.append(chars + start, newLength - start);
- start = 0;
- } while (node != endNode && (node = node->traverseNextNode()));
- }
- result = result.simplifyWhiteSpace().stripWhiteSpace();
-#if DUMP_NAV_CACHE
- {
- char buffer[256];
- CacheBuilder::Debug debug;
- debug.init(buffer, sizeof(buffer));
- debug.print("copy: ");
- debug.wideString(result);
- DUMP_NAV_LOGD("%s", buffer);
- }
-#endif
- return result;
-}
-
void WebViewCore::setSelection(int start, int end)
{
WebCore::Node* focus = currentFocus();
// Create an array of java Strings for the drop down.
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jobjectArray labelArray = makeLabelArray(env, labels, count);
// Create an array determining whether each item is enabled.
}
env->ReleaseIntArrayElements(selectedArray, selArray, 0);
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestListBox, labelArray, enabledArray, selectedArray);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_requestListBox, labelArray, enabledArray,
+ selectedArray);
env->DeleteLocalRef(selectedArray);
} else {
// Pass up the single selection.
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestSingleListBox, labelArray, enabledArray, selectedCountOrSelection);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_requestSingleListBox, labelArray, enabledArray,
+ selectedCountOrSelection);
}
env->DeleteLocalRef(labelArray);
#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
void WebViewCore::addMessageToConsole(const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceID) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jMessageStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jSourceIDStr = env->NewString((unsigned short *)sourceID.characters(), sourceID.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber, jSourceIDStr);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber,
+ jSourceIDStr);
env->DeleteLocalRef(jMessageStr);
env->DeleteLocalRef(jSourceIDStr);
checkException(env);
void WebViewCore::jsAlert(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
{
#if ENABLE(DATABASE)
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jDatabaseIdentifierStr = env->NewString((unsigned short *)databaseIdentifier.characters(), databaseIdentifier.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_exceededDatabaseQuota, jUrlStr, jDatabaseIdentifierStr, currentQuota, estimatedSize);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_exceededDatabaseQuota, jUrlStr,
+ jDatabaseIdentifierStr, currentQuota, estimatedSize);
env->DeleteLocalRef(jDatabaseIdentifierStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
{
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
checkException(env);
#endif
}
{
m_groupForVisitedLinks = group;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_populateVisitedLinks);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_populateVisitedLinks);
checkException(env);
}
void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring originString = env->NewString((unsigned short *)origin.characters(), origin.length());
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_geolocationPermissionsShowPrompt,
originString);
env->DeleteLocalRef(originString);
void WebViewCore::geolocationPermissionsHidePrompt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_geolocationPermissionsHidePrompt);
checkException(env);
}
bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& text, const WebCore::String& defaultValue, WebCore::String& result)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
-
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jDefaultStr = env->NewString((unsigned short *)defaultValue.characters(), defaultValue.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jstring returnVal = (jstring) env->CallObjectMethod(obj.get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
+ jstring returnVal = (jstring) env->CallObjectMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
// If returnVal is null, it means that the user cancelled the dialog.
if (!returnVal)
return false;
bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& message)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
jstring jInputStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
bool WebViewCore::jsInterrupt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return true; // default to interrupt
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsInterrupt);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsInterrupt);
checkException(env);
return result;
}
WebViewCore::getWebViewJavaObject()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return 0;
- return env->GetObjectField(obj.get(), gWebViewCoreFields.m_webView);
+ return env->GetObjectField(m_javaGlue->object(env).get(), gWebViewCoreFields.m_webView);
}
void WebViewCore::updateTextSelection() {
return;
RenderTextControl* rtc = static_cast<RenderTextControl*>(renderer);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_updateTextSelection, reinterpret_cast<int>(focusNode),
rtc->selectionStart(), rtc->selectionEnd(), m_textGeneration);
checkException(env);
if (m_blockTextfieldUpdates)
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
-
if (changeToPassword) {
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
(int) ptr, true, 0, m_textGeneration);
checkException(env);
return;
}
int length = text.length();
jstring string = env->NewString((unsigned short *) text.characters(), length);
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
(int) ptr, false, string, m_textGeneration);
env->DeleteLocalRef(string);
checkException(env);
void WebViewCore::clearTextEntry()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_clearTextEntry);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_clearTextEntry);
}
void WebViewCore::setBackgroundColor(SkColor c)
jclass WebViewCore::getPluginClass(const WebCore::String& libName, const char* className)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
jstring libString = env->NewString(libName.characters(), libName.length());
jstring classString = env->NewStringUTF(className);
- jobject pluginClass = env->CallObjectMethod(obj.get(),
+ jobject pluginClass = env->CallObjectMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_getPluginClass,
libString, classString);
checkException(env);
void WebViewCore::hideFullScreenPlugin()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_hideFullScreenPlugin);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_hideFullScreenPlugin);
checkException(env);
}
void WebViewCore::updateFullScreenPlugin(int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateFullScreenPlugin, x, y,
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_updateFullScreenPlugin, x, y,
width, height);
checkException(env);
}
jobject WebViewCore::addSurface(jobject view, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- jobject result = env->CallObjectMethod(obj.get(),
+ jobject result = env->CallObjectMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_addSurface,
view, x, y, width, height);
checkException(env);
void WebViewCore::updateSurface(jobject childView, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateSurface, childView, x,
- y, width, height);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_updateSurface, childView,
+ x, y, width, height);
checkException(env);
}
void WebViewCore::destroySurface(jobject childView)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_destroySurface, childView);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_destroySurface, childView);
checkException(env);
}
viewImpl->setBackgroundColor((SkColor) color);
}
-static jstring GetSelection(JNIEnv *env, jobject obj, jobject selRgn)
-{
-#ifdef ANDROID_INSTRUMENT
- TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
-#endif
- WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__);
- SkRegion* selectionRegion = GraphicsJNI::getNativeRegion(env, selRgn);
- WebCore::String result = viewImpl->getSelection(selectionRegion);
- if (!result.isEmpty())
- return WebCoreStringToJString(env, result);
- return 0;
-}
-
static void DumpDomTree(JNIEnv *env, jobject obj, jboolean useFile)
{
WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
SkANP::InitEvent(&event, kLifecycle_ANPEventType);
event.data.lifecycle.action = kPause_ANPLifecycleAction;
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
+
+ WebViewCore::setIsPaused(true);
}
static void Resume(JNIEnv* env, jobject obj)
SkANP::InitEvent(&event, kLifecycle_ANPEventType);
event.data.lifecycle.action = kResume_ANPLifecycleAction;
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
+
+ WebViewCore::setIsPaused(false);
}
static void FreeMemory(JNIEnv* env, jobject obj)
env->ReleaseStringChars(item, str);
env->DeleteLocalRef(item);
}
- env->DeleteLocalRef(array);
}
// Notification from the UI thread that the plugin's full-screen surface has been discarded
(void*) SplitContent },
{ "nativeSetBackgroundColor", "(I)V",
(void*) SetBackgroundColor },
- { "nativeGetSelection", "(Landroid/graphics/Region;)Ljava/lang/String;",
- (void*) GetSelection },
{ "nativeRegisterURLSchemeAsLocal", "(Ljava/lang/String;)V",
(void*) RegisterURLSchemeAsLocal },
{ "nativeDumpDomTree", "(Z)V",
WebCore::String retrieveHref(WebCore::Frame* frame, WebCore::Node* node);
WebCore::String retrieveAnchorText(WebCore::Frame* frame, WebCore::Node* node);
WebCore::String requestLabel(WebCore::Frame* , WebCore::Node* );
- WebCore::String getSelection(SkRegion* );
// Create a single picture to represent the drawn DOM (used by navcache)
void recordPicture(SkPicture* picture);
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);
// field safely from our respective threads
static Mutex gButtonMutex;
WTF::Vector<Container> m_buttons;
+ static bool isPaused() { return s_isPaused; }
+ static void setIsPaused(bool isPaused) { s_isPaused = isPaused; }
// end of shared members
// internal functions
unsigned m_domtree_version;
bool m_check_domtree_version;
PageGroup* m_groupForVisitedLinks;
+ static bool s_isPaused;
SkTDArray<PluginWidgetAndroid*> m_plugins;
WebCore::Timer<WebViewCore> m_pluginInvalTimer;
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
}
if (interestingType == false)
return false;
- if (mBoundsSlop.contains(rect) ||
+ if (!mDrawnOver.contains(rect) && (mBoundsSlop.contains(rect) ||
(mBounds.fLeft == rect.fLeft && mBounds.fRight == rect.fRight &&
mBounds.fTop >= rect.fTop && mBounds.fBottom <= rect.fBottom) ||
(mBounds.fTop == rect.fTop && mBounds.fBottom == rect.fBottom &&
- mBounds.fLeft >= rect.fLeft && mBounds.fRight <= rect.fRight)) {
+ mBounds.fLeft >= rect.fLeft && mBounds.fRight <= rect.fRight))) {
mDrawnOver.setEmpty();
mAllDrawnIn.join(rect);
DBG_NAV_LOGD("BoundsCheck (contains) rect={%d,%d,%d,%d}"
checker.drawPicture(*mPicture);
boundsCheck.checkLast();
// was it not drawn or clipped out?
+ CachedNode* node = const_cast<CachedNode*>(best->mNode);
if (boundsCheck.hidden()) { // if hidden, return false so that nav can try again
- CachedNode* node = const_cast<CachedNode*>(best->mNode);
#if DEBUG_NAV_UI
const SkIRect& m = boundsCheck.mBounds;
const SkIRect& s = boundsCheck.mBoundsSlop;
#if DEBUG_NAV_UI
const SkIRect& modded = boundsCheck.mBounds;
DBG_NAV_LOGD("partially occluded node:%p (%d) old:{%d,%d,%d,%d}"
- " new:{%d,%d,%d,%d}", best->mNode, best->mNode->index(),
+ " new:{%d,%d,%d,%d}", node, node->index(),
orig.fLeft, orig.fTop, orig.fRight, orig.fBottom,
base.fLeft, base.fTop, base.fRight, base.fBottom);
#endif
best->mMouseBounds = WebCore::IntRect(bounds.x() + base.fLeft - kMargin,
bounds.y() + base.fTop - kMargin, base.width(), base.height());
+ node->clip(best->mMouseBounds);
+ return true;
}
return false;
}
#include "SkPoint.h"
#include "SkRect.h"
#include "SkRegion.h"
+#include "SkUtils.h"
class CommonCheck : public SkBounder {
public:
CommonCheck() : mMatrix(NULL), mPaint(NULL) {}
- virtual void setUp(const SkPaint& paint, const SkMatrix& matrix, SkScalar y) {
+ virtual void setUp(const SkPaint& paint, const SkMatrix& matrix, SkScalar y,
+ const void* text) {
mMatrix = &matrix;
mPaint = &paint;
+ mText = static_cast<const uint16_t*>(text);
mY = y;
mBase = mBottom = mTop = INT_MAX;
}
protected:
const SkMatrix* mMatrix;
const SkPaint* mPaint;
+ const uint16_t* mText;
+ SkScalar mY;
int mBase;
int mBottom;
int mTop;
- SkScalar mY;
};
class FirstCheck : public CommonCheck {
full.fRight = mLast.fLeft;
}
mSelectRegion->op(full, SkRegion::kUnion_Op);
+ DBG_NAV_LOGD("MultilineBuilder full=(%d,%d,r=%d,b=%d)",
+ full.fLeft, full.fTop, full.fRight, full.fBottom);
mLast = full;
mLastBase = base();
if (mStart == mEnd)
bool mCapture;
};
+class TextExtractor : public CommonCheck {
+public:
+ TextExtractor(const SkRegion& region) : mSelectRegion(region),
+ mSkipFirstSpace(true) { // don't start with a space
+ }
+
+ virtual void setUp(const SkPaint& paint, const SkMatrix& matrix, SkScalar y,
+ const void* text) {
+ INHERITED::setUp(paint, matrix, y, text);
+ SkPaint charPaint = paint;
+ charPaint.setTextEncoding(SkPaint::kUTF8_TextEncoding);
+ mMinSpaceWidth = charPaint.measureText(" ", 1) * 3 / 4;
+ }
+
+ virtual bool onIRect(const SkIRect& rect, uint16_t glyphID) {
+ SkIRect full;
+ full.set(rect.fLeft, top(), rect.fRight, bottom());
+ if (mSelectRegion.contains(full)) {
+ if (!mSkipFirstSpace
+ && ((mLast.fTop < top() && mLast.fBottom < top() + 2)
+ || (mLast.fLeft < rect.fLeft // glyphs are LTR
+ && mLast.fRight + mMinSpaceWidth < rect.fLeft))) {
+ DBG_NAV_LOGD("TextExtractor [%02x] append space", glyphID);
+ *mSelectText.append() = ' ';
+ } else
+ mSkipFirstSpace = false;
+ DBG_NAV_LOGD("TextExtractor [%02x] append full=(%d,%d,r=%d,b=%d)",
+ glyphID, full.fLeft, full.fTop, full.fRight, full.fBottom);
+ SkUnichar uni;
+ SkPaint utfPaint = *mPaint;
+ utfPaint.setTextEncoding(SkPaint::kUTF16_TextEncoding);
+ utfPaint.glyphsToUnichars(&glyphID, 1, &uni);
+ if (uni) {
+ uint16_t chars[2];
+ size_t count = SkUTF16_FromUnichar(uni, chars);
+ *mSelectText.append() = chars[0];
+ if (count == 2)
+ *mSelectText.append() = chars[1];
+ }
+ mLast = full;
+ } else
+ DBG_NAV_LOGD("TextExtractor [%02x] skip full=(%d,%d,r=%d,b=%d)",
+ glyphID, full.fLeft, full.fTop, full.fRight, full.fBottom);
+ return false;
+ }
+
+ WebCore::String text() {
+ return WebCore::String(mSelectText.begin(), mSelectText.count());
+ }
+
+protected:
+ const SkRegion& mSelectRegion;
+ SkTDArray<uint16_t> mSelectText;
+ SkIRect mLast;
+ SkScalar mMinSpaceWidth;
+ bool mSkipFirstSpace;
+private:
+ typedef CommonCheck INHERITED;
+};
+
class TextCanvas : public SkCanvas {
public:
virtual void drawText(const void* text, size_t byteLength, SkScalar x,
SkScalar y, const SkPaint& paint) {
- mBounder.setUp(paint, getTotalMatrix(), y);
+ mBounder.setUp(paint, getTotalMatrix(), y, text);
SkCanvas::drawText(text, byteLength, x, y, paint);
}
virtual void drawPosTextH(const void* text, size_t byteLength,
const SkScalar xpos[], SkScalar constY,
const SkPaint& paint) {
- mBounder.setUp(paint, getTotalMatrix(), constY);
+ mBounder.setUp(paint, getTotalMatrix(), constY, text);
SkCanvas::drawPosTextH(text, byteLength, xpos, constY, paint);
}
_check.offsetBounds(area.fLeft, area.fTop);
return _check.bestBounds();
}
+
+WebCore::String CopyPaste::text(const SkPicture& picture, const SkIRect& area,
+ const SkRegion& region) {
+ SkRegion copy = region;
+ copy.translate(-area.fLeft, -area.fTop);
+ const SkIRect& bounds = copy.getBounds();
+ DBG_NAV_LOGD("area=(%d, %d, %d, %d) region=(%d, %d, %d, %d)",
+ area.fLeft, area.fTop, area.fRight, area.fBottom,
+ bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom);
+ TextExtractor extractor(copy);
+ TextCanvas checker(&extractor, picture, area);
+ checker.drawPicture(const_cast<SkPicture&>(picture));
+ return extractor.text();
+}
#ifndef SELECT_TEXT_H
#define SELECT_TEXT_H
+#include "PlatformString.h"
+
class SkPicture;
struct SkIRect;
struct SkIPoint;
const SkIRect& selStart, const SkIRect& selEnd, SkRegion* region);
static SkIRect findClosest(const SkPicture& , const SkIRect& area,
int x, int y);
+ static WebCore::String text(const SkPicture& , const SkIRect& area,
+ const SkRegion& );
};
#endif
#define LOG_TAG "webviewglue"
-#include <config.h>
+#include "config.h"
-#include "android_graphics.h"
#include "AndroidAnimation.h"
#include "AndroidLog.h"
#include "AtomicString.h"
#include "CachedFrame.h"
#include "CachedNode.h"
#include "CachedRoot.h"
+#include "CString.h"
#include "FindCanvas.h"
#include "Frame.h"
#include "GraphicsJNI.h"
#include "SkPixelXorXfermode.h"
#include "SkRect.h"
#include "SkTime.h"
-#include "WebCoreJni.h"
-#include "WebViewCore.h"
-#include "jni_utility.h"
-
#ifdef ANDROID_INSTRUMENT
#include "TimeCounter.h"
#endif
+#include "WebCoreJni.h"
+#include "WebViewCore.h"
+#include "android_graphics.h"
#ifdef GET_NATIVE_VIEW
#undef GET_NATIVE_VIEW
#define GET_NATIVE_VIEW(env, obj) ((WebView*)env->GetIntField(obj, gWebViewField))
-#include <ui/KeycodeLabels.h>
+#include <JNIUtility.h>
#include <JNIHelp.h>
#include <jni.h>
+#include <ui/KeycodeLabels.h>
namespace android {
};
struct JavaGlue {
- jobject m_obj;
+ jweak m_obj;
jmethodID m_clearTextEntry;
jmethodID m_overrideLoading;
jmethodID m_scrollBy;
{
jclass clazz = env->FindClass("android/webkit/WebView");
// m_javaGlue = new JavaGlue;
- m_javaGlue.m_obj = adoptGlobalRef(env, javaWebView);
+ m_javaGlue.m_obj = env->NewWeakGlobalRef(javaWebView);
m_javaGlue.m_scrollBy = GetJMethod(env, clazz, "setContentScrollBy", "(IIZ)Z");
m_javaGlue.m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V");
m_javaGlue.m_overrideLoading = GetJMethod(env, clazz, "overrideLoading", "(Ljava/lang/String;)V");
if (m_javaGlue.m_obj)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(m_javaGlue.m_obj);
+ env->DeleteWeakGlobalRef(m_javaGlue.m_obj);
m_javaGlue.m_obj = 0;
}
delete m_frameCacheUI;
{
DEBUG_NAV_UI_LOGD("%s", __FUNCTION__);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_clearTextEntry);
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_clearTextEntry);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return 0;
- int result = env->CallIntMethod(obj.get(), m_javaGlue.m_getScaledMaxXScroll);
+ int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxXScroll);
checkException(env);
return result;
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return 0;
- int result = env->CallIntMethod(obj.get(), m_javaGlue.m_getScaledMaxYScroll);
+ int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxYScroll);
checkException(env);
return result;
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- jobject jRect = env->CallObjectMethod(obj.get(), m_javaGlue.m_getVisibleRect);
+ jobject jRect = env->CallObjectMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getVisibleRect);
checkException(env);
int left = (int) env->GetIntField(jRect, m_javaGlue.m_rectLeft);
checkException(env);
if (!root)
return 0;
const CachedFrame* frame = 0;
- const CachedNode* result = slop ? findAt(root, rect, &frame, &rx, &ry) : 0;
+ const CachedNode* result = findAt(root, rect, &frame, &rx, &ry);
if (!result) {
DBG_NAV_LOGD("no nodes found root=%p", root);
setNavBounds(rect);
void overrideUrlLoading(const WebCore::String& url)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jName = env->NewString((jchar*) url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue.m_overrideLoading, jName);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_overrideLoading, jName);
env->DeleteLocalRef(jName);
}
m_selEnd.fLeft, m_selEnd.fTop, m_selEnd.fRight, m_selEnd.fBottom);
}
-const SkRegion& getSelection()
+const String getSelection()
{
- return m_selRegion;
+ WebCore::IntRect r;
+ getVisibleRect(&r);
+ SkIRect area;
+ area.set(r.x(), r.y(), r.right(), r.bottom());
+ String result = CopyPaste::text(*m_navPictureUI, area, m_selRegion);
+ DBG_NAV_LOGD("text=%s", result.latin1().data());
+ return result;
}
void drawSelectionRegion(SkCanvas* canvas)
void sendMoveFocus(WebCore::Frame* framePtr, WebCore::Node* nodePtr)
{
- DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
+ DBG_NAV_LOGD("framePtr=%p nodePtr=%p", framePtr, nodePtr);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveFocus, (jint) framePtr,
- (jint) nodePtr);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_sendMoveFocus, (jint) framePtr, (jint) nodePtr);
checkException(env);
}
{
DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveMouse,
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendMoveMouse,
(jint) framePtr, (jint) nodePtr, x, y);
checkException(env);
}
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMoveMouseIfLatest, disableFocusController);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_sendMoveMouseIfLatest, disableFocusController);
checkException(env);
}
m_generation, framePtr, nodePtr, x, y);
LOG_ASSERT(m_javaGlue.m_obj, "A WebView was not associated with this WebViewNative!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_sendMotionUp,
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendMotionUp,
m_generation, (jint) framePtr, (jint) nodePtr, x, y);
checkException(env);
}
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return false;
- bool result = env->CallBooleanMethod(obj.get(),
+ bool result = env->CallBooleanMethod(m_javaGlue.object(env).get(),
m_javaGlue.m_scrollBy, dx, dy, true);
checkException(env);
return result;
void rebuildWebTextView()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_rebuildWebTextView);
+ env->CallVoidMethod(m_javaGlue.object(env).get(),
+ m_javaGlue.m_rebuildWebTextView);
checkException(env);
}
void viewInvalidate()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_viewInvalidate);
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_viewInvalidate);
checkException(env);
}
void viewInvalidateRect(int l, int t, int r, int b)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_viewInvalidateRect, l, r, t, b);
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_viewInvalidateRect, l, r, t, b);
checkException(env);
}
void postInvalidateDelayed(int64_t delay, const WebCore::IntRect& bounds)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue.object(env);
- // if it is called during or after DESTROY is handled, the real object of
- // WebView can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue.m_postInvalidateDelayed,
- delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
+ env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_postInvalidateDelayed,
+ delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
checkException(env);
}
{
WebView* view = GET_NATIVE_VIEW(env, obj);
LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
- return GraphicsJNI::createRegion(env, new SkRegion(view->getSelection()));
+ String selection = view->getSelection();
+ return env->NewString((jchar*)selection.characters(), selection.length());
}
#ifdef ANDROID_DUMP_DISPLAY_TREE
(void*) nativeFocusNodePointer },
{ "nativeGetCursorRingBounds", "()Landroid/graphics/Rect;",
(void*) nativeGetCursorRingBounds },
- { "nativeGetSelection", "()Landroid/graphics/Region;",
+ { "nativeGetSelection", "()Ljava/lang/String;",
(void*) nativeGetSelection },
{ "nativeHasCursorNode", "()Z",
(void*) nativeHasCursorNode },
#include "config.h"
#include "android_npapi.h"
+#include "SkTypes.h"
#include "media/AudioTrack.h"
struct ANPAudioTrack {
// must include config.h first for webkit to fiddle with new/delete
#include "config.h"
+#include "ANPSurface_npapi.h"
#include "PluginView.h"
#include "PluginWidgetAndroid.h"
#include "SkANP.h"
+#include "android_graphics.h"
+#include <JNIUtility.h>
#include <ui/Surface.h>
#include <ui/Rect.h>
#include <ui/Region.h>
-#include "jni_utility.h"
#include <utils/RefBase.h>
-#include "android_graphics.h"
-#include "ANPSurface_npapi.h"
using namespace android;
*/
#include "config.h"
-#include "android_graphics.h"
+#include "PluginWidgetAndroid.h"
+
+#if ENABLE(TOUCH_EVENTS)
+#include "ChromeClient.h"
+#endif
#include "Document.h"
#include "Element.h"
#include "Frame.h"
+#include "Page.h"
#include "PluginPackage.h"
#include "PluginView.h"
#include "PluginWidgetAndroid.h"
#include "SkFlipPixelRef.h"
#include "SkString.h"
#include "WebViewCore.h"
-#include "jni_utility.h"
+#include "android_graphics.h"
+#include <JNIUtility.h>
#define DEBUG_VISIBLE_RECTS 1 // temporary debug printfs and fixes
}
Document* doc = m_pluginView->getParentFrame()->document();
+#if ENABLE(TOUCH_EVENTS)
if((m_eventFlags ^ flags) & kTouch_ANPEventFlag) {
- if(flags & kTouch_ANPEventFlag)
- doc->addTouchEventListener(m_pluginView->getElement());
- else
- doc->removeTouchEventListener(m_pluginView->getElement());
+ if (flags & kTouch_ANPEventFlag) {
+ if (Page* page = doc->page())
+ page->chrome()->client()->needTouchEvents(true, false);
+ doc->addListenerTypeIfNeeded(eventNames().touchstartEvent);
+ } else {
+ if (Page* page = doc->page())
+ page->chrome()->client()->needTouchEvents(false, false);
+ }
}
+#endif
m_eventFlags = flags;
}
#include "android_npapi.h"
#include "IntPoint.h"
+#include "IntRect.h"
#include "SkRect.h"
#include <jni.h>
+++ /dev/null
-/*
- * Copyright 2007, 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.
- */
-
-#include "config.h"
-
-namespace std
-{
- void sort(const void** start, const void** end, const void** temp, Comparator comp)
- {
- size_t endlen = end - start;
- size_t midlen = endlen / 2;
- const void** mid = start + midlen;
- if (midlen > 1)
- sort(start, mid, temp, comp);
- if (end - mid > 1)
- sort(mid, end, temp, comp);
- memcpy(temp, start, midlen * sizeof(*start));
- size_t i = 0;
- size_t j = midlen;
- size_t off = 0;
- while (i < midlen && j < endlen)
- start[off++] = (*comp)(start[j], temp[i]) ? start[j++] : temp[i++];
- if (i < midlen)
- memcpy(&start[off], &temp[i], (midlen - i) * sizeof(*start));
- }
-
- void sort(const void** start, const void** end, Comparator comp) {
- if (end - start > 1) {
- const void** temp = new sortType[(end - start) / 2];
- sort(start, end, temp, comp);
- delete[] temp;
- }
- }
-}
+++ /dev/null
-#ifdef __cplusplus
-
-/*
- *
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
- // extracted from stl_algobase.h
- // full STL is not compatible with the ARM build
- // a limited number of STL functions is used by webkit: swap, max, and min are
- // included below for webkit compatibility
-
-#ifdef __GLIBCPP_INTERNAL_ALGOBASE_H
-#error "real STL defined"
-#endif
-
-#ifndef __ANDROID_ALGORITHM
-#define __ANDROID_ALGORITHM
-
-#ifndef __ANDROID_LIMITS
-#include <limits>
-#endif
-
-#ifndef _CPP_UTILITY
-#include <utility>
-#endif
-
-#include <SkScalar.h> // for SK_ScalarNaN
-#ifdef PREFIX_FOR_WEBCORE
-#include <SkTSearch.h>
-#endif
-
-#include <float.h>
-#include <math.h>
-#include <stdint.h>
-#include <stddef.h>
-
-#ifndef WCHAR_MAX
- #define WCHAR_MAX 0xFFFF
-#endif
-
-namespace std
-{
- template<typename _Tp>
- inline void
- swap(_Tp& __a, _Tp& __b)
- {
- _Tp __tmp = __a;
- __a = __b;
- __b = __tmp;
- }
-
- template<typename _Tp>
- inline void
- reverse(_Tp* __first, _Tp* __last)
- {
- while(true)
- {
- if (__first == __last || __first == --__last)
- return;
- else
- {
- _Tp __tmp = *__first;
- *__first = *__last;
- *__last = __tmp;
- }
- ++__first;
- }
- }
-
- #undef min
- #undef max
-
- template<typename _Tp>
- inline const _Tp&
- min(const _Tp& __a, const _Tp& __b)
- {
- return __b < __a ? __b : __a;
- }
-
- template<typename _Tp>
- inline const _Tp&
- max(const _Tp& __a, const _Tp& __b)
- {
- return __a < __b ? __b : __a;
- }
-
-template <class _InputIter, class _OutputIter>
-inline _OutputIter copy(_InputIter __first, _InputIter __last,
- _OutputIter __result)
-{
- for (size_t __n = __last - __first; __n > 0; --__n) {
- *__result = *__first;
- ++__first;
- ++__result;
- }
- return __result;
-}
-
-template <class _ForwardIter, class _Tp>
-void fill(_ForwardIter __first, _ForwardIter __last, const _Tp& __value) {
- for ( ; __first != __last; ++__first)
- *__first = __value;
-}
-
-#ifndef UINTPTR_MAX
-#define UINTPTR_MAX UINT32_MAX
-#endif
-
-#ifndef UINT32_MAX
-#define UINT32_MAX (0xffffffff)
-#endif
-
-template <typename T>
-struct numeric_limits {
- /// Returns the minimum value for type T.
- static inline T min (void) { return (T(0)); }
- /// Returns the minimum value for type T.
- static inline T max (void) { return (T(0)); }
- static const bool is_signed = false; ///< True if the type is signed.
- static const bool is_integer = false; ///< True if stores an exact value.
- static const bool is_integral = false; ///< True if fixed size and cast-copyable.
-};
-
-template <typename T>
-struct numeric_limits<T*> {
- static inline T* min (void) { return (NULL); }
- static inline T* max (void) { return (UINTPTR_MAX); }
- static const bool is_signed = false;
- static const bool is_integer = true;
- static const bool is_integral = true;
-};
-
-#define _NUMERIC_LIMITS(type, minVal, maxVal, quietNaN, bSigned, bInteger, bIntegral) \
-template <> \
-struct numeric_limits<type> { \
- static inline type infinity (void) { return (maxVal); } \
- static inline type min (void) { return (minVal); } \
- static inline type max (void) { return (maxVal); } \
- static inline type quiet_NaN() { return (quietNaN); } \
- static const bool is_signed = bSigned; \
- static const bool is_integer = bInteger; \
- static const bool is_integral = bIntegral; \
-}
-
-//--------------------------------------------------------------------------------------
-// type min max NaN signed integer integral
-//--------------------------------------------------------------------------------------
-_NUMERIC_LIMITS (bool, false, true, 0, false, true, true);
-_NUMERIC_LIMITS (char, SCHAR_MIN, SCHAR_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (int, INT_MIN, INT_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (short, SHRT_MIN, SHRT_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (long, LONG_MIN, LONG_MAX, 0, true, true, true);
-#if HAVE_THREE_CHAR_TYPES
-_NUMERIC_LIMITS (signed char, SCHAR_MIN, SCHAR_MAX, 0, true, true, true);
-#endif
-_NUMERIC_LIMITS (unsigned char, 0, UCHAR_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned int, 0, UINT_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned short,0, USHRT_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (unsigned long, 0, ULONG_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (wchar_t, 0, WCHAR_MAX, 0, false, true, true);
-_NUMERIC_LIMITS (float, FLT_MIN, FLT_MAX, SK_ScalarNaN, true, false, true);
-_NUMERIC_LIMITS (double, DBL_MIN, DBL_MAX, SK_ScalarNaN, true, false, true);
-_NUMERIC_LIMITS (long double, LDBL_MIN, LDBL_MAX, SK_ScalarNaN, true, false, true);
-#ifdef HAVE_LONG_LONG
-_NUMERIC_LIMITS (long long, LLONG_MIN, LLONG_MAX, 0, true, true, true);
-_NUMERIC_LIMITS (unsigned long long, 0, ULLONG_MAX, 0, false, true, true);
-#endif
-//--------------------------------------------------------------------------------------
-
-using ::ptrdiff_t;
-
-typedef bool (* Comparator)(const void*, const void*);
-extern void sort(const void** start, const void** end, Comparator comp);
-
-#ifdef PREFIX_FOR_WEBCORE
- typedef const void* sortType;
-
- inline bool binary_search(const unsigned short* const base,
- const unsigned short* const end,
- short target)
- {
- return SkTSearch<unsigned short>(base, end - base, target, sizeof(unsigned short)) >= 0;
- }
-
-
- template<typename P> inline void sort (P** start, P**end,
- bool (* comp)(const P*, const P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) comp);
- }
-
- template<typename P> void sort(P* start, P* end,
- bool (* comp)(const P&, const P&)) {
- stable_sort(start, end, *comp);
- }
-
- template<typename P> inline void stable_sort(P** start, P** end,
- bool (* comp)(P*, P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) comp);
- }
-
- template<typename P> inline void stable_sort(P** start, P** end,
- bool (& comp)(const P*, const P*))
- {
- sort((const void**) start, (const void**) end, (Comparator) &comp);
- }
-
- template<typename P> void stable_sort(P* start, P* end, P* temp,
- bool (& comp)(const P&, const P&)) {
- size_t endlen = end - start;
- size_t midlen = endlen / 2;
- P* mid = start + midlen;
- if (midlen > 1)
- stable_sort(start, mid, temp, comp);
- if (end - mid > 1)
- stable_sort(mid, end, temp, comp);
- memcpy(temp, start, midlen * sizeof(*start));
- size_t i = 0;
- size_t j = midlen;
- size_t off = 0;
- while (i < midlen && j < endlen) {
- P* dst = (comp)(start[j], temp[i]) ? &start[j++] : &temp[i++];
- memcpy(&start[off++], dst, sizeof(*start));
- }
- if (i < midlen)
- memcpy(&start[off], &temp[i], (midlen - i) * sizeof(*start));
- }
-
- template<typename P> void stable_sort(P* start, P* end,
- bool (& comp)(const P&, const P&)) {
- if (end - start > 1) {
- size_t count = (end - start) / 2;
- P* temp = static_cast<P*>(malloc(count * sizeof(P)));
- stable_sort(start, end, temp, comp);
- free(temp);
- }
- }
-
- template<typename P> void stable_sort(P* start, P* end,
- bool (& comp)(P, P)) {
- stable_sort(start, end, (bool (&)(const P&, const P&))(comp));
- }
-
- class ostream {
- int this_class_intentionally_left_empty;
- };
-#endif
-
-}
-
-#endif
-
-#endif // __cplusplus
-
+++ /dev/null
-/*
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __CONCEPT_CHECKS_H
-#define __CONCEPT_CHECKS_H
-
-/*
- Use these macro like assertions, but they assert properties
- on types (usually template arguments). In technical terms they
- verify whether a type "models" a "concept".
-
- This set of requirements and the terminology used here is derived
- from the book "Generic Programming and the STL" by Matt Austern
- (Addison Wesley). For further information please consult that
- book. The requirements also are intended to match the ANSI/ISO C++
- standard.
-
- This file covers the basic concepts and the iterator concepts.
- There are several other files that provide the requirements
- for the STL containers:
- container_concepts.h
- sequence_concepts.h
- assoc_container_concepts.h
-
- Jeremy Siek, 1999
-
- TO DO:
- - some issues with regards to concept classification and mutability
- including AssociativeContianer -> ForwardContainer
- and SortedAssociativeContainer -> ReversibleContainer
- - HashedAssociativeContainer
- - Allocator
- - Function Object Concepts
-
- */
-
-#ifndef __STL_USE_CONCEPT_CHECKS
-
-// Some compilers lack the features that are necessary for concept checks.
-// On those compilers we define the concept check macros to do nothing.
-#define __STL_REQUIRES(__type_var, __concept) do {} while(0)
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- static int __##__type_var##_##__concept
-#define __STL_CONVERTIBLE(__type_x, __type_y) do {} while(0)
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) do {} while(0)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- static int __##__type_x##__type_y##_require_same_type
-#define __STL_GENERATOR_CHECK(__func, __ret) do {} while(0)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- static int __##__func##__ret##_generator_check
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) do {} while(0)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- static int __##__func##__ret##__arg##_unary_function_check
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- static int __##__func##__ret##__first##__second##_binary_function_check
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do {} while(0)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- static int __##__opname##__ret##__first##__second##_require_binary_op
-
-#else /* __STL_USE_CONCEPT_CHECKS */
-
-// This macro tests whether the template argument "__type_var"
-// satisfies the requirements of "__concept". Here is a list of concepts
-// that we know how to check:
-// _Allocator
-// _Assignable
-// _DefaultConstructible
-// _EqualityComparable
-// _LessThanComparable
-// _TrivialIterator
-// _InputIterator
-// _OutputIterator
-// _ForwardIterator
-// _BidirectionalIterator
-// _RandomAccessIterator
-// _Mutable_TrivialIterator
-// _Mutable_ForwardIterator
-// _Mutable_BidirectionalIterator
-// _Mutable_RandomAccessIterator
-
-#define __STL_REQUIRES(__type_var, __concept) \
-do { \
- void (*__x)( __type_var ) = __concept##_concept_specification< __type_var >\
- ::__concept##_requirement_violation; __x = __x; } while (0)
-
-// Use this to check whether type X is convertible to type Y
-#define __STL_CONVERTIBLE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_CONVERT_ERROR< __type_x , \
- __type_y >::__type_X_is_not_convertible_to_type_Y; \
- __x = __x; } while (0)
-
-// Use this to test whether two template arguments are the same type
-#define __STL_REQUIRES_SAME_TYPE(__type_x, __type_y) \
-do { \
- void (*__x)( __type_x , __type_y ) = _STL_SAME_TYPE_ERROR< __type_x, \
- __type_y >::__type_X_not_same_as_type_Y; \
- __x = __x; } while (0)
-
-
-// function object checks
-#define __STL_GENERATOR_CHECK(__func, __ret) \
-do { \
- __ret (*__x)( __func&) = \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
-do { \
- __ret (*__x)( __func&, const __arg& ) = \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
-do { \
- __ret (*__x)( __func&, const __first&, const __second& ) = \
- _STL_BINARY_FUNCTION_ERROR< \
- __func, __ret, __first, __second>::__binary_function_requirement_violation; \
- __x = __x; } while (0)
-
-
-#define __STL_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- do { \
- __ret (*__x)( __first&, __second& ) = _STL_BINARY##__opname##_ERROR< \
- __ret, __first, __second>::__binary_operator_requirement_violation; \
- __ret (*__y)( const __first&, const __second& ) = \
- _STL_BINARY##__opname##_ERROR< __ret, __first, __second>:: \
- __const_binary_operator_requirement_violation; \
- __y = __y; __x = __x; } while (0)
-
-
-#ifdef __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-
-#define __STL_CLASS_REQUIRES(__type_var, __concept)
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y)
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret)
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg)
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second)
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second)
-
-#else
-
-// Use this macro inside of template classes, where you would
-// like to place requirements on the template arguments to the class
-// Warning: do not pass pointers and such (e.g. T*) in as the __type_var,
-// since the type_var is used to construct identifiers. Instead typedef
-// the pointer type, then use the typedef name for the __type_var.
-#define __STL_CLASS_REQUIRES(__type_var, __concept) \
- typedef void (* __func##__type_var##__concept)( __type_var ); \
- template <__func##__type_var##__concept _Tp1> \
- struct __dummy_struct_##__type_var##__concept { }; \
- static __dummy_struct_##__type_var##__concept< \
- __concept##_concept_specification< \
- __type_var>::__concept##_requirement_violation> \
- __dummy_ptr_##__type_var##__concept
-
-
-#define __STL_CLASS_REQUIRES_SAME_TYPE(__type_x, __type_y) \
- typedef void (* __func_##__type_x##__type_y##same_type)( __type_x, \
- __type_y ); \
- template < __func_##__type_x##__type_y##same_type _Tp1> \
- struct __dummy_struct_##__type_x##__type_y##_same_type { }; \
- static __dummy_struct_##__type_x##__type_y##_same_type< \
- _STL_SAME_TYPE_ERROR<__type_x, __type_y>::__type_X_not_same_as_type_Y> \
- __dummy_ptr_##__type_x##__type_y##_same_type
-
-
-#define __STL_CLASS_GENERATOR_CHECK(__func, __ret) \
- typedef __ret (* __f_##__func##__ret##_generator)( __func& ); \
- template <__f_##__func##__ret##_generator _Tp1> \
- struct __dummy_struct_##__func##__ret##_generator { }; \
- static __dummy_struct_##__func##__ret##_generator< \
- _STL_GENERATOR_ERROR< \
- __func, __ret>::__generator_requirement_violation> \
- __dummy_ptr_##__func##__ret##_generator
-
-
-#define __STL_CLASS_UNARY_FUNCTION_CHECK(__func, __ret, __arg) \
- typedef __ret (* __f_##__func##__ret##__arg##_unary_check)( __func&, \
- const __arg& ); \
- template <__f_##__func##__ret##__arg##_unary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__arg##_unary_check { }; \
- static __dummy_struct_##__func##__ret##__arg##_unary_check< \
- _STL_UNARY_FUNCTION_ERROR< \
- __func, __ret, __arg>::__unary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__arg##_unary_check
-
-
-#define __STL_CLASS_BINARY_FUNCTION_CHECK(__func, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_check)( __func&, const __first&,\
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_check _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_check { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_check< \
- _STL_BINARY_FUNCTION_ERROR<__func, __ret, __first, __second>:: \
- __binary_function_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_check
-
-
-#define __STL_CLASS_REQUIRES_BINARY_OP(__opname, __ret, __first, __second) \
- typedef __ret (* __f_##__func##__ret##__first##__second##_binary_op)(const __first&, \
- const __second& ); \
- template <__f_##__func##__ret##__first##__second##_binary_op _Tp1> \
- struct __dummy_struct_##__func##__ret##__first##__second##_binary_op { }; \
- static __dummy_struct_##__func##__ret##__first##__second##_binary_op< \
- _STL_BINARY##__opname##_ERROR<__ret, __first, __second>:: \
- __binary_operator_requirement_violation> \
- __dummy_ptr_##__func##__ret##__first##__second##_binary_op
-
-#endif
-
-/* helper class for finding non-const version of a type. Need to have
- something to assign to etc. when testing constant iterators. */
-
-template <class _Tp>
-struct _Mutable_trait {
- typedef _Tp _Type;
-};
-template <class _Tp>
-struct _Mutable_trait<const _Tp> {
- typedef _Tp _Type;
-};
-
-
-/* helper function for avoiding compiler warnings about unused variables */
-template <class _Type>
-void __sink_unused_warning(_Type) { }
-
-template <class _TypeX, class _TypeY>
-struct _STL_CONVERT_ERROR {
- static void
- __type_X_is_not_convertible_to_type_Y(_TypeX __x, _TypeY) {
- _TypeY __y = __x;
- __sink_unused_warning(__y);
- }
-};
-
-
-template <class _Type> struct __check_equal { };
-
-template <class _TypeX, class _TypeY>
-struct _STL_SAME_TYPE_ERROR {
- static void
- __type_X_not_same_as_type_Y(_TypeX , _TypeY ) {
- __check_equal<_TypeX> t1 = __check_equal<_TypeY>();
- }
-};
-
-
-// Some Functon Object Checks
-
-template <class _Func, class _Ret>
-struct _STL_GENERATOR_ERROR {
- static _Ret __generator_requirement_violation(_Func& __f) {
- return __f();
- }
-};
-
-template <class _Func>
-struct _STL_GENERATOR_ERROR<_Func, void> {
- static void __generator_requirement_violation(_Func& __f) {
- __f();
- }
-};
-
-
-template <class _Func, class _Ret, class _Arg>
-struct _STL_UNARY_FUNCTION_ERROR {
- static _Ret
- __unary_function_requirement_violation(_Func& __f,
- const _Arg& __arg) {
- return __f(__arg);
- }
-};
-
-template <class _Func, class _Arg>
-struct _STL_UNARY_FUNCTION_ERROR<_Func, void, _Arg> {
- static void
- __unary_function_requirement_violation(_Func& __f,
- const _Arg& __arg) {
- __f(__arg);
- }
-};
-
-template <class _Func, class _Ret, class _First, class _Second>
-struct _STL_BINARY_FUNCTION_ERROR {
- static _Ret
- __binary_function_requirement_violation(_Func& __f,
- const _First& __first,
- const _Second& __second) {
- return __f(__first, __second);
- }
-};
-
-template <class _Func, class _First, class _Second>
-struct _STL_BINARY_FUNCTION_ERROR<_Func, void, _First, _Second> {
- static void
- __binary_function_requirement_violation(_Func& __f,
- const _First& __first,
- const _Second& __second) {
- __f(__first, __second);
- }
-};
-
-
-#define __STL_DEFINE_BINARY_OP_CHECK(_OP, _NAME) \
-template <class _Ret, class _First, class _Second> \
-struct _STL_BINARY##_NAME##_ERROR { \
- static _Ret \
- __const_binary_operator_requirement_violation(const _First& __first, \
- const _Second& __second) { \
- return __first _OP __second; \
- } \
- static _Ret \
- __binary_operator_requirement_violation(_First& __first, \
- _Second& __second) { \
- return __first _OP __second; \
- } \
-}
-
-__STL_DEFINE_BINARY_OP_CHECK(==, _OP_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(!=, _OP_NOT_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(<, _OP_LESS_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(<=, _OP_LESS_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(>, _OP_GREATER_THAN);
-__STL_DEFINE_BINARY_OP_CHECK(>=, _OP_GREATER_EQUAL);
-__STL_DEFINE_BINARY_OP_CHECK(+, _OP_PLUS);
-__STL_DEFINE_BINARY_OP_CHECK(*, _OP_TIMES);
-__STL_DEFINE_BINARY_OP_CHECK(/, _OP_DIVIDE);
-__STL_DEFINE_BINARY_OP_CHECK(-, _OP_SUBTRACT);
-__STL_DEFINE_BINARY_OP_CHECK(%, _OP_MOD);
-// ...
-
-// TODO, add unary operators (prefix and postfix)
-
-/*
- The presence of this class is just to trick EDG into displaying
- these error messages before any other errors. Without the
- classes, the errors in the functions get reported after
- other class errors deep inside the library. The name
- choice just makes for an eye catching error message :)
- */
-struct _STL_ERROR {
-
- template <class _Type>
- static _Type
- __default_constructor_requirement_violation(_Type) {
- return _Type();
- }
- template <class _Type>
- static _Type
- __assignment_operator_requirement_violation(_Type __a) {
- __a = __a;
- return __a;
- }
- template <class _Type>
- static _Type
- __copy_constructor_requirement_violation(_Type __a) {
- _Type __c(__a);
- return __c;
- }
- template <class _Type>
- static _Type
- __const_parameter_required_for_copy_constructor(_Type /* __a */,
- const _Type& __b) {
- _Type __c(__b);
- return __c;
- }
- template <class _Type>
- static _Type
- __const_parameter_required_for_assignment_operator(_Type __a,
- const _Type& __b) {
- __a = __b;
- return __a;
- }
- template <class _Type>
- static _Type
- __less_than_comparable_requirement_violation(_Type __a, _Type __b) {
- if (__a < __b || __a > __b || __a <= __b || __a >= __b) return __a;
- return __b;
- }
- template <class _Type>
- static _Type
- __equality_comparable_requirement_violation(_Type __a, _Type __b) {
- if (__a == __b || __a != __b) return __a;
- return __b;
- }
- template <class _Iterator>
- static void
- __dereference_operator_requirement_violation(_Iterator __i) {
- __sink_unused_warning(*__i);
- }
- template <class _Iterator>
- static void
- __dereference_operator_and_assignment_requirement_violation(_Iterator __i) {
- *__i = *__i;
- }
- template <class _Iterator>
- static void
- __preincrement_operator_requirement_violation(_Iterator __i) {
- ++__i;
- }
- template <class _Iterator>
- static void
- __postincrement_operator_requirement_violation(_Iterator __i) {
- __i++;
- }
- template <class _Iterator>
- static void
- __predecrement_operator_requirement_violation(_Iterator __i) {
- --__i;
- }
- template <class _Iterator>
- static void
- __postdecrement_operator_requirement_violation(_Iterator __i) {
- __i--;
- }
- template <class _Iterator, class _Type>
- static void
- __postincrement_operator_and_assignment_requirement_violation(_Iterator __i,
- _Type __t) {
- *__i++ = __t;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_addition_assignment_requirement_violation(_Iterator __i,
- _Distance __n) {
- __i += __n;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_addition_requirement_violation(_Iterator __i, _Distance __n) {
- __i = __i + __n;
- __i = __n + __i;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_subtraction_assignment_requirement_violation(_Iterator __i,
- _Distance __n) {
- __i -= __n;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Iterator
- __iterator_subtraction_requirement_violation(_Iterator __i, _Distance __n) {
- __i = __i - __n;
- return __i;
- }
- template <class _Iterator, class _Distance>
- static _Distance
- __difference_operator_requirement_violation(_Iterator __i, _Iterator __j,
- _Distance __n) {
- __n = __i - __j;
- return __n;
- }
- template <class _Exp, class _Type, class _Distance>
- static _Type
- __element_access_operator_requirement_violation(_Exp __x, _Type*,
- _Distance __n) {
- return __x[__n];
- }
- template <class _Exp, class _Type, class _Distance>
- static void
- __element_assignment_operator_requirement_violation(_Exp __x,
- _Type* __t,
- _Distance __n) {
- __x[__n] = *__t;
- }
-
-}; /* _STL_ERROR */
-
-/* Associated Type Requirements */
-
-__STL_BEGIN_NAMESPACE
-template <class _Iterator> struct iterator_traits;
-__STL_END_NAMESPACE
-
-template <class _Iter>
-struct __value_type_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::value_type value_type;
-};
-
-template <class _Iter>
-struct __difference_type_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::difference_type
- difference_type;
-};
-
-template <class _Iter>
-struct __reference_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::reference reference;
-};
-
-template <class _Iter>
-struct __pointer_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::pointer pointer;
-};
-
-template <class _Iter>
-struct __iterator_category_type_definition_requirement_violation {
- typedef typename __STD::iterator_traits<_Iter>::iterator_category
- iterator_category;
-};
-
-/* Assignable Requirements */
-
-
-template <class _Type>
-struct _Assignable_concept_specification {
- static void _Assignable_requirement_violation(_Type __a) {
- _STL_ERROR::__assignment_operator_requirement_violation(__a);
- _STL_ERROR::__copy_constructor_requirement_violation(__a);
- _STL_ERROR::__const_parameter_required_for_copy_constructor(__a,__a);
- _STL_ERROR::__const_parameter_required_for_assignment_operator(__a,__a);
- }
-};
-
-/* DefaultConstructible Requirements */
-
-
-template <class _Type>
-struct _DefaultConstructible_concept_specification {
- static void _DefaultConstructible_requirement_violation(_Type __a) {
- _STL_ERROR::__default_constructor_requirement_violation(__a);
- }
-};
-
-/* EqualityComparable Requirements */
-
-template <class _Type>
-struct _EqualityComparable_concept_specification {
- static void _EqualityComparable_requirement_violation(_Type __a) {
- _STL_ERROR::__equality_comparable_requirement_violation(__a, __a);
- }
-};
-
-/* LessThanComparable Requirements */
-template <class _Type>
-struct _LessThanComparable_concept_specification {
- static void _LessThanComparable_requirement_violation(_Type __a) {
- _STL_ERROR::__less_than_comparable_requirement_violation(__a, __a);
- }
-};
-
-/* TrivialIterator Requirements */
-
-template <class _TrivialIterator>
-struct _TrivialIterator_concept_specification {
-static void
-_TrivialIterator_requirement_violation(_TrivialIterator __i) {
- typedef typename
- __value_type_type_definition_requirement_violation<_TrivialIterator>::
- value_type __T;
- // Refinement of Assignable
- _Assignable_concept_specification<_TrivialIterator>::
- _Assignable_requirement_violation(__i);
- // Refinement of DefaultConstructible
- _DefaultConstructible_concept_specification<_TrivialIterator>::
- _DefaultConstructible_requirement_violation(__i);
- // Refinement of EqualityComparable
- _EqualityComparable_concept_specification<_TrivialIterator>::
- _EqualityComparable_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__dereference_operator_requirement_violation(__i);
-}
-};
-
-template <class _TrivialIterator>
-struct _Mutable_TrivialIterator_concept_specification {
-static void
-_Mutable_TrivialIterator_requirement_violation(_TrivialIterator __i) {
- _TrivialIterator_concept_specification<_TrivialIterator>::
- _TrivialIterator_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__dereference_operator_and_assignment_requirement_violation(__i);
-}
-};
-
-/* InputIterator Requirements */
-
-template <class _InputIterator>
-struct _InputIterator_concept_specification {
-static void
-_InputIterator_requirement_violation(_InputIterator __i) {
- // Refinement of TrivialIterator
- _TrivialIterator_concept_specification<_InputIterator>::
- _TrivialIterator_requirement_violation(__i);
- // Associated Types
- __difference_type_type_definition_requirement_violation<_InputIterator>();
- __reference_type_definition_requirement_violation<_InputIterator>();
- __pointer_type_definition_requirement_violation<_InputIterator>();
- __iterator_category_type_definition_requirement_violation<_InputIterator>();
- // Valid Expressions
- _STL_ERROR::__preincrement_operator_requirement_violation(__i);
- _STL_ERROR::__postincrement_operator_requirement_violation(__i);
-}
-};
-
-/* OutputIterator Requirements */
-
-template <class _OutputIterator>
-struct _OutputIterator_concept_specification {
-static void
-_OutputIterator_requirement_violation(_OutputIterator __i) {
- // Refinement of Assignable
- _Assignable_concept_specification<_OutputIterator>::
- _Assignable_requirement_violation(__i);
- // Associated Types
- __iterator_category_type_definition_requirement_violation<_OutputIterator>();
- // Valid Expressions
- _STL_ERROR::__dereference_operator_requirement_violation(__i);
- _STL_ERROR::__preincrement_operator_requirement_violation(__i);
- _STL_ERROR::__postincrement_operator_requirement_violation(__i);
- _STL_ERROR::
- __postincrement_operator_and_assignment_requirement_violation(__i, *__i);
-}
-};
-
-/* ForwardIterator Requirements */
-
-template <class _ForwardIterator>
-struct _ForwardIterator_concept_specification {
-static void
-_ForwardIterator_requirement_violation(_ForwardIterator __i) {
- // Refinement of InputIterator
- _InputIterator_concept_specification<_ForwardIterator>::
- _InputIterator_requirement_violation(__i);
-}
-};
-
-template <class _ForwardIterator>
-struct _Mutable_ForwardIterator_concept_specification {
-static void
-_Mutable_ForwardIterator_requirement_violation(_ForwardIterator __i) {
- _ForwardIterator_concept_specification<_ForwardIterator>::
- _ForwardIterator_requirement_violation(__i);
- // Refinement of OutputIterator
- _OutputIterator_concept_specification<_ForwardIterator>::
- _OutputIterator_requirement_violation(__i);
-}
-};
-
-/* BidirectionalIterator Requirements */
-
-template <class _BidirectionalIterator>
-struct _BidirectionalIterator_concept_specification {
-static void
-_BidirectionalIterator_requirement_violation(_BidirectionalIterator __i) {
- // Refinement of ForwardIterator
- _ForwardIterator_concept_specification<_BidirectionalIterator>::
- _ForwardIterator_requirement_violation(__i);
- // Valid Expressions
- _STL_ERROR::__predecrement_operator_requirement_violation(__i);
- _STL_ERROR::__postdecrement_operator_requirement_violation(__i);
-}
-};
-
-template <class _BidirectionalIterator>
-struct _Mutable_BidirectionalIterator_concept_specification {
-static void
-_Mutable_BidirectionalIterator_requirement_violation(
- _BidirectionalIterator __i)
-{
- _BidirectionalIterator_concept_specification<_BidirectionalIterator>::
- _BidirectionalIterator_requirement_violation(__i);
- // Refinement of mutable_ForwardIterator
- _Mutable_ForwardIterator_concept_specification<_BidirectionalIterator>::
- _Mutable_ForwardIterator_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<
- _BidirectionalIterator>::value_type __T;
- typename _Mutable_trait<__T>::_Type* __tmp_ptr = 0;
- // Valid Expressions
- _STL_ERROR::
- __postincrement_operator_and_assignment_requirement_violation(__i,
- *__tmp_ptr);
-}
-};
-
-/* RandomAccessIterator Requirements */
-
-template <class _RandAccIter>
-struct _RandomAccessIterator_concept_specification {
-static void
-_RandomAccessIterator_requirement_violation(_RandAccIter __i) {
- // Refinement of BidirectionalIterator
- _BidirectionalIterator_concept_specification<_RandAccIter>::
- _BidirectionalIterator_requirement_violation(__i);
- // Refinement of LessThanComparable
- _LessThanComparable_concept_specification<_RandAccIter>::
- _LessThanComparable_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<_RandAccIter>
- ::value_type
- value_type;
- typedef typename
- __difference_type_type_definition_requirement_violation<_RandAccIter>
- ::difference_type
- _Dist;
- typedef typename _Mutable_trait<_Dist>::_Type _MutDist;
-
- // Valid Expressions
- _STL_ERROR::__iterator_addition_assignment_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__iterator_addition_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::
- __iterator_subtraction_assignment_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__iterator_subtraction_requirement_violation(__i,
- _MutDist());
- _STL_ERROR::__difference_operator_requirement_violation(__i, __i,
- _MutDist());
- typename _Mutable_trait<value_type>::_Type* __dummy_ptr = 0;
- _STL_ERROR::__element_access_operator_requirement_violation(__i,
- __dummy_ptr,
- _MutDist());
-}
-};
-
-template <class _RandAccIter>
-struct _Mutable_RandomAccessIterator_concept_specification {
-static void
-_Mutable_RandomAccessIterator_requirement_violation(_RandAccIter __i)
-{
- _RandomAccessIterator_concept_specification<_RandAccIter>::
- _RandomAccessIterator_requirement_violation(__i);
- // Refinement of mutable_BidirectionalIterator
- _Mutable_BidirectionalIterator_concept_specification<_RandAccIter>::
- _Mutable_BidirectionalIterator_requirement_violation(__i);
- typedef typename
- __value_type_type_definition_requirement_violation<_RandAccIter>
- ::value_type
- value_type;
- typedef typename
- __difference_type_type_definition_requirement_violation<_RandAccIter>
- ::difference_type
- _Dist;
-
- typename _Mutable_trait<value_type>::_Type* __tmp_ptr = 0;
- // Valid Expressions
- _STL_ERROR::__element_assignment_operator_requirement_violation(__i,
- __tmp_ptr, _Dist());
-}
-};
-
-#define __STL_TYPEDEF_REQUIREMENT(__REQUIREMENT) \
-template <class Type> \
-struct __##__REQUIREMENT##__typedef_requirement_violation { \
- typedef typename Type::__REQUIREMENT __REQUIREMENT; \
-}
-
-__STL_TYPEDEF_REQUIREMENT(value_type);
-__STL_TYPEDEF_REQUIREMENT(difference_type);
-__STL_TYPEDEF_REQUIREMENT(size_type);
-__STL_TYPEDEF_REQUIREMENT(reference);
-__STL_TYPEDEF_REQUIREMENT(const_reference);
-__STL_TYPEDEF_REQUIREMENT(pointer);
-__STL_TYPEDEF_REQUIREMENT(const_pointer);
-
-
-template <class _Alloc>
-struct _Allocator_concept_specification {
-static void
-_Allocator_requirement_violation(_Alloc __a) {
- // Refinement of DefaultConstructible
- _DefaultConstructible_concept_specification<_Alloc>::
- _DefaultConstructible_requirement_violation(__a);
- // Refinement of EqualityComparable
- _EqualityComparable_concept_specification<_Alloc>::
- _EqualityComparable_requirement_violation(__a);
- // Associated Types
- __value_type__typedef_requirement_violation<_Alloc>();
- __difference_type__typedef_requirement_violation<_Alloc>();
- __size_type__typedef_requirement_violation<_Alloc>();
- __reference__typedef_requirement_violation<_Alloc>();
- __const_reference__typedef_requirement_violation<_Alloc>();
- __pointer__typedef_requirement_violation<_Alloc>();
- __const_pointer__typedef_requirement_violation<_Alloc>();
- typedef typename _Alloc::value_type _Tp;
- //__STL_REQUIRES_SAME_TYPE(typename _Alloc::__STL_TEMPLATE rebind<_Tp>::other,
- // _Alloc);
-}
-};
-
-#endif /* __STL_USE_CONCEPT_CHECKS */
-
-#endif /* __CONCEPT_CHECKS_H */
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-// -*- C++ -*- forwarding header.
-
-// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
-// Free Software Foundation, Inc.
-//
-// This file is part of the GNU ISO C++ Library. This library is free
-// software; you can redistribute it and/or modify it under the
-// terms of the GNU General Public License as published by the
-// Free Software Foundation; either version 2, or (at your option)
-// any later version.
-
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License along
-// with this library; see the file COPYING. If not, write to the Free
-// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
-// USA.
-
-// As a special exception, you may use this file as part of a free software
-// library without restriction. Specifically, if other files instantiate
-// templates or use macros or inline functions from this file, or you compile
-// this file and link it with other files to produce an executable, this
-// file does not by itself cause the resulting executable to be covered by
-// the GNU General Public License. This exception does not however
-// invalidate any other reasons why the executable file might be covered by
-// the GNU General Public License.
-
-//
-// ISO C++ 14882: 20.4.6 C library
-//
-
-/** @file cstring
- * This is a Standard C++ Library file. You should @c #include this file
- * in your programs, rather than any of the "*.h" implementation files.
- *
- * This is the C++ version of the Standard C Library header @c string.h,
- * and its contents are (mostly) the same as that header, but are all
- * contained in the namespace @c std.
- */
-
-#ifndef _GLIBCXX_CSTRING
-#define _GLIBCXX_CSTRING 1
-
-#pragma GCC system_header
-
-#include <cstddef>
-
-#include <string.h>
-
-// Get rid of those macros defined in <string.h> in lieu of real functions.
-#undef memcpy
-#undef memmove
-#undef strcpy
-#undef strncpy
-#undef strcat
-#undef strncat
-#undef memcmp
-#undef strcmp
-#undef strcoll
-#undef strncmp
-#undef strxfrm
-#undef memchr
-#undef strchr
-#undef strcspn
-#undef strpbrk
-#undef strrchr
-#undef strspn
-#undef strstr
-#undef strtok
-#undef memset
-#undef strerror
-#undef strlen
-
-namespace std
-{
- using ::memcpy;
- using ::memmove;
- using ::strcpy;
- using ::strncpy;
- using ::strcat;
- using ::strncat;
- using ::memcmp;
- using ::strcmp;
-// using ::strcoll;
- using ::strncmp;
-// using ::strxfrm;
- using ::strcspn;
- using ::strspn;
- using ::strtok;
- using ::memset;
- using ::strerror;
- using ::strlen;
-
- using ::memchr;
-
- inline void*
- memchr(void* __p, int __c, size_t __n)
- { return memchr(const_cast<const void*>(__p), __c, __n); }
-
- using ::strchr;
-
- inline char*
- strchr(char* __s1, int __n)
- { return __builtin_strchr(const_cast<const char*>(__s1), __n); }
-
- using ::strpbrk;
-
- inline char*
- strpbrk(char* __s1, const char* __s2)
- { return __builtin_strpbrk(const_cast<const char*>(__s1), __s2); }
-
- using ::strrchr;
-
- inline char*
- strrchr(char* __s1, int __n)
- { return __builtin_strrchr(const_cast<const char*>(__s1), __n); }
-
- using ::strstr;
-
- inline char*
- strstr(char* __s1, const char* __s2)
- { return __builtin_strstr(const_cast<const char*>(__s1), __s2); }
-}
-
-#endif
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-#ifndef __SGI_STL_HEAP_H
-#define __SGI_STL_HEAP_H
-
-#include <concept_checks.h>
-#include <stl_config.h>
-#include <stl_heap.h>
-
-#ifdef __STL_USE_NAMESPACES
-
-using __STD::push_heap;
-using __STD::pop_heap;
-using __STD::make_heap;
-using __STD::sort_heap;
-
-#endif /* __STL_USE_NAMESPACES */
-
-
-#endif /* __SGI_STL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- * Copyright (c) 1997-1999
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-//minimal file to get build to work
-
-#ifdef _CPP_MEMORY
-#error "real STL defined"
-#endif
-
-#ifndef __ANDROID_MEMORY
-#define __ANDROID_MEMORY
-//we good to do this?
-#define __STL_MEMBER_TEMPLATES
-
-#define __STL_NOTHROW
-
-/*#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \*/
-
-#if defined(__STL_MEMBER_TEMPLATES)
-template<class _Tp1> struct auto_ptr_ref {
- _Tp1* _M_ptr;
- auto_ptr_ref(_Tp1* __p) : _M_ptr(__p) {}
-};
-#endif
-
-namespace std {
-
-template <class _Tp> class auto_ptr {
-private:
- _Tp* _M_ptr;
-
-public:
- typedef _Tp element_type;
-
- explicit auto_ptr(_Tp* __p = 0) __STL_NOTHROW : _M_ptr(__p) {}
- auto_ptr(auto_ptr& __a) __STL_NOTHROW : _M_ptr(__a.release()) {}
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Tp1> auto_ptr(auto_ptr<_Tp1>& __a) __STL_NOTHROW
- : _M_ptr(__a.release()) {}
-#endif /* __STL_MEMBER_TEMPLATES */
-
- auto_ptr& operator=(auto_ptr& __a) __STL_NOTHROW {
- if (&__a != this) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
-
-#ifdef __STL_MEMBER_TEMPLATES
- template <class _Tp1>
- auto_ptr& operator=(auto_ptr<_Tp1>& __a) __STL_NOTHROW {
- if (__a.get() != this->get()) {
- delete _M_ptr;
- _M_ptr = __a.release();
- }
- return *this;
- }
-#endif /* __STL_MEMBER_TEMPLATES */
-
- // Note: The C++ standard says there is supposed to be an empty throw
- // specification here, but omitting it is standard conforming. Its
- // presence can be detected only if _Tp::~_Tp() throws, but (17.4.3.6/2)
- // this is prohibited.
- ~auto_ptr() { delete _M_ptr; }
-
- _Tp& operator*() const __STL_NOTHROW {
- return *_M_ptr;
- }
- _Tp* operator->() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* get() const __STL_NOTHROW {
- return _M_ptr;
- }
- _Tp* release() __STL_NOTHROW {
- _Tp* __tmp = _M_ptr;
- _M_ptr = 0;
- return __tmp;
- }
- void reset(_Tp* __p = 0) __STL_NOTHROW {
- if (__p != _M_ptr) {
- delete _M_ptr;
- _M_ptr = __p;
- }
- }
-
-/*#if defined(__SGI_STL_USE_AUTO_PTR_CONVERSIONS) && \*/
-#if defined(__STL_MEMBER_TEMPLATES)
-
-public:
- auto_ptr(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW
- : _M_ptr(__ref._M_ptr) {}
-
- auto_ptr& operator=(auto_ptr_ref<_Tp> __ref) __STL_NOTHROW {
- if (__ref._M_ptr != this->get()) {
- delete _M_ptr;
- _M_ptr = __ref._M_ptr;
- }
- return *this;
- }
-
- template <class _Tp1> operator auto_ptr_ref<_Tp1>() __STL_NOTHROW
- { return auto_ptr_ref<_Tp1>(this->release()); }
- template <class _Tp1> operator auto_ptr<_Tp1>() __STL_NOTHROW
- { return auto_ptr<_Tp1>(this->release()); }
-
-#endif /* auto ptr conversions && member templates */
-
-};
-
-} //namespace std
-
-#endif /* __ANDROID_MEMORY */
-
-
-// Local Variables:
-// mode:C++
-// End:
-
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * Copyright (c) 1997
- * Silicon Graphics
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- */
-
-#ifndef __STL_CONFIG_H
-# define __STL_CONFIG_H
-
-// Flags:
-// * __STL_NO_BOOL: defined if the compiler doesn't have bool as a builtin
-// type.
-// * __STL_HAS_WCHAR_T: defined if the compier has wchar_t as a builtin type.
-// * __STL_NO_DRAND48: defined if the compiler doesn't have the drand48
-// function.
-// * __STL_STATIC_TEMPLATE_MEMBER_BUG: defined if the compiler can't handle
-// static members of template classes.
-// * __STL_STATIC_CONST_INIT_BUG: defined if the compiler can't handle a
-// constant-initializer in the declaration of a static const data member
-// of integer type. (See section 9.4.2, paragraph 4, of the C++ standard.)
-// * __STL_CLASS_PARTIAL_SPECIALIZATION: defined if the compiler supports
-// partial specialization of template classes.
-// * __STL_PARTIAL_SPECIALIZATION_SYNTAX: defined if the compiler
-// supports partial specialization syntax for full specialization of
-// class templates. (Even if it doesn't actually support partial
-// specialization itself.)
-// * __STL_FUNCTION_TMPL_PARTIAL_ORDER: defined if the compiler supports
-// partial ordering of function templates. (a.k.a partial specialization
-// of function templates.)
-// * __STL_MEMBER_TEMPLATES: defined if the compiler supports template
-// member functions of classes.
-// * __STL_MEMBER_TEMPLATE_CLASSES: defined if the compiler supports
-// nested classes that are member templates of other classes.
-// * __STL_TEMPLATE_FRIENDS: defined if the compiler supports templatized
-// friend declarations.
-// * __STL_EXPLICIT_FUNCTION_TMPL_ARGS: defined if the compiler
-// supports calling a function template by providing its template
-// arguments explicitly.
-// * __STL_LIMITED_DEFAULT_TEMPLATES: defined if the compiler is unable
-// to handle default template parameters that depend on previous template
-// parameters.
-// * __STL_NON_TYPE_TMPL_PARAM_BUG: defined if the compiler has trouble with
-// function template argument deduction for non-type template parameters.
-// * __SGI_STL_NO_ARROW_OPERATOR: defined if the compiler is unable
-// to support the -> operator for iterators.
-// * __STL_DEFAULT_CONSTRUCTOR_BUG: defined if T() does not work properly
-// when T is a builtin type.
-// * __STL_USE_EXCEPTIONS: defined if the compiler (in the current compilation
-// mode) supports exceptions.
-// * __STL_USE_NAMESPACES: defined if the compiler has the necessary
-// support for namespaces.
-// * __STL_NO_EXCEPTION_HEADER: defined if the compiler does not have a
-// standard-conforming header <exception>.
-// * __STL_NO_BAD_ALLOC: defined if the compiler does not have a <new>
-// header, or if <new> does not contain a bad_alloc class. If a bad_alloc
-// class exists, it is assumed to be in namespace std.
-// * __STL_SGI_THREADS: defined if this is being compiled for an SGI IRIX
-// system in multithreaded mode, using native SGI threads instead of
-// pthreads.
-// * __STL_WIN32THREADS: defined if this is being compiled on a WIN32
-// compiler in multithreaded mode.
-// * __STL_PTHREADS: defined if we should use portable pthreads
-// synchronization.
-// * __STL_UITHREADS: defined if we should use UI / solaris / UnixWare threads
-// synchronization. UIthreads are similar to pthreads, but are based
-// on an earlier version of the Posix threads standard.
-// * __STL_LONG_LONG if the compiler has long long and unsigned long long
-// types. (They're not in the C++ standard, but they are expected to be
-// included in the forthcoming C9X standard.)
-// * __STL_THREADS is defined if thread safety is needed.
-// * __STL_VOLATILE is defined to be "volatile" if threads are being
-// used, and the empty string otherwise.
-// * __STL_USE_CONCEPT_CHECKS enables some extra compile-time error
-// checking to make sure that user-defined template arguments satisfy
-// all of the appropriate requirements. This may result in more
-// comprehensible error messages. It incurs no runtime overhead. This
-// feature requires member templates and partial specialization.
-// * __STL_NO_USING_CLAUSE_IN_CLASS: The compiler does not handle "using"
-// clauses inside of class definitions.
-// * __STL_NO_FRIEND_TEMPLATE_CLASS: The compiler does not handle friend
-// declaractions where the friend is a template class.
-// * __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE: The compiler does not
-// support the use of a function pointer type as the argument
-// for a template.
-// * __STL_MEMBER_TEMPLATE_KEYWORD: standard C++ requires the template
-// keyword in a few new places (14.2.4). This flag is set for
-// compilers that support (and require) this usage.
-
-
-// User-settable macros that control compilation:
-// * __STL_USE_SGI_ALLOCATORS: if defined, then the STL will use older
-// SGI-style allocators, instead of standard-conforming allocators,
-// even if the compiler supports all of the language features needed
-// for standard-conforming allocators.
-// * __STL_NO_NAMESPACES: if defined, don't put the library in namespace
-// std, even if the compiler supports namespaces.
-// * __STL_NO_RELOPS_NAMESPACE: if defined, don't put the relational
-// operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
-// if the compiler supports namespaces and partial ordering of
-// function templates.
-// * __STL_ASSERTIONS: if defined, then enable runtime checking through the
-// __stl_assert macro.
-// * _PTHREADS: if defined, use Posix threads for multithreading support.
-// * _UITHREADS:if defined, use SCO/Solaris/UI threads for multithreading
-// support
-// * _NOTHREADS: if defined, don't use any multithreading support.
-// * _STL_NO_CONCEPT_CHECKS: if defined, disables the error checking that
-// we get from __STL_USE_CONCEPT_CHECKS.
-// * __STL_USE_NEW_IOSTREAMS: if defined, then the STL will use new,
-// standard-conforming iostreams (e.g. the <iosfwd> header). If not
-// defined, the STL will use old cfront-style iostreams (e.g. the
-// <iostream.h> header).
-
-// Other macros defined by this file:
-
-// * bool, true, and false, if __STL_NO_BOOL is defined.
-// * typename, as a null macro if it's not already a keyword.
-// * explicit, as a null macro if it's not already a keyword.
-// * namespace-related macros (__STD, __STL_BEGIN_NAMESPACE, etc.)
-// * exception-related macros (__STL_TRY, __STL_UNWIND, etc.)
-// * __stl_assert, either as a test or as a null macro, depending on
-// whether or not __STL_ASSERTIONS is defined.
-
-# if defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_PTHREADS
-# endif
-
-# if defined(_UITHREADS) && !defined(_PTHREADS) && !defined(_NOTHREADS)
-# define __STL_UITHREADS
-# endif
-
-# if defined(__sgi) && !defined(__GNUC__)
-# include <standards.h>
-# if !defined(_BOOL)
-# define __STL_NO_BOOL
-# endif
-# if defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32
-# define __STL_STATIC_CONST_INIT_BUG
-# endif
-# if defined(_WCHAR_T_IS_KEYWORD)
-# define __STL_HAS_WCHAR_T
-# endif
-# if !defined(_TYPENAME_IS_KEYWORD)
-# define __STL_NEED_TYPENAME
-# endif
-# ifdef _PARTIAL_SPECIALIZATION_OF_CLASS_TEMPLATES
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# endif
-# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# endif
-# ifdef _MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# endif
-# if defined(_MEMBER_TEMPLATE_KEYWORD)
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# endif
-# if (_COMPILER_VERSION >= 730) && defined(_MIPS_SIM) && _MIPS_SIM != _ABIO32
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# endif
-# if COMPILER_VERSION < 720 || (defined(_MIPS_SIM) && _MIPS_SIM == _ABIO32)
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# endif
-# if !defined(_EXPLICIT_IS_KEYWORD)
-# define __STL_NEED_EXPLICIT
-# endif
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES)
-# define __STL_HAS_NAMESPACES
-# endif
-# if (_COMPILER_VERSION < 721) || \
- !defined(__STL_HAS_NAMESPACES) || defined(__STL_NO_NAMESPACES)
-# define __STL_NO_EXCEPTION_HEADER
-# endif
-# if _COMPILER_VERSION < 730 || !defined(_STANDARD_C_PLUS_PLUS) || \
- !defined(_NAMESPACES)
-# define __STL_NO_BAD_ALLOC
-# endif
-# if !defined(_NOTHREADS) && !defined(__STL_PTHREADS)
-# define __STL_SGI_THREADS
-# endif
-# if defined(_LONGLONG) && defined(_SGIAPI) && _SGIAPI
-# define __STL_LONG_LONG
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_USE_NEW_IOSTREAMS
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __STL_CAN_THROW_RANGE_ERRORS
-# endif
-# if _COMPILER_VERSION >= 730 && defined(_STANDARD_C_PLUS_PLUS)
-# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-# endif
-# endif
-
-
-/*
- * Jochen Schlick '1999 - added new #defines (__STL)_UITHREADS (for
- * providing SCO / Solaris / UI thread support)
- * - added the necessary defines for the SCO UDK 7
- * compiler (and its template friend behavior)
- * - all UDK7 specific STL changes are based on the
- * macro __USLC__ being defined
- */
-// SCO UDK 7 compiler (UnixWare 7x, OSR 5, UnixWare 2x)
-# if defined(__USLC__)
-# define __STL_HAS_WCHAR_T
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_USE_EXCEPTIONS
-# define __STL_HAS_NAMESPACES
-# define __STL_USE_NAMESPACES
-# define __STL_LONG_LONG
-# if defined(_REENTRANT)
-# define _UITHREADS /* if UnixWare < 7.0.1 */
-# define __STL_UITHREADS
-// use the following defines instead of the UI threads defines when
-// you want to use POSIX threads
-//# define _PTHREADS /* only if UnixWare >=7.0.1 */
-//# define __STL_PTHREADS
-# endif
-# endif
-
-
-
-# ifdef __GNUC__
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 7
-# define __STL_STATIC_TEMPLATE_MEMBER_BUG
-# endif
-# if __GNUC__ < 2
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ <= 8
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
-# if __GNUC__ == 2 && __GNUC_MINOR__ >= 8 || __GNUC__ > 2
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_MEMBER_TEMPLATES
-# define __STL_CAN_THROW_RANGE_ERRORS
- // g++ 2.8.1 supports member template functions, but not member
- // template nested classes.
-# if __GNUC_MINOR__ >= 9 || __GNUC__ > 2
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __SGI_STL_USE_AUTO_PTR_CONVERSIONS
-# define __STL_HAS_NAMESPACES
-//# define __STL_USE_NEW_IOSTREAMS
-# endif
-# endif
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# ifdef __EXCEPTIONS
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _REENTRANT
-# define __STL_PTHREADS
-# endif
-# if (__GNUC__ < 2) || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
-# define __STL_NO_FUNCTION_PTR_IN_CLASS_TEMPLATE
-# endif
-# endif
-
-# if defined(__SUNPRO_CC)
-# define __STL_NO_BOOL
-# define __STL_NEED_TYPENAME
-# define __STL_NEED_EXPLICIT
-# define __STL_USE_EXCEPTIONS
-# ifdef _REENTRANT
-# define __STL_PTHREADS
-# endif
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
-
-# if defined(__COMO__)
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_USE_EXCEPTIONS
-# define __STL_HAS_NAMESPACES
-# endif
-
-// Intel compiler, which uses the EDG front end.
-# if defined(__ICL)
-# define __STL_LONG_LONG
-# define __STL_MEMBER_TEMPLATES
-# define __STL_MEMBER_TEMPLATE_CLASSES
-# define __STL_TEMPLATE_FRIENDS
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_NO_DRAND48
-# define __STL_HAS_NAMESPACES
-# define __STL_USE_EXCEPTIONS
-# define __STL_MEMBER_TEMPLATE_KEYWORD
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-// Mingw32, egcs compiler using the Microsoft C runtime
-# if defined(__MINGW32__)
-# define __STL_NO_DRAND48
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-// Cygwin32, egcs compiler on MS Windows
-# if defined(__CYGWIN__)
-# define __STL_NO_DRAND48
-# endif
-
-
-
-// Microsoft compiler.
-# if defined(_MSC_VER) && !defined(__ICL) && !defined(__MWERKS__)
-# define __STL_NO_DRAND48
-# define __STL_STATIC_CONST_INIT_BUG
-# define __STL_NEED_TYPENAME
-# define __STL_NO_USING_CLAUSE_IN_CLASS
-# define __STL_NO_FRIEND_TEMPLATE_CLASS
-# if _MSC_VER < 1100 /* 1000 is version 4.0, 1100 is 5.0, 1200 is 6.0. */
-# define __STL_NEED_EXPLICIT
-# define __STL_NO_BOOL
-# define __STL_NO_BAD_ALLOC
-# endif
-# if _MSC_VER > 1000
-# include <yvals.h>
-# define __STL_DONT_USE_BOOL_TYPEDEF
-# endif
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef _MT
-# define __STL_WIN32THREADS
-# endif
-# if _MSC_VER >= 1200
-# define __STL_PARTIAL_SPECIALIZATION_SYNTAX
-# define __STL_HAS_NAMESPACES
-# define __STL_CAN_THROW_RANGE_ERRORS
-# define NOMINMAX
-# undef min
-# undef max
-// disable warning 'initializers put in unrecognized initialization area'
-# pragma warning ( disable : 4075 )
-// disable warning 'empty controlled statement found'
-# pragma warning ( disable : 4390 )
-// disable warning 'debug symbol greater than 255 chars'
-# pragma warning ( disable : 4786 )
-# endif
-# if _MSC_VER < 1100
-# define __STL_NO_EXCEPTION_HEADER
-# define __STL_NO_BAD_ALLOC
-# endif
- // Because of a Microsoft front end bug, we must not provide a
- // namespace qualifier when declaring a friend function.
-# define __STD_QUALIFIER
-# endif
-
-# if defined(__BORLANDC__)
-# define __STL_NO_BAD_ALLOC
-# define __STL_NO_DRAND48
-# define __STL_DEFAULT_CONSTRUCTOR_BUG
-# if __BORLANDC__ >= 0x540 /* C++ Builder 4.0 */
-# define __STL_CLASS_PARTIAL_SPECIALIZATION
-# define __STL_FUNCTION_TMPL_PARTIAL_ORDER
-# define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_MEMBER_TEMPLATES
-# define __STL_TEMPLATE_FRIENDS
-# else
-# define __STL_NEED_TYPENAME
-# define __STL_LIMITED_DEFAULT_TEMPLATES
-# define __SGI_STL_NO_ARROW_OPERATOR
-# define __STL_NON_TYPE_TMPL_PARAM_BUG
-# endif
-# ifdef _CPPUNWIND
-# define __STL_USE_EXCEPTIONS
-# endif
-# ifdef __MT__
-# define __STL_WIN32THREADS
-# endif
-# endif
-
-# if defined(__STL_NO_BOOL) && !defined(__STL_DONT_USE_BOOL_TYPEDEF)
- typedef int bool;
-# define true 1
-# define false 0
-# endif
-
-# ifdef __STL_NEED_TYPENAME
-# define typename
-# endif
-
-# ifdef __STL_LIMITED_DEFAULT_TEMPLATES
-# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp)
-# else
-# define __STL_DEPENDENT_DEFAULT_TMPL(_Tp) = _Tp
-# endif
-
-# ifdef __STL_MEMBER_TEMPLATE_KEYWORD
-# define __STL_TEMPLATE template
-# else
-# define __STL_TEMPLATE
-# endif
-
-# ifdef __STL_NEED_EXPLICIT
-# define explicit
-# endif
-
-# ifdef __STL_EXPLICIT_FUNCTION_TMPL_ARGS
-# define __STL_NULL_TMPL_ARGS <>
-# else
-# define __STL_NULL_TMPL_ARGS
-# endif
-
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- || defined (__STL_PARTIAL_SPECIALIZATION_SYNTAX)
-# define __STL_TEMPLATE_NULL template<>
-# else
-# define __STL_TEMPLATE_NULL
-# endif
-
-// Use standard-conforming allocators if we have the necessary language
-// features. __STL_USE_SGI_ALLOCATORS is a hook so that users can
-// disable new-style allocators, and continue to use the same kind of
-// allocators as before, without having to edit library headers.
-# if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && \
- defined(__STL_MEMBER_TEMPLATES) && \
- defined(__STL_MEMBER_TEMPLATE_CLASSES) && \
- !defined(__STL_NO_BOOL) && \
- !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) && \
- !defined(__STL_LIMITED_DEFAULT_TEMPLATES) && \
- !defined(__STL_USE_SGI_ALLOCATORS)
-# define __STL_USE_STD_ALLOCATORS
-# endif
-
-# ifndef __STL_DEFAULT_ALLOCATOR
-# ifdef __STL_USE_STD_ALLOCATORS
-# define __STL_DEFAULT_ALLOCATOR(T) allocator< T >
-# else
-# define __STL_DEFAULT_ALLOCATOR(T) alloc
-# endif
-# endif
-
-// __STL_NO_NAMESPACES is a hook so that users can disable namespaces
-// without having to edit library headers. __STL_NO_RELOPS_NAMESPACE is
-// a hook so that users can disable the std::rel_ops namespace, keeping
-// the relational operator template in namespace std, without having to
-// edit library headers.
-# if defined(__STL_HAS_NAMESPACES) && !defined(__STL_NO_NAMESPACES)
-# define __STL_USE_NAMESPACES
-# define __STD std
-# define __STL_BEGIN_NAMESPACE namespace std {
-# define __STL_END_NAMESPACE }
-# if defined(__STL_FUNCTION_TMPL_PARTIAL_ORDER) && \
- !defined(__STL_NO_RELOPS_NAMESPACE)
-# define __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE namespace std { namespace rel_ops {
-# define __STL_END_RELOPS_NAMESPACE } }
-# define __STD_RELOPS std::rel_ops
-# else /* Use std::rel_ops namespace */
-# define __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE namespace std {
-# define __STL_END_RELOPS_NAMESPACE }
-# define __STD_RELOPS std
-# endif /* Use std::rel_ops namespace */
-# else
-# define __STD
-# define __STL_BEGIN_NAMESPACE
-# define __STL_END_NAMESPACE
-# undef __STL_USE_NAMESPACE_FOR_RELOPS
-# define __STL_BEGIN_RELOPS_NAMESPACE
-# define __STL_END_RELOPS_NAMESPACE
-# define __STD_RELOPS
-# undef __STL_USE_NAMESPACES
-# endif
-
-// Some versions of the EDG front end sometimes require an explicit
-// namespace spec where they shouldn't. This macro facilitates that.
-// If the bug becomes irrelevant, then all uses of __STD_QUALIFIER
-// should be removed. The 7.3 beta SGI compiler has this bug, but the
-// MR version is not expected to have it.
-
-# if defined(__STL_USE_NAMESPACES) && !defined(__STD_QUALIFIER)
-# define __STD_QUALIFIER std::
-# else
-# define __STD_QUALIFIER
-# endif
-
-# ifdef __STL_USE_EXCEPTIONS
-# define __STL_TRY try
-# define __STL_CATCH_ALL catch(...)
-# define __STL_THROW(x) throw x
-# define __STL_RETHROW throw
-# define __STL_NOTHROW throw()
-# define __STL_UNWIND(action) catch(...) { action; throw; }
-# else
-# define __STL_TRY
-# define __STL_CATCH_ALL if (false)
-# define __STL_THROW(x)
-# define __STL_RETHROW
-# define __STL_NOTHROW
-# define __STL_UNWIND(action)
-# endif
-
-#ifdef __STL_ASSERTIONS
-# include <stdio.h>
-# define __stl_assert(expr) \
- if (!(expr)) { fprintf(stderr, "%s:%d STL assertion failure: %s\n", \
- __FILE__, __LINE__, # expr); abort(); }
-#else
-# define __stl_assert(expr)
-#endif
-
-#if defined(__STL_WIN32THREADS) || defined(__STL_SGI_THREADS) \
- || defined(__STL_PTHREADS) || defined(__STL_UITHREADS)
-# define __STL_THREADS
-# define __STL_VOLATILE volatile
-#else
-# define __STL_VOLATILE
-#endif
-
-#if defined(__STL_CLASS_PARTIAL_SPECIALIZATION) \
- && defined(__STL_MEMBER_TEMPLATES) \
- && !defined(_STL_NO_CONCEPT_CHECKS)
-# define __STL_USE_CONCEPT_CHECKS
-#endif
-
-
-#endif /* __STL_CONFIG_H */
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- * Copyright (c) 1997
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_HEAP_H
-#define __SGI_STL_INTERNAL_HEAP_H
-
-__STL_BEGIN_NAMESPACE
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1209
-#endif
-
-// Heap-manipulation functions: push_heap, pop_heap, make_heap, sort_heap.
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__push_heap(_RandomAccessIterator __first,
- _Distance __holeIndex, _Distance __topIndex, _Tp __value)
-{
- _Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex && *(__first + __parent) < __value) {
- *(__first + __holeIndex) = *(__first + __parent);
- __holeIndex = __parent;
- __parent = (__holeIndex - 1) / 2;
- }
- *(__first + __holeIndex) = __value;
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-inline void
-__push_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Distance*, _Tp*)
-{
- __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
- _Tp(*(__last - 1)));
-}
-
-template <class _RandomAccessIterator>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __push_heap_aux(__first, __last,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp,
- class _Compare>
-void
-__push_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __topIndex, _Tp __value, _Compare __comp)
-{
- _Distance __parent = (__holeIndex - 1) / 2;
- while (__holeIndex > __topIndex && __comp(*(__first + __parent), __value)) {
- *(__first + __holeIndex) = *(__first + __parent);
- __holeIndex = __parent;
- __parent = (__holeIndex - 1) / 2;
- }
- *(__first + __holeIndex) = __value;
-}
-
-template <class _RandomAccessIterator, class _Compare,
- class _Distance, class _Tp>
-inline void
-__push_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp,
- _Distance*, _Tp*)
-{
- __push_heap(__first, _Distance((__last - __first) - 1), _Distance(0),
- _Tp(*(__last - 1)), __comp);
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __push_heap_aux(__first, __last, __comp,
- __DISTANCE_TYPE(__first), __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance, class _Tp>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value)
-{
- _Distance __topIndex = __holeIndex;
- _Distance __secondChild = 2 * __holeIndex + 2;
- while (__secondChild < __len) {
- if (*(__first + __secondChild) < *(__first + (__secondChild - 1)))
- __secondChild--;
- *(__first + __holeIndex) = *(__first + __secondChild);
- __holeIndex = __secondChild;
- __secondChild = 2 * (__secondChild + 1);
- }
- if (__secondChild == __len) {
- *(__first + __holeIndex) = *(__first + (__secondChild - 1));
- __holeIndex = __secondChild - 1;
- }
- __push_heap(__first, __holeIndex, __topIndex, __value);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first), __value);
-}
-
-template <class _RandomAccessIterator, class _Tp>
-inline void
-__pop_heap_aux(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Tp*)
-{
- __pop_heap(__first, __last - 1, __last - 1,
- _Tp(*(__last - 1)), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator>
-inline void pop_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __pop_heap_aux(__first, __last, __VALUE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Distance,
- class _Tp, class _Compare>
-void
-__adjust_heap(_RandomAccessIterator __first, _Distance __holeIndex,
- _Distance __len, _Tp __value, _Compare __comp)
-{
- _Distance __topIndex = __holeIndex;
- _Distance __secondChild = 2 * __holeIndex + 2;
- while (__secondChild < __len) {
- if (__comp(*(__first + __secondChild), *(__first + (__secondChild - 1))))
- __secondChild--;
- *(__first + __holeIndex) = *(__first + __secondChild);
- __holeIndex = __secondChild;
- __secondChild = 2 * (__secondChild + 1);
- }
- if (__secondChild == __len) {
- *(__first + __holeIndex) = *(__first + (__secondChild - 1));
- __holeIndex = __secondChild - 1;
- }
- __push_heap(__first, __holeIndex, __topIndex, __value, __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Compare,
- class _Distance>
-inline void
-__pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _RandomAccessIterator __result, _Tp __value, _Compare __comp,
- _Distance*)
-{
- *__result = *__first;
- __adjust_heap(__first, _Distance(0), _Distance(__last - __first),
- __value, __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Compare>
-inline void
-__pop_heap_aux(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Tp*, _Compare __comp)
-{
- __pop_heap(__first, __last - 1, __last - 1, _Tp(*(__last - 1)), __comp,
- __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-pop_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __pop_heap_aux(__first, __last, __VALUE_TYPE(__first), __comp);
-}
-
-template <class _RandomAccessIterator, class _Tp, class _Distance>
-void
-__make_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Tp*, _Distance*)
-{
- if (__last - __first < 2) return;
- _Distance __len = __last - __first;
- _Distance __parent = (__len - 2)/2;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)));
- if (__parent == 0) return;
- __parent--;
- }
-}
-
-template <class _RandomAccessIterator>
-inline void
-make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- __make_heap(__first, __last,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator, class _Compare,
- class _Tp, class _Distance>
-void
-__make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
- _Compare __comp, _Tp*, _Distance*)
-{
- if (__last - __first < 2) return;
- _Distance __len = __last - __first;
- _Distance __parent = (__len - 2)/2;
-
- while (true) {
- __adjust_heap(__first, __parent, __len, _Tp(*(__first + __parent)),
- __comp);
- if (__parent == 0) return;
- __parent--;
- }
-}
-
-template <class _RandomAccessIterator, class _Compare>
-inline void
-make_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __make_heap(__first, __last, __comp,
- __VALUE_TYPE(__first), __DISTANCE_TYPE(__first));
-}
-
-template <class _RandomAccessIterator>
-void sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- __STL_REQUIRES(typename iterator_traits<_RandomAccessIterator>::value_type,
- _LessThanComparable);
- while (__last - __first > 1)
- pop_heap(__first, __last--);
-}
-
-template <class _RandomAccessIterator, class _Compare>
-void
-sort_heap(_RandomAccessIterator __first,
- _RandomAccessIterator __last, _Compare __comp)
-{
- __STL_REQUIRES(_RandomAccessIterator, _Mutable_RandomAccessIterator);
- while (__last - __first > 1)
- pop_heap(__first, __last--, __comp);
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1209
-#endif
-
-__STL_END_NAMESPACE
-
-#endif /* __SGI_STL_INTERNAL_HEAP_H */
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- *
- * Copyright 2009, The Android Open Source Project
- * Copyright (c) 1994
- * Hewlett-Packard Company
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Hewlett-Packard Company makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- *
- *
- * Copyright (c) 1996-1998
- * Silicon Graphics Computer Systems, Inc.
- *
- * Permission to use, copy, modify, distribute and sell this software
- * and its documentation for any purpose is hereby granted without fee,
- * provided that the above copyright notice appear in all copies and
- * that both that copyright notice and this permission notice appear
- * in supporting documentation. Silicon Graphics makes no
- * representations about the suitability of this software for any
- * purpose. It is provided "as is" without express or implied warranty.
- */
-
-/* NOTE: This is an internal header file, included by other STL headers.
- * You should not attempt to use it directly.
- */
-
-#ifndef __SGI_STL_INTERNAL_ITERATOR_BASE_H
-#define __SGI_STL_INTERNAL_ITERATOR_BASE_H
-
-// This file contains all of the general iterator-related utilities.
-// The internal file stl_iterator.h contains predefined iterators,
-// such as front_insert_iterator and istream_iterator.
-
-#include <concept_checks.h>
-
-struct input_iterator_tag {};
-struct output_iterator_tag {};
-struct forward_iterator_tag : public input_iterator_tag {};
-struct bidirectional_iterator_tag : public forward_iterator_tag {};
-struct random_access_iterator_tag : public bidirectional_iterator_tag {};
-
-// The base classes input_iterator, output_iterator, forward_iterator,
-// bidirectional_iterator, and random_access_iterator are not part of
-// the C++ standard. (They have been replaced by struct iterator.)
-// They are included for backward compatibility with the HP STL.
-
-template <class _Tp, class _Distance> struct input_iterator {
- typedef input_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-struct output_iterator {
- typedef output_iterator_tag iterator_category;
- typedef void value_type;
- typedef void difference_type;
- typedef void pointer;
- typedef void reference;
-};
-
-template <class _Tp, class _Distance> struct forward_iterator {
- typedef forward_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-
-template <class _Tp, class _Distance> struct bidirectional_iterator {
- typedef bidirectional_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp, class _Distance> struct random_access_iterator {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Category, class _Tp, class _Distance = ptrdiff_t,
- class _Pointer = _Tp*, class _Reference = _Tp&>
-struct iterator {
- typedef _Category iterator_category;
- typedef _Tp value_type;
- typedef _Distance difference_type;
- typedef _Pointer pointer;
- typedef _Reference reference;
-};
-
-template <class _Iterator>
-struct iterator_traits {
- typedef typename _Iterator::iterator_category iterator_category;
- typedef typename _Iterator::value_type value_type;
- typedef typename _Iterator::difference_type difference_type;
- typedef typename _Iterator::pointer pointer;
- typedef typename _Iterator::reference reference;
-};
-
-template <class _Tp>
-struct iterator_traits<_Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
- typedef _Tp& reference;
-};
-
-template <class _Tp>
-struct iterator_traits<const _Tp*> {
- typedef random_access_iterator_tag iterator_category;
- typedef _Tp value_type;
- typedef ptrdiff_t difference_type;
- typedef const _Tp* pointer;
- typedef const _Tp& reference;
-};
-
-// The overloaded functions iterator_category, distance_type, and
-// value_type are not part of the C++ standard. (They have been
-// replaced by struct iterator_traits.) They are included for
-// backward compatibility with the HP STL.
-
-// We introduce internal names for these functions.
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-__iterator_category(const _Iter&)
-{
- typedef typename iterator_traits<_Iter>::iterator_category _Category;
- return _Category();
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-__distance_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::difference_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-__value_type(const _Iter&)
-{
- return static_cast<typename iterator_traits<_Iter>::value_type*>(0);
-}
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::iterator_category
-iterator_category(const _Iter& __i) { return __iterator_category(__i); }
-
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::difference_type*
-distance_type(const _Iter& __i) { return __distance_type(__i); }
-
-template <class _Iter>
-inline typename iterator_traits<_Iter>::value_type*
-value_type(const _Iter& __i) { return __value_type(__i); }
-
-#define __ITERATOR_CATEGORY(__i) __iterator_category(__i)
-#define __DISTANCE_TYPE(__i) __distance_type(__i)
-#define __VALUE_TYPE(__i) __value_type(__i)
-
-template <class _InputIterator, class _Distance>
-inline void __distance(_InputIterator __first, _InputIterator __last,
- _Distance& __n, input_iterator_tag)
-{
- while (__first != __last) { ++__first; ++__n; }
-}
-
-template <class _RandomAccessIterator, class _Distance>
-inline void __distance(_RandomAccessIterator __first,
- _RandomAccessIterator __last,
- _Distance& __n, random_access_iterator_tag)
-{
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- __n += __last - __first;
-}
-
-template <class _InputIterator, class _Distance>
-inline void distance(_InputIterator __first,
- _InputIterator __last, _Distance& __n)
-{
- __STL_REQUIRES(_InputIterator, _InputIterator);
- __distance(__first, __last, __n, iterator_category(__first));
-}
-
-#ifdef __STL_CLASS_PARTIAL_SPECIALIZATION
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-__distance(_InputIterator __first, _InputIterator __last, input_iterator_tag)
-{
- typename iterator_traits<_InputIterator>::difference_type __n = 0;
- while (__first != __last) {
- ++__first; ++__n;
- }
- return __n;
-}
-
-template <class _RandomAccessIterator>
-inline typename iterator_traits<_RandomAccessIterator>::difference_type
-__distance(_RandomAccessIterator __first, _RandomAccessIterator __last,
- random_access_iterator_tag) {
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- return __last - __first;
-}
-
-template <class _InputIterator>
-inline typename iterator_traits<_InputIterator>::difference_type
-distance(_InputIterator __first, _InputIterator __last) {
- typedef typename iterator_traits<_InputIterator>::iterator_category
- _Category;
- __STL_REQUIRES(_InputIterator, _InputIterator);
- return __distance(__first, __last, _Category());
-}
-
-#endif /* __STL_CLASS_PARTIAL_SPECIALIZATION */
-
-template <class _InputIter, class _Distance>
-inline void __advance(_InputIter& __i, _Distance __n, input_iterator_tag) {
- while (__n--) ++__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma set woff 1183
-#endif
-
-template <class _BidirectionalIterator, class _Distance>
-inline void __advance(_BidirectionalIterator& __i, _Distance __n,
- bidirectional_iterator_tag) {
- __STL_REQUIRES(_BidirectionalIterator, _BidirectionalIterator);
- if (__n >= 0)
- while (__n--) ++__i;
- else
- while (__n++) --__i;
-}
-
-#if defined(__sgi) && !defined(__GNUC__) && (_MIPS_SIM != _MIPS_SIM_ABI32)
-#pragma reset woff 1183
-#endif
-
-template <class _RandomAccessIterator, class _Distance>
-inline void __advance(_RandomAccessIterator& __i, _Distance __n,
- random_access_iterator_tag) {
- __STL_REQUIRES(_RandomAccessIterator, _RandomAccessIterator);
- __i += __n;
-}
-
-template <class _InputIterator, class _Distance>
-inline void advance(_InputIterator& __i, _Distance __n) {
- __STL_REQUIRES(_InputIterator, _InputIterator);
- __advance(__i, __n, iterator_category(__i));
-}
-
-#endif /* __SGI_STL_INTERNAL_ITERATOR_BASE_H */
-
-
-
-// Local Variables:
-// mode:C++
-// End:
+++ /dev/null
-/*
- * Copyright 2007, 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 APPLE COMPUTER, INC. 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.
- */
-
+2009-12-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=32499
+ Add client based Geolocation provider
+
+ Add first cut of a client based Geolocation provider. This is guarded by
+ ENABLE(CLIENT_BASED_GEOLOCATION) and is off by default for now. This adds a
+ GeolocationControllerClient interface that no-one currently implements,
+ but will in a subsequent patch.
+
+ * src/WebViewImpl.cpp:
+ (WebKit::WebViewImpl::WebViewImpl):
+
2009-12-10 Mike Belshe <mike@belshe.com>
Unreviewed, build fix for chromium.
&m_editorClientImpl,
&m_dragClientImpl,
&m_inspectorClientImpl,
+ 0,
0));
m_page->backForwardList()->setClient(&m_backForwardListClientImpl);
+2009-12-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=32499
+ Add client based Geolocation provider
+
+ Add first cut of a client based Geolocation provider. This is guarded by
+ ENABLE(CLIENT_BASED_GEOLOCATION) and is off by default for now. This adds a
+ GeolocationControllerClient interface that no-one currently implements,
+ but will in a subsequent patch.
+
+ * webkit/webkitwebview.cpp:
+ (webkit_web_view_init):
+
2009-12-10 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk>
Reviewed by Xan Lopez.
priv->imContext = gtk_im_multicontext_new();
WebKit::InspectorClient* inspectorClient = new WebKit::InspectorClient(webView);
- priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0);
+ priv->corePage = new Page(new WebKit::ChromeClient(webView), new WebKit::ContextMenuClient(webView), new WebKit::EditorClient(webView), new WebKit::DragClient(webView), inspectorClient, 0, 0);
// We also add a simple wrapper class to provide the public
// interface for the Web Inspector.
* Plugins/Hosted/ProxyInstance.h:
+2009-12-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=32499
+ Add client based Geolocation provider
+
+ Add first cut of a client based Geolocation provider. This is guarded by
+ ENABLE(CLIENT_BASED_GEOLOCATION) and is off by default for now. This adds a
+ GeolocationControllerClient interface that no-one currently implements,
+ but will in a subsequent patch.
+
+ * WebView/WebView.mm:
+ (-[WebView _commonInitializationWithFrameName:groupName:usesDocumentViews:]):
+
2009-12-10 Jon Honeycutt <jhoneycutt@apple.com>
Mac build fix. Unreviewed.
didOneTimeInitialization = true;
}
- _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self));
+ _private->page = new Page(new WebChromeClient(self), new WebContextMenuClient(self), new WebEditorClient(self), new WebDragClient(self), new WebInspectorClient(self), new WebPluginHalterClient(self), 0);
_private->page->settings()->setLocalStorageDatabasePath([[self preferences] _localStorageDatabasePath]);
contextMenuClient = new ContextMenuClientQt();
editorClient = new EditorClientQt(q);
page = new Page(chromeClient, contextMenuClient, editorClient,
- new DragClientQt(q), new InspectorClientQt(q), 0);
+ new DragClientQt(q), new InspectorClientQt(q), 0, 0);
settings = new QWebSettings(page->settings());
* Api/qwebframe.cpp:
+2009-12-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=32499
+ Add client based Geolocation provider
+
+ Add first cut of a client based Geolocation provider. This is guarded by
+ ENABLE(CLIENT_BASED_GEOLOCATION) and is off by default for now. This adds a
+ GeolocationControllerClient interface that no-one currently implements,
+ but will in a subsequent patch.
+
+ * Api/qwebpage.cpp:
+ (QWebPagePrivate::QWebPagePrivate):
+
2009-12-07 Benjamin Poulain <benjamin.poulain@nokia.com>
Reviewed by Kenneth Rohde Christiansen.
+2009-12-13 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Dan Bernstein.
+
+ Fix for https://bugs.webkit.org/show_bug.cgi?id=32499
+ Add client based Geolocation provider
+
+ Add first cut of a client based Geolocation provider. This is guarded by
+ ENABLE(CLIENT_BASED_GEOLOCATION) and is off by default for now. This adds a
+ GeolocationControllerClient interface that no-one currently implements,
+ but will in a subsequent patch.
+
+ * WebView.cpp:
+ (WebView::initWithFrame):
+
2009-12-10 Jon Honeycutt <jhoneycutt@apple.com>
Pass more information about a plug-in to the PluginHalterDelegate
if (SUCCEEDED(m_preferences->shouldUseHighResolutionTimers(&useHighResolutionTimer)))
Settings::setShouldUseHighResolutionTimers(useHighResolutionTimer);
- m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this));
+ m_page = new Page(new WebChromeClient(this), new WebContextMenuClient(this), new WebEditorClient(this), new WebDragClient(this), new WebInspectorClient(this), new WebPluginHalterClient(this), 0);
BSTR localStoragePath;
if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) {