Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1693)

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1418493003: Let LayerTreeHostImpl::ScrollAnimated scroll the outer viewport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename IsCurrentlyScrollingRoot Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 2449788df4e23896abf10b90806008792ad85054..bb454fed6624bd48cb9322f2a211280405d8b031 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -406,8 +406,8 @@ void LayerTreeHostImpl::Animate() {
if (input_handler_client_) {
// This animates fling scrolls. But on Android WebView root flings are
// controlled by the application, so the compositor does not animate them.
- bool ignore_fling =
- settings_.ignore_root_layer_flings && IsCurrentlyScrollingRoot();
+ bool ignore_fling = settings_.ignore_root_layer_flings &&
+ IsCurrentlyScrollingInnerViewport();
if (!ignore_fling)
input_handler_client_->Animate(monotonic_time);
}
@@ -475,12 +475,12 @@ void LayerTreeHostImpl::StartPageScaleAnimation(
}
void LayerTreeHostImpl::SetNeedsAnimateInput() {
- DCHECK_IMPLIES(IsCurrentlyScrollingRoot(),
+ DCHECK_IMPLIES(IsCurrentlyScrollingInnerViewport(),
!settings_.ignore_root_layer_flings);
SetNeedsAnimate();
}
-bool LayerTreeHostImpl::IsCurrentlyScrollingRoot() const {
+bool LayerTreeHostImpl::IsCurrentlyScrollingInnerViewport() const {
LayerImpl* scrolling_layer = CurrentlyScrollingLayer();
if (!scrolling_layer)
return false;
@@ -1866,7 +1866,7 @@ bool LayerTreeHostImpl::IsActivelyScrolling() const {
// On Android WebView root flings are controlled by the application,
// so the compositor does not animate them and can't tell if they
// are actually animating. So assume there are none.
- if (settings_.ignore_root_layer_flings && IsCurrentlyScrollingRoot())
+ if (settings_.ignore_root_layer_flings && IsCurrentlyScrollingInnerViewport())
return false;
return did_lock_scrolling_layer_;
}
@@ -2396,6 +2396,14 @@ LayerImpl* LayerTreeHostImpl::FindScrollLayerForDeviceViewportPoint(
if (potentially_scrolling_layer_impl == OuterViewportScrollLayer())
potentially_scrolling_layer_impl = InnerViewportScrollLayer();
+ // Animated wheel scrolls need to scroll the outer viewport layer, and do not
+ // go through Viewport::ScrollBy which would normally handle the distribution.
+ // NOTE: This will need refactoring if we want smooth scrolling on Android.
+ if (type == ANIMATED_WHEEL &&
+ potentially_scrolling_layer_impl == InnerViewportScrollLayer()) {
+ potentially_scrolling_layer_impl = OuterViewportScrollLayer();
+ }
+
return potentially_scrolling_layer_impl;
}
@@ -2419,7 +2427,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollBeginImpl(
top_controls_manager_->ScrollBegin();
active_tree_->SetCurrentlyScrollingLayer(scrolling_layer_impl);
- wheel_scrolling_ = (type == WHEEL);
+ wheel_scrolling_ = (type == WHEEL || type == ANIMATED_WHEEL);
client_->RenewTreePriority();
UMA_HISTOGRAM_BOOLEAN("TryScroll.SlowScroll", false);
return SCROLL_STARTED;
@@ -2480,13 +2488,13 @@ InputHandler::ScrollStatus LayerTreeHostImpl::ScrollAnimated(
// ScrollAnimated is only used for wheel scrolls. We use the same bubbling
// behavior as ScrollBy to determine which layer to animate, but we do not
tdresser 2015/10/20 12:29:40 We might want to update the comment here - we don'
skobes 2015/10/20 18:28:15 Done.
// do the Android-specific things in ScrollBy like showing top controls.
- InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, WHEEL);
+ InputHandler::ScrollStatus scroll_status =
+ ScrollBegin(viewport_point, ANIMATED_WHEEL);
if (scroll_status == SCROLL_STARTED) {
gfx::Vector2dF pending_delta = scroll_delta;
for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl;
layer_impl = NextLayerInScrollOrder(layer_impl)) {
- // The inner viewport layer represents the viewport.
- if (!layer_impl->scrollable() || layer_impl == OuterViewportScrollLayer())
+ if (!layer_impl->scrollable())
continue;
gfx::ScrollOffset current_offset = layer_impl->CurrentScrollOffset();

Powered by Google App Engine
This is Rietveld 408576698