Commit 747074db authored by Eugene But's avatar Eugene But Committed by Commit Bot

Fix transition type for same-document back forward navigations.

This change keeps the original transition type and adds
PAGE_TRANSITION_FORWARD_BACK as qualifier.

Change-Id: Ia3b59c3d555223a66a5553cbba2ff1ebf3b28f0c
Reviewed-on: https://chromium-review.googlesource.com/c/1371883Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Commit-Queue: Eugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615817}
parent d7e495c2
...@@ -4974,11 +4974,15 @@ registerLoadRequestForURL:(const GURL&)requestURL ...@@ -4974,11 +4974,15 @@ registerLoadRequestForURL:(const GURL&)requestURL
- (void)didFinishGoToIndexSameDocumentNavigationWithType: - (void)didFinishGoToIndexSameDocumentNavigationWithType:
(web::NavigationInitiationType)type (web::NavigationInitiationType)type
hasUserGesture:(BOOL)hasUserGesture { hasUserGesture:(BOOL)hasUserGesture {
GURL URL = _webStateImpl->GetLastCommittedURL(); web::NavigationItem* item =
_webStateImpl->GetNavigationManager()->GetLastCommittedItem();
GURL URL = item->GetVirtualURL();
std::unique_ptr<web::NavigationContextImpl> context = std::unique_ptr<web::NavigationContextImpl> context =
web::NavigationContextImpl::CreateNavigationContext( web::NavigationContextImpl::CreateNavigationContext(
_webStateImpl, URL, hasUserGesture, _webStateImpl, URL, hasUserGesture,
ui::PageTransition::PAGE_TRANSITION_FORWARD_BACK, static_cast<ui::PageTransition>(
item->GetTransitionType() |
ui::PageTransition::PAGE_TRANSITION_FORWARD_BACK),
type == web::NavigationInitiationType::RENDERER_INITIATED); type == web::NavigationInitiationType::RENDERER_INITIATED);
context->SetIsSameDocument(true); context->SetIsSameDocument(true);
_webStateImpl->SetIsLoading(true); _webStateImpl->SetIsLoading(true);
......
...@@ -1013,8 +1013,9 @@ TEST_P(WebStateObserverTest, UserInitiatedHashChangeNavigation) { ...@@ -1013,8 +1013,9 @@ TEST_P(WebStateObserverTest, UserInitiatedHashChangeNavigation) {
EXPECT_CALL(observer_, DidStartLoading(web_state())); EXPECT_CALL(observer_, DidStartLoading(web_state()));
bool has_user_gesture = true; bool has_user_gesture = true;
ui::PageTransition expected_transition = ui::PageTransition expected_transition = static_cast<ui::PageTransition>(
ui::PageTransition::PAGE_TRANSITION_FORWARD_BACK; ui::PageTransition::PAGE_TRANSITION_FORWARD_BACK |
ui::PageTransition::PAGE_TRANSITION_TYPED);
if (GetWebClient()->IsSlimNavigationManagerEnabled()) { if (GetWebClient()->IsSlimNavigationManagerEnabled()) {
// TODO(crbug.com/913052): propagate |has_user_gesture| on back/forward // TODO(crbug.com/913052): propagate |has_user_gesture| on back/forward
// navigation in slim nav. // navigation in slim nav.
......
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