From 7f2c94d3daa01a46e72123359e3fca487bba92e9 Mon Sep 17 00:00:00 2001 From: Dorel Luca Date: Tue, 12 Feb 2019 18:42:00 +0200 Subject: [PATCH] Backed out changeset 7f9e50bfaad1 (bug 1525101) for Mochitest failures in toolkit/content/tests/chrome/test_menulist_paging.xul --- layout/xul/nsMenuPopupFrame.cpp | 10 +++++++++- layout/xul/nsMenuPopupFrame.h | 3 +++ layout/xul/nsXULPopupManager.cpp | 7 ++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index 034cd031f034..06e0d22141fb 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -58,7 +58,6 @@ using namespace mozilla; using mozilla::dom::Event; -using mozilla::dom::Document; using mozilla::dom::KeyboardEvent; int8_t nsMenuPopupFrame::sDefaultLevelIsTop = -1; @@ -392,6 +391,15 @@ 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; diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h index 42746476428f..dd288e7f8c33 100644 --- a/layout/xul/nsMenuPopupFrame.h +++ b/layout/xul/nsMenuPopupFrame.h @@ -247,6 +247,9 @@ 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; diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index 9e70f6d1f42f..56506fcfb80d 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -1284,11 +1284,8 @@ void nsXULPopupManager::FirePopupShowingEvent(nsIContent* aPopup, nsPopupType popupType = popupFrame->PopupType(); // generate the child frames if they have not already been generated - const bool generateFrames = popupFrame->IsLeaf(); - MOZ_ASSERT_IF(generateFrames, !popupFrame->HasGeneratedChildren()); - popupFrame->SetGeneratedChildren(); - if (generateFrames) { - MOZ_ASSERT(popupFrame->PrincipalChildList().IsEmpty()); + if (!popupFrame->HasGeneratedChildren()) { + popupFrame->SetGeneratedChildren(); presShell->FrameConstructor()->GenerateChildFrames(popupFrame); }