forked from mirrors/gecko-dev
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
27 lines
694 B
Python
27 lines
694 B
Python
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
# Leaf constants to pass to Frame's leafness argument.
|
|
LEAF = "Leaf"
|
|
NOT_LEAF = "NotLeaf"
|
|
|
|
|
|
class FrameClass:
|
|
def __init__(self, cls):
|
|
self.cls = cls
|
|
|
|
|
|
class Frame(FrameClass):
|
|
def __init__(self, cls, ty, leafness):
|
|
FrameClass.__init__(self, cls)
|
|
self.ty = ty
|
|
self.leafness = leafness
|
|
self.is_concrete = True
|
|
|
|
|
|
class AbstractFrame(FrameClass):
|
|
def __init__(self, cls):
|
|
FrameClass.__init__(self, cls)
|
|
self.is_concrete = False
|