From badd8399ca803f48ca43658b49c1cdcf0e3ec250 Mon Sep 17 00:00:00 2001 From: Cary Clark Date: Thu, 15 Oct 2009 13:32:08 -0400 Subject: fix copy/paste using trackball on passion This fix should be considered for passion mr1, but does not affect sholes -- this is a trackball only bug. The selection caret and arrow now take the scale factor and the height of the title bar into account when preparing the canvas for drawing. Clicking the trackball at the end of selecting text no longer sends a click event. Requires a companion fix in external/webkit Fixes http://b/issue?id=2187591 --- core/java/android/webkit/WebView.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'core/java/android/webkit') diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 590bfe2..916d21e 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -2967,12 +2967,12 @@ public class WebView extends AbsoluteLayout animateScroll); if (mNativeClass == 0) return; - if (mShiftIsPressed) { + if (mShiftIsPressed && !animateZoom) { if (mTouchSelection) { nativeDrawSelectionRegion(canvas); } else { - nativeDrawSelection(canvas, mSelectX, mSelectY, - mExtendSelection); + nativeDrawSelection(canvas, mInvActualScale, getTitleHeight(), + mSelectX, mSelectY, mExtendSelection); } } else if (drawCursorRing) { if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) { @@ -4137,6 +4137,9 @@ public class WebView extends AbsoluteLayout return true; } if (ev.getAction() == MotionEvent.ACTION_DOWN) { + if (mShiftIsPressed) { + return true; // discard press if copy in progress + } mTrackballDown = true; if (mNativeClass == 0) { return false; @@ -4165,6 +4168,7 @@ public class WebView extends AbsoluteLayout } else { mExtendSelection = true; } + return true; // discard press if copy in progress } if (DebugFlags.WEB_VIEW) { Log.v(LOGTAG, "onTrackballEvent up ev=" + ev @@ -5710,8 +5714,8 @@ public class WebView extends AbsoluteLayout private native void nativeDestroy(); private native void nativeDrawCursorRing(Canvas content); private native void nativeDrawMatches(Canvas canvas); - private native void nativeDrawSelection(Canvas content - , int x, int y, boolean extendSelection); + private native void nativeDrawSelection(Canvas content, float scale, + int offset, int x, int y, boolean extendSelection); private native void nativeDrawSelectionRegion(Canvas content); private native void nativeDumpDisplayTree(String urlOrNull); private native int nativeFindAll(String findLower, String findUpper); -- cgit v1.1