WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 62886
Basic display of WebVTT captions
https://bugs.webkit.org/show_bug.cgi?id=62886
Summary
Basic display of WebVTT captions
Anna Cavender
Reported
2011-06-17 11:01:09 PDT
This change will enable rendering of text track cues on <video>s.
Attachments
Proposed patch
(36.51 KB, patch)
2011-12-18 16:20 PST
,
Eric Carlson
sam
: review-
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
Updated patch
(37.40 KB, patch)
2011-12-18 18:34 PST
,
Eric Carlson
sam
: review+
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
Updated, one more time.
(38.25 KB, patch)
2011-12-18 20:55 PST
,
Eric Carlson
sam
: review+
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
One more patch for the EWS bot
(38.36 KB, patch)
2011-12-18 22:59 PST
,
Eric Carlson
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
YAP
(38.26 KB, patch)
2011-12-18 23:10 PST
,
Eric Carlson
webkit.review.bot
: commit-queue-
Details
Formatted Diff
Diff
Updated patch
(39.85 KB, patch)
2011-12-19 08:38 PST
,
Eric Carlson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Eric Carlson
Comment 1
2011-12-18 14:58:59 PST
Because of the complexity of rendering WebVTT and because the rendering section of the spec is still in flux, I think it makes sense to implement a simple text track renderer using default positioning and style only. FWIW, this is the approach that Microsoft has taken for the beta (at least) of IE 10.
Eric Carlson
Comment 2
2011-12-18 15:52:32 PST
<
rdar://problem/10320025
>
Eric Carlson
Comment 3
2011-12-18 16:20:22 PST
Created
attachment 119786
[details]
Proposed patch
WebKit Review Bot
Comment 4
2011-12-18 16:21:33 PST
Attachment 119786
[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/html/shadow/MediaControlElements.h:500: The parameter name "arena" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 15 files If any of these errors are false positives, please file a bug against check-webkit-style.
WebKit Review Bot
Comment 5
2011-12-18 16:42:40 PST
Comment on
attachment 119786
[details]
Proposed patch
Attachment 119786
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/10933352
Sam Weinig
Comment 6
2011-12-18 16:59:21 PST
Comment on
attachment 119786
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=119786&action=review
r- due to using innerHTML. We should at the very least have tests which show the effect of using it.
> Source/WebCore/html/HTMLMediaElement.cpp:1007 > + HTMLTrackElement* trackElement; > + for (Node* node = firstChild(); node; node = node->nextSibling()) { > + if (!node->hasTagName(trackTag)) > + continue; > + trackElement = static_cast<HTMLTrackElement*>(node); > + if (trackElement->track() != track) > + continue;
I don't think it is necessary to have the trackElement outside of the loop.
> Source/WebCore/html/HTMLMediaElement.h:70 > +typedef PODIntervalTree <double, TextTrackCue*> CueIntervalTree;
Don't want the space after PODIntervalTree.
> Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:379 > + StringBuilder cues; > + for (size_t i = 0; i < visibleCues.size(); ++i) { > + if (i > 0 && cues.length()) > + cues.append("<br>"); > + > + TextTrackCue* cue = visibleCues[i].data(); > + ASSERT(cue->isActive()); > + if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) > + continue; > + > + cues.append(cue->getCueAsSource()); > + } > + > + ExceptionCode e; > + m_textTrackDisplay->setInnerHTML(cues.toString(), e); > + if (cues.length()) > + m_textDisplayContainer->show(); > + else > + m_textDisplayContainer->hide();
I think it would be nicer/safer to use programatic DOM APIs (appendChild, etc) instead of building a string and using innerHTML. If you do need to parse the cues as HTML, I would recommend doing it one cue at a time and not as a concatenated string.
Eric Carlson
Comment 7
2011-12-18 18:34:44 PST
Created
attachment 119795
[details]
Updated patch
Eric Carlson
Comment 8
2011-12-18 18:35:26 PST
(In reply to
comment #6
)
> (From update of
attachment 119786
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=119786&action=review
> > r- due to using innerHTML. We should at the very least have tests which show the effect of using it. > > > Source/WebCore/html/HTMLMediaElement.cpp:1007 > > + HTMLTrackElement* trackElement; > > + for (Node* node = firstChild(); node; node = node->nextSibling()) { > > + if (!node->hasTagName(trackTag)) > > + continue; > > + trackElement = static_cast<HTMLTrackElement*>(node); > > + if (trackElement->track() != track) > > + continue; > > I don't think it is necessary to have the trackElement outside of the loop. >
Fixed.
> > Source/WebCore/html/HTMLMediaElement.h:70 > > +typedef PODIntervalTree <double, TextTrackCue*> CueIntervalTree; > > Don't want the space after PODIntervalTree. >
Fixed.
> > Source/WebCore/html/shadow/MediaControlRootElementChromium.cpp:379 > > + StringBuilder cues; > > + for (size_t i = 0; i < visibleCues.size(); ++i) { > > + if (i > 0 && cues.length()) > > + cues.append("<br>"); > > + > > + TextTrackCue* cue = visibleCues[i].data(); > > + ASSERT(cue->isActive()); > > + if (!cue->track() || cue->track()->mode() != TextTrack::SHOWING) > > + continue; > > + > > + cues.append(cue->getCueAsSource()); > > + } > > + > > + ExceptionCode e; > > + m_textTrackDisplay->setInnerHTML(cues.toString(), e); > > + if (cues.length()) > > + m_textDisplayContainer->show(); > > + else > > + m_textDisplayContainer->hide(); > > I think it would be nicer/safer to use programatic DOM APIs (appendChild, etc) instead of building a string and using innerHTML. If you do need to parse the cues as HTML, I would recommend doing it one cue at a time and not as a concatenated string.
Fixed. Thanks!
WebKit Review Bot
Comment 9
2011-12-18 18:57:08 PST
Comment on
attachment 119795
[details]
Updated patch
Attachment 119795
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/10935368
Sam Weinig
Comment 10
2011-12-18 20:38:56 PST
Comment on
attachment 119795
[details]
Updated patch View in context:
https://bugs.webkit.org/attachment.cgi?id=119795&action=review
r=me, but please consider adding a test with tags in the content. (Also, make sure all the parts of the test are there.)
> LayoutTests/media/track/track-cue-rendering.html:65 > + testTrack = document.querySelectorAll('track')[0];
Nit: This could just use querySelector('track') if you so felt.
Eric Carlson
Comment 11
2011-12-18 20:55:03 PST
Created
attachment 119806
[details]
Updated, one more time.
Eric Carlson
Comment 12
2011-12-18 20:59:35 PST
Comment on
attachment 119806
[details]
Updated, one more time. Remove r? because Sam already r+'d the previous version. This one is just so the ews bots can tell me if the Chromium specific code compiles.
WebKit Review Bot
Comment 13
2011-12-18 21:11:35 PST
Comment on
attachment 119806
[details]
Updated, one more time.
Attachment 119806
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/10932449
Eric Carlson
Comment 14
2011-12-18 22:59:59 PST
Created
attachment 119820
[details]
One more patch for the EWS bot
WebKit Review Bot
Comment 15
2011-12-18 23:05:26 PST
Comment on
attachment 119820
[details]
One more patch for the EWS bot
Attachment 119820
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/10921510
Eric Carlson
Comment 16
2011-12-18 23:10:43 PST
Created
attachment 119822
[details]
YAP
WebKit Review Bot
Comment 17
2011-12-19 08:23:22 PST
Comment on
attachment 119822
[details]
YAP
Attachment 119822
[details]
did not pass chromium-ews (chromium-xvfb): Output:
http://queues.webkit.org/results/10942012
Eric Carlson
Comment 18
2011-12-19 08:38:00 PST
Created
attachment 119867
[details]
Updated patch Updated to fix a problem the Chromium EWS bot found.
Eric Carlson
Comment 19
2011-12-19 09:26:07 PST
http://trac.webkit.org/changeset/103242
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug