diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index ac7b70db4a59..1771ba278452 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -9209,7 +9209,7 @@ bool nsLayoutUtils::CanScrollOriginClobberApz(ScrollOrigin aScrollOrigin) { ScrollMetadata nsLayoutUtils::ComputeScrollMetadata( nsIFrame* aForFrame, nsIFrame* aScrollFrame, nsIContent* aContent, const nsIFrame* aReferenceFrame, LayerManager* aLayerManager, - ViewID aScrollParentId, const nsRect& aViewport, + ViewID aScrollParentId, const nsSize& aScrollPortSize, const Maybe& aClipRect, bool aIsRootContent, const Maybe& aContainerParameters) { nsPresContext* presContext = aForFrame->PresContext(); @@ -9218,7 +9218,8 @@ ScrollMetadata nsLayoutUtils::ComputeScrollMetadata( PresShell* presShell = presContext->GetPresShell(); ScrollMetadata metadata; FrameMetrics& metrics = metadata.GetMetrics(); - metrics.SetLayoutViewport(CSSRect::FromAppUnits(aViewport)); + metrics.SetLayoutViewport( + CSSRect(CSSPoint(), CSSSize::FromAppUnits(aScrollPortSize))); nsIDocShell* docShell = presContext->GetDocShell(); BrowsingContext* bc = docShell ? docShell->GetBrowsingContext() : nullptr; @@ -9640,16 +9641,16 @@ Maybe nsLayoutUtils::GetRootMetadata( if (addMetrics || ensureMetricsForRootId) { bool isRootContent = presContext->IsRootContentDocumentCrossProcess(); - nsRect viewport(aBuilder->ToReferenceFrame(frame), frame->GetSize()); + nsSize scrollPortSize = frame->GetSize(); if (isRootContent && rootScrollFrame) { nsIScrollableFrame* scrollableFrame = rootScrollFrame->GetScrollTargetFrame(); - viewport.SizeTo(scrollableFrame->GetScrollPortRect().Size()); + scrollPortSize = scrollableFrame->GetScrollPortRect().Size(); } return Some(nsLayoutUtils::ComputeScrollMetadata( frame, rootScrollFrame, content, aBuilder->FindReferenceFrameFor(frame), - aLayerManager, ScrollableLayerGuid::NULL_SCROLL_ID, viewport, Nothing(), - isRootContent, Some(aContainerParameters))); + aLayerManager, ScrollableLayerGuid::NULL_SCROLL_ID, scrollPortSize, + Nothing(), isRootContent, Some(aContainerParameters))); } return Nothing(); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 8e269a95815b..1a26f173b021 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -2903,7 +2903,7 @@ class nsLayoutUtils { nsIFrame* aForFrame, nsIFrame* aScrollFrame, nsIContent* aContent, const nsIFrame* aReferenceFrame, mozilla::layers::LayerManager* aLayerManager, ViewID aScrollParentId, - const nsRect& aViewport, const mozilla::Maybe& aClipRect, + const nsSize& aScrollPortSize, const mozilla::Maybe& aClipRect, bool aIsRoot, const mozilla::Maybe& aContainerParameters); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 3a4fbae38c8a..ddfb547dfbb4 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -4307,9 +4307,6 @@ Maybe ScrollFrameHelper::ComputeScrollMetadata( return Nothing(); } - nsPoint toReferenceFrame = - mOuter->GetOffsetToCrossDoc(aContainerReferenceFrame); - Maybe parentLayerClip; if (aClip && mAddClipRectToLayer) { parentLayerClip = Some(aClip->GetClipRect()); @@ -4320,11 +4317,9 @@ Maybe ScrollFrameHelper::ComputeScrollMetadata( MOZ_ASSERT(mScrolledFrame->GetContent()); - nsRect scrollport = mScrollPort + toReferenceFrame; - return Some(nsLayoutUtils::ComputeScrollMetadata( mScrolledFrame, mOuter, mOuter->GetContent(), aContainerReferenceFrame, - aLayerManager, mScrollParentID, scrollport, parentLayerClip, + aLayerManager, mScrollParentID, mScrollPort.Size(), parentLayerClip, isRootContent, aParameters)); } diff --git a/layout/painting/nsDisplayList.cpp b/layout/painting/nsDisplayList.cpp index a2f3ce7cf79c..8df330d515ba 100644 --- a/layout/painting/nsDisplayList.cpp +++ b/layout/painting/nsDisplayList.cpp @@ -38,6 +38,7 @@ #include "mozilla/ViewportUtils.h" #include "nsCSSRendering.h" #include "nsCSSRenderingGradients.h" +#include "nsRefreshDriver.h" #include "nsRegion.h" #include "nsStyleStructInlines.h" #include "nsStyleTransformMatrix.h" @@ -7091,13 +7092,10 @@ LayerState nsDisplayScrollInfoLayer::GetLayerState( UniquePtr nsDisplayScrollInfoLayer::ComputeScrollMetadata( LayerManager* aLayerManager, const ContainerLayerParameters& aContainerParameters) { - nsRect viewport = mScrollFrame->GetRect() - mScrollFrame->GetPosition() + - mScrollFrame->GetOffsetToCrossDoc(ReferenceFrame()); - ScrollMetadata metadata = nsLayoutUtils::ComputeScrollMetadata( mScrolledFrame, mScrollFrame, mScrollFrame->GetContent(), - ReferenceFrame(), aLayerManager, mScrollParentId, viewport, Nothing(), - false, Some(aContainerParameters)); + ReferenceFrame(), aLayerManager, mScrollParentId, mScrollFrame->GetSize(), + Nothing(), false, Some(aContainerParameters)); metadata.GetMetrics().SetIsScrollInfoLayer(true); nsIScrollableFrame* scrollableFrame = mScrollFrame->GetScrollTargetFrame(); if (scrollableFrame) {