зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1605956 - Don't invalidate scroll anchor on visual viewport offset updates if visual viewport size is not set. r=botond
As we only use the offset if the visual viewport size is set. Differential Revision: https://phabricator.services.mozilla.com/D58226 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5015323ddf
Коммит
ce358595b7
|
@ -10649,24 +10649,25 @@ void PresShell::ResetVisualViewportSize() {
|
|||
|
||||
bool PresShell::SetVisualViewportOffset(const nsPoint& aScrollOffset,
|
||||
const nsPoint& aPrevLayoutScrollPos) {
|
||||
bool didChange = false;
|
||||
if (GetVisualViewportOffset() != aScrollOffset) {
|
||||
nsPoint prevOffset = GetVisualViewportOffset();
|
||||
mVisualViewportOffset = Some(aScrollOffset);
|
||||
didChange = true;
|
||||
nsPoint prevOffset = GetVisualViewportOffset();
|
||||
if (prevOffset == aScrollOffset) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (auto* window = nsGlobalWindowInner::Cast(mDocument->GetInnerWindow())) {
|
||||
window->VisualViewport()->PostScrollEvent(prevOffset,
|
||||
aPrevLayoutScrollPos);
|
||||
}
|
||||
mVisualViewportOffset = Some(aScrollOffset);
|
||||
|
||||
if (auto* window = nsGlobalWindowInner::Cast(mDocument->GetInnerWindow())) {
|
||||
window->VisualViewport()->PostScrollEvent(prevOffset, aPrevLayoutScrollPos);
|
||||
}
|
||||
|
||||
if (IsVisualViewportSizeSet()) {
|
||||
if (nsIScrollableFrame* rootScrollFrame =
|
||||
GetRootScrollFrameAsScrollable()) {
|
||||
ScrollAnchorContainer* container = rootScrollFrame->Anchor();
|
||||
container->UserScrolled();
|
||||
rootScrollFrame->Anchor()->UserScrolled();
|
||||
}
|
||||
}
|
||||
return didChange;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void PresShell::ScrollToVisual(const nsPoint& aVisualViewportOffset,
|
||||
|
|
Загрузка…
Ссылка в новой задаче