From 120496a230fc142d4bd04f330c9b9eafec153e16 Mon Sep 17 00:00:00 2001 From: Andi-Bogdan Postelnicu Date: Tue, 11 Jan 2022 15:49:03 +0000 Subject: [PATCH] Bug 1519636 - Reformat recent changes to the Google coding style. r=sylvestre Updated with clang-format version 13.0.0 (taskcluster-dn0nWlPhT22vaQNfMnFkSg) Differential Revision: https://phabricator.services.mozilla.com/D135325 --- accessible/ipc/RemoteAccessibleBase.cpp | 4 +-- dom/canvas/SanitizeRenderer.cpp | 6 ++--- dom/canvas/WebGLTypes.h | 4 +-- dom/canvas/gtest/TestSanitizeRenderer.cpp | 28 +++++++++++++------- dom/ipc/ClonedErrorHolder.cpp | 2 +- dom/media/webrtc/MediaEngineWebRTCAudio.h | 5 ++-- gfx/layers/ImageContainer.cpp | 32 ++++++++++++++--------- gfx/thebes/gfxFcPlatformFontList.cpp | 4 +-- gfx/thebes/gfxFont.h | 2 +- gfx/thebes/gfxMacFont.cpp | 4 +-- js/src/jit/JitFrames.h | 3 ++- layout/style/CSSLayerBlockRule.h | 3 +-- layout/style/CSSLayerStatementRule.cpp | 21 +++++++++------ layout/xul/nsXULPopupManager.cpp | 3 +-- widget/cocoa/MOZMenuOpeningCoordinator.mm | 10 +++++-- widget/cocoa/NativeMenuMac.h | 3 +-- widget/gtk/nsDeviceContextSpecG.cpp | 6 ++--- 17 files changed, 79 insertions(+), 61 deletions(-) diff --git a/accessible/ipc/RemoteAccessibleBase.cpp b/accessible/ipc/RemoteAccessibleBase.cpp index cb8085b156d2..e7e26ba33c7b 100644 --- a/accessible/ipc/RemoteAccessibleBase.cpp +++ b/accessible/ipc/RemoteAccessibleBase.cpp @@ -487,13 +487,13 @@ already_AddRefed RemoteAccessibleBase::Attributes() { GroupPos groupPos = GroupPosition(); nsAccUtils::SetAccGroupAttrs(attributes, groupPos.level, groupPos.setSize, - groupPos.posInSet); + groupPos.posInSet); bool hierarchical = false; uint32_t itemCount = AccGroupInfo::TotalItemCount(this, &hierarchical); if (itemCount) { attributes->SetAttribute(nsGkAtoms::child_item_count, - static_cast(itemCount)); + static_cast(itemCount)); } if (hierarchical) { diff --git a/dom/canvas/SanitizeRenderer.cpp b/dom/canvas/SanitizeRenderer.cpp index c09d047527b6..3e7a7cfce2a4 100644 --- a/dom/canvas/SanitizeRenderer.cpp +++ b/dom/canvas/SanitizeRenderer.cpp @@ -93,8 +93,7 @@ static std::string ChooseDeviceReplacement(const std::string& str) { static const std::string GEFORCE_480 = "GeForce GTX 480"; static const std::string GEFORCE_980 = "GeForce GTX 980"; - if (Contains(str, "NVIDIA") || - Contains(str, "GeForce") || + if (Contains(str, "NVIDIA") || Contains(str, "GeForce") || Contains(str, "Quadro")) { auto ret = std::invoke([&]() { static const std::regex kGeForce("GeForce.*?([0-9][0-9][0-9]+)"); @@ -276,7 +275,8 @@ static std::string ChooseDeviceReplacement(const std::string& str) { std::string SanitizeRenderer(const std::string& str) { std::smatch m; - // e.g. "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3D11 vs_5_0 ps_5_0, D3D11-27.20.1020.2002)" + // e.g. "ANGLE (AMD, AMD Radeon(TM) Graphics Direct3D11 vs_5_0 ps_5_0, + // D3D11-27.20.1020.2002)" static const std::regex kReAngle( "ANGLE [(]([^,]*), ([^,]*)( Direct3D[^,]*), .*[)]"); if (std::regex_match(str, m, kReAngle)) { diff --git a/dom/canvas/WebGLTypes.h b/dom/canvas/WebGLTypes.h index d68947c88ad9..5273e54a90f6 100644 --- a/dom/canvas/WebGLTypes.h +++ b/dom/canvas/WebGLTypes.h @@ -266,9 +266,7 @@ class UniqueBuffer final { UniqueBuffer() = default; - ~UniqueBuffer() { - reset(); - } + ~UniqueBuffer() { reset(); } UniqueBuffer(UniqueBuffer&& rhs) { *this = std::move(rhs); } diff --git a/dom/canvas/gtest/TestSanitizeRenderer.cpp b/dom/canvas/gtest/TestSanitizeRenderer.cpp index 1a5e53c2e4be..85e04b638091 100644 --- a/dom/canvas/gtest/TestSanitizeRenderer.cpp +++ b/dom/canvas/gtest/TestSanitizeRenderer.cpp @@ -202,41 +202,49 @@ TEST(SanitizeRenderer, TestAdreno512) } // - -// Keep gtests for our known CI RENDERER strings (see test_renderer_strings.html) -// otherwise the first time we know we messed up is in CI results after an hour, -// instead of after running gtests locally. +// Keep gtests for our known CI RENDERER strings (see +// test_renderer_strings.html) otherwise the first time we know we messed up is +// in CI results after an hour, instead of after running gtests locally. -TEST(SanitizeRenderer, TestCiAndroid) { +TEST(SanitizeRenderer, TestCiAndroid) +{ const std::string renderer("Adreno (TM) 540"); const std::string expectation("Adreno (TM) 540"); const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer); EXPECT_EQ(sanitized, expectation); } -TEST(SanitizeRenderer, TestCiLinux) { +TEST(SanitizeRenderer, TestCiLinux) +{ const std::string renderer("llvmpipe (LLVM 10.0.0, 256 bits)"); const std::string expectation("llvmpipe"); const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer); EXPECT_EQ(sanitized, expectation); } -TEST(SanitizeRenderer, TestCiMac) { +TEST(SanitizeRenderer, TestCiMac) +{ const std::string renderer("Intel(R) UHD Graphics 630"); const std::string expectation("Intel(R) HD Graphics 400"); const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer); EXPECT_EQ(sanitized, expectation); } -TEST(SanitizeRenderer, TestCiMac2) { +TEST(SanitizeRenderer, TestCiMac2) +{ const std::string renderer("Apple M1"); const std::string expectation("Apple M1"); const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer); EXPECT_EQ(sanitized, expectation); } -TEST(SanitizeRenderer, TestCiWindows) { - const std::string renderer("ANGLE (NVIDIA, NVIDIA Tesla M60 Direct3D11 vs_5_0 ps_5_0, D3D11-23.21.13.9181)"); - const std::string expectation("ANGLE (NVIDIA, NVIDIA GeForce 8800 GTX Direct3D11 vs_5_0 ps_5_0)"); +TEST(SanitizeRenderer, TestCiWindows) +{ + const std::string renderer( + "ANGLE (NVIDIA, NVIDIA Tesla M60 Direct3D11 vs_5_0 ps_5_0, " + "D3D11-23.21.13.9181)"); + const std::string expectation( + "ANGLE (NVIDIA, NVIDIA GeForce 8800 GTX Direct3D11 vs_5_0 ps_5_0)"); const auto sanitized = mozilla::webgl::SanitizeRenderer(renderer); EXPECT_EQ(sanitized, expectation); } diff --git a/dom/ipc/ClonedErrorHolder.cpp b/dom/ipc/ClonedErrorHolder.cpp index 79b68b5b3551..c2d4293c561e 100644 --- a/dom/ipc/ClonedErrorHolder.cpp +++ b/dom/ipc/ClonedErrorHolder.cpp @@ -311,7 +311,7 @@ bool ClonedErrorHolder::ToErrorValue(JSContext* aCx, if (mTokenOffset >= sourceLine.Length()) { // Corrupt data, leave linebuf unset. } else if (JS::UniqueTwoByteChars buffer = - ToNullTerminatedJSStringBuffer(aCx, sourceLine)) { + ToNullTerminatedJSStringBuffer(aCx, sourceLine)) { err->initOwnedLinebuf(buffer.release(), sourceLine.Length(), mTokenOffset); } else { diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.h b/dom/media/webrtc/MediaEngineWebRTCAudio.h index 8516fe771217..8d80c6daa57d 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.h +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.h @@ -266,9 +266,8 @@ class AudioInputTrack : public ProcessedMediaTrack { } // Get the data in [aFrom, aTo) from aPort->GetSource() to aOutput. aOutput // needs to be empty. - void GetInputSourceData(AudioSegment& aOutput, - const MediaInputPort* aPort, GraphTime aFrom, - GraphTime aTo) const; + void GetInputSourceData(AudioSegment& aOutput, const MediaInputPort* aPort, + GraphTime aFrom, GraphTime aTo) const; // Any thread AudioInputTrack* AsAudioInputTrack() override { return this; } diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp index b2affb136178..2c9b83cdf654 100644 --- a/gfx/layers/ImageContainer.cpp +++ b/gfx/layers/ImageContainer.cpp @@ -496,7 +496,8 @@ Maybe PlanarYCbCrData::From( const MemoryOrShmem& memOrShmem = sdb.data(); switch (memOrShmem.type()) { case MemoryOrShmem::Tuintptr_t: - gfxCriticalError() << "PlanarYCbCrData::From SurfaceDescriptorBuffer w/uintptr_t unsupported."; + gfxCriticalError() << "PlanarYCbCrData::From SurfaceDescriptorBuffer " + "w/uintptr_t unsupported."; break; case MemoryOrShmem::TShmem: buffer.emplace(memOrShmem.get_Shmem().Range()); @@ -526,34 +527,39 @@ Maybe PlanarYCbCrData::From( yuvData.mColorRange = yuvDesc.colorRange(); const auto GetPlanePtr = [&](const uint32_t beginOffset, - const gfx::IntSize size, const int32_t stride) -> uint8_t* { + const gfx::IntSize size, + const int32_t stride) -> uint8_t* { if (size.width > stride) return nullptr; - auto bytesNeeded = CheckedInt(stride) * size.height; // Don't accept `stride*(h-1)+w`. + auto bytesNeeded = CheckedInt(stride) * + size.height; // Don't accept `stride*(h-1)+w`. bytesNeeded += beginOffset; if (!bytesNeeded.isValid() || bytesNeeded.value() > buffer->length()) { - gfxCriticalError() << "PlanarYCbCrData::From asked for out-of-bounds plane data."; + gfxCriticalError() + << "PlanarYCbCrData::From asked for out-of-bounds plane data."; return nullptr; } return (buffer->begin() + beginOffset).get(); }; - yuvData.mYChannel = GetPlanePtr(yuvDesc.yOffset(), yuvData.mYSize, yuvData.mYStride); - yuvData.mCbChannel = GetPlanePtr(yuvDesc.cbOffset(), yuvData.mCbCrSize, yuvData.mCbCrStride); - yuvData.mCrChannel = GetPlanePtr(yuvDesc.crOffset(), yuvData.mCbCrSize, yuvData.mCbCrStride); + yuvData.mYChannel = + GetPlanePtr(yuvDesc.yOffset(), yuvData.mYSize, yuvData.mYStride); + yuvData.mCbChannel = + GetPlanePtr(yuvDesc.cbOffset(), yuvData.mCbCrSize, yuvData.mCbCrStride); + yuvData.mCrChannel = + GetPlanePtr(yuvDesc.crOffset(), yuvData.mCbCrSize, yuvData.mCbCrStride); if (yuvData.mYSkip || yuvData.mCbSkip || yuvData.mCrSkip || yuvData.mYSize.width < 0 || yuvData.mYSize.height < 0 || yuvData.mCbCrSize.width < 0 || yuvData.mCbCrSize.height < 0 || - yuvData.mYStride < 0 || yuvData.mCbCrStride < 0 || - !yuvData.mYChannel || !yuvData.mCbChannel || !yuvData.mCrChannel) { + yuvData.mYStride < 0 || yuvData.mCbCrStride < 0 || !yuvData.mYChannel || + !yuvData.mCbChannel || !yuvData.mCrChannel) { gfxCriticalError() << "Unusual PlanarYCbCrData: " << yuvData.mYSkip << "," << yuvData.mCbSkip << "," << yuvData.mCrSkip << ", " << yuvData.mYSize.width << "," << yuvData.mYSize.height << ", " << yuvData.mCbCrSize.width << "," << yuvData.mCbCrSize.height << ", " << yuvData.mYStride - << "," << yuvData.mCbCrStride - << ", " << yuvData.mYChannel - << "," << yuvData.mCbChannel - << "," << yuvData.mCrChannel; + << "," << yuvData.mCbCrStride << ", " + << yuvData.mYChannel << "," << yuvData.mCbChannel << "," + << yuvData.mCrChannel; return {}; } diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp index 483fbdfe38ea..85c24e937975 100644 --- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -545,8 +545,8 @@ double gfxFontconfigFontEntry::GetAspect(uint8_t aSizeAdjustBasis) { case FontSizeAdjust::Tag::IcHeight: { bool vertical = FontSizeAdjust::Tag(aSizeAdjustBasis) == FontSizeAdjust::Tag::IcHeight; - gfxFloat advance = font->GetCharAdvance(gfxFont::kWaterIdeograph, - vertical); + gfxFloat advance = + font->GetCharAdvance(gfxFont::kWaterIdeograph, vertical); return advance > 0 ? advance / metrics.emHeight : 1.0; } default: diff --git a/gfx/thebes/gfxFont.h b/gfx/thebes/gfxFont.h index deb9fee49022..8cb407592590 100644 --- a/gfx/thebes/gfxFont.h +++ b/gfx/thebes/gfxFont.h @@ -1631,7 +1631,7 @@ class gfxFont { gfxFloat aveCharWidth; gfxFloat spaceWidth; - gfxFloat zeroWidth; // -1 if there was no zero glyph + gfxFloat zeroWidth; // -1 if there was no zero glyph gfxFloat ideographicWidth; // -1 if kWaterIdeograph is not supported gfxFloat ZeroOrAveCharWidth() const { diff --git a/gfx/thebes/gfxMacFont.cpp b/gfx/thebes/gfxMacFont.cpp index e11d2786f654..a83d2fa27bca 100644 --- a/gfx/thebes/gfxMacFont.cpp +++ b/gfx/thebes/gfxMacFont.cpp @@ -375,8 +375,8 @@ void gfxMacFont::InitMetrics() { } mSpaceGlyph = glyphID; - mMetrics.ideographicWidth = GetCharWidth(cmap, kWaterIdeograph, &glyphID, - cgConvFactor); + mMetrics.ideographicWidth = + GetCharWidth(cmap, kWaterIdeograph, &glyphID, cgConvFactor); if (glyphID == 0) { // Indicate "not found". mMetrics.ideographicWidth = -1.0; diff --git a/js/src/jit/JitFrames.h b/js/src/jit/JitFrames.h index a8f4b479bc63..a290a422efb9 100644 --- a/js/src/jit/JitFrames.h +++ b/js/src/jit/JitFrames.h @@ -176,7 +176,8 @@ struct ResumeFromException { }; #if defined(JS_CODEGEN_ARM64) - static_assert(sizeof(ResumeFromException) % 16 == 0, "ResumeFromException should be aligned"); +static_assert(sizeof(ResumeFromException) % 16 == 0, + "ResumeFromException should be aligned"); #endif void HandleException(ResumeFromException* rfe); diff --git a/layout/style/CSSLayerBlockRule.h b/layout/style/CSSLayerBlockRule.h index d5ca2e82f536..b5ba920a7bee 100644 --- a/layout/style/CSSLayerBlockRule.h +++ b/layout/style/CSSLayerBlockRule.h @@ -15,7 +15,7 @@ namespace mozilla::dom { class CSSLayerBlockRule final : public css::GroupRule { public: CSSLayerBlockRule(RefPtr aRawRule, StyleSheet* aSheet, - css::Rule* aParentRule, uint32_t aLine, uint32_t aColumn); + css::Rule* aParentRule, uint32_t aLine, uint32_t aColumn); NS_DECL_ISUPPORTS_INHERITED @@ -32,7 +32,6 @@ class CSSLayerBlockRule final : public css::GroupRule { void GetName(nsACString&) const; - size_t SizeOfIncludingThis(MallocSizeOf) const override; JSObject* WrapObject(JSContext*, JS::Handle) override; diff --git a/layout/style/CSSLayerStatementRule.cpp b/layout/style/CSSLayerStatementRule.cpp index 14cfbbd92c05..e90b4abb7486 100644 --- a/layout/style/CSSLayerStatementRule.cpp +++ b/layout/style/CSSLayerStatementRule.cpp @@ -10,9 +10,9 @@ namespace mozilla::dom { -CSSLayerStatementRule::CSSLayerStatementRule(RefPtr aRawRule, - StyleSheet* aSheet, css::Rule* aParentRule, - uint32_t aLine, uint32_t aColumn) +CSSLayerStatementRule::CSSLayerStatementRule( + RefPtr aRawRule, StyleSheet* aSheet, + css::Rule* aParentRule, uint32_t aLine, uint32_t aColumn) : Rule(aSheet, aParentRule, aLine, aColumn), mRawRule(std::move(aRawRule)) {} @@ -34,9 +34,12 @@ void CSSLayerStatementRule::List(FILE* out, int32_t aIndent) const { } #endif -StyleCssRuleType CSSLayerStatementRule::Type() const { return StyleCssRuleType::LayerStatement; } +StyleCssRuleType CSSLayerStatementRule::Type() const { + return StyleCssRuleType::LayerStatement; +} -void CSSLayerStatementRule::SetRawAfterClone(RefPtr aRaw) { +void CSSLayerStatementRule::SetRawAfterClone( + RefPtr aRaw) { mRawRule = std::move(aRaw); } @@ -47,16 +50,18 @@ void CSSLayerStatementRule::GetCssText(nsACString& aCssText) const { void CSSLayerStatementRule::GetNameList(nsTArray& aNames) const { size_t size = Servo_LayerStatementRule_GetNameCount(mRawRule.get()); for (size_t i = 0; i < size; ++i) { - Servo_LayerStatementRule_GetNameAt(mRawRule.get(), i, aNames.AppendElement()); + Servo_LayerStatementRule_GetNameAt(mRawRule.get(), i, + aNames.AppendElement()); } } -size_t CSSLayerStatementRule::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const { +size_t CSSLayerStatementRule::SizeOfIncludingThis( + MallocSizeOf aMallocSizeOf) const { return aMallocSizeOf(this); } JSObject* CSSLayerStatementRule::WrapObject(JSContext* aCx, - JS::Handle aGivenProto) { + JS::Handle aGivenProto) { return CSSLayerStatementRule_Binding::Wrap(aCx, this, aGivenProto); } diff --git a/layout/xul/nsXULPopupManager.cpp b/layout/xul/nsXULPopupManager.cpp index 6777c08441d7..806a70a3049a 100644 --- a/layout/xul/nsXULPopupManager.cpp +++ b/layout/xul/nsXULPopupManager.cpp @@ -1563,8 +1563,7 @@ void nsXULPopupManager::BeginShowingPopup(const PendingPopup& aPendingPopup, bool aSelectFirstItem) { RefPtr popup = aPendingPopup.mPopup; - nsMenuPopupFrame* popupFrame = - do_QueryFrame(popup->GetPrimaryFrame()); + nsMenuPopupFrame* popupFrame = do_QueryFrame(popup->GetPrimaryFrame()); if (!popupFrame) { return; } diff --git a/widget/cocoa/MOZMenuOpeningCoordinator.mm b/widget/cocoa/MOZMenuOpeningCoordinator.mm index a37e4366dcb9..eda5b055a765 100644 --- a/widget/cocoa/MOZMenuOpeningCoordinator.mm +++ b/widget/cocoa/MOZMenuOpeningCoordinator.mm @@ -106,7 +106,10 @@ static BOOL sNeedToUnwindForMenuClosing = NO; mPendingOpening = nil; @try { - [self _openMenu:info.menu atScreenPosition:info.position forView:info.view withAppearance:info.appearance]; + [self _openMenu:info.menu + atScreenPosition:info.position + forView:info.view + withAppearance:info.appearance]; } @catch (NSException* exception) { nsObjCExceptionLog(exception); } @@ -142,7 +145,10 @@ static BOOL sNeedToUnwindForMenuClosing = NO; } } -- (void)_openMenu:(NSMenu*)aMenu atScreenPosition:(NSPoint)aPosition forView:(NSView*)aView withAppearance:(NSAppearance*)aAppearance { +- (void)_openMenu:(NSMenu*)aMenu + atScreenPosition:(NSPoint)aPosition + forView:(NSView*)aView + withAppearance:(NSAppearance*)aAppearance { // There are multiple ways to display an NSMenu as a context menu. // // 1. We can return the NSMenu from -[ChildView menuForEvent:] and the NSView will open it for diff --git a/widget/cocoa/NativeMenuMac.h b/widget/cocoa/NativeMenuMac.h index 69c5d022c936..cd281937f57a 100644 --- a/widget/cocoa/NativeMenuMac.h +++ b/widget/cocoa/NativeMenuMac.h @@ -49,8 +49,7 @@ class NativeMenuMac : public NativeMenu, // nsMenuX::Observer void OnMenuWillOpen(dom::Element* aPopupElement) override; void OnMenuDidOpen(dom::Element* aPopupElement) override; - void OnMenuWillActivateItem(dom::Element* aPopupElement, - dom::Element* aMenuItemElement) override; + void OnMenuWillActivateItem(dom::Element* aPopupElement, dom::Element* aMenuItemElement) override; void OnMenuClosed(dom::Element* aPopupElement) override; NSMenu* NativeNSMenu() { return mMenu ? mMenu->NativeNSMenu() : nil; } diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp index b1aafa04f3fe..9a2f234a6e7c 100644 --- a/widget/gtk/nsDeviceContextSpecG.cpp +++ b/widget/gtk/nsDeviceContextSpecG.cpp @@ -416,11 +416,9 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::EndDocument() { if (widget::ShouldUsePortal(widget::PortalKind::Print)) { // Use the name of the file for printing to match with // nsFlatpakPrintPortal - nsCOMPtr os = - mozilla::services::GetObserverService(); + nsCOMPtr os = mozilla::services::GetObserverService(); // Pass filename to be sure that observer process the right data - os->NotifyObservers(nullptr, "print-to-file-finished", - targetPath.get()); + os->NotifyObservers(nullptr, "print-to-file-finished", targetPath.get()); } } return NS_OK;