Bug 1155819 - Set anchor as back button for tablets. r=ally

--HG--
extra : rebase_source : 0e877a56a15b14b4cc35c4a6744e17666b745b02
This commit is contained in:
Chenxia Liu 2015-04-17 17:56:10 -07:00
Родитель b91d35ed33
Коммит 58d0b4eaf4
2 изменённых файлов: 14 добавлений и 5 удалений

Просмотреть файл

@ -127,6 +127,11 @@ abstract class BrowserToolbarTabletBase extends BrowserToolbar {
}
}
@Override
public View getDoorHangerAnchor() {
return backButton;
}
protected boolean canDoBack(final Tab tab) {
return (tab.canDoBack() && !isEditing());
}

Просмотреть файл

@ -100,11 +100,15 @@ public abstract class AnchoredPopup extends PopupWindow {
return;
}
// If the anchor is null or out of the window bounds, just show the popup at the top of the
// root view.
final boolean validAnchor = (mAnchor != null) && (anchorLocation[1] > 0);
final View anchor = validAnchor ? mAnchor : decorView;
if (HardwareUtils.isTablet()) {
showAsDropDown(mAnchor, 0, 0);
} else {
// If the anchor is null or out of the window bounds, just show the popup at the top of the
// root view.
final boolean validAnchor = (mAnchor != null) && (anchorLocation[1] > 0);
final View anchor = validAnchor ? mAnchor : decorView;
showAtLocation(anchor, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, offsetY);
showAtLocation(anchor, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, offsetY);
}
}
}