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 672fd3eea1b4074985f4fb1ffa9895dbf6e7afa7..a19c54562eee4c06fbba172f2f4b14ff1500e765 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 |
@@ -293,6 +293,7 @@ public class ContentViewCore |
// Lazily created paste popup menu, triggered either via long press in an |
// editable region or from tapping the insertion handle. |
private PastePopupMenu mPastePopupMenu; |
+ private boolean mWasPastePopupShowingOnInsertionDragStart; |
private PopupTouchHandleDrawableDelegate mTouchHandleDelegate; |
@@ -2209,14 +2210,24 @@ public class ContentViewCore |
mHasInsertion = true; |
break; |
- case SelectionEventType.INSERTION_MOVED: |
- // TODO(jdduke): Handle case where movement triggered by focus. |
+ case SelectionEventType.INSERTION_DRAG_STARTED: |
+ mWasPastePopupShowingOnInsertionDragStart = |
+ mPastePopupMenu != null && mPastePopupMenu.isShowing(); |
hidePastePopup(); |
break; |
+ case SelectionEventType.INSERTION_MOVED: |
+ if (mPastePopupMenu == null) break; |
+ if (!isScrollInProgress() && mPastePopupMenu.isShowing()) { |
+ showPastePopup((int) posXDip, (int) posYDip); |
+ } else { |
+ hidePastePopup(); |
+ } |
+ break; |
+ |
case SelectionEventType.INSERTION_TAPPED: |
- if (getPastePopup().isShowing()) |
- mPastePopupMenu.hide(); |
+ if (mWasPastePopupShowingOnInsertionDragStart) |
+ hidePastePopup(); |
else |
showPastePopup((int) posXDip, (int) posYDip); |
break; |