Changeset 213316 in webkit


Ignore:
Timestamp:
Mar 2, 2017 3:50:59 PM (7 years ago)
Author:
mrajca@apple.com
Message:

Media: send "did interfere with playback" events when the user pauses an autoplaying element
https://bugs.webkit.org/show_bug.cgi?id=169006

Reviewed by Alex Christensen.

Source/WebCore:

Added API tests.

  • html/HTMLMediaElement.cpp:

(WebCore::HTMLMediaElement::pauseInternal):

Tools:

  • TestWebKitAPI/Tests/WebKit2/js-play-with-controls.html:
  • TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:

(TEST): Added.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r213311 r213316  
     12017-02-28  Matt Rajca  <mrajca@apple.com>
     2
     3        Media: send "did interfere with playback" events when the user pauses an autoplaying element
     4        https://bugs.webkit.org/show_bug.cgi?id=169006
     5
     6        Reviewed by Alex Christensen.
     7
     8        Added API tests.
     9
     10        * html/HTMLMediaElement.cpp:
     11        (WebCore::HTMLMediaElement::pauseInternal):
     12
    1132017-03-02  Chris Dumez  <cdumez@apple.com>
    214
  • trunk/Source/WebCore/html/HTMLMediaElement.cpp

    r213246 r213316  
    32573257
    32583258    m_autoplaying = false;
     3259
     3260    if (ScriptController::processingUserGestureForMedia() && m_playbackWithoutUserGesture == PlaybackWithoutUserGesture::Started) {
     3261        if (Page* page = document().page())
     3262            page->chrome().client().handleAutoplayEvent(AutoplayEvent::UserDidInterfereWithPlayback);
     3263    }
     3264
    32593265    m_playbackWithoutUserGesture = PlaybackWithoutUserGesture::None;
    32603266
  • trunk/Tools/ChangeLog

    r213306 r213316  
     12017-02-28  Matt Rajca  <mrajca@apple.com>
     2
     3        Media: send "did interfere with playback" events when the user pauses an autoplaying element
     4        https://bugs.webkit.org/show_bug.cgi?id=169006
     5
     6        Reviewed by Alex Christensen.
     7
     8        * TestWebKitAPI/Tests/WebKit2/js-play-with-controls.html:
     9        * TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm:
     10        (TEST): Added.
     11
    1122017-03-02  Srinivasan Vijayaraghavan  <svijayaraghavan@apple.com>
    213
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/js-play-with-controls.html

    r213246 r213316  
    1010
    1111            function play() {
    12                 document.getElementById("video").play();
     12                var video = document.getElementById("video");
     13                if (video.paused)
     14                    video.play();
     15                else
     16                    video.pause();
    1317            }
    1418
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WebsitePolicies.mm

    r213246 r213316  
    391391    [webView mouseUpAtPoint:muteButtonClickPoint];
    392392    runUntilReceivesAutoplayEvent(kWKAutoplayEventUserDidInterfereWithPlayback);
     393
     394    receivedAutoplayEvent = std::nullopt;
     395    [webView loadRequest:jsPlayRequest];
     396    [webView waitForMessage:@"playing"];
     397    ASSERT_TRUE(receivedAutoplayEvent == std::nullopt);
     398
     399    const NSPoint playButtonClickPoint = NSMakePoint(20, 256);
     400    [webView mouseDownAtPoint:playButtonClickPoint simulatePressure:NO];
     401    [webView mouseUpAtPoint:playButtonClickPoint];
     402    runUntilReceivesAutoplayEvent(kWKAutoplayEventUserDidInterfereWithPlayback);
    393403}
    394404#endif
Note: See TracChangeset for help on using the changeset viewer.