From 0b9b1643df176bd628a6c7dbd00ec0f1fb584988 Mon Sep 17 00:00:00 2001 From: Mark Finkle Date: Tue, 22 Dec 2009 16:59:34 -0500 Subject: [PATCH] Bug 536199 - Crash Yahoo! frontpage with 12/21 1.9.2 nightly build [r=dougt] --- layout/generic/nsObjectFrame.cpp | 45 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index fa9ae16ed27..71ee3040afb 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -5031,7 +5031,7 @@ nsPluginInstanceOwner::SetupXShm() // // This method supports the NPImageExpose API which is specific to the // HILDON platform. Basically what it allows us to do is to pass a -// memory buffer into a plugin (namely flash), and have flase draw +// memory buffer into a plugin (namely flash), and have flash draw // directly into the buffer. // // It may be faster if the rest of the system used offscreen image @@ -5066,10 +5066,10 @@ nsPluginInstanceOwner::NativeImageDraw(NPRect* invalidRect) if (absPosHeight == 0 || absPosWidth == 0) return; - if (!mSharedXImage || - mPluginSize.width != absPosWidth || - mPluginSize.height != absPosHeight) { - + PRBool sizeChanged = (mPluginSize.width != absPosWidth || + mPluginSize.height != absPosHeight); + + if (!mSharedXImage || sizeChanged) { mPluginSize = nsIntSize(absPosWidth, absPosHeight); if (NS_FAILED(SetupXShm())) @@ -5083,23 +5083,24 @@ nsPluginInstanceOwner::NativeImageDraw(NPRect* invalidRect) // setup window such that it knows about the size and clip. This // is to work around a flash clipping bug when using the Image // Expose API. - - NPRect newClipRect; - newClipRect.left = 0; - newClipRect.top = 0; - newClipRect.right = window->width; - newClipRect.bottom = window->height; - - window->clipRect = newClipRect; - window->x = 0; - window->y = 0; + if (!invalidRect && sizeChanged) { + NPRect newClipRect; + newClipRect.left = 0; + newClipRect.top = 0; + newClipRect.right = window->width; + newClipRect.bottom = window->height; - NPSetWindowCallbackStruct* ws_info = - static_cast(window->ws_info); - ws_info->visual = 0; - ws_info->colormap = 0; - ws_info->depth = 16; - mInstance->SetWindow(window); + window->clipRect = newClipRect; + window->x = 0; + window->y = 0; + + NPSetWindowCallbackStruct* ws_info = + static_cast(window->ws_info); + ws_info->visual = 0; + ws_info->colormap = 0; + ws_info->depth = 16; + mInstance->SetWindow(window); + } NPEvent pluginEvent; NPImageExpose imageExpose; @@ -5781,7 +5782,7 @@ nsPluginInstanceOwner::SetAbsoluteScreenPosition(nsIDOMElement* element, clip->GetWidth(&width); clip->GetHeight(&height); - mAbsolutePositionClip = gfxRect(left,top, width, height); + mAbsolutePositionClip = gfxRect(left, top, width, height); mBlitParentElement = element;