Index: android_webview/browser/browser_view_renderer.cc |
diff --git a/android_webview/browser/browser_view_renderer.cc b/android_webview/browser/browser_view_renderer.cc |
index b3fbe01ebf45ff7bc95b4634d2f654afe35fa5c3..2d3748bbc5b594758bdf7962663e4caf8b2c10c1 100644 |
--- a/android_webview/browser/browser_view_renderer.cc |
+++ b/android_webview/browser/browser_view_renderer.cc |
@@ -414,6 +414,17 @@ void BrowserViewRenderer::OnDetachedFromWindow() { |
UpdateCompositorIsActive(); |
} |
+void BrowserViewRenderer::OnComputeScroll(base::TimeTicks animation_time) { |
+ if (pending_fling_animation_.is_null()) |
+ return; |
+ TRACE_EVENT0("android_webview", |
+ "BrowserViewRenderer::FlushPendingScrollAnimation"); |
boliu
2015/06/08 16:54:52
Fix trace event name
hush (inactive)
2015/06/09 19:11:33
Done.
|
+ DCHECK(!pending_fling_animation_.is_null()); |
+ AnimationCallback animation = pending_fling_animation_; |
+ pending_fling_animation_.Reset(); |
+ animation.Run(animation_time); |
+} |
+ |
void BrowserViewRenderer::ReleaseHardware() { |
DCHECK(hardware_enabled_); |
ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI()); |
@@ -551,8 +562,8 @@ gfx::Vector2dF BrowserViewRenderer::GetTotalRootLayerScrollOffset() { |
return scroll_offset_dip_; |
} |
-bool BrowserViewRenderer::IsExternalFlingActive() const { |
- return client_->IsFlingActive(); |
+bool BrowserViewRenderer::IsExternalScrollActive() const { |
+ return client_->IsSmoothScrollingActive(); |
} |
void BrowserViewRenderer::UpdateRootLayerState( |
@@ -606,6 +617,12 @@ BrowserViewRenderer::RootLayerStateAsValue( |
return state; |
} |
+void BrowserViewRenderer::SetNeedsAnimateScroll( |
+ const AnimationCallback& scroll_animation) { |
+ pending_fling_animation_ = scroll_animation; |
+ PostInvalidateWithFallback(); |
boliu
2015/06/08 16:54:52
Actually I'm eating my words. You said it's ok if
hush (inactive)
2015/06/09 19:11:33
Okay. I will just postInvalidate and add a comment
|
+} |
+ |
void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
gfx::Vector2dF latest_overscroll_delta, |
gfx::Vector2dF current_fling_velocity) { |
@@ -618,7 +635,10 @@ void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll, |
scaled_overscroll_delta + overscroll_rounding_error_); |
overscroll_rounding_error_ = |
scaled_overscroll_delta - rounded_overscroll_delta; |
- client_->DidOverscroll(rounded_overscroll_delta); |
+ gfx::Vector2dF fling_velocity_pixels = |
+ gfx::ScaleVector2d(current_fling_velocity, physical_pixel_scale); |
+ |
+ client_->DidOverscroll(rounded_overscroll_delta, fling_velocity_pixels); |
} |
void BrowserViewRenderer::PostInvalidate() { |
@@ -641,7 +661,8 @@ void BrowserViewRenderer::PostInvalidateWithFallback() { |
bool throttle_fallback_tick = |
(is_paused_ && !clear_view_) || (attached_to_window_ && !window_visible_); |
- if (throttle_fallback_tick || fallback_tick_pending_) |
+ if (throttle_fallback_tick || fallback_tick_pending_ || |
+ !pending_fling_animation_.is_null()) |
boliu
2015/06/08 16:54:52
don't forget to remove this
(Seems to be backward
hush (inactive)
2015/06/09 19:11:33
okay,.. removed this. And yes. The logic here is b
|
return; |
DCHECK(post_fallback_tick_.IsCancelled()); |