Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2308)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/input/HandleView.java

Issue 300323005: Route selection bounds updates through the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Defer selection updates until after compositor scheduling Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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() {

Powered by Google App Engine
This is Rietveld 408576698