Index: content/public/android/java/src/org/chromium/content/browser/input/HandleView.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java b/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java |
index f504b066f4b081436f5c7ebe94cc8f79a1bb5d4e..187973f8f27febeeb4a56d205667ad7b21ef5601 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/input/HandleView.java |
@@ -62,6 +62,7 @@ public class HandleView extends View { |
private final Rect mTempRect = new Rect(); |
+ private int mOrientation = -1; |
static final int LEFT = 0; |
static final int CENTER = 1; |
static final int RIGHT = 2; |
@@ -80,7 +81,7 @@ public class HandleView extends View { |
android.R.attr.textSelectHandleRight, |
}; |
- HandleView(CursorController controller, int pos, View parent, |
+ HandleView(CursorController controller, int orientation, View parent, |
PositionObserver parentPositionObserver) { |
super(parent.getContext()); |
mParent = parent; |
@@ -89,8 +90,9 @@ public class HandleView extends View { |
mContainer = new PopupWindow(context, null, android.R.attr.textSelectHandleWindowStyle); |
mContainer.setSplitTouchEnabled(true); |
mContainer.setClippingEnabled(false); |
+ mContainer.setAnimationStyle(0); |
- setOrientation(pos); |
+ setOrientation(orientation); |
// Convert line offset dips to pixels. |
mLineOffsetY = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, |
@@ -107,16 +109,19 @@ public class HandleView extends View { |
mParentPositionObserver = parentPositionObserver; |
} |
- void setOrientation(int pos) { |
+ void setOrientation(int orientation) { |
+ if (mOrientation == orientation) return; |
+ mOrientation = orientation; |
+ |
Context context = mParent.getContext(); |
TypedArray a = context.getTheme().obtainStyledAttributes(TEXT_VIEW_HANDLE_ATTRS); |
- mDrawable = a.getDrawable(pos); |
+ mDrawable = a.getDrawable(orientation); |
a.recycle(); |
- mIsInsertionHandle = (pos == CENTER); |
+ mIsInsertionHandle = (orientation == CENTER); |
int handleWidth = mDrawable.getIntrinsicWidth(); |
- switch (pos) { |
+ switch (orientation) { |
case LEFT: { |
mHotspotX = (handleWidth * 3) / 4f; |
break; |
@@ -164,6 +169,7 @@ public class HandleView extends View { |
} |
private void onPositionChanged() { |
+ if (getVisibility() != VISIBLE) return; |
mContainer.update(getContainerPositionX(), getContainerPositionY(), |
getRight() - getLeft(), getBottom() - getTop()); |
} |
@@ -391,6 +397,8 @@ public class HandleView extends View { |
mAlpha = 0.f; |
mFadeStartTime = AnimationUtils.currentAnimationTimeMillis(); |
setVisibility(VISIBLE); |
+ // Force a position update as such updates may have gone suppressed while invisible. |
+ if (isShowing()) onPositionChanged(); |
} |
void showPastePopupWindow() { |