Changeset 69938 in webkit
- Timestamp:
- Oct 17, 2010 7:59:32 PM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r69937 r69938 1 2010-10-17 Adam Barth <abarth@webkit.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Remove explicit passing of user gesture in NavigationScheduler 6 https://bugs.webkit.org/show_bug.cgi?id=47786 7 8 As requested by Mr. Glazkov, remove more explicit passing of the user 9 gesture state. We now use a static to pass this information around. 10 11 * bindings/generic/BindingFrame.h: 12 (WebCore::::navigateIfAllowed): 13 * bindings/js/JSDOMWindowCustom.cpp: 14 (WebCore::JSDOMWindow::setLocation): 15 * bindings/js/JSLocationCustom.cpp: 16 (WebCore::JSLocation::reload): 17 * bindings/v8/custom/V8LocationCustom.cpp: 18 (WebCore::V8Location::reloadCallback): 19 * inspector/InspectorController.cpp: 20 (WebCore::InspectorController::setResourceTrackingEnabled): 21 (WebCore::InspectorController::reloadPage): 22 * loader/NavigationScheduler.cpp: 23 (WebCore::ScheduledNavigation::ScheduledNavigation): 24 (WebCore::ScheduledURLNavigation::ScheduledURLNavigation): 25 (WebCore::ScheduledRedirect::ScheduledRedirect): 26 (WebCore::ScheduledLocationChange::ScheduledLocationChange): 27 (WebCore::ScheduledRefresh::ScheduledRefresh): 28 (WebCore::ScheduledHistoryNavigation::ScheduledHistoryNavigation): 29 (WebCore::ScheduledFormSubmission::ScheduledFormSubmission): 30 (WebCore::NavigationScheduler::scheduleRedirect): 31 (WebCore::NavigationScheduler::mustLockBackForwardList): 32 (WebCore::NavigationScheduler::scheduleLocationChange): 33 (WebCore::NavigationScheduler::scheduleFormSubmission): 34 (WebCore::NavigationScheduler::scheduleRefresh): 35 (WebCore::NavigationScheduler::scheduleHistoryNavigation): 36 * loader/NavigationScheduler.h: 37 * loader/SubframeLoader.cpp: 38 (WebCore::SubframeLoader::loadOrRedirectSubframe): 39 1 40 2010-10-17 Julien Chaffraix <jchaffraix@codeaurora.org> 2 41 -
trunk/WebCore/bindings/generic/BindingFrame.h
r69039 r69938 50 50 return; 51 51 if (!protocolIsJavaScript(url) || state->allowsAccessFromFrame(frame)) 52 frame->navigationScheduler()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList , state->processingUserGesture());52 frame->navigationScheduler()->scheduleLocationChange(url.string(), activeFrame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList); 53 53 } 54 54 -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r69924 r69938 513 513 if (!protocolIsJavaScript(url) || allowsAccessFrom(exec)) { 514 514 // We want a new history item if this JS was called via a user gesture 515 frame->navigationScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false , processingUserGesture());515 frame->navigationScheduler()->scheduleLocationChange(url, lexicalFrame->loader()->outgoingReferrer(), !lexicalFrame->script()->anyPageIsProcessingUserGesture(), false); 516 516 } 517 517 } -
trunk/WebCore/bindings/js/JSLocationCustom.cpp
r69039 r69938 314 314 315 315 if (!protocolIsJavaScript(frame->loader()->url())) 316 frame->navigationScheduler()->scheduleRefresh( processingUserGesture());316 frame->navigationScheduler()->scheduleRefresh(); 317 317 return jsUndefined(); 318 318 } -
trunk/WebCore/bindings/v8/custom/V8LocationCustom.cpp
r69039 r69938 283 283 284 284 if (!protocolIsJavaScript(frame->loader()->url())) 285 frame->navigationScheduler()->scheduleRefresh( processingUserGesture());285 frame->navigationScheduler()->scheduleRefresh(); 286 286 return v8::Undefined(); 287 287 } -
trunk/WebCore/inspector/InspectorController.cpp
r69924 r69938 1163 1163 1164 1164 if (enable) 1165 m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh(true);1165 reloadPage(); 1166 1166 } 1167 1167 … … 2123 2123 void InspectorController::reloadPage() 2124 2124 { 2125 m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh(true); 2125 // FIXME: Why do we set the user gesture indicator here? 2126 UserGestureIndicator indicator(DefinitelyProcessingUserGesture); 2127 m_inspectedPage->mainFrame()->navigationScheduler()->scheduleRefresh(); 2126 2128 } 2127 2129 -
trunk/WebCore/loader/NavigationScheduler.cpp
r69924 r69938 54 54 class ScheduledNavigation : public Noncopyable { 55 55 public: 56 ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange , bool wasUserGesture)56 ScheduledNavigation(double delay, bool lockHistory, bool lockBackForwardList, bool wasDuringLoad, bool isLocationChange) 57 57 : m_delay(delay) 58 58 , m_lockHistory(lockHistory) … … 60 60 , m_wasDuringLoad(wasDuringLoad) 61 61 , m_isLocationChange(isLocationChange) 62 , m_wasUserGesture( wasUserGesture)62 , m_wasUserGesture(ScriptController::processingUserGesture()) 63 63 { 64 64 } … … 89 89 class ScheduledURLNavigation : public ScheduledNavigation { 90 90 public: 91 ScheduledURLNavigation(double delay, const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, boolduringLoad, bool isLocationChange)92 : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange , wasUserGesture)91 ScheduledURLNavigation(double delay, const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool duringLoad, bool isLocationChange) 92 : ScheduledNavigation(delay, lockHistory, lockBackForwardList, duringLoad, isLocationChange) 93 93 , m_url(url) 94 94 , m_referrer(referrer) … … 129 129 class ScheduledRedirect : public ScheduledURLNavigation { 130 130 public: 131 ScheduledRedirect(double delay, const String& url, bool lockHistory, bool lockBackForwardList, bool wasUserGesture) 132 : ScheduledURLNavigation(delay, url, String(), lockHistory, lockBackForwardList, wasUserGesture, false, false) { } 131 ScheduledRedirect(double delay, const String& url, bool lockHistory, bool lockBackForwardList) 132 : ScheduledURLNavigation(delay, url, String(), lockHistory, lockBackForwardList, false, false) 133 { 134 } 133 135 134 136 virtual bool shouldStartTimer(Frame* frame) { return frame->loader()->allAncestorsAreComplete(); } … … 137 139 class ScheduledLocationChange : public ScheduledURLNavigation { 138 140 public: 139 ScheduledLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool wasUserGesture, boolduringLoad)140 : ScheduledURLNavigation(0.0, url, referrer, lockHistory, lockBackForwardList, wasUserGesture,duringLoad, true) { }141 ScheduledLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList, bool duringLoad) 142 : ScheduledURLNavigation(0.0, url, referrer, lockHistory, lockBackForwardList, duringLoad, true) { } 141 143 }; 142 144 143 145 class ScheduledRefresh : public ScheduledURLNavigation { 144 146 public: 145 ScheduledRefresh(const String& url, const String& referrer, bool wasUserGesture) 146 : ScheduledURLNavigation(0.0, url, referrer, true, true, wasUserGesture, false, true) { } 147 ScheduledRefresh(const String& url, const String& referrer) 148 : ScheduledURLNavigation(0.0, url, referrer, true, true, false, true) 149 { 150 } 147 151 148 152 virtual void fire(Frame* frame) … … 155 159 class ScheduledHistoryNavigation : public ScheduledNavigation { 156 160 public: 157 explicit ScheduledHistoryNavigation(int historySteps, bool wasUserGesture) : ScheduledNavigation(0, false, false, false, true, wasUserGesture), m_historySteps(historySteps) { } 161 explicit ScheduledHistoryNavigation(int historySteps) 162 : ScheduledNavigation(0, false, false, false, true) 163 , m_historySteps(historySteps) 164 { 165 } 158 166 159 167 virtual void fire(Frame* frame) … … 179 187 class ScheduledFormSubmission : public ScheduledNavigation { 180 188 public: 181 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad , bool wasUserGesture)182 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true , wasUserGesture)189 ScheduledFormSubmission(PassRefPtr<FormSubmission> submission, bool lockBackForwardList, bool duringLoad) 190 : ScheduledNavigation(0, submission->lockHistory(), lockBackForwardList, duringLoad, true) 183 191 , m_submission(submission) 184 192 , m_haveToldClient(false) … … 259 267 // We want a new back/forward list item if the refresh timeout is > 1 second. 260 268 if (!m_redirect || delay <= m_redirect->delay()) 261 schedule(adoptPtr(new ScheduledRedirect(delay, url, true, delay <= 1 , false)));262 } 263 264 bool NavigationScheduler::mustLockBackForwardList(Frame* targetFrame , bool wasUserGesture)269 schedule(adoptPtr(new ScheduledRedirect(delay, url, true, delay <= 1))); 270 } 271 272 bool NavigationScheduler::mustLockBackForwardList(Frame* targetFrame) 265 273 { 266 274 // Non-user navigation before the page has finished firing onload should not create a new back/forward item. 267 275 // See https://webkit.org/b/42861 for the original motivation for this. 268 if (! wasUserGesture&& targetFrame->loader()->documentLoader() && !targetFrame->loader()->documentLoader()->wasOnloadHandled())276 if (!ScriptController::processingUserGesture() && targetFrame->loader()->documentLoader() && !targetFrame->loader()->documentLoader()->wasOnloadHandled()) 269 277 return true; 270 278 … … 280 288 } 281 289 282 void NavigationScheduler::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList , bool wasUserGesture)290 void NavigationScheduler::scheduleLocationChange(const String& url, const String& referrer, bool lockHistory, bool lockBackForwardList) 283 291 { 284 292 if (!m_frame->page()) … … 287 295 return; 288 296 289 lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame , wasUserGesture);297 lockBackForwardList = lockBackForwardList || mustLockBackForwardList(m_frame); 290 298 291 299 FrameLoader* loader = m_frame->loader(); … … 303 311 bool duringLoad = !loader->stateMachine()->committedFirstRealDocumentLoad(); 304 312 305 schedule(adoptPtr(new ScheduledLocationChange(url, referrer, lockHistory, lockBackForwardList, wasUserGesture,duringLoad)));313 schedule(adoptPtr(new ScheduledLocationChange(url, referrer, lockHistory, lockBackForwardList, duringLoad))); 306 314 } 307 315 … … 320 328 // to match IE and Opera. 321 329 // See https://bugs.webkit.org/show_bug.cgi?id=32383 for the original motivation for this. 322 bool isUserGesture = m_frame->loader()->isProcessingUserGesture(); 323 bool lockBackForwardList = mustLockBackForwardList(m_frame, isUserGesture) || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript && m_frame->tree()->parent() && !isUserGesture); 324 325 schedule(adoptPtr(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad, isUserGesture))); 326 } 327 328 void NavigationScheduler::scheduleRefresh(bool wasUserGesture) 330 bool lockBackForwardList = mustLockBackForwardList(m_frame) 331 || (submission->state()->formSubmissionTrigger() == SubmittedByJavaScript 332 && m_frame->tree()->parent() && !ScriptController::processingUserGesture()); 333 334 schedule(adoptPtr(new ScheduledFormSubmission(submission, lockBackForwardList, duringLoad))); 335 } 336 337 void NavigationScheduler::scheduleRefresh() 329 338 { 330 339 if (!m_frame->page()) … … 334 343 return; 335 344 336 schedule(adoptPtr(new ScheduledRefresh(url.string(), m_frame->loader()->outgoingReferrer() , wasUserGesture)));345 schedule(adoptPtr(new ScheduledRefresh(url.string(), m_frame->loader()->outgoingReferrer()))); 337 346 } 338 347 … … 351 360 352 361 // In all other cases, schedule the history traversal to occur asynchronously. 353 schedule(adoptPtr(new ScheduledHistoryNavigation(steps , m_frame->loader()->isProcessingUserGesture())));362 schedule(adoptPtr(new ScheduledHistoryNavigation(steps))); 354 363 } 355 364 -
trunk/WebCore/loader/NavigationScheduler.h
r69039 r69938 57 57 58 58 void scheduleRedirect(double delay, const String& url); 59 void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true , bool userGesture = false);59 void scheduleLocationChange(const String& url, const String& referrer, bool lockHistory = true, bool lockBackForwardList = true); 60 60 void scheduleFormSubmission(PassRefPtr<FormSubmission>); 61 void scheduleRefresh( bool userGesture = false);61 void scheduleRefresh(); 62 62 void scheduleHistoryNavigation(int steps); 63 63 … … 71 71 void schedule(PassOwnPtr<ScheduledNavigation>); 72 72 73 static bool mustLockBackForwardList(Frame* targetFrame , bool mustLockIfDuringLoad);73 static bool mustLockBackForwardList(Frame* targetFrame); 74 74 75 75 Frame* m_frame; -
trunk/WebCore/loader/SubframeLoader.cpp
r69039 r69938 240 240 Frame* frame = ownerElement->contentFrame(); 241 241 if (frame) 242 frame->navigationScheduler()->scheduleLocationChange(url.string(), m_frame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList , m_frame->loader()->isProcessingUserGesture());242 frame->navigationScheduler()->scheduleLocationChange(url.string(), m_frame->loader()->outgoingReferrer(), lockHistory, lockBackForwardList); 243 243 else 244 244 frame = loadSubframe(ownerElement, url, frameName, m_frame->loader()->outgoingReferrer());
Note: See TracChangeset
for help on using the changeset viewer.