am 09e383c9: tweak select text
Merge commit '09e383c9ff4a3b762084e999dfb5fdd347abc151' into eclair-mr2-plus-aosp * commit '09e383c9ff4a3b762084e999dfb5fdd347abc151': tweak select text
This commit is contained in:
@@ -2971,11 +2971,12 @@ public class WebView extends AbsoluteLayout
|
|||||||
|
|
||||||
if (mNativeClass == 0) return;
|
if (mNativeClass == 0) return;
|
||||||
if (mShiftIsPressed && !animateZoom) {
|
if (mShiftIsPressed && !animateZoom) {
|
||||||
if (mTouchSelection) {
|
if (mTouchSelection || mExtendSelection) {
|
||||||
nativeDrawSelectionRegion(canvas);
|
nativeDrawSelectionRegion(canvas);
|
||||||
} else {
|
}
|
||||||
nativeDrawSelection(canvas, mInvActualScale, getTitleHeight(),
|
if (!mTouchSelection) {
|
||||||
mSelectX, mSelectY, mExtendSelection);
|
nativeDrawSelectionPointer(canvas, mInvActualScale, mSelectX,
|
||||||
|
mSelectY - getTitleHeight(), mExtendSelection);
|
||||||
}
|
}
|
||||||
} else if (drawCursorRing) {
|
} else if (drawCursorRing) {
|
||||||
if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
|
if (mTouchMode == TOUCH_SHORTPRESS_START_MODE) {
|
||||||
@@ -3275,18 +3276,8 @@ public class WebView extends AbsoluteLayout
|
|||||||
if (mShiftIsPressed == false && nativeCursorWantsKeyEvents() == false
|
if (mShiftIsPressed == false && nativeCursorWantsKeyEvents() == false
|
||||||
&& (keyCode == KeyEvent.KEYCODE_SHIFT_LEFT
|
&& (keyCode == KeyEvent.KEYCODE_SHIFT_LEFT
|
||||||
|| keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT)) {
|
|| keyCode == KeyEvent.KEYCODE_SHIFT_RIGHT)) {
|
||||||
mExtendSelection = false;
|
setUpSelectXY();
|
||||||
mShiftIsPressed = true;
|
}
|
||||||
if (nativeHasCursorNode()) {
|
|
||||||
Rect rect = nativeCursorNodeBounds();
|
|
||||||
mSelectX = contentToViewX(rect.left);
|
|
||||||
mSelectY = contentToViewY(rect.top);
|
|
||||||
} else {
|
|
||||||
mSelectX = mScrollX + (int) mLastTouchX;
|
|
||||||
mSelectY = mScrollY + (int) mLastTouchY;
|
|
||||||
}
|
|
||||||
nativeHideCursor();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyCode >= KeyEvent.KEYCODE_DPAD_UP
|
if (keyCode >= KeyEvent.KEYCODE_DPAD_UP
|
||||||
&& keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) {
|
&& keyCode <= KeyEvent.KEYCODE_DPAD_RIGHT) {
|
||||||
@@ -3454,6 +3445,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
commitCopy();
|
commitCopy();
|
||||||
} else {
|
} else {
|
||||||
mExtendSelection = true;
|
mExtendSelection = true;
|
||||||
|
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
|
||||||
}
|
}
|
||||||
@@ -3494,14 +3486,29 @@ public class WebView extends AbsoluteLayout
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setUpSelectXY() {
|
||||||
|
mExtendSelection = false;
|
||||||
|
mShiftIsPressed = true;
|
||||||
|
if (nativeHasCursorNode()) {
|
||||||
|
Rect rect = nativeCursorNodeBounds();
|
||||||
|
mSelectX = contentToViewX(rect.left);
|
||||||
|
mSelectY = contentToViewY(rect.top);
|
||||||
|
} else if (mLastTouchY > getVisibleTitleHeight()) {
|
||||||
|
mSelectX = mScrollX + (int) mLastTouchX;
|
||||||
|
mSelectY = mScrollY + (int) mLastTouchY;
|
||||||
|
} else {
|
||||||
|
mSelectX = mScrollX + getViewWidth() / 2;
|
||||||
|
mSelectY = mScrollY + getViewHeightWithTitle() / 2;
|
||||||
|
}
|
||||||
|
nativeHideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @hide
|
* @hide
|
||||||
*/
|
*/
|
||||||
public void emulateShiftHeld() {
|
public void emulateShiftHeld() {
|
||||||
if (0 == mNativeClass) return; // client isn't initialized
|
if (0 == mNativeClass) return; // client isn't initialized
|
||||||
mExtendSelection = false;
|
setUpSelectXY();
|
||||||
mShiftIsPressed = true;
|
|
||||||
nativeHideCursor();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean commitCopy() {
|
private boolean commitCopy() {
|
||||||
@@ -3519,6 +3526,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
mExtendSelection = false;
|
mExtendSelection = false;
|
||||||
}
|
}
|
||||||
mShiftIsPressed = false;
|
mShiftIsPressed = false;
|
||||||
|
invalidate(); // remove selection region and pointer
|
||||||
if (mTouchMode == TOUCH_SELECT_MODE) {
|
if (mTouchMode == TOUCH_SELECT_MODE) {
|
||||||
mTouchMode = TOUCH_INIT_MODE;
|
mTouchMode = TOUCH_INIT_MODE;
|
||||||
}
|
}
|
||||||
@@ -3813,6 +3821,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
nativeMoveSelection(viewToContentX(mSelectX),
|
nativeMoveSelection(viewToContentX(mSelectX),
|
||||||
viewToContentY(mSelectY), false);
|
viewToContentY(mSelectY), false);
|
||||||
mTouchSelection = mExtendSelection = true;
|
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) {
|
||||||
@@ -4195,6 +4204,7 @@ public class WebView extends AbsoluteLayout
|
|||||||
commitCopy();
|
commitCopy();
|
||||||
} else {
|
} else {
|
||||||
mExtendSelection = true;
|
mExtendSelection = true;
|
||||||
|
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
|
||||||
}
|
}
|
||||||
@@ -5803,8 +5813,8 @@ public class WebView extends AbsoluteLayout
|
|||||||
private native void nativeDestroy();
|
private native void nativeDestroy();
|
||||||
private native void nativeDrawCursorRing(Canvas content);
|
private native void nativeDrawCursorRing(Canvas content);
|
||||||
private native void nativeDrawMatches(Canvas canvas);
|
private native void nativeDrawMatches(Canvas canvas);
|
||||||
private native void nativeDrawSelection(Canvas content, float scale,
|
private native void nativeDrawSelectionPointer(Canvas content,
|
||||||
int offset, int x, int y, boolean extendSelection);
|
float scale, int x, int y, boolean extendSelection);
|
||||||
private native void nativeDrawSelectionRegion(Canvas content);
|
private native void nativeDrawSelectionRegion(Canvas content);
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user