Bug 177805: Fix the use of units in Gecko. r+sr=roc

git-svn-id: svn://10.0.0.236/trunk@219640 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
sharparrow1%yahoo.com
2007-02-07 07:46:44 +00:00
parent d70c26f70c
commit dd459d0a71
164 changed files with 1364 additions and 2226 deletions

View File

@@ -686,12 +686,8 @@ DocumentViewerImpl::InitPresentationStuff(PRBool aDoInitialReflow)
nsRect bounds;
mWindow->GetBounds(bounds);
float p2t;
p2t = mPresContext->PixelsToTwips();
nscoord width = NSIntPixelsToTwips(bounds.width, p2t);
nscoord height = NSIntPixelsToTwips(bounds.height, p2t);
nscoord width = mPresContext->DevPixelsToAppUnits(bounds.width);
nscoord height = mPresContext->DevPixelsToAppUnits(bounds.height);
mViewManager->DisableRefresh();
mViewManager->SetWindowDimensions(width, height);
@@ -802,7 +798,6 @@ DocumentViewerImpl::InitInternal(nsIWidget* aParentWidget,
// Clear PrintPreview Alternate Device
if (mDeviceContext) {
mDeviceContext->SetAltDevice(nsnull);
mDeviceContext->SetCanonicalPixelScale(1.0);
}
#endif
@@ -924,9 +919,8 @@ DocumentViewerImpl::DumpContentToPPM(const char* aFileName)
mViewManager->GetRootView(view);
}
nsRect r = view->GetBounds() - view->GetPosition();
float p2t = mPresContext->PixelsToTwips();
// Limit the bitmap size to 5000x5000
nscoord twipLimit = NSIntPixelsToTwips(5000, p2t);
nscoord twipLimit = mPresContext->DevPixelsToAppUnits(5000);
if (r.height > twipLimit)
r.height = twipLimit;
if (r.width > twipLimit)
@@ -950,9 +944,8 @@ DocumentViewerImpl::DumpContentToPPM(const char* aFileName)
if (!surface) {
status = "NOSURFACE";
} else {
float t2p = mPresContext->TwipsToPixels();
PRUint32 width = NSTwipsToIntPixels(view->GetBounds().width, t2p);
PRUint32 height = NSTwipsToIntPixels(view->GetBounds().height, t2p);
PRUint32 width = mPresContext->AppUnitsToDevPixels(view->GetBounds().width);
PRUint32 height = mPresContext->AppUnitsToDevPixels(view->GetBounds().height);
PRUint8* data;
PRInt32 rowLen, rowSpan;
@@ -2318,9 +2311,7 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
nsIDeviceContext *dx = mPresContext->DeviceContext();
nsRect tbounds = aBounds;
float p2t;
p2t = mPresContext->PixelsToTwips();
tbounds *= p2t;
tbounds *= mPresContext->AppUnitsPerDevPixel();
// Initialize the view manager with an offset. This allows the viewmanager
// to manage a coordinate space offset from (0,0)
@@ -3150,7 +3141,6 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
PRInt32 width, height;
float pixelScale;
// so how big is it?
nsRect shellArea = presContext->GetVisibleArea();
@@ -3159,9 +3149,8 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
// Protect against bogus returns here
return NS_ERROR_FAILURE;
}
pixelScale = presContext->TwipsToPixels();
width = PRInt32((float)shellArea.width*pixelScale);
height = PRInt32((float)shellArea.height*pixelScale);
width = presContext->AppUnitsToDevPixels(shellArea.width);
height = presContext->AppUnitsToDevPixels(shellArea.height);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));