зеркало из https://github.com/mozilla/pjs.git
Make sure to flush out content and style updates when calling sizeToContent.
Bug 244235, r+sr=jst
This commit is contained in:
Родитель
6700a8a774
Коммит
201cd5d791
|
@ -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,16 +2673,8 @@ 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));
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче