OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser.input; | 5 package org.chromium.content.browser.input; |
6 | 6 |
7 import android.annotation.SuppressLint; | 7 import android.annotation.SuppressLint; |
8 import android.content.res.Configuration; | 8 import android.content.res.Configuration; |
9 import android.graphics.Rect; | 9 import android.graphics.Rect; |
10 import android.os.Build; | 10 import android.os.Build; |
(...skipping 15 matching lines...) Expand all Loading... |
26 import android.view.inputmethod.InputMethodManager; | 26 import android.view.inputmethod.InputMethodManager; |
27 | 27 |
28 import org.chromium.base.Log; | 28 import org.chromium.base.Log; |
29 import org.chromium.base.TraceEvent; | 29 import org.chromium.base.TraceEvent; |
30 import org.chromium.base.VisibleForTesting; | 30 import org.chromium.base.VisibleForTesting; |
31 import org.chromium.base.annotations.CalledByNative; | 31 import org.chromium.base.annotations.CalledByNative; |
32 import org.chromium.base.annotations.JNINamespace; | 32 import org.chromium.base.annotations.JNINamespace; |
33 import org.chromium.blink_public.web.WebInputEventModifier; | 33 import org.chromium.blink_public.web.WebInputEventModifier; |
34 import org.chromium.blink_public.web.WebInputEventType; | 34 import org.chromium.blink_public.web.WebInputEventType; |
35 import org.chromium.blink_public.web.WebTextInputMode; | 35 import org.chromium.blink_public.web.WebTextInputMode; |
36 import org.chromium.content.browser.RenderCoordinates; | |
37 import org.chromium.content.browser.ViewUtils; | 36 import org.chromium.content.browser.ViewUtils; |
38 import org.chromium.content.browser.picker.InputDialogContainer; | 37 import org.chromium.content.browser.picker.InputDialogContainer; |
39 import org.chromium.content_public.browser.ImeEventObserver; | 38 import org.chromium.content_public.browser.ImeEventObserver; |
40 import org.chromium.content_public.browser.WebContents; | 39 import org.chromium.content_public.browser.WebContents; |
41 import org.chromium.ui.base.ime.TextInputType; | 40 import org.chromium.ui.base.ime.TextInputType; |
42 | 41 |
43 import java.lang.ref.WeakReference; | 42 import java.lang.ref.WeakReference; |
44 import java.util.ArrayList; | 43 import java.util.ArrayList; |
45 import java.util.List; | 44 import java.util.List; |
46 | 45 |
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 if (isValid()) { | 815 if (isValid()) { |
817 nativeRequestCursorUpdate(mNativeImeAdapterAndroid, immediateRequest
, monitorRequest); | 816 nativeRequestCursorUpdate(mNativeImeAdapterAndroid, immediateRequest
, monitorRequest); |
818 } | 817 } |
819 if (mCursorAnchorInfoController == null) return false; | 818 if (mCursorAnchorInfoController == null) return false; |
820 return mCursorAnchorInfoController.onRequestCursorUpdates( | 819 return mCursorAnchorInfoController.onRequestCursorUpdates( |
821 immediateRequest, monitorRequest, mContainerView); | 820 immediateRequest, monitorRequest, mContainerView); |
822 } | 821 } |
823 | 822 |
824 /** | 823 /** |
825 * Notified when a frame has been produced by the renderer and all the assoc
iated metadata. | 824 * Notified when a frame has been produced by the renderer and all the assoc
iated metadata. |
826 * @param renderCoordinates coordinate information to convert CSS (document)
coordinates to | 825 * @param scaleFactor device scale factor. |
827 * View-local Physical (screen) coordinates | 826 * @param contentOffsetYPix Y offset below the browser controls. |
828 * @param hasInsertionMarker Whether the insertion marker is visible or not. | 827 * @param hasInsertionMarker Whether the insertion marker is visible or not. |
829 * @param insertionMarkerHorizontal X coordinates (in view-local DIP pixels)
of the insertion | 828 * @param insertionMarkerHorizontal X coordinates (in view-local DIP pixels)
of the insertion |
830 * marker if it exists. Will be ignored oth
erwise. | 829 * marker if it exists. Will be ignored oth
erwise. |
831 * @param insertionMarkerTop Y coordinates (in view-local DIP pixels) of the
top of the | 830 * @param insertionMarkerTop Y coordinates (in view-local DIP pixels) of the
top of the |
832 * insertion marker if it exists. Will be ignored
otherwise. | 831 * insertion marker if it exists. Will be ignored
otherwise. |
833 * @param insertionMarkerBottom Y coordinates (in view-local DIP pixels) of
the bottom of | 832 * @param insertionMarkerBottom Y coordinates (in view-local DIP pixels) of
the bottom of |
834 * the insertion marker if it exists. Will be i
gnored otherwise. | 833 * the insertion marker if it exists. Will be i
gnored otherwise. |
835 */ | 834 */ |
836 public void onUpdateFrameInfo(RenderCoordinates renderCoordinates, boolean h
asInsertionMarker, | 835 @CalledByNative |
837 boolean isInsertionMarkerVisible, float insertionMarkerHorizontal, | 836 private void updateFrameInfo(float scaleFactor, float contentOffsetYPix, |
838 float insertionMarkerTop, float insertionMarkerBottom) { | 837 boolean hasInsertionMarker, boolean isInsertionMarkerVisible, |
| 838 float insertionMarkerHorizontal, float insertionMarkerTop, |
| 839 float insertionMarkerBottom) { |
839 if (mCursorAnchorInfoController == null) return; | 840 if (mCursorAnchorInfoController == null) return; |
840 mCursorAnchorInfoController.onUpdateFrameInfo(renderCoordinates, hasInse
rtionMarker, | 841 mCursorAnchorInfoController.onUpdateFrameInfo(scaleFactor, contentOffset
YPix, |
841 isInsertionMarkerVisible, insertionMarkerHorizontal, insertionMa
rkerTop, | 842 hasInsertionMarker, isInsertionMarkerVisible, insertionMarkerHor
izontal, |
842 insertionMarkerBottom, mContainerView); | 843 insertionMarkerTop, insertionMarkerBottom, mContainerView); |
843 } | 844 } |
844 | 845 |
845 @CalledByNative | 846 @CalledByNative |
846 private void populateUnderlinesFromSpans(CharSequence text, long underlines)
{ | 847 private void populateUnderlinesFromSpans(CharSequence text, long underlines)
{ |
847 if (DEBUG_LOGS) { | 848 if (DEBUG_LOGS) { |
848 Log.i(TAG, "populateUnderlinesFromSpans: text [%s], underlines [%d]"
, text, underlines); | 849 Log.i(TAG, "populateUnderlinesFromSpans: text [%s], underlines [%d]"
, text, underlines); |
849 } | 850 } |
850 if (!(text instanceof SpannableString)) return; | 851 if (!(text instanceof SpannableString)) return; |
851 | 852 |
852 SpannableString spannableString = ((SpannableString) text); | 853 SpannableString spannableString = ((SpannableString) text); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 int start, int end); | 901 int start, int end); |
901 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i
nt start, int end); | 902 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i
nt start, int end); |
902 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, | 903 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, |
903 int before, int after); | 904 int before, int after); |
904 private native void nativeDeleteSurroundingTextInCodePoints( | 905 private native void nativeDeleteSurroundingTextInCodePoints( |
905 long nativeImeAdapterAndroid, int before, int after); | 906 long nativeImeAdapterAndroid, int before, int after); |
906 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt
erAndroid); | 907 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt
erAndroid); |
907 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, | 908 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, |
908 boolean immediateRequest, boolean monitorRequest); | 909 boolean immediateRequest, boolean monitorRequest); |
909 } | 910 } |
OLD | NEW |