bug 522779: use nsTArray::Contains() instead of checking nsTArray::IndexOf() against various sentinel values, in three places in layout. r=dbaron

This commit is contained in:
Daniel Holbert
2009-10-16 15:49:30 -07:00
parent 9d9136ce19
commit 0ec39376f1
3 changed files with 3 additions and 4 deletions

View File

@@ -6973,7 +6973,7 @@ DoDeletingFrameSubtree(nsFrameManager* aFrameManager,
// the out-of-flow frame will be destroyed by aRemovedFrame.
if (outOfFlowFrame->GetStyleDisplay()->mDisplay == NS_STYLE_DISPLAY_POPUP ||
!nsLayoutUtils::IsProperAncestorFrame(aRemovedFrame, outOfFlowFrame)) {
NS_ASSERTION(aDestroyQueue.IndexOf(outOfFlowFrame) == kNotFound,
NS_ASSERTION(!aDestroyQueue.Contains(outOfFlowFrame),
"out-of-flow is already in the destroy queue");
aDestroyQueue.AppendElement(outOfFlowFrame);
// Recurse into the out-of-flow, it is now the aRemovedFrame.

View File

@@ -314,8 +314,7 @@ private:
NS_DECL_IMGIDECODEROBSERVER
void AddIconObserver(nsImageFrame *frame) {
NS_ABORT_IF_FALSE(mIconObservers.IndexOf(frame) ==
nsTArray<nsImageFrame*>::NoIndex,
NS_ABORT_IF_FALSE(!mIconObservers.Contains(frame),
"Observer shouldn't aleady be in array");
mIconObservers.AppendElement(frame);
}

View File

@@ -1527,7 +1527,7 @@ nsMathMLChar::StretchEnumContext::EnumCallback(const nsString& aFamily,
nsGlyphTable* glyphTable = aGeneric ?
&gGlyphTableList->mUnicodeTable : gGlyphTableList->GetGlyphTableFor(aFamily);
if (context->mTablesTried.IndexOf(glyphTable) != context->mTablesTried.NoIndex)
if (context->mTablesTried.Contains(glyphTable))
return PR_TRUE; // already tried this one
context->mGlyphTable = glyphTable;