зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1470267 - Store the visual viewport offset in nsIPresShell. r=botond
Added a data member to nsIPresShell to store the visual viewport offset. APZ will update the visual viewport offset in the presShell for root scroll frames on every repaint request. MozReview-Commit-ID: Ksou43hrE6H --HG-- extra : rebase_source : 812c88efc7556c4bff2a62834cfaaec6e6945093
This commit is contained in:
Родитель
1e95ba963d
Коммит
e8cc1dc6df
|
@ -74,6 +74,16 @@ RecenterDisplayPort(mozilla::layers::FrameMetrics& aFrameMetrics)
|
|||
aFrameMetrics.SetDisplayPortMargins(margins);
|
||||
}
|
||||
|
||||
static already_AddRefed<nsIPresShell>
|
||||
GetPresShell(const nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> result;
|
||||
if (nsIDocument* doc = aContent->GetComposedDoc()) {
|
||||
result = doc->GetShell();
|
||||
}
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
static CSSPoint
|
||||
ScrollFrameTo(nsIScrollableFrame* aFrame, const FrameMetrics& aMetrics, bool& aSuccessOut)
|
||||
{
|
||||
|
@ -146,6 +156,11 @@ ScrollFrame(nsIContent* aContent,
|
|||
if (sf) {
|
||||
sf->ResetScrollInfoIfGeneration(aMetrics.GetScrollGeneration());
|
||||
sf->SetScrollableByAPZ(!aMetrics.IsScrollInfoLayer());
|
||||
if (sf->IsRootScrollFrameOfDocument()) {
|
||||
if (nsCOMPtr<nsIPresShell> shell = GetPresShell(aContent)) {
|
||||
shell->SetVisualViewportOffset(CSSPoint::ToAppUnits(aMetrics.GetScrollOffset()));
|
||||
}
|
||||
}
|
||||
}
|
||||
bool scrollUpdated = false;
|
||||
CSSPoint apzScrollOffset = aMetrics.GetScrollOffset();
|
||||
|
@ -230,16 +245,6 @@ SetDisplayPortMargins(nsIPresShell* aPresShell,
|
|||
nsLayoutUtils::SetDisplayPortBaseIfNotSet(aContent, base);
|
||||
}
|
||||
|
||||
static already_AddRefed<nsIPresShell>
|
||||
GetPresShell(const nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> result;
|
||||
if (nsIDocument* doc = aContent->GetComposedDoc()) {
|
||||
result = doc->GetShell();
|
||||
}
|
||||
return result.forget();
|
||||
}
|
||||
|
||||
static void
|
||||
SetPaintRequestTime(nsIContent* aContent, const TimeStamp& aPaintRequestTime)
|
||||
{
|
||||
|
|
|
@ -1667,6 +1667,14 @@ public:
|
|||
return mScrollPositionClampingScrollPortSize;
|
||||
}
|
||||
|
||||
void SetVisualViewportOffset(const nsPoint& aScrollOffset) {
|
||||
mVisualViewportOffset = aScrollOffset;
|
||||
}
|
||||
|
||||
nsPoint GetVisualViewportOffset() const {
|
||||
return mVisualViewportOffset;
|
||||
}
|
||||
|
||||
virtual void WindowSizeMoveDone() = 0;
|
||||
virtual void SysColorChanged() = 0;
|
||||
virtual void ThemeChanged() = 0;
|
||||
|
@ -1745,6 +1753,8 @@ protected:
|
|||
|
||||
nsSize mScrollPositionClampingScrollPortSize;
|
||||
|
||||
nsPoint mVisualViewportOffset;
|
||||
|
||||
// A list of stack weak frames. This is a pointer to the last item in the list.
|
||||
AutoWeakFrame* mAutoWeakFrames;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче