diff options
| author | Cary Clark <cary@android.com> | 2009-09-28 12:50:42 -0400 |
|---|---|---|
| committer | Cary Clark <cary@android.com> | 2009-09-29 15:42:37 -0400 |
| commit | eaa18dec91b6dd0ce3191a9ab65cdc95ef68b935 (patch) | |
| tree | 55475f4a2071d0aa7f46e1e5b17389f144a095fa /core/java/android/webkit/WebTextView.java | |
| parent | f993fefc3b14ece3f0f3eac6bb3d241bffb3cdfb (diff) | |
| download | frameworks_base-eaa18dec91b6dd0ce3191a9ab65cdc95ef68b935.zip frameworks_base-eaa18dec91b6dd0ce3191a9ab65cdc95ef68b935.tar.gz frameworks_base-eaa18dec91b6dd0ce3191a9ab65cdc95ef68b935.tar.bz2 | |
scroll text field with touch
Add a hidden public method to text/method/Touch.java that
computes the maximum scroll amount for a text field.
Remove 'faketouch' code; it causes a crash and is
no longer required.
Pass the percentage of the current scroll from the UI
thread to webkit. One additional fix is to allow very
small movements which are currently disallowed because
they are smaller than 'smallerSlop' in WebTextView.java.
Companion fix is in external/webkit.
Fixes http://b/issue?id=2133049
Diffstat (limited to 'core/java/android/webkit/WebTextView.java')
| -rw-r--r-- | core/java/android/webkit/WebTextView.java | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java index 65ce158..f479124 100644 --- a/core/java/android/webkit/WebTextView.java +++ b/core/java/android/webkit/WebTextView.java @@ -276,25 +276,6 @@ import java.util.ArrayList; } /** - * Create a fake touch up event at (x,y) with respect to this WebTextView. - * This is used by WebView to act as though a touch event which happened - * before we placed the WebTextView actually hit it, so that it can place - * the cursor accordingly. - */ - /* package */ void fakeTouchEvent(float x, float y) { - // We need to ensure that there is a Layout, since the Layout is used - // in determining where to place the cursor. - if (getLayout() == null) { - measure(mWidthSpec, mHeightSpec); - } - // Create a fake touch up, which is used to place the cursor. - MotionEvent ev = MotionEvent.obtain(0, 0, MotionEvent.ACTION_UP, - x, y, 0); - onTouchEvent(ev); - ev.recycle(); - } - - /** * Determine whether this WebTextView currently represents the node * represented by ptr. * @param ptr Pointer to a node to compare to. @@ -457,7 +438,14 @@ import java.util.ArrayList; int smallerSlop = slop/2; if (dx > smallerSlop || dy > smallerSlop) { if (mWebView != null) { - mWebView.scrollFocusedTextInput(mScrollX, mScrollY); + float maxScrollX = (float) Touch.getMaxScrollX(this, + getLayout(), mScrollY); + if (DebugFlags.WEB_TEXT_VIEW) { + Log.v(LOGTAG, "onTouchEvent x=" + mScrollX + " y=" + + mScrollY + " maxX=" + maxScrollX); + } + mWebView.scrollFocusedTextInput(maxScrollX > 0 ? + mScrollX / maxScrollX : 0, mScrollY); } mScrolled = true; return true; |
