Commit 2fd254cb authored by Chris Lu's avatar Chris Lu Committed by Commit Bot

[ios] Only add HeaderInset for overscroll calculation if SmoothScrolling

If Smooth Scrolling is on, then the scrollview's origin is the same as
the header's origin. Thus, |self.initialHeaderInset| is added to track
the actual offset dragged by the user from the top of the page. When
Smooth Scrolling is off, the scrollview's origin is the bottom left
of the header, so adding that inset is unnecessary.

Before refactoring fullscreen for MultiWindow, the ContentView's
contentInset was set, but it is no longer needed and
|self.initialHeaderInset| is the same value. Thus, not adding anything
to contentOffsetFromTheTop is sufficient when Smooth Scrolling is off.

Bug: 1128444
Change-Id: I5ada9f5cca5f8450572e0df6e689bd0f4cef47ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2446782Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarRobbie Gibson <rkgibson@google.com>
Commit-Queue: Chris Lu <thegreenfrog@chromium.org>
Cr-Commit-Position: refs/heads/master@{#818988}
parent 78276705
......@@ -62,6 +62,10 @@ class OverscrollActionsTabHelperTest : public PlatformTest {
base::test::ios::SpinRunLoopWithMinDelay(base::TimeDelta::FromSecondsD(
kMinimumPullDurationToTransitionToReadyInSeconds));
[ui_scroll_view_.delegate scrollViewDidScroll:ui_scroll_view_];
// Scroll to content offset below action threshold to cancel bounce
// animation.
scroll_view_proxy_.contentOffset = CGPointMake(0, -56);
// Scroll past action threshold to trigger refresh action.
scroll_view_proxy_.contentOffset = CGPointMake(0, -293);
CGPoint target_offset = CGPointMake(0, -92);
[ui_scroll_view_.delegate scrollViewWillEndDragging:ui_scroll_view_
......
......@@ -3746,7 +3746,7 @@ NSString* const kBrowserViewControllerSnackbarCategory =
- (void)updateForFullscreenProgress:(CGFloat)progress {
[self updateHeadersForFullscreenProgress:progress];
[self updateFootersForFullscreenProgress:progress];
if (!fullscreen::features::ShouldScopeFullscreenControllerToBrowser()) {
if (!fullscreen::features::ShouldUseSmoothScrolling()) {
[self updateBrowserViewportForFullscreenProgress:progress];
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment