Changeset 245366 in webkit


Ignore:
Timestamp:
May 15, 2019 3:42:00 PM (5 years ago)
Author:
Devin Rousso
Message:

Web Inspector: user gesture toggle should also force user interaction flag
https://bugs.webkit.org/show_bug.cgi?id=197269

Reviewed by Joseph Pecoraro.

Source/WebCore:

Test: inspector/runtime/evaluate-userGestureEmulation-userIsInteracting.html

  • inspector/agents/page/PageRuntimeAgent.cpp:

(WebCore::PageRuntimeAgent::evaluate):

  • page/ChromeClient.h:

(WebCore::ChromeClient::userIsInteracting const): Added.
(WebCore::ChromeClient::setUserIsInteracting): Added.

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

(WebCore::Internals::userIsInteracting): Added.

Source/WebKit:

  • WebProcess/WebCoreSupport/WebChromeClient.h:
  • WebProcess/WebCoreSupport/WebChromeClient.cpp:

(WebKit::WebChromeClient::userIsInteracting const): Added.
(WebKit::WebChromeClient::setUserIsInteracting): Added.

  • WebProcess/WebPage/WebPage.h:

(WebKit::WebPage::userIsInteracting const): Added.
(WebKit::WebPage::setUserIsInteracting): Added.

LayoutTests:

  • inspector/runtime/evaluate-userGestureEmulation-userIsInteracting.html: Added.
  • inspector/runtime/evaluate-userGestureEmulation-userIsInteracting-expected.txt: Added.

Only enable the above test on WK2, as the user interaction state is only supported by WK2.

Location:
trunk
Files:
2 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r245363 r245366  
     12019-05-15  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: user gesture toggle should also force user interaction flag
     4        https://bugs.webkit.org/show_bug.cgi?id=197269
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * inspector/runtime/evaluate-userGestureEmulation-userIsInteracting.html: Added.
     9        * inspector/runtime/evaluate-userGestureEmulation-userIsInteracting-expected.txt: Added.
     10
     11        * TestExpectations:
     12        * platform/wk2/TestExpectations:
     13        Only enable the above test on WK2, as the user interaction state is only supported by WK2.
     14
    1152019-05-15  Devin Rousso  <drousso@apple.com>
    216
  • trunk/LayoutTests/TestExpectations

    r245362 r245366  
    543543# Debugger stepping tests can timeout if they run slowly due to a short timer scheduled in the frontend.
    544544webkit.org/b/161951 [ Debug ] inspector/debugger/paused-scopes.html [ Skip ]
     545
     546# User interaction is a WK2 concept.
     547inspector/runtime/evaluate-userGestureEmulation-userIsInteracting.html [ Skip ]
    545548
    546549# These conformance tests are no longer in sync with the latest specification
  • trunk/LayoutTests/platform/wk2/TestExpectations

    r245013 r245366  
    502502# First two lines are reversed when test is flaky.
    503503fast/preloader/document-write-2.html [ Pass Failure ]
     504
     505# User interaction is a WK2 concept.
     506inspector/runtime/evaluate-userGestureEmulation-userIsInteracting.html [ Skip ]
    504507
    505508### END OF (3) Unclassified failures
  • trunk/Source/WebCore/ChangeLog

    r245361 r245366  
     12019-05-15  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: user gesture toggle should also force user interaction flag
     4        https://bugs.webkit.org/show_bug.cgi?id=197269
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        Test: inspector/runtime/evaluate-userGestureEmulation-userIsInteracting.html
     9
     10        * inspector/agents/page/PageRuntimeAgent.cpp:
     11        (WebCore::PageRuntimeAgent::evaluate):
     12
     13        * page/ChromeClient.h:
     14        (WebCore::ChromeClient::userIsInteracting const): Added.
     15        (WebCore::ChromeClient::setUserIsInteracting): Added.
     16
     17        * testing/Internals.idl:
     18        * testing/Internals.h:
     19        * testing/Internals.cpp:
     20        (WebCore::Internals::userIsInteracting): Added.
     21
    1222019-05-15  Zalan Bujtas  <zalan@apple.com>
    223
  • trunk/Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp

    r243243 r245366  
    3333#include "PageRuntimeAgent.h"
    3434
     35#include "Chrome.h"
     36#include "ChromeClient.h"
    3537#include "Document.h"
    3638#include "Frame.h"
     
    162164void PageRuntimeAgent::evaluate(ErrorString& errorString, const String& expression, const String* objectGroup, const bool* includeCommandLineAPI, const bool* doNotPauseOnExceptionsAndMuteConsole, const int* executionContextId, const bool* returnByValue, const bool* generatePreview, const bool* saveResult, const bool* emulateUserGesture, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result, Optional<bool>& wasThrown, Optional<int>& savedResultIndex)
    163165{
    164     Optional<ProcessingUserGestureState> userGestureState = (emulateUserGesture && *emulateUserGesture) ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt;
     166    auto& pageChromeClient = m_inspectedPage.chrome().client();
     167
     168    auto shouldEmulateUserGesture = emulateUserGesture && *emulateUserGesture;
     169
     170    Optional<ProcessingUserGestureState> userGestureState = shouldEmulateUserGesture ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt;
    165171    UserGestureIndicator gestureIndicator(userGestureState);
     172
     173    bool userWasInteracting = false;
     174    if (shouldEmulateUserGesture) {
     175        userWasInteracting = pageChromeClient.userIsInteracting();
     176        if (!userWasInteracting)
     177            pageChromeClient.setUserIsInteracting(true);
     178    }
     179
    166180    InspectorRuntimeAgent::evaluate(errorString, expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptionsAndMuteConsole, executionContextId, returnByValue, generatePreview, saveResult, emulateUserGesture, result, wasThrown, savedResultIndex);
     181
     182    if (shouldEmulateUserGesture && !userWasInteracting && pageChromeClient.userIsInteracting())
     183        pageChromeClient.setUserIsInteracting(false);
    167184}
    168185
  • trunk/Source/WebCore/page/ChromeClient.h

    r245174 r245366  
    508508    virtual void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel) { }
    509509
     510    virtual bool userIsInteracting() const { return false; }
     511    virtual void setUserIsInteracting(bool) { }
     512
    510513protected:
    511514    virtual ~ChromeClient() = default;
  • trunk/Source/WebCore/testing/Internals.cpp

    r245288 r245366  
    4848#include "CertificateInfo.h"
    4949#include "Chrome.h"
     50#include "ChromeClient.h"
    5051#include "ClientOrigin.h"
    5152#include "ComposedTreeIterator.h"
     
    44244425}
    44254426
     4427bool Internals::userIsInteracting()
     4428{
     4429    if (auto* document = contextDocument()) {
     4430        if (auto* page = document->page())
     4431            return page->chrome().client().userIsInteracting();
     4432    }
     4433    return false;
     4434}
     4435
    44264436double Internals::lastHandledUserGestureTimestamp()
    44274437{
  • trunk/Source/WebCore/testing/Internals.h

    r245280 r245366  
    656656    void withUserGesture(RefPtr<VoidCallback>&&);
    657657
     658    bool userIsInteracting();
     659
    658660    RefPtr<GCObservation> observeGC(JSC::JSValue);
    659661
  • trunk/Source/WebCore/testing/Internals.idl

    r245280 r245366  
    639639    void withUserGesture(VoidCallback callback);
    640640
     641    boolean userIsInteracting();
     642
    641643    GCObservation? observeGC(any observed);
    642644
  • trunk/Source/WebKit/ChangeLog

    r245360 r245366  
     12019-05-15  Devin Rousso  <drousso@apple.com>
     2
     3        Web Inspector: user gesture toggle should also force user interaction flag
     4        https://bugs.webkit.org/show_bug.cgi?id=197269
     5
     6        Reviewed by Joseph Pecoraro.
     7
     8        * WebProcess/WebCoreSupport/WebChromeClient.h:
     9        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
     10        (WebKit::WebChromeClient::userIsInteracting const): Added.
     11        (WebKit::WebChromeClient::setUserIsInteracting): Added.
     12
     13        * WebProcess/WebPage/WebPage.h:
     14        (WebKit::WebPage::userIsInteracting const): Added.
     15        (WebKit::WebPage::setUserIsInteracting): Added.
     16
    1172019-05-15  Brent Fulgham  <bfulgham@apple.com>
    218
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

    r245174 r245366  
    13411341}
    13421342
     1343bool WebChromeClient::userIsInteracting() const
     1344{
     1345    return m_page.userIsInteracting();
     1346}
     1347
     1348void WebChromeClient::setUserIsInteracting(bool userIsInteracting)
     1349{
     1350    m_page.setUserIsInteracting(userIsInteracting);
     1351}
     1352
    13431353} // namespace WebKit
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h

    r245174 r245366  
    380380    void configureLoggingChannel(const String&, WTFLogChannelState, WTFLogLevel) final;
    381381
     382    bool userIsInteracting() const final;
     383    void setUserIsInteracting(bool) final;
     384
    382385    String m_cachedToolTip;
    383386    mutable RefPtr<WebFrame> m_cachedFrameSetLargestFrame;
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r245335 r245366  
    11941194    bool isThrottleable() const;
    11951195
     1196    bool userIsInteracting() const { return m_userIsInteracting; }
     1197    void setUserIsInteracting(bool userIsInteracting) { m_userIsInteracting = userIsInteracting; }
     1198
    11961199private:
    11971200    WebPage(uint64_t pageID, WebPageCreationParameters&&);
Note: See TracChangeset for help on using the changeset viewer.