| Index: chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
|
| index 6f7f5733db21138c46f76bef09ca54a7f59ae42d..947d5787d6ba8217e58759c93d6c40a40162b0fd 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/appmenu/AppMenu.java
|
| @@ -84,9 +84,10 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
|
| * button)
|
| * @param screenRotation Current device screen rotation.
|
| * @param visibleDisplayFrame The display area rect in which AppMenu is supposed to fit in.
|
| + * @param screenHeight Current device screen height.
|
| */
|
| void show(Context context, View anchorView, boolean isByHardwareButton, int screenRotation,
|
| - Rect visibleDisplayFrame) {
|
| + Rect visibleDisplayFrame, int screenHeight) {
|
| mPopup = new ListPopupWindow(context, null, android.R.attr.popupMenuStyle);
|
| mPopup.setModal(true);
|
| mPopup.setAnchorView(anchorView);
|
| @@ -140,7 +141,7 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
|
| this, menuItems, LayoutInflater.from(context), showMenuButton);
|
| mPopup.setAdapter(mAdapter);
|
|
|
| - setMenuHeight(menuItems.size(), visibleDisplayFrame);
|
| + setMenuHeight(menuItems.size(), visibleDisplayFrame, screenHeight);
|
| setPopupOffset(mPopup, mCurrentScreenRotation, visibleDisplayFrame);
|
| mPopup.setOnItemClickListener(this);
|
| mPopup.show();
|
| @@ -263,7 +264,7 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
|
| return mPopup;
|
| }
|
|
|
| - private void setMenuHeight(int numMenuItems, Rect appDimensions) {
|
| + private void setMenuHeight(int numMenuItems, Rect appDimensions, int screenHeight) {
|
| assert mPopup.getAnchorView() != null;
|
| View anchorView = mPopup.getAnchorView();
|
| int[] anchorViewLocation = new int[2];
|
| @@ -271,6 +272,10 @@ public class AppMenu implements OnItemClickListener, OnKeyListener {
|
| anchorViewLocation[1] -= appDimensions.top;
|
| int anchorViewImpactHeight = mIsByHardwareButton ? anchorView.getHeight() : 0;
|
|
|
| + // Set appDimensions.height() for abnormal anchorViewLocation.
|
| + if (anchorViewLocation[1] > screenHeight) {
|
| + anchorViewLocation[1] = appDimensions.height();
|
| + }
|
| int availableScreenSpace = Math.max(anchorViewLocation[1],
|
| appDimensions.height() - anchorViewLocation[1] - anchorViewImpactHeight);
|
|
|
|
|