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 2fa3eff0720b6227649fe32d4323f6bc308af257..9a8aa3e1eae39023dcec34dd433dfdfbab7cea3e 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 |
@@ -2391,25 +2391,21 @@ public class ContentViewCore |
@SuppressWarnings("unused") |
@CalledByNative |
- private void onSelectionBoundsChanged(Rect anchorRectDip, int anchorDir, Rect focusRectDip, |
- int focusDir, boolean isAnchorFirst) { |
- // All coordinates are in DIP. |
- int x1 = anchorRectDip.left; |
- int y1 = anchorRectDip.bottom; |
- int x2 = focusRectDip.left; |
- int y2 = focusRectDip.bottom; |
- |
- if (x1 != x2 || y1 != y2 || |
+ private void onSelectionBoundsChanged( |
+ float anchorXDip, float anchorYDip, float focusXDip, float focusYDip, |
+ int anchorDir, int focusDir, |
+ boolean isAnchorFirst, boolean isAnchorVisible, boolean isFocusVisible) { |
+ if (focusXDip != anchorXDip || focusYDip != anchorYDip || |
(mSelectionHandleController != null && mSelectionHandleController.isDragging())) { |
if (mInsertionHandleController != null) { |
mInsertionHandleController.hide(); |
} |
if (isAnchorFirst) { |
- mStartHandlePoint.setLocalDip(x1, y1); |
- mEndHandlePoint.setLocalDip(x2, y2); |
+ mStartHandlePoint.setLocalDip(anchorXDip, anchorYDip); |
+ mEndHandlePoint.setLocalDip(focusXDip, focusYDip); |
} else { |
- mStartHandlePoint.setLocalDip(x2, y2); |
- mEndHandlePoint.setLocalDip(x1, y1); |
+ mStartHandlePoint.setLocalDip(focusXDip, focusYDip); |
+ mEndHandlePoint.setLocalDip(anchorXDip, anchorYDip); |
} |
boolean wereSelectionHandlesShowing = getSelectionHandleController().isShowing(); |
@@ -2427,12 +2423,12 @@ public class ContentViewCore |
} else { |
mUnselectAllOnActionModeDismiss = false; |
hideSelectActionBar(); |
- if (x1 != 0 && y1 != 0 && mSelectionEditable) { |
+ if (anchorXDip != 0 && anchorYDip != 0 && mSelectionEditable) { |
// Selection is a caret, and a text field is focused. |
if (mSelectionHandleController != null) { |
mSelectionHandleController.hide(); |
} |
- mInsertionHandlePoint.setLocalDip(x1, y1); |
+ mInsertionHandlePoint.setLocalDip(anchorXDip, anchorYDip); |
getInsertionHandleController().onCursorPositionChanged(); |
updateHandleScreenPositions(); |
@@ -2452,9 +2448,10 @@ public class ContentViewCore |
} |
} |
mHasSelection = false; |
- } |
- if (isSelectionHandleShowing() || isInsertionHandleShowing()) { |
- mPositionObserver.addListener(mPositionListener); |
+ |
+ if (isSelectionHandleShowing() || isInsertionHandleShowing()) { |
+ mPositionObserver.addListener(mPositionListener); |
+ } |
} |
} |