Bug 1931736. Add missing braces around if/loop statements in layout/style/. r=layout-reviewers,emilio

Depends on D229252

Differential Revision: https://phabricator.services.mozilla.com/D229253
This commit is contained in:
Jonathan Watt
2024-11-17 05:04:00 +00:00
parent d2626775eb
commit b21dc1a9c9
5 changed files with 32 additions and 12 deletions

View File

@@ -420,12 +420,17 @@ static bool HebrewToText(CounterValue aOrdinal, nsAString& aResult) {
} // if
// Process digit for 1 - 9
if (n3 > 0) thousandsGroup.Append(gHebrewDigit[n3 - 1]);
if (outputSep) thousandsGroup.Append((char16_t)HEBREW_GERESH);
if (allText.IsEmpty())
if (n3 > 0) {
thousandsGroup.Append(gHebrewDigit[n3 - 1]);
}
if (outputSep) {
thousandsGroup.Append((char16_t)HEBREW_GERESH);
}
if (allText.IsEmpty()) {
allText = thousandsGroup;
else
} else {
allText = thousandsGroup + allText;
}
aOrdinal /= 1000;
outputSep = true;
} while (aOrdinal >= 1);

View File

@@ -452,7 +452,9 @@ void GlobalStyleSheetCache::InitFromProfile() {
if (appInfo) {
bool inSafeMode = false;
appInfo->GetInSafeMode(&inSafeMode);
if (inSafeMode) return;
if (inSafeMode) {
return;
}
}
nsCOMPtr<nsIFile> contentFile;
nsCOMPtr<nsIFile> chromeFile;
@@ -464,7 +466,9 @@ void GlobalStyleSheetCache::InitFromProfile() {
}
contentFile->Clone(getter_AddRefs(chromeFile));
if (!chromeFile) return;
if (!chromeFile) {
return;
}
contentFile->Append(u"userContent.css"_ns);
chromeFile->Append(u"userChrome.css"_ns);

View File

@@ -575,7 +575,9 @@ static const char kCharsetSym[] = "@charset \"";
static bool GetCharsetFromData(const char* aStyleSheetData,
uint32_t aDataLength, nsACString& aCharset) {
aCharset.Truncate();
if (aDataLength <= sizeof(kCharsetSym) - 1) return false;
if (aDataLength <= sizeof(kCharsetSym) - 1) {
return false;
}
if (strncmp(aStyleSheetData, kCharsetSym, sizeof(kCharsetSym) - 1)) {
return false;

View File

@@ -97,7 +97,9 @@ DeclarationBlock* nsDOMCSSAttributeDeclaration::GetOrCreateCSSDeclaration(
Operation aOperation, DeclarationBlock** aCreated) {
MOZ_ASSERT(aOperation != Operation::Modify || aCreated);
if (!mElement) return nullptr;
if (!mElement) {
return nullptr;
}
DeclarationBlock* declaration;
if (mIsSMILOverride) {

View File

@@ -115,18 +115,23 @@ bool nsStyleUtil::ValueIncludes(const nsAString& aValueList,
while (p < p_end) {
// skip leading space
while (p != p_end && nsContentUtils::IsHTMLWhitespace(*p)) ++p;
while (p != p_end && nsContentUtils::IsHTMLWhitespace(*p)) {
++p;
}
const char16_t* val_start = p;
// look for space or end
while (p != p_end && !nsContentUtils::IsHTMLWhitespace(*p)) ++p;
while (p != p_end && !nsContentUtils::IsHTMLWhitespace(*p)) {
++p;
}
const char16_t* val_end = p;
if (val_start < val_end &&
aValue.Equals(Substring(val_start, val_end), aComparator))
aValue.Equals(Substring(val_start, val_end), aComparator)) {
return true;
}
++p; // we know the next character is not whitespace
}
@@ -180,7 +185,9 @@ void nsStyleUtil::AppendEscapedCSSIdent(const nsAString& aIdent,
const char16_t* in = aIdent.BeginReading();
const char16_t* const end = aIdent.EndReading();
if (in == end) return;
if (in == end) {
return;
}
// A leading dash does not need to be escaped as long as it is not the
// *only* character in the identifier.