Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(404)

Side by Side Diff: Source/core/loader/FrameLoader.cpp

Issue 1063573002: history.pushState() should take care of scrolling state (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
5 * Copyright (C) 2008 Alp Toker <alp@atoker.com> 5 * Copyright (C) 2008 Alp Toker <alp@atoker.com>
6 * Copyright (C) Research In Motion Limited 2009. All rights reserved. 6 * Copyright (C) Research In Motion Limited 2009. All rights reserved.
7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com> 7 * Copyright (C) 2011 Kris Jordan <krisjordan@gmail.com>
8 * Copyright (C) 2011 Google Inc. All rights reserved. 8 * Copyright (C) 2011 Google Inc. All rights reserved.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 return false; 545 return false;
546 Settings* settings = m_frame->settings(); 546 Settings* settings = m_frame->settings();
547 bool allowed = client()->allowPlugins(settings && settings->pluginsEnabled() ); 547 bool allowed = client()->allowPlugins(settings && settings->pluginsEnabled() );
548 if (!allowed && reason == AboutToInstantiatePlugin) 548 if (!allowed && reason == AboutToInstantiatePlugin)
549 client()->didNotAllowPlugins(); 549 client()->didNotAllowPlugins();
550 return allowed; 550 return allowed;
551 } 551 }
552 552
553 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, FrameLoadType type) 553 void FrameLoader::updateForSameDocumentNavigation(const KURL& newURL, SameDocume ntNavigationSource sameDocumentNavigationSource, PassRefPtr<SerializedScriptValu e> data, FrameLoadType type)
554 { 554 {
555 saveScrollState();
556
555 // Update the data source's request with the new URL to fake the URL change 557 // Update the data source's request with the new URL to fake the URL change
556 m_frame->document()->setURL(newURL); 558 m_frame->document()->setURL(newURL);
557 documentLoader()->setReplacesCurrentHistoryItem(type != FrameLoadTypeStandar d); 559 documentLoader()->setReplacesCurrentHistoryItem(type != FrameLoadTypeStandar d);
558 documentLoader()->updateForSameDocumentNavigation(newURL, sameDocumentNaviga tionSource); 560 documentLoader()->updateForSameDocumentNavigation(newURL, sameDocumentNaviga tionSource);
559 561
560 // Generate start and stop notifications only when loader is completed so th at we 562 // Generate start and stop notifications only when loader is completed so th at we
561 // don't fire them for fragment redirection that happens in window.onload ha ndler. 563 // don't fire them for fragment redirection that happens in window.onload ha ndler.
562 // See https://bugs.webkit.org/show_bug.cgi?id=31838 564 // See https://bugs.webkit.org/show_bug.cgi?id=31838
563 if (m_frame->document()->loadEventFinished()) 565 if (m_frame->document()->loadEventFinished())
564 client()->didStartLoading(NavigationWithinSameDocument); 566 client()->didStartLoading(NavigationWithinSameDocument);
(...skipping 17 matching lines...) Expand all
582 // If we have a provisional request for a different document, a fragment scr oll should cancel it. 584 // If we have a provisional request for a different document, a fragment scr oll should cancel it.
583 if (m_provisionalDocumentLoader) { 585 if (m_provisionalDocumentLoader) {
584 m_provisionalDocumentLoader->stopLoading(); 586 m_provisionalDocumentLoader->stopLoading();
585 if (m_provisionalDocumentLoader) 587 if (m_provisionalDocumentLoader)
586 m_provisionalDocumentLoader->detachFromFrame(); 588 m_provisionalDocumentLoader->detachFromFrame();
587 m_provisionalDocumentLoader = nullptr; 589 m_provisionalDocumentLoader = nullptr;
588 if (!m_frame->host()) 590 if (!m_frame->host())
589 return; 591 return;
590 } 592 }
591 m_loadType = type; 593 m_loadType = type;
592 saveScrollState();
593 594
594 KURL oldURL = m_frame->document()->url(); 595 KURL oldURL = m_frame->document()->url();
595 // If we were in the autoscroll/panScroll mode we want to stop it before fol lowing the link to the anchor 596 // If we were in the autoscroll/panScroll mode we want to stop it before fol lowing the link to the anchor
596 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme ntIdentifier() != oldURL.fragmentIdentifier(); 597 bool hashChange = equalIgnoringFragmentIdentifier(url, oldURL) && url.fragme ntIdentifier() != oldURL.fragmentIdentifier();
597 if (hashChange) { 598 if (hashChange) {
598 m_frame->eventHandler().stopAutoscroll(); 599 m_frame->eventHandler().stopAutoscroll();
599 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url); 600 m_frame->localDOMWindow()->enqueueHashchangeEvent(oldURL, url);
600 } 601 }
601 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirect); 602 m_documentLoader->setIsClientRedirect(clientRedirect == ClientRedirect);
602 updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, nullptr, type); 603 updateForSameDocumentNavigation(url, SameDocumentNavigationDefault, nullptr, type);
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 // FIXME: We need a way to propagate insecure requests policy flags to 1428 // FIXME: We need a way to propagate insecure requests policy flags to
1428 // out-of-process frames. For now, we'll always use default behavior. 1429 // out-of-process frames. For now, we'll always use default behavior.
1429 if (!parentFrame->isLocalFrame()) 1430 if (!parentFrame->isLocalFrame())
1430 return nullptr; 1431 return nullptr;
1431 1432
1432 ASSERT(toLocalFrame(parentFrame)->document()); 1433 ASSERT(toLocalFrame(parentFrame)->document());
1433 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ; 1434 return toLocalFrame(parentFrame)->document()->insecureNavigationsToUpgrade() ;
1434 } 1435 }
1435 1436
1436 } // namespace blink 1437 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698