Title: [214900] trunk/Source/WebCore
- Revision
- 214900
- Author
- [email protected]
- Date
- 2017-04-04 14:32:15 -0700 (Tue, 04 Apr 2017)
Log Message
Change Document's lastHandledUserGestureTimestamp to be a MonotonicTime
https://bugs.webkit.org/show_bug.cgi?id=170468
Reviewed by Zalan Bujtas.
Change the double to MonotonicTime. No behavior change.
* dom/Document.cpp:
(WebCore::Document::updateLastHandledUserGestureTimestamp):
* dom/Document.h:
(WebCore::Document::lastHandledUserGestureTimestamp):
* html/HTMLPlugInImageElement.cpp:
(WebCore::documentHadRecentUserGesture):
* loader/FrameLoader.cpp:
(WebCore::shouldAskForNavigationConfirmation):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (214899 => 214900)
--- trunk/Source/WebCore/ChangeLog 2017-04-04 21:30:29 UTC (rev 214899)
+++ trunk/Source/WebCore/ChangeLog 2017-04-04 21:32:15 UTC (rev 214900)
@@ -1,3 +1,21 @@
+2017-04-04 Simon Fraser <[email protected]>
+
+ Change Document's lastHandledUserGestureTimestamp to be a MonotonicTime
+ https://bugs.webkit.org/show_bug.cgi?id=170468
+
+ Reviewed by Zalan Bujtas.
+
+ Change the double to MonotonicTime. No behavior change.
+
+ * dom/Document.cpp:
+ (WebCore::Document::updateLastHandledUserGestureTimestamp):
+ * dom/Document.h:
+ (WebCore::Document::lastHandledUserGestureTimestamp):
+ * html/HTMLPlugInImageElement.cpp:
+ (WebCore::documentHadRecentUserGesture):
+ * loader/FrameLoader.cpp:
+ (WebCore::shouldAskForNavigationConfirmation):
+
2017-04-04 Youenn Fablet <[email protected]>
[Debug] ASSERT(!throwScope.exception()) on imported/w3c/web-platform-tests/fetch/api/cors/cors-preflight-status-worker.html
Modified: trunk/Source/WebCore/dom/Document.cpp (214899 => 214900)
--- trunk/Source/WebCore/dom/Document.cpp 2017-04-04 21:30:29 UTC (rev 214899)
+++ trunk/Source/WebCore/dom/Document.cpp 2017-04-04 21:32:15 UTC (rev 214900)
@@ -6310,7 +6310,7 @@
void Document::updateLastHandledUserGestureTimestamp()
{
- m_lastHandledUserGestureTimestamp = monotonicallyIncreasingTime();
+ m_lastHandledUserGestureTimestamp = MonotonicTime::now();
ResourceLoadObserver::sharedObserver().logUserInteractionWithReducedTimeResolution(*this);
}
Modified: trunk/Source/WebCore/dom/Document.h (214899 => 214900)
--- trunk/Source/WebCore/dom/Document.h 2017-04-04 21:30:29 UTC (rev 214899)
+++ trunk/Source/WebCore/dom/Document.h 2017-04-04 21:32:15 UTC (rev 214900)
@@ -1143,7 +1143,7 @@
void didAddWheelEventHandler(Node&);
void didRemoveWheelEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One);
- double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
+ MonotonicTime lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
void updateLastHandledUserGestureTimestamp();
// Used for testing. Count handlers in the main document, and one per frame which contains handlers.
@@ -1572,7 +1572,7 @@
#endif
std::unique_ptr<EventTargetSet> m_wheelEventTargets;
- double m_lastHandledUserGestureTimestamp { 0 };
+ MonotonicTime m_lastHandledUserGestureTimestamp;
void clearScriptedAnimationController();
RefPtr<ScriptedAnimationController> m_scriptedAnimationController;
Modified: trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp (214899 => 214900)
--- trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2017-04-04 21:30:29 UTC (rev 214899)
+++ trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp 2017-04-04 21:32:15 UTC (rev 214900)
@@ -52,7 +52,7 @@
static const int sizingTinyDimensionThreshold = 40;
static const float sizingFullPageAreaRatioThreshold = 0.96;
-static const float autostartSoonAfterUserGestureThreshold = 5.0;
+static const Seconds autostartSoonAfterUserGestureThreshold = 5_s;
// This delay should not exceed the snapshot delay in PluginView.cpp
static const auto simulatedMouseClickTimerDelay = std::chrono::milliseconds { 750 };
@@ -499,11 +499,11 @@
static bool documentHadRecentUserGesture(Document& document)
{
- double lastKnownUserGestureTimestamp = document.lastHandledUserGestureTimestamp();
+ MonotonicTime lastKnownUserGestureTimestamp = document.lastHandledUserGestureTimestamp();
if (document.frame() != &document.page()->mainFrame() && document.page()->mainFrame().document())
lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp, document.page()->mainFrame().document()->lastHandledUserGestureTimestamp());
- return monotonicallyIncreasingTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold;
+ return MonotonicTime::now() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold;
}
void HTMLPlugInImageElement::checkSizeChangeForSnapshotting()
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (214899 => 214900)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2017-04-04 21:30:29 UTC (rev 214899)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2017-04-04 21:32:15 UTC (rev 214900)
@@ -3036,7 +3036,7 @@
static bool shouldAskForNavigationConfirmation(Document& document, const BeforeUnloadEvent& event)
{
- bool userDidInteractWithPage = document.topDocument().lastHandledUserGestureTimestamp() > 0;
+ bool userDidInteractWithPage = static_cast<bool>(document.topDocument().lastHandledUserGestureTimestamp());
// Web pages can request we ask for confirmation before navigating by:
// - Cancelling the BeforeUnloadEvent (modern way)
// - Setting the returnValue attribute on the BeforeUnloadEvent to a non-empty string.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes