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

Unified Diff: Source/core/loader/FrameLoader.cpp

Issue 319573008: Navigation transitions: Initiate navigation transition and send serialized markup to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@transitions_editing
Patch Set: Rebase Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/loader/FrameLoader.cpp
diff --git a/Source/core/loader/FrameLoader.cpp b/Source/core/loader/FrameLoader.cpp
index da94bb9a311f10e48f390a2acd1eb878ca99b753..09399338684934c1311ec77fb16363483661d599 100644
--- a/Source/core/loader/FrameLoader.cpp
+++ b/Source/core/loader/FrameLoader.cpp
@@ -1263,6 +1263,31 @@ bool FrameLoader::shouldClose()
return shouldClose;
}
+bool FrameLoader::validateTransitionNavigationMode()
+{
+ if (frame()->document()->inQuirksMode()) {
+ frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLevel, "Ignoring transition elements due to quirks mode.");
+ return false;
+ }
+
+ // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/scaling issues.
+ return true;
+}
+
+bool FrameLoader::dispatchNavigationTransitionData()
+{
+ Vector<Document::TransitionElementData> elementData;
+ frame()->document()->getTransitionElementData(elementData);
+ if (elementData.isEmpty() || !validateTransitionNavigationMode())
+ return false;
+
+ Vector<Document::TransitionElementData>::iterator iter = elementData.begin();
+ for (; iter != elementData.end(); ++iter)
+ client()->dispatchAddNavigationTransitionData(iter->scope, iter->selector, iter->markup);
+
+ return true;
+}
+
void FrameLoader::loadWithNavigationAction(const NavigationAction& action, FrameLoadType type, PassRefPtrWillBeRawPtr<FormState> formState, const SubstituteData& substituteData, ContentSecurityPolicyCheck shouldCheckMainWorldContentSecurityPolicy, ClientRedirectPolicy clientRedirect, const AtomicString& overrideEncoding)
{
ASSERT(client()->hasWebView());
@@ -1292,9 +1317,14 @@ void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame
else if (m_documentLoader)
m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEncoding());
+
+ bool isTransitionNavigation = false;
+ if (RuntimeEnabledFeatures::navigationTransitionsEnabled())
+ isTransitionNavigation = dispatchNavigationTransitionData();
+
// stopAllLoaders can detach the LocalFrame, so protect it.
RefPtr<LocalFrame> protect(m_frame);
- if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, shouldCheckMainWorldContentSecurityPolicy) || !shouldClose()) && m_policyDocumentLoader) {
+ if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, shouldCheckMainWorldContentSecurityPolicy, isTransitionNavigation) || !shouldClose()) && m_policyDocumentLoader) {
m_policyDocumentLoader->detachFromFrame();
m_policyDocumentLoader = nullptr;
return;
@@ -1328,7 +1358,7 @@ void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame
if (m_provisionalDocumentLoader->isClientRedirect())
m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url());
m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->request().url());
- client()->dispatchDidStartProvisionalLoad();
+ client()->dispatchDidStartProvisionalLoad(isTransitionNavigation);
ASSERT(m_provisionalDocumentLoader);
m_provisionalDocumentLoader->startLoadingMainResource();
}
« no previous file with comments | « Source/core/loader/FrameLoader.h ('k') | Source/core/loader/FrameLoaderClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698