am 581f7861: DO NOT MERGE Refactor find and select dialogs

Merge commit '581f78615a9dc65ee264b3619ef6cdd0b0e8355c' into gingerbread-plus-aosp

* commit '581f78615a9dc65ee264b3619ef6cdd0b0e8355c':
  DO NOT MERGE Refactor find and select dialogs
This commit is contained in:
Cary Clark
2010-08-20 09:33:10 -07:00
committed by Android Git Automerger
2 changed files with 202 additions and 96 deletions

View File

@ -320,4 +320,22 @@ public class WebChromeClient {
public void openFileChooser(ValueCallback<Uri> uploadFile) { public void openFileChooser(ValueCallback<Uri> uploadFile) {
uploadFile.onReceiveValue(null); uploadFile.onReceiveValue(null);
} }
/**
* Tell the client that the selection has been initiated.
* @hide
*/
public void onSelectionStart(WebView view) {
// By default we cancel the selection again, thus disabling
// text selection unless the chrome client supports it.
view.notifySelectDialogDismissed();
}
/**
* Tell the client that the selection has been copied or canceled.
* @hide
*/
public void onSelectionDone(WebView view) {
}
} }

View File

@ -459,8 +459,7 @@ public class WebView extends AbsoluteLayout
private static final int TOUCH_SHORTPRESS_MODE = 5; private static final int TOUCH_SHORTPRESS_MODE = 5;
private static final int TOUCH_DOUBLE_TAP_MODE = 6; private static final int TOUCH_DOUBLE_TAP_MODE = 6;
private static final int TOUCH_DONE_MODE = 7; private static final int TOUCH_DONE_MODE = 7;
private static final int TOUCH_SELECT_MODE = 8; private static final int TOUCH_PINCH_DRAG = 8;
private static final int TOUCH_PINCH_DRAG = 9;
// Whether to forward the touch events to WebCore // Whether to forward the touch events to WebCore
private boolean mForwardTouchEvents = false; private boolean mForwardTouchEvents = false;
@ -2693,6 +2692,14 @@ public class WebView extends AbsoluteLayout
nativeSetFindIsUp(isUp); nativeSetFindIsUp(isUp);
} }
/**
* @hide
*/
public int findIndex() {
if (0 == mNativeClass) return -1;
return nativeFindIndex();
}
// Used to know whether the find dialog is open. Affects whether // Used to know whether the find dialog is open. Affects whether
// or not we draw the highlights for matches. // or not we draw the highlights for matches.
private boolean mFindIsUp; private boolean mFindIsUp;
@ -3309,12 +3316,33 @@ public class WebView extends AbsoluteLayout
// Send the click so that the textfield is in focus // Send the click so that the textfield is in focus
centerKeyPressOnTextField(); centerKeyPressOnTextField();
rebuildWebTextView(); rebuildWebTextView();
} else {
clearTextEntry(true);
} }
if (inEditingMode()) { if (inEditingMode()) {
return mWebTextView.performLongClick(); return mWebTextView.performLongClick();
} else {
return super.performLongClick();
} }
/* if long click brings up a context menu, the super function
* returns true and we're done. Otherwise, nothing happened when
* the user clicked. */
if (super.performLongClick()) {
return true;
}
/* In the case where the application hasn't already handled the long
* click action, look for a word under the click. If one is found,
* animate the text selection into view.
* FIXME: no animation code yet */
if (mSelectingText) return false; // long click does nothing on selection
int x = viewToContentX((int) mLastTouchX + mScrollX);
int y = viewToContentY((int) mLastTouchY + mScrollY);
setUpSelect();
if (mNativeClass != 0 && nativeWordSelection(x, y)) {
nativeSetExtendSelection();
getWebChromeClient().onSelectionStart(this);
return true;
}
notifySelectDialogDismissed();
return false;
} }
boolean inAnimateZoom() { boolean inAnimateZoom() {
@ -3465,19 +3493,12 @@ public class WebView extends AbsoluteLayout
// decide which adornments to draw // decide which adornments to draw
int extras = DRAW_EXTRAS_NONE; int extras = DRAW_EXTRAS_NONE;
if (mFindIsUp) { if (mFindIsUp) {
// When the FindDialog is up, only draw the matches if we are not in
// the process of scrolling them into view.
if (!animateScroll) {
extras = DRAW_EXTRAS_FIND; extras = DRAW_EXTRAS_FIND;
} } else if (mSelectingText) {
} else if (mShiftIsPressed && !nativeFocusIsPlugin()) { extras = DRAW_EXTRAS_SELECTION;
if (!animateZoom && !mPreviewZoomOnly) { nativeSetSelectionPointer(mDrawSelectionPointer,
extras = DRAW_EXTRAS_SELECTION; mInvActualScale,
nativeSetSelectionRegion(mTouchSelection || mExtendSelection); mSelectX, mSelectY - getTitleHeight());
nativeSetSelectionPointer(!mTouchSelection, mInvActualScale,
mSelectX, mSelectY - getTitleHeight(),
mExtendSelection);
}
} else if (drawCursorRing) { } else if (drawCursorRing) {
extras = DRAW_EXTRAS_CURSOR_RING; extras = DRAW_EXTRAS_CURSOR_RING;
} }
@ -3486,11 +3507,6 @@ public class WebView extends AbsoluteLayout
if (extras == DRAW_EXTRAS_CURSOR_RING) { if (extras == DRAW_EXTRAS_CURSOR_RING) {
if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) { if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
mTouchMode = TOUCH_SHORTPRESS_MODE; mTouchMode = TOUCH_SHORTPRESS_MODE;
HitTestResult hitTest = getHitTestResult();
if (hitTest == null
|| hitTest.mType == HitTestResult.UNKNOWN_TYPE) {
mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
}
} }
} }
if (mFocusSizeChanged) { if (mFocusSizeChanged) {
@ -3829,8 +3845,8 @@ public class WebView extends AbsoluteLayout
|| keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) { || keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) {
if (nativeFocusIsPlugin()) { if (nativeFocusIsPlugin()) {
mShiftIsPressed = true; mShiftIsPressed = true;
} else if (!nativeCursorWantsKeyEvents() && !mShiftIsPressed) { } else if (!nativeCursorWantsKeyEvents() && !mSelectingText) {
setUpSelectXY(); setUpSelect();
} }
} }
@ -3851,7 +3867,7 @@ public class WebView extends AbsoluteLayout
letPluginHandleNavKey(keyCode, event.getEventTime(), true); letPluginHandleNavKey(keyCode, event.getEventTime(), true);
return true; return true;
} }
if (mShiftIsPressed) { if (mSelectingText) {
int xRate = keyCode == KeyEvent.KEYCODE_DPAD_LEFT int xRate = keyCode == KeyEvent.KEYCODE_DPAD_LEFT
? -1 : keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ? 1 : 0; ? -1 : keyCode == KeyEvent.KEYCODE_DPAD_RIGHT ? 1 : 0;
int yRate = keyCode == KeyEvent.KEYCODE_DPAD_UP ? int yRate = keyCode == KeyEvent.KEYCODE_DPAD_UP ?
@ -3871,7 +3887,7 @@ public class WebView extends AbsoluteLayout
if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) { if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
switchOutDrawHistory(); switchOutDrawHistory();
if (event.getRepeatCount() == 0) { if (event.getRepeatCount() == 0) {
if (mShiftIsPressed && !nativeFocusIsPlugin()) { if (mSelectingText) {
return true; // discard press if copy in progress return true; // discard press if copy in progress
} }
mGotCenterDown = true; mGotCenterDown = true;
@ -3889,10 +3905,8 @@ public class WebView extends AbsoluteLayout
if (keyCode != KeyEvent.KEYCODE_SHIFT_LEFT if (keyCode != KeyEvent.KEYCODE_SHIFT_LEFT
&& keyCode != KeyEvent.KEYCODE_SHIFT_RIGHT) { && keyCode != KeyEvent.KEYCODE_SHIFT_RIGHT) {
// turn off copy select if a shift-key combo is pressed // turn off copy select if a shift-key combo is pressed
mExtendSelection = mShiftIsPressed = false; selectionDone();
if (mTouchMode == TOUCH_SELECT_MODE) { mShiftIsPressed = false;
mTouchMode = TOUCH_INIT_MODE;
}
} }
if (getSettings().getNavDump()) { if (getSettings().getNavDump()) {
@ -3982,7 +3996,8 @@ public class WebView extends AbsoluteLayout
|| keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) { || keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT) {
if (nativeFocusIsPlugin()) { if (nativeFocusIsPlugin()) {
mShiftIsPressed = false; mShiftIsPressed = false;
} else if (commitCopy()) { } else if (copySelection()) {
selectionDone();
return true; return true;
} }
} }
@ -4003,11 +4018,13 @@ public class WebView extends AbsoluteLayout
mPrivateHandler.removeMessages(LONG_PRESS_CENTER); mPrivateHandler.removeMessages(LONG_PRESS_CENTER);
mGotCenterDown = false; mGotCenterDown = false;
if (mShiftIsPressed && !nativeFocusIsPlugin()) { if (mSelectingText) {
if (mExtendSelection) { if (mExtendSelection) {
commitCopy(); copySelection();
selectionDone();
} else { } else {
mExtendSelection = true; mExtendSelection = true;
nativeSetExtendSelection();
invalidate(); // draw the i-beam instead of the arrow invalidate(); // draw the i-beam instead of the arrow
} }
return true; // discard press if copy in progress return true; // discard press if copy in progress
@ -4052,9 +4069,18 @@ public class WebView extends AbsoluteLayout
return false; return false;
} }
private void setUpSelectXY() { /**
* @hide pending API council approval.
*/
public void setUpSelect() {
if (0 == mNativeClass) return; // client isn't initialized
if (inFullScreenMode()) return;
if (mSelectingText) return;
mExtendSelection = false; mExtendSelection = false;
mShiftIsPressed = true; mSelectingText = mDrawSelectionPointer = true;
// don't let the picture change during text selection
WebViewCore.pauseUpdatePicture(mWebViewCore);
nativeResetSelection();
if (nativeHasCursorNode()) { if (nativeHasCursorNode()) {
Rect rect = nativeCursorNodeBounds(); Rect rect = nativeCursorNodeBounds();
mSelectX = contentToViewX(rect.left); mSelectX = contentToViewX(rect.left);
@ -4074,40 +4100,82 @@ public class WebView extends AbsoluteLayout
* Do not rely on this functionality; it will be deprecated in the future. * Do not rely on this functionality; it will be deprecated in the future.
*/ */
public void emulateShiftHeld() { public void emulateShiftHeld() {
if (0 == mNativeClass) return; // client isn't initialized setUpSelect();
setUpSelectXY();
} }
private boolean commitCopy() { /**
* @hide pending API council approval.
*/
public void selectAll() {
if (0 == mNativeClass) return; // client isn't initialized
if (inFullScreenMode()) return;
if (!mSelectingText) setUpSelect();
nativeSelectAll();
mDrawSelectionPointer = false;
mExtendSelection = true;
invalidate();
}
/**
* @hide pending API council approval.
*/
public boolean selectDialogIsUp() {
return mSelectingText;
}
/**
* @hide pending API council approval.
*/
public void notifySelectDialogDismissed() {
mSelectingText = false;
WebViewCore.resumeUpdatePicture(mWebViewCore);
}
/**
* @hide pending API council approval.
*/
public void selectionDone() {
if (mSelectingText) {
getWebChromeClient().onSelectionDone(this);
invalidate(); // redraw without selection
notifySelectDialogDismissed();
}
}
/**
* @hide pending API council approval.
*/
public boolean copySelection() {
boolean copiedSomething = false; boolean copiedSomething = false;
if (mExtendSelection) { String selection = getSelection();
String selection = nativeGetSelection(); if (selection != "") {
if (selection != "") { if (DebugFlags.WEB_VIEW) {
if (DebugFlags.WEB_VIEW) { Log.v(LOGTAG, "copySelection \"" + selection + "\"");
Log.v(LOGTAG, "commitCopy \"" + selection + "\""); }
} Toast.makeText(mContext
Toast.makeText(mContext , com.android.internal.R.string.text_copied
, com.android.internal.R.string.text_copied , Toast.LENGTH_SHORT).show();
, Toast.LENGTH_SHORT).show(); copiedSomething = true;
copiedSomething = true; try {
try { IClipboard clip = IClipboard.Stub.asInterface(
IClipboard clip = IClipboard.Stub.asInterface( ServiceManager.getService("clipboard"));
ServiceManager.getService("clipboard")); clip.setClipboardText(selection);
clip.setClipboardText(selection); } catch (android.os.RemoteException e) {
} catch (android.os.RemoteException e) { Log.e(LOGTAG, "Clipboard failed", e);
Log.e(LOGTAG, "Clipboard failed", e);
}
} }
mExtendSelection = false;
} }
mShiftIsPressed = false;
invalidate(); // remove selection region and pointer invalidate(); // remove selection region and pointer
if (mTouchMode == TOUCH_SELECT_MODE) {
mTouchMode = TOUCH_INIT_MODE;
}
return copiedSomething; return copiedSomething;
} }
/**
* @hide pending API council approval.
*/
public String getSelection() {
if (mNativeClass == 0) return "";
return nativeGetSelection();
}
@Override @Override
protected void onAttachedToWindow() { protected void onAttachedToWindow() {
super.onAttachedToWindow(); super.onAttachedToWindow();
@ -4682,7 +4750,7 @@ public class WebView extends AbsoluteLayout
private boolean shouldForwardTouchEvent() { private boolean shouldForwardTouchEvent() {
return mFullScreenHolder != null || (mForwardTouchEvents return mFullScreenHolder != null || (mForwardTouchEvents
&& mTouchMode != TOUCH_SELECT_MODE && !mSelectingText
&& mPreventDefault != PREVENT_DEFAULT_IGNORE); && mPreventDefault != PREVENT_DEFAULT_IGNORE);
} }
@ -4770,16 +4838,6 @@ public class WebView extends AbsoluteLayout
mTouchMode = TOUCH_DRAG_START_MODE; mTouchMode = TOUCH_DRAG_START_MODE;
mConfirmMove = true; mConfirmMove = true;
mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY); mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY);
} else if (!inFullScreenMode() && mShiftIsPressed) {
mSelectX = mScrollX + (int) x;
mSelectY = mScrollY + (int) y;
mTouchMode = TOUCH_SELECT_MODE;
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "select=" + mSelectX + "," + mSelectY);
}
nativeMoveSelection(contentX, contentY, false);
mTouchSelection = mExtendSelection = true;
invalidate(); // draw the i-beam instead of the arrow
} else if (mPrivateHandler.hasMessages(RELEASE_SINGLE_TAP)) { } else if (mPrivateHandler.hasMessages(RELEASE_SINGLE_TAP)) {
mPrivateHandler.removeMessages(RELEASE_SINGLE_TAP); mPrivateHandler.removeMessages(RELEASE_SINGLE_TAP);
if (deltaX * deltaX + deltaY * deltaY < mDoubleTapSlopSquare) { if (deltaX * deltaX + deltaY * deltaY < mDoubleTapSlopSquare) {
@ -4804,6 +4862,14 @@ public class WebView extends AbsoluteLayout
EventLog.writeEvent(EventLogTags.BROWSER_DOUBLE_TAP_DURATION, EventLog.writeEvent(EventLogTags.BROWSER_DOUBLE_TAP_DURATION,
(eventTime - mLastTouchUpTime), eventTime); (eventTime - mLastTouchUpTime), eventTime);
} }
if (mSelectingText) {
mDrawSelectionPointer = false;
mSelectionStarted = nativeStartSelection(contentX, contentY);
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "select=" + contentX + "," + contentY);
}
invalidate();
}
} }
// Trigger the link // Trigger the link
if (mTouchMode == TOUCH_INIT_MODE if (mTouchMode == TOUCH_INIT_MODE
@ -4895,17 +4961,17 @@ public class WebView extends AbsoluteLayout
+ " mTouchMode = " + mTouchMode); + " mTouchMode = " + mTouchMode);
} }
mVelocityTracker.addMovement(ev); mVelocityTracker.addMovement(ev);
if (mTouchMode != TOUCH_DRAG_MODE) { if (mSelectingText && mSelectionStarted) {
if (mTouchMode == TOUCH_SELECT_MODE) { if (DebugFlags.WEB_VIEW) {
mSelectX = mScrollX + (int) x; Log.v(LOGTAG, "extend=" + contentX + "," + contentY);
mSelectY = mScrollY + (int) y;
if (DebugFlags.WEB_VIEW) {
Log.v(LOGTAG, "xtend=" + mSelectX + "," + mSelectY);
}
nativeMoveSelection(contentX, contentY, true);
invalidate();
break;
} }
nativeExtendSelection(contentX, contentY);
invalidate();
break;
}
if (mTouchMode != TOUCH_DRAG_MODE) {
if (!mConfirmMove) { if (!mConfirmMove) {
break; break;
} }
@ -5072,10 +5138,6 @@ public class WebView extends AbsoluteLayout
mTouchMode = TOUCH_DONE_MODE; mTouchMode = TOUCH_DONE_MODE;
} }
break; break;
case TOUCH_SELECT_MODE:
commitCopy();
mTouchSelection = false;
break;
case TOUCH_INIT_MODE: // tap case TOUCH_INIT_MODE: // tap
case TOUCH_SHORTPRESS_START_MODE: case TOUCH_SHORTPRESS_START_MODE:
case TOUCH_SHORTPRESS_MODE: case TOUCH_SHORTPRESS_MODE:
@ -5106,6 +5168,13 @@ public class WebView extends AbsoluteLayout
break; break;
} }
} else { } else {
if (mSelectingText) {
// tapping on selection or controls does nothing
if (!nativeHitSelection(contentX, contentY)) {
selectionDone();
}
break;
}
if (mTouchMode == TOUCH_INIT_MODE) { if (mTouchMode == TOUCH_INIT_MODE) {
mPrivateHandler.sendEmptyMessageDelayed( mPrivateHandler.sendEmptyMessageDelayed(
RELEASE_SINGLE_TAP, ViewConfiguration RELEASE_SINGLE_TAP, ViewConfiguration
@ -5276,8 +5345,10 @@ public class WebView extends AbsoluteLayout
private float mTrackballRemainsY = 0.0f; private float mTrackballRemainsY = 0.0f;
private int mTrackballXMove = 0; private int mTrackballXMove = 0;
private int mTrackballYMove = 0; private int mTrackballYMove = 0;
private boolean mSelectingText = false;
private boolean mSelectionStarted = false;
private boolean mExtendSelection = false; private boolean mExtendSelection = false;
private boolean mTouchSelection = false; private boolean mDrawSelectionPointer = false;
private static final int TRACKBALL_KEY_TIMEOUT = 1000; private static final int TRACKBALL_KEY_TIMEOUT = 1000;
private static final int TRACKBALL_TIMEOUT = 200; private static final int TRACKBALL_TIMEOUT = 200;
private static final int TRACKBALL_WAIT = 100; private static final int TRACKBALL_WAIT = 100;
@ -5316,10 +5387,8 @@ public class WebView extends AbsoluteLayout
if (ev.getY() < 0) pageUp(true); if (ev.getY() < 0) pageUp(true);
return true; return true;
} }
boolean shiftPressed = mShiftIsPressed && (mNativeClass == 0
|| !nativeFocusIsPlugin());
if (ev.getAction() == MotionEvent.ACTION_DOWN) { if (ev.getAction() == MotionEvent.ACTION_DOWN) {
if (shiftPressed) { if (mSelectingText) {
return true; // discard press if copy in progress return true; // discard press if copy in progress
} }
mTrackballDown = true; mTrackballDown = true;
@ -5344,11 +5413,13 @@ public class WebView extends AbsoluteLayout
mPrivateHandler.removeMessages(LONG_PRESS_CENTER); mPrivateHandler.removeMessages(LONG_PRESS_CENTER);
mTrackballDown = false; mTrackballDown = false;
mTrackballUpTime = time; mTrackballUpTime = time;
if (shiftPressed) { if (mSelectingText) {
if (mExtendSelection) { if (mExtendSelection) {
commitCopy(); copySelection();
selectionDone();
} else { } else {
mExtendSelection = true; mExtendSelection = true;
nativeSetExtendSelection();
invalidate(); // draw the i-beam instead of the arrow invalidate(); // draw the i-beam instead of the arrow
} }
return true; // discard press if copy in progress return true; // discard press if copy in progress
@ -5415,8 +5486,7 @@ public class WebView extends AbsoluteLayout
+ " yRate=" + yRate + " yRate=" + yRate
); );
} }
nativeMoveSelection(viewToContentX(mSelectX), nativeMoveSelection(viewToContentX(mSelectX), viewToContentY(mSelectY));
viewToContentY(mSelectY), mExtendSelection);
int scrollX = mSelectX < mScrollX ? -SELECT_CURSOR_OFFSET int scrollX = mSelectX < mScrollX ? -SELECT_CURSOR_OFFSET
: mSelectX > maxX - SELECT_CURSOR_OFFSET ? SELECT_CURSOR_OFFSET : mSelectX > maxX - SELECT_CURSOR_OFFSET ? SELECT_CURSOR_OFFSET
: 0; : 0;
@ -5482,7 +5552,16 @@ public class WebView extends AbsoluteLayout
float yRate = mTrackballRemainsY * 1000 / elapsed; float yRate = mTrackballRemainsY * 1000 / elapsed;
int viewWidth = getViewWidth(); int viewWidth = getViewWidth();
int viewHeight = getViewHeight(); int viewHeight = getViewHeight();
if (mShiftIsPressed && (mNativeClass == 0 || !nativeFocusIsPlugin())) { if (mSelectingText) {
if (!mDrawSelectionPointer) {
// The last selection was made by touch, disabling drawing the
// selection pointer. Allow the trackball to adjust the
// position of the touch control.
mSelectX = contentToViewX(nativeSelectionX());
mSelectY = contentToViewY(nativeSelectionY());
mDrawSelectionPointer = mExtendSelection = true;
nativeSetExtendSelection();
}
moveSelection(scaleTrackballX(xRate, viewWidth), moveSelection(scaleTrackballX(xRate, viewWidth),
scaleTrackballY(yRate, viewHeight)); scaleTrackballY(yRate, viewHeight));
mTrackballRemainsX = mTrackballRemainsY = 0; mTrackballRemainsX = mTrackballRemainsY = 0;
@ -7402,6 +7481,7 @@ public class WebView extends AbsoluteLayout
private native void nativeDebugDump(); private native void nativeDebugDump();
private native void nativeDestroy(); private native void nativeDestroy();
private native boolean nativeEvaluateLayersAnimations(); private native boolean nativeEvaluateLayersAnimations();
private native void nativeExtendSelection(int x, int y);
private native void nativeDrawExtras(Canvas canvas, int extra); private native void nativeDrawExtras(Canvas canvas, int extra);
private native void nativeDumpDisplayTree(String urlOrNull); private native void nativeDumpDisplayTree(String urlOrNull);
private native int nativeFindAll(String findLower, String findUpper); private native int nativeFindAll(String findLower, String findUpper);
@ -7430,6 +7510,7 @@ public class WebView extends AbsoluteLayout
private native boolean nativeHasCursorNode(); private native boolean nativeHasCursorNode();
private native boolean nativeHasFocusNode(); private native boolean nativeHasFocusNode();
private native void nativeHideCursor(); private native void nativeHideCursor();
private native boolean nativeHitSelection(int x, int y);
private native String nativeImageURI(int x, int y); private native String nativeImageURI(int x, int y);
private native void nativeInstrumentReport(); private native void nativeInstrumentReport();
/* package */ native boolean nativeMoveCursorToNextTextInput(); /* package */ native boolean nativeMoveCursorToNextTextInput();
@ -7439,21 +7520,27 @@ public class WebView extends AbsoluteLayout
private native boolean nativeMoveCursor(int keyCode, int count, private native boolean nativeMoveCursor(int keyCode, int count,
boolean noScroll); boolean noScroll);
private native int nativeMoveGeneration(); private native int nativeMoveGeneration();
private native void nativeMoveSelection(int x, int y, private native void nativeMoveSelection(int x, int y);
boolean extendSelection);
private native boolean nativePointInNavCache(int x, int y, int slop); private native boolean nativePointInNavCache(int x, int y, int slop);
// Like many other of our native methods, you must make sure that // Like many other of our native methods, you must make sure that
// mNativeClass is not null before calling this method. // mNativeClass is not null before calling this method.
private native void nativeRecordButtons(boolean focused, private native void nativeRecordButtons(boolean focused,
boolean pressed, boolean invalidate); boolean pressed, boolean invalidate);
private native void nativeResetSelection();
private native void nativeSelectAll();
private native void nativeSelectBestAt(Rect rect); private native void nativeSelectBestAt(Rect rect);
private native int nativeSelectionX();
private native int nativeSelectionY();
private native int nativeFindIndex();
private native void nativeSetExtendSelection();
private native void nativeSetFindIsEmpty(); private native void nativeSetFindIsEmpty();
private native void nativeSetFindIsUp(boolean isUp); private native void nativeSetFindIsUp(boolean isUp);
private native void nativeSetFollowedLink(boolean followed); private native void nativeSetFollowedLink(boolean followed);
private native void nativeSetHeightCanMeasure(boolean measure); private native void nativeSetHeightCanMeasure(boolean measure);
private native void nativeSetRootLayer(int layer); private native void nativeSetRootLayer(int layer);
private native void nativeSetSelectionPointer(boolean set, private native void nativeSetSelectionPointer(boolean set,
float scale, int x, int y, boolean extendSelection); float scale, int x, int y);
private native boolean nativeStartSelection(int x, int y);
private native void nativeSetSelectionRegion(boolean set); private native void nativeSetSelectionRegion(boolean set);
private native Rect nativeSubtractLayers(Rect content); private native Rect nativeSubtractLayers(Rect content);
private native int nativeTextGeneration(); private native int nativeTextGeneration();
@ -7461,6 +7548,7 @@ public class WebView extends AbsoluteLayout
// we always want to pass in our generation number. // we always want to pass in our generation number.
private native void nativeUpdateCachedTextfield(String updatedText, private native void nativeUpdateCachedTextfield(String updatedText,
int generation); int generation);
private native boolean nativeWordSelection(int x, int y);
// return NO_LEFTEDGE means failure. // return NO_LEFTEDGE means failure.
private static final int NO_LEFTEDGE = -1; private static final int NO_LEFTEDGE = -1;
private native int nativeGetBlockLeftEdge(int x, int y, float scale); private native int nativeGetBlockLeftEdge(int x, int y, float scale);