Commit 63b4eb1a authored by Danyao Wang's avatar Danyao Wang Committed by Commit Bot

[ios] Fix transition type for same-document back/forward navigation.

The ui::PAGE_TRANSITION_FORWARD_BACK bit has always been set for
different-document back/forward navigation. It's not clear why
same-document back/forward navigation should be treated differently.
Making this change matches the Blink behavior (so should be low risk)
and removes a special case.

Bug: 798832
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I39e7a28caa9069cbb12ebdc965918792b36b77b2
Reviewed-on: https://chromium-review.googlesource.com/847940
Commit-Queue: Danyao Wang <danyao@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#527105}
parent 8b843691
......@@ -305,6 +305,9 @@ void LegacyNavigationManagerImpl::FinishGoToIndex(
NavigationItem* to_item = items[index].get();
NavigationItem* previous_item = [session_controller_ currentItem];
to_item->SetTransitionType(ui::PageTransitionFromInt(
to_item->GetTransitionType() | ui::PAGE_TRANSITION_FORWARD_BACK));
bool same_document_navigation =
[session_controller_ isSameDocumentNavigationBetweenItem:previous_item
andItem:to_item];
......@@ -314,11 +317,6 @@ void LegacyNavigationManagerImpl::FinishGoToIndex(
} else {
[session_controller_ discardNonCommittedItems];
[session_controller_ setPendingItemIndex:index];
NavigationItemImpl* pending_item = [session_controller_ pendingItem];
pending_item->SetTransitionType(ui::PageTransitionFromInt(
pending_item->GetTransitionType() | ui::PAGE_TRANSITION_FORWARD_BACK));
delegate_->LoadCurrentItem();
}
}
......
......@@ -2293,12 +2293,8 @@ TEST_P(NavigationManagerTest, GoToIndexSameDocument) {
}
navigation_manager()->GoToIndex(0);
// Preserve the existing behavior of legacy navigation manager for change
// management, even though it seems like a bug that the back-forward
// transition bit is not set for same-document history navigation.
EXPECT_EQ(GetParam() == TEST_WK_BASED_NAVIGATION_MANAGER,
(navigation_manager()->GetItemAtIndex(0)->GetTransitionType() &
ui::PAGE_TRANSITION_FORWARD_BACK) > 0);
EXPECT_TRUE(navigation_manager()->GetItemAtIndex(0)->GetTransitionType() &
ui::PAGE_TRANSITION_FORWARD_BACK);
if (GetParam() == TEST_LEGACY_NAVIGATION_MANAGER) {
EXPECT_EQ(0, navigation_manager()->GetLastCommittedItemIndex());
......
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