Bug 1397375 - Part3. Remove the related webrender user data when destroying a frame. r=jrmuizel draft
authorEthan Lin <ethlin@mozilla.com>
Mon, 11 Sep 2017 17:58:26 +0800
changeset 662294 61cddc8f6390acb03a8db4a04511e607d28473a2
parent 662293 fbf34a12545ea0f3724ab2bf9f89c4b5ca7e4b31
child 730805 ec7c4822dbe55b8ac173eba21847090359ddca58
push id79015
push userbmo:ethlin@mozilla.com
push dateMon, 11 Sep 2017 09:59:00 +0000
reviewersjrmuizel
bugs1397375
milestone57.0a1
Bug 1397375 - Part3. Remove the related webrender user data when destroying a frame. r=jrmuizel MozReview-Commit-ID: IYjfqWiiPZ
layout/painting/FrameLayerBuilder.cpp
--- a/layout/painting/FrameLayerBuilder.cpp
+++ b/layout/painting/FrameLayerBuilder.cpp
@@ -1933,16 +1933,25 @@ GetTranslationForPaintedLayer(PaintedLay
 
 /* static */ void
 FrameLayerBuilder::RemoveFrameFromLayerManager(const nsIFrame* aFrame,
                                                SmallPointerArray<DisplayItemData>& aArray)
 {
   MOZ_RELEASE_ASSERT(!sDestroyedFrame);
   sDestroyedFrame = aFrame;
 
+  // For layers-free mode, we should remove the webrender user data from the frame.
+  if (aFrame->HasProperty(nsIFrame::WebRenderUserDataProperty())) {
+    nsIFrame::WebRenderUserDataTable* userDataTable =
+      aFrame->GetProperty(nsIFrame::WebRenderUserDataProperty());
+    for (auto iter = userDataTable->Iter(); !iter.Done(); iter.Next()) {
+      iter.UserData()->RemoveFromTable();
+    }
+  }
+
   // Hold a reference to all the items so that they don't get
   // deleted from under us.
   nsTArray<RefPtr<DisplayItemData> > arrayCopy;
   for (DisplayItemData* data : aArray) {
     arrayCopy.AppendElement(data);
   }
 
 #ifdef DEBUG_DISPLAY_ITEM_DATA