Merge mozilla-central to autoland. CLOSED TREE
authorCsoregi Natalia <ncsoregi@mozilla.com>
Mon, 15 Apr 2019 18:27:25 +0300
changeset 469506 85aec9a8e154
parent 469505 1fcd483102a0 (current diff)
parent 469488 16d953cca414 (diff)
child 469507 d0ca7b557e0f
push id35873
push userccoroiu@mozilla.com
push dateMon, 15 Apr 2019 21:36:26 +0000
treeherdermozilla-central@b8f49a14c458 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to autoland. CLOSED TREE
--- a/layout/generic/TextOverflow.cpp
+++ b/layout/generic/TextOverflow.cpp
@@ -213,17 +213,17 @@ static void PaintTextShadowCallback(gfxC
                                     const nscolor& aShadowColor, void* aData) {
   reinterpret_cast<nsDisplayTextOverflowMarker*>(aData)->PaintTextToContext(
       aCtx, aShadowOffset);
 }
 
 void nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
                                         gfxContext* aCtx) {
   DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
-                                                    IsSubpixelAADisabled());
+                                                    mDisableSubpixelAA);
 
   nscolor foregroundColor =
       nsLayoutUtils::GetColor(mFrame, &nsStyleText::mWebkitTextFillColor);
 
   // Paint the text-shadows for the overflow marker
   nsLayoutUtils::PaintTextShadow(mFrame, aCtx, mRect, GetPaintRect(),
                                  foregroundColor, PaintTextShadowCallback,
                                  (void*)this);
--- a/layout/generic/ViewportFrame.cpp
+++ b/layout/generic/ViewportFrame.cpp
@@ -101,21 +101,18 @@ static void BuildDisplayListForTopLayerF
     // root scroll frame.
     clipState.SetClipChainForContainingBlockDescendants(
         savedOutOfFlowData->mCombinedClipChain);
     clipState.ClipContainingBlockDescendantsExtra(
         visible + aBuilder->ToReferenceFrame(aFrame), nullptr);
     asrSetter.SetCurrentActiveScrolledRoot(
         savedOutOfFlowData->mContainingBlockActiveScrolledRoot);
   }
-  // This function jumps into random frames that may not be descendants of
-  // aBuilder->mCurrentFrame, so aBuilder->mInInvalidSubtree is unrelated.
-  // Request recalculation of mInInvalidSubtree.
   nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
-      aBuilder, aFrame, visible, dirty, nsDisplayListBuilder::RIIS_YES);
+      aBuilder, aFrame, visible, dirty);
 
   nsDisplayList list;
   aFrame->BuildDisplayListForStackingContext(aBuilder, &list);
   aList->AppendToTop(&list);
 }
 
 void ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
                                                 nsDisplayList* aList) {
@@ -151,20 +148,18 @@ void ViewportFrame::BuildDisplayListForT
               frame->GetChildList(kBackdropList).FirstChild()) {
         MOZ_ASSERT(backdropPh->IsPlaceholderFrame());
         MOZ_ASSERT(!backdropPh->GetNextSibling(), "more than one ::backdrop?");
         MOZ_ASSERT(backdropPh->HasAnyStateBits(NS_FRAME_FIRST_REFLOW),
                    "did you intend to reflow ::backdrop placeholders?");
         nsIFrame* backdropFrame =
             static_cast<nsPlaceholderFrame*>(backdropPh)->GetOutOfFlowFrame();
         MOZ_ASSERT(backdropFrame);
-
         BuildDisplayListForTopLayerFrame(aBuilder, backdropFrame, aList);
       }
-
       BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
     }
   }
 
   if (nsCanvasFrame* canvasFrame = PresShell()->GetCanvasFrame()) {
     if (Element* container = canvasFrame->GetCustomContentContainer()) {
       if (nsIFrame* frame = container->GetPrimaryFrame()) {
         MOZ_ASSERT(frame->StyleDisplay()->mTopLayer != NS_STYLE_TOP_LAYER_NONE,
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -641,17 +641,17 @@ bool nsDisplayBullet::CreateWebRenderCom
 
 void nsDisplayBullet::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
   uint32_t flags = imgIContainer::FLAG_NONE;
   if (aBuilder->ShouldSyncDecodeImages()) {
     flags |= imgIContainer::FLAG_SYNC_DECODE;
   }
 
   ImgDrawResult result = static_cast<nsBulletFrame*>(mFrame)->PaintBullet(
-      *aCtx, ToReferenceFrame(), GetPaintRect(), flags, IsSubpixelAADisabled());
+      *aCtx, ToReferenceFrame(), GetPaintRect(), flags, mDisableSubpixelAA);
 
   nsDisplayBulletGeometry::UpdateDrawResult(this, result);
 }
 
 void nsBulletFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
                                      const nsDisplayListSet& aLists) {
   if (!IsVisibleForPainting()) return;
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3802,25 +3802,18 @@ void nsIFrame::BuildDisplayListForChild(
        IsSVGContentWithCSSClip(child))) {
     pseudoStackingContext = true;
     awayFromCommonPath = true;
   }
 
   NS_ASSERTION(!isStackingContext || pseudoStackingContext,
                "Stacking contexts must also be pseudo-stacking-contexts");
 
-  // nsBlockFrame paints pushed floats directly, rather than through their
-  // placeholder, which is why we force a recallculation of InInvalidSubtree
-  // state.
-  auto recalcInInvalidSubtree =
-      (child->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT)
-          ? nsDisplayListBuilder::RIIS_YES
-          : nsDisplayListBuilder::RIIS_NO;
   nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
-      aBuilder, child, visible, dirty, recalcInInvalidSubtree);
+      aBuilder, child, visible, dirty);
   DisplayListClipState::AutoClipMultiple clipState(aBuilder);
   nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter asrSetter(aBuilder);
   CheckForApzAwareEventHandlers(aBuilder, child);
 
   if (savedOutOfFlowData) {
     aBuilder->SetBuildingInvisibleItems(false);
 
     clipState.SetClipChainForContainingBlockDescendants(
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3759,22 +3759,16 @@ void ScrollFrameHelper::BuildDisplayList
 
 void ScrollFrameHelper::MaybeAddTopLayerItems(nsDisplayListBuilder* aBuilder,
                                               const nsDisplayListSet& aLists) {
   if (mIsRoot) {
     if (ViewportFrame* viewportFrame = do_QueryFrame(mOuter->GetParent())) {
       nsDisplayList topLayerList;
       viewportFrame->BuildDisplayListForTopLayer(aBuilder, &topLayerList);
       if (!topLayerList.IsEmpty()) {
-        // This function jumps into random frames that may not be descendants of
-        // aBuilder->mCurrentFrame, so aBuilder->mInInvalidSubtree is unrelated.
-        // Request recalculation of mInInvalidSubtree.
-        nsDisplayListBuilder::AutoBuildingDisplayList buildingDisplayList(
-            aBuilder, viewportFrame, nsDisplayListBuilder::RIIS_YES);
-
         // Wrap the whole top layer in a single item with maximum z-index,
         // and append it at the very end, so that it stays at the topmost.
         nsDisplayWrapList* wrapList = MakeDisplayItem<nsDisplayWrapList>(
             aBuilder, viewportFrame, &topLayerList,
             aBuilder->CurrentActiveScrolledRoot(), false, 2);
         if (wrapList) {
           wrapList->SetOverrideZIndex(
               std::numeric_limits<decltype(wrapList->ZIndex())>::max());
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -452,17 +452,17 @@ class nsDisplayHeaderFooter final : publ
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      gfxContext* aCtx) override {
 #ifdef DEBUG
     nsPageFrame* pageFrame = do_QueryFrame(mFrame);
     MOZ_ASSERT(pageFrame, "We should have an nsPageFrame");
 #endif
     static_cast<nsPageFrame*>(mFrame)->PaintHeaderFooter(
-        *aCtx, ToReferenceFrame(), IsSubpixelAADisabled());
+        *aCtx, ToReferenceFrame(), mDisableSubpixelAA);
   }
   NS_DISPLAY_DECL_NAME("HeaderFooter", TYPE_HEADER_FOOTER)
 
   virtual nsRect GetComponentAlphaBounds(
       nsDisplayListBuilder* aBuilder) const override {
     bool snap;
     return GetBounds(aBuilder, &snap);
   }
@@ -519,22 +519,18 @@ void nsPageFrame::BuildDisplayList(nsDis
     // we don't have to process earlier pages. The display lists for
     // these extra pages are pruned so that only display items for the
     // page we currently care about (which we would have reached by
     // following placeholders to their out-of-flows) end up on the list.
     nsIFrame* page = child;
     while ((page = GetNextPage(page)) != nullptr) {
       nsRect childVisible = visibleRect + child->GetOffsetTo(page);
 
-      // This function jumps into random frames that may not be descendants of
-      // aBuilder->mCurrentFrame, so aBuilder->mInInvalidSubtree is unrelated.
-      // Request recalculation of mInInvalidSubtree.
       nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
-          aBuilder, page, childVisible, childVisible,
-          nsDisplayListBuilder::RIIS_YES);
+          aBuilder, page, childVisible, childVisible);
       BuildDisplayListForExtraPage(aBuilder, this, page, &content);
     }
 
     // Invoke AutoBuildingDisplayList to ensure that the correct visibleRect
     // is used to compute the visible rect if AddCanvasBackgroundColorItem
     // creates a display item.
     nsDisplayListBuilder::AutoBuildingDisplayList building(
         aBuilder, child, visibleRect, visibleRect);
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -430,25 +430,24 @@ void nsSubDocumentFrame::BuildDisplayLis
   bool constructZoomItem = subdocRootFrame && parentAPD != subdocAPD;
   bool needsOwnLayer = false;
   if (constructResolutionItem || constructZoomItem || haveDisplayPort ||
       presContext->IsRootContentDocument() ||
       (sf && sf->IsScrollingActive(aBuilder))) {
     needsOwnLayer = true;
   }
 
-  if (subdocRootFrame && aBuilder->IsRetainingDisplayList()) {
+  if (aBuilder->IsRetainingDisplayList()) {
     // Caret frame changed, rebuild the entire subdoc.
     // We could just invalidate the old and new frame
     // areas and save some work here. RetainedDisplayListBuilder
     // does this, so we could teach it to find and check all
     // subdocs in advance.
     if (mPreviousCaret != aBuilder->GetCaretFrame()) {
       dirty = visible;
-      aBuilder->MarkFrameModifiedDuringBuilding(subdocRootFrame);
       aBuilder->RebuildAllItemsInCurrentSubtree();
       // Mark the old caret frame as invalid so that we remove the
       // old nsDisplayCaret. We don't mark the current frame as invalid
       // since we want the nsDisplaySubdocument to retain it's place
       // in the retained display list.
       if (mPreviousCaret) {
         aBuilder->MarkFrameModifiedDuringBuilding(mPreviousCaret);
       }
--- a/layout/ipc/RenderFrame.cpp
+++ b/layout/ipc/RenderFrame.cpp
@@ -190,16 +190,21 @@ mozilla::LayerState nsDisplayRemote::Get
     nsDisplayListBuilder* aBuilder, LayerManager* aManager,
     const ContainerLayerParameters& aParameters) {
   if (IsTempLayerManager(aManager)) {
     return mozilla::LAYER_NONE;
   }
   return mozilla::LAYER_ACTIVE_FORCE;
 }
 
+bool nsDisplayRemote::HasDeletedFrame() const {
+  // RenderFrame might change without invalidating nsSubDocumentFrame.
+  return !GetFrameLoader() || nsDisplayItem::HasDeletedFrame();
+}
+
 already_AddRefed<Layer> nsDisplayRemote::BuildLayer(
     nsDisplayListBuilder* aBuilder, LayerManager* aManager,
     const ContainerLayerParameters& aContainerParameters) {
   MOZ_ASSERT(mFrame, "Makes no sense to have a shadow tree without a frame");
 
   if (IsTempLayerManager(aManager)) {
     // This can happen if aManager is a "temporary" manager, or if the
     // widget's layer manager changed out from under us.  We need to
--- a/layout/ipc/RenderFrame.h
+++ b/layout/ipc/RenderFrame.h
@@ -85,31 +85,31 @@ class RenderFrame final {
 }  // namespace layout
 }  // namespace mozilla
 
 /**
  * A nsDisplayRemote will graft a remote frame's shadow layer tree (for a given
  * nsFrameLoader) into its parent frame's layer tree.
  */
 class nsDisplayRemote final : public nsDisplayItem {
-  friend class nsDisplayItem;
-
   typedef mozilla::dom::TabId TabId;
   typedef mozilla::gfx::Matrix4x4 Matrix4x4;
   typedef mozilla::layers::EventRegionsOverride EventRegionsOverride;
   typedef mozilla::layers::Layer Layer;
   typedef mozilla::layers::LayersId LayersId;
   typedef mozilla::layers::RefLayer RefLayer;
   typedef mozilla::layout::RenderFrame RenderFrame;
   typedef mozilla::LayoutDeviceRect LayoutDeviceRect;
   typedef mozilla::LayoutDeviceIntPoint LayoutDeviceIntPoint;
 
  public:
   nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsSubDocumentFrame* aFrame);
 
+  bool HasDeletedFrame() const override;
+
   LayerState GetLayerState(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aParameters) override;
 
   already_AddRefed<Layer> BuildLayer(
       nsDisplayListBuilder* aBuilder, LayerManager* aManager,
       const ContainerLayerParameters& aContainerParameters) override;
 
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -136,20 +136,21 @@ bool RetainedDisplayListBuilder::PreProc
 
   MOZ_RELEASE_ASSERT(initializeDAG || aList->mDAG.Length() == aList->Count());
 
   nsDisplayList saved;
   aList->mOldItems.SetCapacity(aList->Count());
   MOZ_RELEASE_ASSERT(aList->mOldItems.IsEmpty());
   while (nsDisplayItem* item = aList->RemoveBottom()) {
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-    item->SetMergedPreProcessed(false, true);
+    item->mMergedItem = false;
+    item->mPreProcessedItem = true;
 #endif
 
-    if (!item->CanBeReused() || item->HasDeletedFrame()) {
+    if (item->HasDeletedFrame() || !item->CanBeReused()) {
       size_t i = aList->mOldItems.Length();
       aList->mOldItems.AppendElement(OldItemInfo(nullptr));
       item->Destroy(&mBuilder);
 
       if (initializeDAG) {
         if (i == 0) {
           aList->mDAG.AddNode(Span<const MergedListIndex>());
         } else {
@@ -208,32 +209,27 @@ void RetainedDisplayListBuilder::Increme
   MOZ_ASSERT(subDocFrame);
 
   nsIPresShell* presShell = subDocFrame->GetSubdocumentPresShellForPainting(0);
   MOZ_ASSERT(presShell);
 
   mBuilder.IncrementPresShellPaintCount(presShell);
 }
 
-bool AnyContentAncestorModified(nsIFrame* aFrame, nsIFrame* aStopAtFrame) {
-  nsIFrame* f = aFrame;
-  while (f) {
+static bool AnyContentAncestorModified(nsIFrame* aFrame,
+                                       nsIFrame* aStopAtFrame = nullptr) {
+  for (nsIFrame* f = aFrame; f;
+       f = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(f)) {
     if (f->IsFrameModified()) {
       return true;
     }
 
     if (aStopAtFrame && f == aStopAtFrame) {
       break;
     }
-
-    if (f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) {
-      f = f->GetParent();
-    } else {
-      f = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(f);
-    }
   }
 
   return false;
 }
 
 static Maybe<const ActiveScrolledRoot*> SelectContainerASR(
     const DisplayItemClipChain* aClipChain, const ActiveScrolledRoot* aItemASR,
     Maybe<const ActiveScrolledRoot*>& aContainerASR) {
@@ -274,24 +270,16 @@ static void UpdateASR(nsDisplayItem* aIt
   }
 
   wrapList->SetActiveScrolledRoot(ActiveScrolledRoot::PickAncestor(
       wrapList->GetFrameActiveScrolledRoot(), *asr));
 
   wrapList->UpdateHitTestInfoActiveScrolledRoot(*asr);
 }
 
-OldItemInfo::OldItemInfo(nsDisplayItem* aItem)
-    : mItem(aItem), mUsed(false), mDiscarded(false) {
-  if (mItem) {
-    // Clear cached modified frame state when adding an item to the old list.
-    mItem->SetModifiedFrame(false);
-  }
-}
-
 void OldItemInfo::AddedMatchToMergedList(RetainedDisplayListBuilder* aBuilder,
                                          MergedListIndex aIndex) {
   AddedToMergedList(aIndex);
 }
 
 void OldItemInfo::Discard(RetainedDisplayListBuilder* aBuilder,
                           nsTArray<MergedListIndex>&& aDirectPredecessors) {
   MOZ_ASSERT(!IsUsed());
@@ -299,50 +287,48 @@ void OldItemInfo::Discard(RetainedDispla
   mDirectPredecessors = std::move(aDirectPredecessors);
   if (mItem) {
     mItem->Destroy(aBuilder->Builder());
   }
   mItem = nullptr;
 }
 
 bool OldItemInfo::IsChanged() {
-  return !mItem || !mItem->CanBeReused() || mItem->HasDeletedFrame();
+  return !mItem || mItem->HasDeletedFrame() || !mItem->CanBeReused();
 }
 
 /**
  * A C++ implementation of Markus Stange's merge-dags algorithm.
  * https://github.com/mstange/merge-dags
  *
  * MergeState handles combining a new list of display items into an existing
  * DAG and computes the new DAG in a single pass.
  * Each time we add a new item, we resolve all dependencies for it, so that the
  * resulting list and DAG are built in topological ordering.
  */
 class MergeState {
  public:
   MergeState(RetainedDisplayListBuilder* aBuilder,
-             RetainedDisplayList& aOldList, nsDisplayItem* aOuterItem)
+             RetainedDisplayList& aOldList, uint32_t aOuterKey)
       : mBuilder(aBuilder),
         mOldList(&aOldList),
         mOldItems(std::move(aOldList.mOldItems)),
         mOldDAG(
             std::move(*reinterpret_cast<DirectedAcyclicGraph<OldListUnits>*>(
                 &aOldList.mDAG))),
-        mOuterItem(aOuterItem),
+        mOuterKey(aOuterKey),
         mResultIsModified(false) {
     mMergedDAG.EnsureCapacityFor(mOldDAG);
     MOZ_RELEASE_ASSERT(mOldItems.Length() == mOldDAG.Length());
   }
 
   Maybe<MergedListIndex> ProcessItemFromNewList(
       nsDisplayItem* aNewItem, const Maybe<MergedListIndex>& aPreviousItem) {
     OldListIndex oldIndex;
-    MOZ_DIAGNOSTIC_ASSERT(aNewItem->HasModifiedFrame() ==
-                          HasModifiedFrame(aNewItem));
-    if (!aNewItem->HasModifiedFrame() &&
+    if (!HasModifiedFrame(aNewItem) &&
         HasMatchingItemInOldList(aNewItem, &oldIndex)) {
       nsDisplayItem* oldItem = mOldItems[oldIndex.val].mItem;
       MOZ_DIAGNOSTIC_ASSERT(oldItem->GetPerFrameKey() ==
                                 aNewItem->GetPerFrameKey() &&
                             oldItem->Frame() == aNewItem->Frame());
       if (!mOldItems[oldIndex.val].IsChanged()) {
         MOZ_DIAGNOSTIC_ASSERT(!mOldItems[oldIndex.val].IsUsed());
         nsDisplayItem* destItem;
@@ -472,31 +458,29 @@ class MergeState {
     return result;
   }
 
   bool HasMatchingItemInOldList(nsDisplayItem* aItem, OldListIndex* aOutIndex) {
     nsIFrame::DisplayItemArray* items =
         aItem->Frame()->GetProperty(nsIFrame::DisplayItems());
     // Look for an item that matches aItem's frame and per-frame-key, but isn't
     // the same item.
-    uint32_t outerKey = mOuterItem ? mOuterItem->GetPerFrameKey() : 0;
     for (nsDisplayItem* i : *items) {
       if (i != aItem && i->Frame() == aItem->Frame() &&
           i->GetPerFrameKey() == aItem->GetPerFrameKey()) {
-        if (i->GetOldListIndex(mOldList, outerKey, aOutIndex)) {
+        if (i->GetOldListIndex(mOldList, mOuterKey, aOutIndex)) {
           return true;
         }
       }
     }
     return false;
   }
 
   bool HasModifiedFrame(nsDisplayItem* aItem) {
-    nsIFrame* stopFrame = mOuterItem ? mOuterItem->Frame() : nullptr;
-    return AnyContentAncestorModified(aItem->FrameForInvalidation(), stopFrame);
+    return AnyContentAncestorModified(aItem->FrameForInvalidation());
   }
 
   void UpdateContainerASR(nsDisplayItem* aItem) {
     mContainerASR = SelectContainerASR(
         aItem->GetClipChain(), aItem->GetActiveScrolledRoot(), mContainerASR);
   }
 
   MergedListIndex AddNewNode(
@@ -507,21 +491,22 @@ class MergeState {
     aItem->NotifyUsed(mBuilder->Builder());
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
     nsIFrame::DisplayItemArray* items =
         aItem->Frame()->GetProperty(nsIFrame::DisplayItems());
     for (nsDisplayItem* i : *items) {
       if (i->Frame() == aItem->Frame() &&
           i->GetPerFrameKey() == aItem->GetPerFrameKey()) {
-        MOZ_DIAGNOSTIC_ASSERT(!i->IsMergedItem());
+        MOZ_DIAGNOSTIC_ASSERT(!i->mMergedItem);
       }
     }
 
-    aItem->SetMergedPreProcessed(true, false);
+    aItem->mMergedItem = true;
+    aItem->mPreProcessedItem = false;
 #endif
 
     mMergedItems.AppendToTop(aItem);
     MergedListIndex newIndex =
         mMergedDAG.AddNode(aDirectPredecessors, aExtraDirectPredecessor);
     return newIndex;
   }
 
@@ -629,17 +614,17 @@ class MergeState {
   Maybe<const ActiveScrolledRoot*> mContainerASR;
   nsTArray<OldItemInfo> mOldItems;
   DirectedAcyclicGraph<OldListUnits> mOldDAG;
   // Unfortunately we can't use strong typing for the hashtables
   // since they internally encode the type with the mOps pointer,
   // and assert when we try swap the contents
   nsDisplayList mMergedItems;
   DirectedAcyclicGraph<MergedListUnits> mMergedDAG;
-  nsDisplayItem* mOuterItem;
+  uint32_t mOuterKey;
   bool mResultIsModified;
 };
 
 /**
  * Takes two display lists and merges them into an output list.
  *
  * Display lists wthout an explicit DAG are interpreted as linear DAGs (with a
  * maximum of one direct predecessor and one direct successor per node). We add
@@ -651,17 +636,18 @@ class MergeState {
  */
 bool RetainedDisplayListBuilder::MergeDisplayLists(
     nsDisplayList* aNewList, RetainedDisplayList* aOldList,
     RetainedDisplayList* aOutList,
     mozilla::Maybe<const mozilla::ActiveScrolledRoot*>& aOutContainerASR,
     nsDisplayItem* aOuterItem) {
   AUTO_PROFILER_LABEL_CATEGORY_PAIR(GRAPHICS_DisplayListMerging);
 
-  MergeState merge(this, *aOldList, aOuterItem);
+  MergeState merge(this, *aOldList,
+                   aOuterItem ? aOuterItem->GetPerFrameKey() : 0);
 
   Maybe<MergedListIndex> previousItemIndex;
   while (nsDisplayItem* item = aNewList->RemoveBottom()) {
     previousItemIndex = merge.ProcessItemFromNewList(item, previousItemIndex);
   }
 
   *aOutList = merge.Finalize();
   aOutContainerASR = merge.mContainerASR;
--- a/layout/painting/RetainedDisplayListHelpers.h
+++ b/layout/painting/RetainedDisplayListHelpers.h
@@ -134,17 +134,18 @@ class DirectedAcyclicGraph {
   nsTArray<NodeInfo> mNodesInfo;
   nsTArray<Index<T>> mDirectPredecessorList;
 };
 
 struct RetainedDisplayListBuilder;
 class nsDisplayItem;
 
 struct OldItemInfo {
-  explicit OldItemInfo(nsDisplayItem* aItem);
+  explicit OldItemInfo(nsDisplayItem* aItem)
+      : mItem(aItem), mUsed(false), mDiscarded(false) {}
 
   void AddedToMergedList(MergedListIndex aIndex) {
     MOZ_ASSERT(!IsUsed());
     mUsed = true;
     mIndex = aIndex;
     mItem = nullptr;
   }
 
@@ -163,12 +164,9 @@ struct OldItemInfo {
 
   nsDisplayItem* mItem;
   bool mUsed;
   bool mDiscarded;
   MergedListIndex mIndex;
   nsTArray<MergedListIndex> mDirectPredecessors;
 };
 
-bool AnyContentAncestorModified(nsIFrame* aFrame,
-                                nsIFrame* aStopAtFrame = nullptr);
-
 #endif  // RETAINEDDISPLAYLISTHELPERS_H_
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -96,17 +96,16 @@
 #include "nsSliderFrame.h"
 #include "ClientLayerManager.h"
 #include "mozilla/layers/RenderRootStateManager.h"
 #include "mozilla/layers/StackingContextHelper.h"
 #include "mozilla/layers/WebRenderBridgeChild.h"
 #include "mozilla/layers/WebRenderLayerManager.h"
 #include "mozilla/layers/WebRenderMessages.h"
 #include "mozilla/layers/WebRenderScrollData.h"
-#include "mozilla/layout/RenderFrame.h"
 
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::dom;
 using namespace mozilla::layout;
 using namespace mozilla::gfx;
 
 typedef ScrollableLayerGuid::ViewID ViewID;
@@ -131,17 +130,17 @@ void AssertUniqueItem(nsDisplayItem* aIt
   nsIFrame::DisplayItemArray* items =
       aItem->Frame()->GetProperty(nsIFrame::DisplayItems());
   if (!items) {
     return;
   }
   for (nsDisplayItem* i : *items) {
     if (i != aItem && !i->HasDeletedFrame() && i->Frame() == aItem->Frame() &&
         i->GetPerFrameKey() == aItem->GetPerFrameKey()) {
-      if (i->IsPreProcessedItem()) {
+      if (i->mPreProcessedItem) {
         continue;
       }
       MOZ_DIAGNOSTIC_ASSERT(false, "Duplicate display item!");
     }
   }
 }
 #endif
 
@@ -3167,19 +3166,28 @@ static_assert(sizeof(nsDisplayItem) <= 1
 #endif
 
 nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame, aBuilder->CurrentActiveScrolledRoot()) {}
 
 nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                              const ActiveScrolledRoot* aActiveScrolledRoot)
     : mFrame(aFrame),
-      mItemFlags(),
       mActiveScrolledRoot(aActiveScrolledRoot),
-      mAnimatedGeometryRoot(nullptr) {
+      mAnimatedGeometryRoot(nullptr),
+      mForceNotVisible(aBuilder->IsBuildingInvisibleItems()),
+      mDisableSubpixelAA(false),
+      mReusedItem(false),
+      mPaintRectValid(false),
+      mCanBeReused(true)
+#ifdef MOZ_DUMP_PAINTING
+      ,
+      mPainted(false)
+#endif
+{
   MOZ_COUNT_CTOR(nsDisplayItem);
   if (aBuilder->IsRetainingDisplayList()) {
     mFrame->AddDisplayItem(this);
   }
   mReferenceFrame = aBuilder->FindReferenceFrameFor(aFrame, &mToReferenceFrame);
   // This can return the wrong result if the item override
   // ShouldFixToViewport(), the item needs to set it again in its constructor.
   mAnimatedGeometryRoot = aBuilder->FindAnimatedGeometryRootFor(aFrame);
@@ -3195,66 +3203,45 @@ nsDisplayItem::nsDisplayItem(nsDisplayLi
 
   // The visible rect is for mCurrentFrame, so we have to use
   // mCurrentOffsetToReferenceFrame
   nsRect visible = aBuilder->GetVisibleRect() +
                    aBuilder->GetCurrentFrameOffsetToReferenceFrame();
   SetBuildingRect(visible);
 
   const nsStyleDisplay* disp = mFrame->StyleDisplay();
-  if (mFrame->BackfaceIsHidden(disp)) {
-    mItemFlags += ItemFlag::BackfaceHidden;
-  }
-  if (mFrame->Combines3DTransformWithAncestors(disp)) {
-    mItemFlags += ItemFlag::Combines3DTransformWithAncestors;
-  }
+  mBackfaceIsHidden = mFrame->BackfaceIsHidden(disp);
+  mCombines3DTransformWithAncestors =
+      mFrame->Combines3DTransformWithAncestors(disp);
 }
 
 /* static */
 bool nsDisplayItem::ForceActiveLayers() {
   static bool sForce = false;
   static bool sForceCached = false;
 
   if (!sForceCached) {
     Preferences::AddBoolVarCache(&sForce, "layers.force-active", false);
     sForceCached = true;
   }
 
   return sForce;
 }
 
-bool nsDisplayItem::HasModifiedFrame() const {
-  return mItemFlags.contains(ItemFlag::ModifiedFrame);
-}
-
-void nsDisplayItem::SetModifiedFrame(bool aModified) {
-  if (aModified) {
-    mItemFlags += ItemFlag::ModifiedFrame;
-  } else {
-    mItemFlags -= ItemFlag::ModifiedFrame;
-  }
-}
-
-bool nsDisplayItem::HasDeletedFrame() const {
-  return mItemFlags.contains(ItemFlag::DeletedFrame) ||
-         (GetType() == DisplayItemType::TYPE_REMOTE &&
-          !static_cast<const nsDisplayRemote*>(this)->GetFrameLoader());
-}
-
 int32_t nsDisplayItem::ZIndex() const { return mFrame->ZIndex(); }
 
 bool nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                       nsRegion* aVisibleRegion) {
   return !GetPaintRect().IsEmpty() &&
          !IsInvisibleInRect(aVisibleRegion->GetBounds());
 }
 
 bool nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder,
                                         nsRegion* aVisibleRegion) {
-  if (ForceNotVisible() && !GetSameCoordinateSystemChildren()) {
+  if (mForceNotVisible && !GetSameCoordinateSystemChildren()) {
     // mForceNotVisible wants to ensure that this display item doesn't render
     // anything itself. If this item has contents, then we obviously want to
     // render those, so we don't need this check in that case.
     NS_ASSERTION(GetBuildingRect().IsEmpty(),
                  "invisible items without children should have empty vis rect");
     SetPaintRect(nsRect());
   } else {
     bool snap;
@@ -3309,18 +3296,16 @@ void nsDisplayItem::FuseClipChainUpTo(ns
 
   if (mClipChain) {
     mClip = &mClipChain->mClip;
   } else {
     mClip = nullptr;
   }
 }
 
-void nsDisplayItem::SetDeletedFrame() { mItemFlags += ItemFlag::DeletedFrame; }
-
 bool nsDisplayItem::ShouldUseAdvancedLayer(LayerManager* aManager,
                                            PrefFunc aFunc) const {
   return CanUseAdvancedLayer(aManager) ? aFunc() : false;
 }
 
 bool nsDisplayItem::CanUseAdvancedLayer(LayerManager* aManager) const {
   return gfxPrefs::LayersAdvancedBasicLayerEnabled() || !aManager ||
          aManager->GetBackendType() == layers::LayersBackend::LAYERS_WR;
@@ -6708,20 +6693,23 @@ nsDisplaySubDocument::~nsDisplaySubDocum
     mSubDocFrame->RemoveDisplayItem(this);
   }
 }
 
 nsIFrame* nsDisplaySubDocument::FrameForInvalidation() const {
   return mSubDocFrame ? mSubDocFrame : mFrame;
 }
 
+bool nsDisplaySubDocument::HasDeletedFrame() const {
+  return !mSubDocFrame || nsDisplayItem::HasDeletedFrame();
+}
+
 void nsDisplaySubDocument::RemoveFrame(nsIFrame* aFrame) {
   if (aFrame == mSubDocFrame) {
     mSubDocFrame = nullptr;
-    SetDeletedFrame();
   }
   nsDisplayItem::RemoveFrame(aFrame);
 }
 
 void nsDisplaySubDocument::Disown() {
   if (mFrame) {
     mFrame->RemoveDisplayItem(this);
     mFrame = nullptr;
@@ -8951,17 +8939,17 @@ bool nsDisplayText::CanApplyOpacity() co
 
   return true;
 }
 
 void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
   AUTO_PROFILER_LABEL("nsDisplayText::Paint", GRAPHICS);
 
   DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
-                                                    IsSubpixelAADisabled());
+                                                    mDisableSubpixelAA);
   RenderToContext(aCtx, aBuilder);
 }
 
 bool nsDisplayText::CreateWebRenderCommands(
     mozilla::wr::DisplayListBuilder& aBuilder,
     mozilla::wr::IpcResourceUpdateQueue& aResources,
     const StackingContextHelper& aSc, RenderRootStateManager* aManager,
     nsDisplayListBuilder* aDisplayListBuilder) {
@@ -10279,91 +10267,8 @@ PaintTelemetry::AutoRecord::~AutoRecord(
   if (mStart.IsNull()) {
     return;
   }
 
   sMetrics[mMetric] += (TimeStamp::Now() - mStart).ToMilliseconds();
 }
 
 }  // namespace mozilla
-
-#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-static nsIFrame* GetSelfOrPlaceholderFor(nsIFrame* aFrame) {
-  if (aFrame->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) {
-    return aFrame;
-  }
-
-  if ((aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
-      !aFrame->GetPrevInFlow()) {
-    return aFrame->GetPlaceholderFrame();
-  }
-
-  return aFrame;
-}
-
-static nsIFrame* GetAncestorFor(nsIFrame* aFrame) {
-  nsIFrame* f = GetSelfOrPlaceholderFor(aFrame);
-  MOZ_ASSERT(f);
-  return nsLayoutUtils::GetCrossDocParentFrame(f);
-}
-#endif
-
-nsDisplayListBuilder::AutoBuildingDisplayList::AutoBuildingDisplayList(
-    nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
-    const nsRect& aVisibleRect, const nsRect& aDirtyRect,
-    const bool aIsTransformed, RecalcInInvalidSubtree aRecalcInvalidSubtree)
-    : mBuilder(aBuilder),
-      mPrevFrame(aBuilder->mCurrentFrame),
-      mPrevReferenceFrame(aBuilder->mCurrentReferenceFrame),
-      mPrevHitTestArea(aBuilder->mHitTestArea),
-      mPrevHitTestInfo(aBuilder->mHitTestInfo),
-      mPrevOffset(aBuilder->mCurrentOffsetToReferenceFrame),
-      mPrevVisibleRect(aBuilder->mVisibleRect),
-      mPrevDirtyRect(aBuilder->mDirtyRect),
-      mPrevAGR(aBuilder->mCurrentAGR),
-      mPrevAncestorHasApzAwareEventHandler(
-          aBuilder->mAncestorHasApzAwareEventHandler),
-      mPrevBuildingInvisibleItems(aBuilder->mBuildingInvisibleItems),
-      mPrevInInvalidSubtree(aBuilder->mInInvalidSubtree) {
-#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-  // Validate that aForChild is being visited from it's parent frame if
-  // recalculation of mInInvalidSubtree isn't requested.
-  const nsIFrame* ancestor = GetAncestorFor(aForChild);
-  MOZ_DIAGNOSTIC_ASSERT(aRecalcInvalidSubtree ==
-                            nsDisplayListBuilder::RIIS_YES ||
-                        aForChild == mPrevFrame || ancestor == mPrevFrame);
-#endif
-
-  if (aIsTransformed) {
-    aBuilder->mCurrentOffsetToReferenceFrame = nsPoint();
-    aBuilder->mCurrentReferenceFrame = aForChild;
-  } else if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
-    aBuilder->mCurrentOffsetToReferenceFrame += aForChild->GetPosition();
-  } else {
-    aBuilder->mCurrentReferenceFrame = aBuilder->FindReferenceFrameFor(
-        aForChild, &aBuilder->mCurrentOffsetToReferenceFrame);
-  }
-
-  bool isAsync;
-  mCurrentAGRState = aBuilder->IsAnimatedGeometryRoot(aForChild, isAsync);
-
-  if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
-    if (mCurrentAGRState == AGR_YES) {
-      aBuilder->mCurrentAGR =
-          aBuilder->WrapAGRForFrame(aForChild, isAsync, aBuilder->mCurrentAGR);
-    }
-  } else if (aBuilder->mCurrentFrame != aForChild) {
-    aBuilder->mCurrentAGR = aBuilder->FindAnimatedGeometryRootFor(aForChild);
-  }
-
-  MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDoc(
-      aBuilder->RootReferenceFrame(), *aBuilder->mCurrentAGR));
-  if (!aRecalcInvalidSubtree) {
-    aBuilder->mInInvalidSubtree = aBuilder->mInInvalidSubtree ||
-      aForChild->IsFrameModified();
-  } else {
-    aBuilder->mInInvalidSubtree = AnyContentAncestorModified(aForChild);
-  }
-  aBuilder->mCurrentFrame = aForChild;
-  aBuilder->mVisibleRect = aVisibleRect;
-  aBuilder->mDirtyRect =
-      aBuilder->mInInvalidSubtree ? aVisibleRect : aDirtyRect;
-}
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -437,21 +437,16 @@ class nsDisplayListBuilder {
   typedef mozilla::layers::FrameMetrics FrameMetrics;
   typedef mozilla::layers::ScrollableLayerGuid ScrollableLayerGuid;
   typedef mozilla::layers::ScrollableLayerGuid::ViewID ViewID;
   typedef mozilla::gfx::CompositorHitTestInfo CompositorHitTestInfo;
   typedef mozilla::gfx::Matrix4x4 Matrix4x4;
   typedef mozilla::Maybe<mozilla::layers::ScrollDirection> MaybeScrollDirection;
 
   /**
-   * Does InInvalidSubtree need to recalculated?
-   */
-  enum RecalcInInvalidSubtree { RIIS_NO, RIIS_YES };
-
-  /**
    * @param aReferenceFrame the frame at the root of the subtree; its origin
    * is the origin of the reference coordinate system for this display list
    * @param aMode encodes what the builder is being used for.
    * @param aBuildCaret whether or not we should include the caret in any
    * display lists that we make.
    */
   nsDisplayListBuilder(nsIFrame* aReferenceFrame,
                        nsDisplayListBuilderMode aMode, bool aBuildCaret,
@@ -1132,35 +1127,69 @@ class nsDisplayListBuilder {
   /**
    * A helper class used to temporarily set nsDisplayListBuilder properties for
    * building display items.
    * aVisibleRect and aDirtyRect are relative to aForChild.
    */
   class AutoBuildingDisplayList {
    public:
     AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
-                            RecalcInInvalidSubtree aRecalcInvalidSubtree)
-        : AutoBuildingDisplayList(
-              aBuilder, aForChild, aBuilder->GetVisibleRect(),
-              aBuilder->GetDirtyRect(), aForChild->IsTransformed(),
-              aRecalcInvalidSubtree) {}
-
-    AutoBuildingDisplayList(
-        nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
-        const nsRect& aVisibleRect, const nsRect& aDirtyRect,
-        RecalcInInvalidSubtree aRecalcInvalidSubtree = RIIS_NO)
+                            const nsRect& aVisibleRect,
+                            const nsRect& aDirtyRect)
         : AutoBuildingDisplayList(aBuilder, aForChild, aVisibleRect, aDirtyRect,
-                                  aForChild->IsTransformed(),
-                                  aRecalcInvalidSubtree) {}
-
-    AutoBuildingDisplayList(
-        nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
-        const nsRect& aVisibleRect, const nsRect& aDirtyRect,
-        const bool aIsTransformed,
-        RecalcInInvalidSubtree aRecalcInvalidSubtree = RIIS_NO);
+                                  aForChild->IsTransformed()) {}
+
+    AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
+                            const nsRect& aVisibleRect,
+                            const nsRect& aDirtyRect, const bool aIsTransformed)
+        : mBuilder(aBuilder),
+          mPrevFrame(aBuilder->mCurrentFrame),
+          mPrevReferenceFrame(aBuilder->mCurrentReferenceFrame),
+          mPrevHitTestArea(aBuilder->mHitTestArea),
+          mPrevHitTestInfo(aBuilder->mHitTestInfo),
+          mPrevOffset(aBuilder->mCurrentOffsetToReferenceFrame),
+          mPrevVisibleRect(aBuilder->mVisibleRect),
+          mPrevDirtyRect(aBuilder->mDirtyRect),
+          mPrevAGR(aBuilder->mCurrentAGR),
+          mPrevAncestorHasApzAwareEventHandler(
+              aBuilder->mAncestorHasApzAwareEventHandler),
+          mPrevBuildingInvisibleItems(aBuilder->mBuildingInvisibleItems),
+          mPrevInInvalidSubtree(aBuilder->mInInvalidSubtree) {
+      if (aIsTransformed) {
+        aBuilder->mCurrentOffsetToReferenceFrame = nsPoint();
+        aBuilder->mCurrentReferenceFrame = aForChild;
+      } else if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
+        aBuilder->mCurrentOffsetToReferenceFrame += aForChild->GetPosition();
+      } else {
+        aBuilder->mCurrentReferenceFrame = aBuilder->FindReferenceFrameFor(
+            aForChild, &aBuilder->mCurrentOffsetToReferenceFrame);
+      }
+
+      bool isAsync;
+      mCurrentAGRState = aBuilder->IsAnimatedGeometryRoot(aForChild, isAsync);
+
+      if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
+        if (mCurrentAGRState == AGR_YES) {
+          aBuilder->mCurrentAGR = aBuilder->WrapAGRForFrame(
+              aForChild, isAsync, aBuilder->mCurrentAGR);
+        }
+      } else if (aBuilder->mCurrentFrame != aForChild) {
+        aBuilder->mCurrentAGR =
+            aBuilder->FindAnimatedGeometryRootFor(aForChild);
+      }
+
+      MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDoc(
+          aBuilder->RootReferenceFrame(), *aBuilder->mCurrentAGR));
+      aBuilder->mInInvalidSubtree =
+          aBuilder->mInInvalidSubtree || aForChild->IsFrameModified();
+      aBuilder->mCurrentFrame = aForChild;
+      aBuilder->mVisibleRect = aVisibleRect;
+      aBuilder->mDirtyRect =
+          aBuilder->mInInvalidSubtree ? aVisibleRect : aDirtyRect;
+    }
 
     void SetReferenceFrameAndCurrentOffset(const nsIFrame* aFrame,
                                            const nsPoint& aOffset) {
       mBuilder->mCurrentReferenceFrame = aFrame;
       mBuilder->mCurrentOffsetToReferenceFrame = aOffset;
     }
 
     bool IsAnimatedGeometryRoot() const { return mCurrentAGRState == AGR_YES; }
@@ -1726,17 +1755,27 @@ class nsDisplayListBuilder {
     if (!aFrame->IsFrameModified()) {
       mModifiedFramesDuringBuilding.AppendElement(aFrame);
       aFrame->SetFrameIsModified(true);
       return true;
     }
     return false;
   }
 
+  bool MarkCurrentFrameModifiedDuringBuilding() {
+    if (MarkFrameModifiedDuringBuilding(const_cast<nsIFrame*>(mCurrentFrame))) {
+      mInInvalidSubtree = true;
+      mDirtyRect = mVisibleRect;
+      return true;
+    }
+    return false;
+  }
+
   void RebuildAllItemsInCurrentSubtree() {
+    mInInvalidSubtree = true;
     mDirtyRect = mVisibleRect;
   }
 
   /**
    * This is a convenience function to ease the transition until AGRs and ASRs
    * are unified.
    */
   AnimatedGeometryRoot* AnimatedGeometryRootForASR(
@@ -2067,32 +2106,21 @@ MOZ_ALWAYS_INLINE T* MakeDisplayItem(nsD
         if (!did->HasMergedFrames()) {
           item->SetDisplayItemData(did, did->GetLayer()->Manager());
         }
         break;
       }
     }
   }
 
-  if (aBuilder->InInvalidSubtree() ||
-      item->FrameForInvalidation()->IsFrameModified()) {
-    item->SetModifiedFrame(true);
-  }
-
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
   if (aBuilder->IsRetainingDisplayList() && !aBuilder->IsInPageSequence() &&
       aBuilder->IsBuilding()) {
     AssertUniqueItem(item);
   }
-
-  // Verify that InInvalidSubtree matches invalidation frame's modified state.
-  if (aBuilder->InInvalidSubtree()) {
-    MOZ_DIAGNOSTIC_ASSERT(
-        AnyContentAncestorModified(item->FrameForInvalidation()));
-  }
 #endif
 
   return item;
 }
 
 /**
  * This is the unit of rendering and event testing. Each instance of this
  * class represents an entity that can be drawn on the screen, e.g., a
@@ -2150,24 +2178,23 @@ class nsDisplayItem : public nsDisplayIt
     DisplayItemType type = GetType();
     this->~nsDisplayItem();
     aBuilder->Destroy(type, this);
   }
 
   virtual void RestoreState() {
     mClipChain = mState.mClipChain;
     mClip = mState.mClip;
-    mItemFlags -= ItemFlag::DisableSubpixelAA;
+    mDisableSubpixelAA = false;
   }
 
   virtual void RemoveFrame(nsIFrame* aFrame) {
     if (mFrame && aFrame == mFrame) {
       MOZ_ASSERT(!mFrame->HasDisplayItem(this));
       mFrame = nullptr;
-      SetDeletedFrame();
       SetDisplayItemData(nullptr, nullptr);
     }
   }
 
   /**
    * Downcasts this item to nsDisplayWrapList, if possible.
    */
   virtual const nsDisplayWrapList* AsDisplayWrapList() const { return nullptr; }
@@ -2183,39 +2210,38 @@ class nsDisplayItem : public nsDisplayIt
   nsDisplayItem(const nsDisplayItem&) = delete;
   /**
    * The custom copy-constructor is implemented to prevent copying the saved
    * state of the item.
    * This is currently only used when creating temporary items for merging.
    */
   nsDisplayItem(nsDisplayListBuilder* aBuilder, const nsDisplayItem& aOther)
       : mFrame(aOther.mFrame),
-        mItemFlags(),
         mClipChain(aOther.mClipChain),
         mClip(aOther.mClip),
         mActiveScrolledRoot(aOther.mActiveScrolledRoot),
         mReferenceFrame(aOther.mReferenceFrame),
         mAnimatedGeometryRoot(aOther.mAnimatedGeometryRoot),
         mToReferenceFrame(aOther.mToReferenceFrame),
         mBuildingRect(aOther.mBuildingRect),
-        mPaintRect(aOther.mPaintRect) {
+        mPaintRect(aOther.mPaintRect),
+        mForceNotVisible(aOther.mForceNotVisible),
+        mDisableSubpixelAA(aOther.mDisableSubpixelAA),
+        mReusedItem(false),
+        mBackfaceIsHidden(aOther.mBackfaceIsHidden),
+        mCombines3DTransformWithAncestors(
+            aOther.mCombines3DTransformWithAncestors),
+        mPaintRectValid(false),
+        mCanBeReused(true)
+#ifdef MOZ_DUMP_PAINTING
+        ,
+        mPainted(false)
+#endif
+  {
     MOZ_COUNT_CTOR(nsDisplayItem);
-    // TODO: It might be better to remove the flags that aren't copied.
-    if (aOther.ForceNotVisible()) {
-      mItemFlags += ItemFlag::ForceNotVisible;
-    }
-    if (aOther.IsSubpixelAADisabled()) {
-      mItemFlags += ItemFlag::DisableSubpixelAA;
-    }
-    if (mFrame->In3DContextAndBackfaceIsHidden()) {
-      mItemFlags += ItemFlag::BackfaceHidden;
-    }
-    if (aOther.Combines3DTransformWithAncestors()) {
-      mItemFlags += ItemFlag::Combines3DTransformWithAncestors;
-    }
   }
 
   struct HitTestState {
     explicit HitTestState() : mInPreserves3D(false) {}
 
     ~HitTestState() {
       NS_ASSERTION(mItemBuffer.Length() == 0,
                    "mItemBuffer should have been cleared");
@@ -2269,20 +2295,17 @@ class nsDisplayItem : public nsDisplayIt
   }
 
   /**
    * @return the nsIFrame that provides the style data, and should
    * be checked when deciding if this display item can be reused.
    */
   virtual nsIFrame* FrameForInvalidation() const { return mFrame; }
 
-  bool HasModifiedFrame() const;
-  void SetModifiedFrame(bool aModified);
-
-  bool HasDeletedFrame() const;
+  virtual bool HasDeletedFrame() const { return !mFrame; }
 
   virtual nsIFrame* StyleFrame() const { return mFrame; }
 
   /**
    * Compute the used z-index of our frame; returns zero for elements to which
    * z-index does not apply, and for z-index:auto.
    * @note This can be overridden, @see nsDisplayWrapList::SetOverrideZIndex.
    */
@@ -2516,22 +2539,22 @@ class nsDisplayItem : public nsDisplayIt
   virtual void PaintWithClip(nsDisplayListBuilder* aBuilder, gfxContext* aCtx,
                              const DisplayItemClip& aClip) {}
 
 #ifdef MOZ_DUMP_PAINTING
   /**
    * Mark this display item as being painted via
    * FrameLayerBuilder::DrawPaintedLayer.
    */
-  bool Painted() const { return mItemFlags.contains(ItemFlag::Painted); }
+  bool Painted() const { return mPainted; }
 
   /**
    * Check if this display item has been painted.
    */
-  void SetPainted() { mItemFlags += ItemFlag::Painted; }
+  void SetPainted() { mPainted = true; }
 #endif
 
   /**
    * Get the layer drawn by this display item. Call this only if
    * GetLayerState() returns something other than LAYER_NONE.
    * If GetLayerState returned LAYER_NONE then Paint will be called
    * instead.
    * This is called while aManager is in the construction phase.
@@ -2704,26 +2727,24 @@ class nsDisplayItem : public nsDisplayIt
 
   void SetBuildingRect(const nsRect& aBuildingRect) {
     if (aBuildingRect == mBuildingRect) {
       // Avoid unnecessary paint rect recompution when the
       // building rect is staying the same.
       return;
     }
     mPaintRect = mBuildingRect = aBuildingRect;
-    mItemFlags -= ItemFlag::PaintRectValid;
+    mPaintRectValid = false;
   }
 
   void SetPaintRect(const nsRect& aPaintRect) {
     mPaintRect = aPaintRect;
-    mItemFlags += ItemFlag::PaintRectValid;
-  }
-  bool HasPaintRect() const {
-    return mItemFlags.contains(ItemFlag::PaintRectValid);
-  }
+    mPaintRectValid = true;
+  }
+  bool HasPaintRect() const { return mPaintRectValid; }
 
   /**
    * Returns the building rect for the children, relative to their
    * reference frame. Can be different from mBuildingRect for
    * nsDisplayTransform, since the reference frame for the children is different
    * from the reference frame for the item itself.
    */
   virtual const nsRect& GetBuildingRectForChildren() const {
@@ -2739,19 +2760,17 @@ class nsDisplayItem : public nsDisplayIt
     NS_ASSERTION(CanApplyOpacity(), "ApplyOpacity not supported on this type");
   }
   /**
    * Returns true if this display item would return true from ApplyOpacity
    * without actually applying the opacity. Otherwise returns false.
    */
   virtual bool CanApplyOpacity() const { return false; }
 
-  bool ForceNotVisible() const {
-    return mItemFlags.contains(ItemFlag::ForceNotVisible);
-  }
+  bool ForceNotVisible() const { return mForceNotVisible; }
 
   /**
    * For debugging and stuff
    */
   virtual const char* Name() const = 0;
 
   virtual void WriteDebugInfo(std::stringstream& aStream) {}
 
@@ -2807,21 +2826,19 @@ class nsDisplayItem : public nsDisplayIt
   virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) const {
     return nsRect();
   }
 
   /**
    * Disable usage of component alpha. Currently only relevant for items that
    * have text.
    */
-  void DisableComponentAlpha() { mItemFlags += ItemFlag::DisableSubpixelAA; }
-
-  bool IsSubpixelAADisabled() const {
-    return mItemFlags.contains(ItemFlag::DisableSubpixelAA);
-  }
+  void DisableComponentAlpha() { mDisableSubpixelAA = true; }
+
+  bool IsSubpixelAADisabled() const { return mDisableSubpixelAA; }
 
   /**
    * Check if we can add async animations to the layer for this display item.
    */
   virtual bool CanUseAsyncAnimations(nsDisplayListBuilder* aBuilder) {
     return false;
   }
 
@@ -2847,58 +2864,47 @@ class nsDisplayItem : public nsDisplayIt
 
   /**
    * Intersect all clips in our clip chain up to (and including) aASR and set
    * set the intersection as this item's clip.
    */
   void FuseClipChainUpTo(nsDisplayListBuilder* aBuilder,
                          const ActiveScrolledRoot* aASR);
 
-  bool BackfaceIsHidden() const {
-    return mItemFlags.contains(ItemFlag::BackfaceHidden);
-  }
+  bool BackfaceIsHidden() const { return mBackfaceIsHidden; }
 
   bool Combines3DTransformWithAncestors() const {
-    return mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors);
+    return mCombines3DTransformWithAncestors;
   }
 
   bool In3DContextAndBackfaceIsHidden() const {
-    return mItemFlags.contains(ItemFlag::BackfaceHidden) &&
-           mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors);
+    return mBackfaceIsHidden && mCombines3DTransformWithAncestors;
   }
 
   bool HasDifferentFrame(const nsDisplayItem* aOther) const {
     return mFrame != aOther->mFrame;
   }
 
   bool HasSameTypeAndClip(const nsDisplayItem* aOther) const {
     return GetPerFrameKey() == aOther->GetPerFrameKey() &&
            GetClipChain() == aOther->GetClipChain();
   }
 
   bool HasSameContent(const nsDisplayItem* aOther) const {
     return mFrame->GetContent() == aOther->Frame()->GetContent();
   }
 
-  bool IsReused() const { return mItemFlags.contains(ItemFlag::ReusedItem); }
-  void SetReused(bool aReused) {
-    if (aReused) {
-      mItemFlags += ItemFlag::ReusedItem;
-    } else {
-      mItemFlags -= ItemFlag::ReusedItem;
-    }
-  }
-
-  bool CanBeReused() const {
-    return !mItemFlags.contains(ItemFlag::CantBeReused);
-  }
-  void SetCantBeReused() { mItemFlags += ItemFlag::CantBeReused; }
+  bool IsReused() const { return mReusedItem; }
+
+  void SetReused(bool aReused) { mReusedItem = aReused; }
+
+  bool CanBeReused() const { return mCanBeReused; }
   void DiscardIfOldItem() {
     if (mOldList) {
-      SetCantBeReused();
+      mCanBeReused = false;
     }
   }
   virtual void NotifyUsed(nsDisplayListBuilder* aBuilder) {}
 
   virtual nsIFrame* GetDependentFrame() { return nullptr; }
 
   virtual mozilla::Maybe<nsRect> GetClipWithRespectToASR(
       nsDisplayListBuilder* aBuilder, const ActiveScrolledRoot* aASR) const;
@@ -2960,44 +2966,21 @@ class nsDisplayItem : public nsDisplayIt
 
   virtual bool HasHitTestInfo() const { return false; }
 
 #ifdef DEBUG
   virtual bool IsHitTestItem() const { return false; }
 #endif
 
  protected:
-  void SetDeletedFrame();
-
   typedef bool (*PrefFunc)(void);
   bool ShouldUseAdvancedLayer(LayerManager* aManager, PrefFunc aFunc) const;
   bool CanUseAdvancedLayer(LayerManager* aManager) const;
 
-  enum class ItemFlag {
-    ModifiedFrame,
-    DeletedFrame,
-    ForceNotVisible,
-    DisableSubpixelAA,
-    CantBeReused,
-    ReusedItem,
-    BackfaceHidden,
-    Combines3DTransformWithAncestors,
-    PaintRectValid,
-#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
-    MergedItem,
-    PreProcessedItem,
-#endif
-#ifdef MOZ_DUMP_PAINTING
-    // True if this frame has been painted.
-    Painted,
-#endif
-  };
-
   nsIFrame* mFrame;
-  mozilla::EnumSet<ItemFlag, uint16_t> mItemFlags;
   RefPtr<const DisplayItemClipChain> mClipChain;
   const DisplayItemClip* mClip;
   RefPtr<const ActiveScrolledRoot> mActiveScrolledRoot;
   // Result of FindReferenceFrameFor(mFrame), if mFrame is non-null
   const nsIFrame* mReferenceFrame;
   RefPtr<struct AnimatedGeometryRoot> mAnimatedGeometryRoot;
   // Result of ToReferenceFrame(mFrame), if mFrame is non-null
   nsPoint mToReferenceFrame;
@@ -3021,41 +3004,36 @@ class nsDisplayItem : public nsDisplayIt
  protected:
   struct {
     RefPtr<const DisplayItemClipChain> mClipChain;
     const DisplayItemClip* mClip;
   } mState;
 
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
  public:
-  bool IsMergedItem() const {
-    return mItemFlags.contains(ItemFlag::MergedItem);
-  }
-  bool IsPreProcessedItem() const {
-    return mItemFlags.contains(ItemFlag::PreProcessedItem);
-  }
-  void SetMergedPreProcessed(bool aMerged, bool aPreProcessed) {
-    if (aMerged) {
-      mItemFlags += ItemFlag::MergedItem;
-    } else {
-      mItemFlags -= ItemFlag::MergedItem;
-    }
-
-    if (aPreProcessed) {
-      mItemFlags += ItemFlag::PreProcessedItem;
-    } else {
-      mItemFlags -= ItemFlag::PreProcessedItem;
-    }
-  }
-
   uint32_t mOldListKey = 0;
   uint32_t mOldNestingDepth = 0;
+  bool mMergedItem = false;
+  bool mPreProcessedItem = false;
 
  protected:
 #endif
+
+  bool mForceNotVisible;
+  bool mDisableSubpixelAA;
+  bool mReusedItem;
+  bool mBackfaceIsHidden;
+  bool mCombines3DTransformWithAncestors;
+  bool mPaintRectValid;
+  bool mCanBeReused;
+
+#ifdef MOZ_DUMP_PAINTING
+  // True if this frame has been painted.
+  bool mPainted;
+#endif
 };
 
 /**
  * Manages a singly-linked list of display list items.
  *
  * mSentinel is the sentinel list value, the first value in the null-terminated
  * linked list of items. mTop is the last item in the list (whose 'above'
  * pointer is null). This class has no virtual methods. So list objects are just
@@ -4178,19 +4156,17 @@ class nsDisplaySolidColor : public nsDis
  public:
   nsDisplaySolidColor(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                       const nsRect& aBounds, nscolor aColor,
                       bool aCanBeReused = true)
       : nsDisplaySolidColorBase(aBuilder, aFrame, aColor), mBounds(aBounds) {
     NS_ASSERTION(NS_GET_A(aColor) > 0,
                  "Don't create invisible nsDisplaySolidColors!");
     MOZ_COUNT_CTOR(nsDisplaySolidColor);
-    if (!aCanBeReused) {
-      SetCantBeReused();
-    }
+    mCanBeReused = aCanBeReused;
   }
 
 #ifdef NS_BUILD_REFCNT_LOGGING
   ~nsDisplaySolidColor() override { MOZ_COUNT_DTOR(nsDisplaySolidColor); }
 #endif
 
   NS_DISPLAY_DECL_NAME("SolidColor", TYPE_SOLID_COLOR)
 
@@ -4518,20 +4494,23 @@ class nsDisplayTableBackgroundImage : pu
            (static_cast<uint8_t>(mTableType) << TYPE_BITS) |
            nsDisplayItem::GetPerFrameKey();
   }
 
   bool IsInvalid(nsRect& aRect) const override;
 
   nsIFrame* FrameForInvalidation() const override { return mStyleFrame; }
 
+  bool HasDeletedFrame() const override {
+    return !mStyleFrame || nsDisplayBackgroundImage::HasDeletedFrame();
+  }
+
   void RemoveFrame(nsIFrame* aFrame) override {
     if (aFrame == mStyleFrame) {
       mStyleFrame = nullptr;
-      SetDeletedFrame();
     }
     nsDisplayBackgroundImage::RemoveFrame(aFrame);
   }
 
  protected:
   nsIFrame* StyleFrame() const override { return mStyleFrame; }
 
   nsIFrame* mStyleFrame;
@@ -4646,20 +4625,23 @@ class nsDisplayTableThemedBackground : p
 
   uint32_t GetPerFrameKey() const override {
     return (static_cast<uint8_t>(mTableType) << TYPE_BITS) |
            nsDisplayItem::GetPerFrameKey();
   }
 
   nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
 
+  bool HasDeletedFrame() const override {
+    return !mAncestorFrame || nsDisplayThemedBackground::HasDeletedFrame();
+  }
+
   void RemoveFrame(nsIFrame* aFrame) override {
     if (aFrame == mAncestorFrame) {
       mAncestorFrame = nullptr;
-      SetDeletedFrame();
     }
     nsDisplayThemedBackground::RemoveFrame(aFrame);
   }
 
  protected:
   nsIFrame* StyleFrame() const override { return mAncestorFrame; }
   nsIFrame* mAncestorFrame;
   TableType mTableType;
@@ -4823,20 +4805,23 @@ class nsDisplayTableBackgroundColor : pu
       mAncestorFrame->RemoveDisplayItem(this);
     }
   }
 
   NS_DISPLAY_DECL_NAME("TableBackgroundColor", TYPE_TABLE_BACKGROUND_COLOR)
 
   nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
 
+  bool HasDeletedFrame() const override {
+    return !mAncestorFrame || nsDisplayBackgroundColor::HasDeletedFrame();
+  }
+
   void RemoveFrame(nsIFrame* aFrame) override {
     if (aFrame == mAncestorFrame) {
       mAncestorFrame = nullptr;
-      SetDeletedFrame();
     }
     nsDisplayBackgroundColor::RemoveFrame(aFrame);
   }
 
   uint32_t GetPerFrameKey() const override {
     return (static_cast<uint8_t>(mTableType) << TYPE_BITS) |
            nsDisplayItem::GetPerFrameKey();
   }
@@ -5642,20 +5627,23 @@ class nsDisplayTableBlendMode : public n
   NS_DISPLAY_DECL_NAME("TableBlendMode", TYPE_TABLE_BLEND_MODE)
 
   nsDisplayWrapList* Clone(nsDisplayListBuilder* aBuilder) const override {
     return MakeDisplayItem<nsDisplayTableBlendMode>(aBuilder, *this);
   }
 
   nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
 
+  bool HasDeletedFrame() const override {
+    return !mAncestorFrame || nsDisplayBlendMode::HasDeletedFrame();
+  }
+
   void RemoveFrame(nsIFrame* aFrame) override {
     if (aFrame == mAncestorFrame) {
       mAncestorFrame = nullptr;
-      SetDeletedFrame();
     }
     nsDisplayBlendMode::RemoveFrame(aFrame);
   }
 
   uint32_t GetPerFrameKey() const override {
     return (mIndex << (TYPE_BITS +
                        static_cast<uint8_t>(TableTypeBits::COUNT))) |
            (static_cast<uint8_t>(mTableType) << TYPE_BITS) |
@@ -5746,20 +5734,23 @@ class nsDisplayTableBlendContainer : pub
   NS_DISPLAY_DECL_NAME("TableBlendContainer", TYPE_TABLE_BLEND_CONTAINER)
 
   nsDisplayWrapList* Clone(nsDisplayListBuilder* aBuilder) const override {
     return MakeDisplayItem<nsDisplayTableBlendContainer>(aBuilder, *this);
   }
 
   nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
 
+  bool HasDeletedFrame() const override {
+    return !mAncestorFrame || nsDisplayBlendContainer::HasDeletedFrame();
+  }
+
   void RemoveFrame(nsIFrame* aFrame) override {
     if (aFrame == mAncestorFrame) {
       mAncestorFrame = nullptr;
-      SetDeletedFrame();
     }
     nsDisplayBlendContainer::RemoveFrame(aFrame);
   }
 
   uint32_t GetPerFrameKey() const override {
     return (static_cast<uint8_t>(mTableType) << TYPE_BITS) |
            nsDisplayItem::GetPerFrameKey();
   }
@@ -5976,16 +5967,17 @@ class nsDisplaySubDocument : public nsDi
   nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                            bool* aSnap) const override;
 
   mozilla::UniquePtr<ScrollMetadata> ComputeScrollMetadata(
       LayerManager* aLayerManager,
       const ContainerLayerParameters& aContainerParameters);
 
   nsIFrame* FrameForInvalidation() const override;
+  bool HasDeletedFrame() const override;
   void RemoveFrame(nsIFrame* aFrame) override;
 
   void Disown();
 
  protected:
   ViewID mScrollParentId;
   bool mForceDispatchToContentRegion;
   bool mShouldFlatten;
@@ -6157,20 +6149,23 @@ class nsDisplayTableFixedPosition : publ
   NS_DISPLAY_DECL_NAME("TableFixedPosition", TYPE_TABLE_FIXED_POSITION)
 
   nsDisplayWrapList* Clone(nsDisplayListBuilder* aBuilder) const override {
     return MakeDisplayItem<nsDisplayTableFixedPosition>(aBuilder, *this);
   }
 
   nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
 
+  bool HasDeletedFrame() const override {
+    return !mAncestorFrame || nsDisplayFixedPosition::HasDeletedFrame();
+  }
+
   void RemoveFrame(nsIFrame* aFrame) override {
     if (aFrame == mAncestorFrame) {
       mAncestorFrame = nullptr;
-      SetDeletedFrame();
     }
     nsDisplayFixedPosition::RemoveFrame(aFrame);
   }
 
   uint32_t GetPerFrameKey() const override {
     return (mIndex << (TYPE_BITS +
                        static_cast<uint8_t>(TableTypeBits::COUNT))) |
            (static_cast<uint8_t>(mTableType) << TYPE_BITS) |
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -2856,17 +2856,17 @@ void nsDisplaySVGText::HitTest(nsDisplay
   nsIFrame* target = frame->GetFrameForPoint(userSpacePt);
   if (target) {
     aOutFrames->AppendElement(target);
   }
 }
 
 void nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
   DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
-                                                    IsSubpixelAADisabled());
+                                                    mDisableSubpixelAA);
 
   uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
 
   // ToReferenceFrame includes our mRect offset, but painting takes
   // account of that too. To avoid double counting, we subtract that
   // here.
   nsPoint offset = ToReferenceFrame() - mFrame->GetPosition();
 
--- a/layout/xul/nsTextBoxFrame.cpp
+++ b/layout/xul/nsTextBoxFrame.cpp
@@ -273,17 +273,17 @@ static void PaintTextShadowCallback(gfxC
                                     const nscolor& aShadowColor, void* aData) {
   reinterpret_cast<nsDisplayXULTextBox*>(aData)->PaintTextToContext(
       aCtx, aShadowOffset, &aShadowColor);
 }
 
 void nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
                                 gfxContext* aCtx) {
   DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
-                                                    IsSubpixelAADisabled());
+                                                    mDisableSubpixelAA);
 
   // Paint the text shadow before doing any foreground stuff
   nsRect drawRect =
       static_cast<nsTextBoxFrame*>(mFrame)->mTextDrawRect + ToReferenceFrame();
   nsLayoutUtils::PaintTextShadow(mFrame, aCtx, drawRect, GetPaintRect(),
                                  mFrame->StyleColor()->mColor.ToColor(),
                                  PaintTextShadowCallback, (void*)this);
 
--- a/layout/xul/tree/nsTreeBodyFrame.cpp
+++ b/layout/xul/tree/nsTreeBodyFrame.cpp
@@ -2493,17 +2493,17 @@ class nsDisplayTreeBody final : public n
     nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry,
                                              aInvalidRegion);
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
                      gfxContext* aCtx) override {
     MOZ_ASSERT(aBuilder);
     DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
-                                                      IsSubpixelAADisabled());
+                                                      mDisableSubpixelAA);
 
     ImgDrawResult result = static_cast<nsTreeBodyFrame*>(mFrame)->PaintTreeBody(
         *aCtx, GetPaintRect(), ToReferenceFrame(), aBuilder);
 
     nsDisplayItemGenericImageGeometry::UpdateDrawResult(this, result);
   }
 
   NS_DISPLAY_DECL_NAME("XULTreeBody", TYPE_XUL_TREE_BODY)
--- a/remote/moz.build
+++ b/remote/moz.build
@@ -1,14 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-DIRS += ["pref"]
-TEST_DIRS += ["test"]
+DIRS += [
+  "pref",
+  "test",
+]
 
 EXTRA_COMPONENTS += [
     "command-line-handler.js",
     "RemoteAgent.manifest",
 ]
 
 JAR_MANIFESTS += ["jar.mn"]