Changeset 214982 in webkit


Ignore:
Timestamp:
Apr 5, 2017, 5:55:14 PM (9 years ago)
Author:
Simon Fraser
Message:

Set lastHandledUserGestureTimestamp on all ancestor documents, not just the top document
https://bugs.webkit.org/show_bug.cgi?id=170479

Reviewed by Sam Weinig.

Source/WebCore:

When interacting with a subframe document, set lastHandledUserGestureTimestamp on all ancestor
documents up to the root.

This will be used in future for requestAnimationFrame throttling.

Test: fast/frames/user-gesture-timestamp-propagation.html

  • dom/Document.cpp:

(WebCore::Document::updateLastHandledUserGestureTimestamp):

  • dom/Document.h:
  • dom/UserGestureIndicator.cpp:

(WebCore::UserGestureIndicator::UserGestureIndicator):

  • testing/Internals.cpp:

(WebCore::Internals::lastHandledUserGestureTimestamp):

  • testing/Internals.h:
  • testing/Internals.idl:

LayoutTests:

  • fast/frames/user-gesture-timestamp-propagation-expected.txt: Added.
  • fast/frames/user-gesture-timestamp-propagation.html: Added.
Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r214976 r214982  
     12017-04-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Set lastHandledUserGestureTimestamp on all ancestor documents, not just the top document
     4        https://bugs.webkit.org/show_bug.cgi?id=170479
     5
     6        Reviewed by Sam Weinig.
     7
     8        * fast/frames/user-gesture-timestamp-propagation-expected.txt: Added.
     9        * fast/frames/user-gesture-timestamp-propagation.html: Added.
     10        * platform/ios/TestExpectations:
     11
    1122017-04-05  Eric Carlson  <eric.carlson@apple.com>
    213
  • trunk/LayoutTests/platform/ios/TestExpectations

    r214955 r214982  
    380380media/audio-dealloc-crash.html [ Skip ]
    381381
    382 # This test uses EventSender's mouseMoveTo, mouseUp and mouseDown
     382# Tests that use EventSender's mouseMoveTo, mouseUp and mouseDown
    383383fast/forms/range/disabled-while-dragging.html [ Skip ]
    384384fast/forms/range/range-drag-when-toggled-disabled.html [ Skip ]
    385 fast/media/video-element-in-details-collapse.html [ Skip ]
     385fast/frames/user-gesture-timestamp-propagation.html [ Failure ]
    386386
    387387# The file-wrapper part of <attachment> is not yet working on iOS
  • trunk/Source/WebCore/ChangeLog

    r214980 r214982  
     12017-04-05  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Set lastHandledUserGestureTimestamp on all ancestor documents, not just the top document
     4        https://bugs.webkit.org/show_bug.cgi?id=170479
     5
     6        Reviewed by Sam Weinig.
     7
     8        When interacting with a subframe document, set lastHandledUserGestureTimestamp on all ancestor
     9        documents up to the root.
     10
     11        This will be used in future for requestAnimationFrame throttling.
     12
     13        Test: fast/frames/user-gesture-timestamp-propagation.html
     14
     15        * dom/Document.cpp:
     16        (WebCore::Document::updateLastHandledUserGestureTimestamp):
     17        * dom/Document.h:
     18        * dom/UserGestureIndicator.cpp:
     19        (WebCore::UserGestureIndicator::UserGestureIndicator):
     20        * testing/Internals.cpp:
     21        (WebCore::Internals::lastHandledUserGestureTimestamp):
     22        * testing/Internals.h:
     23        * testing/Internals.idl:
     24
    1252017-04-05  Eric Carlson  <eric.carlson@apple.com>
    226
  • trunk/Source/WebCore/dom/Document.cpp

    r214976 r214982  
    143143#include "RenderWidget.h"
    144144#include "RequestAnimationFrameCallback.h"
    145 #include "ResourceLoadObserver.h"
    146145#include "RuntimeEnabledFeatures.h"
    147146#include "SVGDocumentExtensions.h"
     
    63146313}
    63156314
    6316 void Document::updateLastHandledUserGestureTimestamp()
    6317 {
    6318     m_lastHandledUserGestureTimestamp = MonotonicTime::now();
    6319     ResourceLoadObserver::sharedObserver().logUserInteractionWithReducedTimeResolution(*this);
     6315void Document::updateLastHandledUserGestureTimestamp(MonotonicTime time)
     6316{
     6317    m_lastHandledUserGestureTimestamp = time;
     6318   
     6319    if (HTMLFrameOwnerElement* element = ownerElement())
     6320        element->document().updateLastHandledUserGestureTimestamp(time);
    63206321}
    63216322
  • trunk/Source/WebCore/dom/Document.h

    r214900 r214982  
    11451145
    11461146    MonotonicTime lastHandledUserGestureTimestamp() const { return m_lastHandledUserGestureTimestamp; }
    1147     void updateLastHandledUserGestureTimestamp();
     1147    void updateLastHandledUserGestureTimestamp(MonotonicTime);
    11481148
    11491149    // Used for testing. Count handlers in the main document, and one per frame which contains handlers.
  • trunk/Source/WebCore/dom/UserGestureIndicator.cpp

    r208985 r214982  
    2828
    2929#include "Document.h"
     30#include "ResourceLoadObserver.h"
    3031#include <wtf/MainThread.h>
    3132#include <wtf/NeverDestroyed.h>
     
    5556        currentToken() = UserGestureToken::create(state.value());
    5657
    57     if (document && currentToken()->processingUserGesture())
    58         document->topDocument().updateLastHandledUserGestureTimestamp();
     58    if (document && currentToken()->processingUserGesture()) {
     59        document->updateLastHandledUserGestureTimestamp(MonotonicTime::now());
     60        ResourceLoadObserver::sharedObserver().logUserInteractionWithReducedTimeResolution(*document);
     61    }
    5962}
    6063
  • trunk/Source/WebCore/testing/Internals.cpp

    r214976 r214982  
    37743774}
    37753775
     3776double Internals::lastHandledUserGestureTimestamp()
     3777{
     3778    Document* document = contextDocument();
     3779    if (!document)
     3780        return 0;
     3781
     3782    return document->lastHandledUserGestureTimestamp().secondsSinceEpoch().value();
     3783}
     3784
    37763785RefPtr<GCObservation> Internals::observeGC(JSC::JSValue value)
    37773786{
  • trunk/Source/WebCore/testing/Internals.h

    r214913 r214982  
    533533   
    534534    bool isProcessingUserGesture();
     535    double lastHandledUserGestureTimestamp();
    535536
    536537    RefPtr<GCObservation> observeGC(JSC::JSValue);
  • trunk/Source/WebCore/testing/Internals.idl

    r214913 r214982  
    502502
    503503    boolean isProcessingUserGesture();
     504    double lastHandledUserGestureTimestamp();
    504505
    505506    GCObservation? observeGC(any observed);
Note: See TracChangeset for help on using the changeset viewer.