| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 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) 2009 Adam Barth. All rights reserved. | 5 * Copyright (C) 2009 Adam Barth. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0; | 57 unsigned NavigationDisablerForBeforeUnload::s_navigationDisableCount = 0; |
| 58 | 58 |
| 59 class ScheduledNavigation : public NoBaseWillBeGarbageCollectedFinalized<Schedul
edNavigation> { | 59 class ScheduledNavigation : public NoBaseWillBeGarbageCollectedFinalized<Schedul
edNavigation> { |
| 60 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); USING_FAST_MALLOC_WILL_BE_REMOVED
(ScheduledNavigation); | 60 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); USING_FAST_MALLOC_WILL_BE_REMOVED
(ScheduledNavigation); |
| 61 public: | 61 public: |
| 62 ScheduledNavigation(double delay, Document* originDocument, bool replacesCur
rentItem, bool isLocationChange) | 62 ScheduledNavigation(double delay, Document* originDocument, bool replacesCur
rentItem, bool isLocationChange) |
| 63 : m_delay(delay) | 63 : m_delay(delay) |
| 64 , m_originDocument(originDocument) | 64 , m_originDocument(originDocument) |
| 65 , m_replacesCurrentItem(replacesCurrentItem) | 65 , m_replacesCurrentItem(replacesCurrentItem) |
| 66 , m_isLocationChange(isLocationChange) | 66 , m_isLocationChange(isLocationChange) |
| 67 , m_wasUserGesture(UserGestureIndicator::processingUserGesture()) | 67 , m_wasUserGesture(UserGestureIndicator::processingUserGestureUntracked(
)) |
| 68 { | 68 { |
| 69 if (m_wasUserGesture) | 69 if (m_wasUserGesture) |
| 70 m_userGestureToken = UserGestureIndicator::currentToken(); | 70 m_userGestureToken = UserGestureIndicator::currentToken(); |
| 71 } | 71 } |
| 72 virtual ~ScheduledNavigation() { } | 72 virtual ~ScheduledNavigation() { } |
| 73 | 73 |
| 74 virtual void fire(LocalFrame*) = 0; | 74 virtual void fire(LocalFrame*) = 0; |
| 75 | 75 |
| 76 virtual bool shouldStartTimer(LocalFrame*) { return true; } | 76 virtual bool shouldStartTimer(LocalFrame*) { return true; } |
| 77 | 77 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 300 |
| 301 // We want a new back/forward list item if the refresh timeout is > 1 second
. | 301 // We want a new back/forward list item if the refresh timeout is > 1 second
. |
| 302 if (!m_redirect || delay <= m_redirect->delay()) | 302 if (!m_redirect || delay <= m_redirect->delay()) |
| 303 schedule(ScheduledRedirect::create(delay, m_frame->document(), url, dela
y <= 1)); | 303 schedule(ScheduledRedirect::create(delay, m_frame->document(), url, dela
y <= 1)); |
| 304 } | 304 } |
| 305 | 305 |
| 306 bool NavigationScheduler::mustReplaceCurrentItem(LocalFrame* targetFrame) | 306 bool NavigationScheduler::mustReplaceCurrentItem(LocalFrame* targetFrame) |
| 307 { | 307 { |
| 308 // Non-user navigation before the page has finished firing onload should not
create a new back/forward item. | 308 // Non-user navigation before the page has finished firing onload should not
create a new back/forward item. |
| 309 // See https://webkit.org/b/42861 for the original motivation for this. | 309 // See https://webkit.org/b/42861 for the original motivation for this. |
| 310 if (!UserGestureIndicator::processingUserGesture() && !targetFrame->document
()->loadEventFinished()) | 310 if (!targetFrame->document()->loadEventFinished() && !UserGestureIndicator::
processingUserGesture()) |
| 311 return true; | 311 return true; |
| 312 | 312 |
| 313 // Navigation of a subframe during loading of an ancestor frame does not cre
ate a new back/forward item. | 313 // Navigation of a subframe during loading of an ancestor frame does not cre
ate a new back/forward item. |
| 314 // The definition of "during load" is any time before all handlers for the l
oad event have been run. | 314 // The definition of "during load" is any time before all handlers for the l
oad event have been run. |
| 315 // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motiva
tion for this. | 315 // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motiva
tion for this. |
| 316 Frame* parentFrame = targetFrame->tree().parent(); | 316 Frame* parentFrame = targetFrame->tree().parent(); |
| 317 return parentFrame && parentFrame->isLocalFrame() && !toLocalFrame(parentFra
me)->loader().allAncestorsAreComplete(); | 317 return parentFrame && parentFrame->isLocalFrame() && !toLocalFrame(parentFra
me)->loader().allAncestorsAreComplete(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 void NavigationScheduler::scheduleLocationChange(Document* originDocument, const
String& url, bool replacesCurrentItem) | 320 void NavigationScheduler::scheduleLocationChange(Document* originDocument, const
String& url, bool replacesCurrentItem) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 m_redirect.clear(); | 432 m_redirect.clear(); |
| 433 } | 433 } |
| 434 | 434 |
| 435 DEFINE_TRACE(NavigationScheduler) | 435 DEFINE_TRACE(NavigationScheduler) |
| 436 { | 436 { |
| 437 visitor->trace(m_frame); | 437 visitor->trace(m_frame); |
| 438 visitor->trace(m_redirect); | 438 visitor->trace(m_redirect); |
| 439 } | 439 } |
| 440 | 440 |
| 441 } // namespace blink | 441 } // namespace blink |
| OLD | NEW |