Bug 401361 - Draw correctly when drawWindow is called on a window using fullZoom [p=roc r+sr=vlad a=blocking1.9+]

git-svn-id: svn://10.0.0.236/trunk@238957 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
reed%reedloden.com
2007-11-08 04:43:36 +00:00
parent d479bc0f1e
commit 4bfd3bb4b2
2 changed files with 17 additions and 4 deletions

View File

@@ -694,7 +694,7 @@ public:
* @param aRect is the region to capture into the offscreen buffer, in the
* root frame's coordinate system (if aIgnoreViewportScrolling is false)
* or in the root scrolled frame's coordinate system
* (if aIgnoreViewportScrolling is true)
* (if aIgnoreViewportScrolling is true). The coordinates are in appunits.
* @param aUntrusted set to PR_TRUE if the contents may be passed to malicious
* agents. E.g. we might choose not to paint the contents of sensitive widgets
* such as the file name in a file upload widget, and we might choose not
@@ -702,7 +702,9 @@ public:
* @param aIgnoreViewportScrolling ignore clipping/scrolling/scrollbar painting
* due to scrolling in the viewport
* @param aBackgroundColor a background color to render onto
* @param aRenderedContext the gfxContext to render to
* @param aRenderedContext the gfxContext to render to. We render so that
* one CSS pixel in the source document is rendered to one unit in the current
* transform.
*/
NS_IMETHOD RenderDocument(const nsRect& aRect, PRBool aUntrusted,
PRBool aIgnoreViewportScrolling,

View File

@@ -4799,6 +4799,12 @@ PresShell::RenderDocument(const nsRect& aRect, PRBool aUntrusted,
{
NS_ENSURE_TRUE(!aUntrusted, NS_ERROR_NOT_IMPLEMENTED);
gfxRect r(0, 0,
nsPresContext::AppUnitsToFloatCSSPixels(aRect.width),
nsPresContext::AppUnitsToFloatCSSPixels(aRect.height));
aThebesContext->Save();
aThebesContext->Clip(r);
aThebesContext->PushGroup(NS_GET_A(aBackgroundColor) == 0xff ?
gfxASurface::CONTENT_COLOR :
gfxASurface::CONTENT_COLOR_ALPHA);
@@ -4839,10 +4845,13 @@ PresShell::RenderDocument(const nsRect& aRect, PRBool aUntrusted,
if (NS_SUCCEEDED(rv)) {
// Ensure that r.x,r.y gets drawn at (0,0)
aThebesContext->Save();
aThebesContext->Translate(gfxPoint(-mPresContext->AppUnitsToGfxUnits(rect.x),
-mPresContext->AppUnitsToGfxUnits(rect.y)));
aThebesContext->Translate(gfxPoint(-nsPresContext::AppUnitsToFloatCSSPixels(rect.x),
-nsPresContext::AppUnitsToFloatCSSPixels(rect.y)));
nsIDeviceContext* devCtx = mPresContext->DeviceContext();
gfxFloat scale = gfxFloat(devCtx->AppUnitsPerDevPixel())/nsPresContext::AppUnitsPerCSSPixel();
aThebesContext->Scale(scale, scale);
nsCOMPtr<nsIRenderingContext> rc;
devCtx->CreateRenderingContextInstance(*getter_AddRefs(rc));
rc->Init(devCtx, aThebesContext);
@@ -4861,6 +4870,8 @@ PresShell::RenderDocument(const nsRect& aRect, PRBool aUntrusted,
aThebesContext->PopGroupToSource();
aThebesContext->Paint();
aThebesContext->Restore();
return NS_OK;
}