| 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 64b1d582eca608e3d74a9dcea2fbc615e6fcaa91..9de353a4e7644ceb70bbacce70b605c8ce36d99b 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
|
| @@ -1919,8 +1919,9 @@ public class ContentViewCore
|
|
|
| @Override
|
| public void showHandles(int startDir, int endDir) {
|
| + final boolean showing = isShowing();
|
| super.showHandles(startDir, endDir);
|
| - showSelectActionBar();
|
| + if (!showing && isShowing()) showSelectActionBar();
|
| }
|
|
|
| };
|
| @@ -1956,11 +1957,6 @@ public class ContentViewCore
|
| return (int) Math.ceil(
|
| mRenderCoordinates.fromLocalCssToPix(AVERAGE_LINE_HEIGHT));
|
| }
|
| -
|
| - @Override
|
| - public void showHandle() {
|
| - super.showHandle();
|
| - }
|
| };
|
|
|
| mInsertionHandleController.hideAndDisallowAutomaticShowing();
|
| @@ -2400,26 +2396,19 @@ 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 isAnchorVisible, boolean isFocusVisible) {
|
| + // TODO(jdduke): Use |is{Anchor,Focus}Visible|, as well as the action
|
| + // bar height, to set handle visibility, see crbug.com/164819.
|
| + if (focusXDip != anchorXDip || focusYDip != anchorYDip ||
|
| (mSelectionHandleController != null && mSelectionHandleController.isDragging())) {
|
| if (mInsertionHandleController != null) {
|
| mInsertionHandleController.hide();
|
| }
|
| - if (isAnchorFirst) {
|
| - mStartHandlePoint.setLocalDip(x1, y1);
|
| - mEndHandlePoint.setLocalDip(x2, y2);
|
| - } else {
|
| - mStartHandlePoint.setLocalDip(x2, y2);
|
| - mEndHandlePoint.setLocalDip(x1, y1);
|
| - }
|
| + mStartHandlePoint.setLocalDip(anchorXDip, anchorYDip);
|
| + mEndHandlePoint.setLocalDip(focusXDip, focusYDip);
|
|
|
| boolean wereSelectionHandlesShowing = getSelectionHandleController().isShowing();
|
|
|
| @@ -2436,12 +2425,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();
|
| @@ -2453,12 +2442,7 @@ public class ContentViewCore
|
| }
|
| } else {
|
| // Deselection
|
| - if (mSelectionHandleController != null) {
|
| - mSelectionHandleController.hideAndDisallowAutomaticShowing();
|
| - }
|
| - if (mInsertionHandleController != null) {
|
| - mInsertionHandleController.hideAndDisallowAutomaticShowing();
|
| - }
|
| + hideHandles();
|
| }
|
| mHasSelection = false;
|
| }
|
|
|