| 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 b9336d6119a230f9ccef7ac87c39bad71015c35d..ab3bc84822536ed11dbf78f6961d0454e4e97a6d 100644
|
| --- a/android_webview/browser/browser_view_renderer.cc
|
| +++ b/android_webview/browser/browser_view_renderer.cc
|
| @@ -414,6 +414,12 @@ void BrowserViewRenderer::OnDetachedFromWindow() {
|
| UpdateCompositorIsActive();
|
| }
|
|
|
| +void BrowserViewRenderer::OnComputeScroll(base::TimeTicks animation_time) {
|
| + if (pending_fling_animation_.is_null())
|
| + return;
|
| + FlushPendingFlingAnimation(animation_time);
|
| +}
|
| +
|
| void BrowserViewRenderer::ReleaseHardware() {
|
| DCHECK(hardware_enabled_);
|
| ReturnUnusedResource(shared_renderer_state_.PassUncommittedFrameOnUI());
|
| @@ -605,6 +611,13 @@ BrowserViewRenderer::RootLayerStateAsValue(
|
| return state;
|
| }
|
|
|
| +void BrowserViewRenderer::SetNeedsAnimateFling(
|
| + const AnimationCallback& fling_animation) {
|
| + // TODO(jdduke): Skip invalidate if animation already pending?
|
| + pending_fling_animation_ = fling_animation;
|
| + client_->PostInvalidate();
|
| +}
|
| +
|
| void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll,
|
| gfx::Vector2dF latest_overscroll_delta,
|
| gfx::Vector2dF current_fling_velocity) {
|
| @@ -617,7 +630,19 @@ 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);
|
| +
|
| + const bool first_overscroll_x =
|
| + accumulated_overscroll.x() &&
|
| + accumulated_overscroll.x() == latest_overscroll_delta.x();
|
| + const bool first_overscroll_y =
|
| + accumulated_overscroll.y() &&
|
| + accumulated_overscroll.y() == latest_overscroll_delta.y();
|
| +
|
| + client_->DidOverscroll(rounded_overscroll_delta, fling_velocity_pixels,
|
| + first_overscroll_x, first_overscroll_y);
|
| }
|
|
|
| void BrowserViewRenderer::PostInvalidate() {
|
| @@ -694,6 +719,16 @@ void BrowserViewRenderer::ForceFakeCompositeSW() {
|
| CompositeSW(&canvas);
|
| }
|
|
|
| +void BrowserViewRenderer::FlushPendingFlingAnimation(
|
| + base::TimeTicks animation_time) {
|
| + TRACE_EVENT0("android_webview",
|
| + "BrowserViewRenderer::FlushPendingFlingAnimation");
|
| + DCHECK(!pending_fling_animation_.is_null());
|
| + AnimationCallback animation = pending_fling_animation_;
|
| + pending_fling_animation_.Reset();
|
| + animation.Run(animation_time);
|
| +}
|
| +
|
| bool BrowserViewRenderer::CompositeSW(SkCanvas* canvas) {
|
| DCHECK(compositor_);
|
| CancelFallbackTick();
|
|
|