Bug 711799 - Add parentheses to a bunch of && expressions nested within || expressions. r=dholbert

This commit is contained in:
Jeff Walden 2011-12-18 01:00:47 -05:00
parent 85bf4a9e46
commit 2e53b58879
13 changed files with 55 additions and 52 deletions

View File

@ -1565,14 +1565,14 @@ nsDocAccessible::AddDependentIDsFor(nsAccessible* aRelProvider,
if (relAttr == nsGkAtoms::_for) {
if (!aRelProvider->GetContent()->IsHTML() ||
aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
aRelProvider->GetContent()->Tag() != nsGkAtoms::output)
(aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
aRelProvider->GetContent()->Tag() != nsGkAtoms::output))
continue;
} else if (relAttr == nsGkAtoms::control) {
if (!aRelProvider->GetContent()->IsXUL() ||
aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
aRelProvider->GetContent()->Tag() != nsGkAtoms::description)
(aRelProvider->GetContent()->Tag() != nsGkAtoms::label &&
aRelProvider->GetContent()->Tag() != nsGkAtoms::description))
continue;
}

View File

@ -2691,8 +2691,8 @@ nsXMLHttpRequest::Send(nsIVariant *aBody)
// can run script that would try to restart this request, and that could end
// up doing our AsyncOpen on a null channel if the reentered AsyncOpen fails.
ChangeState(XML_HTTP_REQUEST_SENT);
if (!mUploadComplete &&
HasListenersFor(NS_LITERAL_STRING(UPLOADPROGRESS_STR)) ||
if ((!mUploadComplete &&
HasListenersFor(NS_LITERAL_STRING(UPLOADPROGRESS_STR))) ||
(mUpload && mUpload->HasListenersFor(NS_LITERAL_STRING(PROGRESS_STR)))) {
StartProgressEventTimer();
}

View File

@ -378,8 +378,8 @@ nsHTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
nsKeyEvent * keyEvent = (nsKeyEvent *)aVisitor.mEvent;
if ((keyEvent->keyCode == NS_VK_RETURN &&
NS_KEY_PRESS == aVisitor.mEvent->message) ||
keyEvent->keyCode == NS_VK_SPACE &&
NS_KEY_UP == aVisitor.mEvent->message) {
(keyEvent->keyCode == NS_VK_SPACE &&
NS_KEY_UP == aVisitor.mEvent->message)) {
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event(NS_IS_TRUSTED_EVENT(aVisitor.mEvent),

View File

@ -471,7 +471,7 @@ nsHTMLMenuItemElement::WalkRadioGroup(Visitor* aVisitor)
bool info2Empty = !info2.mValue || info2.mValue->IsEmptyString();
if (info1Empty != info2Empty ||
info1.mValue && info2.mValue && !info1.mValue->Equals(*info2.mValue)) {
(info1.mValue && info2.mValue && !info1.mValue->Equals(*info2.mValue))) {
continue;
}

View File

@ -1142,7 +1142,7 @@ nsHTMLTextAreaElement::IntrinsicState() const
// error and never applies if novalidate is set on the form owner.
if ((!mForm || !mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate)) &&
(GetValidityState(VALIDITY_STATE_CUSTOM_ERROR) ||
mCanShowInvalidUI && ShouldShowValidityUI())) {
(mCanShowInvalidUI && ShouldShowValidityUI()))) {
state |= NS_EVENT_STATE_MOZ_UI_INVALID;
}
}

View File

@ -641,9 +641,9 @@ nsXBLPrototypeBinding::AttributeChanged(nsIAtom* aAttribute,
// xbl:text set on us.
if ((dstAttr == nsGkAtoms::text && dstNs == kNameSpaceID_XBL) ||
realElement->NodeInfo()->Equals(nsGkAtoms::html,
kNameSpaceID_XUL) &&
dstAttr == nsGkAtoms::value) {
(realElement->NodeInfo()->Equals(nsGkAtoms::html,
kNameSpaceID_XUL) &&
dstAttr == nsGkAtoms::value)) {
// Flush out all our kids.
PRUint32 childCount = realElement->GetChildCount();
for (PRUint32 i = 0; i < childCount; i++)

View File

@ -195,8 +195,8 @@ float JapaneseContextAnalysis::GetConfidence(void)
PRInt32 SJISContextAnalysis::GetOrder(const char* str, PRUint32 *charLen)
{
//find out current char's byte length
if ((unsigned char)*str >= (unsigned char)0x81 && (unsigned char)*str <= (unsigned char)0x9f ||
(unsigned char)*str >= (unsigned char)0xe0 && (unsigned char)*str <= (unsigned char)0xfc )
if (((unsigned char)*str >= (unsigned char)0x81 && (unsigned char)*str <= (unsigned char)0x9f) ||
((unsigned char)*str >= (unsigned char)0xe0 && (unsigned char)*str <= (unsigned char)0xfc) )
*charLen = 2;
else
*charLen = 1;

View File

@ -1377,10 +1377,11 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList,
// Assign the item to a layer
if (layerState == LAYER_ACTIVE_FORCE ||
layerState == LAYER_ACTIVE_EMPTY ||
layerState == LAYER_ACTIVE && (aClip.mRoundedClipRects.IsEmpty() ||
// We can use the visible rect here only because the item has its own
// layer, like the comment below.
!aClip.IsRectClippedByRoundedCorner(item->GetVisibleRect()))) {
(layerState == LAYER_ACTIVE &&
(aClip.mRoundedClipRects.IsEmpty() ||
// We can use the visible rect here only because the item has its own
// layer, like the comment below.
!aClip.IsRectClippedByRoundedCorner(item->GetVisibleRect())))) {
// LAYER_ACTIVE_EMPTY means the layer is created just for its metadata.
// We should never see an empty layer with any visible content!

View File

@ -1626,7 +1626,7 @@ nsFrameSelection::AdjustForMaintainedSelection(nsIContent *aContent,
// If aContent/aOffset is inside the maintained selection, or if it is on the
// "anchor" side of the maintained selection, we need to do something.
if (relToStart < 0 && relToEnd > 0 ||
if ((relToStart < 0 && relToEnd > 0) ||
(relToStart > 0 &&
mDomSelections[index]->GetDirection() == eDirNext) ||
(relToEnd < 0 &&

View File

@ -613,12 +613,12 @@ mozTXTToHTMLConv::ItMatchesDelimited(const PRUnichar * aInString,
if
(
(before == LT_IGNORE && (after == LT_IGNORE || after == LT_DELIMITER))
&& textLen < aRepLen ||
(before != LT_IGNORE || after != LT_IGNORE && after != LT_DELIMITER)
&& textLen < aRepLen + 1 ||
before != LT_IGNORE && after != LT_IGNORE && after != LT_DELIMITER
&& textLen < aRepLen + 2
((before == LT_IGNORE && (after == LT_IGNORE || after == LT_DELIMITER))
&& textLen < aRepLen) ||
((before != LT_IGNORE || (after != LT_IGNORE && after != LT_DELIMITER))
&& textLen < aRepLen + 1) ||
(before != LT_IGNORE && after != LT_IGNORE && after != LT_DELIMITER
&& textLen < aRepLen + 2)
)
return false;
@ -627,28 +627,28 @@ mozTXTToHTMLConv::ItMatchesDelimited(const PRUnichar * aInString,
if
(
before == LT_ALPHA
&& !nsCRT::IsAsciiAlpha(text0) ||
before == LT_DIGIT
&& !nsCRT::IsAsciiDigit(text0) ||
before == LT_DELIMITER
(before == LT_ALPHA
&& !nsCRT::IsAsciiAlpha(text0)) ||
(before == LT_DIGIT
&& !nsCRT::IsAsciiDigit(text0)) ||
(before == LT_DELIMITER
&&
(
nsCRT::IsAsciiAlpha(text0) ||
nsCRT::IsAsciiDigit(text0) ||
text0 == *rep
) ||
after == LT_ALPHA
&& !nsCRT::IsAsciiAlpha(textAfterPos) ||
after == LT_DIGIT
&& !nsCRT::IsAsciiDigit(textAfterPos) ||
after == LT_DELIMITER
)) ||
(after == LT_ALPHA
&& !nsCRT::IsAsciiAlpha(textAfterPos)) ||
(after == LT_DIGIT
&& !nsCRT::IsAsciiDigit(textAfterPos)) ||
(after == LT_DELIMITER
&&
(
nsCRT::IsAsciiAlpha(textAfterPos) ||
nsCRT::IsAsciiDigit(textAfterPos) ||
textAfterPos == *rep
) ||
)) ||
!Substring(Substring(aInString, aInString+aInLength),
(before == LT_IGNORE ? 0 : 1),
aRepLen).Equals(Substring(rep, rep+aRepLen),
@ -754,7 +754,7 @@ mozTXTToHTMLConv::SmilyHit(const PRUnichar * aInString, PRInt32 aLength, bool co
(
aLength <= PRInt32(delim) ||
IsSpace(aInString[delim]) ||
aLength > PRInt32(delim + 1)
(aLength > PRInt32(delim + 1)
&&
(
aInString[delim] == '.' ||
@ -765,7 +765,7 @@ mozTXTToHTMLConv::SmilyHit(const PRUnichar * aInString, PRInt32 aLength, bool co
aInString[delim] == '!' ||
aInString[delim] == '?'
)
&& IsSpace(aInString[delim + 1])
&& IsSpace(aInString[delim + 1]))
)
&& ItMatchesDelimited(aInString, aLength, NS_ConvertASCIItoUTF16(tagTXT).get(), tagLen,
col0 ? LT_IGNORE : LT_DELIMITER, LT_IGNORE)
@ -980,8 +980,8 @@ mozTXTToHTMLConv::GlyphHit(const PRUnichar * aInString, PRInt32 aInLength, bool
)
&&
(
2 < aInLength && nsCRT::IsAsciiDigit(aInString[2]) ||
3 < aInLength && aInString[2] == '-' && nsCRT::IsAsciiDigit(aInString[3])
(2 < aInLength && nsCRT::IsAsciiDigit(aInString[2])) ||
(3 < aInLength && aInString[2] == '-' && nsCRT::IsAsciiDigit(aInString[3]))
)
)
{
@ -991,8 +991,8 @@ mozTXTToHTMLConv::GlyphHit(const PRUnichar * aInString, PRInt32 aInLength, bool
&&
(
nsCRT::IsAsciiDigit(aInString[delimPos]) ||
aInString[delimPos] == '.' && delimPos + 1 < aInLength &&
nsCRT::IsAsciiDigit(aInString[delimPos + 1])
(aInString[delimPos] == '.' && delimPos + 1 < aInLength &&
nsCRT::IsAsciiDigit(aInString[delimPos + 1]))
);
delimPos++)
;

View File

@ -338,9 +338,9 @@ public:
bool operator< (const nsUrlClassifierEntry& entry) const {
return (mTableId < entry.mTableId ||
mChunkId < entry.mChunkId ||
mHavePartial && !entry.mHavePartial ||
(mHavePartial && !entry.mHavePartial) ||
(mHavePartial && mPartialHash < entry.mPartialHash) ||
mHaveComplete && !entry.mHaveComplete ||
(mHaveComplete && !entry.mHaveComplete) ||
(mHaveComplete && mCompleteHash < entry.mCompleteHash));
}

View File

@ -288,9 +288,11 @@ nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
return true;
nsKeyEvent *nativeKeyEvent = static_cast<nsKeyEvent*>(aEvent.nativeEvent);
if (!nativeKeyEvent || nativeKeyEvent->eventStructType != NS_KEY_EVENT &&
nativeKeyEvent->message != NS_KEY_PRESS)
if (!nativeKeyEvent ||
(nativeKeyEvent->eventStructType != NS_KEY_EVENT &&
nativeKeyEvent->message != NS_KEY_PRESS)) {
return false;
}
for (PRUint32 i = 0; i < nativeKeyEvent->alternativeCharCodes.Length(); ++i) {
PRUint32 ch = nativeKeyEvent->isShift ?

View File

@ -436,7 +436,7 @@ nsWindowMediator::CalculateZPosition(
// locate inBelow. use topmost if it can't be found or isn't in the
// z-order list
info = GetInfoFor(inBelow);
if (!info || info->mYounger != info && info->mLower == info)
if (!info || (info->mYounger != info && info->mLower == info))
info = mTopmostWindow;
else
found = true;
@ -533,9 +533,9 @@ nsWindowMediator::SetZPosition(
nsWindowInfo *inInfo,
*belowInfo;
if (inPosition != nsIWindowMediator::zLevelTop &&
inPosition != nsIWindowMediator::zLevelBottom &&
inPosition != nsIWindowMediator::zLevelBelow ||
if ((inPosition != nsIWindowMediator::zLevelTop &&
inPosition != nsIWindowMediator::zLevelBottom &&
inPosition != nsIWindowMediator::zLevelBelow) ||
!inWindow) {
return NS_ERROR_INVALID_ARG;
}