Make sure to flush out content and style updates when calling sizeToContent.

Bug 244235, r+sr=jst
This commit is contained in:
bzbarsky%mit.edu 2004-05-28 16:03:09 +00:00
Родитель 6700a8a774
Коммит 201cd5d791
3 изменённых файлов: 13 добавлений и 11 удалений

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

@ -2674,6 +2674,11 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
// Flush out all content and style updates. Note that we don't need to
// flush layout since we're about to do a top-level resize reflow, and we
// shouldn't have any parents to propagate the flush to.
mDocument->FlushPendingNotifications(Flush_Style);
NS_ENSURE_SUCCESS(presShell->ResizeReflow(NS_UNCONSTRAINEDSIZE,
NS_UNCONSTRAINEDSIZE), NS_ERROR_FAILURE);

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

@ -2673,17 +2673,9 @@ GlobalWindowImpl::SizeToContent()
return NS_OK;
}
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem(do_QueryInterface(mDocShell));
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeItem> docShellParent;
docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));
// It's only valid to access this from a top window. Doesn't work from
// sub-frames.
if (docShellParent)
return NS_ERROR_FAILURE;
// The content viewer does a check to make sure that it's a content
// viewer for a toplevel docshell.
nsCOMPtr<nsIContentViewer> cv;
mDocShell->GetContentViewer(getter_AddRefs(cv));
nsCOMPtr<nsIMarkupDocumentViewer> markupViewer(do_QueryInterface(cv));

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

@ -2674,6 +2674,11 @@ NS_IMETHODIMP DocumentViewerImpl::SizeToContent()
GetPresShell(getter_AddRefs(presShell));
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
// Flush out all content and style updates. Note that we don't need to
// flush layout since we're about to do a top-level resize reflow, and we
// shouldn't have any parents to propagate the flush to.
mDocument->FlushPendingNotifications(Flush_Style);
NS_ENSURE_SUCCESS(presShell->ResizeReflow(NS_UNCONSTRAINEDSIZE,
NS_UNCONSTRAINEDSIZE), NS_ERROR_FAILURE);