From ff18db0258951efd315555ea6ea742b6bff0db83 Mon Sep 17 00:00:00 2001 From: Oleg Romashin Date: Tue, 7 Sep 2010 17:36:59 -0700 Subject: [PATCH] Bug 556487 - Post Reflow Callback for nsObjectFrame r=roc a=blocking2.0 --HG-- extra : rebase_source : c8058990232bbabf8fbd36890e0fb6190c318faf --- layout/generic/nsObjectFrame.cpp | 24 +++++++++++++++++++++--- layout/generic/nsObjectFrame.h | 11 ++++++++++- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index d5f73371194..7a6f63410c4 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -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; } diff --git a/layout/generic/nsObjectFrame.h b/layout/generic/nsObjectFrame.h index 9f52e97dd7e..fe9bc4326af 100644 --- a/layout/generic/nsObjectFrame.h +++ b/layout/generic/nsObjectFrame.h @@ -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 {