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
This commit is contained in:
Andi-Bogdan Postelnicu 2022-01-11 15:49:03 +00:00
parent b7685e5c2d
commit 120496a230
17 changed files with 79 additions and 61 deletions

View File

@ -487,13 +487,13 @@ already_AddRefed<AccAttributes> RemoteAccessibleBase<Derived>::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<int32_t>(itemCount));
static_cast<int32_t>(itemCount));
}
if (hierarchical) {

View File

@ -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)) {

View File

@ -266,9 +266,7 @@ class UniqueBuffer final {
UniqueBuffer() = default;
~UniqueBuffer() {
reset();
}
~UniqueBuffer() { reset(); }
UniqueBuffer(UniqueBuffer&& rhs) { *this = std::move(rhs); }

View File

@ -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);
}

View File

@ -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 {

View File

@ -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; }

View File

@ -496,7 +496,8 @@ Maybe<PlanarYCbCrData> 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<uint8_t>());
@ -526,34 +527,39 @@ Maybe<PlanarYCbCrData> 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<uintptr_t>(stride) * size.height; // Don't accept `stride*(h-1)+w`.
auto bytesNeeded = CheckedInt<uintptr_t>(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 {};
}

View File

@ -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:

View File

@ -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 {

View File

@ -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;

View File

@ -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);

View File

@ -15,7 +15,7 @@ namespace mozilla::dom {
class CSSLayerBlockRule final : public css::GroupRule {
public:
CSSLayerBlockRule(RefPtr<RawServoLayerBlockRule> 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<JSObject*>) override;

View File

@ -10,9 +10,9 @@
namespace mozilla::dom {
CSSLayerStatementRule::CSSLayerStatementRule(RefPtr<RawServoLayerStatementRule> aRawRule,
StyleSheet* aSheet, css::Rule* aParentRule,
uint32_t aLine, uint32_t aColumn)
CSSLayerStatementRule::CSSLayerStatementRule(
RefPtr<RawServoLayerStatementRule> 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<RawServoLayerStatementRule> aRaw) {
void CSSLayerStatementRule::SetRawAfterClone(
RefPtr<RawServoLayerStatementRule> aRaw) {
mRawRule = std::move(aRaw);
}
@ -47,16 +50,18 @@ void CSSLayerStatementRule::GetCssText(nsACString& aCssText) const {
void CSSLayerStatementRule::GetNameList(nsTArray<nsCString>& 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<JSObject*> aGivenProto) {
JS::Handle<JSObject*> aGivenProto) {
return CSSLayerStatementRule_Binding::Wrap(aCx, this, aGivenProto);
}

View File

@ -1563,8 +1563,7 @@ void nsXULPopupManager::BeginShowingPopup(const PendingPopup& aPendingPopup,
bool aSelectFirstItem) {
RefPtr<nsIContent> popup = aPendingPopup.mPopup;
nsMenuPopupFrame* popupFrame =
do_QueryFrame(popup->GetPrimaryFrame());
nsMenuPopupFrame* popupFrame = do_QueryFrame(popup->GetPrimaryFrame());
if (!popupFrame) {
return;
}

View File

@ -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

View File

@ -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; }

View File

@ -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<nsIObserverService> os =
mozilla::services::GetObserverService();
nsCOMPtr<nsIObserverService> 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;