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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1063853005: Unify Android Webview and Chrome's fling (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: comments Created 5 years, 7 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 c90087641c359b49dec6150e13fb4196a0eeed4c..187704651a732a0855f8beaa62b6316e56a7a788 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -390,8 +390,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);
@@ -450,6 +453,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) {
@@ -1754,9 +1773,9 @@ LayerImpl* LayerTreeHostImpl::CurrentlyScrollingLayer() const {
bool LayerTreeHostImpl::IsActivelyScrolling() const {
return (did_lock_scrolling_layer_ && CurrentlyScrollingLayer()) ||
(InnerViewportScrollLayer() &&
- InnerViewportScrollLayer()->IsExternalFlingActive()) ||
+ InnerViewportScrollLayer()->IsExternalScrollActive()) ||
(OuterViewportScrollLayer() &&
- OuterViewportScrollLayer()->IsExternalFlingActive());
+ OuterViewportScrollLayer()->IsExternalScrollActive());
}
// Content layers can be either directly scrollable or contained in an outer
@@ -2712,13 +2731,6 @@ InputHandler::ScrollStatus LayerTreeHostImpl::FlingScrollBegin() {
if (!active_tree_->CurrentlyScrollingLayer())
return SCROLL_IGNORED;
- if (settings_.ignore_root_layer_flings &&
- (active_tree_->CurrentlyScrollingLayer() == InnerViewportScrollLayer() ||
- active_tree_->CurrentlyScrollingLayer() == OuterViewportScrollLayer())) {
- ClearCurrentlyScrollingLayer();
- return SCROLL_IGNORED;
- }
-
if (!wheel_scrolling_) {
// Allow the fling to lock to the first layer that moves after the initial
// fling |ScrollBy()| event.
@@ -2951,6 +2963,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?
aelias_OOO_until_Jul13 2015/05/09 03:32:05 Maybe unnecessary optimization?
hush (inactive) 2015/05/13 23:26:20 Actually I think we can't skip even when scrolling
+ if (input_handler_client_)
+ input_handler_client_->Animate(monotonic_time);
+}
+
void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) {
if (!page_scale_animation_)
return;

Powered by Google App Engine
This is Rietveld 408576698