Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java

Issue 411383002: Fix composition key-code after switching to a new input field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added reset of state in a couple other places Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.os.Handler; 7 import android.os.Handler;
8 import android.os.ResultReceiver; 8 import android.os.ResultReceiver;
9 import android.os.SystemClock; 9 import android.os.SystemClock;
10 import android.text.Editable; 10 import android.text.Editable;
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 InputMethodManagerWrapper getInputMethodManagerWrapper() { 173 InputMethodManagerWrapper getInputMethodManagerWrapper() {
174 return mInputMethodManagerWrapper; 174 return mInputMethodManagerWrapper;
175 } 175 }
176 176
177 /** 177 /**
178 * Set the current active InputConnection when a new InputConnection is cons tructed. 178 * Set the current active InputConnection when a new InputConnection is cons tructed.
179 * @param inputConnection The input connection that is currently used with I ME. 179 * @param inputConnection The input connection that is currently used with I ME.
180 */ 180 */
181 void setInputConnection(AdapterInputConnection inputConnection) { 181 void setInputConnection(AdapterInputConnection inputConnection) {
182 mInputConnection = inputConnection; 182 mInputConnection = inputConnection;
183 mLastComposeText = null;
183 } 184 }
184 185
185 /** 186 /**
186 * Should be only used by AdapterInputConnection. 187 * Should be only used by AdapterInputConnection.
187 * @return The input type of currently focused element. 188 * @return The input type of currently focused element.
188 */ 189 */
189 int getTextInputType() { 190 int getTextInputType() {
190 return mTextInputType; 191 return mTextInputType;
191 } 192 }
192 193
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 showKeyboard(); 253 showKeyboard();
253 } 254 }
254 } 255 }
255 256
256 public void attach(long nativeImeAdapter, int textInputType) { 257 public void attach(long nativeImeAdapter, int textInputType) {
257 if (mNativeImeAdapterAndroid != 0) { 258 if (mNativeImeAdapterAndroid != 0) {
258 nativeResetImeAdapter(mNativeImeAdapterAndroid); 259 nativeResetImeAdapter(mNativeImeAdapterAndroid);
259 } 260 }
260 mNativeImeAdapterAndroid = nativeImeAdapter; 261 mNativeImeAdapterAndroid = nativeImeAdapter;
261 mTextInputType = textInputType; 262 mTextInputType = textInputType;
263 mLastComposeText = null;
262 if (nativeImeAdapter != 0) { 264 if (nativeImeAdapter != 0) {
263 nativeAttachImeAdapter(mNativeImeAdapterAndroid); 265 nativeAttachImeAdapter(mNativeImeAdapterAndroid);
264 } 266 }
265 if (mTextInputType == sTextInputTypeNone) { 267 if (mTextInputType == sTextInputTypeNone) {
266 dismissInput(false); 268 dismissInput(false);
267 } 269 }
268 } 270 }
269 271
270 /** 272 /**
271 * Attaches the imeAdapter to its native counterpart. This is needed to star t forwarding 273 * Attaches the imeAdapter to its native counterpart. This is needed to star t forwarding
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } 430 }
429 431
430 nativeSendSyntheticKeyEvent(mNativeImeAdapterAndroid, sEventTypeKeyU p, 432 nativeSendSyntheticKeyEvent(mNativeImeAdapterAndroid, sEventTypeKeyU p,
431 timeStampMs, keyCode, 0); 433 timeStampMs, keyCode, 0);
432 } 434 }
433 435
434 return true; 436 return true;
435 } 437 }
436 438
437 void finishComposingText() { 439 void finishComposingText() {
440 mLastComposeText = null;
438 if (mNativeImeAdapterAndroid == 0) return; 441 if (mNativeImeAdapterAndroid == 0) return;
439 nativeFinishComposingText(mNativeImeAdapterAndroid); 442 nativeFinishComposingText(mNativeImeAdapterAndroid);
440 } 443 }
441 444
442 boolean translateAndSendNativeEvents(KeyEvent event) { 445 boolean translateAndSendNativeEvents(KeyEvent event) {
443 if (mNativeImeAdapterAndroid == 0) return false; 446 if (mNativeImeAdapterAndroid == 0) return false;
444 447
445 int action = event.getAction(); 448 int action = event.getAction();
446 if (action != KeyEvent.ACTION_DOWN && 449 if (action != KeyEvent.ACTION_DOWN &&
447 action != KeyEvent.ACTION_UP) { 450 action != KeyEvent.ACTION_UP) {
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , 663 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid ,
661 int before, int after); 664 int before, int after);
662 665
663 private native void nativeUnselect(long nativeImeAdapterAndroid); 666 private native void nativeUnselect(long nativeImeAdapterAndroid);
664 private native void nativeSelectAll(long nativeImeAdapterAndroid); 667 private native void nativeSelectAll(long nativeImeAdapterAndroid);
665 private native void nativeCut(long nativeImeAdapterAndroid); 668 private native void nativeCut(long nativeImeAdapterAndroid);
666 private native void nativeCopy(long nativeImeAdapterAndroid); 669 private native void nativeCopy(long nativeImeAdapterAndroid);
667 private native void nativePaste(long nativeImeAdapterAndroid); 670 private native void nativePaste(long nativeImeAdapterAndroid);
668 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); 671 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid);
669 } 672 }
OLDNEW
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/input/ImeTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698