Bug 1525101 - Make the XULPopupManager caller to GenerateChildFrames sound. r=mats

It only works basically by chance with XBL and doesn't handle any kind of
dynamic insertion. See comment 4 in the bug for the diagnostic.

Differential Revision: https://phabricator.services.mozilla.com/D19489

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-02-12 14:49:57 +00:00
Родитель 941e6a2a63
Коммит eeda7edadf
3 изменённых файлов: 6 добавлений и 14 удалений

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

@ -58,6 +58,7 @@
using namespace mozilla;
using mozilla::dom::Event;
using mozilla::dom::Document;
using mozilla::dom::KeyboardEvent;
int8_t nsMenuPopupFrame::sDefaultLevelIsTop = -1;
@ -391,15 +392,6 @@ void nsXULPopupShownEvent::CancelListener() {
NS_IMPL_ISUPPORTS_INHERITED(nsXULPopupShownEvent, Runnable,
nsIDOMEventListener);
void nsMenuPopupFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) {
// unless the list is empty, indicate that children have been generated.
if (aListID == kPrincipalList && aChildList.NotEmpty()) {
mGeneratedChildren = true;
}
nsBoxFrame::SetInitialChildList(aListID, aChildList);
}
bool nsMenuPopupFrame::IsLeafDynamic() const {
if (mGeneratedChildren) return false;

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

@ -247,9 +247,6 @@ class nsMenuPopupFrame final : public nsBoxFrame,
nsresult CreateWidgetForView(nsView* aView);
uint8_t GetShadowStyle();
virtual void SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList) override;
virtual bool IsLeafDynamic() const override;
virtual void UpdateWidgetProperties() override;

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

@ -1284,8 +1284,11 @@ void nsXULPopupManager::FirePopupShowingEvent(nsIContent* aPopup,
nsPopupType popupType = popupFrame->PopupType();
// generate the child frames if they have not already been generated
if (!popupFrame->HasGeneratedChildren()) {
popupFrame->SetGeneratedChildren();
const bool generateFrames = popupFrame->IsLeaf();
MOZ_ASSERT_IF(generateFrames, !popupFrame->HasGeneratedChildren());
popupFrame->SetGeneratedChildren();
if (generateFrames) {
MOZ_ASSERT(popupFrame->PrincipalChildList().IsEmpty());
presShell->FrameConstructor()->GenerateChildFrames(popupFrame);
}