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

Side by Side Diff: Source/core/dom/Document.cpp

Issue 32793003: Have Frame::navigationScheduler() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/v8/ScriptController.cpp ('k') | Source/core/frame/DOMWindow.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
2303 return; 2303 return;
2304 } 2304 }
2305 2305
2306 m_frame->loader()->checkCompleted(); 2306 m_frame->loader()->checkCompleted();
2307 } 2307 }
2308 2308
2309 void Document::implicitClose() 2309 void Document::implicitClose()
2310 { 2310 {
2311 ASSERT(!inStyleRecalc()); 2311 ASSERT(!inStyleRecalc());
2312 2312
2313 bool wasLocationChangePending = frame() && frame()->navigationScheduler()->l ocationChangePending(); 2313 bool wasLocationChangePending = frame() && frame()->navigationScheduler().lo cationChangePending();
2314 bool doload = !parsing() && m_parser && !processingLoadEvent() && !wasLocati onChangePending; 2314 bool doload = !parsing() && m_parser && !processingLoadEvent() && !wasLocati onChangePending;
2315 2315
2316 // If the load was blocked because of a pending location change and the loca tion change triggers a same document 2316 // If the load was blocked because of a pending location change and the loca tion change triggers a same document
2317 // navigation, don't fire load events after the same document navigation com pletes (unless there's an explicit open). 2317 // navigation, don't fire load events after the same document navigation com pletes (unless there's an explicit open).
2318 m_loadEventProgress = LoadEventTried; 2318 m_loadEventProgress = LoadEventTried;
2319 2319
2320 if (!doload) 2320 if (!doload)
2321 return; 2321 return;
2322 2322
2323 // The call to dispatchWindowLoadEvent can detach the DOMWindow and cause it (and its 2323 // The call to dispatchWindowLoadEvent can detach the DOMWindow and cause it (and its
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2361 // An event handler may have removed the frame 2361 // An event handler may have removed the frame
2362 if (!frame()) { 2362 if (!frame()) {
2363 m_loadEventProgress = LoadEventCompleted; 2363 m_loadEventProgress = LoadEventCompleted;
2364 return; 2364 return;
2365 } 2365 }
2366 2366
2367 // Make sure both the initial layout and reflow happen after the onload 2367 // Make sure both the initial layout and reflow happen after the onload
2368 // fires. This will improve onload scores, and other browsers do it. 2368 // fires. This will improve onload scores, and other browsers do it.
2369 // If they wanna cheat, we can too. -dwh 2369 // If they wanna cheat, we can too. -dwh
2370 2370
2371 if (frame()->navigationScheduler()->locationChangePending() && elapsedTime() < cLayoutScheduleThreshold) { 2371 if (frame()->navigationScheduler().locationChangePending() && elapsedTime() < cLayoutScheduleThreshold) {
2372 // Just bail out. Before or during the onload we were shifted to another page. 2372 // Just bail out. Before or during the onload we were shifted to another page.
2373 // The old i-Bench suite does this. When this happens don't bother paint ing or laying out. 2373 // The old i-Bench suite does this. When this happens don't bother paint ing or laying out.
2374 m_loadEventProgress = LoadEventCompleted; 2374 m_loadEventProgress = LoadEventCompleted;
2375 view()->unscheduleRelayout(); 2375 view()->unscheduleRelayout();
2376 return; 2376 return;
2377 } 2377 }
2378 2378
2379 RenderObject* renderObject = renderer(); 2379 RenderObject* renderObject = renderer();
2380 2380
2381 // We used to force a synchronous display and flush here. This really isn't 2381 // We used to force a synchronous display and flush here. This really isn't
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
2898 String message = "Refused to refresh " + m_url.elidedString() + " to a j avascript: URL"; 2898 String message = "Refused to refresh " + m_url.elidedString() + " to a j avascript: URL";
2899 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message); 2899 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
2900 return; 2900 return;
2901 } 2901 }
2902 2902
2903 if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomati cFeatures)) { 2903 if (httpRefreshType == HttpRefreshFromMetaTag && isSandboxed(SandboxAutomati cFeatures)) {
2904 String message = "Refused to execute the redirect specified via '<meta h ttp-equiv='refresh' content='...'>'. The document is sandboxed, and the 'allow-s cripts' keyword is not set."; 2904 String message = "Refused to execute the redirect specified via '<meta h ttp-equiv='refresh' content='...'>'. The document is sandboxed, and the 'allow-s cripts' keyword is not set.";
2905 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message); 2905 addConsoleMessage(SecurityMessageSource, ErrorMessageLevel, message);
2906 return; 2906 return;
2907 } 2907 }
2908 m_frame->navigationScheduler()->scheduleRedirect(delay, refreshURL); 2908 m_frame->navigationScheduler().scheduleRedirect(delay, refreshURL);
2909 } 2909 }
2910 2910
2911 void Document::processHttpEquivSetCookie(const String& content) 2911 void Document::processHttpEquivSetCookie(const String& content)
2912 { 2912 {
2913 // FIXME: make setCookie work on XML documents too; e.g. in case of <html:me ta .....> 2913 // FIXME: make setCookie work on XML documents too; e.g. in case of <html:me ta .....>
2914 if (!isHTMLDocument()) 2914 if (!isHTMLDocument())
2915 return; 2915 return;
2916 2916
2917 // Exception (for sandboxed documents) ignored. 2917 // Exception (for sandboxed documents) ignored.
2918 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION); 2918 toHTMLDocument(this)->setCookie(content, IGNORE_EXCEPTION);
2919 } 2919 }
2920 2920
2921 void Document::processHttpEquivXFrameOptions(const String& content) 2921 void Document::processHttpEquivXFrameOptions(const String& content)
2922 { 2922 {
2923 Frame* frame = this->frame(); 2923 Frame* frame = this->frame();
2924 if (!frame) 2924 if (!frame)
2925 return; 2925 return;
2926 2926
2927 FrameLoader* frameLoader = frame->loader(); 2927 FrameLoader* frameLoader = frame->loader();
2928 unsigned long requestIdentifier = loader()->mainResourceIdentifier(); 2928 unsigned long requestIdentifier = loader()->mainResourceIdentifier();
2929 if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url(), request Identifier)) { 2929 if (frameLoader->shouldInterruptLoadForXFrameOptions(content, url(), request Identifier)) {
2930 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'."; 2930 String message = "Refused to display '" + url().elidedString() + "' in a frame because it set 'X-Frame-Options' to '" + content + "'.";
2931 frameLoader->stopAllLoaders(); 2931 frameLoader->stopAllLoaders();
2932 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's 2932 // Stopping the loader isn't enough, as we're already parsing the docume nt; to honor the header's
2933 // intent, we must navigate away from the possibly partially-rendered do cument to a location that 2933 // intent, we must navigate away from the possibly partially-rendered do cument to a location that
2934 // doesn't inherit the parent's SecurityOrigin. 2934 // doesn't inherit the parent's SecurityOrigin.
2935 frame->navigationScheduler()->scheduleLocationChange(securityOrigin(), S ecurityOrigin::urlWithUniqueSecurityOrigin(), String()); 2935 frame->navigationScheduler().scheduleLocationChange(securityOrigin(), Se curityOrigin::urlWithUniqueSecurityOrigin(), String());
2936 addConsoleMessageWithRequestIdentifier(SecurityMessageSource, ErrorMessa geLevel, message, requestIdentifier); 2936 addConsoleMessageWithRequestIdentifier(SecurityMessageSource, ErrorMessa geLevel, message, requestIdentifier);
2937 } 2937 }
2938 } 2938 }
2939 2939
2940 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin ) 2940 bool Document::shouldMergeWithLegacyDescription(ViewportDescription::Type origin )
2941 { 2941 {
2942 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type == origin; 2942 return settings() && settings()->viewportMetaMergeContentQuirk() && m_legacy ViewportDescription.isMetaViewportType() && m_legacyViewportDescription.type == origin;
2943 } 2943 }
2944 2944
2945 void Document::setViewportDescription(const ViewportDescription& viewportDescrip tion) 2945 void Document::setViewportDescription(const ViewportDescription& viewportDescrip tion)
(...skipping 2402 matching lines...) Expand 10 before | Expand all | Expand 10 after
5348 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode) 5348 void Document::modifiedStyleSheet(StyleSheet* sheet, RecalcStyleTime when, Style ResolverUpdateMode updateMode)
5349 { 5349 {
5350 if (!isActive()) 5350 if (!isActive())
5351 return; 5351 return;
5352 5352
5353 styleEngine()->modifiedStyleSheet(sheet); 5353 styleEngine()->modifiedStyleSheet(sheet);
5354 styleResolverChanged(when, updateMode); 5354 styleResolverChanged(when, updateMode);
5355 } 5355 }
5356 5356
5357 } // namespace WebCore 5357 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/v8/ScriptController.cpp ('k') | Source/core/frame/DOMWindow.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698