зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1730856 - Part 1: Use the correct scroll target for fixed backgrounds. r=mstange
Differential Revision: https://phabricator.services.mozilla.com/D127120
This commit is contained in:
Родитель
d3b12b23cf
Коммит
6e6f9c754a
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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<nsDisplayTableFixedPosition>(
|
||||
aBuilder, aSecondaryFrame, index, &temp, aFrame);
|
||||
aBuilder, aSecondaryFrame, index, &temp, aFrame, aScrollTargetASR);
|
||||
}
|
||||
|
||||
return MakeDisplayItemWithIndex<nsDisplayFixedPosition>(aBuilder, aFrame,
|
||||
aIndex + 1, &temp);
|
||||
return MakeDisplayItemWithIndex<nsDisplayFixedPosition>(
|
||||
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);
|
||||
|
|
|
@ -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<const ActiveScrolledRoot> mContainerASR;
|
||||
RefPtr<const ActiveScrolledRoot> 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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче