diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 0565974c7a4..4a72dbebbf5 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -178,13 +178,13 @@ nsLineLayout::BeginLineReflow(nscoord aX, nscoord aY, "should no longer be using unconstrained widths"); #ifdef DEBUG if ((aWidth != NS_UNCONSTRAINEDSIZE) && CRAZY_WIDTH(aWidth)) { - NS_NOTREACHED("bad width"); +// NS_NOTREACHED("bad width"); nsFrame::ListTag(stdout, mBlockReflowState->frame); printf(": Init: bad caller: width WAS %d(0x%x)\n", aWidth, aWidth); } if ((aHeight != NS_UNCONSTRAINEDSIZE) && CRAZY_HEIGHT(aHeight)) { - NS_NOTREACHED("bad height"); +// NS_NOTREACHED("bad height"); nsFrame::ListTag(stdout, mBlockReflowState->frame); printf(": Init: bad caller: height WAS %d(0x%x)\n", aHeight, aHeight); diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 6189e3e014b..a2888ec2fdc 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -404,27 +404,13 @@ public: return mLastEventloopNestingLevel; } + static PRUint32 GetEventloopNestingLevel(); + void ConsiderNewEventloopNestingLevel() { - nsCOMPtr appShell = do_GetService(kAppShellCID); - if (appShell) { - PRUint32 currentLevel = 0; - appShell->GetEventloopNestingLevel(¤tLevel); -#ifdef XP_MACOSX - // Cocoa widget code doesn't process UI events through the normal appshell - // event loop, so it needs an additional count here. - currentLevel++; -#else - // No idea how this happens... but Linux doesn't consistently process UI - // events through the appshell event loop. If we get a 0 here on any - // platform we increment the level just in case so that we make sure we - // always tear the plugin down eventually. - if (!currentLevel) { - currentLevel++; - } -#endif - if (currentLevel < mLastEventloopNestingLevel) { - mLastEventloopNestingLevel = currentLevel; - } + PRUint32 currentLevel = GetEventloopNestingLevel(); + + if (currentLevel < mLastEventloopNestingLevel) { + mLastEventloopNestingLevel = currentLevel; } } @@ -3171,6 +3157,32 @@ void nsPluginInstanceOwner::GUItoMacEvent(const nsGUIEvent& anEvent, EventRecord #endif +// static +PRUint32 +nsPluginInstanceOwner::GetEventloopNestingLevel() +{ + nsCOMPtr appShell = do_GetService(kAppShellCID); + PRUint32 currentLevel = 0; + if (appShell) { + appShell->GetEventloopNestingLevel(¤tLevel); +#ifdef XP_MACOSX + // Cocoa widget code doesn't process UI events through the normal + // appshell event loop, so it needs an additional count here. + currentLevel++; +#endif + } + + // No idea how this happens... but Linux doesn't consistently + // process UI events through the appshell event loop. If we get a 0 + // here on any platform we increment the level just in case so that + // we make sure we always tear the plugin down eventually. + if (!currentLevel) { + currentLevel++; + } + + return currentLevel; +} + nsresult nsPluginInstanceOwner::ScrollPositionWillChange(nsIScrollableView* aScrollable, nscoord aX, nscoord aY) { #ifdef XP_MACOSX @@ -4291,11 +4303,7 @@ nsresult nsPluginInstanceOwner::Init(nsPresContext* aPresContext, nsObjectFrame* aFrame, nsIContent* aContent) { - mLastEventloopNestingLevel = 0; - nsCOMPtr appShell = do_GetService(kAppShellCID); - if (appShell) { - appShell->GetEventloopNestingLevel(&mLastEventloopNestingLevel); - } + mLastEventloopNestingLevel = GetEventloopNestingLevel(); PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG, ("nsPluginInstanceOwner::Init() called on %p for frame %p\n", this,