adjust for possible rounding in intrinsic window sizing calculation. bugs 68352,77639, probably others. r=brendan,hyatt

This commit is contained in:
danm%netscape.com 2001-05-11 00:47:38 +00:00
Родитель d0f2b845b9
Коммит f533dd2922
2 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -4981,7 +4981,16 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
NS_ENSURE_TRUE(treeOwner, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width, height),
/* presContext's size was calculated in twips and has already been
rounded to the equivalent pixels (so the width/height calculation
we just performed was probably exact, though it was based on
values already rounded during ResizeReflow). In a surprising
number of instances, this rounding makes a window which for want
of one extra pixel's width ends up wrapping the longest line of
text during actual window layout. This makes the window too short,
generally clipping the OK/Cancel buttons. Here we add one pixel
to the calculated width, to circumvent this problem. */
NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width+1, height),
NS_ERROR_FAILURE);
return NS_OK;

Просмотреть файл

@ -4981,7 +4981,16 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
NS_ENSURE_TRUE(treeOwner, NS_ERROR_FAILURE);
NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width, height),
/* presContext's size was calculated in twips and has already been
rounded to the equivalent pixels (so the width/height calculation
we just performed was probably exact, though it was based on
values already rounded during ResizeReflow). In a surprising
number of instances, this rounding makes a window which for want
of one extra pixel's width ends up wrapping the longest line of
text during actual window layout. This makes the window too short,
generally clipping the OK/Cancel buttons. Here we add one pixel
to the calculated width, to circumvent this problem. */
NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width+1, height),
NS_ERROR_FAILURE);
return NS_OK;