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

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

Issue 1115473002: Omit calls to set composing region when pasting image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed variable name Created 5 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 75c8bd841deba1ddb41d9b5db317a682e308232b..7afd1a184d71f78acd481210613144bec9d39e7a 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
@@ -488,17 +488,26 @@ public class AdapterInputConnection extends BaseInputConnection {
if (a > textLength) a = textLength;
if (b > textLength) b = textLength;
+ CharSequence regionText = null;
if (a == b) {
removeComposingSpans(mEditable);
} else {
+ if (a == 0 && b == mEditable.length()) {
+ regionText = mEditable.subSequence(a, b);
+ // If setting composing region that matches, at least in length, of the entire
+ // editable region then check it for image placeholders. If any are found,
+ // don't continue this operation.
+ // This fixes the problem where, on Android 4.3, pasting an image is followed
aurimas (slooooooooow) 2015/05/27 20:28:13 What does keyboard do if we do not set the composi
bcwhite 2015/05/28 11:18:15 I can find no difference in the behavior of the ke
+ // by setting the composing region which then causes the image to be deleted.
+ // http://crbug.com/466755
+ for (int i = a; i < b; ++i) {
+ if (regionText.charAt(i) == '\uFFFC') return true;
+ }
+ }
super.setComposingRegion(a, b);
}
updateSelectionIfRequired();
- CharSequence regionText = null;
- if (b > a) {
- regionText = mEditable.subSequence(a, b);
- }
return mImeAdapter.setComposingRegion(regionText, a, b);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698