mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-28 04:35:33 +00:00
Bug 394887, lazily create popup content and widgets, r+sr=bz, a=roc
This commit is contained in:
parent
81e60268e2
commit
7f76d89c57
@ -254,6 +254,30 @@ nsMenuPopupFrame::SetInitialChildList(nsIAtom* aListName,
|
||||
return nsBoxFrame::SetInitialChildList(aListName, aChildList);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsMenuPopupFrame::IsLeaf() const
|
||||
{
|
||||
if (mGeneratedChildren)
|
||||
return PR_FALSE;
|
||||
|
||||
// any popup with a type attribute, such as the autocomplete popup,
|
||||
// is always generated right away.
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::type))
|
||||
return PR_FALSE;
|
||||
|
||||
if (mPopupType != ePopupTypeMenu)
|
||||
return PR_TRUE;
|
||||
|
||||
// menu popups generate their child frames lazily only when opened, so
|
||||
// behave like a leaf frame. However, generate child frames normally if
|
||||
// the parent menu has a sizetopopup attribute. In this case the size of
|
||||
// the parent menu is dependant on the size of the popup, so the frames
|
||||
// need to exist in order to calculate this size.
|
||||
nsIContent* parentContent = mContent->GetParent();
|
||||
return (parentContent &&
|
||||
!parentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::sizetopopup));
|
||||
}
|
||||
|
||||
void
|
||||
nsMenuPopupFrame::AdjustView()
|
||||
{
|
||||
|
@ -183,22 +183,7 @@ public:
|
||||
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
|
||||
nsIFrame* aChildList);
|
||||
|
||||
virtual PRBool IsLeaf() const
|
||||
{
|
||||
if (!mGeneratedChildren && mPopupType == ePopupTypeMenu) {
|
||||
// menu popups generate their child frames lazily only when opened, so
|
||||
// behave like a leaf frame. However, generate child frames normally if
|
||||
// the parent menu has a sizetopopup attribute. In this case the size of
|
||||
// the parent menu is dependant on the size of the popup, so the frames
|
||||
// need to exist in order to calculate this size.
|
||||
nsIContent* parentContent = mContent->GetParent();
|
||||
if (parentContent &&
|
||||
!parentContent->HasAttr(kNameSpaceID_None, nsGkAtoms::sizetopopup))
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
return PR_FALSE;
|
||||
}
|
||||
virtual PRBool IsLeaf() const;
|
||||
|
||||
// AdjustView should be called by the parent frame after the popup has been
|
||||
// laid out, so that the view can be shown.
|
||||
|
Loading…
Reference in New Issue
Block a user