Loading
Bug 1746310 - Remove nsMenuPopupFrame::GenerateFrames and related code. r=tnikkel
The root of the problem is that nsMenuPopupFrame::GenerateFrames calls into frame construction without making sure that styles are clean. So it was pretty much working by chance, sorta. I was going to fix this by adding the necessary flushes before calling GenerateFrames, but on closer inspection, the front-end has effectively already implemented this optimization by only generating the relevant DOM on popupShowing: https://searchfox.org/mozilla-central/rev/a11b63915bd7810a03635d733123448ab5bfcad3/toolkit/content/widgets/menupopup.js#87-91 And for menulists on creation: https://searchfox.org/mozilla-central/rev/a11b63915bd7810a03635d733123448ab5bfcad3/toolkit/content/widgets/menupopup.js#151 After bug 1714846 we even destroy frames as needed, for panels. So I think all of this complexity is unwarranted, and if we need some of it we should implement it in the front-end like bug 1714846 did, and I'd rather do this than flushing styles and so on. There's one tweak I had to do to an nsPlaceholderFrame assertion. The reason is that now the nsMenuPopupFrames do get their NS_FRAME_FIRST_REFLOW bit cleared here: https://searchfox.org/mozilla-central/rev/bd25b1ca76dd5d323ffc69557f6cf759ba76ba23/layout/xul/nsMenuPopupFrame.cpp#557 Because the IsLeaf() condition here is no longer true: https://searchfox.org/mozilla-central/rev/bd25b1ca76dd5d323ffc69557f6cf759ba76ba23/layout/xul/nsMenuPopupFrame.cpp#532 It doesn't change anything though, because this condition never holded for popups consistently. Differential Revision: https://phabricator.services.mozilla.com/D134331