From 094150db2d50f72ebdb43f7a18ea721fbcb5ce3f Mon Sep 17 00:00:00 2001 From: "av%netscape.com" Date: Sun, 23 Dec 2001 04:11:52 +0000 Subject: [PATCH] Bug 116108 -- windowless plugins do not get updated window in table cell, r=peterl, sr=attinasi git-svn-id: svn://10.0.0.236/branches/MOZILLA_0_9_4_BRANCH@111043 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/html/base/src/nsObjectFrame.cpp | 66 +++++++++++-------- 1 file changed, 40 insertions(+), 26 deletions(-) diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index ca16fbee168..5be2ccc3240 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -1716,36 +1716,50 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, // Screen painting code #if defined (XP_MAC) - // delegate all painting to the plugin instance. - if ((NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) && (nsnull != mInstanceOwner)) { - mInstanceOwner->Paint(aDirtyRect); - } + // delegate all painting to the plugin instance. + if ((NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) && (nsnull != mInstanceOwner)) + mInstanceOwner->Paint(aDirtyRect); #elif defined (XP_PC) - if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) - { - nsIPluginInstance * inst; - if (NS_OK == GetPluginInstance(inst)) - { - // Look if it's windowless - nsPluginWindow * window; - mInstanceOwner->GetWindow(window); - if (window->type == nsPluginWindowType_Drawable) - { - PRUint32 hdc; - aRenderingContext.RetrieveCurrentNativeGraphicData(&hdc); - if(NS_REINTERPRET_CAST(PRUint32, window->window) != hdc) - { - window->window = NS_REINTERPRET_CAST(nsPluginPort*, hdc); - inst->SetWindow(window); - } - mInstanceOwner->Paint(aDirtyRect, hdc); - } - NS_RELEASE(inst); + if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { + nsIPluginInstance * inst; + if (NS_OK == GetPluginInstance(inst)) { + // Look if it's windowless + nsPluginWindow * window; + mInstanceOwner->GetWindow(window); + if (window->type == nsPluginWindowType_Drawable) { + + // check if we need to call SetWindow with updated parameters + PRBool doupdatewindow = PR_FALSE; + + // check if we need to update hdc + PRUint32 hdc; + aRenderingContext.RetrieveCurrentNativeGraphicData(&hdc); + if(NS_REINTERPRET_CAST(PRUint32, window->window) != hdc) { + window->window = NS_REINTERPRET_CAST(nsPluginPort*, hdc); + doupdatewindow = PR_TRUE; } + + // check if we need to update window position + nsPoint origin; + GetWindowOriginInPixels(aPresContext, PR_TRUE, &origin); + + if((window->x != origin.x) || (window->y != origin.y)) { + window->x = origin.x; + window->y = origin.y; + doupdatewindow = PR_TRUE; + } + + if(doupdatewindow) + inst->SetWindow(window); + + mInstanceOwner->Paint(aDirtyRect, hdc); + } + NS_RELEASE(inst); } + } #endif /* !XP_MAC */ - DO_GLOBAL_REFLOW_COUNT_DSP("nsObjectFrame", &aRenderingContext); - return NS_OK; + DO_GLOBAL_REFLOW_COUNT_DSP("nsObjectFrame", &aRenderingContext); + return NS_OK; } NS_IMETHODIMP