| Index: content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| index b5989cf533886446ab9f9ee7d683e622f2438953..d135710bd364345bb77d603a8b8ad46f84d33597 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/SelectPopupDropdown.java
|
| @@ -26,7 +26,6 @@ public class SelectPopupDropdown implements SelectPopup {
|
| private final Context mContext;
|
| private final DropdownPopupWindow mDropdownPopupWindow;
|
|
|
| - private int mInitialSelection = -1;
|
| private boolean mSelectionNotified;
|
|
|
| public SelectPopupDropdown(ContentViewCore contentViewCore, List<SelectPopupItem> items,
|
| @@ -42,9 +41,12 @@ public class SelectPopupDropdown implements SelectPopup {
|
| hide(false);
|
| }
|
| });
|
| +
|
| + int initialSelection = -1;
|
| if (selected.length > 0) {
|
| - mInitialSelection = selected[0];
|
| + initialSelection = selected[0];
|
| }
|
| + mDropdownPopupWindow.setInitialSelection(initialSelection);
|
| mDropdownPopupWindow.setAdapter(new DropdownAdapter(mContext, items, null));
|
| mDropdownPopupWindow.setRtl(rightAligned);
|
| RenderCoordinates renderCoordinates = mContentViewCore.getRenderCoordinates();
|
| @@ -74,10 +76,9 @@ public class SelectPopupDropdown implements SelectPopup {
|
|
|
| @Override
|
| public void show() {
|
| - mDropdownPopupWindow.show();
|
| - if (mInitialSelection >= 0) {
|
| - mDropdownPopupWindow.getListView().setSelection(mInitialSelection);
|
| - }
|
| + // postShow() to make sure show() happens after the layout of the anchor view has been
|
| + // changed.
|
| + mDropdownPopupWindow.postShow();
|
| }
|
|
|
| @Override
|
|
|