From 758e8363339d9d6c2e7f5367d99f979c35e891a9 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Fri, 29 Mar 2019 23:41:48 -0700 Subject: [PATCH 1/7] No bug - clang-format -p gfx --- gfx/2d/Logging.h | 4 +- gfx/gl/GLContextFeatures.cpp | 4 +- gfx/gl/GLContextProviderEGL.cpp | 3 +- gfx/ipc/VsyncIOThreadHolder.h | 4 +- gfx/layers/Layers.cpp | 6 +- gfx/layers/Layers.h | 3 +- gfx/layers/apz/src/APZCTreeManager.cpp | 12 +- gfx/layers/apz/src/APZCTreeManager.h | 14 +-- gfx/layers/apz/src/APZUpdater.cpp | 40 +++---- gfx/layers/apz/test/gtest/APZCBasicTester.h | 6 +- gfx/layers/apz/test/gtest/TestBasic.cpp | 5 +- gfx/layers/client/ClientImageLayer.cpp | 7 +- .../composite/AsyncCompositionManager.cpp | 18 +-- gfx/layers/wr/AsyncImagePipelineManager.cpp | 15 ++- gfx/layers/wr/IpcResourceUpdateQueue.cpp | 6 +- gfx/layers/wr/RenderRootTypes.cpp | 104 +++++++++--------- gfx/layers/wr/WebRenderMessageUtils.h | 6 +- gfx/layers/wr/WebRenderUserData.cpp | 4 +- gfx/src/FontPropertyTypes.h | 3 +- gfx/thebes/gfxPlatform.cpp | 7 +- gfx/thebes/gfxUtils.cpp | 23 ++-- gfx/thebes/gfxUtils.h | 12 +- gfx/vr/external_api/moz_external_vr.h | 3 +- gfx/webrender_bindings/RenderThread.cpp | 6 +- gfx/webrender_bindings/WebRenderAPI.cpp | 5 +- gfx/webrender_bindings/WebRenderTypes.h | 40 +++---- 26 files changed, 178 insertions(+), 182 deletions(-) diff --git a/gfx/2d/Logging.h b/gfx/2d/Logging.h index 3d63ee67a528..28704f98c113 100644 --- a/gfx/2d/Logging.h +++ b/gfx/2d/Logging.h @@ -862,7 +862,7 @@ inline bool MOZ2D_warn_if_impl(bool aCondition, const char* aExpr, const int INDENT_PER_LEVEL = 2; -template +template class TreeLog { public: explicit TreeLog(const std::string& aPrefix = "") @@ -930,7 +930,7 @@ class TreeLog { } }; -template +template class TreeAutoIndent { public: explicit TreeAutoIndent(TreeLog& aTreeLog) : mTreeLog(aTreeLog) { diff --git a/gfx/gl/GLContextFeatures.cpp b/gfx/gl/GLContextFeatures.cpp index 582575d6815e..863940882b13 100644 --- a/gfx/gl/GLContextFeatures.cpp +++ b/gfx/gl/GLContextFeatures.cpp @@ -142,8 +142,8 @@ static const FeatureInfo sFeatureInfoArr[] = { GLESVersion::ES3, GLContext::Extension_None, {GLContext::ARB_color_buffer_float, GLContext::EXT_color_buffer_float, - GLContext::EXT_color_buffer_half_float, GLContext::CHROMIUM_color_buffer_float_rgba, - GLContext::Extensions_End}}, + GLContext::EXT_color_buffer_half_float, + GLContext::CHROMIUM_color_buffer_float_rgba, GLContext::Extensions_End}}, {"frag_depth", GLVersion::GL2, GLESVersion::ES3, diff --git a/gfx/gl/GLContextProviderEGL.cpp b/gfx/gl/GLContextProviderEGL.cpp index 86a943bc0aba..3eade951fca5 100644 --- a/gfx/gl/GLContextProviderEGL.cpp +++ b/gfx/gl/GLContextProviderEGL.cpp @@ -286,8 +286,7 @@ already_AddRefed GLContextEGLFactory::Create( flags, caps, false, config, surface, &discardFailureId); if (!gl) { const auto err = egl->fGetError(); - gfxCriticalNote << "Failed to create EGLContext!: " - << gfx::hexa(err); + gfxCriticalNote << "Failed to create EGLContext!: " << gfx::hexa(err); mozilla::gl::DestroySurface(surface); return nullptr; } diff --git a/gfx/ipc/VsyncIOThreadHolder.h b/gfx/ipc/VsyncIOThreadHolder.h index b5ea0c2c1fa5..265e063912bc 100644 --- a/gfx/ipc/VsyncIOThreadHolder.h +++ b/gfx/ipc/VsyncIOThreadHolder.h @@ -23,9 +23,7 @@ class VsyncIOThreadHolder final { RefPtr GetThread() const; - bool IsOnCurrentThread() const { - return mThread->IsOnCurrentThread(); - } + bool IsOnCurrentThread() const { return mThread->IsOnCurrentThread(); } void Dispatch(already_AddRefed task) { mThread->Dispatch(std::move(task), NS_DISPATCH_NORMAL); diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 5134db70be77..11d3f75a370d 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -2233,8 +2233,7 @@ bool LayerManager::IsLogEnabled() { } bool LayerManager::SetPendingScrollUpdateForNextTransaction( - ScrollableLayerGuid::ViewID aScrollId, - const ScrollUpdateInfo& aUpdateInfo, + ScrollableLayerGuid::ViewID aScrollId, const ScrollUpdateInfo& aUpdateInfo, wr::RenderRoot aRenderRoot) { Layer* withPendingTransform = DepthFirstSearch( GetRoot(), [](Layer* aLayer) { return aLayer->HasPendingTransform(); }); @@ -2247,7 +2246,8 @@ bool LayerManager::SetPendingScrollUpdateForNextTransaction( // RenderRoot::Default so that we can make assumptions in // GetPendingScrollInfoUpdate. wr::RenderRoot renderRoot = (GetBackendType() == LayersBackend::LAYERS_WR) - ? aRenderRoot : wr::RenderRoot::Default; + ? aRenderRoot + : wr::RenderRoot::Default; mPendingScrollUpdates[renderRoot][aScrollId] = aUpdateInfo; return true; } diff --git a/gfx/layers/Layers.h b/gfx/layers/Layers.h index 6cd8921fa552..a77a5b687234 100644 --- a/gfx/layers/Layers.h +++ b/gfx/layers/Layers.h @@ -791,8 +791,7 @@ class LayerManager : public FrameRecorder { */ virtual bool SetPendingScrollUpdateForNextTransaction( ScrollableLayerGuid::ViewID aScrollId, - const ScrollUpdateInfo& aUpdateInfo, - wr::RenderRoot aRenderRoot); + const ScrollUpdateInfo& aUpdateInfo, wr::RenderRoot aRenderRoot); Maybe GetPendingScrollInfoUpdate( ScrollableLayerGuid::ViewID aScrollId); void ClearPendingScrollInfoUpdate(); diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 62d07a8951c3..2de1da3f946f 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -362,8 +362,8 @@ APZCTreeManager::UpdateHitTestingTreeImpl(LayersId aRootLayerTreeId, if (gfxPrefs::APZTestLoggingEnabled()) { MutexAutoLock lock(mTestDataLock); UniquePtr ptr = MakeUnique(); - auto result = - mTestData.insert(std::make_pair(aOriginatingWrRootId.mLayersId, std::move(ptr))); + auto result = mTestData.insert( + std::make_pair(aOriginatingWrRootId.mLayersId, std::move(ptr))); testData = result.first->second.get(); testData->StartNewPaint(aPaintSequenceNumber); } @@ -609,7 +609,8 @@ void APZCTreeManager::UpdateHitTestingTree(LayersId aRootLayerTreeId, LayerMetricsWrapper root(aRoot); UpdateHitTestingTreeImpl(aRootLayerTreeId, root, aIsFirstPaint, - WRRootId::NonWebRender(aOriginatingLayersId), aPaintSequenceNumber); + WRRootId::NonWebRender(aOriginatingLayersId), + aPaintSequenceNumber); } void APZCTreeManager::UpdateHitTestingTree( @@ -1046,8 +1047,9 @@ HitTestingTreeNode* APZCTreeManager::PrepareNodeForLayer( "Using APZC %p for layer %p with identifiers %" PRIx64 " %" PRId64 "\n", apzc, aLayer.GetLayer(), uint64_t(aLayersId), aMetrics.GetScrollId()); - apzc->NotifyLayersUpdated(aLayer.Metadata(), aState.mIsFirstPaint, - WRRootId(aLayersId, aRenderRoot) == aState.mOriginatingWrRootId); + apzc->NotifyLayersUpdated( + aLayer.Metadata(), aState.mIsFirstPaint, + WRRootId(aLayersId, aRenderRoot) == aState.mOriginatingWrRootId); // Since this is the first time we are encountering an APZC with this guid, // the node holding it must be the primary holder. It may be newly-created diff --git a/gfx/layers/apz/src/APZCTreeManager.h b/gfx/layers/apz/src/APZCTreeManager.h index b91304c93c14..6e8a0067a75f 100644 --- a/gfx/layers/apz/src/APZCTreeManager.h +++ b/gfx/layers/apz/src/APZCTreeManager.h @@ -19,14 +19,14 @@ #include "mozilla/layers/APZTestData.h" // for APZTestData #include "mozilla/layers/IAPZCTreeManager.h" // for IAPZCTreeManager #include "mozilla/layers/LayersTypes.h" -#include "mozilla/layers/KeyboardMap.h" // for KeyboardMap -#include "mozilla/layers/TouchCounter.h" // for TouchCounter +#include "mozilla/layers/KeyboardMap.h" // for KeyboardMap +#include "mozilla/layers/TouchCounter.h" // for TouchCounter #include "mozilla/layers/ZoomConstraints.h" // for ZoomConstraints -#include "mozilla/RecursiveMutex.h" // for RecursiveMutex -#include "mozilla/RefPtr.h" // for RefPtr -#include "mozilla/TimeStamp.h" // for mozilla::TimeStamp -#include "mozilla/UniquePtr.h" // for UniquePtr -#include "nsCOMPtr.h" // for already_AddRefed +#include "mozilla/RecursiveMutex.h" // for RecursiveMutex +#include "mozilla/RefPtr.h" // for RefPtr +#include "mozilla/TimeStamp.h" // for mozilla::TimeStamp +#include "mozilla/UniquePtr.h" // for UniquePtr +#include "nsCOMPtr.h" // for already_AddRefed #if defined(MOZ_WIDGET_ANDROID) # include "mozilla/layers/AndroidDynamicToolbarAnimator.h" diff --git a/gfx/layers/apz/src/APZUpdater.cpp b/gfx/layers/apz/src/APZUpdater.cpp index 865603e722bd..f4c36386f5ae 100644 --- a/gfx/layers/apz/src/APZUpdater.cpp +++ b/gfx/layers/apz/src/APZUpdater.cpp @@ -157,7 +157,8 @@ void APZUpdater::UpdateFocusState(LayersId aRootLayerTreeId, MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); UpdaterQueueSelector selector(aOriginatingWrRootId); if (aFocusTarget.mData.is()) { - const FocusTarget::ScrollTargets& targets = aFocusTarget.mData.as(); + const FocusTarget::ScrollTargets& targets = + aFocusTarget.mData.as(); selector.mRenderRoots += targets.mHorizontalRenderRoot; selector.mRenderRoots += targets.mVerticalRenderRoot; } @@ -196,23 +197,23 @@ void APZUpdater::UpdateScrollDataAndTreeState( } self->mEpochData[aOriginatingWrRootId].mRequired = aEpoch; })); - RunOnUpdaterThread( - UpdaterQueueSelector(aOriginatingWrRootId), - NS_NewRunnableFunction( - "APZUpdater::UpdateHitTestingTree", - [=, aScrollData = std::move(aScrollData)]() { - self->mScrollData[aOriginatingWrRootId] = aScrollData; - auto root = self->mScrollData.find(aRootLayerTreeId); - if (root == self->mScrollData.end()) { - return; - } - self->mApz->UpdateHitTestingTree( - aRootLayerTreeId.mLayersId, - WebRenderScrollDataWrapper(*self, aRootLayerTreeId, - &(root->second)), - aScrollData.IsFirstPaint(), aOriginatingWrRootId, - aScrollData.GetPaintSequenceNumber()); - })); + RunOnUpdaterThread(UpdaterQueueSelector(aOriginatingWrRootId), + NS_NewRunnableFunction( + "APZUpdater::UpdateHitTestingTree", + [=, aScrollData = std::move(aScrollData)]() { + self->mScrollData[aOriginatingWrRootId] = + aScrollData; + auto root = self->mScrollData.find(aRootLayerTreeId); + if (root == self->mScrollData.end()) { + return; + } + self->mApz->UpdateHitTestingTree( + aRootLayerTreeId.mLayersId, + WebRenderScrollDataWrapper( + *self, aRootLayerTreeId, &(root->second)), + aScrollData.IsFirstPaint(), aOriginatingWrRootId, + aScrollData.GetPaintSequenceNumber()); + })); } void APZUpdater::UpdateScrollOffsets(WRRootId aRootLayerTreeId, @@ -235,8 +236,7 @@ void APZUpdater::UpdateScrollOffsets(WRRootId aRootLayerTreeId, aRootLayerTreeId.mLayersId, WebRenderScrollDataWrapper( *self, aRootLayerTreeId, &(root->second)), - /*isFirstPaint*/ false, - aOriginatingWrRootId, + /*isFirstPaint*/ false, aOriginatingWrRootId, aPaintSequenceNumber); })); } diff --git a/gfx/layers/apz/test/gtest/APZCBasicTester.h b/gfx/layers/apz/test/gtest/APZCBasicTester.h index 9fd11cc4e9e6..215e54cd76fd 100644 --- a/gfx/layers/apz/test/gtest/APZCBasicTester.h +++ b/gfx/layers/apz/test/gtest/APZCBasicTester.h @@ -32,10 +32,8 @@ class APZCBasicTester : public APZCTesterBase { tm = new TestAPZCTreeManager(mcc); updater = new APZUpdater(tm, false); sampler = new APZSampler(tm, false); - apzc = - new TestAsyncPanZoomController(LayersId{0}, mcc, tm, - wr::RenderRoot::Default, - mGestureBehavior); + apzc = new TestAsyncPanZoomController( + LayersId{0}, mcc, tm, wr::RenderRoot::Default, mGestureBehavior); apzc->SetFrameMetrics(TestFrameMetrics()); apzc->GetScrollMetadata().SetIsLayersIdRoot(true); } diff --git a/gfx/layers/apz/test/gtest/TestBasic.cpp b/gfx/layers/apz/test/gtest/TestBasic.cpp index 806f8ac05039..3a3b6fd566df 100644 --- a/gfx/layers/apz/test/gtest/TestBasic.cpp +++ b/gfx/layers/apz/test/gtest/TestBasic.cpp @@ -58,9 +58,8 @@ TEST_F(APZCBasicTester, ComplexTransform) { // CSS pixels). The displayport is 1 extra CSS pixel on all // sides. - RefPtr childApzc = - new TestAsyncPanZoomController(LayersId{0}, mcc, tm, - wr::RenderRoot::Default); + RefPtr childApzc = new TestAsyncPanZoomController( + LayersId{0}, mcc, tm, wr::RenderRoot::Default); const char* layerTreeSyntax = "c(c)"; // LayerID 0 1 diff --git a/gfx/layers/client/ClientImageLayer.cpp b/gfx/layers/client/ClientImageLayer.cpp index 34378779932e..ffe444ee8a3c 100644 --- a/gfx/layers/client/ClientImageLayer.cpp +++ b/gfx/layers/client/ClientImageLayer.cpp @@ -120,8 +120,8 @@ void ClientImageLayer::RenderLayer() { return; } - if (!mImageClient || !mImageClient->UpdateImage(mContainer, GetContentFlags(), - Nothing())) { + if (!mImageClient || + !mImageClient->UpdateImage(mContainer, GetContentFlags(), Nothing())) { CompositableType type = GetImageClientType(); if (type == CompositableType::UNKNOWN) { return; @@ -137,8 +137,7 @@ void ClientImageLayer::RenderLayer() { mImageClient->Connect(); ClientManager()->AsShadowForwarder()->Attach(mImageClient, this); } - if (!mImageClient->UpdateImage(mContainer, GetContentFlags(), - Nothing())) { + if (!mImageClient->UpdateImage(mContainer, GetContentFlags(), Nothing())) { return; } } diff --git a/gfx/layers/composite/AsyncCompositionManager.cpp b/gfx/layers/composite/AsyncCompositionManager.cpp index cf2456669905..d0278d9271df 100644 --- a/gfx/layers/composite/AsyncCompositionManager.cpp +++ b/gfx/layers/composite/AsyncCompositionManager.cpp @@ -1045,13 +1045,14 @@ bool AsyncCompositionManager::ApplyAsyncContentTransformToTree( if (mIsFirstPaint || FrameMetricsHaveUpdated(metrics)) { if (animator) { animator->UpdateRootFrameMetrics(metrics); - } else if (RefPtr uiController = - UiCompositorControllerParent:: - GetFromRootLayerTreeId(rootLayerTreeId)) { + } else if (RefPtr + uiController = UiCompositorControllerParent:: + GetFromRootLayerTreeId( + rootLayerTreeId)) { uiController->NotifyUpdateScreenMetrics(metrics); } mLastMetrics = metrics; - } + } if (mIsFirstPaint) { if (animator) { animator->FirstPaint(); @@ -1238,9 +1239,12 @@ bool AsyncCompositionManager::ApplyAsyncContentTransformToTree( } #if defined(MOZ_WIDGET_ANDROID) -bool AsyncCompositionManager::FrameMetricsHaveUpdated(const FrameMetrics& aMetrics) { - return RoundedToInt(mLastMetrics.GetScrollOffset()) != RoundedToInt(aMetrics.GetScrollOffset()) - || mLastMetrics.GetZoom() != aMetrics.GetZoom();; +bool AsyncCompositionManager::FrameMetricsHaveUpdated( + const FrameMetrics& aMetrics) { + return RoundedToInt(mLastMetrics.GetScrollOffset()) != + RoundedToInt(aMetrics.GetScrollOffset()) || + mLastMetrics.GetZoom() != aMetrics.GetZoom(); + ; } #endif diff --git a/gfx/layers/wr/AsyncImagePipelineManager.cpp b/gfx/layers/wr/AsyncImagePipelineManager.cpp index 85316ef0e7f6..006c317f9e8e 100644 --- a/gfx/layers/wr/AsyncImagePipelineManager.cpp +++ b/gfx/layers/wr/AsyncImagePipelineManager.cpp @@ -460,10 +460,10 @@ void AsyncImagePipelineManager::ApplyAsyncImageForPipeline( wr::BuiltDisplayList dl; wr::LayoutSize builderContentSize; builder.Finalize(builderContentSize, dl); - aSceneBuilderTxn.SetDisplayList( - gfx::Color(0.f, 0.f, 0.f, 0.f), aEpoch, - wr::ToLayoutSize(aPipeline->mScBounds.Size()), - aPipelineId, builderContentSize, dl.dl_desc, dl.dl); + aSceneBuilderTxn.SetDisplayList(gfx::Color(0.f, 0.f, 0.f, 0.f), aEpoch, + wr::ToLayoutSize(aPipeline->mScBounds.Size()), + aPipelineId, builderContentSize, dl.dl_desc, + dl.dl); } void AsyncImagePipelineManager::ApplyAsyncImageForPipeline( @@ -519,10 +519,9 @@ void AsyncImagePipelineManager::SetEmptyDisplayList( wr::BuiltDisplayList dl; wr::LayoutSize builderContentSize; builder.Finalize(builderContentSize, dl); - txn.SetDisplayList( - gfx::Color(0.f, 0.f, 0.f, 0.f), epoch, - wr::ToLayoutSize(pipeline->mScBounds.Size()), - aPipelineId, builderContentSize, dl.dl_desc, dl.dl); + txn.SetDisplayList(gfx::Color(0.f, 0.f, 0.f, 0.f), epoch, + wr::ToLayoutSize(pipeline->mScBounds.Size()), aPipelineId, + builderContentSize, dl.dl_desc, dl.dl); } void AsyncImagePipelineManager::HoldExternalImage( diff --git a/gfx/layers/wr/IpcResourceUpdateQueue.cpp b/gfx/layers/wr/IpcResourceUpdateQueue.cpp index f99af4137af6..0b29874f9277 100644 --- a/gfx/layers/wr/IpcResourceUpdateQueue.cpp +++ b/gfx/layers/wr/IpcResourceUpdateQueue.cpp @@ -249,8 +249,7 @@ bool ShmSegmentsReader::Read(const layers::OffsetRange& aRange, } IpcResourceUpdateQueue::IpcResourceUpdateQueue( - layers::WebRenderBridgeChild* aAllocator, - wr::RenderRoot aRenderRoot, + layers::WebRenderBridgeChild* aAllocator, wr::RenderRoot aRenderRoot, size_t aChunkSize) : mWriter(aAllocator, aChunkSize), mRenderRoot(aRenderRoot) {} @@ -276,8 +275,7 @@ IpcResourceUpdateQueue& IpcResourceUpdateQueue::operator=( return *this; } -void IpcResourceUpdateQueue::ReplaceResources( - IpcResourceUpdateQueue&& aOther) { +void IpcResourceUpdateQueue::ReplaceResources(IpcResourceUpdateQueue&& aOther) { MOZ_ASSERT(IsEmpty(), "Will forget existing updates!"); MOZ_ASSERT(!aOther.HasAnySubQueue(), "Subqueues will be lost!"); MOZ_ASSERT(mRenderRoot == aOther.mRenderRoot); diff --git a/gfx/layers/wr/RenderRootTypes.cpp b/gfx/layers/wr/RenderRootTypes.cpp index c49240399409..03b7be60493f 100644 --- a/gfx/layers/wr/RenderRootTypes.cpp +++ b/gfx/layers/wr/RenderRootTypes.cpp @@ -11,65 +11,61 @@ namespace mozilla { namespace ipc { -void IPDLParamTraits::Write(IPC::Message* aMsg, - IProtocol* aActor, - paramType&& aParam) { - WriteIPDLParam(aMsg, aActor, aParam.mRenderRoot); - WriteIPDLParam(aMsg, aActor, aParam.mRect); - WriteIPDLParam(aMsg, aActor, aParam.mCommands); - WriteIPDLParam(aMsg, aActor, aParam.mContentSize); - WriteIPDLParam(aMsg, aActor, std::move(aParam.mDL)); - WriteIPDLParam(aMsg, aActor, aParam.mDLDesc); - WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates); - WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems); - WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems)); - WriteIPDLParam(aMsg, aActor, aParam.mScrollData); +void IPDLParamTraits::Write( + IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) { + WriteIPDLParam(aMsg, aActor, aParam.mRenderRoot); + WriteIPDLParam(aMsg, aActor, aParam.mRect); + WriteIPDLParam(aMsg, aActor, aParam.mCommands); + WriteIPDLParam(aMsg, aActor, aParam.mContentSize); + WriteIPDLParam(aMsg, aActor, std::move(aParam.mDL)); + WriteIPDLParam(aMsg, aActor, aParam.mDLDesc); + WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates); + WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems); + WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems)); + WriteIPDLParam(aMsg, aActor, aParam.mScrollData); } -bool IPDLParamTraits::Read(const IPC::Message* aMsg, - PickleIterator* aIter, - IProtocol* aActor, - paramType* aResult) { - if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRenderRoot) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRect) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mContentSize) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDL) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLDesc) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollData)) { - return true; - } - return false; +bool IPDLParamTraits::Read( + const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor, + paramType* aResult) { + if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRenderRoot) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRect) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mContentSize) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDL) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mDLDesc) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollData)) { + return true; + } + return false; } -void IPDLParamTraits::Write(IPC::Message* aMsg, - IProtocol* aActor, - paramType&& aParam) { - WriteIPDLParam(aMsg, aActor, aParam.mRenderRoot); - WriteIPDLParam(aMsg, aActor, aParam.mCommands); - WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates); - WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems); - WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems)); - WriteIPDLParam(aMsg, aActor, aParam.mScrollUpdates); +void IPDLParamTraits::Write( + IPC::Message* aMsg, IProtocol* aActor, paramType&& aParam) { + WriteIPDLParam(aMsg, aActor, aParam.mRenderRoot); + WriteIPDLParam(aMsg, aActor, aParam.mCommands); + WriteIPDLParam(aMsg, aActor, aParam.mResourceUpdates); + WriteIPDLParam(aMsg, aActor, aParam.mSmallShmems); + WriteIPDLParam(aMsg, aActor, std::move(aParam.mLargeShmems)); + WriteIPDLParam(aMsg, aActor, aParam.mScrollUpdates); } -bool IPDLParamTraits::Read(const IPC::Message* aMsg, - PickleIterator* aIter, - IProtocol* aActor, - paramType* aResult) { - if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRenderRoot) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) && - ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollUpdates)) { - return true; - } - return false; +bool IPDLParamTraits::Read( + const IPC::Message* aMsg, PickleIterator* aIter, IProtocol* aActor, + paramType* aResult) { + if (ReadIPDLParam(aMsg, aIter, aActor, &aResult->mRenderRoot) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mCommands) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mResourceUpdates) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mSmallShmems) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mLargeShmems) && + ReadIPDLParam(aMsg, aIter, aActor, &aResult->mScrollUpdates)) { + return true; + } + return false; } -} // namespace ipc -} // namespace mozilla +} // namespace ipc +} // namespace mozilla diff --git a/gfx/layers/wr/WebRenderMessageUtils.h b/gfx/layers/wr/WebRenderMessageUtils.h index 56bd3a772895..987c130d1807 100644 --- a/gfx/layers/wr/WebRenderMessageUtils.h +++ b/gfx/layers/wr/WebRenderMessageUtils.h @@ -111,9 +111,9 @@ struct ParamTraits template <> struct ParamTraits - : public ContiguousEnumSerializerInclusive {}; + : public ContiguousEnumSerializerInclusive< + mozilla::wr::RenderRoot, mozilla::wr::RenderRoot::Default, + mozilla::wr::kHighestRenderRoot> {}; template <> struct ParamTraits diff --git a/gfx/layers/wr/WebRenderUserData.cpp b/gfx/layers/wr/WebRenderUserData.cpp index ecf1a82d1871..2226d1a95d0d 100644 --- a/gfx/layers/wr/WebRenderUserData.cpp +++ b/gfx/layers/wr/WebRenderUserData.cpp @@ -372,8 +372,8 @@ WebRenderCanvasRendererAsync* WebRenderCanvasData::CreateCanvasRenderer() { return mCanvasRenderer.get(); } -WebRenderRenderRootData::WebRenderRenderRootData(RenderRootStateManager* aManager, - nsDisplayItem* aItem) +WebRenderRenderRootData::WebRenderRenderRootData( + RenderRootStateManager* aManager, nsDisplayItem* aItem) : WebRenderUserData(aManager, aItem) {} RenderRootBoundary& WebRenderRenderRootData::EnsureHasBoundary( diff --git a/gfx/src/FontPropertyTypes.h b/gfx/src/FontPropertyTypes.h index e84c67fc6a23..6e3739ad2403 100644 --- a/gfx/src/FontPropertyTypes.h +++ b/gfx/src/FontPropertyTypes.h @@ -97,8 +97,7 @@ class FontPropertyValue { : mValue(std::round(aValue * kScale)) { MOZ_ASSERT(aValue >= kMin && aValue <= kMax); } - explicit constexpr FontPropertyValue(int aValue) - : mValue(aValue * kScale) { + explicit constexpr FontPropertyValue(int aValue) : mValue(aValue * kScale) { MOZ_ASSERT(aValue >= Min && aValue <= Max); } diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index feb4df6a8e36..0a930430e820 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -2919,7 +2919,8 @@ bool gfxPlatform::IsInLayoutAsapMode() { /* static */ bool gfxPlatform::ForceSoftwareVsync() { - return gfxPrefs::LayoutFrameRate() > 0 || recordreplay::IsRecordingOrReplaying(); + return gfxPrefs::LayoutFrameRate() > 0 || + recordreplay::IsRecordingOrReplaying(); } /* static */ @@ -2932,9 +2933,7 @@ int gfxPlatform::GetSoftwareVsyncRate() { } /* static */ -int gfxPlatform::GetDefaultFrameRate() { - return 60; -} +int gfxPlatform::GetDefaultFrameRate() { return 60; } /* static */ void gfxPlatform::ReInitFrameRate() { diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index 086051be18d4..89a91dd4fb8b 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -1472,8 +1472,7 @@ bool gfxUtils::DumpDisplayList() { } wr::RenderRoot gfxUtils::GetContentRenderRoot() { - if (gfx::gfxVars::UseWebRender() && - gfxPrefs::WebRenderSplitRenderRoots()) { + if (gfx::gfxVars::UseWebRender() && gfxPrefs::WebRenderSplitRenderRoots()) { return wr::RenderRoot::Content; } return wr::RenderRoot::Default; @@ -1489,7 +1488,8 @@ Maybe gfxUtils::GetRenderRootForFrame(const nsIFrame* aFrame) { return gfxUtils::GetRenderRootForElement(aFrame->GetContent()->AsElement()); } -Maybe gfxUtils::GetRenderRootForElement(const dom::Element* aElement) { +Maybe gfxUtils::GetRenderRootForElement( + const dom::Element* aElement) { if (!aElement) { return Nothing(); } @@ -1499,21 +1499,20 @@ Maybe gfxUtils::GetRenderRootForElement(const dom::Element* aEle if (!aElement->IsXULElement()) { return Nothing(); } - if (aElement->AttrValueIs( - kNameSpaceID_None, nsGkAtoms::renderroot, - NS_LITERAL_STRING("content"), eCaseMatters)) { + if (aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::renderroot, + NS_LITERAL_STRING("content"), eCaseMatters)) { return Some(wr::RenderRoot::Content); } return Nothing(); } -wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForFrame(const nsIFrame* aFrame) { +wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForFrame( + const nsIFrame* aFrame) { if (!gfxVars::UseWebRender() || !gfxPrefs::WebRenderSplitRenderRoots()) { return wr::RenderRoot::Default; } - for (const nsIFrame* current = aFrame; - current; + for (const nsIFrame* current = aFrame; current; current = current->GetParent()) { auto renderRoot = gfxUtils::GetRenderRootForFrame(current); if (renderRoot) { @@ -1524,13 +1523,13 @@ wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForFrame(const nsIFrame* aFrame return wr::RenderRoot::Default; } -wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForElement(const dom::Element* aElement) { +wr::RenderRoot gfxUtils::RecursivelyGetRenderRootForElement( + const dom::Element* aElement) { if (!gfxVars::UseWebRender() || !gfxPrefs::WebRenderSplitRenderRoots()) { return wr::RenderRoot::Default; } - for (const dom::Element* current = aElement; - current; + for (const dom::Element* current = aElement; current; current = current->GetParentElement()) { auto renderRoot = gfxUtils::GetRenderRootForElement(current); if (renderRoot) { diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index e2cf205a4d5a..46e5d497df03 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -316,10 +316,14 @@ class gfxUtils { static mozilla::wr::RenderRoot GetContentRenderRoot(); - static mozilla::Maybe GetRenderRootForFrame(const nsIFrame* aFrame); - static mozilla::Maybe GetRenderRootForElement(const mozilla::dom::Element* aElement); - static mozilla::wr::RenderRoot RecursivelyGetRenderRootForFrame(const nsIFrame* aFrame); - static mozilla::wr::RenderRoot RecursivelyGetRenderRootForElement(const mozilla::dom::Element* aElement); + static mozilla::Maybe GetRenderRootForFrame( + const nsIFrame* aFrame); + static mozilla::Maybe GetRenderRootForElement( + const mozilla::dom::Element* aElement); + static mozilla::wr::RenderRoot RecursivelyGetRenderRootForFrame( + const nsIFrame* aFrame); + static mozilla::wr::RenderRoot RecursivelyGetRenderRootForElement( + const mozilla::dom::Element* aElement); }; namespace mozilla { diff --git a/gfx/vr/external_api/moz_external_vr.h b/gfx/vr/external_api/moz_external_vr.h index 8b8c1ffeadca..a734fe057d13 100644 --- a/gfx/vr/external_api/moz_external_vr.h +++ b/gfx/vr/external_api/moz_external_vr.h @@ -161,7 +161,8 @@ enum class VRDisplayCapabilityFlags : uint16_t { Cap_MountDetection = 1 << 8, /** * Cap_PositionEmulated is set if the VRDisplay is capable of setting a - * emulated position (e.g. neck model) even if still doesn't support 6DOF tracking. + * emulated position (e.g. neck model) even if still doesn't support 6DOF + * tracking. */ Cap_PositionEmulated = 1 << 9, /** diff --git a/gfx/webrender_bindings/RenderThread.cpp b/gfx/webrender_bindings/RenderThread.cpp index 1b974141def8..c1c71b4a0e23 100644 --- a/gfx/webrender_bindings/RenderThread.cpp +++ b/gfx/webrender_bindings/RenderThread.cpp @@ -511,7 +511,8 @@ void RenderThread::DecPendingFrameCount(wr::WindowId aWindowId) { info->mStartIds.pop(); } -mozilla::Pair RenderThread::IncRenderingFrameCount(wr::WindowId aWindowId, bool aRender) { +mozilla::Pair RenderThread::IncRenderingFrameCount( + wr::WindowId aWindowId, bool aRender) { auto windows = mWindowInfos.Lock(); auto it = windows->find(AsUint64(aWindowId)); if (it == windows->end()) { @@ -894,7 +895,8 @@ void wr_schedule_render(mozilla::wr::WrWindowId aWindowId, RefPtr cbp = mozilla::layers:: CompositorBridgeParent::GetCompositorBridgeParentFromWindowId(aWindowId); if (cbp) { - cbp->ScheduleRenderOnCompositorThread(Some(wr::RenderRootFromId(aDocumentId))); + cbp->ScheduleRenderOnCompositorThread( + Some(wr::RenderRootFromId(aDocumentId))); } } diff --git a/gfx/webrender_bindings/WebRenderAPI.cpp b/gfx/webrender_bindings/WebRenderAPI.cpp index 2c5dc6880329..9007d8b9c125 100644 --- a/gfx/webrender_bindings/WebRenderAPI.cpp +++ b/gfx/webrender_bindings/WebRenderAPI.cpp @@ -169,9 +169,8 @@ void TransactionBuilder::SetDisplayList( wr::WrPipelineId pipeline_id, const wr::LayoutSize& content_size, wr::BuiltDisplayListDescriptor dl_descriptor, wr::Vec& dl_data) { wr_transaction_set_display_list(mTxn, aEpoch, ToColorF(aBgColor), - aViewportSize, - pipeline_id, content_size, dl_descriptor, - &dl_data.inner); + aViewportSize, pipeline_id, content_size, + dl_descriptor, &dl_data.inner); } void TransactionBuilder::ClearDisplayList(Epoch aEpoch, diff --git a/gfx/webrender_bindings/WebRenderTypes.h b/gfx/webrender_bindings/WebRenderTypes.h index 0207b6be8f08..3e4d2758b1e3 100644 --- a/gfx/webrender_bindings/WebRenderTypes.h +++ b/gfx/webrender_bindings/WebRenderTypes.h @@ -61,29 +61,29 @@ struct ExternalImageKeyPair { /* Generate a brand new window id and return it. */ WindowId NewWindowId(); -MOZ_DEFINE_ENUM_CLASS_WITH_BASE(RenderRoot, uint8_t, ( - // The default render root - within the parent process, this refers - // to everything within the top chrome area (urlbar, tab strip, etc.). - // Within the content process, this refers to the content area. Any - // system that multiplexes data streams from different processes is - // responsible for converting RenderRoot::Default into - // RenderRoot::Content (or whatever value is appropriate) - Default, +MOZ_DEFINE_ENUM_CLASS_WITH_BASE( + RenderRoot, uint8_t, + ( + // The default render root - within the parent process, this refers + // to everything within the top chrome area (urlbar, tab strip, etc.). + // Within the content process, this refers to the content area. Any + // system that multiplexes data streams from different processes is + // responsible for converting RenderRoot::Default into + // RenderRoot::Content (or whatever value is appropriate) + Default, - // Everything below the chrome - even if it is not coming from a content - // process. For example. the devtools, sidebars, and status panel are - // traditionally part of the "chrome," but are assigned a renderroot of - // RenderRoot::Content because they occupy screen space in the "content" - // area of the browser (visually situated below the "chrome" area). - Content -)); + // Everything below the chrome - even if it is not coming from a content + // process. For example. the devtools, sidebars, and status panel are + // traditionally part of the "chrome," but are assigned a renderroot of + // RenderRoot::Content because they occupy screen space in the "content" + // area of the browser (visually situated below the "chrome" area). + Content)); typedef EnumSet RenderRootSet; // For simple iteration of all render roots -const Array kRenderRoots( - RenderRoot::Default, - RenderRoot::Content); +const Array kRenderRoots(RenderRoot::Default, + RenderRoot::Content); const Array kNonDefaultRenderRoots( RenderRoot::Content); @@ -91,12 +91,13 @@ const Array kNonDefaultRenderRoots( template class RenderRootArray : public Array { typedef Array Super; + public: RenderRootArray() { if (IsPod::value) { // Ensure primitive types get initialized to 0/false. PodArrayZero(*this); - } // else C++ will default-initialize the array elements for us + } // else C++ will default-initialize the array elements for us } T& operator[](wr::RenderRoot aIndex) { @@ -114,6 +115,7 @@ class RenderRootArray : public Array { template class NonDefaultRenderRootArray : public Array { typedef Array Super; + public: NonDefaultRenderRootArray() { // See RenderRootArray constructor From 498b71e5e954b790a691495f456238265de5804c Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Fri, 29 Mar 2019 23:42:18 -0700 Subject: [PATCH 2/7] No bug - clang-format -p dom/canvas --- dom/canvas/WebGLContextBuffers.cpp | 6 ++++-- dom/canvas/WebGLContextExtensions.cpp | 9 +++----- dom/canvas/WebGLExtensionTextureFloat.cpp | 3 ++- dom/canvas/WebGLTypes.h | 25 +++++++++++++---------- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/dom/canvas/WebGLContextBuffers.cpp b/dom/canvas/WebGLContextBuffers.cpp index 7eaebe09b587..6829bc57d1eb 100644 --- a/dom/canvas/WebGLContextBuffers.cpp +++ b/dom/canvas/WebGLContextBuffers.cpp @@ -304,12 +304,14 @@ void WebGLContext::BufferData(GLenum target, WebGLsizeiptr size, GLenum usage) { //// const auto checkedSize = CheckedInt(size); - if (!checkedSize.isValid()) return ErrorOutOfMemory("size too large for platform."); + if (!checkedSize.isValid()) + return ErrorOutOfMemory("size too large for platform."); const UniqueBuffer zeroBuffer(calloc(checkedSize.value(), 1u)); if (!zeroBuffer) return ErrorOutOfMemory("Failed to allocate zeros."); - BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(), usage); + BufferDataImpl(target, checkedSize.value(), (const uint8_t*)zeroBuffer.get(), + usage); } void WebGLContext::BufferData(GLenum target, diff --git a/dom/canvas/WebGLContextExtensions.cpp b/dom/canvas/WebGLContextExtensions.cpp index 8d2ea967445b..c3ba40fcb0a2 100644 --- a/dom/canvas/WebGLContextExtensions.cpp +++ b/dom/canvas/WebGLContextExtensions.cpp @@ -284,15 +284,13 @@ void WebGLContext::GetExtension(JSContext* cx, const nsAString& wideName, // Step 4: Enable any implied extensions. switch (ext) { case WebGLExtensionID::EXT_color_buffer_float: - EnableSupportedExtension(callerType, - WebGLExtensionID::EXT_float_blend); + EnableSupportedExtension(callerType, WebGLExtensionID::EXT_float_blend); break; case WebGLExtensionID::OES_texture_float: EnableSupportedExtension(callerType, WebGLExtensionID::WEBGL_color_buffer_float); - EnableSupportedExtension(callerType, - WebGLExtensionID::EXT_float_blend); + EnableSupportedExtension(callerType, WebGLExtensionID::EXT_float_blend); break; case WebGLExtensionID::OES_texture_half_float: @@ -301,8 +299,7 @@ void WebGLContext::GetExtension(JSContext* cx, const nsAString& wideName, break; case WebGLExtensionID::WEBGL_color_buffer_float: - EnableSupportedExtension(callerType, - WebGLExtensionID::EXT_float_blend); + EnableSupportedExtension(callerType, WebGLExtensionID::EXT_float_blend); break; default: diff --git a/dom/canvas/WebGLExtensionTextureFloat.cpp b/dom/canvas/WebGLExtensionTextureFloat.cpp index 7b03bc97d014..528958f984e1 100644 --- a/dom/canvas/WebGLExtensionTextureFloat.cpp +++ b/dom/canvas/WebGLExtensionTextureFloat.cpp @@ -42,7 +42,8 @@ WebGLExtensionTextureFloat::WebGLExtensionTextureFloat(WebGLContext* webgl) dui = {pi.format, pi.format, pi.type}; swizzle = nullptr; if (needsSizedFormat || - gl->IsExtensionSupported(gl::GLContext::CHROMIUM_color_buffer_float_rgba)) { + gl->IsExtensionSupported( + gl::GLContext::CHROMIUM_color_buffer_float_rgba)) { dui.internalFormat = LOCAL_GL_RGBA32F; } fnAdd(webgl::EffectiveFormat::RGBA32F); diff --git a/dom/canvas/WebGLTypes.h b/dom/canvas/WebGLTypes.h index fdf0f38a6b63..aeb1015d9d96 100644 --- a/dom/canvas/WebGLTypes.h +++ b/dom/canvas/WebGLTypes.h @@ -25,20 +25,22 @@ class GLContext; // This is going to be needed a lot. } // namespace gl // - -// Prevent implicit conversions into calloc and malloc. (mozilla namespace only!) +// Prevent implicit conversions into calloc and malloc. (mozilla namespace +// only!) -template -class ForbidNarrowing final -{ +template +class ForbidNarrowing final { DestT mVal; -public: - template + public: + template MOZ_IMPLICIT ForbidNarrowing(SrcT val) : mVal(val) { - static_assert(std::numeric_limits::min() >= std::numeric_limits::min(), - "SrcT must be narrower than DestT."); - static_assert(std::numeric_limits::max() <= std::numeric_limits::max(), - "SrcT must be narrower than DestT."); + static_assert( + std::numeric_limits::min() >= std::numeric_limits::min(), + "SrcT must be narrower than DestT."); + static_assert( + std::numeric_limits::max() <= std::numeric_limits::max(), + "SrcT must be narrower than DestT."); } explicit operator DestT() const { return mVal; } @@ -48,7 +50,8 @@ inline void* malloc(const ForbidNarrowing s) { return ::malloc(size_t(s)); } -inline void* calloc(const ForbidNarrowing n, const ForbidNarrowing size) { +inline void* calloc(const ForbidNarrowing n, + const ForbidNarrowing size) { return ::calloc(size_t(n), size_t(size)); } From 112e44b69e1d9fca4c84ce827e5afde535b6473f Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Fri, 29 Mar 2019 23:42:40 -0700 Subject: [PATCH 3/7] No bug - clang-format -p mfbt --- mfbt/BufferList.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mfbt/BufferList.h b/mfbt/BufferList.h index 99e6ead4aea4..1a2fe8eeb37a 100644 --- a/mfbt/BufferList.h +++ b/mfbt/BufferList.h @@ -399,7 +399,8 @@ class BufferList : private AllocPolicy { }; template -MOZ_MUST_USE bool BufferList::WriteBytes(const char* aData, size_t aSize) { +MOZ_MUST_USE bool BufferList::WriteBytes(const char* aData, + size_t aSize) { MOZ_RELEASE_ASSERT(mOwning); MOZ_RELEASE_ASSERT(mStandardCapacity); From 3c1f379bd84d892dfa444a58662f9bd44407e7dd Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Fri, 29 Mar 2019 18:23:36 +0100 Subject: [PATCH 4/7] Bug 1540195 - Call InitAndRestoreFrame to ensure we have the parent setup correctly before calling SetInitialSingleChild. r=TYLin Differential Revision: https://phabricator.services.mozilla.com/D25430 --HG-- extra : rebase_source : 5028a617be06dc0668edd92ee8410790200ec0ad --- layout/base/nsCSSFrameConstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 12ab3e5fe931..684375430978 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -10766,7 +10766,6 @@ nsContainerFrame* nsCSSFrameConstructor::BeginBuildingColumns( nsContainerFrame* columnSetFrame = NS_NewColumnSetFrame( mPresShell, aComputedStyle, nsFrameState(NS_FRAME_OWNS_ANON_BOXES)); InitAndRestoreFrame(aState, aContent, aParentFrame, columnSetFrame); - SetInitialSingleChild(columnSetFrame, aColumnContent); RefPtr anonBlockStyle = mPresShell->StyleSet()->ResolveInheritingAnonymousBoxStyle( @@ -10774,6 +10773,7 @@ nsContainerFrame* nsCSSFrameConstructor::BeginBuildingColumns( aColumnContent->SetComputedStyleWithoutNotification(anonBlockStyle); InitAndRestoreFrame(aState, aContent, columnSetFrame, aColumnContent); + SetInitialSingleChild(columnSetFrame, aColumnContent); return columnSetFrame; } From 8166e097750b1ea2e146913bc9d4d80b932624e6 Mon Sep 17 00:00:00 2001 From: Mats Palmgren Date: Fri, 29 Mar 2019 18:34:17 +0100 Subject: [PATCH 5/7] Bug 1540198 - [DEBUG] Assert that the child frames have the correct parent pointer in SetInitialChildList. r=TYLin Differential Revision: https://phabricator.services.mozilla.com/D25434 --HG-- extra : rebase_source : defd00e62dc90e316cb12c67521951a1e5892489 --- layout/forms/nsComboboxControlFrame.cpp | 5 +++++ layout/generic/nsAbsoluteContainingBlock.cpp | 3 +++ layout/generic/nsContainerFrame.cpp | 3 +++ layout/tables/nsTableColGroupFrame.cpp | 5 +++++ layout/tables/nsTableFrame.cpp | 5 +++++ layout/tables/nsTableWrapperFrame.cpp | 6 ++++++ layout/xul/nsMenuFrame.cpp | 5 +++++ 7 files changed, 32 insertions(+) diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 77e65281637e..18badcd7002e 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -1338,6 +1338,11 @@ void nsComboboxControlFrame::GetChildLists(nsTArray* aLists) const { void nsComboboxControlFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) { +#ifdef DEBUG + for (nsIFrame* f : aChildList) { + MOZ_ASSERT(f->GetParent() == this, "Unexpected parent"); + } +#endif if (kSelectPopupList == aListID) { mPopupFrames.SetFrames(aChildList); } else { diff --git a/layout/generic/nsAbsoluteContainingBlock.cpp b/layout/generic/nsAbsoluteContainingBlock.cpp index d210db1f8777..a2612c94e7a8 100644 --- a/layout/generic/nsAbsoluteContainingBlock.cpp +++ b/layout/generic/nsAbsoluteContainingBlock.cpp @@ -49,6 +49,9 @@ void nsAbsoluteContainingBlock::SetInitialChildList(nsIFrame* aDelegatingFrame, MOZ_ASSERT(mChildListID == aListID, "unexpected child list name"); #ifdef DEBUG nsFrame::VerifyDirtyBitSet(aChildList); + for (nsIFrame* f : aChildList) { + MOZ_ASSERT(f->GetParent() == aDelegatingFrame, "Unexpected parent"); + } #endif mAbsoluteFrames.SetFrames(aChildList); } diff --git a/layout/generic/nsContainerFrame.cpp b/layout/generic/nsContainerFrame.cpp index a27679c28e3c..00c48ca21210 100644 --- a/layout/generic/nsContainerFrame.cpp +++ b/layout/generic/nsContainerFrame.cpp @@ -65,6 +65,9 @@ void nsContainerFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) { #ifdef DEBUG nsFrame::VerifyDirtyBitSet(aChildList); + for (nsIFrame* f : aChildList) { + MOZ_ASSERT(f->GetParent() == this, "Unexpected parent"); + } #endif if (aListID == kPrincipalList) { MOZ_ASSERT(mFrames.IsEmpty(), diff --git a/layout/tables/nsTableColGroupFrame.cpp b/layout/tables/nsTableColGroupFrame.cpp index 72b5d505b5b0..5e474e915fa9 100644 --- a/layout/tables/nsTableColGroupFrame.cpp +++ b/layout/tables/nsTableColGroupFrame.cpp @@ -114,6 +114,11 @@ void nsTableColGroupFrame::SetInitialChildList(ChildListID aListID, MOZ_ASSERT(mFrames.IsEmpty(), "unexpected second call to SetInitialChildList"); MOZ_ASSERT(aListID == kPrincipalList, "unexpected child list"); +#ifdef DEBUG + for (nsIFrame* f : aChildList) { + MOZ_ASSERT(f->GetParent() == this, "Unexpected parent"); + } +#endif if (aChildList.IsEmpty()) { GetTableFrame()->AppendAnonymousColFrames(this, GetSpan(), eColAnonymousColGroup, false); diff --git a/layout/tables/nsTableFrame.cpp b/layout/tables/nsTableFrame.cpp index d498ca721d9b..833f6708578a 100644 --- a/layout/tables/nsTableFrame.cpp +++ b/layout/tables/nsTableFrame.cpp @@ -314,6 +314,11 @@ void nsTableFrame::SetInitialChildList(ChildListID aListID, MOZ_ASSERT(mFrames.IsEmpty() && mColGroups.IsEmpty(), "unexpected second call to SetInitialChildList"); +#ifdef DEBUG + for (nsIFrame* f : aChildList) { + MOZ_ASSERT(f->GetParent() == this, "Unexpected parent"); + } +#endif // XXXbz the below code is an icky cesspit that's only needed in its current // form for two reasons: diff --git a/layout/tables/nsTableWrapperFrame.cpp b/layout/tables/nsTableWrapperFrame.cpp index d630657674bb..611e1da5dbf9 100644 --- a/layout/tables/nsTableWrapperFrame.cpp +++ b/layout/tables/nsTableWrapperFrame.cpp @@ -82,6 +82,12 @@ void nsTableWrapperFrame::GetChildLists(nsTArray* aLists) const { void nsTableWrapperFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) { if (kCaptionList == aListID) { +#ifdef DEBUG + nsFrame::VerifyDirtyBitSet(aChildList); + for (nsIFrame* f : aChildList) { + MOZ_ASSERT(f->GetParent() == this, "Unexpected parent"); + } +#endif // the frame constructor already checked for table-caption display type MOZ_ASSERT(mCaptionFrames.IsEmpty(), "already have child frames in CaptionList"); diff --git a/layout/xul/nsMenuFrame.cpp b/layout/xul/nsMenuFrame.cpp index af12c65b0315..0d778cbb2d15 100644 --- a/layout/xul/nsMenuFrame.cpp +++ b/layout/xul/nsMenuFrame.cpp @@ -269,6 +269,11 @@ void nsMenuFrame::SetInitialChildList(ChildListID aListID, nsFrameList& aChildList) { if (aListID == kPrincipalList || aListID == kPopupList) { NS_ASSERTION(!HasPopup(), "SetInitialChildList called twice?"); +#ifdef DEBUG + for (nsIFrame* f : aChildList) { + MOZ_ASSERT(f->GetParent() == this, "Unexpected parent"); + } +#endif SetPopupFrame(aChildList); } nsBoxFrame::SetInitialChildList(aListID, aChildList); From e1e112a4ad254bca2a70ce1ead59329eaaad7677 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Fri, 29 Mar 2019 17:52:14 +0200 Subject: [PATCH 6/7] Bug 1540166, avoid some useless ForgetSkippable handling while we're already dealing with snow-white objects, r=mccr8 Differential Revision: https://phabricator.services.mozilla.com/D25414 --HG-- extra : rebase_source : 3acdc1a8de8f6d729971527e6cbe9fd58cdc4610 --- xpcom/base/nsCycleCollector.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp index 957260ba57ac..6a39baea9b1c 100644 --- a/xpcom/base/nsCycleCollector.cpp +++ b/xpcom/base/nsCycleCollector.cpp @@ -2629,6 +2629,10 @@ void nsCycleCollector::ForgetSkippable(js::SliceBudget& aBudget, bool aAsyncSnowWhiteFreeing) { CheckThreadSafety(); + if (mFreeingSnowWhite) { + return; + } + mozilla::Maybe marker; if (NS_IsMainThread()) { marker.emplace("nsCycleCollector::ForgetSkippable", From baf08a736caafa9c6837e21c7c46b8c0262835ac Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Sat, 30 Mar 2019 11:32:42 -0400 Subject: [PATCH 7/7] Bug 1393681: Drop unnecessary arguments in Cocoa nsFilePicker functions. r=mstange --- widget/cocoa/nsFilePicker.h | 9 ++++--- widget/cocoa/nsFilePicker.mm | 46 ++++++++++++++---------------------- 2 files changed, 22 insertions(+), 33 deletions(-) diff --git a/widget/cocoa/nsFilePicker.h b/widget/cocoa/nsFilePicker.h index 9c9d3a04f652..8870ebc53d8f 100644 --- a/widget/cocoa/nsFilePicker.h +++ b/widget/cocoa/nsFilePicker.h @@ -52,10 +52,9 @@ class nsFilePicker : public nsBaseFilePicker { // aFile is an existing but unspecified file. These functions must specify it. // // will return |returnCancel| or |returnOK| as result. - int16_t GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, - nsCOMArray& outFiles); - int16_t GetLocalFolder(const nsString& inTitle, nsIFile** outFile); - int16_t PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, nsIFile** outFile); + int16_t GetLocalFiles(bool inAllowMultiple, nsCOMArray& outFiles); + int16_t GetLocalFolder(nsIFile** outFile); + int16_t PutLocalFile(nsIFile** outFile); void SetDialogTitle(const nsString& inTitle, id aDialog); NSString* PanelDefaultDirectory(); @@ -63,7 +62,7 @@ class nsFilePicker : public nsBaseFilePicker { nsString mTitle; nsCOMArray mFiles; - nsString mDefault; + nsString mDefaultFilename; nsTArray mFilters; nsTArray mTitles; diff --git a/widget/cocoa/nsFilePicker.mm b/widget/cocoa/nsFilePicker.mm index 2dee061890e1..0d00e3200048 100644 --- a/widget/cocoa/nsFilePicker.mm +++ b/widget/cocoa/nsFilePicker.mm @@ -190,34 +190,26 @@ nsresult nsFilePicker::Show(int16_t* retval) { int16_t userClicksOK = returnCancel; - // Random questions from DHH: - // - // Why do we pass mTitle, mDefault to the functions? Can GetLocalFile. PutLocalFile, - // and GetLocalFolder get called someplace else? It generates a bunch of warnings - // as it is right now. - // - // I think we could easily combine GetLocalFile and GetLocalFolder together, just - // setting panel pick options based on mMode. I didn't do it here b/c I wanted to - // make this look as much like Carbon nsFilePicker as possible. - mFiles.Clear(); nsCOMPtr theFile; + // Note that GetLocalFolder shares a lot of code with GetLocalFiles. + // Could combine the functions and just pass the mode in. switch (mMode) { case modeOpen: - userClicksOK = GetLocalFiles(mTitle, false, mFiles); + userClicksOK = GetLocalFiles(false, mFiles); break; case modeOpenMultiple: - userClicksOK = GetLocalFiles(mTitle, true, mFiles); + userClicksOK = GetLocalFiles(true, mFiles); break; case modeSave: - userClicksOK = PutLocalFile(mTitle, mDefault, getter_AddRefs(theFile)); + userClicksOK = PutLocalFile(getter_AddRefs(theFile)); break; case modeGetFolder: - userClicksOK = GetLocalFolder(mTitle, getter_AddRefs(theFile)); + userClicksOK = GetLocalFolder(getter_AddRefs(theFile)); break; default: @@ -266,8 +258,7 @@ static void UpdatePanelFileTypes(NSOpenPanel* aPanel, NSArray* aFilters) { @end // Use OpenPanel to do a GetFile. Returns |returnOK| if the user presses OK in the dialog. -int16_t nsFilePicker::GetLocalFiles(const nsString& inTitle, bool inAllowMultiple, - nsCOMArray& outFiles) { +int16_t nsFilePicker::GetLocalFiles(bool inAllowMultiple, nsCOMArray& outFiles) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; int16_t retVal = (int16_t)returnCancel; @@ -276,12 +267,12 @@ int16_t nsFilePicker::GetLocalFiles(const nsString& inTitle, bool inAllowMultipl SetShowHiddenFileState(thePanel); // Set the options for how the get file dialog will appear - SetDialogTitle(inTitle, thePanel); + SetDialogTitle(mTitle, thePanel); [thePanel setAllowsMultipleSelection:inAllowMultiple]; [thePanel setCanSelectHiddenExtension:YES]; [thePanel setCanChooseDirectories:NO]; [thePanel setCanChooseFiles:YES]; - [thePanel setResolvesAliases:YES]; // this is default - probably doesn't need to be set + [thePanel setResolvesAliases:YES]; // Get filters // filters may be null, if we should allow all file types. @@ -366,7 +357,7 @@ int16_t nsFilePicker::GetLocalFiles(const nsString& inTitle, bool inAllowMultipl } // Use OpenPanel to do a GetFolder. Returns |returnOK| if the user presses OK in the dialog. -int16_t nsFilePicker::GetLocalFolder(const nsString& inTitle, nsIFile** outFile) { +int16_t nsFilePicker::GetLocalFolder(nsIFile** outFile) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; NS_ASSERTION(outFile, "this protected member function expects a null initialized out pointer"); @@ -376,12 +367,12 @@ int16_t nsFilePicker::GetLocalFolder(const nsString& inTitle, nsIFile** outFile) SetShowHiddenFileState(thePanel); // Set the options for how the get file dialog will appear - SetDialogTitle(inTitle, thePanel); - [thePanel setAllowsMultipleSelection:NO]; // this is default -probably doesn't need to be set + SetDialogTitle(mTitle, thePanel); + [thePanel setAllowsMultipleSelection:NO]; [thePanel setCanSelectHiddenExtension:YES]; [thePanel setCanChooseDirectories:YES]; [thePanel setCanChooseFiles:NO]; - [thePanel setResolvesAliases:YES]; // this is default - probably doesn't need to be set + [thePanel setResolvesAliases:YES]; [thePanel setCanCreateDirectories:YES]; // packages != folders @@ -417,8 +408,7 @@ int16_t nsFilePicker::GetLocalFolder(const nsString& inTitle, nsIFile** outFile) } // Returns |returnOK| if the user presses OK in the dialog. -int16_t nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultName, - nsIFile** outFile) { +int16_t nsFilePicker::PutLocalFile(nsIFile** outFile) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; NS_ASSERTION(outFile, "this protected member function expects a null initialized out pointer"); @@ -427,15 +417,15 @@ int16_t nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDe SetShowHiddenFileState(thePanel); - SetDialogTitle(inTitle, thePanel); + SetDialogTitle(mTitle, thePanel); // set up accessory view for file format options NSView* accessoryView = GetAccessoryView(); [thePanel setAccessoryView:accessoryView]; // set up default file name - NSString* defaultFilename = [NSString stringWithCharacters:(const unichar*)inDefaultName.get() - length:inDefaultName.Length()]; + NSString* defaultFilename = [NSString stringWithCharacters:(const unichar*)mDefaultFilename.get() + length:mDefaultFilename.Length()]; // Set up the allowed type. This prevents the extension from being selected. NSString* extension = defaultFilename.pathExtension; @@ -609,7 +599,7 @@ NS_IMETHODIMP nsFilePicker::GetFiles(nsISimpleEnumerator** aFiles) { } NS_IMETHODIMP nsFilePicker::SetDefaultString(const nsAString& aString) { - mDefault = aString; + mDefaultFilename = aString; return NS_OK; }