-
David Bokan authored
This CL fixes a bug when scrolling from outside the root scroller hierarchy. The root scroller is the "main" scroller on a page. On Android, this can be designated on an element other than the document. However, it's still possible to scroll a chain of elements outside of the root scroller subtree. For example, from a sibling of the root scroller or from a |position: fixed| element. In these cases, when the scroll chains to the root, we still want to scroll the visual viewport so that we support panning around if the user is zoomed in. We don't do this on the main thread prior to this CL. Typically, the VisualViewport is scrolled by using the RootFrameViewport class. However, in this case we can't use it since that would cause scrolling in the root scroller (and thus change behavior based on whether the page is viewed using a UA that supports root scroller). This CL adds a special case to Node::NativeApplyScroll. When we construct a chain that doesn't end at the root scroller, we'll always add the root LayoutView to the scroll chain. When scrolling it, we'll attempt to scroll the visual viewport if the document itself can no longer scroll. Note: we have an equivalent special case in LayerTreeHostImpl::ApplyScroll where we can pass a bool to viewport()->ScrollBy() to specify that we should scroll only the visual viewport. This behavior is somewhat more natural in CC since the scroll chain walks the ScrollTree which contains the visual viewport. Blink's scrolling code assumes all scrollable nodes are DOM nodes which isn't true of the visual viewport; hence the need to make this a special case of the root document node. This was implemented in CC in https://crrev.com/c/1752866. At the time, it was assumed this case would be exceedingly rare on the main thread so it was left unimplemented. However, fixing bug 1011866 will result in this case becoming more common. Bug: 977954, 1011866 Change-Id: I7d2d9cb70b66b54a8c972af4bdc6d69978fe690b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1859940Reviewed-by:
Philip Rogers <pdr@chromium.org> Commit-Queue: David Bokan <bokan@chromium.org> Cr-Commit-Position: refs/heads/master@{#707222}
b90fd462