Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7c1b20c authored by Adam Powell's avatar Adam Powell
Browse files

Fix bug 3465210 - Anchored popups don't appear above anchor when there

isn't enough room.

Oops. Fix a regression introduced by recent changes.

Change-Id: I413998dc2413763f2ea3f31a7ca68f098be19b36
parent 572c4a7d
Loading
Loading
Loading
Loading
+8 −7
Original line number Original line Diff line number Diff line
@@ -1056,16 +1056,17 @@ public class PopupWindow {
        anchor.getWindowVisibleDisplayFrame(displayFrame);
        anchor.getWindowVisibleDisplayFrame(displayFrame);
        
        
        final View root = anchor.getRootView();
        final View root = anchor.getRootView();
        if (mAllowScrollingAnchorParent && (p.y + mPopupHeight > displayFrame.bottom ||
        if (p.y + mPopupHeight > displayFrame.bottom || p.x + mPopupWidth - root.getWidth() > 0) {
                p.x + mPopupWidth - root.getWidth() > 0)) {
            // if the drop down disappears at the bottom of the screen. we try to
            // if the drop down disappears at the bottom of the screen. we try to
            // scroll a parent scrollview or move the drop down back up on top of
            // scroll a parent scrollview or move the drop down back up on top of
            // the edit box
            // the edit box
            if (mAllowScrollingAnchorParent) {
                int scrollX = anchor.getScrollX();
                int scrollX = anchor.getScrollX();
                int scrollY = anchor.getScrollY();
                int scrollY = anchor.getScrollY();
                Rect r = new Rect(scrollX, scrollY,  scrollX + mPopupWidth + xoff,
                Rect r = new Rect(scrollX, scrollY,  scrollX + mPopupWidth + xoff,
                        scrollY + mPopupHeight + anchor.getHeight() + yoff);
                        scrollY + mPopupHeight + anchor.getHeight() + yoff);
                anchor.requestRectangleOnScreen(r, true);
                anchor.requestRectangleOnScreen(r, true);
            }


            // now we re-evaluate the space available, and decide from that
            // now we re-evaluate the space available, and decide from that
            // whether the pop-up will go above or below the anchor.
            // whether the pop-up will go above or below the anchor.