Offset the viewmanager in nsDocumentViewer by passing the offset to nsIViewManager::Init instead of offsetting the root view b=32161 r=attanasi@netscape.com

This commit is contained in:
kmcclusk%netscape.com 2000-03-23 23:50:42 +00:00
parent a9ca1f89f8
commit cc8f1f34bd
3 changed files with 42 additions and 12 deletions

View File

@ -887,15 +887,25 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
nsCOMPtr<nsIDeviceContext> dx;
mPresContext->GetDeviceContext(getter_AddRefs(dx));
if ((NS_OK != rv) || (NS_OK != mViewManager->Init(dx))) {
return rv;
}
nsRect tbounds = aBounds;
float p2t;
mPresContext->GetPixelsToTwips(&p2t);
tbounds *= p2t;
// Initialize the view manager with an offset. This allows the viewmanager
// to manage a coordinate space offset from (0,0)
if ((NS_OK != rv) || (NS_OK != mViewManager->Init(dx, tbounds.x, tbounds.y))) {
return rv;
}
// Reset the bounds offset so the root view is set to 0,0. The offset is
// specified in nsIViewManager::Init above.
// Besides, layout will reset the root view to (0,0) during reflow,
// so changing it to 0,0 eliminates placing
// the root view in the wrong place initially.
tbounds.x = 0;
tbounds.y = 0;
// Create a child window of the parent that is our "root view/window"
// Create a view
rv = nsComponentManager::CreateInstance(kViewCID,

View File

@ -887,15 +887,25 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
nsCOMPtr<nsIDeviceContext> dx;
mPresContext->GetDeviceContext(getter_AddRefs(dx));
if ((NS_OK != rv) || (NS_OK != mViewManager->Init(dx))) {
return rv;
}
nsRect tbounds = aBounds;
float p2t;
mPresContext->GetPixelsToTwips(&p2t);
tbounds *= p2t;
// Initialize the view manager with an offset. This allows the viewmanager
// to manage a coordinate space offset from (0,0)
if ((NS_OK != rv) || (NS_OK != mViewManager->Init(dx, tbounds.x, tbounds.y))) {
return rv;
}
// Reset the bounds offset so the root view is set to 0,0. The offset is
// specified in nsIViewManager::Init above.
// Besides, layout will reset the root view to (0,0) during reflow,
// so changing it to 0,0 eliminates placing
// the root view in the wrong place initially.
tbounds.x = 0;
tbounds.y = 0;
// Create a child window of the parent that is our "root view/window"
// Create a view
rv = nsComponentManager::CreateInstance(kViewCID,

View File

@ -887,15 +887,25 @@ DocumentViewerImpl::MakeWindow(nsIWidget* aParentWidget,
nsCOMPtr<nsIDeviceContext> dx;
mPresContext->GetDeviceContext(getter_AddRefs(dx));
if ((NS_OK != rv) || (NS_OK != mViewManager->Init(dx))) {
return rv;
}
nsRect tbounds = aBounds;
float p2t;
mPresContext->GetPixelsToTwips(&p2t);
tbounds *= p2t;
// Initialize the view manager with an offset. This allows the viewmanager
// to manage a coordinate space offset from (0,0)
if ((NS_OK != rv) || (NS_OK != mViewManager->Init(dx, tbounds.x, tbounds.y))) {
return rv;
}
// Reset the bounds offset so the root view is set to 0,0. The offset is
// specified in nsIViewManager::Init above.
// Besides, layout will reset the root view to (0,0) during reflow,
// so changing it to 0,0 eliminates placing
// the root view in the wrong place initially.
tbounds.x = 0;
tbounds.y = 0;
// Create a child window of the parent that is our "root view/window"
// Create a view
rv = nsComponentManager::CreateInstance(kViewCID,