Commit e5b36c21 authored by Kurt Horimoto's avatar Kurt Horimoto Committed by Commit Bot

[iOS] Use visible URL for BVC animtation frame calculations.

This CL updates BVC's new tab animation to use the visible URL when it
is expected to be loaded by the WebStateListWebUsageEnabler.

Bug: 880262
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I5d948051d39a016f25987fca8840c40c7c8ae99b
Reviewed-on: https://chromium-review.googlesource.com/1241555Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Reviewed-by: default avatarJustin Cohen <justincohen@chromium.org>
Commit-Queue: Kurt Horimoto <kkhorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594153}
parent 2be0605f
......@@ -5126,14 +5126,30 @@ applicationCommandEndpoint:(id<ApplicationCommands>)applicationCommandEndpoint {
CGFloat newPageOffset = 0;
UIView* newPage = nil;
CGFloat offset = 0;
GURL tabURL = tab.webState->GetLastCommittedURL();
// Toolbar snapshot is only used for the UIRefresh animation.
UIView* toolbarSnapshot;
// Vislble URL should be more correct here than last committed, but for
// safety, limiting the scope only to WKBasedNavigationManager, which needs
// it to correctly animate NTP. See https://crbug.com/819606.
if (web::GetWebClient()->IsSlimNavigationManagerEnabled())
GURL tabURL = tab.webState->GetLastCommittedURL();
BOOL expectingPageLoad = NO;
if (_browserState && !_isShutdown) {
WebStateListWebUsageEnabler* webUsageEnabler =
WebStateListWebUsageEnablerFactory::GetInstance()->GetForBrowserState(
_browserState);
expectingPageLoad = webUsageEnabler->IsWebUsageEnabled() &&
webUsageEnabler->TriggersInitialLoad();
}
if (web::GetWebClient()->IsSlimNavigationManagerEnabled() ||
expectingPageLoad) {
// The visible URL is more correct here. However, the last committed URL
// has been used historically, and it's unclear if there are unintended side
// effects from from using the visible URL in all situations. In order to
// mitigate the risk from using the visible URL, additional checks are used
// here to only update the URL for known conditions in which the last-
// committed URL is incorrect.
// TODO(crbug.com/880262): Update to use visible URL for all new tabs.
tabURL = tab.webState->GetVisibleURL();
}
if (tabURL == kChromeUINewTabURL && !_isOffTheRecord &&
![self canShowTabStrip]) {
offset = 0;
......
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