From 0c8c15400fc49ae10c565591300855eac79c03f0 Mon Sep 17 00:00:00 2001 From: Johnny Stenback Date: Mon, 2 Feb 2009 17:26:28 -0800 Subject: [PATCH] Fixing bug 474022. Reflow if we're about to instantiate a plugin whose frame has not been reflown yet. This fixes a problem where the WMP plugin doesn't work right if its initial size is 0x0. r+sr=bzbarsky@mit.edu --- content/base/src/nsObjectLoadingContent.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/content/base/src/nsObjectLoadingContent.cpp b/content/base/src/nsObjectLoadingContent.cpp index ad4089ece71d..44bb0dfe6b2d 100644 --- a/content/base/src/nsObjectLoadingContent.cpp +++ b/content/base/src/nsObjectLoadingContent.cpp @@ -751,6 +751,21 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance) } nsIFrame *nsiframe = do_QueryFrame(frame); + + if (nsiframe->GetStateBits() & NS_FRAME_FIRST_REFLOW) { + // A frame for this plugin element already exists now, but it has + // not been reflown yet. Force a reflow now so that we don't end + // up initializing a plugin before knowing its size. Also re-fetch + // the frame, as flushing can cause the frame to be deleted. + frame = GetExistingFrame(eFlushLayout); + + if (!frame) { + return NS_OK; + } + + nsiframe = do_QueryFrame(frame); + } + nsWeakFrame weakFrame(nsiframe); // We may have a plugin instance already; if so, do nothing