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

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

Issue 2309983002: Allow selection change update before beginBatchEdit (Closed)
Patch Set: fixed a test failure Created 4 years, 3 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/TextInputState.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/TextInputState.java b/content/public/android/java/src/org/chromium/content/browser/input/TextInputState.java
index 38684dfc9d9cfac2a51d79f0e630417255073812..58d19484c715ece8db5896cf3a29af8c0a69d08d 100644
--- a/content/public/android/java/src/org/chromium/content/browser/input/TextInputState.java
+++ b/content/public/android/java/src/org/chromium/content/browser/input/TextInputState.java
@@ -18,9 +18,10 @@ public class TextInputState {
private final Range mComposition;
private final boolean mSingleLine;
private final boolean mFromIme;
+ private final boolean mInBatchEditMode;
public TextInputState(CharSequence text, Range selection, Range composition, boolean singleLine,
- boolean fromIme) {
+ boolean fromIme, boolean inBatchEditMode) {
selection.clamp(0, text.length());
if (composition.start() != -1 || composition.end() != -1) {
composition.clamp(0, text.length());
@@ -30,6 +31,7 @@ public class TextInputState {
mComposition = composition;
mSingleLine = singleLine;
mFromIme = fromIme;
+ mInBatchEditMode = inBatchEditMode;
}
public CharSequence text() {
@@ -52,6 +54,10 @@ public class TextInputState {
return mFromIme;
}
+ public boolean inBatchEditMode() {
+ return mInBatchEditMode;
+ }
+
public CharSequence getSelectedText() {
if (mSelection.start() == mSelection.end()) return null;
return TextUtils.substring(mText, mSelection.start(), mSelection.end());
@@ -90,8 +96,8 @@ public class TextInputState {
@Override
public String toString() {
- return String.format(Locale.US, "TextInputState {[%s] SEL%s COM%s %s %s}", mText,
+ return String.format(Locale.US, "TextInputState {[%s] SEL%s COM%s %s %s%s}", mText,
mSelection, mComposition, mSingleLine ? "SIN" : "MUL",
- mFromIme ? "fromIME" : "NOTfromIME");
+ mFromIme ? "fromIME" : "NOTfromIME", mInBatchEditMode ? " BatchEdit" : "");
}
}

Powered by Google App Engine
This is Rietveld 408576698