зеркало из https://github.com/mozilla/gecko-dev.git
Bug 454766 - Add suggested parentheses to layout/; r+sr=roc; (with nits by sgautherie)
This commit is contained in:
Родитель
fb806ac585
Коммит
87878e68eb
|
@ -327,7 +327,7 @@ typedef enum nsCharType nsCharType;
|
|||
#define IS_ARABIC_CHAR(c) ((0x0600 <= (c)) && ((c)<= 0x06FF))
|
||||
#define IS_ARABIC_ALPHABETIC(c) (IS_ARABIC_CHAR(c) && \
|
||||
!(IS_HINDI_DIGIT(c) || IS_FARSI_DIGIT(c) || IS_ARABIC_SEPARATOR(c)))
|
||||
#define IS_BIDI_CONTROL_CHAR(c) ((0x202a <= (c)) && ((c)<= 0x202e) \
|
||||
#define IS_BIDI_CONTROL_CHAR(c) (((0x202a <= (c)) && ((c)<= 0x202e)) \
|
||||
|| ((c) == 0x200e) || ((c) == 0x200f))
|
||||
|
||||
/**
|
||||
|
|
|
@ -306,7 +306,7 @@ nsresult nsBidi::SetPara(const PRUnichar *aText, PRInt32 aLength,
|
|||
|
||||
/* check the argument values */
|
||||
if(aText==NULL ||
|
||||
(NSBIDI_MAX_EXPLICIT_LEVEL<aParaLevel) && !IS_DEFAULT_LEVEL(aParaLevel) ||
|
||||
((NSBIDI_MAX_EXPLICIT_LEVEL<aParaLevel) && !IS_DEFAULT_LEVEL(aParaLevel)) ||
|
||||
aLength<-1
|
||||
) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
@ -788,7 +788,7 @@ nsresult nsBidi::CheckExplicitLevels(nsBidiDirection *aDirection)
|
|||
nsBidiDirection nsBidi::DirectionFromFlags(Flags aFlags)
|
||||
{
|
||||
/* if the text contains AN and neutrals, then some neutrals may become RTL */
|
||||
if(!(aFlags&MASK_RTL || aFlags&DIRPROP_FLAG(AN) && aFlags&MASK_POSSIBLE_N)) {
|
||||
if(!(aFlags&MASK_RTL || (aFlags&DIRPROP_FLAG(AN) && aFlags&MASK_POSSIBLE_N))) {
|
||||
return NSBIDI_LTR;
|
||||
} else if(!(aFlags&MASK_LTR)) {
|
||||
return NSBIDI_RTL;
|
||||
|
@ -935,7 +935,7 @@ void nsBidi::ResolveImplicitLevels(PRInt32 aStart, PRInt32 aLimit,
|
|||
historyOfEN|=EN_AFTER_W4;
|
||||
} else if(prevDirProp==AN && /* previous was AN */
|
||||
(nextDirProp==AN || /* next is AN */
|
||||
nextDirProp==EN && lastStrong==AL) /* or (W2) will make it one */
|
||||
(nextDirProp==EN && lastStrong==AL)) /* or (W2) will make it one */
|
||||
) {
|
||||
/* (W4) */
|
||||
dirProp=AN;
|
||||
|
@ -956,7 +956,7 @@ void nsBidi::ResolveImplicitLevels(PRInt32 aStart, PRInt32 aLimit,
|
|||
}
|
||||
|
||||
if( historyOfEN&PREV_EN_AFTER_W4 || /* previous was EN before (W5) */
|
||||
nextDirProp==EN && lastStrong!=AL /* next is EN and (W2) won't make it AN */
|
||||
(nextDirProp==EN && lastStrong!=AL) /* next is EN and (W2) won't make it AN */
|
||||
) {
|
||||
/* (W5) */
|
||||
if(lastStrong!=L) {
|
||||
|
@ -1477,7 +1477,7 @@ nsresult nsBidi::CountRuns(PRInt32* aRunCount)
|
|||
nsresult nsBidi::GetVisualRun(PRInt32 aRunIndex, PRInt32 *aLogicalStart, PRInt32 *aLength, nsBidiDirection *aDirection)
|
||||
{
|
||||
if( aRunIndex<0 ||
|
||||
mRunCount==-1 && !GetRuns() ||
|
||||
(mRunCount==-1 && !GetRuns()) ||
|
||||
aRunIndex>=mRunCount
|
||||
) {
|
||||
*aDirection = NSBIDI_LTR;
|
||||
|
|
|
@ -790,8 +790,8 @@ nsCaret::GetCaretFrameForNodeOffset(nsIContent* aContentNode,
|
|||
aBidiLevel = PR_MAX(aBidiLevel, PR_MIN(levelBefore, levelAfter)); // rule c3
|
||||
aBidiLevel = PR_MIN(aBidiLevel, PR_MAX(levelBefore, levelAfter)); // rule c4
|
||||
if (aBidiLevel == levelBefore // rule c1
|
||||
|| aBidiLevel > levelBefore && aBidiLevel < levelAfter && !((aBidiLevel ^ levelBefore) & 1) // rule c5
|
||||
|| aBidiLevel < levelBefore && aBidiLevel > levelAfter && !((aBidiLevel ^ levelBefore) & 1)) // rule c9
|
||||
|| (aBidiLevel > levelBefore && aBidiLevel < levelAfter && !((aBidiLevel ^ levelBefore) & 1)) // rule c5
|
||||
|| (aBidiLevel < levelBefore && aBidiLevel > levelAfter && !((aBidiLevel ^ levelBefore) & 1))) // rule c9
|
||||
{
|
||||
if (theFrame != frameBefore)
|
||||
{
|
||||
|
@ -821,8 +821,8 @@ nsCaret::GetCaretFrameForNodeOffset(nsIContent* aContentNode,
|
|||
}
|
||||
}
|
||||
else if (aBidiLevel == levelAfter // rule c2
|
||||
|| aBidiLevel > levelBefore && aBidiLevel < levelAfter && !((aBidiLevel ^ levelAfter) & 1) // rule c6
|
||||
|| aBidiLevel < levelBefore && aBidiLevel > levelAfter && !((aBidiLevel ^ levelAfter) & 1)) // rule c10
|
||||
|| (aBidiLevel > levelBefore && aBidiLevel < levelAfter && !((aBidiLevel ^ levelAfter) & 1)) // rule c6
|
||||
|| (aBidiLevel < levelBefore && aBidiLevel > levelAfter && !((aBidiLevel ^ levelAfter) & 1))) // rule c10
|
||||
{
|
||||
if (theFrame != frameAfter)
|
||||
{
|
||||
|
|
|
@ -495,8 +495,8 @@ nsTextInputListener::EditAction()
|
|||
PRInt32 numRedoItems = 0;
|
||||
manager->GetNumberOfUndoItems(&numUndoItems);
|
||||
manager->GetNumberOfRedoItems(&numRedoItems);
|
||||
if (numUndoItems && !mHadUndoItems || !numUndoItems && mHadUndoItems ||
|
||||
numRedoItems && !mHadRedoItems || !numRedoItems && mHadRedoItems) {
|
||||
if ((numUndoItems && !mHadUndoItems) || (!numUndoItems && mHadUndoItems) ||
|
||||
(numRedoItems && !mHadRedoItems) || (!numRedoItems && mHadRedoItems)) {
|
||||
// Modify the menu if undo or redo items are different
|
||||
UpdateTextInputCommands(NS_LITERAL_STRING("undo"));
|
||||
|
||||
|
|
|
@ -4465,8 +4465,8 @@ nsFrame::GetPointFromOffset(PRInt32 inOffset, nsPoint* outPoint)
|
|||
PRInt32 newOffset = newContent->IndexOf(mContent);
|
||||
|
||||
PRBool isRTL = (NS_GET_EMBEDDING_LEVEL(this) & 1) == 1;
|
||||
if (!isRTL && inOffset > newOffset ||
|
||||
isRTL && inOffset <= newOffset)
|
||||
if ((!isRTL && inOffset > newOffset) ||
|
||||
(isRTL && inOffset <= newOffset))
|
||||
bottomLeft.x = GetRect().width;
|
||||
}
|
||||
}
|
||||
|
@ -4799,7 +4799,7 @@ FindBlockFrameOrBR(nsIFrame* aFrame, nsDirection aDirection)
|
|||
// Fall through "special" block frames because their mContent is the content
|
||||
// of the inline frames they were created from. The first/last child of
|
||||
// such frames is the real block frame we're looking for.
|
||||
if (nsLayoutUtils::GetAsBlock(aFrame) && !(aFrame->GetStateBits() & NS_FRAME_IS_SPECIAL) ||
|
||||
if ((nsLayoutUtils::GetAsBlock(aFrame) && !(aFrame->GetStateBits() & NS_FRAME_IS_SPECIAL)) ||
|
||||
aFrame->GetType() == nsGkAtoms::brFrame) {
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
result.mContent = content->GetParent();
|
||||
|
@ -5022,7 +5022,7 @@ nsIFrame::PeekOffset(nsPeekOffsetStruct* aPos)
|
|||
// We can't jump lines if we're looking for whitespace following
|
||||
// non-whitespace, and we already encountered non-whitespace.
|
||||
if (NS_FAILED(result) ||
|
||||
jumpedLine && !wordSelectEatSpace && state.mSawBeforeType) {
|
||||
(jumpedLine && !wordSelectEatSpace && state.mSawBeforeType)) {
|
||||
done = PR_TRUE;
|
||||
} else {
|
||||
if (jumpedLine) {
|
||||
|
@ -5388,7 +5388,7 @@ nsIFrame::GetFrameFromDirection(nsDirection aDirection, PRBool aVisual,
|
|||
nsIFrame** framePtr = aDirection == eDirPrevious ? &firstFrame : &lastFrame;
|
||||
if (*framePtr) {
|
||||
nsBidiLevel embeddingLevel = nsBidiPresUtils::GetFrameEmbeddingLevel(*framePtr);
|
||||
if (((embeddingLevel & 1) && lineIsRTL || !(embeddingLevel & 1) && !lineIsRTL) ==
|
||||
if ((((embeddingLevel & 1) && lineIsRTL) || (!(embeddingLevel & 1) && !lineIsRTL)) ==
|
||||
(aDirection == eDirPrevious)) {
|
||||
nsFrame::GetFirstLeaf(presContext, framePtr);
|
||||
} else {
|
||||
|
|
|
@ -353,10 +353,10 @@ typedef PRUint32 nsReflowStatus;
|
|||
// These macros set or switch incompete statuses without touching th
|
||||
// NS_FRAME_REFLOW_NEXTINFLOW bit.
|
||||
#define NS_FRAME_SET_INCOMPLETE(status) \
|
||||
status = status & ~NS_FRAME_OVERFLOW_INCOMPLETE | NS_FRAME_NOT_COMPLETE
|
||||
status = (status & ~NS_FRAME_OVERFLOW_INCOMPLETE) | NS_FRAME_NOT_COMPLETE
|
||||
|
||||
#define NS_FRAME_SET_OVERFLOW_INCOMPLETE(status) \
|
||||
status = status & ~NS_FRAME_NOT_COMPLETE | NS_FRAME_OVERFLOW_INCOMPLETE
|
||||
status = (status & ~NS_FRAME_NOT_COMPLETE) | NS_FRAME_OVERFLOW_INCOMPLETE
|
||||
|
||||
// This macro tests to see if an nsReflowStatus is an error value
|
||||
// or just a regular return value
|
||||
|
|
|
@ -1435,9 +1435,9 @@ nsImageFrame::HandleEvent(nsPresContext* aPresContext,
|
|||
NS_ENSURE_ARG_POINTER(aEventStatus);
|
||||
nsImageMap* map;
|
||||
|
||||
if (aEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
(aEvent->message == NS_MOUSE_BUTTON_UP &&
|
||||
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) ||
|
||||
if ((aEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
aEvent->message == NS_MOUSE_BUTTON_UP &&
|
||||
static_cast<nsMouseEvent*>(aEvent)->button == nsMouseEvent::eLeftButton) ||
|
||||
aEvent->message == NS_MOUSE_MOVE) {
|
||||
map = GetImageMap(aPresContext);
|
||||
PRBool isServerMap = IsServerImageMap();
|
||||
|
|
|
@ -1006,9 +1006,9 @@ nsObjectFrame::IsHidden(PRBool aCheckVisibilityStyle) const
|
|||
nsAutoString hidden;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::hidden, hidden) &&
|
||||
(hidden.IsEmpty() ||
|
||||
!hidden.LowerCaseEqualsLiteral("false") &&
|
||||
!hidden.LowerCaseEqualsLiteral("no") &&
|
||||
!hidden.LowerCaseEqualsLiteral("off"))) {
|
||||
(!hidden.LowerCaseEqualsLiteral("false") &&
|
||||
!hidden.LowerCaseEqualsLiteral("no") &&
|
||||
!hidden.LowerCaseEqualsLiteral("off")))) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ public:
|
|||
|
||||
PRBool eq;
|
||||
return !mPrincipal ||
|
||||
NS_SUCCEEDED(mPrincipal->Equals(aKey->mPrincipal, &eq)) && eq;
|
||||
(NS_SUCCEEDED(mPrincipal->Equals(aKey->mPrincipal, &eq)) && eq);
|
||||
}
|
||||
|
||||
static const nsURIAndPrincipalHashKey*
|
||||
|
|
|
@ -194,11 +194,11 @@ nsSVGInnerSVGFrame::NotifySVGChanged(PRUint32 aFlags)
|
|||
// a 'viewBox'.
|
||||
|
||||
if (!(aFlags & TRANSFORM_CHANGED) &&
|
||||
svg->mLengthAttributes[nsSVGSVGElement::X].IsPercentage() ||
|
||||
svg->mLengthAttributes[nsSVGSVGElement::Y].IsPercentage() ||
|
||||
(mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox) &&
|
||||
(svg->mLengthAttributes[nsSVGSVGElement::WIDTH].IsPercentage() ||
|
||||
svg->mLengthAttributes[nsSVGSVGElement::HEIGHT].IsPercentage()))) {
|
||||
(svg->mLengthAttributes[nsSVGSVGElement::X].IsPercentage() ||
|
||||
svg->mLengthAttributes[nsSVGSVGElement::Y].IsPercentage() ||
|
||||
(mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::viewBox) &&
|
||||
(svg->mLengthAttributes[nsSVGSVGElement::WIDTH].IsPercentage() ||
|
||||
svg->mLengthAttributes[nsSVGSVGElement::HEIGHT].IsPercentage())))) {
|
||||
|
||||
aFlags |= TRANSFORM_CHANGED;
|
||||
}
|
||||
|
|
|
@ -805,10 +805,10 @@ nsSVGUtils::GetViewBoxTransform(float aViewportWidth, float aViewportHeight,
|
|||
|
||||
if (align != nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_NONE &&
|
||||
a != d) {
|
||||
if (meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_MEET &&
|
||||
a < d ||
|
||||
meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE &&
|
||||
d < a) {
|
||||
if ((meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_MEET &&
|
||||
a < d) ||
|
||||
(meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE &&
|
||||
d < a)) {
|
||||
d = a;
|
||||
switch (align) {
|
||||
case nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN:
|
||||
|
@ -830,10 +830,10 @@ nsSVGUtils::GetViewBoxTransform(float aViewportWidth, float aViewportHeight,
|
|||
}
|
||||
}
|
||||
else if (
|
||||
meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_MEET &&
|
||||
d < a ||
|
||||
meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE &&
|
||||
a < d) {
|
||||
(meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_MEET &&
|
||||
d < a) ||
|
||||
(meetOrSlice == nsIDOMSVGPreserveAspectRatio::SVG_MEETORSLICE_SLICE &&
|
||||
a < d)) {
|
||||
a = d;
|
||||
switch (align) {
|
||||
case nsIDOMSVGPreserveAspectRatio::SVG_PRESERVEASPECTRATIO_XMINYMIN:
|
||||
|
|
|
@ -714,7 +714,7 @@ nsMenuFrame::IsSizedToPopup(nsIContent* aContent, PRBool aRequireAlways)
|
|||
nsAutoString sizedToPopup;
|
||||
aContent->GetAttr(kNameSpaceID_None, nsGkAtoms::sizetopopup, sizedToPopup);
|
||||
sizeToPopup = sizedToPopup.EqualsLiteral("always") ||
|
||||
!aRequireAlways && sizedToPopup.EqualsLiteral("pref");
|
||||
(!aRequireAlways && sizedToPopup.EqualsLiteral("pref"));
|
||||
}
|
||||
|
||||
return sizeToPopup;
|
||||
|
|
Загрузка…
Ссылка в новой задаче