Fix root layer scrolls crash in viewport registration

The crash would occur when a non-main frame finished its lifecycle
update before the main frame. This can happen in an OOPIF as lifecycle
on local roots is independent. This would kick the viewport layer
registration method while the main frame hadn't yet completed
compositing, leading to a CanQueryCompositingState DCHECK. This occured
only when root-layer-scrolls is turned on because, without it, the
container and scrolling layers would be the layers created by the
PaintLayerCompositor (unless the test/page sets a rootScroller) which
live outside the document lifecycle.

This patch fixes the issue by only reregistering viewport layers after
a compositing update on the frame that contains the global root
scroller. This guarantees that we're in the correct lifecycle state.

Bug: 800566, 642378
Change-Id: Ibbaa77b7f40794f16cecdaec46353dd00bc277e9
Reviewed-on: https://chromium-review.googlesource.com/877338
Reviewed-by: Steve Kobes <[email protected]>
Commit-Queue: David Bokan <[email protected]>
Cr-Commit-Position: refs/heads/master@{#531243}
4 files changed