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 18:53:22 +00:00
Родитель 86b72ab902
Коммит 89d429a5be
3 изменённых файлов: 9 добавлений и 15 удалений

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

@ -57,6 +57,7 @@
#include <algorithm>
using namespace mozilla;
using mozilla::dom::Document;
using mozilla::dom::Event;
using mozilla::dom::KeyboardEvent;
@ -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;
@ -453,7 +445,9 @@ void nsMenuPopupFrame::UpdateWidgetProperties() {
void nsMenuPopupFrame::LayoutPopup(nsBoxLayoutState& aState,
nsIFrame* aParentMenu, nsIFrame* aAnchor,
bool aSizedToPopup) {
if (!mGeneratedChildren) return;
if (IsLeaf()) {
return;
}
SchedulePaint();

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

@ -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);
}