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

Unified Diff: third_party/WebKit/Source/core/loader/FrameLoader.cpp

Issue 2408333004: Move persistent gesture state to Document, add DocumentUserGestureToken (Closed)
Patch Set: Switch back to checkign context->isDocument() Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/FrameLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index 65e9ac9a3c572fea1623484eeae2493b80234854..28e87e4d6ca9295916d66e6e9622a2914a1c3b64 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -393,10 +393,6 @@ void FrameLoader::setHistoryItemStateForCommit(
FrameLoadType loadType,
HistoryCommitType historyCommitType,
HistoryNavigationType navigationType) {
- if (m_frame->settings()->historyEntryRequiresUserGesture() &&
- historyCommitType == StandardCommit)
- UserGestureIndicator::clearProcessedUserGestureSinceLoad();
-
HistoryItem* oldItem = m_currentItem;
if (isBackForwardLoadType(loadType) && m_provisionalItem)
m_currentItem = m_provisionalItem.release();
@@ -789,10 +785,12 @@ void FrameLoader::updateForSameDocumentNavigation(
HistoryCommitType historyCommitType = loadTypeToCommitType(type);
if (!m_currentItem)
historyCommitType = HistoryInertCommit;
- if (m_frame->settings()->historyEntryRequiresUserGesture() &&
- !UserGestureIndicator::processedUserGestureSinceLoad() &&
- initiatingDocument)
- historyCommitType = HistoryInertCommit;
+ if (m_frame->settings()->historyEntryRequiresUserGesture()) {
+ if (initiatingDocument && !initiatingDocument->hasReceivedUserGesture())
+ historyCommitType = HistoryInertCommit;
+ else if (historyCommitType == StandardCommit)
+ m_frame->document()->clearHasReceivedUserGesture();
+ }
setHistoryItemStateForCommit(
type, historyCommitType,
@@ -937,8 +935,8 @@ FrameLoadType FrameLoader::determineFrameLoadType(
return FrameLoadTypeReload;
if (m_frame->settings()->historyEntryRequiresUserGesture() &&
- !UserGestureIndicator::processedUserGestureSinceLoad() &&
- request.originDocument())
+ request.originDocument() &&
+ !request.originDocument()->hasReceivedUserGesture())
return FrameLoadTypeReplaceCurrentItem;
return FrameLoadTypeStandard;

Powered by Google App Engine
This is Rietveld 408576698