Commit fcacbb1a authored by Justin Cohen's avatar Justin Cohen Committed by Commit Bot

[ios] Fix BubblePresenter logic for new NTP.

For native controllers, we don't update the contentInset, so it
doesn't make sense to compare the native contentOffset to the
CRWScrollViewProxy.contentInset.

Change-Id: I4fda19725cecbd70af2a054bd3c2132d5b0a25fd
Reviewed-on: https://chromium-review.googlesource.com/c/1333870Reviewed-by: default avatarKurt Horimoto <kkhorimoto@chromium.org>
Commit-Queue: Justin Cohen <justincohen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607745}
parent 84a7f05e
...@@ -3111,19 +3111,19 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint { ...@@ -3111,19 +3111,19 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
- (BOOL)isTabScrolledToTopForBubblePresenter:(BubblePresenter*)bubblePresenter { - (BOOL)isTabScrolledToTopForBubblePresenter:(BubblePresenter*)bubblePresenter {
DCHECK(bubblePresenter == self.bubblePresenter); DCHECK(bubblePresenter == self.bubblePresenter);
CRWWebViewScrollViewProxy* scrollProxy =
self.currentWebState->GetWebViewProxy().scrollViewProxy;
CGPoint scrollOffset = scrollProxy.contentOffset;
UIEdgeInsets contentInset = scrollProxy.contentInset;
// If there is a native controller, use the native controller's scroll offset. // If there is a native controller, use the native controller's scroll offset.
id nativeController = id nativeController =
[self nativeControllerForTab:[self.tabModel currentTab]]; [self nativeControllerForTab:[self.tabModel currentTab]];
if ([nativeController conformsToProtocol:@protocol(NewTabPageOwning)] && if ([nativeController conformsToProtocol:@protocol(NewTabPageOwning)] &&
[nativeController respondsToSelector:@selector(scrollOffset)]) { [nativeController respondsToSelector:@selector(scrollOffset)]) {
scrollOffset = [nativeController scrollOffset]; return [nativeController scrollOffset].y == 0;
} }
CRWWebViewScrollViewProxy* scrollProxy =
self.currentWebState->GetWebViewProxy().scrollViewProxy;
CGPoint scrollOffset = scrollProxy.contentOffset;
UIEdgeInsets contentInset = scrollProxy.contentInset;
return AreCGFloatsEqual(scrollOffset.y, -contentInset.top); return AreCGFloatsEqual(scrollOffset.y, -contentInset.top);
} }
......
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