зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1498812 - Part 10: Return whether SetVisualViewportOffset was a no-op. r=botond
So that the caller doesn't have to retrieve and compare the previous viewport offset himself. Differential Revision: https://phabricator.services.mozilla.com/D15785 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
70dd21256f
Коммит
0ce3612dce
|
@ -10091,17 +10091,20 @@ void nsIPresShell::SetVisualViewportSize(nscoord aWidth, nscoord aHeight) {
|
|||
}
|
||||
}
|
||||
|
||||
void nsIPresShell::SetVisualViewportOffset(
|
||||
bool nsIPresShell::SetVisualViewportOffset(
|
||||
const nsPoint& aScrollOffset, const nsPoint& aPrevLayoutScrollPos) {
|
||||
bool didChange = false;
|
||||
if (mVisualViewportOffset != aScrollOffset) {
|
||||
nsPoint prevOffset = mVisualViewportOffset;
|
||||
mVisualViewportOffset = aScrollOffset;
|
||||
didChange = true;
|
||||
|
||||
if (auto* window = nsGlobalWindowInner::Cast(mDocument->GetInnerWindow())) {
|
||||
window->VisualViewport()->PostScrollEvent(prevOffset,
|
||||
aPrevLayoutScrollPos);
|
||||
}
|
||||
}
|
||||
return didChange;
|
||||
}
|
||||
|
||||
nsPoint nsIPresShell::GetVisualViewportOffsetRelativeToLayoutViewport() const {
|
||||
|
|
|
@ -1650,7 +1650,10 @@ class nsIPresShell : public nsStubDocumentObserver {
|
|||
return mVisualViewportSize;
|
||||
}
|
||||
|
||||
void SetVisualViewportOffset(const nsPoint& aScrollOffset,
|
||||
/**
|
||||
* The return value indicates whether the offset actually changed.
|
||||
*/
|
||||
bool SetVisualViewportOffset(const nsPoint& aScrollOffset,
|
||||
const nsPoint& aPrevLayoutScrollPos);
|
||||
|
||||
nsPoint GetVisualViewportOffset() const { return mVisualViewportOffset; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче