Bug 1253975, don't reset the scroll position of a menulist when it opens as it should scroll to its selection instead, r=mconley

This commit is contained in:
Neil Deakin
2016-07-25 09:08:36 -04:00
parent 6c7939e16b
commit ea37b37afb
4 changed files with 59 additions and 11 deletions

View File

@@ -445,12 +445,17 @@ nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState, nsIFrame* aParentMenu,
// if the popup has just been opened, make sure the scrolled window is at 0,0
if (mIsOpenChanged) {
nsIScrollableFrame *scrollframe = do_QueryFrame(nsBox::GetChildXULBox(this));
if (scrollframe) {
nsWeakFrame weakFrame(this);
scrollframe->ScrollTo(nsPoint(0,0), nsIScrollableFrame::INSTANT);
if (!weakFrame.IsAlive()) {
return;
// Don't scroll menulists as they will scroll to their selected item on their own.
nsCOMPtr<nsIDOMXULMenuListElement> menulist =
do_QueryInterface(aParentMenu ? aParentMenu->GetContent() : nullptr);
if (!menulist) {
nsIScrollableFrame *scrollframe = do_QueryFrame(nsBox::GetChildXULBox(this));
if (scrollframe) {
nsWeakFrame weakFrame(this);
scrollframe->ScrollTo(nsPoint(0,0), nsIScrollableFrame::INSTANT);
if (!weakFrame.IsAlive()) {
return;
}
}
}
}