Title: [221014] trunk
- Revision
- 221014
- Author
- [email protected]
- Date
- 2017-08-22 08:56:32 -0700 (Tue, 22 Aug 2017)
Log Message
Call updateIsPlayingMedia whenever m_userHasInteractedWithMediaElement changes
https://bugs.webkit.org/show_bug.cgi?id=175796
Reviewed by Eric Carlson.
Source/WebCore:
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):
LayoutTests:
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (221013 => 221014)
--- trunk/LayoutTests/ChangeLog 2017-08-22 15:54:17 UTC (rev 221013)
+++ trunk/LayoutTests/ChangeLog 2017-08-22 15:56:32 UTC (rev 221014)
@@ -1,3 +1,15 @@
+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-21 Chris Dumez <[email protected]>
[Beacon] Content extensions should be able to intercept Beacon / Ping redirects
Added: trunk/LayoutTests/media/video-user-gesture-tracking-expected.txt (0 => 221014)
--- trunk/LayoutTests/media/video-user-gesture-tracking-expected.txt (rev 0)
+++ trunk/LayoutTests/media/video-user-gesture-tracking-expected.txt 2017-08-22 15:56:32 UTC (rev 221014)
@@ -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: trunk/LayoutTests/media/video-user-gesture-tracking.html (0 => 221014)
--- trunk/LayoutTests/media/video-user-gesture-tracking.html (rev 0)
+++ trunk/LayoutTests/media/video-user-gesture-tracking.html 2017-08-22 15:56:32 UTC (rev 221014)
@@ -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: trunk/LayoutTests/platform/ios/TestExpectations (221013 => 221014)
--- trunk/LayoutTests/platform/ios/TestExpectations 2017-08-22 15:54:17 UTC (rev 221013)
+++ trunk/LayoutTests/platform/ios/TestExpectations 2017-08-22 15:56:32 UTC (rev 221014)
@@ -2570,6 +2570,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: trunk/Source/WebCore/ChangeLog (221013 => 221014)
--- trunk/Source/WebCore/ChangeLog 2017-08-22 15:54:17 UTC (rev 221013)
+++ trunk/Source/WebCore/ChangeLog 2017-08-22 15:56:32 UTC (rev 221014)
@@ -1,3 +1,23 @@
+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-08-22 Zan Dobersek <[email protected]>
GLContext: zero-initialize the GLContext pointer in ThreadGlobalGLContext
Modified: trunk/Source/WebCore/dom/Document.cpp (221013 => 221014)
--- trunk/Source/WebCore/dom/Document.cpp 2017-08-22 15:54:17 UTC (rev 221013)
+++ trunk/Source/WebCore/dom/Document.cpp 2017-08-22 15:56:32 UTC (rev 221014)
@@ -3606,6 +3606,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: trunk/Source/WebCore/dom/Document.h (221013 => 221014)
--- trunk/Source/WebCore/dom/Document.h 2017-08-22 15:54:17 UTC (rev 221013)
+++ trunk/Source/WebCore/dom/Document.h 2017-08-22 15:56:32 UTC (rev 221014)
@@ -1273,7 +1273,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: trunk/Source/WebCore/testing/Internals.cpp (221013 => 221014)
--- trunk/Source/WebCore/testing/Internals.cpp 2017-08-22 15:54:17 UTC (rev 221013)
+++ trunk/Source/WebCore/testing/Internals.cpp 2017-08-22 15:56:32 UTC (rev 221014)
@@ -3581,6 +3581,8 @@
string.append("HasMutedAudioCaptureDevice,");
if (state & MediaProducer::HasMutedVideoCaptureDevice)
string.append("HasMutedVideoCaptureDevice,");
+ if (state & MediaProducer::HasUserInteractedWithMediaElement)
+ string.append("HasUserInteractedWithMediaElement,");
if (string.isEmpty())
string.append("IsNotPlaying");
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes