Changeset 166684 in webkit
- Timestamp:
- Apr 2, 2014 5:51:04 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r166682 r166684 1 2014-04-02 Mark Rowe <mrowe@apple.com> 2 3 <https://webkit.org/b/131135> Introduce LockHistory and LockBackForwardList enums to use in place of bools. 4 5 These arguments are often passed using literals at the call site, where the use of bools severely hinders 6 the readability of the code. 7 8 Reviewed by Andreas Kling. 9 10 * WebCore.exp.in: 11 * html/HTMLAnchorElement.cpp: 12 (WebCore::HTMLAnchorElement::handleClick): 13 * html/HTMLFormElement.cpp: 14 (WebCore::HTMLFormElement::submit): 15 * html/HTMLFrameElementBase.cpp: 16 (WebCore::HTMLFrameElementBase::openURL): 17 (WebCore::HTMLFrameElementBase::setLocation): 18 * html/HTMLFrameElementBase.h: 19 * inspector/InspectorFrontendClientLocal.cpp: 20 (WebCore::InspectorFrontendClientLocal::openInNewTab): 21 * inspector/InspectorPageAgent.cpp: 22 (WebCore::InspectorPageAgent::navigate): 23 * loader/FormSubmission.cpp: 24 (WebCore::FormSubmission::FormSubmission): 25 (WebCore::FormSubmission::create): 26 * loader/FormSubmission.h: 27 (WebCore::FormSubmission::lockHistory): 28 * loader/FrameLoader.cpp: 29 (WebCore::FrameLoader::changeLocation): 30 (WebCore::FrameLoader::urlSelected): 31 (WebCore::FrameLoader::loadURLIntoChildFrame): 32 (WebCore::FrameLoader::loadFrameRequest): 33 (WebCore::FrameLoader::loadURL): 34 (WebCore::FrameLoader::loadWithNavigationAction): 35 (WebCore::FrameLoader::clientRedirected): 36 (WebCore::FrameLoader::loadPostRequest): 37 (WebCore::FrameLoader::continueLoadAfterNewWindowPolicy): 38 (WebCore::FrameLoader::loadDifferentDocumentItem): 39 * loader/FrameLoader.h: 40 * loader/FrameLoaderTypes.h: 41 * loader/NavigationScheduler.cpp: 42 (WebCore::ScheduledNavigation::ScheduledNavigation): 43 (WebCore::ScheduledNavigation::lockHistory): 44 (WebCore::ScheduledNavigation::lockBackForwardList): 45 (WebCore::ScheduledURLNavigation::ScheduledURLNavigation): 46 (WebCore::ScheduledRedirect::ScheduledRedirect): 47 (WebCore::ScheduledLocationChange::ScheduledLocationChange): 48 (WebCore::ScheduledRefresh::ScheduledRefresh): 49 (WebCore::ScheduledHistoryNavigation::ScheduledHistoryNavigation): 50 (WebCore::ScheduledFormSubmission::ScheduledFormSubmission): 51 (WebCore::NavigationScheduler::scheduleRedirect): 52 (WebCore::NavigationScheduler::mustLockBackForwardList): 53 (WebCore::NavigationScheduler::scheduleLocationChange): 54 (WebCore::NavigationScheduler::scheduleFormSubmission): 55 * loader/NavigationScheduler.h: 56 * loader/SubframeLoader.cpp: 57 (WebCore::SubframeLoader::requestFrame): 58 (WebCore::SubframeLoader::requestObject): 59 (WebCore::SubframeLoader::loadOrRedirectSubframe): 60 * loader/SubframeLoader.h: 61 * page/ContextMenuController.cpp: 62 (WebCore::openNewWindow): 63 (WebCore::ContextMenuController::contextMenuItemSelected): 64 * page/DOMWindow.cpp: 65 (WebCore::DOMWindow::setLocation): 66 (WebCore::DOMWindow::createWindow): 67 (WebCore::DOMWindow::open): 68 * svg/SVGAElement.cpp: 69 (WebCore::SVGAElement::defaultEventHandler): 70 1 71 2014-04-02 Tim Horton <timothy_horton@apple.com> 2 72 -
trunk/Source/WebCore/WebCore.exp.in
r166682 r166684 131 131 __ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE 132 132 __ZN7WebCore11FrameLoader11shouldCloseEv 133 __ZN7WebCore11FrameLoader11urlSelectedERKNS_3URLERKN3WTF6StringENS4_10PassRefPtrINS_5EventEEE bbNS_18ShouldSendReferrerE133 __ZN7WebCore11FrameLoader11urlSelectedERKNS_3URLERKN3WTF6StringENS4_10PassRefPtrINS_5EventEEENS_11LockHistoryENS_19LockBackForwardListENS_18ShouldSendReferrerE 134 134 __ZN7WebCore11FrameLoader14detachChildrenEv 135 135 __ZN7WebCore11FrameLoader14stopAllLoadersENS_26ClearProvisionalItemPolicyE 136 136 __ZN7WebCore11FrameLoader16detachFromParentEv 137 __ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestE bbN3WTF10PassRefPtrINS_5EventEEENS5_INS_9FormStateEEENS_18ShouldSendReferrerE137 __ZN7WebCore11FrameLoader16loadFrameRequestERKNS_16FrameLoadRequestENS_11LockHistoryENS_19LockBackForwardListEN3WTF10PassRefPtrINS_5EventEEENS7_INS_9FormStateEEENS_18ShouldSendReferrerE 138 138 __ZN7WebCore11FrameLoader17stopForUserCancelEb 139 139 __ZN7WebCore11FrameLoader21loadURLIntoChildFrameERKNS_3URLERKN3WTF6StringEPNS_5FrameE … … 1199 1199 __ZN7WebCore7IntRectC1ERKNS_9FloatRectE 1200 1200 __ZN7WebCore7IntSizeC1ERK6CGSize 1201 __ZN7WebCore7IntSizeC1ERKNS_9FloatSizeE 1201 1202 __ZN7WebCore7TextRun19allowsRoundingHacksEv 1202 1203 __ZN7WebCore7TextRun21s_allowsRoundingHacksE … … 1307 1308 __ZN7WebCore9FloatRectC1ERK6CGRect 1308 1309 __ZN7WebCore9FloatRectC1ERKNS_7IntRectE 1309 __ZNK7WebCore9FloatRect8containsERKNS_10FloatPointENS0_12ContainsModeE1310 1310 __ZN7WebCore9FloatSizeC1ERK6CGSize 1311 1311 __ZN7WebCore9FloatSizeC1ERKNS_7IntSizeE 1312 __ZN7WebCore7IntSizeC1ERKNS_9FloatSizeE1313 1312 __ZN7WebCore9FontCache10invalidateEv 1314 1313 __ZN7WebCore9FontCache13fontDataCountEv … … 1909 1908 __ZNK7WebCore9FloatQuad11boundingBoxEv 1910 1909 __ZNK7WebCore9FloatRect10intersectsERKS0_ 1910 __ZNK7WebCore9FloatRect8containsERKNS_10FloatPointENS0_12ContainsModeE 1911 1911 __ZNK7WebCore9FloatRect8containsERKS0_ 1912 1912 __ZNK7WebCore9FloatRectcv6CGRectEv -
trunk/Source/WebCore/html/HTMLAnchorElement.cpp
r165607 r166684 548 548 } else 549 549 #endif 550 frame->loader().urlSelected(kurl, target(), event, false, false, hasRel(RelationNoReferrer) ? NeverSendReferrer : MaybeSendReferrer);550 frame->loader().urlSelected(kurl, target(), event, LockHistory::No, LockBackForwardList::No, hasRel(RelationNoReferrer) ? NeverSendReferrer : MaybeSendReferrer); 551 551 552 552 sendPings(kurl); -
trunk/Source/WebCore/html/HTMLFormElement.cpp
r166615 r166684 348 348 firstSuccessfulSubmitButton->setActivatedSubmit(true); 349 349 350 bool lockHistory = !processingUserGesture;350 LockHistory lockHistory = processingUserGesture ? LockHistory::No : LockHistory::Yes; 351 351 frame->loader().submitForm(FormSubmission::create(this, m_attributes, event, lockHistory, formSubmissionTrigger)); 352 352 -
trunk/Source/WebCore/html/HTMLFrameElementBase.cpp
r165045 r166684 74 74 } 75 75 76 void HTMLFrameElementBase::openURL( bool lockHistory, boollockBackForwardList)76 void HTMLFrameElementBase::openURL(LockHistory lockHistory, LockBackForwardList lockBackForwardList) 77 77 { 78 78 if (!isURLAllowed()) … … 182 182 183 183 if (inDocument()) 184 openURL( false, false);184 openURL(LockHistory::No, LockBackForwardList::No); 185 185 } 186 186 -
trunk/Source/WebCore/html/HTMLFrameElementBase.h
r164254 r166684 25 25 #define HTMLFrameElementBase_h 26 26 27 #include "FrameLoaderTypes.h" 27 28 #include "HTMLFrameOwnerElement.h" 28 29 #include "ScrollTypes.h" … … 65 66 66 67 void setNameAndOpenURL(); 67 void openURL( bool lockHistory = true, bool lockBackForwardList = true);68 void openURL(LockHistory = LockHistory::Yes, LockBackForwardList = LockBackForwardList::Yes); 68 69 69 70 AtomicString m_URL; -
trunk/Source/WebCore/inspector/InspectorFrontendClientLocal.cpp
r164245 r166684 225 225 226 226 // FIXME: Why does one use mainFrame and the other frame? 227 frame->loader().changeLocation(mainFrame.document()->securityOrigin(), frame->document()->completeURL(url), "", false, false);227 frame->loader().changeLocation(mainFrame.document()->securityOrigin(), frame->document()->completeURL(url), "", LockHistory::No, LockBackForwardList::No); 228 228 } 229 229 -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r166329 r166684 430 430 UserGestureIndicator indicator(DefinitelyProcessingUserGesture); 431 431 Frame& frame = m_page->mainFrame(); 432 frame.loader().changeLocation(frame.document()->securityOrigin(), frame.document()->completeURL(url), "", false, false);432 frame.loader().changeLocation(frame.document()->securityOrigin(), frame.document()->completeURL(url), "", LockHistory::No, LockBackForwardList::No); 433 433 } 434 434 -
trunk/Source/WebCore/loader/FormSubmission.cpp
r166047 r166684 125 125 } 126 126 127 inline FormSubmission::FormSubmission(Method method, const URL& action, const String& target, const String& contentType, PassRefPtr<FormState> state, PassRefPtr<FormData> data, const String& boundary, boollockHistory, PassRefPtr<Event> event)127 inline FormSubmission::FormSubmission(Method method, const URL& action, const String& target, const String& contentType, PassRefPtr<FormState> state, PassRefPtr<FormData> data, const String& boundary, LockHistory lockHistory, PassRefPtr<Event> event) 128 128 : m_method(method) 129 129 , m_action(action) … … 138 138 } 139 139 140 PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const Attributes& attributes, PassRefPtr<Event> event, boollockHistory, FormSubmissionTrigger trigger)140 PassRefPtr<FormSubmission> FormSubmission::create(HTMLFormElement* form, const Attributes& attributes, PassRefPtr<Event> event, LockHistory lockHistory, FormSubmissionTrigger trigger) 141 141 { 142 142 ASSERT(form); -
trunk/Source/WebCore/loader/FormSubmission.h
r156550 r166684 33 33 34 34 #include "FormState.h" 35 #include "FrameLoaderTypes.h" 35 36 #include "URL.h" 36 37 … … 89 90 }; 90 91 91 static PassRefPtr<FormSubmission> create(HTMLFormElement*, const Attributes&, PassRefPtr<Event> event, bool lockHistory, FormSubmissionTrigger);92 static PassRefPtr<FormSubmission> create(HTMLFormElement*, const Attributes&, PassRefPtr<Event> event, LockHistory, FormSubmissionTrigger); 92 93 93 94 void populateFrameLoadRequest(FrameLoadRequest&); … … 103 104 FormData* data() const { return m_formData.get(); } 104 105 const String boundary() const { return m_boundary; } 105 boollockHistory() const { return m_lockHistory; }106 LockHistory lockHistory() const { return m_lockHistory; } 106 107 Event* event() const { return m_event.get(); } 107 108 … … 112 113 113 114 private: 114 FormSubmission(Method, const URL& action, const String& target, const String& contentType, PassRefPtr<FormState>, PassRefPtr<FormData>, const String& boundary, bool lockHistory, PassRefPtr<Event>);115 FormSubmission(Method, const URL& action, const String& target, const String& contentType, PassRefPtr<FormState>, PassRefPtr<FormData>, const String& boundary, LockHistory, PassRefPtr<Event>); 115 116 116 117 // FIXME: Hold an instance of Attributes instead of individual members. … … 122 123 RefPtr<FormData> m_formData; 123 124 String m_boundary; 124 boolm_lockHistory;125 LockHistory m_lockHistory; 125 126 RefPtr<Event> m_event; 126 127 String m_referrer; -
trunk/Source/WebCore/loader/FrameLoader.cpp
r166600 r166684 318 318 } 319 319 320 void FrameLoader::changeLocation(SecurityOrigin* securityOrigin, const URL& url, const String& referrer, bool lockHistory, boollockBackForwardList, bool refresh)320 void FrameLoader::changeLocation(SecurityOrigin* securityOrigin, const URL& url, const String& referrer, LockHistory lockHistory, LockBackForwardList lockBackForwardList, bool refresh) 321 321 { 322 322 urlSelected(FrameLoadRequest(securityOrigin, ResourceRequest(url, referrer, refresh ? ReloadIgnoringCacheData : UseProtocolCachePolicy), "_self"), … … 324 324 } 325 325 326 void FrameLoader::urlSelected(const URL& url, const String& passedTarget, PassRefPtr<Event> triggeringEvent, bool lockHistory, boollockBackForwardList, ShouldSendReferrer shouldSendReferrer)326 void FrameLoader::urlSelected(const URL& url, const String& passedTarget, PassRefPtr<Event> triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer) 327 327 { 328 328 urlSelected(FrameLoadRequest(m_frame.document()->securityOrigin(), ResourceRequest(url), passedTarget), … … 332 332 // The shouldReplaceDocumentIfJavaScriptURL parameter will go away when the FIXME to eliminate the 333 333 // corresponding parameter from ScriptController::executeIfJavaScriptURL() is addressed. 334 void FrameLoader::urlSelected(const FrameLoadRequest& passedRequest, PassRefPtr<Event> triggeringEvent, bool lockHistory, boollockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL)334 void FrameLoader::urlSelected(const FrameLoadRequest& passedRequest, PassRefPtr<Event> triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL) 335 335 { 336 336 ASSERT(!m_suppressOpenerInNewFrame); … … 915 915 } 916 916 917 childFrame->loader().loadURL(url, referer, "_self", false, FrameLoadTypeRedirectWithLockedBackForwardList, 0, 0);917 childFrame->loader().loadURL(url, referer, "_self", LockHistory::No, FrameLoadTypeRedirectWithLockedBackForwardList, 0, 0); 918 918 } 919 919 … … 1193 1193 } 1194 1194 1195 void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, bool lockHistory, boollockBackForwardList,1195 void FrameLoader::loadFrameRequest(const FrameLoadRequest& request, LockHistory lockHistory, LockBackForwardList lockBackForwardList, 1196 1196 PassRefPtr<Event> event, PassRefPtr<FormState> formState, ShouldSendReferrer shouldSendReferrer) 1197 1197 { … … 1218 1218 if (request.resourceRequest().cachePolicy() == ReloadIgnoringCacheData) 1219 1219 loadType = FrameLoadTypeReload; 1220 else if (lockBackForwardList )1220 else if (lockBackForwardList == LockBackForwardList::Yes) 1221 1221 loadType = FrameLoadTypeRedirectWithLockedBackForwardList; 1222 1222 else … … 1240 1240 } 1241 1241 1242 void FrameLoader::loadURL(const URL& newURL, const String& referrer, const String& frameName, boollockHistory, FrameLoadType newLoadType,1242 void FrameLoader::loadURL(const URL& newURL, const String& referrer, const String& frameName, LockHistory lockHistory, FrameLoadType newLoadType, 1243 1243 PassRefPtr<Event> event, PassRefPtr<FormState> prpFormState) 1244 1244 { … … 1363 1363 } 1364 1364 1365 void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, boollockHistory, FrameLoadType type, PassRefPtr<FormState> formState)1365 void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, const NavigationAction& action, LockHistory lockHistory, FrameLoadType type, PassRefPtr<FormState> formState) 1366 1366 { 1367 1367 RefPtr<DocumentLoader> loader = m_client.createDocumentLoader(request, defaultSubstituteDataForURL(request.url())); 1368 if (lockHistory && m_documentLoader)1368 if (lockHistory == LockHistory::Yes && m_documentLoader) 1369 1369 loader->setClientRedirectSourceForHistory(m_documentLoader->didCreateGlobalHistoryEntry() ? m_documentLoader->urlForHistory().string() : m_documentLoader->clientRedirectSourceForHistory()); 1370 1370 … … 1997 1997 } 1998 1998 1999 void FrameLoader::clientRedirected(const URL& url, double seconds, double fireDate, boollockBackForwardList)1999 void FrameLoader::clientRedirected(const URL& url, double seconds, double fireDate, LockBackForwardList lockBackForwardList) 2000 2000 { 2001 2001 m_client.dispatchWillPerformClientRedirect(url, seconds, fireDate); … … 2009 2009 // no "original" load on which to base a redirect, so we treat the redirect as a normal load. 2010 2010 // Loads triggered by JavaScript form submissions never count as quick redirects. 2011 m_quickRedirectComing = (lockBackForwardList || history().currentItemShouldBeReplaced()) && m_documentLoader && !m_isExecutingJavaScriptFormAction;2011 m_quickRedirectComing = (lockBackForwardList == LockBackForwardList::Yes || history().currentItemShouldBeReplaced()) && m_documentLoader && !m_isExecutingJavaScriptFormAction; 2012 2012 } 2013 2013 … … 2608 2608 } 2609 2609 2610 void FrameLoader::loadPostRequest(const ResourceRequest& inRequest, const String& referrer, const String& frameName, boollockHistory, FrameLoadType loadType, PassRefPtr<Event> event, PassRefPtr<FormState> prpFormState)2610 void FrameLoader::loadPostRequest(const ResourceRequest& inRequest, const String& referrer, const String& frameName, LockHistory lockHistory, FrameLoadType loadType, PassRefPtr<Event> event, PassRefPtr<FormState> prpFormState) 2611 2611 { 2612 2612 RefPtr<FormState> formState = prpFormState; … … 2975 2975 mainFrame->document()->setReferrerPolicy(frame->document()->referrerPolicy()); 2976 2976 } 2977 mainFrame->loader().loadWithNavigationAction(request, NavigationAction(request), false, FrameLoadTypeStandard, formState);2977 mainFrame->loader().loadWithNavigationAction(request, NavigationAction(request), LockHistory::No, FrameLoadTypeStandard, formState); 2978 2978 } 2979 2979 … … 3229 3229 } 3230 3230 3231 loadWithNavigationAction(request, action, false, loadType, 0);3231 loadWithNavigationAction(request, action, LockHistory::No, loadType, 0); 3232 3232 } 3233 3233 -
trunk/Source/WebCore/loader/FrameLoader.h
r165676 r166684 108 108 // FIXME: These are all functions which start loads. We have too many. 109 109 void loadURLIntoChildFrame(const URL&, const String& referer, Frame*); 110 void loadFrameRequest(const FrameLoadRequest&, bool lockHistory, bool lockBackForwardList, // Called by submitForm, calls loadPostRequest and loadURL.110 void loadFrameRequest(const FrameLoadRequest&, LockHistory, LockBackForwardList, // Called by submitForm, calls loadPostRequest and loadURL. 111 111 PassRefPtr<Event>, PassRefPtr<FormState>, ShouldSendReferrer); 112 112 … … 118 118 unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ClientCredentialPolicy, ResourceError&, ResourceResponse&, Vector<char>& data); 119 119 120 void changeLocation(SecurityOrigin*, const URL&, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true, bool refresh = false); 121 void urlSelected(const URL&, const String& target, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, ShouldSendReferrer); 120 void changeLocation(SecurityOrigin*, const URL&, const String& referrer, LockHistory = LockHistory::Yes, 121 LockBackForwardList = LockBackForwardList::Yes, bool refresh = false); 122 void urlSelected(const URL&, const String& target, PassRefPtr<Event>, LockHistory, LockBackForwardList, ShouldSendReferrer); 122 123 void submitForm(PassRefPtr<FormSubmission>); 123 124 … … 256 257 void completed(); 257 258 bool allAncestorsAreComplete() const; // including this 258 void clientRedirected(const URL&, double delay, double fireDate, bool lockBackForwardList);259 void clientRedirected(const URL&, double delay, double fireDate, LockBackForwardList); 259 260 void clientRedirectCancelledOrFinished(bool cancelWithLoadInProgress); 260 261 … … 342 343 void dispatchDidCommitLoad(); 343 344 344 void urlSelected(const FrameLoadRequest&, PassRefPtr<Event>, bool lockHistory, bool lockBackForwardList, ShouldSendReferrer, ShouldReplaceDocumentIfJavaScriptURL);345 void urlSelected(const FrameLoadRequest&, PassRefPtr<Event>, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldReplaceDocumentIfJavaScriptURL); 345 346 346 347 void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>); // Calls continueLoadAfterNavigationPolicy … … 348 349 349 350 void loadWithNavigationAction(const ResourceRequest&, const NavigationAction&, // Calls loadWithDocumentLoader 350 bool lockHistory, FrameLoadType, PassRefPtr<FormState>);351 LockHistory, FrameLoadType, PassRefPtr<FormState>); 351 352 352 353 void loadPostRequest(const ResourceRequest&, const String& referrer, // Called by loadFrameRequest, calls loadWithNavigationAction 353 const String& frameName, bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);354 const String& frameName, LockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>); 354 355 void loadURL(const URL&, const String& referrer, const String& frameName, // Called by loadFrameRequest, calls loadWithNavigationAction or dispatches to navigation policy delegate 355 bool lockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>);356 LockHistory, FrameLoadType, PassRefPtr<Event>, PassRefPtr<FormState>); 356 357 357 358 bool shouldReload(const URL& currentURL, const URL& destinationURL); -
trunk/Source/WebCore/loader/FrameLoaderTypes.h
r165676 r166684 113 113 }; 114 114 115 enum class LockHistory { 116 Yes, 117 No 118 }; 119 120 enum class LockBackForwardList { 121 Yes, 122 No 123 }; 115 124 } 116 125 -
trunk/Source/WebCore/loader/NavigationScheduler.cpp
r165676 r166684 60 60 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); WTF_MAKE_FAST_ALLOCATED; 61 61 public: 62 ScheduledNavigation(double delay, bool lockHistory, boollockBackForwardList, bool wasDuringLoad, bool isLocationChange)62 ScheduledNavigation(double delay, LockHistory lockHistory, LockBackForwardList lockBackForwardList, bool wasDuringLoad, bool isLocationChange) 63 63 : m_delay(delay) 64 64 , m_lockHistory(lockHistory) … … 78 78 79 79 double delay() const { return m_delay; } 80 boollockHistory() const { return m_lockHistory; }81 boollockBackForwardList() const { return m_lockBackForwardList; }80 LockHistory lockHistory() const { return m_lockHistory; } 81 LockBackForwardList lockBackForwardList() const { return m_lockBackForwardList; } 82 82 bool wasDuringLoad() const { return m_wasDuringLoad; } 83 83 bool isLocationChange() const { return m_isLocationChange; } … … 89 89 private: 90 90 double m_delay; 91 boolm_lockHistory;92 boolm_lockBackForwardList;91 LockHistory m_lockHistory; 92 LockBackForwardList m_lockBackForwardList; 93 93 bool m_wasDuringLoad; 94 94 bool m_isLocationChange; … … 98 98 class ScheduledURLNavigation : public ScheduledNavigation { 99 99 protected: 100 ScheduledURLNavigation(double delay, SecurityOrigin* securityOrigin, const String& url, const String& referrer, bool lockHistory, boollockBackForwardList, bool duringLoad, bool isLocationChange)100 ScheduledURLNavigation(double delay, SecurityOrigin* securityOrigin, const String& url, const String& referrer, LockHistory lockHistory, LockBackForwardList lockBackForwardList, bool duringLoad, bool isLocationChange) 101 101 : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange) 102 102 , m_securityOrigin(securityOrigin) … … 150 150 class ScheduledRedirect : public ScheduledURLNavigation { 151 151 public: 152 ScheduledRedirect(double delay, SecurityOrigin* securityOrigin, const String& url, bool lockHistory, boollockBackForwardList)152 ScheduledRedirect(double delay, SecurityOrigin* securityOrigin, const String& url, LockHistory lockHistory, LockBackForwardList lockBackForwardList) 153 153 : ScheduledURLNavigation(delay, securityOrigin, url, String(), lockHistory, lockBackForwardList, false, false) 154 154 { … … 171 171 class ScheduledLocationChange : public ScheduledURLNavigation { 172 172 public: 173 ScheduledLocationChange(SecurityOrigin* securityOrigin, const String& url, const String& referrer, bool lockHistory, boollockBackForwardList, bool duringLoad)173 ScheduledLocationChange(SecurityOrigin* securityOrigin, const String& url, const String& referrer, LockHistory lockHistory, LockBackForwardList lockBackForwardList, bool duringLoad) 174 174 : ScheduledURLNavigation(0.0, securityOrigin, url, referrer, lockHistory, lockBackForwardList, duringLoad, true) { } 175 175 }; … … 178 178 public: 179 179 ScheduledRefresh(SecurityOrigin* securityOrigin, const String& url, const String& referrer) 180 : ScheduledURLNavigation(0.0, securityOrigin, url, referrer, true, true, false, true)180 : ScheduledURLNavigation(0.0, securityOrigin, url, referrer, LockHistory::Yes, LockBackForwardList::Yes, false, true) 181 181 { 182 182 } … … 192 192 public: 193 193 explicit ScheduledHistoryNavigation(int historySteps) 194 : ScheduledNavigation(0, false, false, false, true)194 : ScheduledNavigation(0, LockHistory::No, LockBackForwardList::No, false, true) 195 195 , m_historySteps(historySteps) 196 196 { … … 219 219 class ScheduledFormSubmission : public ScheduledNavigation { 220 220 public: 221 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, boollockBackForwardList, bool duringLoad)221 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, LockBackForwardList lockBackForwardList, bool duringLoad) 222 222 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true) 223 223 , m_submission(submission) … … 320 320 321 321 // We want a new back/forward list item if the refresh timeout is > 1 second. 322 if (!m_redirect || delay <= m_redirect->delay()) 323 schedule(std::make_unique<ScheduledRedirect>(delay, m_frame.document()->securityOrigin(), url, true, delay <= 1)); 324 } 325 326 bool NavigationScheduler::mustLockBackForwardList(Frame& targetFrame) 322 if (!m_redirect || delay <= m_redirect->delay()) { 323 LockBackForwardList lockBackForwardList = delay <= 1 ? LockBackForwardList::Yes : LockBackForwardList::No; 324 schedule(std::make_unique<ScheduledRedirect>(delay, m_frame.document()->securityOrigin(), url, LockHistory::Yes, lockBackForwardList)); 325 } 326 } 327 328 LockBackForwardList NavigationScheduler::mustLockBackForwardList(Frame& targetFrame) 327 329 { 328 330 // Non-user navigation before the page has finished firing onload should not create a new back/forward item. 329 331 // See https://webkit.org/b/42861 for the original motivation for this. 330 332 if (!ScriptController::processingUserGesture() && targetFrame.loader().documentLoader() && !targetFrame.loader().documentLoader()->wasOnloadHandled()) 331 return true;333 return LockBackForwardList::Yes; 332 334 333 335 // Navigation of a subframe during loading of an ancestor frame does not create a new back/forward item. … … 337 339 Document* document = ancestor->document(); 338 340 if (!ancestor->loader().isComplete() || (document && document->processingLoadEvent())) 339 return true;340 } 341 return false;342 } 343 344 void NavigationScheduler::scheduleLocationChange(SecurityOrigin* securityOrigin, const String& url, const String& referrer, bool lockHistory, boollockBackForwardList)341 return LockBackForwardList::Yes; 342 } 343 return LockBackForwardList::No; 344 } 345 346 void NavigationScheduler::scheduleLocationChange(SecurityOrigin* securityOrigin, const String& url, const String& referrer, LockHistory lockHistory, LockBackForwardList lockBackForwardList) 345 347 { 346 348 if (!shouldScheduleNavigation(url)) … … 349 351 return; 350 352 351 lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame); 353 if (lockBackForwardList == LockBackForwardList::No) 354 lockBackForwardList = mustLockBackForwardList(m_frame); 352 355 353 356 FrameLoader& loader = m_frame.loader(); … … 382 385 // to match IE and Opera. 383 386 // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this. 384 bool lockBackForwardList = mustLockBackForwardList(m_frame) 385 || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript 386 && m_frame.tree().parent() && !ScriptController::processingUserGesture()); 387 387 LockBackForwardList lockBackForwardList = mustLockBackForwardList(m_frame); 388 if (lockBackForwardList == LockBackForwardList::No 389 && (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame.tree().parent() && !ScriptController::processingUserGesture())) { 390 lockBackForwardList = LockBackForwardList::Yes; 391 } 392 388 393 schedule(std::make_unique<ScheduledFormSubmission>(submission, lockBackForwardList, duringLoad)); 389 394 } -
trunk/Source/WebCore/loader/NavigationScheduler.h
r165676 r166684 32 32 #define NavigationScheduler_h 33 33 34 #include "FrameLoaderTypes.h" 34 35 #include "Timer.h" 35 36 #include <wtf/Forward.h> … … 74 75 75 76 void scheduleRedirect(double delay, const String& url); 76 void scheduleLocationChange(SecurityOrigin*, const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true); 77 void scheduleLocationChange(SecurityOrigin*, const String& url, const String& referrer, LockHistory = LockHistory::Yes, 78 LockBackForwardList = LockBackForwardList::Yes); 77 79 void scheduleFormSubmission(PassRefPtr<FormSubmission>); 78 80 void scheduleRefresh(); … … 91 93 void schedule(std::unique_ptr<ScheduledNavigation>); 92 94 93 static boolmustLockBackForwardList(Frame& targetFrame);95 static LockBackForwardList mustLockBackForwardList(Frame& targetFrame); 94 96 95 97 Frame& m_frame; -
trunk/Source/WebCore/loader/SubframeLoader.cpp
r166049 r166684 77 77 } 78 78 79 bool SubframeLoader::requestFrame(HTMLFrameOwnerElement& ownerElement, const String& urlString, const AtomicString& frameName, bool lockHistory, boollockBackForwardList)79 bool SubframeLoader::requestFrame(HTMLFrameOwnerElement& ownerElement, const String& urlString, const AtomicString& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList) 80 80 { 81 81 // Support for <frame src="javascript:string"> … … 231 231 // it will create a new frame and set it as the RenderWidget's Widget, causing what was previously 232 232 // in the widget to be torn down. 233 return loadOrRedirectSubframe(ownerElement, completedURL, frameName, true, true);233 return loadOrRedirectSubframe(ownerElement, completedURL, frameName, LockHistory::Yes, LockBackForwardList::Yes); 234 234 } 235 235 … … 321 321 } 322 322 323 Frame* SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement& ownerElement, const URL& url, const AtomicString& frameName, bool lockHistory, boollockBackForwardList)323 Frame* SubframeLoader::loadOrRedirectSubframe(HTMLFrameOwnerElement& ownerElement, const URL& url, const AtomicString& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList) 324 324 { 325 325 Frame* frame = ownerElement.contentFrame(); -
trunk/Source/WebCore/loader/SubframeLoader.h
r165676 r166684 60 60 void clear(); 61 61 62 bool requestFrame(HTMLFrameOwnerElement&, const String& url, const AtomicString& frameName, bool lockHistory = true, bool lockBackForwardList = true);62 bool requestFrame(HTMLFrameOwnerElement&, const String& url, const AtomicString& frameName, LockHistory = LockHistory::Yes, LockBackForwardList = LockBackForwardList::Yes); 63 63 bool requestObject(HTMLPlugInImageElement&, const String& url, const AtomicString& frameName, 64 64 const String& serviceType, const Vector<String>& paramNames, const Vector<String>& paramValues); … … 78 78 private: 79 79 bool requestPlugin(HTMLPlugInImageElement&, const URL&, const String& serviceType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback); 80 Frame* loadOrRedirectSubframe(HTMLFrameOwnerElement&, const URL&, const AtomicString& frameName, bool lockHistory, bool lockBackForwardList);80 Frame* loadOrRedirectSubframe(HTMLFrameOwnerElement&, const URL&, const AtomicString& frameName, LockHistory, LockBackForwardList); 81 81 Frame* loadSubframe(HTMLFrameOwnerElement&, const URL&, const String& name, const String& referrer); 82 82 bool loadPlugin(HTMLPlugInImageElement&, const URL&, const String& mimeType, const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback); -
trunk/Source/WebCore/page/ContextMenuController.cpp
r165676 r166684 207 207 return; 208 208 newPage->chrome().show(); 209 newPage->mainFrame().loader().loadFrameRequest(request, false, false, 0, 0, MaybeSendReferrer);209 newPage->mainFrame().loader().loadFrameRequest(request, LockHistory::No, LockBackForwardList::No, 0, 0, MaybeSendReferrer); 210 210 } 211 211 … … 406 406 case ContextMenuItemTagOpenLink: 407 407 if (Frame* targetFrame = m_context.hitTestResult().targetFrame()) 408 targetFrame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer())), false, false, 0, 0, MaybeSendReferrer);408 targetFrame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer())), LockHistory::No, LockBackForwardList::No, 0, 0, MaybeSendReferrer); 409 409 else 410 410 openNewWindow(m_context.hitTestResult().absoluteLinkURL(), frame); 411 411 break; 412 412 case ContextMenuItemTagOpenLinkInThisWindow: 413 frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer())), false, false, 0, 0, MaybeSendReferrer);413 frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(m_context.hitTestResult().absoluteLinkURL(), frame->loader().outgoingReferrer())), LockHistory::No, LockBackForwardList::No, 0, 0, MaybeSendReferrer); 414 414 break; 415 415 case ContextMenuItemTagBold: -
trunk/Source/WebCore/page/DOMWindow.cpp
r166551 r166684 1928 1928 1929 1929 // We want a new history item if we are processing a user gesture. 1930 LockHistory lockHistory = (locking != LockHistoryBasedOnGestureState || !ScriptController::processingUserGesture()) ? LockHistory::Yes : LockHistory::No; 1931 LockBackForwardList lockBackForwardList = (locking != LockHistoryBasedOnGestureState) ? LockBackForwardList::Yes : LockBackForwardList::No; 1930 1932 m_frame->navigationScheduler().scheduleLocationChange(activeDocument->securityOrigin(), 1931 1933 // FIXME: What if activeDocument()->frame() is 0? 1932 1934 completedURL, activeDocument->frame()->loader().outgoingReferrer(), 1933 locking != LockHistoryBasedOnGestureState || !ScriptController::processingUserGesture(), 1934 locking != LockHistoryBasedOnGestureState); 1935 lockHistory, lockBackForwardList); 1935 1936 } 1936 1937 … … 2044 2045 2045 2046 if (created) 2046 newFrame->loader().changeLocation(activeWindow.document()->securityOrigin(), completedURL, referrer, false, false);2047 newFrame->loader().changeLocation(activeWindow.document()->securityOrigin(), completedURL, referrer, LockHistory::No, LockBackForwardList::No); 2047 2048 else if (!urlString.isEmpty()) { 2048 bool lockHistory = !ScriptController::processingUserGesture();2049 newFrame->navigationScheduler().scheduleLocationChange(activeWindow.document()->securityOrigin(), completedURL.string(), referrer, lockHistory, false);2049 LockHistory lockHistory = ScriptController::processingUserGesture() ? LockHistory::No : LockHistory::Yes; 2050 newFrame->navigationScheduler().scheduleLocationChange(activeWindow.document()->securityOrigin(), completedURL.string(), referrer, lockHistory, LockBackForwardList::No); 2050 2051 } 2051 2052 … … 2101 2102 // For whatever reason, Firefox uses the first window rather than the active window to 2102 2103 // determine the outgoing referrer. We replicate that behavior here. 2103 bool lockHistory = !ScriptController::processingUserGesture(); 2104 targetFrame->navigationScheduler().scheduleLocationChange( 2105 activeDocument->securityOrigin(), 2106 completedURL, 2107 firstFrame->loader().outgoingReferrer(), 2108 lockHistory, 2109 false); 2104 LockHistory lockHistory = ScriptController::processingUserGesture() ? LockHistory::No : LockHistory::Yes; 2105 targetFrame->navigationScheduler().scheduleLocationChange(activeDocument->securityOrigin(), completedURL, firstFrame->loader().outgoingReferrer(), 2106 lockHistory, LockBackForwardList::No); 2110 2107 return targetFrame->document()->domWindow(); 2111 2108 } -
trunk/Source/WebCore/svg/SVGAElement.cpp
r165607 r166684 178 178 if (!frame) 179 179 return; 180 frame->loader().urlSelected(document().completeURL(url), target, event, false, false, MaybeSendReferrer);180 frame->loader().urlSelected(document().completeURL(url), target, event, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer); 181 181 return; 182 182 } -
trunk/Source/WebKit/mac/ChangeLog
r166680 r166684 1 2014-04-02 Mark Rowe <mrowe@apple.com> 2 3 <https://webkit.org/b/131135> Introduce LockHistory and LockBackForwardList enums to use in place of bools. 4 5 These arguments are often passed using literals at the call site, where the use of bools severely hinders 6 the readability of the code. 7 8 Reviewed by Andreas Kling. 9 10 * WebView/WebPDFView.mm: 11 (-[WebPDFView PDFViewWillClickOnLink:withURL:]): 12 1 13 2014-04-02 Stephanie Lewis <slewis@apple.com> 2 14 -
trunk/Source/WebKit/mac/WebView/WebPDFView.mm
r165676 r166684 1057 1057 // Call to the frame loader because this is where our security checks are made. 1058 1058 Frame* frame = core([dataSource webFrame]); 1059 frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(URL)), false, false, event.get(), 0, MaybeSendReferrer);1059 frame->loader().loadFrameRequest(FrameLoadRequest(frame->document()->securityOrigin(), ResourceRequest(URL)), LockHistory::No, LockBackForwardList::No, event.get(), 0, MaybeSendReferrer); 1060 1060 } 1061 1061 -
trunk/Source/WebKit2/ChangeLog
r166682 r166684 1 2014-04-02 Mark Rowe <mrowe@apple.com> 2 3 <https://webkit.org/b/131135> Introduce LockHistory and LockBackForwardList enums to use in place of bools. 4 5 These arguments are often passed using literals at the call site, where the use of bools severely hinders 6 the readability of the code. 7 8 Reviewed by Andreas Kling. 9 10 * WebProcess/Plugins/PDF/PDFPlugin.mm: 11 (WebKit::PDFPlugin::clickedLink): 12 1 13 2014-04-02 Tim Horton <timothy_horton@apple.com> 2 14 -
trunk/Source/WebKit2/WebProcess/Plugins/PDF/PDFPlugin.mm
r165014 r166684 1559 1559 coreEvent = MouseEvent::create(eventNames().clickEvent, frame->document()->defaultView(), platform(m_lastMouseEvent), 0, 0); 1560 1560 1561 frame->loader().urlSelected(url, emptyString(), coreEvent.get(), false, false, MaybeSendReferrer);1561 frame->loader().urlSelected(url, emptyString(), coreEvent.get(), LockHistory::No, LockBackForwardList::No, MaybeSendReferrer); 1562 1562 } 1563 1563 -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebContextMenuClient.cpp
r164192 r166684 87 87 if (Page* page = frame->page()) { 88 88 UserGestureIndicator indicator(DefinitelyProcessingUserGesture); 89 page->mainFrame().loader().urlSelected(URL(ParsedURLString, url), String(), 0, false, false, MaybeSendReferrer);89 page->mainFrame().loader().urlSelected(URL(ParsedURLString, url), String(), 0, LockHistory::No, LockBackForwardList::No, MaybeSendReferrer); 90 90 } 91 91 }
Note: See TracChangeset
for help on using the changeset viewer.