Diff
Modified: branches/safari-604-branch/LayoutTests/ChangeLog (221902 => 221903)
--- branches/safari-604-branch/LayoutTests/ChangeLog 2017-09-12 05:50:35 UTC (rev 221902)
+++ branches/safari-604-branch/LayoutTests/ChangeLog 2017-09-12 05:50:40 UTC (rev 221903)
@@ -1,3 +1,19 @@
+2017-09-10 Jason Marcell <[email protected]>
+
+ Cherry-pick r221014. rdar://problem/34169683
+
+ 2017-08-21 Matt Rajca <[email protected]>
+
+ Call updateIsPlayingMedia whenever m_userHasInteractedWithMediaElement changes
+ https://bugs.webkit.org/show_bug.cgi?id=175796
+
+ Reviewed by Eric Carlson.
+
+ Skip the test on iOS like all the other tests that use runWithKeyDown.
+
+ * media/video-user-gesture-tracking-expected.txt: Added.
+ * media/video-user-gesture-tracking.html: Added.
+
2017-08-15 Jason Marcell <[email protected]>
Cherry-pick r217197. rdar://problem/33890650
Added: branches/safari-604-branch/LayoutTests/media/video-user-gesture-tracking-expected.txt (0 => 221903)
--- branches/safari-604-branch/LayoutTests/media/video-user-gesture-tracking-expected.txt (rev 0)
+++ branches/safari-604-branch/LayoutTests/media/video-user-gesture-tracking-expected.txt 2017-09-12 05:50:40 UTC (rev 221903)
@@ -0,0 +1,9 @@
+RUN(window.internals.settings.setVideoPlaybackRequiresUserGesture(true);)
+RUN(video = document.createElement("video"))
+RUN(video.src = "" "content/test"))
+RUN(document.body.appendChild(video))
+EXPECTED (window.internals.pageMediaState().includes('HasUserInteractedWithMediaElement') == 'false') OK
+RUN(video.play())
+EXPECTED (window.internals.pageMediaState().includes('HasUserInteractedWithMediaElement') == 'true') OK
+END OF TEST
+
Added: branches/safari-604-branch/LayoutTests/media/video-user-gesture-tracking.html (0 => 221903)
--- branches/safari-604-branch/LayoutTests/media/video-user-gesture-tracking.html (rev 0)
+++ branches/safari-604-branch/LayoutTests/media/video-user-gesture-tracking.html 2017-09-12 05:50:40 UTC (rev 221903)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>video-user-gesture-tracking</title>
+ <script src=""
+ <script src=""
+ <script>
+ function runTest() {
+ run('window.internals.settings.setVideoPlaybackRequiresUserGesture(true);');
+ run('video = document.createElement("video")');
+ run('video.src = "" "content/test")');
+ run('document.body.appendChild(video)');
+ testExpected("window.internals.pageMediaState().includes('HasUserInteractedWithMediaElement')", false);
+ runWithKeyDown(() => {
+ run('video.play()');
+ });
+ testExpected("window.internals.pageMediaState().includes('HasUserInteractedWithMediaElement')", true)
+ endTest();
+ }
+ </script>
+</head>
+<body _onload_="runTest()">
+</body>
+</html>
Modified: branches/safari-604-branch/LayoutTests/platform/ios/TestExpectations (221902 => 221903)
--- branches/safari-604-branch/LayoutTests/platform/ios/TestExpectations 2017-09-12 05:50:35 UTC (rev 221902)
+++ branches/safari-604-branch/LayoutTests/platform/ios/TestExpectations 2017-09-12 05:50:40 UTC (rev 221903)
@@ -2572,6 +2572,7 @@
media/video-fullscreen-restriction-removed.html
media/video-playsinline.html
media/video-remote-control-playpause.html
+media/video-user-gesture-tracking.html
media/video-volume-slider-drag.html
media/video-webkit-playsinline.html
media/volume-bar-empty-when-muted.html
Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (221902 => 221903)
--- branches/safari-604-branch/Source/WebCore/ChangeLog 2017-09-12 05:50:35 UTC (rev 221902)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog 2017-09-12 05:50:40 UTC (rev 221903)
@@ -1,3 +1,27 @@
+2017-09-10 Jason Marcell <[email protected]>
+
+ Cherry-pick r221014. rdar://problem/34169683
+
+ 2017-08-21 Matt Rajca <[email protected]>
+
+ Call updateIsPlayingMedia whenever m_userHasInteractedWithMediaElement changes
+ https://bugs.webkit.org/show_bug.cgi?id=175796
+
+ Reviewed by Eric Carlson.
+
+ Test: media/video-user-gesture-tracking.html
+
+ The page media state depends on m_userHasInteractedWithMediaElement, so force it to update
+ as soon as m_userHasInteractedWithMediaElement changes. This fixes an issue where the media
+ state would not reflect the user interaction flag until a call to updateIsPlayingMedia was made.
+
+ * dom/Document.cpp:
+ (WebCore::Document::noteUserInteractionWithMediaElement):
+ * dom/Document.h:
+ (WebCore::Document::noteUserInteractionWithMediaElement): Deleted.
+ * testing/Internals.cpp:
+ (WebCore::Internals::pageMediaState):
+
2017-09-05 Matthew Hanson <[email protected]>
Cherry-pick r221444. rdar://problem/34215746
Modified: branches/safari-604-branch/Source/WebCore/dom/Document.cpp (221902 => 221903)
--- branches/safari-604-branch/Source/WebCore/dom/Document.cpp 2017-09-12 05:50:35 UTC (rev 221902)
+++ branches/safari-604-branch/Source/WebCore/dom/Document.cpp 2017-09-12 05:50:40 UTC (rev 221903)
@@ -3603,6 +3603,15 @@
updateIsPlayingMedia();
}
+void Document::noteUserInteractionWithMediaElement()
+{
+ if (m_userHasInteractedWithMediaElement)
+ return;
+
+ m_userHasInteractedWithMediaElement = true;
+ updateIsPlayingMedia();
+}
+
void Document::updateIsPlayingMedia(uint64_t sourceElementID)
{
MediaProducer::MediaStateFlags state = MediaProducer::IsNotPlaying;
Modified: branches/safari-604-branch/Source/WebCore/dom/Document.h (221902 => 221903)
--- branches/safari-604-branch/Source/WebCore/dom/Document.h 2017-09-12 05:50:35 UTC (rev 221902)
+++ branches/safari-604-branch/Source/WebCore/dom/Document.h 2017-09-12 05:50:40 UTC (rev 221903)
@@ -1281,7 +1281,7 @@
WEBCORE_EXPORT void addAudioProducer(MediaProducer*);
WEBCORE_EXPORT void removeAudioProducer(MediaProducer*);
MediaProducer::MediaStateFlags mediaState() const { return m_mediaState; }
- void noteUserInteractionWithMediaElement() { m_userHasInteractedWithMediaElement = true; }
+ void noteUserInteractionWithMediaElement();
bool isCapturing() const { return MediaProducer::isCapturing(m_mediaState); }
WEBCORE_EXPORT void updateIsPlayingMedia(uint64_t = HTMLMediaElementInvalidID);
void pageMutedStateDidChange();
Modified: branches/safari-604-branch/Source/WebCore/testing/Internals.cpp (221902 => 221903)
--- branches/safari-604-branch/Source/WebCore/testing/Internals.cpp 2017-09-12 05:50:35 UTC (rev 221902)
+++ branches/safari-604-branch/Source/WebCore/testing/Internals.cpp 2017-09-12 05:50:40 UTC (rev 221903)
@@ -3612,6 +3612,8 @@
string.append("HasMutedAudioCaptureDevice,");
if (state & MediaProducer::HasMutedVideoCaptureDevice)
string.append("HasMutedVideoCaptureDevice,");
+ if (state & MediaProducer::HasUserInteractedWithMediaElement)
+ string.append("HasUserInteractedWithMediaElement,");
if (string.isEmpty())
string.append("IsNotPlaying");