| 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 GarbageCollectedFinalized<ScheduledNavigation
> { | 59 class ScheduledNavigation : public GarbageCollectedFinalized<ScheduledNavigation
> { |
| 60 WTF_MAKE_NONCOPYABLE(ScheduledNavigation); | 60 WTF_MAKE_NONCOPYABLE(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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 299 |
| 300 // We want a new back/forward list item if the refresh timeout is > 1 second
. | 300 // We want a new back/forward list item if the refresh timeout is > 1 second
. |
| 301 if (!m_redirect || delay <= m_redirect->delay()) | 301 if (!m_redirect || delay <= m_redirect->delay()) |
| 302 schedule(ScheduledRedirect::create(delay, m_frame->document(), url, dela
y <= 1)); | 302 schedule(ScheduledRedirect::create(delay, m_frame->document(), url, dela
y <= 1)); |
| 303 } | 303 } |
| 304 | 304 |
| 305 bool NavigationScheduler::mustReplaceCurrentItem(LocalFrame* targetFrame) | 305 bool NavigationScheduler::mustReplaceCurrentItem(LocalFrame* targetFrame) |
| 306 { | 306 { |
| 307 // Non-user navigation before the page has finished firing onload should not
create a new back/forward item. | 307 // Non-user navigation before the page has finished firing onload should not
create a new back/forward item. |
| 308 // See https://webkit.org/b/42861 for the original motivation for this. | 308 // See https://webkit.org/b/42861 for the original motivation for this. |
| 309 if (!UserGestureIndicator::processingUserGesture() && !targetFrame->document
()->loadEventFinished()) | 309 if (!targetFrame->document()->loadEventFinished() && !UserGestureIndicator::
processingUserGesture()) |
| 310 return true; | 310 return true; |
| 311 | 311 |
| 312 // Navigation of a subframe during loading of an ancestor frame does not cre
ate a new back/forward item. | 312 // Navigation of a subframe during loading of an ancestor frame does not cre
ate a new back/forward item. |
| 313 // The definition of "during load" is any time before all handlers for the l
oad event have been run. | 313 // The definition of "during load" is any time before all handlers for the l
oad event have been run. |
| 314 // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motiva
tion for this. | 314 // See https://bugs.webkit.org/show_bug.cgi?id=14957 for the original motiva
tion for this. |
| 315 Frame* parentFrame = targetFrame->tree().parent(); | 315 Frame* parentFrame = targetFrame->tree().parent(); |
| 316 return parentFrame && parentFrame->isLocalFrame() && !toLocalFrame(parentFra
me)->loader().allAncestorsAreComplete(); | 316 return parentFrame && parentFrame->isLocalFrame() && !toLocalFrame(parentFra
me)->loader().allAncestorsAreComplete(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 void NavigationScheduler::scheduleLocationChange(Document* originDocument, const
String& url, bool replacesCurrentItem) | 319 void NavigationScheduler::scheduleLocationChange(Document* originDocument, const
String& url, bool replacesCurrentItem) |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 m_redirect.clear(); | 431 m_redirect.clear(); |
| 432 } | 432 } |
| 433 | 433 |
| 434 DEFINE_TRACE(NavigationScheduler) | 434 DEFINE_TRACE(NavigationScheduler) |
| 435 { | 435 { |
| 436 visitor->trace(m_frame); | 436 visitor->trace(m_frame); |
| 437 visitor->trace(m_redirect); | 437 visitor->trace(m_redirect); |
| 438 } | 438 } |
| 439 | 439 |
| 440 } // namespace blink | 440 } // namespace blink |
| OLD | NEW |