Initialize isScrolling to default to PR_FALSE. When printing, we don't obtain a

container, so we can't query for a webshell interface and query if scrolling is
implemented. With isScrolling set to PR_TRUE, we then follow code below which
leads to a crash. Fixes crash seen often when performing Postscript printing on
Unix.

Reviewed by dcone.
This commit is contained in:
syd%netscape.com 1999-03-30 01:11:09 +00:00
Родитель 89e53b21e2
Коммит 2f72fb0105
2 изменённых файлов: 6 добавлений и 6 удалений

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

@ -1522,7 +1522,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext,
// that will act as the scolling mechanism for the viewport // that will act as the scolling mechanism for the viewport
// XXX We should only do this when presenting to the screen, i.e., for galley // XXX We should only do this when presenting to the screen, i.e., for galley
// mode and print-preview, but not when printing // mode and print-preview, but not when printing
PRBool isScrollable = PR_TRUE; PRBool isScrollable = PR_FALSE;
nsISupports* container; nsISupports* container;
if (nsnull != aPresContext) { if (nsnull != aPresContext) {
aPresContext->GetContainer(&container); aPresContext->GetContainer(&container);
@ -1532,8 +1532,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext,
if (nsnull != webShell) { if (nsnull != webShell) {
PRInt32 scrolling = -1; PRInt32 scrolling = -1;
webShell->GetScrolling(scrolling); webShell->GetScrolling(scrolling);
if (NS_STYLE_OVERFLOW_HIDDEN == scrolling) { if (NS_STYLE_OVERFLOW_HIDDEN != scrolling) {
isScrollable = PR_FALSE; isScrollable = PR_TRUE;
} }
NS_RELEASE(webShell); NS_RELEASE(webShell);
} }

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

@ -1522,7 +1522,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext,
// that will act as the scolling mechanism for the viewport // that will act as the scolling mechanism for the viewport
// XXX We should only do this when presenting to the screen, i.e., for galley // XXX We should only do this when presenting to the screen, i.e., for galley
// mode and print-preview, but not when printing // mode and print-preview, but not when printing
PRBool isScrollable = PR_TRUE; PRBool isScrollable = PR_FALSE;
nsISupports* container; nsISupports* container;
if (nsnull != aPresContext) { if (nsnull != aPresContext) {
aPresContext->GetContainer(&container); aPresContext->GetContainer(&container);
@ -1532,8 +1532,8 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext,
if (nsnull != webShell) { if (nsnull != webShell) {
PRInt32 scrolling = -1; PRInt32 scrolling = -1;
webShell->GetScrolling(scrolling); webShell->GetScrolling(scrolling);
if (NS_STYLE_OVERFLOW_HIDDEN == scrolling) { if (NS_STYLE_OVERFLOW_HIDDEN != scrolling) {
isScrollable = PR_FALSE; isScrollable = PR_TRUE;
} }
NS_RELEASE(webShell); NS_RELEASE(webShell);
} }