Merge change 3443
* changes:
Make AppCache work with v8: -- Most changes follow Chrome's changes in the same area -- I needed to update the CodeGeneratorV8.pm to the latest version -- I needed to deprecate v8_utility.h and replace it with V8Utilities.h/cpp
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 78681bc..f50dd1a 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -163,7 +163,6 @@
jmethodID m_didFirstLayout;
jmethodID m_sendMarkNodeInvalid;
jmethodID m_sendNotifyProgressFinished;
- jmethodID m_sendRecomputeFocus;
jmethodID m_sendViewInvalidate;
jmethodID m_updateTextfield;
jmethodID m_restoreScale;
@@ -228,7 +227,6 @@
m_javaGlue->m_didFirstLayout = GetJMethod(env, clazz, "didFirstLayout", "(Z)V");
m_javaGlue->m_sendMarkNodeInvalid = GetJMethod(env, clazz, "sendMarkNodeInvalid", "(I)V");
m_javaGlue->m_sendNotifyProgressFinished = GetJMethod(env, clazz, "sendNotifyProgressFinished", "()V");
- m_javaGlue->m_sendRecomputeFocus = GetJMethod(env, clazz, "sendRecomputeFocus", "()V");
m_javaGlue->m_sendViewInvalidate = GetJMethod(env, clazz, "sendViewInvalidate", "(IIII)V");
m_javaGlue->m_updateTextfield = GetJMethod(env, clazz, "updateTextfield", "(IZLjava/lang/String;I)V");
m_javaGlue->m_restoreScale = GetJMethod(env, clazz, "restoreScale", "(I)V");
@@ -291,7 +289,6 @@
clearContent();
m_updatedFrameCache = true;
m_frameCacheOutOfDate = true;
- m_blockFocusChange = false;
m_snapAnchorNode = 0;
m_useReplay = false;
m_skipContentDraw = false;
@@ -716,14 +713,6 @@
checkException(env);
}
-void WebViewCore::sendRecomputeFocus()
-{
- LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
- JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendRecomputeFocus);
- checkException(env);
-}
-
void WebViewCore::viewInvalidate(const WebCore::IntRect& rect)
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
@@ -1156,10 +1145,6 @@
DBG_NAV_LOGD("m_moveGeneration=%d moveGeneration=%d"
" frame=%p node=%p x=%d y=%d",
m_moveGeneration, moveGeneration, frame, node, x, y);
- if (m_blockFocusChange) {
- DBG_NAV_LOG("m_blockFocusChange");
- return;
- }
if (m_moveGeneration > moveGeneration) {
DBG_NAV_LOGD("m_moveGeneration=%d > moveGeneration=%d",
m_moveGeneration, moveGeneration);
@@ -1196,7 +1181,6 @@
DBG_NAV_LOGD("frame=%p node=%p x=%d y=%d ", frame, node, x, y);
if (!frame || CacheBuilder::validNode(m_mainFrame, frame, NULL) == false)
frame = m_mainFrame;
- WebCore::Node* oldFocusNode = currentFocus();
// mouse event expects the position in the window coordinate
m_mousePos = WebCore::IntPoint(x - m_scrollOffsetX, y - m_scrollOffsetY);
// validNode will still return true if the node is null, as long as we have
@@ -1407,8 +1391,11 @@
void WebViewCore::replaceTextfieldText(int oldStart,
int oldEnd, const WebCore::String& replace, int start, int end)
{
+ WebCore::Node* focus = currentFocus();
+ if (!focus)
+ return;
setSelection(oldStart, oldEnd);
- WebCore::TypingCommand::insertText(currentFocus()->document(), replace,
+ WebCore::TypingCommand::insertText(focus->document(), replace,
false);
setSelection(start, end);
}
@@ -1420,7 +1407,7 @@
WebCore::Node* focus = currentFocus();
if (!focus)
return;
- WebCore::Frame* frame = currentFocus()->document()->frame();
+ WebCore::Frame* frame = focus->document()->frame();
// Construct the ModifierKey value
WebCore::PlatformKeyboardEvent::ModifierKey mods =
static_cast<WebCore::PlatformKeyboardEvent::ModifierKey>
@@ -1657,8 +1644,6 @@
keyHandled = handleMouseClick(focusNode->document()->frame(), focusNode);
WebFrame::getWebFrame(m_mainFrame)->setUserInitiatedClick(false);
}
- // match in moveMouse()
- m_blockFocusChange = false;
return keyHandled;
}
@@ -2245,16 +2230,6 @@
ignoreNullFocus);
}
-static void UnblockFocus(JNIEnv *env, jobject obj)
-{
-#ifdef ANDROID_INSTRUMENT
- TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
-#endif
- WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__);
- viewImpl->unblockFocus();
-}
-
static void UpdateFrameCache(JNIEnv *env, jobject obj)
{
#ifdef ANDROID_INSTRUMENT
@@ -2500,8 +2475,6 @@
(void*) TouchUp },
{ "nativeRetrieveHref", "(II)Ljava/lang/String;",
(void*) RetrieveHref },
- { "nativeUnblockFocus", "()V",
- (void*) UnblockFocus },
{ "nativeUpdateFrameCache", "()V",
(void*) UpdateFrameCache },
{ "nativeGetContentMinPrefWidth", "()I",
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index c60a12c..e51afd4 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -276,7 +276,6 @@
void setBackgroundColor(SkColor c);
void setSnapAnchor(int x, int y);
void snapToAnchor();
- void unblockFocus() { m_blockFocusChange = false; }
void updateFrameCache();
void dumpDomTree(bool);
void dumpRenderTree(bool);
@@ -380,7 +379,6 @@
int m_scrollOffsetY; // webview.java's current scroll in Y
WebCore::IntPoint m_mousePos;
bool m_frameCacheOutOfDate;
- bool m_blockFocusChange;
bool m_progressDone;
int m_lastPassed;
int m_lastVelocity;
diff --git a/WebKit/android/nav/WebView.cpp b/WebKit/android/nav/WebView.cpp
index e0cdd3b..94c419f 100644
--- a/WebKit/android/nav/WebView.cpp
+++ b/WebKit/android/nav/WebView.cpp
@@ -632,8 +632,7 @@
}
/* returns true if the key had no effect (neither scrolled nor changed cursor) */
-bool moveCursor(int keyCode, int count, bool ignoreScroll, bool inval,
- void* lastSentCursor, const WebCore::IntRect* lastSentBounds)
+bool moveCursor(int keyCode, int count, bool ignoreScroll)
{
CachedRoot* root = getFrameCache(AllowNewer);
if (!root) {
@@ -657,7 +656,6 @@
int xMax = getScaledMaxXScroll();
int yMax = getScaledMaxYScroll();
root->setMaxScroll(xMax, yMax);
- CachedHistory savedHistory = *root->rootHistory();
const CachedNode* cachedNode = 0;
int dx = 0;
int dy = 0;
@@ -698,25 +696,12 @@
this->scrollBy(dx, dy);
m_lastDx = dx;
m_lastDxTime = SkTime::GetMSecs();
- ignoreScroll = true; // if move re-executes, don't scroll the second time
}
bool result = false;
if (cachedNode) {
- WebCore::IntPoint pos;
root->setCursor((CachedFrame*) cachedFrame, (CachedNode*) cachedNode);
- root->getSimulatedMousePosition(&pos);
- if (lastSentCursor == cachedNode->nodePointer() && lastSentBounds &&
- *lastSentBounds == cachedNode->bounds())
- {
- sendMoveMouse((WebCore::Frame*) cachedFrame->framePointer(),
- (WebCore::Node*) cachedNode->nodePointer(), pos.x(), pos.y());
- } else {
- sendMoveMouseIfLatest();
- if (inval)
- viewInvalidate();
- DBG_NAV_LOGD("history.mDidFirstLayout=%s",
- savedHistory.didFirstLayout() ? "true" : "false");
- }
+ sendMoveMouseIfLatest();
+ viewInvalidate();
} else {
int docHeight = root->documentHeight();
int docWidth = root->documentWidth();
@@ -1228,7 +1213,7 @@
return ret;
}
-static void nativeClearFocus(JNIEnv *env, jobject obj, int x, int y)
+static void nativeClearCursor(JNIEnv *env, jobject obj, int x, int y)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
@@ -1424,37 +1409,37 @@
return ret;
}
-static bool nativeFocusIsPassword(JNIEnv *env, jobject obj)
+static bool nativeFocusCandidateIsPassword(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
return node ? node->isPassword() : false;
}
-static bool nativeFocusIsRtlText(JNIEnv *env, jobject obj)
+static bool nativeFocusCandidateIsRtlText(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
return node ? node->isRtlText() : false;
}
-static bool nativeFocusIsTextField(JNIEnv *env, jobject obj)
+static bool nativeFocusCandidateIsTextField(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
return node ? node->isTextField() : false;
}
-static bool nativeFocusIsTextInput(JNIEnv *env, jobject obj)
+static bool nativeFocusCandidateIsTextInput(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
return node ? node->isTextField() || node->isTextArea() : false;
}
-static jint nativeFocusMaxLength(JNIEnv *env, jobject obj)
+static jint nativeFocusCandidateMaxLength(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
return node ? node->maxLength() : false;
}
-static jobject nativeFocusName(JNIEnv *env, jobject obj)
+static jobject nativeFocusCandidateName(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
if (!node)
@@ -1463,7 +1448,7 @@
return env->NewString((jchar*)name.characters(), name.length());
}
-static jobject nativeFocusNodeBounds(JNIEnv *env, jobject obj)
+static jobject nativeFocusCandidateNodeBounds(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
WebCore::IntRect bounds = node ? node->getBounds()
@@ -1475,13 +1460,13 @@
return rect;
}
-static jint nativeFocusNodePointer(JNIEnv *env, jobject obj)
+static jint nativeFocusCandidatePointer(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
return reinterpret_cast<int>(node ? node->nodePointer() : 0);
}
-static jobject nativeFocusText(JNIEnv *env, jobject obj)
+static jobject nativeFocusCandidateText(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
if (!node)
@@ -1491,7 +1476,7 @@
value.length()) : 0;
}
-static jint nativeFocusTextSize(JNIEnv *env, jobject obj)
+static jint nativeFocusCandidateTextSize(JNIEnv *env, jobject obj)
{
const CachedNode* node = getFocusCandidate(env, obj);
return node ? node->textSize() : 0;
@@ -1550,20 +1535,13 @@
return GET_NATIVE_VIEW(env, obj)->hasFocusNode();
}
-static bool nativeMoveFocus(JNIEnv *env, jobject obj,
+static bool nativeMoveCursor(JNIEnv *env, jobject obj,
int key, int count, bool ignoreScroll)
{
WebView* view = GET_NATIVE_VIEW(env, obj);
DBG_NAV_LOGD("env=%p obj=%p view=%p", env, obj, view);
LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
- return view->moveCursor(key, count, ignoreScroll, true, 0, 0);
-}
-
-static void nativeRecomputeFocus(JNIEnv *env, jobject obj)
-{
- WebView* view = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(view, "view not set in %s", __FUNCTION__);
-// view->recomputeFocus();
+ return view->moveCursor(key, count, ignoreScroll);
}
static void nativeRecordButtons(JNIEnv* env, jobject obj, bool hasFocus,
@@ -1759,8 +1737,8 @@
* JNI registration
*/
static JNINativeMethod gJavaWebViewMethods[] = {
- { "nativeClearFocus", "(II)V",
- (void*) nativeClearFocus },
+ { "nativeClearCursor", "(II)V",
+ (void*) nativeClearCursor },
{ "nativeCreate", "(I)V",
(void*) nativeCreate },
{ "nativeCursorFramePointer", "()I",
@@ -1799,26 +1777,26 @@
(void*) nativeFindAll },
{ "nativeFindNext", "(Z)V",
(void*) nativeFindNext },
- { "nativeFocusIsPassword", "()Z",
- (void*) nativeFocusIsPassword },
- { "nativeFocusIsRtlText", "()Z",
- (void*) nativeFocusIsRtlText },
- { "nativeFocusIsTextField", "()Z",
- (void*) nativeFocusIsTextField },
- { "nativeFocusIsTextInput", "()Z",
- (void*) nativeFocusIsTextInput },
- { "nativeFocusMaxLength", "()I",
- (void*) nativeFocusMaxLength },
- { "nativeFocusName", "()Ljava/lang/String;",
- (void*) nativeFocusName },
- { "nativeFocusNodeBounds", "()Landroid/graphics/Rect;",
- (void*) nativeFocusNodeBounds },
- { "nativeFocusNodePointer", "()I",
- (void*) nativeFocusNodePointer },
- { "nativeFocusText", "()Ljava/lang/String;",
- (void*) nativeFocusText },
- { "nativeFocusTextSize", "()I",
- (void*) nativeFocusTextSize },
+ { "nativeFocusCandidateIsPassword", "()Z",
+ (void*) nativeFocusCandidateIsPassword },
+ { "nativeFocusCandidateIsRtlText", "()Z",
+ (void*) nativeFocusCandidateIsRtlText },
+ { "nativeFocusCandidateIsTextField", "()Z",
+ (void*) nativeFocusCandidateIsTextField },
+ { "nativeFocusCandidateIsTextInput", "()Z",
+ (void*) nativeFocusCandidateIsTextInput },
+ { "nativeFocusCandidateMaxLength", "()I",
+ (void*) nativeFocusCandidateMaxLength },
+ { "nativeFocusCandidateName", "()Ljava/lang/String;",
+ (void*) nativeFocusCandidateName },
+ { "nativeFocusCandidateNodeBounds", "()Landroid/graphics/Rect;",
+ (void*) nativeFocusCandidateNodeBounds },
+ { "nativeFocusCandidatePointer", "()I",
+ (void*) nativeFocusCandidatePointer },
+ { "nativeFocusCandidateText", "()Ljava/lang/String;",
+ (void*) nativeFocusCandidateText },
+ { "nativeFocusCandidateTextSize", "()I",
+ (void*) nativeFocusCandidateTextSize },
{ "nativeGetCursorRingBounds", "()Landroid/graphics/Rect;",
(void*) nativeGetCursorRingBounds },
{ "nativeGetSelection", "()Landroid/graphics/Region;",
@@ -1835,14 +1813,12 @@
(void*) nativeMarkNodeInvalid },
{ "nativeMotionUp", "(III)Z",
(void*) nativeMotionUp },
- { "nativeMoveFocus", "(IIZ)Z",
- (void*) nativeMoveFocus },
+ { "nativeMoveCursor", "(IIZ)Z",
+ (void*) nativeMoveCursor },
{ "nativeMoveGeneration", "()I",
(void*) nativeMoveGeneration },
{ "nativeMoveSelection", "(IIZ)V",
(void*) nativeMoveSelection },
- { "nativeRecomputeFocus", "()V",
- (void*) nativeRecomputeFocus },
{ "nativeRecordButtons", "(ZZZ)V",
(void*) nativeRecordButtons },
{ "nativeSelectBestAt", "(Landroid/graphics/Rect;)V",