diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 49 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.h | 8 |
2 files changed, 14 insertions, 43 deletions
diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 430c2fc..1fb3c75 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -283,7 +283,6 @@ struct WebViewCore::JavaGlue { jmethodID m_restoreScale; jmethodID m_needTouchEvents; jmethodID m_requestKeyboard; - jmethodID m_requestKeyboardWithSelection; jmethodID m_exceededDatabaseQuota; jmethodID m_reachedMaxAppCacheSize; jmethodID m_populateVisitedLinks; @@ -417,7 +416,6 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m m_javaGlue->m_restoreScale = GetJMethod(env, clazz, "restoreScale", "(FF)V"); m_javaGlue->m_needTouchEvents = GetJMethod(env, clazz, "needTouchEvents", "(Z)V"); m_javaGlue->m_requestKeyboard = GetJMethod(env, clazz, "requestKeyboard", "(Z)V"); - m_javaGlue->m_requestKeyboardWithSelection = GetJMethod(env, clazz, "requestKeyboardWithSelection", "(IIII)V"); m_javaGlue->m_exceededDatabaseQuota = GetJMethod(env, clazz, "exceededDatabaseQuota", "(Ljava/lang/String;Ljava/lang/String;JJ)V"); m_javaGlue->m_reachedMaxAppCacheSize = GetJMethod(env, clazz, "reachedMaxAppCacheSize", "(J)V"); m_javaGlue->m_populateVisitedLinks = GetJMethod(env, clazz, "populateVisitedLinks", "()V"); @@ -447,7 +445,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m #endif m_javaGlue->m_setWebTextViewAutoFillable = GetJMethod(env, clazz, "setWebTextViewAutoFillable", "(ILjava/lang/String;)V"); m_javaGlue->m_selectAt = GetJMethod(env, clazz, "selectAt", "(II)V"); - m_javaGlue->m_initEditField = GetJMethod(env, clazz, "initEditField", "(Ljava/lang/String;II)V"); + m_javaGlue->m_initEditField = GetJMethod(env, clazz, "initEditField", "(ILjava/lang/String;II)V"); env->DeleteLocalRef(clazz); env->SetIntField(javaWebViewCore, gWebViewCoreFields.m_nativeClass, (jint)this); @@ -1156,22 +1154,6 @@ void WebViewCore::needTouchEvents(bool need) #endif } -void WebViewCore::requestKeyboardWithSelection(const WebCore::Node* node, - int selStart, int selEnd) -{ - DEBUG_NAV_UI_LOGD("%s", __FUNCTION__); - ALOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!"); - - JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject javaObject = m_javaGlue->object(env); - if (!javaObject.get()) - return; - env->CallVoidMethod(javaObject.get(), - m_javaGlue->m_requestKeyboardWithSelection, - reinterpret_cast<int>(node), selStart, selEnd, m_textGeneration); - checkException(env); -} - void WebViewCore::requestKeyboard(bool showKeyboard) { DEBUG_NAV_UI_LOGD("%s", __FUNCTION__); @@ -2383,12 +2365,8 @@ void WebViewCore::moveMouse(WebCore::Frame* frame, int x, int y, HitTestResult* Position WebViewCore::getPositionForOffset(Node* node, int offset) { - Position positionInNode(node, 0); - Node* highest = highestEditableRoot(positionInNode); - if (!highest) - highest = node; - Position start = firstPositionInNode(highest); - Position end = lastPositionInNode(highest); + Position start = firstPositionInNode(node); + Position end = lastPositionInNode(node); Document* document = node->document(); PassRefPtr<Range> range = Range::create(document, start, end); WebCore::CharacterIterator iterator(range.get()); @@ -3593,8 +3571,7 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node m_frameCacheOutOfDate = true; updateFrameCache(); #endif - requestKeyboardWithSelection(focusNode, rtc->selectionStart(), - rtc->selectionEnd()); + initEditField(focusNode); } } else if (!fake) { requestKeyboard(false); @@ -3605,7 +3582,6 @@ bool WebViewCore::handleMouseClick(WebCore::Frame* framePtr, WebCore::Node* node // input is needed. if (isContentEditable(focusNode)) { initEditField(focusNode); - requestKeyboard(true); } else if (!nodeIsPlugin(focusNode)) { clearTextEntry(); } @@ -3627,9 +3603,10 @@ void WebViewCore::initEditField(Node* node) AutoJObject javaObject = m_javaGlue->object(env); if (!javaObject.get()) return; + m_textGeneration = 0; jstring fieldText = wtfStringToJstring(env, text, true); env->CallVoidMethod(javaObject.get(), m_javaGlue->m_initEditField, - fieldText, start, end); + reinterpret_cast<int>(node), fieldText, start, end); checkException(env); } @@ -3897,8 +3874,7 @@ void WebViewCore::getSelectionOffsets(Node* node, int& start, int& end) SelectionController* selector = frame->selection(); Position selectionStart = selector->start(); Position selectionEnd = selector->end(); - Node* editable = highestEditableRoot(selectionStart); - Position startOfNode = firstPositionInNode(editable); + Position startOfNode = firstPositionInNode(node); RefPtr<Range> startRange = Range::create(document, startOfNode, selectionStart); start = TextIterator::rangeLength(startRange.get(), true); @@ -3917,13 +3893,10 @@ String WebViewCore::getInputText(Node* node) else { // It must be content editable field. Position inNode(node, 0); - Node* editable = highestEditableRoot(inNode); - if (editable) { - Position start = firstPositionInNode(editable); - Position end = lastPositionInNode(editable); - VisibleSelection allEditableText(start, end); - text = allEditableText.firstRange()->text(); - } + Position start = firstPositionInNode(node); + Position end = lastPositionInNode(node); + VisibleSelection allEditableText(start, end); + text = allEditableText.firstRange()->text(); } return text; } diff --git a/Source/WebKit/android/jni/WebViewCore.h b/Source/WebKit/android/jni/WebViewCore.h index 9fc55d1..034229d 100644 --- a/Source/WebKit/android/jni/WebViewCore.h +++ b/Source/WebKit/android/jni/WebViewCore.h @@ -679,13 +679,12 @@ namespace android { Node* getImplicitBoundaryNode(Node* node, unsigned offset, int direction); /** * Calls into java to reset the text edit field with the - * current contents and selection. This currently works only with - * content-editable fields. + * current contents and selection. */ void initEditField(Node* node); /** * Returns the offsets of the selection area for both normal text - * fields and content-editable fields. start and end are modified + * fields and content editable fields. start and end are modified * by this method. */ static void getSelectionOffsets(Node* node, int& start, int& end); @@ -706,8 +705,7 @@ namespace android { static void setSelection(Node* node, int start, int end); /** * Returns the Position for the given offset for an editable - * field. If node is editable the offset relative to the highest - * editable node. If it is not editable, the offset is relative to node. + * field. The offset is relative to the node start. */ static WebCore::Position getPositionForOffset(Node* node, int offset); |