Bug 368501, Table Properties Windows Cut Off, r=bz, sr=roc

This commit is contained in:
Olli.Pettay%helsinki.fi 2007-03-05 21:55:23 +00:00
Родитель b40bb596e6
Коммит 2a7ac23501
3 изменённых файлов: 35 добавлений и 18 удалений

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

@ -383,6 +383,10 @@ public:
*/
NS_IMETHOD FlushPendingNotifications(mozFlushType aType) = 0;
/**
* Callbacks will be called even if reflow itself fails for
* some reason.
*/
NS_IMETHOD PostReflowCallback(nsIReflowCallback* aCallback) = 0;
NS_IMETHOD CancelReflowCallback(nsIReflowCallback* aCallback) = 0;

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

@ -80,6 +80,7 @@
#include "nsIEventStateManager.h"
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "nsIReflowCallback.h"
#define NS_MENU_POPUP_LIST_INDEX 0
@ -165,7 +166,7 @@ nsMenuFrame::SetParent(const nsIFrame* aParent)
return NS_OK;
}
class nsASyncMenuInitialization : public nsRunnable
class nsASyncMenuInitialization : public nsIReflowCallback
{
public:
nsASyncMenuInitialization(nsIFrame* aFrame)
@ -173,16 +174,19 @@ public:
{
}
NS_IMETHOD Run() {
virtual PRBool ReflowFinished() {
PRBool shouldFlush = PR_FALSE;
if (mWeakFrame.IsAlive()) {
nsIMenuFrame* imenu = nsnull;
CallQueryInterface(mWeakFrame.GetFrame(), &imenu);
if (imenu) {
nsMenuFrame* menu = NS_STATIC_CAST(nsMenuFrame*, imenu);
menu->UpdateMenuType(menu->GetPresContext());
shouldFlush = PR_TRUE;
}
}
return NS_OK;
delete this;
return shouldFlush;
}
nsWeakFrame mWeakFrame;
@ -243,9 +247,9 @@ nsMenuFrame::Init(nsIContent* aContent,
}
BuildAcceleratorText();
nsCOMPtr<nsIRunnable> ev =
new nsASyncMenuInitialization(this);
NS_DispatchToCurrentThread(ev);
nsIReflowCallback* cb = new nsASyncMenuInitialization(this);
NS_ENSURE_TRUE(cb, NS_ERROR_OUT_OF_MEMORY);
GetPresContext()->PresShell()->PostReflowCallback(cb);
return rv;
}
@ -1942,7 +1946,7 @@ nsMenuFrame::AppendFrames(nsIAtom* aListName,
return rv;
}
class nsASyncMenuGeneration : public nsRunnable
class nsASyncMenuGeneration : public nsIReflowCallback
{
public:
nsASyncMenuGeneration(nsIFrame* aFrame)
@ -1955,7 +1959,8 @@ public:
}
}
NS_IMETHOD Run() {
virtual PRBool ReflowFinished() {
PRBool shouldFlush = PR_FALSE;
nsIFrame* frame = mWeakFrame.GetFrame();
if (frame) {
nsBoxLayoutState state(frame->GetPresContext());
@ -1964,13 +1969,15 @@ public:
CallQueryInterface(frame, &imenu);
if (imenu) {
imenu->MarkAsGenerated();
shouldFlush = PR_TRUE;
}
}
}
if (mDocument) {
mDocument->UnblockOnload(PR_FALSE);
}
return NS_OK;
delete this;
return shouldFlush;
}
nsWeakFrame mWeakFrame;
@ -1991,9 +1998,10 @@ nsMenuFrame::SizeToPopup(nsBoxLayoutState& aState, nsSize& aSize)
if (child &&
!nsContentUtils::HasNonEmptyAttr(child, kNameSpaceID_None,
nsGkAtoms::menugenerated)) {
nsCOMPtr<nsIRunnable> ev =
new nsASyncMenuGeneration(this);
NS_DispatchToCurrentThread(ev);
nsIReflowCallback* cb = new nsASyncMenuGeneration(this);
if (cb) {
GetPresContext()->PresShell()->PostReflowCallback(cb);
}
}
return PR_FALSE;
}

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

@ -75,6 +75,7 @@
#include "nsCSSFrameConstructor.h"
#include "nsIBoxLayout.h"
#include "nsIPopupBoxObject.h"
#include "nsIReflowCallback.h"
#ifdef XP_WIN
#include "nsISound.h"
#endif
@ -619,7 +620,7 @@ nsMenuPopupFrame::MovePopupToOtherSideOfParent ( PRBool inFlushAboveBelow, PRInt
} // MovePopupToOtherSideOfParent
class nsASyncMenuActivation : public nsRunnable
class nsASyncMenuActivation : public nsIReflowCallback
{
public:
nsASyncMenuActivation(nsIContent* aContent)
@ -627,7 +628,8 @@ public:
{
}
NS_IMETHOD Run() {
virtual PRBool ReflowFinished() {
PRBool shouldFlush = PR_FALSE;
if (mContent &&
!mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::menuactive,
nsGkAtoms::_true, eCaseMatters) &&
@ -635,8 +637,11 @@ public:
nsGkAtoms::_true, eCaseMatters)) {
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::menuactive,
NS_LITERAL_STRING("true"), PR_TRUE);
shouldFlush = PR_TRUE;
}
return NS_OK;
delete this;
return shouldFlush;
}
nsCOMPtr<nsIContent> mContent;
@ -1000,9 +1005,9 @@ nsMenuPopupFrame::SyncViewWithFrame(nsPresContext* aPresContext,
nsGkAtoms::_true, eCaseMatters) &&
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::menutobedisplayed,
nsGkAtoms::_true, eCaseMatters)) {
nsCOMPtr<nsIRunnable> ev =
new nsASyncMenuActivation(mContent);
NS_DispatchToCurrentThread(ev);
nsIReflowCallback* cb = new nsASyncMenuActivation(mContent);
NS_ENSURE_TRUE(cb, NS_ERROR_OUT_OF_MEMORY);
GetPresContext()->PresShell()->PostReflowCallback(cb);
}
return NS_OK;