We previously DCHECKed that we could never register a new scrollbar against a scroll layer that already has a scrollbar. i.e. We expected that the old scrollbar would be unregistered prior to registering the new one.
RootScroller can break this assumption on Android. On Android, the global rootScroller (i.e. OuterViewport) is prevented from creating its own scrollbars, instead inheriting the VisualViewport-created scrollbars. In other words, the VisualViewport creates a pair of scrollbars and they get re-assigned to whatever the current outer
This means that when we change the global rootScroller (for context see core/page/scrolling/README.md), the previous rootScroller now creates its own scrollbars and the VisualViewport scrollbars get registered to the new rootScroller. This then creates a race between moving the
VisualViewport scrollbar registration and new scrollbar registration on the old rootScroller.
Long-term, the outer viewport shouldn't own the scrollbars but for now it doesn't hurt to just unregister the scrollbar if we notice the scroller already has scrollbars registered.
Bug: 739738 Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel Change-Id: I99e8a95881e7dad19c0318a661da80f441b97b19 Reviewed-on: https://chromium-review.googlesource.com/562018
8448024 Unregister cc scrollbar when registering new one
cc/trees/layer_tree_impl.cc | 23 ++++++++++++++---------
1 file changed, 14 insertions(+), 9 deletions(-)