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 } // if
// Process digit for 1 - 9 // Process digit for 1 - 9
if (n3 > 0) thousandsGroup.Append(gHebrewDigit[n3 - 1]); if (n3 > 0) {
if (outputSep) thousandsGroup.Append((char16_t)HEBREW_GERESH); thousandsGroup.Append(gHebrewDigit[n3 - 1]);
if (allText.IsEmpty()) }
if (outputSep) {
thousandsGroup.Append((char16_t)HEBREW_GERESH);
}
if (allText.IsEmpty()) {
allText = thousandsGroup; allText = thousandsGroup;
else } else {
allText = thousandsGroup + allText; allText = thousandsGroup + allText;
}
aOrdinal /= 1000; aOrdinal /= 1000;
outputSep = true; outputSep = true;
} while (aOrdinal >= 1); } while (aOrdinal >= 1);

View File

@@ -452,7 +452,9 @@ void GlobalStyleSheetCache::InitFromProfile() {
if (appInfo) { if (appInfo) {
bool inSafeMode = false; bool inSafeMode = false;
appInfo->GetInSafeMode(&inSafeMode); appInfo->GetInSafeMode(&inSafeMode);
if (inSafeMode) return; if (inSafeMode) {
return;
}
} }
nsCOMPtr<nsIFile> contentFile; nsCOMPtr<nsIFile> contentFile;
nsCOMPtr<nsIFile> chromeFile; nsCOMPtr<nsIFile> chromeFile;
@@ -464,7 +466,9 @@ void GlobalStyleSheetCache::InitFromProfile() {
} }
contentFile->Clone(getter_AddRefs(chromeFile)); contentFile->Clone(getter_AddRefs(chromeFile));
if (!chromeFile) return; if (!chromeFile) {
return;
}
contentFile->Append(u"userContent.css"_ns); contentFile->Append(u"userContent.css"_ns);
chromeFile->Append(u"userChrome.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, static bool GetCharsetFromData(const char* aStyleSheetData,
uint32_t aDataLength, nsACString& aCharset) { uint32_t aDataLength, nsACString& aCharset) {
aCharset.Truncate(); aCharset.Truncate();
if (aDataLength <= sizeof(kCharsetSym) - 1) return false; if (aDataLength <= sizeof(kCharsetSym) - 1) {
return false;
}
if (strncmp(aStyleSheetData, kCharsetSym, sizeof(kCharsetSym) - 1)) { if (strncmp(aStyleSheetData, kCharsetSym, sizeof(kCharsetSym) - 1)) {
return false; return false;

View File

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

View File

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