Index: content/browser/web_contents/web_contents_impl.cc |
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc |
index 6a058992ed111bc6d71edef0003a64b7ee316a91..3891060099e14b58c176d7c2f15bfc24d49011b2 100644 |
--- a/content/browser/web_contents/web_contents_impl.cc |
+++ b/content/browser/web_contents/web_contents_impl.cc |
@@ -2688,8 +2688,17 @@ void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { |
void WebContentsImpl::DidNavigate( |
RenderViewHost* rvh, |
const ViewHostMsg_FrameNavigate_Params& params) { |
- if (PageTransitionIsMainFrame(params.transition)) |
+ if (PageTransitionIsMainFrame(params.transition)) { |
+ // When overscroll navigation gesture is enabled, a screenshot of the page |
+ // in its current state is taken so that it can be used during the |
+ // nav-gesture. It is necessary to take the screenshot here, before calling |
+ // RenderViewHostManager::DidNavigateMainFrame, because that can change |
+ // WebContents::GetRenderViewHost to return the new host, instead of the one |
+ // that may have just been swapped out. |
+ controller_.TakeScreenshot(); |
+ |
render_manager_.DidNavigateMainFrame(rvh); |
+ } |
// Update the site of the SiteInstance if it doesn't have one yet, unless |
// this is for about:blank. In that case, the SiteInstance can still be |