Loading core/java/android/webkit/WebViewClassic.java +12 −4 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ import android.webkit.WebView.PictureListener; import android.webkit.WebViewCore.DrawData; import android.webkit.WebViewCore.EventHub; import android.webkit.WebViewCore.TextFieldInitData; import android.webkit.WebViewCore.TextSelectionData; import android.webkit.WebViewCore.TouchHighlightData; import android.webkit.WebViewCore.WebKitHitTest; import android.widget.AbsoluteLayout; Loading Loading @@ -4211,7 +4212,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc // decide which adornments to draw int extras = DRAW_EXTRAS_NONE; if (!mFindIsUp && mSelectingText) { if (!mFindIsUp && mShowTextSelectionExtra) { extras = DRAW_EXTRAS_SELECTION; } Loading Loading @@ -4535,11 +4536,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc private void startSelectingText() { mSelectingText = true; mShowTextSelectionExtra = true; mHandleAlphaAnimator.setIntValues(255); mHandleAlphaAnimator.start(); } private void endSelectingText() { mSelectingText = false; mShowTextSelectionExtra = false; mHandleAlphaAnimator.setIntValues(0); mHandleAlphaAnimator.start(); } Loading Loading @@ -5312,9 +5315,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc mSelectCallback.finish(); mSelectCallback = null; } if (!mIsCaretSelection) { updateWebkitSelection(); } invalidate(); // redraw without selection mAutoScrollX = 0; mAutoScrollY = 0; Loading Loading @@ -6442,6 +6442,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc private int mTrackballXMove = 0; private int mTrackballYMove = 0; private boolean mSelectingText = false; private boolean mShowTextSelectionExtra = false; private boolean mSelectionStarted = false; private static final int TRACKBALL_KEY_TIMEOUT = 1000; private static final int TRACKBALL_TIMEOUT = 200; Loading Loading @@ -7942,6 +7943,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc } nativeSetTextSelection(mNativeClass, data.mSelectTextPtr); if (data.mSelectionReason == TextSelectionData.REASON_ACCESSIBILITY_INJECTOR) { selectionDone(); mShowTextSelectionExtra = true; invalidate(); return; } if (data.mSelectTextPtr != 0 && (data.mStart != data.mEnd || (mFieldPointer == nodePointer && mFieldPointer != 0))) { Loading core/java/android/webkit/WebViewCore.java +16 −2 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public final class WebViewCore { private int mHighUsageDeltaMb; private int mChromeCanFocusDirection; private int mTextSelectionChangeReason = TextSelectionData.REASON_UNKNOWN; // The thread name used to identify the WebCore thread and for use in // debugging other classes that require operation within the WebCore thread. Loading Loading @@ -861,6 +862,8 @@ public final class WebViewCore { } static class TextSelectionData { static final int REASON_UNKNOWN = 0; static final int REASON_ACCESSIBILITY_INJECTOR = 1; public TextSelectionData(int start, int end, int selectTextPtr) { mStart = start; mEnd = end; Loading @@ -869,6 +872,7 @@ public final class WebViewCore { int mStart; int mEnd; int mSelectTextPtr; int mSelectionReason = TextSelectionData.REASON_UNKNOWN; } static class TouchUpData { Loading Loading @@ -1544,12 +1548,16 @@ public final class WebViewCore { break; case MODIFY_SELECTION: mTextSelectionChangeReason = TextSelectionData.REASON_ACCESSIBILITY_INJECTOR; String modifiedSelectionString = nativeModifySelection(mNativeClass, msg.arg1, msg.arg2); mWebViewClassic.mPrivateHandler.obtainMessage( WebViewClassic.SELECTION_STRING_CHANGED, modifiedSelectionString).sendToTarget(); mTextSelectionChangeReason = TextSelectionData.REASON_UNKNOWN; break; case LISTBOX_CHOICES: Loading Loading @@ -2763,13 +2771,19 @@ public final class WebViewCore { } } private TextSelectionData createTextSelection(int start, int end, int selPtr) { TextSelectionData data = new TextSelectionData(start, end, selPtr); data.mSelectionReason = mTextSelectionChangeReason; return data; } // called by JNI private void updateTextSelection(int pointer, int start, int end, int textGeneration, int selectionPtr) { if (mWebViewClassic != null) { Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.UPDATE_TEXT_SELECTION_MSG_ID, pointer, textGeneration, new TextSelectionData(start, end, selectionPtr)).sendToTarget(); createTextSelection(start, end, selectionPtr)).sendToTarget(); } } Loading Loading @@ -2803,7 +2817,7 @@ public final class WebViewCore { Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.UPDATE_TEXT_SELECTION_MSG_ID, initData.mFieldPointer, 0, new TextSelectionData(start, end, selectionPtr)) createTextSelection(start, end, selectionPtr)) .sendToTarget(); } Loading Loading
core/java/android/webkit/WebViewClassic.java +12 −4 Original line number Diff line number Diff line Loading @@ -102,6 +102,7 @@ import android.webkit.WebView.PictureListener; import android.webkit.WebViewCore.DrawData; import android.webkit.WebViewCore.EventHub; import android.webkit.WebViewCore.TextFieldInitData; import android.webkit.WebViewCore.TextSelectionData; import android.webkit.WebViewCore.TouchHighlightData; import android.webkit.WebViewCore.WebKitHitTest; import android.widget.AbsoluteLayout; Loading Loading @@ -4211,7 +4212,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc // decide which adornments to draw int extras = DRAW_EXTRAS_NONE; if (!mFindIsUp && mSelectingText) { if (!mFindIsUp && mShowTextSelectionExtra) { extras = DRAW_EXTRAS_SELECTION; } Loading Loading @@ -4535,11 +4536,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc private void startSelectingText() { mSelectingText = true; mShowTextSelectionExtra = true; mHandleAlphaAnimator.setIntValues(255); mHandleAlphaAnimator.start(); } private void endSelectingText() { mSelectingText = false; mShowTextSelectionExtra = false; mHandleAlphaAnimator.setIntValues(0); mHandleAlphaAnimator.start(); } Loading Loading @@ -5312,9 +5315,6 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc mSelectCallback.finish(); mSelectCallback = null; } if (!mIsCaretSelection) { updateWebkitSelection(); } invalidate(); // redraw without selection mAutoScrollX = 0; mAutoScrollY = 0; Loading Loading @@ -6442,6 +6442,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc private int mTrackballXMove = 0; private int mTrackballYMove = 0; private boolean mSelectingText = false; private boolean mShowTextSelectionExtra = false; private boolean mSelectionStarted = false; private static final int TRACKBALL_KEY_TIMEOUT = 1000; private static final int TRACKBALL_TIMEOUT = 200; Loading Loading @@ -7942,6 +7943,13 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc } nativeSetTextSelection(mNativeClass, data.mSelectTextPtr); if (data.mSelectionReason == TextSelectionData.REASON_ACCESSIBILITY_INJECTOR) { selectionDone(); mShowTextSelectionExtra = true; invalidate(); return; } if (data.mSelectTextPtr != 0 && (data.mStart != data.mEnd || (mFieldPointer == nodePointer && mFieldPointer != 0))) { Loading
core/java/android/webkit/WebViewCore.java +16 −2 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ public final class WebViewCore { private int mHighUsageDeltaMb; private int mChromeCanFocusDirection; private int mTextSelectionChangeReason = TextSelectionData.REASON_UNKNOWN; // The thread name used to identify the WebCore thread and for use in // debugging other classes that require operation within the WebCore thread. Loading Loading @@ -861,6 +862,8 @@ public final class WebViewCore { } static class TextSelectionData { static final int REASON_UNKNOWN = 0; static final int REASON_ACCESSIBILITY_INJECTOR = 1; public TextSelectionData(int start, int end, int selectTextPtr) { mStart = start; mEnd = end; Loading @@ -869,6 +872,7 @@ public final class WebViewCore { int mStart; int mEnd; int mSelectTextPtr; int mSelectionReason = TextSelectionData.REASON_UNKNOWN; } static class TouchUpData { Loading Loading @@ -1544,12 +1548,16 @@ public final class WebViewCore { break; case MODIFY_SELECTION: mTextSelectionChangeReason = TextSelectionData.REASON_ACCESSIBILITY_INJECTOR; String modifiedSelectionString = nativeModifySelection(mNativeClass, msg.arg1, msg.arg2); mWebViewClassic.mPrivateHandler.obtainMessage( WebViewClassic.SELECTION_STRING_CHANGED, modifiedSelectionString).sendToTarget(); mTextSelectionChangeReason = TextSelectionData.REASON_UNKNOWN; break; case LISTBOX_CHOICES: Loading Loading @@ -2763,13 +2771,19 @@ public final class WebViewCore { } } private TextSelectionData createTextSelection(int start, int end, int selPtr) { TextSelectionData data = new TextSelectionData(start, end, selPtr); data.mSelectionReason = mTextSelectionChangeReason; return data; } // called by JNI private void updateTextSelection(int pointer, int start, int end, int textGeneration, int selectionPtr) { if (mWebViewClassic != null) { Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.UPDATE_TEXT_SELECTION_MSG_ID, pointer, textGeneration, new TextSelectionData(start, end, selectionPtr)).sendToTarget(); createTextSelection(start, end, selectionPtr)).sendToTarget(); } } Loading Loading @@ -2803,7 +2817,7 @@ public final class WebViewCore { Message.obtain(mWebViewClassic.mPrivateHandler, WebViewClassic.UPDATE_TEXT_SELECTION_MSG_ID, initData.mFieldPointer, 0, new TextSelectionData(start, end, selectionPtr)) createTextSelection(start, end, selectionPtr)) .sendToTarget(); } Loading