Skip to content
  • Jan Henning's avatar
    Bug 1265818 - Part 2 - Add scriptable methods for getting and setting PresStates from JS. r=jst · 0e575681
    Jan Henning authored
    This will allow the session store to store and restore scroll positions (and pinch zoom on Android) for past session history entries as well, whereas today only the scroll position of the current page is saved.
    
    As a LayoutHistoryState saves its PresStates in a hash table that doesn't allow direct access to its contents if you don't already know the entry's key, we provide a function to iterate over all stored PresStates and retrieve their keys, which can then be used to get access to each individual PresState in turn. Since nsPresState is little more than a fancy struct and we don't want to have to turn it into a full-blown XPCOM-compatible interface, we just pass the scroll/zoom-related values we're interested in as in/out parameters from/to JS via the LayoutHistoryState.
    
    We also require a helper method for initialising an SHEntry's LayoutHistoryState, since normally this doesn't happen until the PresShell wants to capture the history state in it. We on the other hand require a LayoutHistoryState to be present immediately after creation of a fresh SHEntry object, so we can feed it the session store data during history restoration.
    
    MozReview-Commit-ID: FfZf8KDsVWl
    ***
    
    --HG--
    extra : rebase_source : 0b3f729bff3ac24680d6fe8a0fb796979886170b
    0e575681