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

Side by Side 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: Created 6 years, 6 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 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch rome(), didAllowNavigation)) 1265 if (!targetFrames[i]->document()->dispatchBeforeUnloadEvent(page->ch rome(), didAllowNavigation))
1266 break; 1266 break;
1267 } 1267 }
1268 1268
1269 if (i == targetFrames.size()) 1269 if (i == targetFrames.size())
1270 shouldClose = true; 1270 shouldClose = true;
1271 } 1271 }
1272 return shouldClose; 1272 return shouldClose;
1273 } 1273 }
1274 1274
1275 bool FrameLoader::validateTransitionNavigationMode()
1276 {
1277 if (frame()->document()->inQuirksMode()) {
1278 frame()->document()->addConsoleMessage(JSMessageSource, ErrorMessageLeve l, "Ignoring transition elements due to quirks mode.");
1279 return false;
1280 }
1281
1282 // FIXME(oysteine): Also check for width=device-width here, to avoid zoom/sc aling issues.
1283 return true;
1284 }
1285
1286 bool FrameLoader::dispatchAnyNavigationTransitionData()
1287 {
1288 Vector<Document::TransitionElementData> elementData;
1289 frame()->document()->getTransitionElementData(&elementData, IGNORE_EXCEPTION );
esprehn 2014/06/13 08:50:18 We don't allow NodeList and the other things you u
oystein (OOO til 10th of July) 2014/06/13 17:52:27 Avoiding getElementsByTagName seems easy enough, b
1290 if (elementData.isEmpty() || !validateTransitionNavigationMode())
esprehn 2014/06/13 08:50:18 The validateTransitionNavigationMode() check shoul
oystein (OOO til 10th of July) 2014/06/18 00:04:08 validateTransitionNavigationMode() also tosses som
1291 return false;
1292
1293 Vector<Document::TransitionElementData>::iterator iter = elementData.begin() ;
1294 for (; iter != elementData.end(); ++iter)
1295 client()->dispatchAddNavigationTransitionData(iter->scope, iter->markup) ;
1296
1297 return true;
1298 }
1299
1275 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame LoadType type, PassRefPtrWillBeRawPtr<FormState> formState, const SubstituteData & substituteData, ClientRedirectPolicy clientRedirect, const AtomicString& overr ideEncoding) 1300 void FrameLoader::loadWithNavigationAction(const NavigationAction& action, Frame LoadType type, PassRefPtrWillBeRawPtr<FormState> formState, const SubstituteData & substituteData, ClientRedirectPolicy clientRedirect, const AtomicString& overr ideEncoding)
1276 { 1301 {
1277 ASSERT(client()->hasWebView()); 1302 ASSERT(client()->hasWebView());
1278 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal) 1303 if (m_frame->document()->pageDismissalEventBeingDispatched() != Document::No Dismissal)
1279 return; 1304 return;
1280 1305
1281 const ResourceRequest& request = action.resourceRequest(); 1306 const ResourceRequest& request = action.resourceRequest();
1282 1307
1283 // The current load should replace the history item if it is the first real 1308 // The current load should replace the history item if it is the first real
1284 // load of the frame. 1309 // load of the frame.
1285 bool replacesCurrentHistoryItem = false; 1310 bool replacesCurrentHistoryItem = false;
1286 if (type == FrameLoadTypeRedirectWithLockedBackForwardList 1311 if (type == FrameLoadTypeRedirectWithLockedBackForwardList
1287 || !m_stateMachine.committedFirstRealDocumentLoad()) { 1312 || !m_stateMachine.committedFirstRealDocumentLoad()) {
1288 replacesCurrentHistoryItem = true; 1313 replacesCurrentHistoryItem = true;
1289 } 1314 }
1290 1315
1291 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, su bstituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.ur l())); 1316 m_policyDocumentLoader = client()->createDocumentLoader(m_frame, request, su bstituteData.isValid() ? substituteData : defaultSubstituteDataForURL(request.ur l()));
1292 m_policyDocumentLoader->setTriggeringAction(action); 1317 m_policyDocumentLoader->setTriggeringAction(action);
1293 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item); 1318 m_policyDocumentLoader->setReplacesCurrentHistoryItem(replacesCurrentHistory Item);
1294 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect ); 1319 m_policyDocumentLoader->setIsClientRedirect(clientRedirect == ClientRedirect );
1295 1320
1296 Frame* parent = m_frame->tree().parent(); 1321 Frame* parent = m_frame->tree().parent();
1297 if (parent && parent->isLocalFrame()) 1322 if (parent && parent->isLocalFrame())
1298 m_policyDocumentLoader->setOverrideEncoding(toLocalFrame(parent)->loader ().documentLoader()->overrideEncoding()); 1323 m_policyDocumentLoader->setOverrideEncoding(toLocalFrame(parent)->loader ().documentLoader()->overrideEncoding());
1299 else if (!overrideEncoding.isEmpty()) 1324 else if (!overrideEncoding.isEmpty())
1300 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding); 1325 m_policyDocumentLoader->setOverrideEncoding(overrideEncoding);
1301 else if (m_documentLoader) 1326 else if (m_documentLoader)
1302 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding()); 1327 m_policyDocumentLoader->setOverrideEncoding(m_documentLoader->overrideEn coding());
1303 1328
1329
1330 bool isTransitionNavigation = false;
1331 if (RuntimeEnabledFeatures::navigationTransitionsEnabled())
1332 isTransitionNavigation = dispatchAnyNavigationTransitionData();
esprehn 2014/06/13 08:50:18 Remove "Any".
oystein (OOO til 10th of July) 2014/06/18 00:04:08 Done.
1333
1304 // stopAllLoaders can detach the LocalFrame, so protect it. 1334 // stopAllLoaders can detach the LocalFrame, so protect it.
1305 RefPtr<LocalFrame> protect(m_frame); 1335 RefPtr<LocalFrame> protect(m_frame);
1306 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request) || !shouldClose()) && m_policyDocumentLoader) { 1336 if ((!m_policyDocumentLoader->shouldContinueForNavigationPolicy(request, isT ransitionNavigation) || !shouldClose()) && m_policyDocumentLoader) {
1307 m_policyDocumentLoader->detachFromFrame(); 1337 m_policyDocumentLoader->detachFromFrame();
1308 m_policyDocumentLoader = nullptr; 1338 m_policyDocumentLoader = nullptr;
1309 return; 1339 return;
1310 } 1340 }
1311 1341
1312 if (m_provisionalDocumentLoader) { 1342 if (m_provisionalDocumentLoader) {
1313 m_provisionalDocumentLoader->stopLoading(); 1343 m_provisionalDocumentLoader->stopLoading();
1314 if (m_provisionalDocumentLoader) 1344 if (m_provisionalDocumentLoader)
1315 m_provisionalDocumentLoader->detachFromFrame(); 1345 m_provisionalDocumentLoader->detachFromFrame();
1316 m_provisionalDocumentLoader = nullptr; 1346 m_provisionalDocumentLoader = nullptr;
(...skipping 13 matching lines...) Expand all
1330 m_loadType = type; 1360 m_loadType = type;
1331 m_state = FrameStateProvisional; 1361 m_state = FrameStateProvisional;
1332 1362
1333 if (formState) 1363 if (formState)
1334 client()->dispatchWillSubmitForm(formState->form()); 1364 client()->dispatchWillSubmitForm(formState->form());
1335 1365
1336 m_progressTracker->progressStarted(); 1366 m_progressTracker->progressStarted();
1337 if (m_provisionalDocumentLoader->isClientRedirect()) 1367 if (m_provisionalDocumentLoader->isClientRedirect())
1338 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url()); 1368 m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url());
1339 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req uest().url()); 1369 m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->req uest().url());
1340 client()->dispatchDidStartProvisionalLoad(); 1370 client()->dispatchDidStartProvisionalLoad(isTransitionNavigation);
1341 ASSERT(m_provisionalDocumentLoader); 1371 ASSERT(m_provisionalDocumentLoader);
1342 m_provisionalDocumentLoader->startLoadingMainResource(); 1372 m_provisionalDocumentLoader->startLoadingMainResource();
1343 } 1373 }
1344 1374
1345 void FrameLoader::applyUserAgent(ResourceRequest& request) 1375 void FrameLoader::applyUserAgent(ResourceRequest& request)
1346 { 1376 {
1347 String userAgent = this->userAgent(request.url()); 1377 String userAgent = this->userAgent(request.url());
1348 ASSERT(!userAgent.isNull()); 1378 ASSERT(!userAgent.isNull());
1349 request.setHTTPUserAgent(AtomicString(userAgent)); 1379 request.setHTTPUserAgent(AtomicString(userAgent));
1350 } 1380 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 // FIXME: We need a way to propagate sandbox flags to out-of-process frames. 1495 // FIXME: We need a way to propagate sandbox flags to out-of-process frames.
1466 Frame* parentFrame = m_frame->tree().parent(); 1496 Frame* parentFrame = m_frame->tree().parent();
1467 if (parentFrame && parentFrame->isLocalFrame()) 1497 if (parentFrame && parentFrame->isLocalFrame())
1468 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags(); 1498 flags |= toLocalFrame(parentFrame)->document()->sandboxFlags();
1469 if (FrameOwner* frameOwner = m_frame->ownerElement()) 1499 if (FrameOwner* frameOwner = m_frame->ownerElement())
1470 flags |= frameOwner->sandboxFlags(); 1500 flags |= frameOwner->sandboxFlags();
1471 return flags; 1501 return flags;
1472 } 1502 }
1473 1503
1474 } // namespace WebCore 1504 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698