From 207cd25a195b758dc26d1291bf45934c276414fd Mon Sep 17 00:00:00 2001 From: "av%netscape.com" Date: Sat, 22 Dec 2001 00:21:12 +0000 Subject: [PATCH] Bug 116108, passing coordinates to windowless plugin when in a table, r=peterl, sr=attinasi git-svn-id: svn://10.0.0.236/trunk@111019 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsObjectFrame.cpp | 23 ++++++++++++++++--- .../layout/html/base/src/nsObjectFrame.cpp | 23 ++++++++++++++++--- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index 8c7143e9287..4b77eb4513f 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -1591,9 +1591,8 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, PRUint32 aFlags) { const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility); - if ((vis != nsnull) && !vis->IsVisibleOrCollapsed()) { + if ((vis != nsnull) && !vis->IsVisibleOrCollapsed()) return NS_OK; - } nsIFrame * child = mFrames.FirstChild(); if (child) { // if we have children, we are probably not really a plugin @@ -1757,12 +1756,30 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, 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); - inst->SetWindow(window); + 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); diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index 8c7143e9287..4b77eb4513f 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -1591,9 +1591,8 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, PRUint32 aFlags) { const nsStyleVisibility* vis = (const nsStyleVisibility*)mStyleContext->GetStyleData(eStyleStruct_Visibility); - if ((vis != nsnull) && !vis->IsVisibleOrCollapsed()) { + if ((vis != nsnull) && !vis->IsVisibleOrCollapsed()) return NS_OK; - } nsIFrame * child = mFrames.FirstChild(); if (child) { // if we have children, we are probably not really a plugin @@ -1757,12 +1756,30 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, 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); - inst->SetWindow(window); + 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);