Bug 1404091 - In layers-free mode, we should do NotifyInvalidation after EndTransaction if there is any scheduled flush. r=kats

MozReview-Commit-ID: D0LNF0LgWYq

--HG--
extra : rebase_source : e005389de5d2b2b9e0a8ecf5b4de58ae7f9f21a9
This commit is contained in:
Ethan Lin 2017-10-03 16:00:38 +08:00
Родитель d8b5c6edce
Коммит 2a82b402b3
5 изменённых файлов: 12 добавлений и 30 удалений

Просмотреть файл

@ -42,7 +42,6 @@ WebRenderLayerManager::WebRenderLayerManager(nsIWidget* aWidget)
, mEndTransactionWithoutLayers(false)
, mTarget(nullptr)
, mPaintSequenceNumber(0)
, mShouldNotifyInvalidation(false)
{
MOZ_COUNT_CTOR(WebRenderLayerManager);
}
@ -332,14 +331,6 @@ WebRenderLayerManager::CreateWebRenderCommandsFromDisplayList(nsDisplayList* aDi
}
}
// If there is any invalid item, we should notify nsPresContext after EndTransaction.
if (!mShouldNotifyInvalidation) {
nsRect invalid;
if (item->IsInvalid(invalid)) {
mShouldNotifyInvalidation = true;
}
}
{ // scope the ScrollingLayersHelper
ScrollingLayersHelper clip(item, aBuilder, aSc, mClipIdCache, AsyncPanZoomEnabled());
@ -513,15 +504,8 @@ PaintItemByDrawTarget(nsDisplayItem* aItem,
aManager->SetRoot(layer);
layerBuilder->WillEndTransaction();
nsIntRegion invalid;
props->ComputeDifferences(layer, invalid, nullptr);
static_cast<nsDisplayFilter*>(aItem)->PaintAsLayer(aDisplayListBuilder,
context, aManager);
if (!invalid.IsEmpty()) {
aWrManager->SetNotifyInvalidation(true);
}
}
if (aManager->InTransaction()) {
@ -768,9 +752,6 @@ WebRenderLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback
wr::IpcResourceUpdateQueue resourceUpdates(WrBridge()->GetShmemAllocator());
if (mEndTransactionWithoutLayers) {
// Reset the notification flag at the begin of the EndTransaction.
mShouldNotifyInvalidation = false;
// aDisplayList being null here means this is an empty transaction following a layers-free
// transaction, so we reuse the previously built displaylist and scroll
// metadata information
@ -819,9 +800,6 @@ WebRenderLayerManager::EndTransactionInternal(DrawPaintedLayerCallback aCallback
for (auto iter = mLastCanvasDatas.Iter(); !iter.Done(); iter.Next()) {
RefPtr<WebRenderCanvasData> canvasData = iter.Get()->GetKey();
WebRenderCanvasRendererAsync* canvas = canvasData->GetCanvasRenderer();
if (canvas->IsDirty()) {
mShouldNotifyInvalidation = true;
}
canvas->UpdateCompositableClient();
}
}

Просмотреть файл

@ -246,9 +246,6 @@ public:
return res.forget();
}
bool ShouldNotifyInvalidation() const { return mShouldNotifyInvalidation; }
void SetNotifyInvalidation(bool aShouldNotifyInvalidation) { mShouldNotifyInvalidation = aShouldNotifyInvalidation; }
bool SetPendingScrollUpdateForNextTransaction(FrameMetrics::ViewID aScrollId,
const ScrollUpdateInfo& aUpdateInfo) override;
@ -388,10 +385,6 @@ private:
// Store of WebRenderCanvasData objects for use in empty transactions
CanvasDataSet mLastCanvasDatas;
// True if the layers-free transaction has invalidation region and then
// we should send notification after EndTransaction
bool mShouldNotifyInvalidation;
WebRenderUserDataRefTable mWebRenderUserDatas;
};

Просмотреть файл

@ -1201,6 +1201,7 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
mNeedToRecomputeVisibility(false),
mTestControllingRefreshes(false),
mViewManagerFlushIsPending(false),
mHasScheduleFlush(false),
mInRefresh(false),
mWaitingForTransaction(false),
mSkippedPaints(false),
@ -2095,6 +2096,7 @@ nsRefreshDriver::Tick(int64_t aNowEpoch, TimeStamp aNowTime)
}
dispatchRunnablesAfterTick = true;
mHasScheduleFlush = false;
}
#ifndef ANDROID /* bug 1142079 */
@ -2368,6 +2370,7 @@ nsRefreshDriver::ScheduleViewManagerFlush()
NS_ASSERTION(mPresContext->IsRoot(),
"Should only schedule view manager flush on root prescontexts");
mViewManagerFlushIsPending = true;
mHasScheduleFlush = true;
EnsureTimerStarted(eNeverAdjustTimer);
}

Просмотреть файл

@ -217,6 +217,9 @@ public:
bool ViewManagerFlushIsPending() {
return mViewManagerFlushIsPending;
}
bool HasScheduleFlush() {
return mHasScheduleFlush;
}
/**
* Add a document for which we have FrameRequestCallbacks
@ -442,6 +445,11 @@ private:
bool mNeedToRecomputeVisibility;
bool mTestControllingRefreshes;
bool mViewManagerFlushIsPending;
// True if the view manager needs a flush. Layers-free mode uses this value
// to know when to notify invalidation.
bool mHasScheduleFlush;
bool mInRefresh;
// True if the refresh driver is suspended waiting for transaction

Просмотреть файл

@ -2187,7 +2187,7 @@ already_AddRefed<LayerManager> nsDisplayList::PaintRoot(nsDisplayListBuilder* aB
TriggerPendingAnimations(document, layerManager->GetAnimationReadyTime());
}
if (wrManager->ShouldNotifyInvalidation()) {
if (presContext->RefreshDriver()->HasScheduleFlush()) {
presContext->NotifyInvalidation(layerManager->GetLastTransactionId(), nsIntRect());
}