Skip to content
  • Jan Henning's avatar
    Bug 1498812 - Part 9: Switch session store/session history to use visual... · 70dd2125
    Jan Henning authored
    Bug 1498812 - Part 9: Switch session store/session history to use visual viewport for scroll position tracking. r=mikedeboer,snorp
    
    For simplicity's sake, for now we keep storing only one scroll position per
    history entry (bug 1499210), so if we have to choose between the layout and the
    visual viewport, the latter is a vastly better choice, as it more accurately
    represents the scroll position as perceived by the user, especially when the
    page has been pinch-zoomed.
    
    This also means that instead of the normal scroll events, the session store now
    has to listen for the corresponding events specific to the visual viewport.
    
    We also extend the scroll position test to check that the scroll position isn't
    just properly saved, but also actually properly restored in practice as well.
    We only add this test now instead of already adding it beforehand like we did
    with the rest of the test
    - to avoid having to temporarily extend the checkScroll() helper function to
      deal with todo()/todo_is etc.
    - because getting that part of the test to complete without timing out (which
      would be one of its natural failure modes, because the expected events would
      be missing) would require faking even more scroll events
    - because we already have the todo() tests that are telling us the we didn't
      *store* any scroll position in the first place, so there's no point in trying
      to actually restore anything
    
    For the GeckoView saveAndRestoreState test, we now spin the event loop once
    before setting the scroll position in order to give APZ opportunity to settle
    down after the initial page load.
    
    Differential Revision: https://phabricator.services.mozilla.com/D15690
    
    --HG--
    extra : moz-landing-system : lando
    70dd2125