Unset MayHaveWillChangeBudget draft
authorMiko Mynttinen <mikokm@gmail.com>
Thu, 24 Oct 2019 17:34:46 +0200
changeset 2396003 3a97d0ac0d70253b2dcd376916e9b0c56224f6f4
parent 2393949 c3e0675dc10f681dbfc5972a3d307debb1a33182
child 2396004 422b6f5f6e0245503693b8774706bd917120c72d
push id439668
push usermikokm@gmail.com
push dateThu, 24 Oct 2019 15:55:32 +0000
treeherdertry@422b6f5f6e02 [default view] [failures only]
milestone72.0a1
Unset MayHaveWillChangeBudget
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -2551,30 +2551,30 @@ bool nsDisplayListBuilder::IsInWillChang
 }
 
 void nsDisplayListBuilder::RemoveFromWillChangeBudget(nsIFrame* aFrame) {
   if (!aFrame->MayHaveWillChangeBudget()) {
     MOZ_ASSERT(!mFrameWillChangeBudgets.Contains(aFrame));
     return;
   }
 
-  FrameWillChangeBudget* frameBudget = mFrameWillChangeBudgets.GetValue(aFrame);
-
-  if (!frameBudget) {
-    return;
-  }
-
-  DocumentWillChangeBudget* documentBudget =
-      mDocumentWillChangeBudgets.GetValue(frameBudget->mPresContext);
-
-  if (documentBudget) {
-    *documentBudget -= frameBudget->mUsage;
-  }
-
-  mFrameWillChangeBudgets.Remove(aFrame);
+  aFrame->SetMayHaveWillChangeBudget(false);
+
+  if (auto entry = mFrameWillChangeBudgets.Lookup(aFrame)) {
+    const FrameWillChangeBudget& frameBudget = entry.Data();
+
+    DocumentWillChangeBudget* documentBudget =
+        mDocumentWillChangeBudgets.GetValue(frameBudget.mPresContext);
+
+    if (documentBudget) {
+      *documentBudget -= frameBudget.mUsage;
+    }
+
+    entry.Remove();
+  }
 }
 
 void nsDisplayListBuilder::ClearWillChangeBudget() {
   mFrameWillChangeBudgets.Clear();
   mDocumentWillChangeBudgets.Clear();
 }
 
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE