Changeset 214900 in webkit


Ignore:
Timestamp:
Apr 4, 2017 2:32:15 PM (7 years ago)
Author:
Simon Fraser
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):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r214897 r214900  
     12017-04-04  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Change Document's lastHandledUserGestureTimestamp to be a MonotonicTime
     4        https://bugs.webkit.org/show_bug.cgi?id=170468
     5
     6        Reviewed by Zalan Bujtas.
     7       
     8        Change the double to MonotonicTime. No behavior change.
     9
     10        * dom/Document.cpp:
     11        (WebCore::Document::updateLastHandledUserGestureTimestamp):
     12        * dom/Document.h:
     13        (WebCore::Document::lastHandledUserGestureTimestamp):
     14        * html/HTMLPlugInImageElement.cpp:
     15        (WebCore::documentHadRecentUserGesture):
     16        * loader/FrameLoader.cpp:
     17        (WebCore::shouldAskForNavigationConfirmation):
     18
    1192017-04-04  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebCore/dom/Document.cpp

    r214721 r214900  
    63116311void Document::updateLastHandledUserGestureTimestamp()
    63126312{
    6313     m_lastHandledUserGestureTimestamp = monotonicallyIncreasingTime();
     6313    m_lastHandledUserGestureTimestamp = MonotonicTime::now();
    63146314    ResourceLoadObserver::sharedObserver().logUserInteractionWithReducedTimeResolution(*this);
    63156315}
  • trunk/Source/WebCore/dom/Document.h

    r214721 r214900  
    11441144    void didRemoveWheelEventHandler(Node&, EventHandlerRemoval = EventHandlerRemoval::One);
    11451145
    1146     double lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
     1146    MonotonicTime lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
    11471147    void updateLastHandledUserGestureTimestamp();
    11481148
     
    15731573    std::unique_ptr<EventTargetSet> m_wheelEventTargets;
    15741574
    1575     double m_lastHandledUserGestureTimestamp { 0 };
     1575    MonotonicTime m_lastHandledUserGestureTimestamp;
    15761576
    15771577    void clearScriptedAnimationController();
  • trunk/Source/WebCore/html/HTMLPlugInImageElement.cpp

    r211591 r214900  
    5353static const int sizingTinyDimensionThreshold = 40;
    5454static const float sizingFullPageAreaRatioThreshold = 0.96;
    55 static const float autostartSoonAfterUserGestureThreshold = 5.0;
     55static const Seconds autostartSoonAfterUserGestureThreshold = 5_s;
    5656
    5757// This delay should not exceed the snapshot delay in PluginView.cpp
     
    500500static bool documentHadRecentUserGesture(Document& document)
    501501{
    502     double lastKnownUserGestureTimestamp = document.lastHandledUserGestureTimestamp();
     502    MonotonicTime lastKnownUserGestureTimestamp = document.lastHandledUserGestureTimestamp();
    503503    if (document.frame() != &document.page()->mainFrame() && document.page()->mainFrame().document())
    504504        lastKnownUserGestureTimestamp = std::max(lastKnownUserGestureTimestamp, document.page()->mainFrame().document()->lastHandledUserGestureTimestamp());
    505505
    506     return monotonicallyIncreasingTime() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold;
     506    return MonotonicTime::now() - lastKnownUserGestureTimestamp < autostartSoonAfterUserGestureThreshold;
    507507}
    508508
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r214392 r214900  
    30373037static bool shouldAskForNavigationConfirmation(Document& document, const BeforeUnloadEvent& event)
    30383038{
    3039     bool userDidInteractWithPage = document.topDocument().lastHandledUserGestureTimestamp() > 0;
     3039    bool userDidInteractWithPage = static_cast<bool>(document.topDocument().lastHandledUserGestureTimestamp());
    30403040    // Web pages can request we ask for confirmation before navigating by:
    30413041    // - Cancelling the BeforeUnloadEvent (modern way)
Note: See TracChangeset for help on using the changeset viewer.