From 21a5c77ebbacf3b908f56365017dacec1d6c4df6 Mon Sep 17 00:00:00 2001 From: "av%netscape.com" Date: Mon, 14 Jan 2002 23:16:37 +0000 Subject: [PATCH] Fix for bug 110094 -- winless plugins don't get right coordinates when scrolled, r=bnesse, sr=attinasi git-svn-id: svn://10.0.0.236/trunk@112116 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsObjectFrame.cpp | 31 ++++++++++++------- .../layout/html/base/src/nsObjectFrame.cpp | 31 ++++++++++++------- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index a325edb22cc..423c8b694d3 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -1486,24 +1486,31 @@ nsresult nsObjectFrame::GetWindowOriginInPixels(nsIPresContext * aPresContext, P nsresult rv = NS_OK; nsIView * parentWithView; - nsPoint origin; - nsPoint offset(0,0); + nsPoint origin(0,0); GetOffsetFromView(aPresContext, origin, &parentWithView); - // if it's windowless we want to get the offset from the parent frame - if (aWindowless) { - nsIWidget* aWidget; - parentWithView->GetOffsetFromWidget(&offset.x, &offset.y, aWidget); - origin += offset; + // if it's windowless, let's make correction for some more things + if (aWindowless && parentWithView) { + nsPoint correction(0,0); + // parent view may be scrolled + parentWithView->GetPosition(&correction.x, &correction.y); + origin += correction; + + // offset from widget + nsIWidget* aWidget; + correction = nsPoint(0, 0); + parentWithView->GetOffsetFromWidget(&correction.x, &correction.y, aWidget); + origin += correction; + + // offset from parent frame nsIFrame* parentFrame; GetParentWithView(aPresContext, &parentFrame); - - if(parentFrame) { - nsPoint originFrame; - parentFrame->GetOffsetFromView(aPresContext, originFrame, &parentWithView); - origin += originFrame; + if (parentFrame) { + correction = nsPoint(0, 0); + parentFrame->GetOffsetFromView(aPresContext, correction, &parentWithView); + origin += correction; } } diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index a325edb22cc..423c8b694d3 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -1486,24 +1486,31 @@ nsresult nsObjectFrame::GetWindowOriginInPixels(nsIPresContext * aPresContext, P nsresult rv = NS_OK; nsIView * parentWithView; - nsPoint origin; - nsPoint offset(0,0); + nsPoint origin(0,0); GetOffsetFromView(aPresContext, origin, &parentWithView); - // if it's windowless we want to get the offset from the parent frame - if (aWindowless) { - nsIWidget* aWidget; - parentWithView->GetOffsetFromWidget(&offset.x, &offset.y, aWidget); - origin += offset; + // if it's windowless, let's make correction for some more things + if (aWindowless && parentWithView) { + nsPoint correction(0,0); + // parent view may be scrolled + parentWithView->GetPosition(&correction.x, &correction.y); + origin += correction; + + // offset from widget + nsIWidget* aWidget; + correction = nsPoint(0, 0); + parentWithView->GetOffsetFromWidget(&correction.x, &correction.y, aWidget); + origin += correction; + + // offset from parent frame nsIFrame* parentFrame; GetParentWithView(aPresContext, &parentFrame); - - if(parentFrame) { - nsPoint originFrame; - parentFrame->GetOffsetFromView(aPresContext, originFrame, &parentWithView); - origin += originFrame; + if (parentFrame) { + correction = nsPoint(0, 0); + parentFrame->GetOffsetFromView(aPresContext, correction, &parentWithView); + origin += correction; } }