From c90d6e2a33a36ed341e9df1541b213c5fec286bd Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Tue, 13 Jan 2015 21:03:13 -0800 Subject: [PATCH] Bug 1110277 patch 7 - Call CreateNeededFrames from ~ReframingStyleContexts. r=bzbarsky I don't have any tests that exercise this code, and I can't even find a codepath that demonstrates that it's needed, since the lazy reconstruction that happens during style-triggered frame reconstruction all appears to go through PostRestyleEvent rather than MaybeConstructLazily. But I think we should either do this or add an assertion that it's not needed, and given that it's one line, it seems like we may as well just do it. (Note also that we're currently calling CreateNeededFrames at the start of style reresolution, in RestyleManager::ProcessPendingRestyles; this adds a call at the end.) --- layout/base/RestyleManager.cpp | 10 ++++++++++ layout/base/RestyleManager.h | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/layout/base/RestyleManager.cpp b/layout/base/RestyleManager.cpp index b4218528c327..0688ce43be92 100644 --- a/layout/base/RestyleManager.cpp +++ b/layout/base/RestyleManager.cpp @@ -995,6 +995,16 @@ RestyleManager::ReframingStyleContexts::ReframingStyleContexts( mRestyleManager->mReframingStyleContexts = this; } +RestyleManager::ReframingStyleContexts::~ReframingStyleContexts() +{ + // Before we go away, we need to flush out any frame construction that + // was enqueued, so that we start transitions. + // Note that this is a little bit evil in that we're calling into code + // that calls our member functions from our destructor, but it's at + // the beginning of our destructor, so it shouldn't be too bad. + mRestyleManager->mPresContext->FrameConstructor()->CreateNeededFrames(); +} + static inline dom::Element* ElementForStyleContext(nsIContent* aParentContent, nsIFrame* aFrame, diff --git a/layout/base/RestyleManager.h b/layout/base/RestyleManager.h index bcb908fe897c..53370ea36a54 100644 --- a/layout/base/RestyleManager.h +++ b/layout/base/RestyleManager.h @@ -181,7 +181,7 @@ public: */ typedef nsRefPtrHashtable, nsStyleContext> ReframingStyleContextTable; - class MOZ_STACK_CLASS ReframingStyleContexts { + class MOZ_STACK_CLASS ReframingStyleContexts MOZ_FINAL { public: /** * Construct a ReframingStyleContexts object. The caller must @@ -190,6 +190,7 @@ public: * method of RestyleManager.) */ explicit ReframingStyleContexts(RestyleManager* aRestyleManager); + ~ReframingStyleContexts(); void Put(nsIContent* aContent, nsStyleContext* aStyleContext) { MOZ_ASSERT(aContent);