Bug 556487 - Post Reflow Callback for nsObjectFrame r=roc a=blocking2.0

--HG--
extra : rebase_source : c8058990232bbabf8fbd36890e0fb6190c318faf
This commit is contained in:
Oleg Romashin 2010-09-07 17:36:59 -07:00
parent d3b765aafa
commit ff18db0258
2 changed files with 31 additions and 4 deletions

View File

@ -575,6 +575,7 @@ private:
nsObjectFrame::nsObjectFrame(nsStyleContext* aContext)
: nsObjectFrameSuper(aContext)
, mReflowCallbackPosted(PR_FALSE)
{
PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
("Created new nsObjectFrame %p\n", this));
@ -932,6 +933,10 @@ nsObjectFrame::Reflow(nsPresContext* aPresContext,
}
FixupWindow(r.Size());
if (!mReflowCallbackPosted) {
mReflowCallbackPosted = PR_TRUE;
aPresContext->PresShell()->PostReflowCallback(this);
}
aStatus = NS_FRAME_COMPLETE;
@ -939,6 +944,22 @@ nsObjectFrame::Reflow(nsPresContext* aPresContext,
return NS_OK;
}
///////////// nsIReflowCallback ///////////////
PRBool
nsObjectFrame::ReflowFinished()
{
mReflowCallbackPosted = PR_FALSE;
CallSetWindow();
return PR_TRUE;
}
void
nsObjectFrame::ReflowCallbackCanceled()
{
mReflowCallbackPosted = PR_FALSE;
}
nsresult
nsObjectFrame::InstantiatePlugin(nsIPluginHost* aPluginHost,
const char* aMimeType,
@ -1153,9 +1174,6 @@ nsObjectFrame::DidReflow(nsPresContext* aPresContext,
vm->SetViewVisibility(view, IsHidden() ? nsViewVisibility_kHide : nsViewVisibility_kShow);
}
// WMP10 needs an additional SetWindow call here (bug 391261)
CallSetWindow();
return rv;
}

View File

@ -48,6 +48,7 @@
#include "nsFrame.h"
#include "nsRegion.h"
#include "nsDisplayList.h"
#include "nsIReflowCallback.h"
#ifdef ACCESSIBILITY
class nsIAccessible;
@ -62,7 +63,9 @@ class nsIDOMElement;
#define nsObjectFrameSuper nsFrame
class nsObjectFrame : public nsObjectFrameSuper, public nsIObjectFrame {
class nsObjectFrame : public nsObjectFrameSuper,
public nsIObjectFrame,
public nsIReflowCallback {
public:
NS_DECL_FRAMEARENA_HELPERS
@ -162,6 +165,10 @@ public:
static nsIObjectFrame* GetNextObjectFrame(nsPresContext* aPresContext,
nsIFrame* aRoot);
// nsIReflowCallback
virtual PRBool ReflowFinished();
virtual void ReflowCallbackCanceled();
protected:
nsObjectFrame(nsStyleContext* aContext);
virtual ~nsObjectFrame();
@ -257,6 +264,8 @@ private:
// to the underlying problem described in bug 136927, and to prevent
// reentry into instantiation.
PRBool mPreventInstantiation;
PRPackedBool mReflowCallbackPosted;
};
class nsDisplayPlugin : public nsDisplayItem {