Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
index 43f223cd803aadfb03ac1f04a6e22be733d4f4b3..1e33a9590e4e6589bee9529ee74f7c84089ca6fa 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
@@ -2176,6 +2176,10 @@ public class ContentViewCore implements |
@CalledByNative |
private void onSelectionEvent( |
int eventType, int xAnchor, int yAnchor, int left, int top, int right, int bottom) { |
+ // Ensure the provided selection coordinates form a non-empty rect, as required by |
+ // the selection action mode. |
+ if (left == right) ++right; |
+ if (top == bottom) ++bottom; |
switch (eventType) { |
case SelectionEventType.SELECTION_SHOWN: |
mSelectionRect.set(left, top, right, bottom); |
@@ -2184,11 +2188,7 @@ public class ContentViewCore implements |
// TODO(cjhopman): Remove this when there is a better signal that long press caused |
// a selection. See http://crbug.com/150151. |
mContainerView.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS); |
- // There may already be an active selection, e.g., if the user |
- // longpresses different text while an existing selection is |
- // active. In such case, we need to update the selection rect. |
showSelectActionMode(true); |
- invalidateActionModeContentRect(); |
break; |
case SelectionEventType.SELECTION_MOVED: |