[iOS] Fix PageDisplayState before applying scroll offset.
The referenced bug occurs due to ordering issues of our viewport inset updates relative to PageDisplayState application. When reloading the page using overscroll, the PageDisplayState is stored. Since the page is scrolled to the top, the contentOffset is -contentInset.top (-92 in portrait on iPhone X). Upon rotating the device, the following events occur: 1) CRWWebController's |-orientationDidChange| kicks off the scroll restoration process for the y offset of -92. This is asynchronous because it first executes JavaScript in order to extract the viewport tag. 2) BVC's |-traitCollectionDidChange:| updates the toolbar heights for the new horizontal size class, which in turn updates the scroll view's contentInset. For landscape iPhone X, this produces a top contentInset of 50 (i.e. the "scrolled to top" y content offset is -50). 3) The asynchronous viewport meta tag data extraction finishes and CRWWebController restores the -92 contentOffset, pushing the page below the toolbar. This CL updates PageScrollState semantics such that it stores the offset from the scrolled-to-top-left position, which allows the application of PageScrollStates contentInset-agnostic. Bug: 923856 Change-Id: I468970abbdbd200e4ac836d5664a985f0c8e3e71 Reviewed-on: https://chromium-review.googlesource.com/c/1432377Reviewed-by:Eugene But <eugenebut@chromium.org> Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org> Auto-Submit: Kurt Horimoto <kkhorimoto@chromium.org> Cr-Commit-Position: refs/heads/master@{#625828}
Showing
Please register or sign in to comment