Bug 1626198 - Fix flushing in XULTreeElement::GetTreeBodyFrame. r=smaug

The code was knowingly broken (because of bug 585123). But that bug is closed,
and the broken code is causing asserts to fire in bug 1624488 because well, it's
broken ;)

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2020-03-31 10:52:35 +00:00
parent e0bb552444
commit 8f6c68a91d

View File

@ -83,16 +83,15 @@ nsTreeBodyFrame* XULTreeElement::GetTreeBodyFrame(FlushType aFlushType) {
MOZ_ASSERT(aFlushType == FlushType::Frames ||
aFlushType == FlushType::Layout || aFlushType == FlushType::None);
nsCOMPtr<nsIContent> kungFuDeathGrip = this; // keep a reference
RefPtr<Document> doc = GetComposedDoc();
// Make sure our frames are up to date, and layout as needed. We
// have to do this before checking for our cached mTreeBody, since
// it might go away on style flush, and in any case if aFlushLayout
// is true we need to make sure to flush no matter what.
// XXXbz except that flushing style when we were not asked to flush
// layout here breaks things. See bug 585123.
if (aFlushType == FlushType::Layout && doc) {
doc->FlushPendingNotifications(FlushType::Layout);
if (aFlushType != FlushType::None) {
if (RefPtr<Document> doc = GetComposedDoc()) {
doc->FlushPendingNotifications(aFlushType);
}
}
if (mTreeBody) {
@ -100,10 +99,6 @@ nsTreeBodyFrame* XULTreeElement::GetTreeBodyFrame(FlushType aFlushType) {
return mTreeBody;
}
if (aFlushType == FlushType::Frames && doc) {
doc->FlushPendingNotifications(FlushType::Frames);
}
if (nsCOMPtr<nsIContent> tree = FindBodyElement(this)) {
mTreeBody = do_QueryFrame(tree->GetPrimaryFrame());
}