From 9fd40ef3a353c1de06a6824e5ff938338aa3e249 Mon Sep 17 00:00:00 2001 From: "peterlubczynski%netscape.com" Date: Tue, 7 Aug 2001 01:50:32 +0000 Subject: [PATCH] Fix for windowless plugins don't draw in the correct place when scrolled bug 93056 patch by dbrittain@superscape.com r=peterl sr=waterson --- layout/generic/nsObjectFrame.cpp | 20 +++++++++----------- layout/html/base/src/nsObjectFrame.cpp | 20 +++++++++----------- 2 files changed, 18 insertions(+), 22 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index df1da1cb747d..6f85fa1b4381 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1313,30 +1313,28 @@ nsObjectFrame::DidReflow(nsIPresContext* aPresContext, nsIPluginInstance *inst; float t2p; aPresContext->GetTwipsToPixels(&t2p); - nscoord offx, offy; + nscoord offx = 0; + nscoord offy = 0; GetOffsetFromView(aPresContext, origin, &parentWithView); // if it's windowless we want to get the offset from the parent frame if (window->type == nsPluginWindowType_Drawable) { - nsIFrame* parentFrame; + nsIWidget* aWidget; + parentWithView->GetOffsetFromWidget(&offx, &offy, aWidget); + + nsIFrame* parentFrame; GetParentWithView(aPresContext, &parentFrame); if(parentFrame != nsnull) parentFrame->GetOffsetFromView(aPresContext, origin, &parentWithView); + } -#if 0 - // beard: how do we get this? - parentWithView->GetScrollOffset(&offx, &offy); -#else - offx = offy = 0; -#endif - - window->x = NSTwipsToIntPixels(origin.x, t2p); - window->y = NSTwipsToIntPixels(origin.y, t2p); + window->x = NSTwipsToIntPixels(origin.x + offx, t2p); + window->y = NSTwipsToIntPixels(origin.y + offy, t2p); // window->width = NSTwipsToIntPixels(aMetrics.width, t2p); // window->height = NSTwipsToIntPixels(aMetrics.height, t2p); diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index df1da1cb747d..6f85fa1b4381 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -1313,30 +1313,28 @@ nsObjectFrame::DidReflow(nsIPresContext* aPresContext, nsIPluginInstance *inst; float t2p; aPresContext->GetTwipsToPixels(&t2p); - nscoord offx, offy; + nscoord offx = 0; + nscoord offy = 0; GetOffsetFromView(aPresContext, origin, &parentWithView); // if it's windowless we want to get the offset from the parent frame if (window->type == nsPluginWindowType_Drawable) { - nsIFrame* parentFrame; + nsIWidget* aWidget; + parentWithView->GetOffsetFromWidget(&offx, &offy, aWidget); + + nsIFrame* parentFrame; GetParentWithView(aPresContext, &parentFrame); if(parentFrame != nsnull) parentFrame->GetOffsetFromView(aPresContext, origin, &parentWithView); + } -#if 0 - // beard: how do we get this? - parentWithView->GetScrollOffset(&offx, &offy); -#else - offx = offy = 0; -#endif - - window->x = NSTwipsToIntPixels(origin.x, t2p); - window->y = NSTwipsToIntPixels(origin.y, t2p); + window->x = NSTwipsToIntPixels(origin.x + offx, t2p); + window->y = NSTwipsToIntPixels(origin.y + offy, t2p); // window->width = NSTwipsToIntPixels(aMetrics.width, t2p); // window->height = NSTwipsToIntPixels(aMetrics.height, t2p);