Bug 1356843 - Fix -Wcomma warnings in layout/. r=dholbert

clang's -Wcomma warning warns about suspicious use of the comma operator such as between two statements or to call a function for side effects within an expression. In addition to fixing the warnings, replace some char16_t(' ') casts of char literals with shorter UTF-16 character literals u' '.

layout/painting/FrameLayerBuilder.cpp:3647:31 [-Wcomma] possible misuse of comma operator here
layout/painting/FrameLayerBuilder.cpp:3657:41 [-Wcomma] possible misuse of comma operator here
layout/painting/nsCSSRenderingBorders.cpp:3336:33 [-Wcomma] possible misuse of comma operator here
layout/painting/nsCSSRenderingBorders.cpp:3336:60 [-Wcomma] possible misuse of comma operator here
layout/painting/nsCSSRenderingBorders.cpp:3337:33 [-Wcomma] possible misuse of comma operator here
layout/painting/nsCSSRenderingBorders.cpp:3337:60 [-Wcomma] possible misuse of comma operator here
layout/style/Declaration.cpp:808:41 [-Wcomma] possible misuse of comma operator here
layout/style/Declaration.cpp:812:42 [-Wcomma] possible misuse of comma operator here
layout/style/FontFaceSet.cpp:1118:60 [-Wcomma] possible misuse of comma operator here

MozReview-Commit-ID: 9tfcIsnnBwM

--HG--
extra : rebase_source : 89916d1d7b43e4c4793364637a8d015242cb033f
extra : source : c5921d4d63f8f68eafe5a33013e08f9a455429d9
This commit is contained in:
Chris Peterson 2017-04-09 21:11:45 -07:00
parent 884429fb68
commit 9e037cb5e9
4 changed files with 29 additions and 17 deletions

View File

@ -3660,7 +3660,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,
PaintedLayerData data;
data.mAnimatedGeometryRoot = aAnimatedGeometryRoot;
data.mASR = aASR;
data.mClipChain = aClipChain,
data.mClipChain = aClipChain;
data.mAnimatedGeometryRootOffset = aTopLeft;
data.mReferenceFrame = aItem->ReferenceFrame();
data.mBackfaceHidden = aItem->Frame()->In3DContextAndBackfaceIsHidden();
@ -3670,7 +3670,7 @@ ContainerState::NewPaintedLayerData(nsDisplayItem* aItem,
newLayerEntry->mAnimatedGeometryRoot = aAnimatedGeometryRoot;
newLayerEntry->mASR = aASR;
newLayerEntry->mScrollMetadataASR = aScrollMetadataASR;
newLayerEntry->mClipChain = aClipChain,
newLayerEntry->mClipChain = aClipChain;
// newLayerEntry->mOpaqueRegion is filled in later from
// paintedLayerData->mOpaqueRegion, if necessary.

View File

@ -3333,8 +3333,8 @@ nsCSSBorderRenderer::DrawBorders()
if (allBordersSame && mCompositeColors[0] != nullptr && !mNoBorderRadius)
forceSeparateCorners = true;
PrintAsString(" mOuterRect: "), PrintAsString(mOuterRect), PrintAsStringNewline();
PrintAsString(" mInnerRect: "), PrintAsString(mInnerRect), PrintAsStringNewline();
PrintAsString(" mOuterRect: "); PrintAsString(mOuterRect); PrintAsStringNewline();
PrintAsString(" mInnerRect: "); PrintAsString(mInnerRect); PrintAsStringNewline();
PrintAsFormatString(" mBorderColors: 0x%08x 0x%08x 0x%08x 0x%08x\n", mBorderColors[0], mBorderColors[1], mBorderColors[2], mBorderColors[3]);
// if conditioning the outside rect failed, then bail -- the outside

View File

@ -800,17 +800,26 @@ Declaration::GetPropertyValueInternal(
MOZ_ASSERT(StringEndsWith(nsCSSProps::GetStringValue(subprops[2]),
NS_LITERAL_CSTRING("-color")),
"third subprop must be the color property");
const nsCSSValue *colorValue = data->ValueFor(subprops[2]);
bool isCurrentColor =
colorValue->GetUnit() == eCSSUnit_EnumColor &&
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR;
if (!AppendValueToString(subprops[0], aValue, aSerialization) ||
!(aValue.Append(char16_t(' ')),
AppendValueToString(subprops[1], aValue, aSerialization)) ||
bool ok = AppendValueToString(subprops[0], aValue, aSerialization);
if (ok) {
aValue.Append(u' ');
ok = AppendValueToString(subprops[1], aValue, aSerialization);
if (ok) {
const nsCSSValue *colorValue = data->ValueFor(subprops[2]);
bool isCurrentColor =
colorValue->GetUnit() == eCSSUnit_EnumColor &&
colorValue->GetIntValue() == NS_COLOR_CURRENTCOLOR;
// Don't output a third value when it's currentcolor.
!(isCurrentColor ||
(aValue.Append(char16_t(' ')),
AppendValueToString(subprops[2], aValue, aSerialization)))) {
if (!isCurrentColor) {
aValue.Append(u' ');
ok = AppendValueToString(subprops[2], aValue, aSerialization);
}
}
}
if (!ok) {
aValue.Truncate();
}
break;

View File

@ -1116,8 +1116,12 @@ FontFaceSet::FindOrCreateUserFontEntryFromFontFace(const nsAString& aFamilyName,
face->mLocalName.Truncate();
face->mFormatFlags = 0;
while (i + 1 < numSrc && (val = srcArr->Item(i+1),
val.GetUnit() == eCSSUnit_Font_Format)) {
while (i + 1 < numSrc) {
val = srcArr->Item(i + 1);
if (val.GetUnit() != eCSSUnit_Font_Format)
break;
nsDependentString valueString(val.GetStringBufferValue());
if (valueString.LowerCaseEqualsASCII("woff")) {
face->mFormatFlags |= gfxUserFontSet::FLAG_FORMAT_WOFF;
@ -1350,7 +1354,6 @@ FontFaceSet::CheckFontLoad(const gfxFontFaceSrc* aFontFaceSrc,
return NS_OK;
}
// @arg aPrincipal: generally this is mDocument->NodePrincipal() but
// might also be the original principal which enables user stylesheets
// to load font files via @font-face rules.