summaryrefslogtreecommitdiffstats
path: root/WebKit/android
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android')
-rw-r--r--WebKit/android/RenderSkinCombo.cpp61
-rw-r--r--WebKit/android/RenderSkinCombo.h20
-rw-r--r--WebKit/android/jni/JavaBridge.cpp17
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp42
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.h4
-rw-r--r--WebKit/android/jni/WebCoreJni.cpp12
-rw-r--r--WebKit/android/jni/WebCoreJni.h6
-rw-r--r--WebKit/android/jni/WebCoreResourceLoader.cpp9
-rw-r--r--WebKit/android/jni/WebCoreResourceLoader.h1
-rw-r--r--WebKit/android/jni/WebHistory.cpp12
-rw-r--r--WebKit/android/jni/WebHistory.h2
-rw-r--r--WebKit/android/jni/WebViewCore.cpp49
-rw-r--r--WebKit/android/nav/FindCanvas.h1
-rw-r--r--WebKit/android/nav/WebView.cpp33
14 files changed, 107 insertions, 162 deletions
diff --git a/WebKit/android/RenderSkinCombo.cpp b/WebKit/android/RenderSkinCombo.cpp
index 4fed8d8..902f2c0 100644
--- a/WebKit/android/RenderSkinCombo.cpp
+++ b/WebKit/android/RenderSkinCombo.cpp
@@ -24,69 +24,48 @@
*/
#include "config.h"
+#include "RenderSkinCombo.h"
+
#include "Document.h"
#include "Node.h"
-#include "PlatformGraphicsContext.h"
-#include "RenderSkinCombo.h"
#include "SkCanvas.h"
#include "SkNinePatch.h"
namespace WebCore {
-static const int margin = 2;
-static const SkIRect mar = { margin, margin, RenderSkinCombo::extraWidth(), margin };
-
-SkBitmap RenderSkinCombo::m_bitmap[2];
-bool RenderSkinCombo::m_decoded;
+static SkBitmap s_bitmap[2]; // Collection of assets for a combo box
+static bool s_decoded; // True if all assets were decoded
+static const int s_margin = 2;
+static const SkIRect s_mar = { s_margin, s_margin,
+ RenderSkinCombo::extraWidth(), s_margin };
RenderSkinCombo::RenderSkinCombo()
{
- m_height = 20;
- m_width = 75;
- m_state = kNormal;
- m_bounds.set(0, 0, SkIntToScalar(m_width), SkIntToScalar(m_height));
}
void RenderSkinCombo::Init(android::AssetManager* am)
{
- if (m_decoded)
+ if (s_decoded)
return;
// Maybe short circuiting is fine, since I don't even draw if one state is not decoded properly
// but is that necessary in the final version?
- m_decoded = RenderSkinAndroid::DecodeBitmap(am, "images/combobox-noHighlight.png", &m_bitmap[kNormal]);
- m_decoded = RenderSkinAndroid::DecodeBitmap(am, "images/combobox-disabled.png", &m_bitmap[kDisabled]) && m_decoded;
+ s_decoded = RenderSkinAndroid::DecodeBitmap(am, "images/combobox-noHighlight.png", &s_bitmap[kNormal]);
+ s_decoded = RenderSkinAndroid::DecodeBitmap(am, "images/combobox-disabled.png", &s_bitmap[kDisabled]) && s_decoded;
}
-bool RenderSkinCombo::draw(PlatformGraphicsContext *p)
+bool RenderSkinCombo::Draw(SkCanvas* canvas, Node* element, int x, int y, int width, int height)
{
- // The text is drawn right next to the left side - should I draw the box slightly to the left?
- if (!m_decoded)
- return false;
- SkCanvas* canvas = p->mCanvas;
- SkNinePatch::DrawNine(canvas, m_bounds, m_bitmap[m_state], mar);
- return false;
-}
-
-void RenderSkinCombo::notifyState(Node* element)
-{
- m_state = kDisabled;
- if (!element)
- return;
- if (element->isEnabled())
- m_state = kNormal;
-}
-
-void RenderSkinCombo::setDim(int width, int height)
-{
- if (width != m_width || height != m_height) {
- m_width = width;
- if (height < (margin<<1) + 1)
- height = (margin<<1) + 1;
- else
- m_height = height;
- m_bounds.set(0, 0, SkIntToScalar(m_width), SkIntToScalar(m_height));
+ if (!s_decoded)
+ return true;
+ State state = element && element->isEnabled() ? kNormal : kDisabled;
+ if (height < (s_margin<<1) + 1) {
+ height = (s_margin<<1) + 1;
}
+ SkRect bounds;
+ bounds.set(SkIntToScalar(x), SkIntToScalar(y), SkIntToScalar(x + width), SkIntToScalar(y + height));
+ SkNinePatch::DrawNine(canvas, bounds, s_bitmap[state], s_mar);
+ return false;
}
} //WebCore
diff --git a/WebKit/android/RenderSkinCombo.h b/WebKit/android/RenderSkinCombo.h
index aeea6a0..0970b6b 100644
--- a/WebKit/android/RenderSkinCombo.h
+++ b/WebKit/android/RenderSkinCombo.h
@@ -27,10 +27,10 @@
#define RenderSkinCombo_h
#include "RenderSkinAndroid.h"
-#include "SkBitmap.h"
-#include "SkPaint.h"
#include "SkRect.h"
+class SkCanvas;
+
namespace WebCore {
// This is very similar to RenderSkinButton - maybe they should be the same class?
@@ -45,21 +45,17 @@ public:
*/
static void Init(android::AssetManager*);
- virtual bool draw(PlatformGraphicsContext*);
- virtual void notifyState(Node* element);
- virtual void setDim(int width, int height);
+ /**
+ * Draw the provided Node on the SkCanvas, using the dimensions provided by
+ * x,y,w,h. Return true if we did not draw, and WebKit needs to draw it,
+ * false otherwise.
+ */
+ static bool Draw(SkCanvas* , Node* , int x, int y, int w, int h);
// The image is an extra 30 pixels wider than the RenderObject, so this accounts for that.
static int extraWidth() { return arrowMargin; }
private:
- SkRect m_bounds; // Maybe this should become a protected member of RenderSkinAndroid...
- static SkBitmap m_bitmap[2]; // Collection of assets for a combo box
- static bool m_decoded; // True if all assets were decoded
- SkPaint m_paint;
- // Could probably move m_state into RenderSkinAndroid...
- // Although notice that the state for RenderSkinRadio is just an integer, and it behaves differently
- State m_state;
static const int arrowMargin = 30;
};
diff --git a/WebKit/android/jni/JavaBridge.cpp b/WebKit/android/jni/JavaBridge.cpp
index 37bb5d2..eefeea5 100644
--- a/WebKit/android/jni/JavaBridge.cpp
+++ b/WebKit/android/jni/JavaBridge.cpp
@@ -94,7 +94,6 @@ public:
static void ServiceFuncPtrQueue(JNIEnv*);
private:
- JavaVM* mJvm;
jobject mJavaObject;
jmethodID mSetSharedTimer;
jmethodID mStopSharedTimer;
@@ -109,7 +108,6 @@ static JavaBridge* gJavaBridge;
JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
{
- mJvm = jnienv_to_javavm(env);
mJavaObject = adoptGlobalRef(env, obj);
jclass clazz = env->GetObjectClass(obj);
@@ -134,7 +132,7 @@ JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
JavaBridge::~JavaBridge()
{
if (mJavaObject) {
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->DeleteGlobalRef(mJavaObject);
mJavaObject = 0;
}
@@ -146,7 +144,7 @@ JavaBridge::~JavaBridge()
void
JavaBridge::setSharedTimer(long long timemillis)
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
env->CallVoidMethod(obj.get(), mSetSharedTimer, timemillis);
}
@@ -154,7 +152,7 @@ JavaBridge::setSharedTimer(long long timemillis)
void
JavaBridge::stopSharedTimer()
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
env->CallVoidMethod(obj.get(), mStopSharedTimer);
}
@@ -162,7 +160,7 @@ JavaBridge::stopSharedTimer()
void
JavaBridge::setCookies(WebCore::KURL const& url, WebCore::KURL const& docUrl, WebCore::String const& value)
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
const WebCore::String& urlStr = url.string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
const WebCore::String& docUrlStr = docUrl.string();
@@ -179,7 +177,7 @@ JavaBridge::setCookies(WebCore::KURL const& url, WebCore::KURL const& docUrl, We
WebCore::String
JavaBridge::cookies(WebCore::KURL const& url)
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
const WebCore::String& urlStr = url.string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
@@ -195,7 +193,7 @@ JavaBridge::cookies(WebCore::KURL const& url)
bool
JavaBridge::cookiesEnabled()
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
jboolean ret = env->CallBooleanMethod(obj.get(), mCookiesEnabled);
return (ret != 0);
@@ -215,8 +213,7 @@ void JavaBridge::signalServiceFuncPtrQueue()
// In order to signal the main thread we must go through JNI. This
// is the only usage on most threads, so we need to ensure a JNI
// environment is setup.
- JSC::Bindings::getJNIEnv();
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
env->CallVoidMethod(obj.get(), mSignalFuncPtrQueue);
}
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index 8cf9cbe..860109b 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -108,7 +108,6 @@ namespace android {
struct WebFrame::JavaBrowserFrame
{
- JavaVM* mJVM;
jobject mObj;
jobject mHistoryList; // WebBackForwardList object
jmethodID mStartLoadingResource;
@@ -146,7 +145,6 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
{
jclass clazz = env->GetObjectClass(obj);
mJavaFrame = new JavaBrowserFrame;
- mJavaFrame->mJVM = jnienv_to_javavm(env);
mJavaFrame->mObj = adoptGlobalRef(env, obj);
mJavaFrame->mHistoryList = adoptGlobalRef(env, historyList);
mJavaFrame->mStartLoadingResource = env->GetMethodID(clazz, "startLoadingResource",
@@ -206,7 +204,7 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
WebFrame::~WebFrame()
{
if (mJavaFrame->mObj) {
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->DeleteGlobalRef(mJavaFrame->mObj);
env->DeleteGlobalRef(mJavaFrame->mHistoryList);
mJavaFrame->mObj = 0;
@@ -264,7 +262,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
WebCore::String method = request.httpMethod();
WebCore::HTTPHeaderMap headers = request.httpHeaderFields();
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebCore::String urlStr = request.url().string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
jstring jMethodStr = NULL;
@@ -362,7 +360,7 @@ WebFrame::reportError(int errorCode, const WebCore::String& description,
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data());
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring descStr = env->NewString((unsigned short*)description.characters(), description.length());
jstring failUrl = env->NewString((unsigned short*)failingUrl.characters(), failingUrl.length());
@@ -391,7 +389,7 @@ WebFrame::loadStarted(WebCore::Frame* frame)
!isMainFrame))
return;
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
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.
@@ -418,7 +416,7 @@ WebFrame::transitionToCommitted(WebCore::Frame* frame)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebCore::FrameLoadType loadType = frame->loader()->loadType();
bool isMainFrame = (!frame->tree() || !frame->tree()->parent());
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mTransitionToCommitted,
@@ -432,7 +430,7 @@ WebFrame::didFinishLoad(WebCore::Frame* frame)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebCore::FrameLoader* loader = frame->loader();
const WebCore::KURL& url = loader->activeDocumentLoader()->url();
if (url.isEmpty())
@@ -456,7 +454,7 @@ WebFrame::addHistoryItem(WebCore::HistoryItem* item)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: addHistoryItem");
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebHistory::AddItem(mJavaFrame->history(env), item);
}
@@ -467,7 +465,7 @@ WebFrame::removeHistoryItem(int index)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: removeHistoryItem at %d", index);
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebHistory::RemoveItem(mJavaFrame->history(env), index);
}
@@ -478,7 +476,7 @@ WebFrame::updateHistoryIndex(int newIndex)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: updateHistoryIndex to %d", newIndex);
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebHistory::UpdateHistoryIndex(mJavaFrame->history(env), newIndex);
}
@@ -491,7 +489,7 @@ WebFrame::setTitle(const WebCore::String& title)
#ifndef NDEBUG
LOGV("setTitle(%s)", title.ascii().data());
#endif
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring jTitleStr = env->NewString((unsigned short *)title.characters(), title.length());
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetTitle,
@@ -507,7 +505,7 @@ WebFrame::windowObjectCleared(WebCore::Frame* frame)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOGV("::WebCore:: windowObjectCleared");
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mWindowObjectCleared, (int)frame);
checkException(env);
@@ -519,7 +517,7 @@ WebFrame::setProgress(float newProgress)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
int progress = (int) (100 * newProgress);
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetProgress, progress);
checkException(env);
@@ -538,7 +536,7 @@ WebFrame::didReceiveIcon(WebCore::Image* icon)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
LOG_ASSERT(icon, "DidReceiveIcon called without an image!");
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jobject bitmap = webcoreImageToJavaBitmap(env, icon);
if (!bitmap)
return;
@@ -555,7 +553,7 @@ WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
WebCore::String urlStr(url.string());
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring jUrlStr = env->NewString((unsigned short*)urlStr.characters(), urlStr.length());
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
@@ -587,7 +585,7 @@ WebFrame::canHandleRequest(const WebCore::ResourceRequest& request)
// Empty urls should not be sent to java
if (url.isEmpty())
return true;
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
// check to see whether browser app wants to hijack url loading.
@@ -603,7 +601,7 @@ WebFrame::createWindow(bool dialog, bool userGesture)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jobject obj = env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mCreateWindow, dialog, userGesture);
if (obj) {
@@ -619,7 +617,7 @@ WebFrame::requestFocus() const
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestFocus);
checkException(env);
}
@@ -631,7 +629,7 @@ WebFrame::closeWindow(WebViewCore* webViewCore)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
assert(webViewCore);
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mCloseWindow,
webViewCore->getJavaObject().get());
}
@@ -646,7 +644,7 @@ WebFrame::decidePolicyForFormResubmission(WebCore::FramePolicyFunction func)
#ifdef ANDROID_INSTRUMENT
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
PolicyFunctionWrapper* p = new PolicyFunctionWrapper;
p->func = func;
env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
@@ -655,7 +653,7 @@ WebFrame::decidePolicyForFormResubmission(WebCore::FramePolicyFunction func)
WebCore::String
WebFrame::getRawResourceFilename(RAW_RES_ID id) const
{
- JNIEnv* env = javavm_to_jnienv(mJavaFrame->mJVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring ret = (jstring) env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mGetRawResFilename, (int)id);
diff --git a/WebKit/android/jni/WebCoreFrameBridge.h b/WebKit/android/jni/WebCoreFrameBridge.h
index 3793042..f554117 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.h
+++ b/WebKit/android/jni/WebCoreFrameBridge.h
@@ -61,7 +61,7 @@ class WebFrame : public WebCoreRefObject {
// helper function
static WebFrame* getWebFrame(const WebCore::Frame* frame);
- WebCoreResourceLoader* startLoadingResource(WebCore::ResourceHandle*,
+ virtual WebCoreResourceLoader* startLoadingResource(WebCore::ResourceHandle*,
const WebCore::ResourceRequest& request,
bool isHighPriority,
bool synchronous);
@@ -93,7 +93,7 @@ class WebFrame : public WebCoreRefObject {
void updateVisitedHistory(const WebCore::KURL& url, bool reload);
- bool canHandleRequest(const WebCore::ResourceRequest& request);
+ virtual bool canHandleRequest(const WebCore::ResourceRequest& request);
WebCore::Frame* createWindow(bool dialog, bool userGesture);
diff --git a/WebKit/android/jni/WebCoreJni.cpp b/WebKit/android/jni/WebCoreJni.cpp
index e4634d0..f9d9cc9 100644
--- a/WebKit/android/jni/WebCoreJni.cpp
+++ b/WebKit/android/jni/WebCoreJni.cpp
@@ -93,18 +93,6 @@ WebCore::String to_string(JNIEnv* env, jstring str)
return ret;
}
-JavaVM* jnienv_to_javavm(JNIEnv* env)
-{
- JavaVM* vm;
- return env->GetJavaVM(&vm) >= 0 ? vm : NULL;
-}
-
-JNIEnv* javavm_to_jnienv(JavaVM* vm)
-{
- JNIEnv* env;
- return vm->GetEnv((void **)&env, JNI_VERSION_1_4) >= 0 ? env : NULL;
-}
-
}
struct RegistrationMethod {
diff --git a/WebKit/android/jni/WebCoreJni.h b/WebKit/android/jni/WebCoreJni.h
index 6e7ea43..d6e48c7 100644
--- a/WebKit/android/jni/WebCoreJni.h
+++ b/WebKit/android/jni/WebCoreJni.h
@@ -66,12 +66,6 @@ jobject adoptGlobalRef(JNIEnv*, jobject);
// occurred and logs the exception.
bool checkException(JNIEnv* env);
-// Get the JavaVM pointer for the given JNIEnv pointer
-JavaVM* jnienv_to_javavm(JNIEnv* env);
-
-// Get the JNIEnv pointer for the given JavaVM pointer
-JNIEnv* javavm_to_jnienv(JavaVM* vm);
-
// Create a WebCore::String object from a jstring object.
WebCore::String to_string(JNIEnv* env, jstring str);
diff --git a/WebKit/android/jni/WebCoreResourceLoader.cpp b/WebKit/android/jni/WebCoreResourceLoader.cpp
index b335b49..d4eda81 100644
--- a/WebKit/android/jni/WebCoreResourceLoader.cpp
+++ b/WebKit/android/jni/WebCoreResourceLoader.cpp
@@ -70,13 +70,12 @@ static struct resourceloader_t {
WebCoreResourceLoader::WebCoreResourceLoader(JNIEnv *env, jobject jLoadListener)
{
- mJvm = jnienv_to_javavm(env);
mJLoader = env->NewGlobalRef(jLoadListener);
}
WebCoreResourceLoader::~WebCoreResourceLoader()
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
SET_NATIVE_HANDLE(env, mJLoader, 0);
env->DeleteGlobalRef(mJLoader);
mJLoader = 0;
@@ -84,14 +83,14 @@ WebCoreResourceLoader::~WebCoreResourceLoader()
void WebCoreResourceLoader::cancel()
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(mJLoader, gResourceLoader.mCancelMethodID);
checkException(env);
}
void WebCoreResourceLoader::downloadFile()
{
- JNIEnv* env = javavm_to_jnienv(mJvm);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(mJLoader, gResourceLoader.mDownloadFileMethodID);
checkException(env);
}
@@ -103,7 +102,7 @@ void WebCoreResourceLoader::downloadFile()
*/
bool WebCoreResourceLoader::willLoadFromCache(const WebCore::KURL& url)
{
- JNIEnv* env = javavm_to_jnienv(JSC::Bindings::getJavaVM());
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebCore::String urlStr = url.string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
jclass resourceLoader = env->FindClass("android/webkit/LoadListener");
diff --git a/WebKit/android/jni/WebCoreResourceLoader.h b/WebKit/android/jni/WebCoreResourceLoader.h
index 0b0de59..5dd5abe 100644
--- a/WebKit/android/jni/WebCoreResourceLoader.h
+++ b/WebKit/android/jni/WebCoreResourceLoader.h
@@ -66,7 +66,6 @@ public:
static void Error(JNIEnv*, jobject, jint, jstring, jstring);
private:
- JavaVM* mJvm;
jobject mJLoader;
};
diff --git a/WebKit/android/jni/WebHistory.cpp b/WebKit/android/jni/WebHistory.cpp
index 5555ff1..028d62e 100644
--- a/WebKit/android/jni/WebHistory.cpp
+++ b/WebKit/android/jni/WebHistory.cpp
@@ -43,6 +43,7 @@
#include "TextEncoding.h"
#include "WebCoreFrameBridge.h"
#include "WebCoreJni.h"
+#include "jni_utility.h"
#include <JNIHelp.h>
#include <SkUtils.h>
@@ -231,15 +232,14 @@ jbyteArray WebHistory::Flatten(JNIEnv* env, WTF::Vector<char>& v, WebCore::Histo
// Write our flattened data to the java array.
jbyte* bytes = env->GetByteArrayElements(b, NULL);
- memcpy(bytes, v.data(), v.size());
+ if (bytes)
+ memcpy(bytes, v.data(), v.size());
env->ReleaseByteArrayElements(b, bytes, 0);
return b;
}
WebHistoryItem::WebHistoryItem(JNIEnv* env, jobject obj,
WebCore::HistoryItem* item) {
- JavaVM* vm;
- mJVM = env->GetJavaVM(&vm) >= 0 ? vm : NULL;
mObject = adoptGlobalRef(env, obj);
mScale = 100;
mActive = false;
@@ -249,8 +249,7 @@ WebHistoryItem::WebHistoryItem(JNIEnv* env, jobject obj,
WebHistoryItem::~WebHistoryItem() {
if (mObject) {
- JNIEnv* env;
- env = mJVM->GetEnv((void **)&env, JNI_VERSION_1_4) >= 0 ? env : NULL;
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
env->DeleteGlobalRef(mObject);
@@ -278,8 +277,7 @@ void WebHistoryItem::updateHistoryItem(WebCore::HistoryItem* item) {
webItem = webItem->parent();
item = webItem->historyItem();
}
- JNIEnv* env;
- env = webItem->mJVM->GetEnv((void **)&env, JNI_VERSION_1_4) >= 0 ? env : NULL;
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
diff --git a/WebKit/android/jni/WebHistory.h b/WebKit/android/jni/WebHistory.h
index 6b6b61d..40dc8f8 100644
--- a/WebKit/android/jni/WebHistory.h
+++ b/WebKit/android/jni/WebHistory.h
@@ -51,7 +51,6 @@ public:
WebHistoryItem(WebHistoryItem* parent)
: mParent(parent)
, mObject(NULL)
- , mJVM(NULL)
, mScale(100)
, mActive(false)
, mHistoryItem(NULL) {}
@@ -67,7 +66,6 @@ public:
private:
RefPtr<WebHistoryItem> mParent;
jobject mObject;
- JavaVM* mJVM;
int mScale;
bool mActive;
WebCore::HistoryItem* mHistoryItem;
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 9967b78..6aa92cb 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -90,6 +90,7 @@
#include "HistoryItem.h"
#include "android_graphics.h"
#include <ui/KeycodeLabels.h>
+#include "jni_utility.h"
#if DEBUG_NAV_UI
#include "SkTime.h"
@@ -135,7 +136,6 @@ struct WebViewCoreFields {
// ----------------------------------------------------------------------------
struct WebViewCore::JavaGlue {
- JavaVM* m_JVM;
jobject m_obj;
jmethodID m_spawnScrollTo;
jmethodID m_scrollTo;
@@ -201,7 +201,6 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
jclass clazz = env->GetObjectClass(javaWebViewCore);
m_javaGlue = new JavaGlue;
- m_javaGlue->m_JVM = jnienv_to_javavm(env);
m_javaGlue->m_obj = adoptGlobalRef(env, javaWebViewCore);
m_javaGlue->m_spawnScrollTo = GetJMethod(env, clazz, "contentSpawnScrollTo", "(II)V");
m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(II)V");
@@ -236,7 +235,7 @@ WebViewCore::~WebViewCore()
Release(m_popupReply);
if (m_javaGlue->m_obj) {
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->DeleteGlobalRef(m_javaGlue->m_obj);
m_javaGlue->m_obj = 0;
}
@@ -563,7 +562,7 @@ void WebViewCore::scrollTo(int x, int y, bool animate)
// LOGD("WebViewCore::scrollTo(%d %d)\n", x, y);
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo, x, y);
checkException(env);
}
@@ -571,7 +570,7 @@ void WebViewCore::scrollTo(int x, int y, bool animate)
void WebViewCore::sendMarkNodeInvalid(WebCore::Node* node)
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendMarkNodeInvalid, (int) node);
checkException(env);
}
@@ -579,7 +578,7 @@ void WebViewCore::sendMarkNodeInvalid(WebCore::Node* node)
void WebViewCore::sendNotifyFocusSet()
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendNotifyFocusSet);
checkException(env);
}
@@ -587,7 +586,7 @@ void WebViewCore::sendNotifyFocusSet()
void WebViewCore::sendNotifyProgressFinished()
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendNotifyProgressFinished);
checkException(env);
}
@@ -595,7 +594,7 @@ void WebViewCore::sendNotifyProgressFinished()
void WebViewCore::sendRecomputeFocus()
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendRecomputeFocus);
checkException(env);
}
@@ -603,7 +602,7 @@ void WebViewCore::sendRecomputeFocus()
void WebViewCore::viewInvalidate(const SkIRect& rect)
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendViewInvalidate,
rect.fLeft, rect.fTop, rect.fRight, rect.fBottom);
checkException(env);
@@ -612,7 +611,7 @@ void WebViewCore::viewInvalidate(const SkIRect& rect)
void WebViewCore::viewInvalidate(const WebCore::IntRect& rect)
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendViewInvalidate,
rect.x(), rect.y(), rect.right(), rect.bottom());
checkException(env);
@@ -622,14 +621,14 @@ void WebViewCore::scrollBy(int dx, int dy)
{
if (!(dx | dy))
return;
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_scrollBy, dx, dy);
checkException(env);
}
void WebViewCore::contentDraw()
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_contentDraw);
checkException(env);
}
@@ -677,7 +676,7 @@ void WebViewCore::didFirstLayout()
return;
LOGV("::WebCore:: didFirstLayout %s", url.string().ascii().data());
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_didFirstLayout);
checkException(env);
@@ -691,7 +690,7 @@ void WebViewCore::restoreScale(int scale)
DEBUG_NAV_UI_LOGD("%s", __FUNCTION__);
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_restoreScale, scale);
checkException(env);
}
@@ -702,7 +701,7 @@ void WebViewCore::needTouchEvents(bool need)
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
#if ENABLE(TOUCH_EVENTS) // Android
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_needTouchEvents, need);
checkException(env);
#endif
@@ -1384,7 +1383,7 @@ WebCore::Frame* WebViewCore::deleteSelection(WebCore::Frame* frame, WebCore::Nod
void WebViewCore::replaceTextfieldText(WebCore::Frame* frame, WebCore::Node* node, int x, int y,
int oldStart, int oldEnd, jstring replace, int start, int end)
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebCore::String webcoreString = to_string(env, replace);
frame = setSelection(frame, node, x, y, oldStart, oldEnd);
@@ -1423,7 +1422,7 @@ void WebViewCore::passToJs(WebCore::Frame* frame, WebCore::Node* node, int x, in
WebCore::RenderObject* renderer = currentFocus->renderer();
if (renderer && (renderer->isTextField() || renderer->isTextArea())) {
WebCore::RenderTextControl* renderText = static_cast<WebCore::RenderTextControl*>(renderer);
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
WebCore::String current = to_string(env, currentText);
WebCore::String test = renderText->text();
// If the text changed during the key event, update the UI text field.
@@ -1548,7 +1547,7 @@ void WebViewCore::listBoxRequest(WebCoreReply* reply, const uint16_t** labels, s
LOG_ASSERT(m_javaGlue->m_obj, "No java widget associated with this view!");
// Create an array of java Strings for the drop down.
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jobjectArray labelArray = makeLabelArray(env, labels, count);
// Create an array determining whether each item is enabled.
@@ -1765,7 +1764,7 @@ void WebViewCore::popupReply(const int* array, int count)
void WebViewCore::jsAlert(const WebCore::String& url, const WebCore::String& text)
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
@@ -1776,7 +1775,7 @@ void WebViewCore::jsAlert(const WebCore::String& url, const WebCore::String& tex
bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& text)
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
@@ -1788,7 +1787,7 @@ bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& t
bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& text, const WebCore::String& defaultValue, WebCore::String& result)
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
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());
@@ -1807,7 +1806,7 @@ bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& te
bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& message)
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
jstring jInputStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
@@ -1820,13 +1819,13 @@ bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& me
AutoJObject
WebViewCore::getJavaObject()
{
- return getRealObject(javavm_to_jnienv(m_javaGlue->m_JVM), m_javaGlue->m_obj);
+ return getRealObject(JSC::Bindings::getJNIEnv(), m_javaGlue->m_obj);
}
jobject
WebViewCore::getWebViewJavaObject()
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
return env->GetObjectField(m_javaGlue->object(env).get(), gWebViewCoreFields.m_webView);
}
@@ -1835,7 +1834,7 @@ void WebViewCore::updateTextfield(WebCore::Node* ptr, bool changeToPassword,
{
if (m_blockTextfieldUpdates)
return;
- JNIEnv* env = javavm_to_jnienv(m_javaGlue->m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
if (changeToPassword) {
env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
(int) ptr, true, 0, m_textGeneration);
diff --git a/WebKit/android/nav/FindCanvas.h b/WebKit/android/nav/FindCanvas.h
index 4ecbf37..5d79b4c 100644
--- a/WebKit/android/nav/FindCanvas.h
+++ b/WebKit/android/nav/FindCanvas.h
@@ -32,6 +32,7 @@
#include "SkRegion.h"
#include "SkTDArray.h"
#include "icu/unicode/umachine.h"
+#include "wtf/Vector.h"
class SkRect;
class SkTypeface;
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index 2a11490..c645f72 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -53,6 +53,7 @@
#include "SkTime.h"
#include "WebCoreJni.h"
#include "WebViewCore.h"
+#include "jni_utility.h"
#ifdef GET_NATIVE_VIEW
#undef GET_NATIVE_VIEW
@@ -350,7 +351,6 @@ enum OutOfFocusFix {
};
struct JavaGlue {
- JavaVM* m_JVM;
jobject m_obj;
jmethodID m_clearTextEntry;
jmethodID m_scrollBy;
@@ -381,7 +381,6 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl)
{
jclass clazz = env->FindClass("android/webkit/WebView");
// m_javaGlue = new JavaGlue;
- m_javaGlue.m_JVM = jnienv_to_javavm(env);
m_javaGlue.m_obj = adoptGlobalRef(env, javaWebView);
m_javaGlue.m_scrollBy = GetJMethod(env, clazz, "setContentScrollBy", "(II)V");
m_javaGlue.m_clearTextEntry = GetJMethod(env, clazz, "clearTextEntry", "()V");
@@ -434,7 +433,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl)
{
if (m_javaGlue.m_obj)
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->DeleteGlobalRef(m_javaGlue.m_obj);
m_javaGlue.m_obj = 0;
}
@@ -476,7 +475,7 @@ void clearFocus(int x, int y, bool inval)
void clearTextEntry()
{
DEBUG_NAV_UI_LOGD("%s", __FUNCTION__);
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_clearTextEntry);
checkException(env);
}
@@ -890,7 +889,7 @@ CachedRoot* getFrameCache(FrameCachePermission allowNewer)
int getScaledMaxXScroll()
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxXScroll);
checkException(env);
return result;
@@ -899,7 +898,7 @@ int getScaledMaxXScroll()
int getScaledMaxYScroll()
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
int result = env->CallIntMethod(m_javaGlue.object(env).get(), m_javaGlue.m_getScaledMaxYScroll);
checkException(env);
return result;
@@ -908,7 +907,7 @@ int getScaledMaxYScroll()
void getVisibleRect(WebCore::IntRect* rect)
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
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);
@@ -1573,7 +1572,7 @@ void sendFinalFocus(WebCore::Frame* framePtr, WebCore::Node* nodePtr, int x, int
{
DBG_NAV_LOGD("framePtr=%p nodePtr=%p x=%d y=%d", framePtr, nodePtr, x, y);
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendFinalFocus,
(jint) framePtr, (jint) nodePtr, x, y);
checkException(env);
@@ -1582,7 +1581,7 @@ void sendFinalFocus(WebCore::Frame* framePtr, WebCore::Node* nodePtr, int x, int
void sendKitFocus()
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendKitFocus);
checkException(env);
}
@@ -1596,7 +1595,7 @@ void sendMotionUp(int buildGeneration,
" x=%d y=%d slop=%d", buildGeneration,
m_generation, framePtr, nodePtr, x, y, slop);
LOG_ASSERT(m_javaGlue.m_obj, "A WebView was not associated with this WebViewNative!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_sendMotionUp, m_generation,
buildGeneration, (jint) framePtr, (jint) nodePtr, x, y, slop, isClick, retry);
checkException(env);
@@ -1609,7 +1608,7 @@ void setFocusData(int buildGeneration, WebCore::Frame* framePtr,
DBG_NAV_LOGD("moveGeneration=%d buildGeneration=%d framePtr=%p nodePtr=%p"
" x=%d y=%d", m_generation, buildGeneration, framePtr, nodePtr, x, y);
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_setFocusData, m_generation,
buildGeneration, (jint) framePtr, (jint) nodePtr, x, y, ignoreNullFocus);
checkException(env);
@@ -1678,7 +1677,7 @@ void scrollBy(int dx, int dy)
{
LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_scrollBy, dx, dy);
checkException(env);
}
@@ -1730,14 +1729,14 @@ bool updateFocusNode(JNIEnv* env)
void updateTextEntry()
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_updateTextEntry);
checkException(env);
}
void displaySoftKeyboard()
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(),
m_javaGlue.m_displaySoftKeyboard);
checkException(env);
@@ -1745,21 +1744,21 @@ void displaySoftKeyboard()
void viewInvalidate()
{
- JNIEnv* env = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
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 = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
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 = javavm_to_jnienv(m_javaGlue.m_JVM);
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
env->CallVoidMethod(m_javaGlue.object(env).get(), m_javaGlue.m_postInvalidateDelayed,
delay, bounds.x(), bounds.y(), bounds.right(), bounds.bottom());
checkException(env);