Skip to content

Commit

Permalink
Fix DropdownPopupWindow positioning on Android L.
Browse files Browse the repository at this point in the history
Android L randomly changed the default vertical offset for ListPopupWindow to
-10dp by changing Widget.ListPopupWindow style to set dropDownVerticalOffset
to -10dp. This CL sets it explictly to the padding of our background image.

BUG=419444

Review URL: https://codereview.chromium.org/723843002

Cr-Commit-Position: refs/heads/master@{#303995}
  • Loading branch information
aurimas authored and Commit bot committed Nov 13, 2014
1 parent 99476b1 commit eae8afa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ui/android/java/src/org/chromium/ui/DropdownPopupWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public void onDismiss() {
});

setAnchorView(mAnchorView);
Rect originalPadding = new Rect();
getBackground().getPadding(originalPadding);
setVerticalOffset(-originalPadding.top);
}

/**
Expand Down Expand Up @@ -111,8 +114,8 @@ public void show() {
setInputMethodMode(INPUT_METHOD_NEEDED);

int contentWidth = measureContentWidth();
float contentWidthInDip = contentWidth /
mContext.getResources().getDisplayMetrics().density;
float contentWidthInDip = contentWidth
/ mContext.getResources().getDisplayMetrics().density;
if (contentWidthInDip > mAnchorWidth) {
setContentWidth(contentWidth);
final Rect displayFrame = new Rect();
Expand Down

0 comments on commit eae8afa

Please sign in to comment.