Additional patch for Bug 348304 to fix Bug 351909 r+sr=bz

This commit is contained in:
Olli.Pettay%helsinki.fi 2006-09-12 07:27:38 +00:00
Родитель f507686699
Коммит bfcbe65fbe
1 изменённых файлов: 23 добавлений и 19 удалений

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

@ -1952,34 +1952,38 @@ class nsASyncMenuGeneration : public nsRunnable
{
public:
nsASyncMenuGeneration(nsIContent* aContent)
: mContent(aContent)
: mContent(aContent), mDocument(aContent ? aContent->GetCurrentDoc() : nsnull)
{
if (mDocument) {
mDocument->BlockOnload();
}
}
NS_IMETHOD Run() {
nsIDocument* doc = mContent ? mContent->GetCurrentDoc() : nsnull;
NS_ENSURE_TRUE(doc, NS_OK);
nsIPresShell* shell = doc->GetShellAt(0);
NS_ENSURE_TRUE(shell, NS_OK);
nsIFrame* frame = shell->GetPrimaryFrameFor(mContent);
NS_ENSURE_TRUE(frame, NS_OK);
PRBool collapsed = PR_FALSE;
nsBoxLayoutState state(frame->GetPresContext());
frame->IsCollapsed(state, collapsed);
if (collapsed) {
return NS_OK;
nsIPresShell* shell = doc ? doc->GetShellAt(0) : nsnull;
nsIFrame* frame = shell ? shell->GetPrimaryFrameFor(mContent) : nsnull;
if (frame) {
PRBool collapsed = PR_FALSE;
nsBoxLayoutState state(frame->GetPresContext());
frame->IsCollapsed(state, collapsed);
if (!collapsed) {
nsIMenuFrame* imenu = nsnull;
CallQueryInterface(frame, &imenu);
if (imenu) {
imenu->MarkAsGenerated();
}
}
}
nsIMenuFrame* imenu = nsnull;
CallQueryInterface(frame, &imenu);
NS_ENSURE_TRUE(imenu, NS_OK);
return imenu->MarkAsGenerated();
if (mDocument) {
mDocument->UnblockOnload(PR_FALSE);
}
return NS_OK;
}
nsCOMPtr<nsIContent> mContent;
nsCOMPtr<nsIContent> mContent;
nsCOMPtr<nsIDocument> mDocument;
};
PRBool