diff --git a/gfx/layers/wr/HitTestInfoManager.cpp b/gfx/layers/wr/HitTestInfoManager.cpp index 17ebced04344..5c8f8d0b8e75 100644 --- a/gfx/layers/wr/HitTestInfoManager.cpp +++ b/gfx/layers/wr/HitTestInfoManager.cpp @@ -89,7 +89,7 @@ void HitTestInfoManager::ProcessItem( return; } - HITTEST_INFO_LOG("+ [%d, %d, %d, %d]: flags: 0x%x, viewId: %llu\n", area.x, + HITTEST_INFO_LOG("+ [%d, %d, %d, %d]: flags: 0x%x, viewId: %lu\n", area.x, area.y, area.width, area.height, flags.serialize(), viewId); CreateWebRenderCommands(aBuilder, aItem, area, flags, viewId); @@ -106,7 +106,7 @@ bool HitTestInfoManager::Update(const nsRect& aArea, if (mViewId == aViewId && mFlags == aFlags && mArea.Contains(aArea) && mSpaceAndClipChain == aSpaceAndClip) { // The previous hit testing information can be reused. - HITTEST_INFO_LOG("s [%d, %d, %d, %d]: flags: 0x%x, viewId: %llu\n", aArea.x, + HITTEST_INFO_LOG("s [%d, %d, %d, %d]: flags: 0x%x, viewId: %lu\n", aArea.x, aArea.y, aArea.width, aArea.height, aFlags.serialize(), aViewId); return false; diff --git a/layout/generic/nsCanvasFrame.cpp b/layout/generic/nsCanvasFrame.cpp index f698599d75f5..316569acb2c4 100644 --- a/layout/generic/nsCanvasFrame.cpp +++ b/layout/generic/nsCanvasFrame.cpp @@ -554,7 +554,7 @@ void nsCanvasFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, if (bgItem) { thisItemList.AppendToTop( nsDisplayFixedPosition::CreateForFixedBackground( - aBuilder, this, nullptr, bgItem, i)); + aBuilder, this, nullptr, bgItem, i, asr)); } } else { diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index 4f77e25f971f..ae9647713b32 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -3243,7 +3243,7 @@ AppendedBackgroundType nsDisplayBackgroundImage::AppendBackgroundItemsToTop( thisItemList.AppendToTop( nsDisplayFixedPosition::CreateForFixedBackground( - aBuilder, aFrame, aSecondaryReferenceFrame, bgItem, i)); + aBuilder, aFrame, aSecondaryReferenceFrame, bgItem, i, asr)); } } else { // bgData.shouldFixToViewport == false nsDisplayBackgroundImage* bgItem = CreateBackgroundImage( @@ -5428,7 +5428,8 @@ nsRegion nsDisplaySubDocument::GetOpaqueRegion(nsDisplayListBuilder* aBuilder, /* static */ nsDisplayFixedPosition* nsDisplayFixedPosition::CreateForFixedBackground( nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsIFrame* aSecondaryFrame, - nsDisplayBackgroundImage* aImage, const uint16_t aIndex) { + nsDisplayBackgroundImage* aImage, const uint16_t aIndex, + const ActiveScrolledRoot* aScrollTargetASR) { nsDisplayList temp; temp.AppendToTop(aImage); @@ -5436,36 +5437,38 @@ nsDisplayFixedPosition* nsDisplayFixedPosition::CreateForFixedBackground( auto tableType = GetTableTypeFromFrame(aFrame); const uint16_t index = CalculateTablePerFrameKey(aIndex + 1, tableType); return MakeDisplayItemWithIndex( - aBuilder, aSecondaryFrame, index, &temp, aFrame); + aBuilder, aSecondaryFrame, index, &temp, aFrame, aScrollTargetASR); } - return MakeDisplayItemWithIndex(aBuilder, aFrame, - aIndex + 1, &temp); + return MakeDisplayItemWithIndex( + aBuilder, aFrame, aIndex + 1, &temp, aScrollTargetASR); } nsDisplayFixedPosition::nsDisplayFixedPosition( nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot, - const ActiveScrolledRoot* aContainerASR) + const ActiveScrolledRoot* aScrollTargetASR) : nsDisplayOwnLayer(aBuilder, aFrame, aList, aActiveScrolledRoot), - mContainerASR(aContainerASR), + mScrollTargetASR(aScrollTargetASR), mIsFixedBackground(false) { MOZ_COUNT_CTOR(nsDisplayFixedPosition); } -nsDisplayFixedPosition::nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, - nsIFrame* aFrame, - nsDisplayList* aList) +nsDisplayFixedPosition::nsDisplayFixedPosition( + nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, + const ActiveScrolledRoot* aScrollTargetASR) : nsDisplayOwnLayer(aBuilder, aFrame, aList, aBuilder->CurrentActiveScrolledRoot()), - mContainerASR(nullptr), // XXX maybe this should be something? + // For fixed backgrounds, this is the ASR for the nearest scroll frame. + mScrollTargetASR(aScrollTargetASR), mIsFixedBackground(true) { MOZ_COUNT_CTOR(nsDisplayFixedPosition); } ScrollableLayerGuid::ViewID nsDisplayFixedPosition::GetScrollTargetId() { - if (mContainerASR && !nsLayoutUtils::IsReallyFixedPos(mFrame)) { - return mContainerASR->GetViewId(); + if (mScrollTargetASR && + (mIsFixedBackground || !nsLayoutUtils::IsReallyFixedPos(mFrame))) { + return mScrollTargetASR->GetViewId(); } return nsLayoutUtils::ScrollIdForRootScrollFrame(mFrame->PresContext()); } @@ -5503,9 +5506,10 @@ bool nsDisplayFixedPosition::UpdateScrollData( } void nsDisplayFixedPosition::WriteDebugInfo(std::stringstream& aStream) { - aStream << nsPrintfCString(" (containerASR %s) (scrolltarget %" PRIu64 ")", - ActiveScrolledRoot::ToString(mContainerASR).get(), - GetScrollTargetId()) + aStream << nsPrintfCString( + " (containerASR %s) (scrolltarget %" PRIu64 ")", + ActiveScrolledRoot::ToString(mScrollTargetASR).get(), + GetScrollTargetId()) .get(); } @@ -5540,8 +5544,8 @@ TableType GetTableTypeFromFrame(nsIFrame* aFrame) { nsDisplayTableFixedPosition::nsDisplayTableFixedPosition( nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, - nsIFrame* aAncestorFrame) - : nsDisplayFixedPosition(aBuilder, aFrame, aList), + nsIFrame* aAncestorFrame, const ActiveScrolledRoot* aScrollTargetASR) + : nsDisplayFixedPosition(aBuilder, aFrame, aList, aScrollTargetASR), mAncestorFrame(aAncestorFrame) { if (aBuilder->IsRetainingDisplayList()) { mAncestorFrame->AddDisplayItem(this); diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h index 445b75e17e51..61394d25e960 100644 --- a/layout/painting/nsDisplayList.h +++ b/layout/painting/nsDisplayList.h @@ -5477,11 +5477,11 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer { nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayList* aList, const ActiveScrolledRoot* aActiveScrolledRoot, - const ActiveScrolledRoot* aContainerASR); + const ActiveScrolledRoot* aScrollTargetASR); nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, const nsDisplayFixedPosition& aOther) : nsDisplayOwnLayer(aBuilder, aOther), - mContainerASR(aOther.mContainerASR), + mScrollTargetASR(aOther.mScrollTargetASR), mIsFixedBackground(aOther.mIsFixedBackground) { MOZ_COUNT_CTOR(nsDisplayFixedPosition); } @@ -5489,7 +5489,7 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer { static nsDisplayFixedPosition* CreateForFixedBackground( nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsIFrame* aSecondaryFrame, nsDisplayBackgroundImage* aImage, - const uint16_t aIndex); + const uint16_t aIndex, const ActiveScrolledRoot* aScrollTargetASR); MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayFixedPosition) @@ -5516,10 +5516,11 @@ class nsDisplayFixedPosition : public nsDisplayOwnLayer { protected: // For background-attachment:fixed nsDisplayFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsDisplayList* aList); + nsDisplayList* aList, + const ActiveScrolledRoot* aScrollTargetASR); ViewID GetScrollTargetId(); - RefPtr mContainerASR; + RefPtr mScrollTargetASR; bool mIsFixedBackground; private: @@ -5542,7 +5543,8 @@ class nsDisplayTableFixedPosition : public nsDisplayFixedPosition { protected: nsDisplayTableFixedPosition(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, - nsDisplayList* aList, nsIFrame* aAncestorFrame); + nsDisplayList* aList, nsIFrame* aAncestorFrame, + const ActiveScrolledRoot* aScrollTargetASR); nsDisplayTableFixedPosition(nsDisplayListBuilder* aBuilder, const nsDisplayTableFixedPosition& aOther)