Commit 9405cbcc authored by Botond Ballo's avatar Botond Ballo
Browse files

Bug 1493742 - When accepting a layout viewport update from the main thread,...

Bug 1493742 - When accepting a layout viewport update from the main thread, constrain its position to enclose the visual viewport. r=kats

APZ wants the *size* of the layout viewport from the main thread, but it
knows the position better.

Differential Revision: https://phabricator.services.mozilla.com/D9448

--HG--
extra : moz-landing-system : lando
parent b62d70d3
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4431,6 +4431,16 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe
    SmoothScrollTo(Metrics().GetSmoothScrollOffset());
  }

  if (viewportUpdated) {
    // While we want to accept the main thread's layout viewport _size_,
    // its position may be out of date in light of async scrolling, to
    // adjust it if necessary to make sure it continues to enclose the
    // visual viewport.
    // Note: it's important to do this _after_ we've accepted any
    // updated composition bounds.
    Metrics().RecalculateViewportOffset();
  }

  if (needContentRepaint) {
    // This repaint request is not driven by a user action on the APZ side
    RequestContentRepaint(false);