Bug 1728706. Use IsRootContentDocumentCrossProcess for top layer related optimization in ScrollFrameHelper::BuildDisplayList. r=botond
authorTimothy Nikkel <tnikkel@gmail.com>
Fri, 03 Sep 2021 19:17:17 +0000
changeset 590990 0ba31a6b4959c8cb5542c5b4f9e006267e42a469
parent 590989 3c69fc87e9d86e262b2931ecf9117fc5353a8c35
child 590991 6b58b83b626e01f7b2af85156c293c9bccd82816
push id149180
push usertnikkel@mozilla.com
push dateFri, 03 Sep 2021 19:19:41 +0000
treeherderautoland@0ba31a6b4959 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1728706, 1664804
milestone93.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 1728706. Use IsRootContentDocumentCrossProcess for top layer related optimization in ScrollFrameHelper::BuildDisplayList. r=botond The reason this IsRootContentDocument check was added was because of a test where there is fixed pos content in the top layer of a subdocument. This fixed pos content gets removed from the display list as part of this optimization. So no WebRenderLayerScrollData gets created for the asr of this fixed pos content, which causes an assert. (from https://bugzilla.mozilla.org/show_bug.cgi?id=1664804#c18 ) The code that ensures there is WebRenderLayerScrollData for the root asr is here https://searchfox.org/mozilla-central/rev/55e8eba74b60b92d04b781f7928f54ef76b13fa9/gfx/layers/wr/WebRenderCommandBuilder.cpp#1636 and it happens for all root content documents in the process, so this optimization is valid for any root content document in the process. Differential Revision: https://phabricator.services.mozilla.com/D124298
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -4055,23 +4055,25 @@ void ScrollFrameHelper::BuildDisplayList
   }
 
   // Create any required items for the 'top layer' and check if they'll be
   // opaque over the entire area of the viewport. If they are, then we can
   // skip building display items for the rest of the page.
   bool topLayerIsOpaque = false;
   if (nsDisplayWrapList* topLayerWrapList =
           MaybeCreateTopLayerItems(aBuilder, &topLayerIsOpaque)) {
-    // If the top layer content is opaque, and we're the root content document,
-    // we can drop the display items behind it. We only support doing this for
-    // the root document, since the top layer content might have fixed position
-    // items that have a scrolltarget referencing the APZ data for the document.
-    // APZ builds this data implicitly for the root document, but subdocuments
-    // need their display items to generate it, so we can't cull those.
-    if (topLayerIsOpaque && mOuter->PresContext()->IsRootContentDocument()) {
+    // If the top layer content is opaque, and we're the root content document
+    // in the process, we can drop the display items behind it. We only support
+    // doing this for the root content document in the process, since the top
+    // layer content might have fixed position items that have a scrolltarget
+    // referencing the APZ data for the document. APZ builds this data
+    // implicitly for the root content document in the process, but subdocuments
+    // etc need their display items to generate it, so we can't cull those.
+    if (topLayerIsOpaque &&
+        mOuter->PresContext()->IsRootContentDocumentInProcess()) {
       set.DeleteAll(aBuilder);
     }
     set.PositionedDescendants()->AppendToTop(topLayerWrapList);
   }
 
   if (willBuildAsyncZoomContainer) {
     MOZ_ASSERT(mClipAllDescendants);