From 03359fa12a81eb57b1b1eed41c21ecb2303458ee Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Wed, 19 Nov 2003 02:00:51 +0000 Subject: [PATCH] Fix printing of plugins in absolutely positioned divs to use the right coordinates. Bug 225832, r+sr=roc --- layout/generic/nsObjectFrame.cpp | 17 +++++++---------- layout/html/base/src/nsObjectFrame.cpp | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/layout/generic/nsObjectFrame.cpp b/layout/generic/nsObjectFrame.cpp index 2a25700b424a..39b3c0725685 100644 --- a/layout/generic/nsObjectFrame.cpp +++ b/layout/generic/nsObjectFrame.cpp @@ -1632,21 +1632,18 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, pi->GetValue(nsPluginInstanceVariable_WindowlessBool, (void *)&windowless); window.type = windowless ? nsPluginWindowType_Drawable : nsPluginWindowType_Window; - // get a few things - nsCOMPtr printSettings; - if (thePrinterContext) { - thePrinterContext->GetPrintSettings(getter_AddRefs(printSettings)); - NS_ENSURE_TRUE(printSettings, NS_ERROR_FAILURE); - printSettings->GetMarginInTwips(margin); - } + // Get the offset of the DC + nsTransform2D* rcTransform; + aRenderingContext.GetCurrentTransform(rcTransform); + rcTransform->GetTranslationCoord(&origin.x, &origin.y); + // Get the conversion factor between pixels and twips aPresContext->GetTwipsToPixels(&t2p); - GetOffsetFromView(aPresContext, origin, &parentWithView); // set it all up // XXX is windowless different? - window.x = NSToCoordRound((origin.x + margin.left) * t2p); - window.y = NSToCoordRound((origin.y + margin.top ) * t2p); + window.x = origin.x; + window.y = origin.y; window.width = NSToCoordRound(mRect.width * t2p); window.height= NSToCoordRound(mRect.height * t2p); window.clipRect.bottom = 0; window.clipRect.top = 0; diff --git a/layout/html/base/src/nsObjectFrame.cpp b/layout/html/base/src/nsObjectFrame.cpp index 2a25700b424a..39b3c0725685 100644 --- a/layout/html/base/src/nsObjectFrame.cpp +++ b/layout/html/base/src/nsObjectFrame.cpp @@ -1632,21 +1632,18 @@ nsObjectFrame::Paint(nsIPresContext* aPresContext, pi->GetValue(nsPluginInstanceVariable_WindowlessBool, (void *)&windowless); window.type = windowless ? nsPluginWindowType_Drawable : nsPluginWindowType_Window; - // get a few things - nsCOMPtr printSettings; - if (thePrinterContext) { - thePrinterContext->GetPrintSettings(getter_AddRefs(printSettings)); - NS_ENSURE_TRUE(printSettings, NS_ERROR_FAILURE); - printSettings->GetMarginInTwips(margin); - } + // Get the offset of the DC + nsTransform2D* rcTransform; + aRenderingContext.GetCurrentTransform(rcTransform); + rcTransform->GetTranslationCoord(&origin.x, &origin.y); + // Get the conversion factor between pixels and twips aPresContext->GetTwipsToPixels(&t2p); - GetOffsetFromView(aPresContext, origin, &parentWithView); // set it all up // XXX is windowless different? - window.x = NSToCoordRound((origin.x + margin.left) * t2p); - window.y = NSToCoordRound((origin.y + margin.top ) * t2p); + window.x = origin.x; + window.y = origin.y; window.width = NSToCoordRound(mRect.width * t2p); window.height= NSToCoordRound(mRect.height * t2p); window.clipRect.bottom = 0; window.clipRect.top = 0;