| Index: content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java b/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
|
| index b2127709b32de3fe024bd79f46e2eb7e17280e3f..b8bd747fee25cee82b1a4b201652987b788aba24 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/PastePopupMenu.java
|
| @@ -61,12 +61,7 @@ public class PastePopupMenu implements OnClickListener {
|
| mContainer.setWidth(ViewGroup.LayoutParams.WRAP_CONTENT);
|
| mContainer.setHeight(ViewGroup.LayoutParams.WRAP_CONTENT);
|
|
|
| - final int[] POPUP_LAYOUT_ATTRS = {
|
| - android.R.attr.textEditPasteWindowLayout,
|
| - android.R.attr.textEditNoPasteWindowLayout,
|
| - android.R.attr.textEditSidePasteWindowLayout,
|
| - android.R.attr.textEditSideNoPasteWindowLayout,
|
| - };
|
| + final int[] POPUP_LAYOUT_ATTRS = { android.R.attr.textEditPasteWindowLayout, };
|
|
|
| mPasteViews = new View[POPUP_LAYOUT_ATTRS.length];
|
| mPasteViewLayouts = new int[POPUP_LAYOUT_ATTRS.length];
|
| @@ -96,7 +91,7 @@ public class PastePopupMenu implements OnClickListener {
|
| */
|
| public void showAt(int x, int y) {
|
| if (!canPaste()) return;
|
| - updateContent(true);
|
| + updateContent();
|
| positionAt(x, y);
|
| }
|
|
|
| @@ -146,7 +141,7 @@ public class PastePopupMenu implements OnClickListener {
|
|
|
| final int screenWidth = mContext.getResources().getDisplayMetrics().widthPixels;
|
| if (coords[1] < minOffsetY) {
|
| - updateContent(false);
|
| + updateContent();
|
| // Update dimensions from new view
|
| contentView = mContainer.getContentView();
|
| width = contentView.getMeasuredWidth();
|
| @@ -174,37 +169,29 @@ public class PastePopupMenu implements OnClickListener {
|
| mContainer.showAtLocation(mParent, Gravity.NO_GRAVITY, coords[0], coords[1]);
|
| }
|
|
|
| - private int viewIndex(boolean onTop) {
|
| - return (onTop ? 0 : 1 << 1) + (canPaste() ? 0 : 1 << 0);
|
| - }
|
| -
|
| - private void updateContent(boolean onTop) {
|
| - final int viewIndex = viewIndex(onTop);
|
| - View view = mPasteViews[viewIndex];
|
| + private void updateContent() {
|
| + final int viewIndex = 0;
|
|
|
| - if (view == null) {
|
| + if (mPasteViews[viewIndex] == null) {
|
| final int layout = mPasteViewLayouts[viewIndex];
|
| LayoutInflater inflater = (LayoutInflater) mContext.
|
| getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
| if (inflater != null) {
|
| - view = inflater.inflate(layout, null);
|
| - }
|
| -
|
| - if (view == null) {
|
| - throw new IllegalArgumentException("Unable to inflate TextEdit paste window");
|
| + mPasteViews[viewIndex] = inflater.inflate(layout, null);
|
| + if (mPasteViews[viewIndex] == null) {
|
| + throw new IllegalArgumentException("Unable to inflate TextEdit paste window");
|
| + }
|
| }
|
|
|
| final int size = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
|
| - view.setLayoutParams(new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
|
| - ViewGroup.LayoutParams.WRAP_CONTENT));
|
| - view.measure(size, size);
|
| -
|
| - view.setOnClickListener(this);
|
| + mPasteViews[viewIndex].setLayoutParams(
|
| + new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
| + mPasteViews[viewIndex].measure(size, size);
|
|
|
| - mPasteViews[viewIndex] = view;
|
| + mPasteViews[viewIndex].setOnClickListener(this);
|
| }
|
|
|
| - mContainer.setContentView(view);
|
| + mContainer.setContentView(mPasteViews[viewIndex]);
|
| }
|
|
|
| private boolean canPaste() {
|
|
|