RESOLVED FIXED 71123
Implement TextTrackList and the textTracks attribute of HTMLMediaElement
https://bugs.webkit.org/show_bug.cgi?id=71123
Summary Implement TextTrackList and the textTracks attribute of HTMLMediaElement
Attachments
Proposed patch (75.47 KB, patch)
2011-11-08 12:51 PST, Eric Carlson
no flags
Updated to apply to TOT (76.20 KB, patch)
2011-11-08 15:24 PST, Eric Carlson
webkit-ews: commit-queue-
Updated to compile when ENABLE_VIDEO_TRACK is not defined (75.44 KB, patch)
2011-11-08 16:50 PST, Eric Carlson
webkit.review.bot: commit-queue-
One more time. (76.02 KB, patch)
2011-11-08 18:45 PST, Eric Carlson
webkit.review.bot: commit-queue-
YAP (75.92 KB, patch)
2011-11-08 20:07 PST, Eric Carlson
webkit.review.bot: commit-queue-
Patch (76.31 KB, patch)
2011-11-09 07:47 PST, Eric Carlson
sam: review-
Updated to address Sam's feedback. (77.05 KB, patch)
2011-11-09 13:32 PST, Eric Carlson
ggaren: review-
Addressing Geoff's comments. (80.82 KB, patch)
2011-11-10 14:08 PST, Eric Carlson
sam: review+
Eric Carlson
Comment 1 2011-11-08 12:51:32 PST
Created attachment 114140 [details] Proposed patch Uploaded so the EWS bots can point out problems in ports I can't build.
Radar WebKit Bug Importer
Comment 2 2011-11-08 12:59:23 PST
Darin Adler
Comment 3 2011-11-08 15:11:24 PST
Comment on attachment 114140 [details] Proposed patch Patch doesn’t seem to apply.
Eric Carlson
Comment 4 2011-11-08 15:24:38 PST
Created attachment 114164 [details] Updated to apply to TOT
Early Warning System Bot
Comment 5 2011-11-08 15:38:01 PST
Comment on attachment 114164 [details] Updated to apply to TOT Attachment 114164 [details] did not pass qt-ews (qt): Output: http://queues.webkit.org/results/10374217
Eric Carlson
Comment 6 2011-11-08 16:50:34 PST
Created attachment 114175 [details] Updated to compile when ENABLE_VIDEO_TRACK is not defined
WebKit Review Bot
Comment 7 2011-11-08 18:29:45 PST
Comment on attachment 114175 [details] Updated to compile when ENABLE_VIDEO_TRACK is not defined Attachment 114175 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/10376246
Eric Carlson
Comment 8 2011-11-08 18:45:55 PST
Created attachment 114196 [details] One more time.
WebKit Review Bot
Comment 9 2011-11-08 18:59:59 PST
Attachment 114196 [details] did not pass style-queue: Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/medi..." exit_code: 1 Source/WebCore/bindings/js/JSTextTrackListCustom.cpp:47: Could not find a newline character at the end of the file. [whitespace/ending_newline] [5] Total errors found: 1 in 34 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 10 2011-11-08 19:34:02 PST
Comment on attachment 114196 [details] One more time. Attachment 114196 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/10375317
Eric Carlson
Comment 11 2011-11-08 20:07:26 PST
WebKit Review Bot
Comment 12 2011-11-08 20:34:45 PST
Comment on attachment 114201 [details] YAP Attachment 114201 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/10382104
Eric Carlson
Comment 13 2011-11-08 21:39:38 PST
(In reply to comment #12) > (From update of attachment 114201 [details]) > Attachment 114201 [details] did not pass chromium-ews (chromium-xvfb): > Output: http://queues.webkit.org/results/10382104 out/Release/obj/gen/webcore/bindings/V8HTMLTrackElement.cpp: In function 'v8::Handle<v8::Value> WebCore::HTMLTrackElementInternal::trackAttrGetter(v8::Local<v8::String>, const v8::AccessorInfo&)': out/Release/obj/gen/webcore/bindings/V8HTMLTrackElement.cpp:130: error: call of overloaded 'toV8(WTF::PassRefPtr<WebCore::LoadableTextTrack>)' is ambiguous out/Release/obj/gen/webkit/bindings/V8Event.h:72: note: candidates are: ... HTMLTrackElement.idl didn't change, why does V8HTMLTrackElement.cpp no longer compile?
Adam Barth
Comment 14 2011-11-08 22:29:56 PST
Comment on attachment 114201 [details] YAP View in context: https://bugs.webkit.org/attachment.cgi?id=114201&action=review > Source/WebCore/html/HTMLTrackElement.cpp:154 > + return m_track; Do you mean return m_track.release() ?
Eric Carlson
Comment 15 2011-11-09 07:47:48 PST
Sam Weinig
Comment 16 2011-11-09 10:05:15 PST
Comment on attachment 114278 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=114278&action=review > Source/WebCore/html/HTMLMediaElement.cpp:2046 > +PassRefPtr<TextTrackList> HTMLMediaElement::textTracks() const This probably wants to be a raw pointer return type. > Source/WebCore/html/HTMLMediaElement.h:249 > + enum InvalidUrlAction { DoNothing, Complain }; Url should be spelled URL. > Source/WebCore/html/HTMLTrackElement.cpp:157 > +PassRefPtr<TextTrack> HTMLTrackElement::track() This should probably return a raw pointer. > Source/WebCore/html/HTMLTrackElement.cpp:160 > + RefPtr<TextTrack> track = loadableTrack(); > + return track.release(); This can just be return loadableTrack(); > Source/WebCore/html/HTMLTrackElement.h:77 > + // TextTrackLoadingClient I think this is just a TextTrackClient now. > Source/WebCore/html/HTMLTrackElement.h:88 > + RefPtr<ScriptExecutionContext> m_context; I am not sure you need to store this. The Document associate with the element should be the ScriptExecutionContext to use. > Source/WebCore/html/LoadableTextTrack.h:47 > + virtual void loadingCompleted(LoadableTextTrack*, bool /* loadingFailed */) { } Maybe didCompleteLoad()? > Source/WebCore/html/LoadableTextTrack.h:75 > + RefPtr<ScriptExecutionContext> m_context; You should probably be able to get to this through the m_trackElement. > Source/WebCore/html/track/TextTrackList.h:31 > +#include "ActiveDOMObject.h" I don't think you use this anymore.
Eric Carlson
Comment 17 2011-11-09 13:32:23 PST
Created attachment 114355 [details] Updated to address Sam's feedback.
Geoffrey Garen
Comment 18 2011-11-10 11:30:41 PST
Comment on attachment 114355 [details] Updated to address Sam's feedback. View in context: https://bugs.webkit.org/attachment.cgi?id=114355&action=review r- because the JS marking stuff is not quite right. I'm sorry this API turned out to be so complicated. Sam and I are working on making it better. > Source/WebCore/bindings/js/JSTextTrackListCustom.cpp:45 > + if (textTrackList->hasEventListeners()) > + return true; > + if (jsTextTrackList->hasCustomProperties()) > + return true; This is a memory leak. It is valid to say "if (!x) return false" here to optimize away a wrapper. But saying "if (x) return true" will cause a wrapper with custom properties or event listeners to be immortal. > Source/WebCore/bindings/js/JSTextTrackListCustom.cpp:47 > + return visitor.containsOpaqueRoot(root(textTrackList->owner())); You also need a custom mark function that calls visitor.addOpaqueRoot(root(...)), so that, if this list is marked, it keeps the rest of the DOM alive, since the list has accessors to the rest of the DOM.
Eric Carlson
Comment 19 2011-11-10 14:08:07 PST
Created attachment 114565 [details] Addressing Geoff's comments.
Sam Weinig
Comment 20 2011-11-10 15:50:07 PST
Comment on attachment 114565 [details] Addressing Geoff's comments. View in context: https://bugs.webkit.org/attachment.cgi?id=114565&action=review > Source/WebCore/html/HTMLTrackElement.cpp:46 > + , m_track(0) You don't have to initialize this since it is in a RefPtr.
Eric Carlson
Comment 21 2011-11-11 09:36:02 PST
Note You need to log in before you can comment on or make changes to this bug.