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
This commit is contained in:
Timothy Nikkel 2021-09-03 19:17:17 +00:00
Родитель 38e8910b47
Коммит 185e176645
1 изменённых файлов: 9 добавлений и 7 удалений

Просмотреть файл

@ -4060,13 +4060,15 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
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);