diff options
author | Leon Scroggins <scroggo@google.com> | 2009-06-26 17:22:50 -0400 |
---|---|---|
committer | Leon Scroggins <scroggo@google.com> | 2009-06-30 11:47:26 -0400 |
commit | 3ccd3655a09633794f4d815ff85f35fa986a10d4 (patch) | |
tree | efbb325ac22ba33ad7b268809e0fb822b81b4cb7 /core/java/android/webkit | |
parent | 8cdad889154b87bb796de3dc3f57952b6858e884 (diff) | |
download | frameworks_base-3ccd3655a09633794f4d815ff85f35fa986a10d4.zip frameworks_base-3ccd3655a09633794f4d815ff85f35fa986a10d4.tar.gz frameworks_base-3ccd3655a09633794f4d815ff85f35fa986a10d4.tar.bz2 |
Fix a WebView longpress bug.
Longpressing on a WebView while the WebTextView is up calls
WebTextView::performLongPress(). This used to be fine, but now
we may still leave the WebTextView up while the user is longpressing
on something else. Check to ensure that the focus is the same
as the cursor before calling WebTextView's version. Also,
send a click if the user longpresses on a different WebTextView,
so it will now behave appropriately. Requires a change in
external/webkit.
Also remove a duplicate check for inEditingMode().
Diffstat (limited to 'core/java/android/webkit')
-rw-r--r-- | core/java/android/webkit/WebView.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index b067d71..ddcec3c 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2505,6 +2505,14 @@ public class WebView extends AbsoluteLayout @Override public boolean performLongClick() { + if (mNativeClass != 0 && nativeCursorIsTextInput()) { + // Send the click so that the textfield is in focus + // FIXME: When we start respecting changes to the native textfield's + // selection, need to make sure that this does not change it. + mWebViewCore.sendMessage(EventHub.CLICK, nativeCursorFramePointer(), + nativeCursorNodePointer()); + rebuildWebTextView(); + } if (inEditingMode()) { return mWebTextView.performLongClick(); } else { @@ -3484,9 +3492,7 @@ public class WebView extends AbsoluteLayout public void onChildViewRemoved(View p, View child) { if (child == this) { - if (inEditingMode()) { - clearTextEntry(); - } + clearTextEntry(); } } @@ -4025,9 +4031,10 @@ public class WebView extends AbsoluteLayout if (ev.getAction() == MotionEvent.ACTION_DOWN) { mPrivateHandler.removeMessages(SWITCH_TO_CLICK); mTrackballDown = true; - if (mNativeClass != 0) { - nativeRecordButtons(hasFocus() && hasWindowFocus(), true, true); + if (mNativeClass == 0) { + return false; } + nativeRecordButtons(hasFocus() && hasWindowFocus(), true, true); if (time - mLastCursorTime <= TRACKBALL_TIMEOUT && !mLastCursorBounds.equals(nativeGetCursorRingBounds())) { nativeSelectBestAt(mLastCursorBounds); |