summaryrefslogtreecommitdiffstats
path: root/Source/WebKit
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebKit')
-rw-r--r--Source/WebKit/android/jni/WebViewCore.cpp1
-rw-r--r--Source/WebKit/android/nav/WebView.cpp76
2 files changed, 44 insertions, 33 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp
index 1c51b14..a883075 100644
--- a/Source/WebKit/android/jni/WebViewCore.cpp
+++ b/Source/WebKit/android/jni/WebViewCore.cpp
@@ -437,6 +437,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
// Static initialisation of certain important V8 static data gets performed at system startup when
// libwebcore gets loaded. We now need to associate the WebCore thread with V8 to complete
// initialisation.
+ WebCore::ScriptController::setFlags("--nocrankshaft", strlen("--nocrankshaft"));
v8::V8::Initialize();
#endif
}
diff --git a/Source/WebKit/android/nav/WebView.cpp b/Source/WebKit/android/nav/WebView.cpp
index 7057a54..77ac2ae 100644
--- a/Source/WebKit/android/nav/WebView.cpp
+++ b/Source/WebKit/android/nav/WebView.cpp
@@ -126,6 +126,7 @@ struct JavaGlue {
jmethodID m_viewInvalidate;
jmethodID m_viewInvalidateRect;
jmethodID m_postInvalidateDelayed;
+ jmethodID m_pageSwapCallback;
jmethodID m_inFullScreenMode;
jfieldID m_rectLeft;
jfieldID m_rectTop;
@@ -162,6 +163,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir,
m_javaGlue.m_viewInvalidateRect = GetJMethod(env, clazz, "viewInvalidate", "(IIII)V");
m_javaGlue.m_postInvalidateDelayed = GetJMethod(env, clazz,
"viewInvalidateDelayed", "(JIIII)V");
+ m_javaGlue.m_pageSwapCallback = GetJMethod(env, clazz, "pageSwapCallback", "()V");
m_javaGlue.m_inFullScreenMode = GetJMethod(env, clazz, "inFullScreenMode", "()Z");
env->DeleteLocalRef(clazz);
@@ -198,6 +200,7 @@ WebView(JNIEnv* env, jobject javaWebView, int viewImpl, WTF::String drawableDir,
m_buttonSkin = new RenderSkinButton(am, drawableDir);
#if USE(ACCELERATED_COMPOSITING)
m_glWebViewState = 0;
+ m_pageSwapCallbackRegistered = false;
#endif
}
@@ -513,8 +516,20 @@ bool drawGL(WebCore::IntRect& viewRect, WebCore::IntRect* invalRect, WebCore::In
// once the correct scale is set
if (!visibleRect.hasValidCoordinates())
return false;
+ bool pagesSwapped = false;
bool ret = m_glWebViewState->drawGL(viewRect, visibleRect, invalRect,
- webViewRect, titleBarHeight, clip, scale);
+ webViewRect, titleBarHeight, clip, scale,
+ &pagesSwapped);
+ if (m_pageSwapCallbackRegistered && pagesSwapped) {
+ m_pageSwapCallbackRegistered = false;
+ LOG_ASSERT(m_javaGlue.m_obj, "A java object was not associated with this native WebView!");
+ JNIEnv* env = JSC::Bindings::getJNIEnv();
+ AutoJObject javaObject = m_javaGlue.object(env);
+ if (javaObject.get()) {
+ env->CallVoidMethod(javaObject.get(), m_javaGlue.m_pageSwapCallback);
+ checkException(env);
+ }
+ }
if (ret || m_glWebViewState->currentPictureCounter() != pic)
return true;
#endif
@@ -1435,12 +1450,13 @@ static void copyScrollPositionRecursive(const LayerAndroid* from,
#endif
void setBaseLayer(BaseLayerAndroid* layer, SkRegion& inval, bool showVisualIndicator,
- bool isPictureAfterFirstLayout)
+ bool isPictureAfterFirstLayout, bool registerPageSwapCallback)
{
#if USE(ACCELERATED_COMPOSITING)
if (m_glWebViewState)
m_glWebViewState->setBaseLayer(layer, inval, showVisualIndicator,
isPictureAfterFirstLayout);
+ m_pageSwapCallbackRegistered |= registerPageSwapCallback;
#endif
#if ENABLE(ANDROID_OVERFLOW_SCROLL)
@@ -1513,6 +1529,7 @@ private: // local state for WebView
Functor* m_glDrawFunctor;
#if USE(ACCELERATED_COMPOSITING)
GLWebViewState* m_glWebViewState;
+ bool m_pageSwapCallbackRegistered;
#endif
const RenderSkinButton* m_buttonSkin;
}; // end of WebView class
@@ -1587,6 +1604,15 @@ class GLDrawFunctor : Functor {
jint extras;
};
+static jobject createJavaRect(JNIEnv* env, int x, int y, int right, int bottom)
+{
+ jclass rectClass = env->FindClass("android/graphics/Rect");
+ jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
+ jobject rect = env->NewObject(rectClass, init, x, y, right, bottom);
+ env->DeleteLocalRef(rectClass);
+ return rect;
+}
+
/*
* Native JNI methods
*/
@@ -1600,12 +1626,8 @@ static jobject nativeCacheHitNodeBounds(JNIEnv *env, jobject obj)
{
WebCore::IntRect bounds = GET_NATIVE_VIEW(env, obj)
->m_cacheHitNode->originalAbsoluteBounds();
- jclass rectClass = env->FindClass("android/graphics/Rect");
- jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
- jobject rect = env->NewObject(rectClass, init, bounds.x(),
- bounds.y(), bounds.maxX(), bounds.maxY());
- env->DeleteLocalRef(rectClass);
- return rect;
+ return createJavaRect(env, bounds.x(), bounds.y(),
+ bounds.maxX(), bounds.maxY());
}
static int nativeCacheHitNodePointer(JNIEnv *env, jobject obj)
@@ -1735,12 +1757,8 @@ static jobject nativeCursorNodeBounds(JNIEnv *env, jobject obj)
const CachedNode* node = getCursorNode(env, obj, &frame);
WebCore::IntRect bounds = node ? node->bounds(frame)
: WebCore::IntRect(0, 0, 0, 0);
- jclass rectClass = env->FindClass("android/graphics/Rect");
- jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
- jobject rect = env->NewObject(rectClass, init, bounds.x(),
- bounds.y(), bounds.maxX(), bounds.maxY());
- env->DeleteLocalRef(rectClass);
- return rect;
+ return createJavaRect(env, bounds.x(), bounds.y(),
+ bounds.maxX(), bounds.maxY());
}
static jint nativeCursorNodePointer(JNIEnv *env, jobject obj)
@@ -1874,14 +1892,16 @@ static bool nativeEvaluateLayersAnimations(JNIEnv *env, jobject obj)
static void nativeSetBaseLayer(JNIEnv *env, jobject obj, jint layer, jobject inval,
jboolean showVisualIndicator,
- jboolean isPictureAfterFirstLayout)
+ jboolean isPictureAfterFirstLayout,
+ jboolean registerPageSwapCallback)
{
BaseLayerAndroid* layerImpl = reinterpret_cast<BaseLayerAndroid*>(layer);
SkRegion invalRegion;
if (inval)
invalRegion = *GraphicsJNI::getNativeRegion(env, inval);
GET_NATIVE_VIEW(env, obj)->setBaseLayer(layerImpl, invalRegion, showVisualIndicator,
- isPictureAfterFirstLayout);
+ isPictureAfterFirstLayout,
+ registerPageSwapCallback);
}
static BaseLayerAndroid* nativeGetBaseLayer(JNIEnv *env, jobject obj)
@@ -1966,22 +1986,16 @@ static jobject nativeFocusCandidateName(JNIEnv *env, jobject obj)
return wtfStringToJstring(env, name);
}
-static jobject createJavaRect(JNIEnv* env, int x, int y, int right, int bottom)
-{
- jclass rectClass = env->FindClass("android/graphics/Rect");
- jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
- jobject rect = env->NewObject(rectClass, init, x, y, right, bottom);
- env->DeleteLocalRef(rectClass);
- return rect;
-}
-
static jobject nativeFocusCandidateNodeBounds(JNIEnv *env, jobject obj)
{
const CachedFrame* frame;
const CachedNode* node = getFocusCandidate(env, obj, &frame);
WebCore::IntRect bounds = node ? node->bounds(frame)
: WebCore::IntRect(0, 0, 0, 0);
- return createJavaRect(env, bounds.x(), bounds.y(), bounds.maxX(), bounds.maxY());
+ // Inset the rect by 1 unit, so that the focus candidate's border can still
+ // be seen behind it.
+ return createJavaRect(env, bounds.x() + 1, bounds.y() + 1,
+ bounds.maxX() - 1, bounds.maxY() - 1);
}
static jobject nativeFocusCandidatePaddingRect(JNIEnv *env, jobject obj)
@@ -2046,12 +2060,8 @@ static jobject nativeFocusNodeBounds(JNIEnv *env, jobject obj)
const CachedNode* node = getFocusNode(env, obj, &frame);
WebCore::IntRect bounds = node ? node->bounds(frame)
: WebCore::IntRect(0, 0, 0, 0);
- jclass rectClass = env->FindClass("android/graphics/Rect");
- jmethodID init = env->GetMethodID(rectClass, "<init>", "(IIII)V");
- jobject rect = env->NewObject(rectClass, init, bounds.x(),
- bounds.y(), bounds.maxX(), bounds.maxY());
- env->DeleteLocalRef(rectClass);
- return rect;
+ return createJavaRect(env, bounds.x(), bounds.y(),
+ bounds.maxX(), bounds.maxY());
}
static jint nativeFocusNodePointer(JNIEnv *env, jobject obj)
@@ -2757,7 +2767,7 @@ static JNINativeMethod gJavaWebViewMethods[] = {
(void*) nativeSetFindIsUp },
{ "nativeSetHeightCanMeasure", "(Z)V",
(void*) nativeSetHeightCanMeasure },
- { "nativeSetBaseLayer", "(ILandroid/graphics/Region;ZZ)V",
+ { "nativeSetBaseLayer", "(ILandroid/graphics/Region;ZZZ)V",
(void*) nativeSetBaseLayer },
{ "nativeGetBaseLayer", "()I",
(void*) nativeGetBaseLayer },