From 6118b38f499d3e695f56c60e1906bdade30ef453 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Thu, 20 Apr 2017 10:38:06 -0400 Subject: [PATCH] Bug 1357754 - Record the isFirstPaint flag in the WebRenderScrollData. r=jrmuizel MozReview-Commit-ID: KKiRBLRTfEj --- gfx/layers/wr/WebRenderLayerManager.cpp | 11 +++++++++-- gfx/layers/wr/WebRenderLayerManager.h | 2 ++ gfx/layers/wr/WebRenderScrollData.cpp | 13 +++++++++++++ gfx/layers/wr/WebRenderScrollData.h | 9 ++++++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/gfx/layers/wr/WebRenderLayerManager.cpp b/gfx/layers/wr/WebRenderLayerManager.cpp index b458e9148be3..c25495210c68 100644 --- a/gfx/layers/wr/WebRenderLayerManager.cpp +++ b/gfx/layers/wr/WebRenderLayerManager.cpp @@ -238,6 +238,7 @@ WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget) : mWidget(aWidget) , mLatestTransactionId(0) , mNeedsComposite(false) + , mIsFirstPaint(false) , mTarget(nullptr) { MOZ_COUNT_CTOR(WebRenderLayerManager); @@ -403,8 +404,14 @@ WebRenderLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback } WebRenderScrollData scrollData; - if (mRoot && mWidget->AsyncPanZoomEnabled()) { - PopulateScrollData(scrollData, mRoot.get()); + if (mWidget->AsyncPanZoomEnabled()) { + if (mIsFirstPaint) { + scrollData.SetIsFirstPaint(); + mIsFirstPaint = false; + } + if (mRoot) { + PopulateScrollData(scrollData, mRoot.get()); + } } bool sync = mTarget != nullptr; diff --git a/gfx/layers/wr/WebRenderLayerManager.h b/gfx/layers/wr/WebRenderLayerManager.h index 43e0eff15f71..9fd8989172f2 100644 --- a/gfx/layers/wr/WebRenderLayerManager.h +++ b/gfx/layers/wr/WebRenderLayerManager.h @@ -143,6 +143,7 @@ public: mNeedsComposite = aNeedsComposite; } virtual bool NeedsComposite() const override { return mNeedsComposite; } + virtual void SetIsFirstPaint() override { mIsFirstPaint = true; } DrawPaintedLayerCallback GetPaintedLayerCallback() const { return mPaintedLayerCallback; } @@ -212,6 +213,7 @@ private: bool mTransactionIncomplete; bool mNeedsComposite; + bool mIsFirstPaint; // When we're doing a transaction in order to draw to a non-default // target, the layers transaction is only performed in order to send diff --git a/gfx/layers/wr/WebRenderScrollData.cpp b/gfx/layers/wr/WebRenderScrollData.cpp index 7191afcc2112..05d3b86025ae 100644 --- a/gfx/layers/wr/WebRenderScrollData.cpp +++ b/gfx/layers/wr/WebRenderScrollData.cpp @@ -74,6 +74,7 @@ WebRenderLayerScrollData::GetScrollMetadata(const WebRenderScrollData& aOwner, } WebRenderScrollData::WebRenderScrollData() + : mIsFirstPaint(false) { } @@ -133,5 +134,17 @@ WebRenderScrollData::GetScrollMetadata(size_t aIndex) const return mScrollMetadatas[aIndex]; } +void +WebRenderScrollData::SetIsFirstPaint() +{ + mIsFirstPaint = true; +} + +bool +WebRenderScrollData::IsFirstPaint() const +{ + return mIsFirstPaint; +} + } // namespace layers } // namespace mozilla diff --git a/gfx/layers/wr/WebRenderScrollData.h b/gfx/layers/wr/WebRenderScrollData.h index 08b8f7609650..a3c1d82139a4 100644 --- a/gfx/layers/wr/WebRenderScrollData.h +++ b/gfx/layers/wr/WebRenderScrollData.h @@ -116,6 +116,9 @@ public: const ScrollMetadata& GetScrollMetadata(size_t aIndex) const; + void SetIsFirstPaint(); + bool IsFirstPaint() const; + friend struct IPC::ParamTraits; private: @@ -138,6 +141,8 @@ private: // descendants that layer had, which allows reconstructing the traversal on the // other side. nsTArray mLayerScrollData; + + bool mIsFirstPaint; }; } // namespace layers @@ -197,13 +202,15 @@ struct ParamTraits { WriteParam(aMsg, aParam.mScrollMetadatas); WriteParam(aMsg, aParam.mLayerScrollData); + WriteParam(aMsg, aParam.mIsFirstPaint); } static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) { return ReadParam(aMsg, aIter, &aResult->mScrollMetadatas) - && ReadParam(aMsg, aIter, &aResult->mLayerScrollData); + && ReadParam(aMsg, aIter, &aResult->mLayerScrollData) + && ReadParam(aMsg, aIter, &aResult->mIsFirstPaint); } };