Bug 226232 DRefTool analysis for xul files

r=roc sr=roc
This commit is contained in:
timeless%mozdev.org 2003-12-21 04:04:05 +00:00
Родитель dd49d5d888
Коммит 57d9d7b390
4 изменённых файлов: 295 добавлений и 294 удалений

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

@ -351,6 +351,8 @@ nsPopupSetFrame::ShowPopup(nsIContent* aElementContent, nsIContent* aPopupConten
entry = mPopupList->GetEntry(aPopupContent); entry = mPopupList->GetEntry(aPopupContent);
if (!entry) { if (!entry) {
entry = new nsPopupFrameList(aPopupContent, mPopupList); entry = new nsPopupFrameList(aPopupContent, mPopupList);
if (!entry)
return NS_ERROR_OUT_OF_MEMORY;
mPopupList = entry; mPopupList = entry;
} }
@ -801,6 +803,8 @@ nsPopupSetFrame::AddPopupFrame(nsIFrame* aPopup)
entry = mPopupList->GetEntry(content); entry = mPopupList->GetEntry(content);
if (!entry) { if (!entry) {
entry = new nsPopupFrameList(content, mPopupList); entry = new nsPopupFrameList(content, mPopupList);
if (!entry)
return NS_ERROR_OUT_OF_MEMORY;
mPopupList = entry; mPopupList = entry;
} }

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

@ -321,6 +321,9 @@ nsRootBoxFrame::AddTooltipSupport(nsIContent* aNode)
// it will add itself to, and destroyed when those targets // it will add itself to, and destroyed when those targets
// are destroyed // are destroyed
nsXULTooltipListener* listener = new nsXULTooltipListener(); nsXULTooltipListener* listener = new nsXULTooltipListener();
if (!listener)
return NS_ERROR_OUT_OF_MEMORY;
listener->Init(aNode, this); listener->Init(aNode, this);
return NS_OK; return NS_OK;
} }

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

@ -188,7 +188,6 @@ nsSplitterFrameInner::GetResizeBefore()
nsXULAtoms::resizebefore, value); nsXULAtoms::resizebefore, value);
if (value.Equals(NS_LITERAL_STRING("farthest"))) if (value.Equals(NS_LITERAL_STRING("farthest")))
return Farthest; return Farthest;
else
return Closest; return Closest;
} }
@ -206,9 +205,8 @@ nsSplitterFrameInner::GetResizeAfter()
nsXULAtoms::resizeafter, value); nsXULAtoms::resizeafter, value);
if (value.Equals(NS_LITERAL_STRING("farthest"))) if (value.Equals(NS_LITERAL_STRING("farthest")))
return Farthest; return Farthest;
else if (value.Equals(NS_LITERAL_STRING("grow"))) if (value.Equals(NS_LITERAL_STRING("grow")))
return Grow; return Grow;
else
return Closest; return Closest;
} }
@ -220,11 +218,9 @@ nsSplitterFrameInner::GetState()
nsXULAtoms::state, value); nsXULAtoms::state, value);
if (value.Equals(NS_LITERAL_STRING("dragging"))) if (value.Equals(NS_LITERAL_STRING("dragging")))
return Dragging; return Dragging;
else if (value.Equals(NS_LITERAL_STRING("collapsed"))) if (value.Equals(NS_LITERAL_STRING("collapsed")))
return Collapsed; return Collapsed;
else
return Open; return Open;
} }
// //
@ -248,21 +244,19 @@ NS_NewSplitterFrame ( nsIPresShell* aPresShell, nsIFrame** aNewFrame )
} // NS_NewSplitterFrame } // NS_NewSplitterFrame
nsSplitterFrame::nsSplitterFrame(nsIPresShell* aPresShell):nsBoxFrame(aPresShell) nsSplitterFrame::nsSplitterFrame(nsIPresShell* aPresShell)
: nsBoxFrame(aPresShell),
mInner(0)
{ {
mInner = new nsSplitterFrameInner(this);
mInner->AddRef();
mInner->mChildInfosAfter = nsnull;
mInner->mChildInfosBefore = nsnull;
mInner->mState = nsSplitterFrameInner::Open;
mInner->mDragging = PR_FALSE;
} }
nsSplitterFrame::~nsSplitterFrame() nsSplitterFrame::~nsSplitterFrame()
{ {
if (mInner) {
mInner->RemoveListener(); mInner->RemoveListener();
mInner->Release(); mInner->Release();
} }
}
// //
@ -324,6 +318,16 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext,
nsStyleContext* aContext, nsStyleContext* aContext,
nsIFrame* aPrevInFlow) nsIFrame* aPrevInFlow)
{ {
NS_ENSURE_FALSE(mInner, NS_ERROR_ALREADY_INITIALIZED);
mInner = new nsSplitterFrameInner(this);
if (!mInner)
return NS_ERROR_OUT_OF_MEMORY;
mInner->AddRef();
mInner->mChildInfosAfter = nsnull;
mInner->mChildInfosBefore = nsnull;
mInner->mState = nsSplitterFrameInner::Open;
mInner->mDragging = PR_FALSE;
/* make it real time drag for now due to problems /* make it real time drag for now due to problems
nsILookAndFeel* lookAndFeel; nsILookAndFeel* lookAndFeel;
if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, NS_GET_IID(nsILookAndFeel), (void**)&lookAndFeel))) { if (NS_SUCCEEDED(nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, NS_GET_IID(nsILookAndFeel), (void**)&lookAndFeel))) {
@ -474,7 +478,6 @@ nsSplitterFrame::HandleEvent(nsIPresContext* aPresContext,
nsGUIEvent* aEvent, nsGUIEvent* aEvent,
nsEventStatus* aEventStatus) nsEventStatus* aEventStatus)
{ {
switch (aEvent->message) { switch (aEvent->message) {
case NS_MOUSE_MOVE: case NS_MOUSE_MOVE:
mInner->MouseDrag(aPresContext, aEvent); mInner->MouseDrag(aPresContext, aEvent);
@ -510,7 +513,6 @@ nsSplitterFrameInner::MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent)
} }
//printf("MouseUp\n"); //printf("MouseUp\n");
} }
} }
@ -598,7 +600,6 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent
if (GetCollapseDirection() == After) if (GetCollapseDirection() == After)
{ {
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE); mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE);
} }
} else if (oldPos < 0 && oldPos < pos) } else if (oldPos < 0 && oldPos < pos)
@ -607,27 +608,20 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent
if (GetCollapseDirection() == Before) if (GetCollapseDirection() == Before)
{ {
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE); mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE);
} }
} }
} }
} else { } else {
// if we are not in a collapsed position and we are not dragging make sure // if we are not in a collapsed position and we are not dragging make sure
// we are dragging. // we are dragging.
if (currentState != Dragging) if (currentState != Dragging)
mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("dragging"), PR_TRUE); mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("dragging"), PR_TRUE);
if (realTimeDrag) if (realTimeDrag)
AdjustChildren(aPresContext); AdjustChildren(aPresContext);
else else
MoveSplitterBy(aPresContext, pos); MoveSplitterBy(aPresContext, pos);
} }
// printf("----- resize ----- "); // printf("----- resize ----- ");
/* /*
for (i=0; i < mChildInfosBeforeCount; i++) for (i=0; i < mChildInfosBeforeCount; i++)
@ -1018,7 +1012,6 @@ nsSplitterFrameInner::UpdateState()
} }
} }
mState = newState; mState = newState;
} }
void void
@ -1070,7 +1063,6 @@ else {
nsBoxLayoutState state(aPresContext); nsBoxLayoutState state(aPresContext);
mOuter->MarkDirty(state); mOuter->MarkDirty(state);
} }
} }
void void

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

@ -157,7 +157,6 @@ nsTextBoxFrame::nsTextBoxFrame(nsIPresShell* aShell):nsLeafBoxFrame(aShell), mCr
nsTextBoxFrame::~nsTextBoxFrame() nsTextBoxFrame::~nsTextBoxFrame()
{ {
if (mAccessKeyInfo)
delete mAccessKeyInfo; delete mAccessKeyInfo;
} }
@ -733,8 +732,11 @@ nsTextBoxFrame::UpdateAccessIndex()
mAccessKeyInfo = nsnull; mAccessKeyInfo = nsnull;
} }
} else { } else {
if (!mAccessKeyInfo) if (!mAccessKeyInfo) {
mAccessKeyInfo = new nsAccessKeyInfo(); mAccessKeyInfo = new nsAccessKeyInfo();
if (!mAccessKeyInfo)
return;
}
nsAString::const_iterator start, end; nsAString::const_iterator start, end;