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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 274323004: NOT FOR LANDING - [WebView] Allow fling animation via the LayerScrollOffsetDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test Created 5 years, 10 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 eddbc60b09655a7594d09a16f089205f8d945bee..99a480da692899741e180cd499500398e1ca5278 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -379,8 +379,11 @@ bool LayerTreeHostImpl::CanDraw() const {
}
void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) {
- if (input_handler_client_)
- input_handler_client_->Animate(monotonic_time);
+ if (!root_layer_scroll_offset_delegate_ ||
+ (CurrentlyScrollingLayer() != InnerViewportScrollLayer() &&
+ CurrentlyScrollingLayer() != OuterViewportScrollLayer())) {
+ AnimateInput(monotonic_time);
+ }
AnimatePageScale(monotonic_time);
AnimateLayers(monotonic_time);
AnimateScrollbars(monotonic_time);
@@ -439,6 +442,22 @@ void LayerTreeHostImpl::StartPageScaleAnimation(
client_->RenewTreePriority();
}
+void LayerTreeHostImpl::SetNeedsAnimateInput() {
+ if (root_layer_scroll_offset_delegate_ &&
+ (CurrentlyScrollingLayer() == InnerViewportScrollLayer() ||
+ CurrentlyScrollingLayer() == OuterViewportScrollLayer())) {
+ if (root_layer_animation_callback_.is_null()) {
+ root_layer_animation_callback_ =
+ base::Bind(&LayerTreeHostImpl::AnimateInput, AsWeakPtr());
+ }
+ root_layer_scroll_offset_delegate_->SetNeedsAnimate(
+ root_layer_animation_callback_);
+ return;
+ }
+
+ SetNeedsAnimate();
+}
+
bool LayerTreeHostImpl::IsCurrentlyScrollingLayerAt(
const gfx::Point& viewport_point,
InputHandler::ScrollInputType type) {
@@ -2824,7 +2843,7 @@ InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
if (!active_tree_->CurrentlyScrollingLayer())
return SCROLL_IGNORED;
- if (settings_.ignore_root_layer_flings &&
+ if (false && settings_.ignore_root_layer_flings &&
(active_tree_->CurrentlyScrollingLayer() == InnerViewportScrollLayer() ||
active_tree_->CurrentlyScrollingLayer() == OuterViewportScrollLayer())) {
ClearCurrentlyScrollingLayer();
@@ -3065,6 +3084,13 @@ void LayerTreeHostImpl::ScrollViewportBy(gfx::Vector2dF scroll_delta) {
InnerViewportScrollLayer()->ScrollBy(unused_delta);
}
+void LayerTreeHostImpl::AnimateInput(base::TimeTicks monotonic_time) {
+ DCHECK(proxy_->IsImplThread());
+ // TODO(jdduke): Skip when scrolling the root layer with an offset delegate?
+ if (input_handler_client_)
+ input_handler_client_->Animate(monotonic_time);
+}
+
void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) {
if (!page_scale_animation_)
return;
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698