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

Unified Diff: android_webview/browser/browser_view_renderer.cc

Issue 1063853005: Unify Android Webview and Chrome's fling (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: add proguard Created 5 years, 6 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: 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..61a91921f26477d3f097d93ac1d29c9ac0edaf9a 100644
--- a/android_webview/browser/browser_view_renderer.cc
+++ b/android_webview/browser/browser_view_renderer.cc
@@ -414,6 +414,16 @@ void BrowserViewRenderer::OnDetachedFromWindow() {
UpdateCompositorIsActive();
}
+void BrowserViewRenderer::OnComputeScroll(base::TimeTicks animation_time) {
+ if (pending_fling_animation_.is_null())
+ return;
+ TRACE_EVENT0("android_webview", "BrowserViewRenderer::OnComputeScroll");
+ 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 +561,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 +616,15 @@ BrowserViewRenderer::RootLayerStateAsValue(
return state;
}
+void BrowserViewRenderer::SetNeedsAnimateScroll(
+ const AnimationCallback& scroll_animation) {
+ pending_fling_animation_ = scroll_animation;
+ // No need to reschedule the fallback tick here because the compositor is
+ // fine with the animation not being ticked. The invalidate could happen some
+ // time later, or not at all.
+ client_->PostInvalidate();
+}
+
void BrowserViewRenderer::DidOverscroll(gfx::Vector2dF accumulated_overscroll,
gfx::Vector2dF latest_overscroll_delta,
gfx::Vector2dF current_fling_velocity) {
@@ -618,7 +637,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() {
« no previous file with comments | « android_webview/browser/browser_view_renderer.h ('k') | android_webview/browser/browser_view_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698