Bug 1469403 - Set a flag on the DL builder to indicate if the docshell is active. r=mattwoodrow
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 22 Oct 2018 23:41:47 +0000
changeset 442463 d9e373554f5125fb413029b85a5123b4b2ff42e0
parent 442462 f3273aa382dca7f8149d9839603635d183dc2cf5
child 442464 859e7d50fc031e6e19199f6c093e031566cf875a
push id71514
push userkgupta@mozilla.com
push dateTue, 23 Oct 2018 01:30:39 +0000
treeherderautoland@859e7d50fc03 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1469403
milestone65.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
Bug 1469403 - Set a flag on the DL builder to indicate if the docshell is active. r=mattwoodrow Differential Revision: https://phabricator.services.mozilla.com/D9141
layout/base/nsLayoutUtils.cpp
layout/painting/nsDisplayList.cpp
layout/painting/nsDisplayList.h
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3601,16 +3601,22 @@ nsLayoutUtils::PaintFrame(gfxContext* aR
   if (aFlags & (PaintFrameFlags::PAINT_WIDGET_LAYERS |
                 PaintFrameFlags::PAINT_TO_WINDOW)) {
     builder.SetPaintingToWindow(true);
   }
   if (aFlags & PaintFrameFlags::PAINT_IGNORE_SUPPRESSION) {
     builder.IgnorePaintSuppression();
   }
 
+  if (nsIDocShell* doc = presContext->GetDocShell()) {
+    bool isActive = false;
+    doc->GetIsActive(&isActive);
+    builder.SetInActiveDocShell(isActive);
+  }
+
   nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
   if (rootScrollFrame && !aFrame->GetParent()) {
     nsIScrollableFrame* rootScrollableFrame = presShell->GetRootScrollFrameAsScrollable();
     MOZ_ASSERT(rootScrollableFrame);
     nsRect displayPortBase = aFrame->GetVisualOverflowRectRelativeToSelf();
     nsRect temp = displayPortBase;
     Unused << rootScrollableFrame->DecideScrollableLayer(&builder, &displayPortBase, &temp,
                 /* aSetBase = */ true);
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -1014,16 +1014,17 @@ nsDisplayListBuilder::nsDisplayListBuild
   , mForceLayerForScrollParent(false)
   , mAsyncPanZoomEnabled(nsLayoutUtils::AsyncPanZoomEnabled(aReferenceFrame))
   , mBuildingInvisibleItems(false)
   , mHitTestIsForVisibility(false)
   , mIsBuilding(false)
   , mInInvalidSubtree(false)
   , mDisablePartialUpdates(false)
   , mPartialBuildFailed(false)
+  , mIsInActiveDocShell(false)
 {
   MOZ_COUNT_CTOR(nsDisplayListBuilder);
 
   mBuildCompositorHitTestInfo = mAsyncPanZoomEnabled && IsForPainting();
 
   mLessEventRegionItems = gfxPrefs::LessEventRegionItems();
 
   nsPresContext* pc = aReferenceFrame->PresContext();
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -924,16 +924,19 @@ public:
   {
     mDisablePartialUpdates = aDisable;
   }
   bool DisablePartialUpdates() { return mDisablePartialUpdates; }
 
   void SetPartialBuildFailed(bool aFailed) { mPartialBuildFailed = aFailed; }
   bool PartialBuildFailed() { return mPartialBuildFailed; }
 
+  bool IsInActiveDocShell() { return mIsInActiveDocShell; }
+  void SetInActiveDocShell(bool aActive) { mIsInActiveDocShell = aActive; }
+
   /**
    * Return true if we're currently building a display list for the presshell
    * of a chrome document, or if we're building the display list for a popup.
    */
   bool IsInChromeDocumentOrPopup()
   {
     return mIsInChromePresContext || mIsBuildingForPopup;
   }
@@ -2198,16 +2201,17 @@ private:
   bool mBuildingInvisibleItems;
   bool mHitTestIsForVisibility;
   bool mIsBuilding;
   bool mInInvalidSubtree;
   bool mBuildCompositorHitTestInfo;
   bool mLessEventRegionItems;
   bool mDisablePartialUpdates;
   bool mPartialBuildFailed;
+  bool mIsInActiveDocShell;
 };
 
 class nsDisplayItem;
 class nsDisplayList;
 class RetainedDisplayList;
 /**
  * nsDisplayItems are put in singly-linked lists rooted in an nsDisplayList.
  * nsDisplayItemLink holds the link. The lists are linked from lowest to