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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java

Issue 442433002: Not allowing user to type more chars than max length value for text field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: few nits resolved 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 side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
index 36b80513cdbb493fac73603d6a9f1ad3645a2087..3c4015866d1a355c82d2a8cf3f88f022e66205cc 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/AdapterInputConnection.java
@@ -213,6 +213,10 @@ public class AdapterInputConnection extends BaseInputConnection {
@Override
public boolean setComposingText(CharSequence text, int newCursorPosition) {
if (DEBUG) Log.w(TAG, "setComposingText [" + text + "] [" + newCursorPosition + "]");
+ if (mEditable.length() == mImeAdapter.getInputElementMaxLength()) {
+ finishComposingText();
+ return true;
+ }
if (maybePerformEmptyCompositionWorkaround(text)) return true;
super.setComposingText(text, newCursorPosition);
updateSelectionIfRequired();
@@ -225,6 +229,10 @@ public class AdapterInputConnection extends BaseInputConnection {
@Override
public boolean commitText(CharSequence text, int newCursorPosition) {
if (DEBUG) Log.w(TAG, "commitText [" + text + "] [" + newCursorPosition + "]");
+ if (mEditable.length() == mImeAdapter.getInputElementMaxLength()) {
+ finishComposingText();
+ return true;
+ }
if (maybePerformEmptyCompositionWorkaround(text)) return true;
super.commitText(text, newCursorPosition);
updateSelectionIfRequired();
« no previous file with comments | « content/common/view_messages.h ('k') | content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698