OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.TargetApi; | 7 import android.annotation.TargetApi; |
8 import android.graphics.Matrix; | 8 import android.graphics.Matrix; |
9 import android.os.Build; | 9 import android.os.Build; |
10 import android.view.View; | 10 import android.view.View; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 /** | 129 /** |
130 * Sets positional information of composing text as an array of character bo unds. | 130 * Sets positional information of composing text as an array of character bo unds. |
131 * @param compositionCharacterBounds Array of character bounds in local coor dinates. | 131 * @param compositionCharacterBounds Array of character bounds in local coor dinates. |
132 */ | 132 */ |
133 public void setCompositionCharacterBounds(float[] compositionCharacterBounds ) { | 133 public void setCompositionCharacterBounds(float[] compositionCharacterBounds ) { |
134 if (!mIsEditable) return; | 134 if (!mIsEditable) return; |
135 | 135 |
136 if (!Arrays.equals(compositionCharacterBounds, mCompositionCharacterBoun ds)) { | 136 if (!Arrays.equals(compositionCharacterBounds, mCompositionCharacterBoun ds)) { |
137 mLastCursorAnchorInfo = null; | 137 mLastCursorAnchorInfo = null; |
138 mCompositionCharacterBounds = compositionCharacterBounds; | 138 mCompositionCharacterBounds = compositionCharacterBounds; |
139 } | 139 } |
kinaba
2016/07/05 08:50:09
We may have to invoke updateCursorAnchorInfo() fro
Seigo Nonaka
2016/07/06 03:25:56
Done.
| |
140 } | 140 } |
141 | 141 |
142 /** | 142 /** |
143 * Sets coordinates system parameters and selection marker information. | 143 * Sets coordinates system parameters and selection marker information. |
144 * @param hasInsertionMarker {@code true} if the insertion marker exists. | 144 * @param hasInsertionMarker {@code true} if the insertion marker exists. |
145 * @param isInsertionMarkerVisible {@code true} if the insertion insertion m arker is visible. | 145 * @param isInsertionMarkerVisible {@code true} if the insertion insertion m arker is visible. |
146 * @param insertionMarkerHorizontal X coordinate of the top of the first sel ection marker. | 146 * @param insertionMarkerHorizontal X coordinate of the top of the first sel ection marker. |
147 * @param insertionMarkerTop Y coordinate of the top of the first selection marker. | 147 * @param insertionMarkerTop Y coordinate of the top of the first selection marker. |
148 * @param insertionMarkerBottom Y coordinate of the bottom of the first sele ction marker. | 148 * @param insertionMarkerBottom Y coordinate of the bottom of the first sele ction marker. |
149 * @param view The attached view. | 149 * @param view The attached view. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 } | 191 } |
192 | 192 |
193 // Notify to IME if there is a pending request, or if it is in monitor m ode and we have | 193 // Notify to IME if there is a pending request, or if it is in monitor m ode and we have |
194 // some change in the state. | 194 // some change in the state. |
195 if (mHasPendingImmediateRequest | 195 if (mHasPendingImmediateRequest |
196 || (mMonitorModeEnabled && mLastCursorAnchorInfo == null)) { | 196 || (mMonitorModeEnabled && mLastCursorAnchorInfo == null)) { |
197 updateCursorAnchorInfo(view); | 197 updateCursorAnchorInfo(view); |
198 } | 198 } |
199 } | 199 } |
200 | 200 |
201 /** | |
202 * Resets the current state on update monitoring mode to the default (= do n othing.) | |
203 */ | |
204 public void resetMonitoringState() { | |
205 mMonitorModeEnabled = false; | |
206 mHasPendingImmediateRequest = false; | |
207 } | |
208 | |
209 public void focusedNodeChanged(boolean isEditable) { | 201 public void focusedNodeChanged(boolean isEditable) { |
210 mIsEditable = isEditable; | 202 mIsEditable = isEditable; |
211 mCompositionCharacterBounds = null; | 203 mCompositionCharacterBounds = null; |
212 mHasCoordinateInfo = false; | 204 mHasCoordinateInfo = false; |
213 mLastCursorAnchorInfo = null; | 205 mLastCursorAnchorInfo = null; |
214 } | 206 } |
215 | 207 |
216 public boolean onRequestCursorUpdates(int cursorUpdateMode, View view) { | 208 public boolean onRequestCursorUpdates(int cursorUpdateMode, View view) { |
217 if (!mIsEditable) return false; | 209 if (!mIsEditable) return false; |
218 | 210 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 } | 263 } |
272 mLastCursorAnchorInfo = mCursorAnchorInfoBuilder.build(); | 264 mLastCursorAnchorInfo = mCursorAnchorInfoBuilder.build(); |
273 } | 265 } |
274 | 266 |
275 if (mInputMethodManagerWrapper != null) { | 267 if (mInputMethodManagerWrapper != null) { |
276 mInputMethodManagerWrapper.updateCursorAnchorInfo(view, mLastCursorA nchorInfo); | 268 mInputMethodManagerWrapper.updateCursorAnchorInfo(view, mLastCursorA nchorInfo); |
277 } | 269 } |
278 mHasPendingImmediateRequest = false; | 270 mHasPendingImmediateRequest = false; |
279 } | 271 } |
280 } | 272 } |
OLD | NEW |