Title: [244078] trunk
Revision
244078
Author
jer.no...@apple.com
Date
2019-04-09 08:57:45 -0700 (Tue, 09 Apr 2019)

Log Message

Source/WebCore:
Test for: 196095 Inband Text Track cues interspersed with Data cues can display out of order.
https://bugs.webkit.org/show_bug.cgi?id=196097

Reviewed by Eric Carlson.

Test: media/track/track-in-band-metadata-display-order.html

Add a method in Internals to create a TextTrackCueGeneric (which can normally only be created
by parsing an in-band media track). This requires adding IDL for TextTrackCueGeneric, and exporting
TextTrackCueGeneric for testing.

Drive-by fixes:

Add runtime logging to MediaControlTextTrackContainerElement. This necessitates modifying the
parentMediaElement() method to take a const Node*, and const_cast that constness away in order to return
a HTMLMediaElement*

TextTrackCue, VTTCue, TextTrackCueGeneric, and DataCue should all use the WTF TypeCasts macros to
enable use of is<> and downcast<>.

* Source/WebCore/CMakeLists.txt:
* DerivedSources-input.xcfilelist:
* DerivedSources-output.xcfilelist:
* DerivedSources.make:
* WebCore.xcodeproj/project.pbxproj:
* Sources.txt:
* html/shadow/MediaControlElementTypes.cpp:
(WebCore::parentMediaElement):
* html/shadow/MediaControlElementTypes.h:
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlTextTrackContainerElement::updateDisplay):
(WebCore::MediaControlTextTrackContainerElement::logger const):
(WebCore::MediaControlTextTrackContainerElement::logIdentifier const):
(WebCore::MediaControlTextTrackContainerElement::logChannel const):
* html/shadow/MediaControlElements.h:
* html/track/DataCue.h:
(isType):
* html/track/TextTrackCueGeneric.h:
(isType):
* html/track/TextTrackCueGeneric.idl: Added.
* html/track/VTTCue.h:
(isType):
* testing/Internals.cpp:
(WebCore::Internals::createGenericCue):
* testing/Internals.h:
* testing/Internals.idl:

Tools:
Test for: 196095 Inband Text Track cues interspersed with Data cues can display out of order.
https://bugs.webkit.org/show_bug.cgi?id=196097

Reviewed by Eric Carlson.

Drive-by bug fix: allow tests to play audio without a user gesture by default.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebPreferencesToConsistentValues):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

LayoutTests:
Add test for fix of #196095
https://bugs.webkit.org/show_bug.cgi?id=196097

Reviewed by Eric Carlson.

* media/track/track-in-band-metadata-display-order-expected.txt: Added.
* media/track/track-in-band-metadata-display-order.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244077 => 244078)


--- trunk/LayoutTests/ChangeLog	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/LayoutTests/ChangeLog	2019-04-09 15:57:45 UTC (rev 244078)
@@ -1,3 +1,13 @@
+2019-04-09  Jer Noble  <jer.no...@apple.com>
+
+        Add test for fix of #196095
+        https://bugs.webkit.org/show_bug.cgi?id=196097
+
+        Reviewed by Eric Carlson.
+
+        * media/track/track-in-band-metadata-display-order-expected.txt: Added.
+        * media/track/track-in-band-metadata-display-order.html: Added.
+
 2019-04-08  Chris Fleizach  <cfleiz...@apple.com>
 
         AX: Automatically compute accessibility labels for Apple Pay buttons

Added: trunk/LayoutTests/media/track/track-in-band-metadata-display-order-expected.txt (0 => 244078)


--- trunk/LayoutTests/media/track/track-in-band-metadata-display-order-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-in-band-metadata-display-order-expected.txt	2019-04-09 15:57:45 UTC (rev 244078)
@@ -0,0 +1,21 @@
+
+RUN(video.src = "" "../content/test"))
+EVENT(canplaythrough)
+RUN(captionTrack = video.addTextTrack("captions"))
+RUN(captionTrack.mode = "showing")
+RUN(metadataTrack = video.addTextTrack("metadata"))
+RUN(metadataTrack.mode = "hidden")
+RUN(cue = internals.createGenericCue(2, 4, "I am earlier"))
+RUN(cue.line = 40)
+RUN(captionTrack.addCue(cue))
+RUN(cue = internals.createGenericCue(2.5, 4.5, "I am later"))
+RUN(cue.line = 80)
+RUN(captionTrack.addCue(cue))
+RUN(metadataTrack.addCue(new DataCue(2.25, video.duration, "first data cue")))
+RUN(metadataTrack.addCue(new DataCue(2.25, video.duration, "second data cue")))
+RUN(video.currentTime = 3)
+EVENT(seeked)
+EXPECTED (textTrackDisplayElement(video, "display", 0).textContent == 'I am later') OK
+EXPECTED (textTrackDisplayElement(video, "display", 1).textContent == 'I am earlier') OK
+END OF TEST
+

Added: trunk/LayoutTests/media/track/track-in-band-metadata-display-order.html (0 => 244078)


--- trunk/LayoutTests/media/track/track-in-band-metadata-display-order.html	                        (rev 0)
+++ trunk/LayoutTests/media/track/track-in-band-metadata-display-order.html	2019-04-09 15:57:45 UTC (rev 244078)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>track-in-band-metadata-display-order</title>
+    <script src=""
+    <script src=""
+    <script src=""
+    <script>
+        window.addEventListener('load', async event => {
+            window.video = document.querySelector('video');
+            run('video.src = "" "../content/test")');
+
+            await waitFor(video, 'canplaythrough');
+
+            run('captionTrack = video.addTextTrack("captions")');
+            run('captionTrack.mode = "showing"');
+            run('metadataTrack = video.addTextTrack("metadata")');
+            run('metadataTrack.mode = "hidden"');
+            run('cue = internals.createGenericCue(2, 4, "I am earlier")')
+            run('cue.line = 40');
+            run('captionTrack.addCue(cue)');
+            run('cue = internals.createGenericCue(2.5, 4.5, "I am later")');
+            run('cue.line = 80');
+            run('captionTrack.addCue(cue)');
+            run('metadataTrack.addCue(new DataCue(2.25, video.duration, "first data cue"))')
+            run('metadataTrack.addCue(new DataCue(2.25, video.duration, "second data cue"))')
+
+            run('video.currentTime = 3');
+            await waitFor(video, 'seeked');
+
+            testExpected('textTrackDisplayElement(video, "display", 0).textContent', 'I am later');
+            testExpected('textTrackDisplayElement(video, "display", 1).textContent', 'I am earlier');
+
+            endTest();
+        });
+    </script>
+</head>
+<body>
+    <video controls></video>
+</body>
+</html>
\ No newline at end of file

Modified: trunk/Source/WebCore/CMakeLists.txt (244077 => 244078)


--- trunk/Source/WebCore/CMakeLists.txt	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/CMakeLists.txt	2019-04-09 15:57:45 UTC (rev 244078)
@@ -1368,6 +1368,7 @@
         html/track/DataCue.idl
         html/track/TextTrack.idl
         html/track/TextTrackCue.idl
+        html/track/TextTrackCueGeneric.idl
         html/track/TextTrackCueList.idl
         html/track/TextTrackList.idl
         html/track/TrackEvent.idl

Modified: trunk/Source/WebCore/ChangeLog (244077 => 244078)


--- trunk/Source/WebCore/ChangeLog	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/ChangeLog	2019-04-09 15:57:45 UTC (rev 244078)
@@ -1,3 +1,52 @@
+2019-04-09  Jer Noble  <jer.no...@apple.com>
+
+        Test for: 196095 Inband Text Track cues interspersed with Data cues can display out of order.
+        https://bugs.webkit.org/show_bug.cgi?id=196097
+
+        Reviewed by Eric Carlson.
+
+        Test: media/track/track-in-band-metadata-display-order.html
+
+        Add a method in Internals to create a TextTrackCueGeneric (which can normally only be created
+        by parsing an in-band media track). This requires adding IDL for TextTrackCueGeneric, and exporting
+        TextTrackCueGeneric for testing.
+
+        Drive-by fixes:
+
+        Add runtime logging to MediaControlTextTrackContainerElement. This necessitates modifying the
+        parentMediaElement() method to take a const Node*, and const_cast that constness away in order to return
+        a HTMLMediaElement*
+
+        TextTrackCue, VTTCue, TextTrackCueGeneric, and DataCue should all use the WTF TypeCasts macros to
+        enable use of is<> and downcast<>.
+
+        * Source/WebCore/CMakeLists.txt:
+        * DerivedSources-input.xcfilelist:
+        * DerivedSources-output.xcfilelist:
+        * DerivedSources.make:
+        * WebCore.xcodeproj/project.pbxproj:
+        * Sources.txt:
+        * html/shadow/MediaControlElementTypes.cpp:
+        (WebCore::parentMediaElement):
+        * html/shadow/MediaControlElementTypes.h:
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlTextTrackContainerElement::updateDisplay):
+        (WebCore::MediaControlTextTrackContainerElement::logger const):
+        (WebCore::MediaControlTextTrackContainerElement::logIdentifier const):
+        (WebCore::MediaControlTextTrackContainerElement::logChannel const):
+        * html/shadow/MediaControlElements.h:
+        * html/track/DataCue.h:
+        (isType):
+        * html/track/TextTrackCueGeneric.h:
+        (isType):
+        * html/track/TextTrackCueGeneric.idl: Added.
+        * html/track/VTTCue.h:
+        (isType):
+        * testing/Internals.cpp:
+        (WebCore::Internals::createGenericCue):
+        * testing/Internals.h:
+        * testing/Internals.idl:
+
 2019-04-09  Sihui Liu  <sihui_...@apple.com>
 
         Remove unnecessary network process assertion for IDB close

Modified: trunk/Source/WebCore/DerivedSources-input.xcfilelist (244077 => 244078)


--- trunk/Source/WebCore/DerivedSources-input.xcfilelist	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/DerivedSources-input.xcfilelist	2019-04-09 15:57:45 UTC (rev 244078)
@@ -847,6 +847,7 @@
 $(PROJECT_DIR)/html/track/DataCue.idl
 $(PROJECT_DIR)/html/track/TextTrack.idl
 $(PROJECT_DIR)/html/track/TextTrackCue.idl
+$(PROJECT_DIR)/html/track/TextTrackCueGeneric.idl
 $(PROJECT_DIR)/html/track/TextTrackCueList.idl
 $(PROJECT_DIR)/html/track/TextTrackList.idl
 $(PROJECT_DIR)/html/track/TrackEvent.idl

Modified: trunk/Source/WebCore/DerivedSources-output.xcfilelist (244077 => 244078)


--- trunk/Source/WebCore/DerivedSources-output.xcfilelist	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/DerivedSources-output.xcfilelist	2019-04-09 15:57:45 UTC (rev 244078)
@@ -1749,6 +1749,8 @@
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrack.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrackCue.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrackCue.h
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrackCueGeneric.cpp
+$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrackCueGeneric.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrackCueList.cpp
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrackCueList.h
 $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSTextTrackList.cpp

Modified: trunk/Source/WebCore/DerivedSources.make (244077 => 244078)


--- trunk/Source/WebCore/DerivedSources.make	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/DerivedSources.make	2019-04-09 15:57:45 UTC (rev 244078)
@@ -826,6 +826,7 @@
     $(WebCore)/html/track/DataCue.idl \
     $(WebCore)/html/track/TextTrack.idl \
     $(WebCore)/html/track/TextTrackCue.idl \
+    $(WebCore)/html/track/TextTrackCueGeneric.idl \
     $(WebCore)/html/track/TextTrackCueList.idl \
     $(WebCore)/html/track/TextTrackList.idl \
     $(WebCore)/html/track/TrackEvent.idl \

Modified: trunk/Source/WebCore/Sources.txt (244077 => 244078)


--- trunk/Source/WebCore/Sources.txt	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/Sources.txt	2019-04-09 15:57:45 UTC (rev 244078)
@@ -3435,6 +3435,7 @@
 JSDataCue.cpp
 JSTextTrack.cpp
 JSTextTrackCue.cpp
+JSTextTrackCueGeneric.cpp
 JSTextTrackCueList.cpp
 JSTextTrackList.cpp
 JSTrackEvent.cpp

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (244077 => 244078)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-04-09 15:57:45 UTC (rev 244078)
@@ -13747,6 +13747,9 @@
 		CDFC360218CA61630026E56F /* RemoteCommandListenerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RemoteCommandListenerIOS.mm; sourceTree = "<group>"; };
 		CDFC360318CA61C20026E56F /* RemoteCommandListener.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteCommandListener.cpp; sourceTree = "<group>"; };
 		CDFC360418CA61C20026E56F /* RemoteCommandListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoteCommandListener.h; sourceTree = "<group>"; };
+		CDFD78BA2242C4FE00D7208A /* JSTextTrackCueGeneric.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSTextTrackCueGeneric.h; sourceTree = "<group>"; };
+		CDFD78BB2242C4FF00D7208A /* JSTextTrackCueGeneric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSTextTrackCueGeneric.cpp; sourceTree = "<group>"; };
+		CDFD78C22242FC4900D7208A /* TextTrackCueGeneric.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = TextTrackCueGeneric.idl; sourceTree = "<group>"; };
 		CE057FA31220731100A476D5 /* DocumentMarkerController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DocumentMarkerController.cpp; sourceTree = "<group>"; };
 		CE057FA41220731100A476D5 /* DocumentMarkerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DocumentMarkerController.h; sourceTree = "<group>"; };
 		CE08C3CF152B599A0021B8C2 /* AlternativeTextController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AlternativeTextController.cpp; sourceTree = "<group>"; };
@@ -22741,6 +22744,8 @@
 				0707568F1422668C00414161 /* JSTextTrack.h */,
 				070756D714239B4B00414161 /* JSTextTrackCue.cpp */,
 				070756D814239B4B00414161 /* JSTextTrackCue.h */,
+				CDFD78BB2242C4FF00D7208A /* JSTextTrackCueGeneric.cpp */,
+				CDFD78BA2242C4FE00D7208A /* JSTextTrackCueGeneric.h */,
 				070756D914239B4C00414161 /* JSTextTrackCueList.cpp */,
 				070756DA14239B4E00414161 /* JSTextTrackCueList.h */,
 				07B5A2D91464320A00A81ECE /* JSTextTrackList.cpp */,
@@ -23682,6 +23687,7 @@
 				9759E93A14EF1CF80026A2DD /* TextTrackCue.idl */,
 				071A9EC0168FB56C002629F9 /* TextTrackCueGeneric.cpp */,
 				071A9EC1168FB56C002629F9 /* TextTrackCueGeneric.h */,
+				CDFD78C22242FC4900D7208A /* TextTrackCueGeneric.idl */,
 				9759E93B14EF1CF80026A2DD /* TextTrackCueList.cpp */,
 				9759E93C14EF1CF80026A2DD /* TextTrackCueList.h */,
 				9759E93D14EF1CF80026A2DD /* TextTrackCueList.idl */,

Modified: trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp (244077 => 244078)


--- trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/html/shadow/MediaControlElementTypes.cpp	2019-04-09 15:57:45 UTC (rev 244078)
@@ -54,13 +54,13 @@
 
 class Event;
 
-RefPtr<HTMLMediaElement> parentMediaElement(Node* node)
+RefPtr<HTMLMediaElement> parentMediaElement(const Node* node)
 {
     if (!node)
         return nullptr;
     RefPtr<Node> mediaNode = node->shadowHost();
     if (!mediaNode)
-        mediaNode = node;
+        mediaNode = const_cast<Node*>(node);
     if (!is<HTMLMediaElement>(*mediaNode))
         return nullptr;
     return downcast<HTMLMediaElement>(mediaNode.get());

Modified: trunk/Source/WebCore/html/shadow/MediaControlElementTypes.h (244077 => 244078)


--- trunk/Source/WebCore/html/shadow/MediaControlElementTypes.h	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/html/shadow/MediaControlElementTypes.h	2019-04-09 15:57:45 UTC (rev 244078)
@@ -72,7 +72,7 @@
     MediaClosedCaptionsTrackList,
 };
 
-RefPtr<HTMLMediaElement> parentMediaElement(Node*);
+RefPtr<HTMLMediaElement> parentMediaElement(const Node*);
 inline RefPtr<HTMLMediaElement> parentMediaElement(const RenderObject& renderer) { return parentMediaElement(renderer.node()); }
 
 MediaControlElementType mediaControlElementType(Node*);

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.cpp (244077 => 244078)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.cpp	2019-04-09 15:57:45 UTC (rev 244078)
@@ -1172,10 +1172,10 @@
         removeChildren();
 
     activeCues.removeAllMatching([] (CueInterval& cueInterval) {
-        if (!cueInterval.data() || !cueInterval.data()->isRenderable())
+        if (!is<VTTCue>(cueInterval.data()))
             return true;
 
-        RefPtr<VTTCue> cue = toVTTCue(cueInterval.data());
+        Ref<VTTCue> cue = downcast<VTTCue>(*cueInterval.data());
 
         return !cue->isRenderable()
             || !cue->track()
@@ -1197,12 +1197,9 @@
         if (!mediaController()->closedCaptionsVisible())
             continue;
 
-        RefPtr<VTTCue> cue = toVTTCue(activeCues[i].data());
-        ASSERT(cue);
-        if (!cue)
-            continue;
+        RefPtr<VTTCue> cue = downcast<VTTCue>(activeCues[i].data());
 
-        LOG(Media, "MediaControlTextTrackContainerElement::updateDisplay(%p) - adding and positioning cue #%zu: \"%s\", start=%.2f, end=%.2f, line=%.2f", this, i, cue->text().utf8().data(), cue->startTime(), cue->endTime(), cue->line());
+        DEBUG_LOG(LOGIDENTIFIER, "adding and positioning cue ", i, ": \"", cue->text(), "\", start=", cue->startTime(), ", end=", cue->endTime(), ", line=", cue->line());
         Ref<VTTCueBox> displayBox = cue->getDisplayTree(m_videoDisplaySize.size(), m_fontSize);
         RefPtr<VTTRegion> region = cue->track()->regions()->getRegionById(cue->regionId());
         if (!region) {
@@ -1454,6 +1451,25 @@
     updateSizes();
 }
 
+#if !RELEASE_LOG_DISABLED
+const Logger& MediaControlTextTrackContainerElement::logger() const
+{
+    return document().logger();
+}
+
+const void* MediaControlTextTrackContainerElement::logIdentifier() const
+{
+    if (auto mediaElement = parentMediaElement(this))
+        return mediaElement->logIdentifier();
+    return nullptr;
+}
+
+WTFLogChannel& MediaControlTextTrackContainerElement::logChannel() const
+{
+    return LogMedia;
+}
+#endif // !RELEASE_LOG_DISABLED
+
 #endif // ENABLE(VIDEO_TRACK)
 
 // ----------------------------

Modified: trunk/Source/WebCore/html/shadow/MediaControlElements.h (244077 => 244078)


--- trunk/Source/WebCore/html/shadow/MediaControlElements.h	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/html/shadow/MediaControlElements.h	2019-04-09 15:57:45 UTC (rev 244078)
@@ -33,6 +33,7 @@
 
 #include "MediaControlElementTypes.h"
 #include "TextTrackRepresentation.h"
+#include <wtf/LoggerHelper.h>
 
 namespace WebCore {
 
@@ -466,7 +467,13 @@
 
 #if ENABLE(VIDEO_TRACK)
 
-class MediaControlTextTrackContainerElement final : public MediaControlDivElement, public TextTrackRepresentationClient {
+class MediaControlTextTrackContainerElement final
+    : public MediaControlDivElement
+    , public TextTrackRepresentationClient
+#if !RELEASE_LOG_DISABLED
+    , private LoggerHelper
+#endif
+{
     WTF_MAKE_ISO_ALLOCATED(MediaControlTextTrackContainerElement);
 public:
     static Ref<MediaControlTextTrackContainerElement> create(Document&);
@@ -480,7 +487,14 @@
     void updateTimerFired();
     void updateActiveCuesFontSize();
     void updateTextStrokeStyle();
-    
+
+#if !RELEASE_LOG_DISABLED
+    const Logger& logger() const final;
+    const void* logIdentifier() const final;
+    WTFLogChannel& logChannel() const final;
+    const char* logClassName() const final { return "MediaControlTextTrackContainerElement"; }
+#endif
+
     explicit MediaControlTextTrackContainerElement(Document&);
 
     RenderPtr<RenderElement> createElementRenderer(RenderStyle&&, const RenderTreePosition&) override;

Modified: trunk/Source/WebCore/html/track/DataCue.h (244077 => 244078)


--- trunk/Source/WebCore/html/track/DataCue.h	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/html/track/DataCue.h	2019-04-09 15:57:45 UTC (rev 244078)
@@ -33,6 +33,7 @@
 #include <_javascript_Core/ArrayBuffer.h>
 #include <_javascript_Core/JSCJSValue.h>
 #include <wtf/MediaTime.h>
+#include <wtf/TypeCasts.h>
 
 namespace WebCore {
 
@@ -124,4 +125,8 @@
 
 }
 
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::DataCue)
+static bool isType(const WebCore::TextTrackCue& cue) { return cue.cueType() == WebCore::TextTrackCue::Data; }
+SPECIALIZE_TYPE_TRAITS_END()
+
 #endif

Modified: trunk/Source/WebCore/html/track/TextTrackCueGeneric.h (244077 => 244078)


--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.h	2019-04-09 15:57:45 UTC (rev 244078)
@@ -36,7 +36,7 @@
 
 // A "generic" cue is a non-WebVTT cue, so it is not positioned/sized with the WebVTT logic.
 class TextTrackCueGeneric final : public VTTCue {
-    WTF_MAKE_ISO_ALLOCATED(TextTrackCueGeneric);
+    WTF_MAKE_ISO_ALLOCATED_EXPORT(TextTrackCueGeneric, WEBCORE_EXPORT);
 public:
     static Ref<TextTrackCueGeneric> create(ScriptExecutionContext& context, const MediaTime& start, const MediaTime& end, const String& content)
     {
@@ -71,7 +71,7 @@
     String toJSONString() const;
 
 private:
-    TextTrackCueGeneric(ScriptExecutionContext&, const MediaTime& start, const MediaTime& end, const String&);
+    WEBCORE_EXPORT TextTrackCueGeneric(ScriptExecutionContext&, const MediaTime& start, const MediaTime& end, const String&);
     
     bool isOrderedBefore(const TextTrackCue*) const final;
     bool isPositionedAbove(const TextTrackCue*) const final;
@@ -109,4 +109,9 @@
 };
 
 }
+
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::TextTrackCueGeneric)
+static bool isType(const WebCore::TextTrackCue& cue) { return cue.cueType() == WebCore::TextTrackCue::Generic; }
+SPECIALIZE_TYPE_TRAITS_END()
+
 #endif

Added: trunk/Source/WebCore/html/track/TextTrackCueGeneric.idl (0 => 244078)


--- trunk/Source/WebCore/html/track/TextTrackCueGeneric.idl	                        (rev 0)
+++ trunk/Source/WebCore/html/track/TextTrackCueGeneric.idl	2019-04-09 15:57:45 UTC (rev 244078)
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=VIDEO_TRACK,
+    JSGenerateToJSObject,
+    JSGenerateToNativeObject,
+    NoInterfaceObject,
+    ExportMacro=WEBCORE_EXPORT,
+] interface TextTrackCueGeneric : VTTCue {
+};

Modified: trunk/Source/WebCore/html/track/VTTCue.h (244077 => 244078)


--- trunk/Source/WebCore/html/track/VTTCue.h	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/html/track/VTTCue.h	2019-04-09 15:57:45 UTC (rev 244078)
@@ -35,6 +35,7 @@
 
 #include "HTMLElement.h"
 #include "TextTrackCue.h"
+#include <wtf/TypeCasts.h>
 
 namespace WebCore {
 
@@ -261,4 +262,8 @@
 
 } // namespace WTF
 
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::VTTCue)
+    static bool isType(const WebCore::TextTrackCue& cue) { return cue.isRenderable(); }
+SPECIALIZE_TYPE_TRAITS_END()
+
 #endif

Modified: trunk/Source/WebCore/testing/Internals.cpp (244077 => 244078)


--- trunk/Source/WebCore/testing/Internals.cpp	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/testing/Internals.cpp	2019-04-09 15:57:45 UTC (rev 244078)
@@ -213,6 +213,7 @@
 #if ENABLE(VIDEO_TRACK)
 #include "CaptionUserPreferences.h"
 #include "PageGroup.h"
+#include "TextTrackCueGeneric.h"
 #endif
 
 #if ENABLE(VIDEO)
@@ -3575,6 +3576,21 @@
     return { };
 }
 
+RefPtr<TextTrackCueGeneric> Internals::createGenericCue(double startTime, double endTime, String text)
+{
+    Document* document = contextDocument();
+    if (!document || !document->page())
+        return nullptr;
+#if ENABLE(VIDEO_TRACK)
+    return TextTrackCueGeneric::create(*document, MediaTime::createWithDouble(startTime), MediaTime::createWithDouble(endTime), text);
+#else
+    UNUSED_PARAM(startTime);
+    UNUSED_PARAM(endTime);
+    UNUSED_PARAM(text);
+    return nullptr;
+#endif
+}
+
 #if ENABLE(VIDEO)
 
 Ref<TimeRanges> Internals::createTimeRanges(Float32Array& startTimes, Float32Array& endTimes)

Modified: trunk/Source/WebCore/testing/Internals.h (244077 => 244078)


--- trunk/Source/WebCore/testing/Internals.h	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/testing/Internals.h	2019-04-09 15:57:45 UTC (rev 244078)
@@ -91,6 +91,7 @@
 class SourceBuffer;
 class StringCallback;
 class StyleSheet;
+class TextTrackCueGeneric;
 class TimeRanges;
 class TypeConversions;
 class VoidCallback;
@@ -543,6 +544,7 @@
     ExceptionOr<void> setCaptionsStyleSheetOverride(const String&);
     ExceptionOr<void> setPrimaryAudioTrackLanguageOverride(const String&);
     ExceptionOr<void> setCaptionDisplayMode(const String&);
+    RefPtr<TextTrackCueGeneric> createGenericCue(double startTime, double endTime, String text);
 
 #if ENABLE(VIDEO)
     Ref<TimeRanges> createTimeRanges(Float32Array& startTimes, Float32Array& endTimes);

Modified: trunk/Source/WebCore/testing/Internals.idl (244077 => 244078)


--- trunk/Source/WebCore/testing/Internals.idl	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Source/WebCore/testing/Internals.idl	2019-04-09 15:57:45 UTC (rev 244078)
@@ -540,6 +540,7 @@
     [Conditional=VIDEO_TRACK, MayThrowException] void setCaptionsStyleSheetOverride(DOMString override);
     [Conditional=VIDEO_TRACK, MayThrowException] void setPrimaryAudioTrackLanguageOverride(DOMString language);
     [Conditional=VIDEO_TRACK, MayThrowException] void setCaptionDisplayMode(DOMString mode);
+    [Conditional=VIDEO_TRACK] TextTrackCueGeneric createGenericCue(double startTime, double endTime, DOMString text);
 
     [Conditional=VIDEO] TimeRanges createTimeRanges(Float32Array startTimes, Float32Array
      endTimes);

Modified: trunk/Tools/ChangeLog (244077 => 244078)


--- trunk/Tools/ChangeLog	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Tools/ChangeLog	2019-04-09 15:57:45 UTC (rev 244078)
@@ -1,3 +1,17 @@
+2019-04-09  Jer Noble  <jer.no...@apple.com>
+
+        Test for: 196095 Inband Text Track cues interspersed with Data cues can display out of order.
+        https://bugs.webkit.org/show_bug.cgi?id=196097
+
+        Reviewed by Eric Carlson.
+
+        Drive-by bug fix: allow tests to play audio without a user gesture by default.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebPreferencesToConsistentValues):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+
 2019-04-09  Pablo Saavedra  <psaave...@igalia.com>
 
         [JSCOnly] Add an i386 JSCOnly EWS that runs tests

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (244077 => 244078)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2019-04-09 15:57:45 UTC (rev 244078)
@@ -937,6 +937,7 @@
         [preferences setUserStyleSheetEnabled:NO];
 
     [preferences setMediaPlaybackAllowsInline:YES];
+    [preferences setMediaPlaybackRequiresUserGesture:NO];
     [preferences setVideoPlaybackRequiresUserGesture:NO];
     [preferences setAudioPlaybackRequiresUserGesture:NO];
     [preferences setMediaDataLoadsAutomatically:YES];

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (244077 => 244078)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2019-04-09 15:56:45 UTC (rev 244077)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2019-04-09 15:57:45 UTC (rev 244078)
@@ -866,6 +866,10 @@
 
     WKPreferencesSetWebSQLDisabled(preferences, false);
 
+    WKPreferencesSetMediaPlaybackRequiresUserGesture(preferences, false);
+    WKPreferencesSetVideoPlaybackRequiresUserGesture(preferences, false);
+    WKPreferencesSetAudioPlaybackRequiresUserGesture(preferences, false);
+
     platformResetPreferencesToConsistentValues();
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to