[iOS] Use UIScrollView scroll to top animation.

If you animate a UIScrollView's contentOffset while it's decelerating,
the CADisplayLink powering the deceleration scrolling is not stopped.
As a result, the deceleration will continue after the contentOffset
animation is completed.  This CL updates fullscreen's scroll to top
animation to allow the built-in UIScrollView scroll to top animation,
which cancels the deleration CADisplayLink.

Bug: 811294
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I2fbb572dca7963e760b3ec417eb3157d9e4a5baf
Reviewed-on: https://chromium-review.googlesource.com/922273
Reviewed-by: Justin Cohen <justincohen@chromium.org>
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#537114}(cherry picked from commit cb56b831ff407cb2396173944607b4ee7f6a2a80)
Reviewed-on: https://chromium-review.googlesource.com/935161
Reviewed-by: Kurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/branch-heads/3325@{#573}
Cr-Branched-From: bc084a8b5afa3744a74927344e304c02ae54189f-refs/heads/master@{#530369}
diff --git a/ios/chrome/browser/ui/browser_view_controller.mm b/ios/chrome/browser/ui/browser_view_controller.mm
index 5e14235..71d65b2 100644
--- a/ios/chrome/browser/ui/browser_view_controller.mm
+++ b/ios/chrome/browser/ui/browser_view_controller.mm
@@ -3979,14 +3979,6 @@
     [self updateHeadersForFullscreenProgress:finalProgress];
     [self updateFootersForFullscreenProgress:finalProgress];
     [self updateContentViewTopPaddingForFullscreenProgress:finalProgress];
-    // Scroll the content to the top.
-    id<CRWWebViewProxy> webViewProxy = self.currentWebState->GetWebViewProxy();
-    CRWWebViewScrollViewProxy* scrollProxy = webViewProxy.scrollViewProxy;
-    CGPoint contentOffset = scrollProxy.contentOffset;
-    contentOffset.y = webViewProxy.shouldUseInsetForTopPadding
-                          ? -webViewProxy.topContentPadding
-                          : 0;
-    scrollProxy.contentOffset = contentOffset;
   }];
 }
 
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_proxy_observer.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_proxy_observer.mm
index 944dbe6..7ac27c6 100644
--- a/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_proxy_observer.mm
+++ b/ios/chrome/browser/ui/fullscreen/fullscreen_web_view_proxy_observer.mm
@@ -56,11 +56,10 @@
 
 - (BOOL)webViewScrollViewShouldScrollToTop:
     (CRWWebViewScrollViewProxy*)webViewScrollViewProxy {
-  // The content offset and the toolbar layout needs to be reset simultaneously,
-  // so disallow UIKit's scroll-to-top animation and instead use the mediator to
-  // trigger a custom animation.
+  // Inform FullscreenUIElements that the content is going to be scrolled to the
+  // top.
   self.mediator->ScrollToTop();
-  return NO;
+  return YES;
 }
 
 @end