Bug 131311

Summary: Use displayNameForTrack instead of textTrack->label() for captions.
Product: WebKit Reporter: Jeremy Jones <jeremyj-wk>
Component: MediaAssignee: Jeremy Jones <jeremyj-wk>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, eric.carlson, glenn, jer.noble, jonlee, philipj, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: iPhone / iPad   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing none

Jeremy Jones
Reported 2014-04-07 12:36:34 PDT
> > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:93 > > + legibleOptions.append(textTrack->label()); > > This is wrong, not all tracks have a label but every menu item needs to have a label. We calculate the display name in CaptionPreferences::displayNameForTrack. Probably the right thing to do here is to add a displayName method to PlatformTextTrack and have TextTrack::platformTextTrack call CaptionPreferences::displayNameForTrack.
Attachments
Patch (7.10 KB, patch)
2014-05-01 15:36 PDT, Jeremy Jones
no flags
Patch (7.51 KB, patch)
2014-05-02 10:25 PDT, Jeremy Jones
no flags
Patch for landing (7.51 KB, patch)
2014-05-02 14:34 PDT, Jeremy Jones
no flags
Radar WebKit Bug Importer
Comment 1 2014-04-08 09:14:14 PDT
Jeremy Jones
Comment 2 2014-05-01 15:36:42 PDT
Darin Adler
Comment 3 2014-05-01 16:14:52 PDT
Comment on attachment 230618 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=230618&action=review > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h:53 > + void updateLegibleOptions(); This class has a strange organization. Normally in WebKit we put the private members last and explicitly mark the section private. > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:126 > + } else if (event->type() == eventNames().addtrackEvent > + || event->type() == eventNames().removetrackEvent) I think this would read better on a single line. > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:231 > + CaptionUserPreferences* captionPreferences = m_mediaElement->document().page()->group().captionPreferences(); If this can never be null it should be a reference instead of a pointer. > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:238 > + for (unsigned i = 0, length = m_legibleTracksForMenu.size(); i < length; ++i) { > + RefPtr<TextTrack> textTrack = m_legibleTracksForMenu[i]; > + legibleOptions.append(captionPreferences->displayNameForTrack(textTrack.get())); > + } This should use a modern C++ for loop: for (auto& track : m_legibleTracksForMenu) legibleOptions.append(preferences.displayNameForTrack(track.get()));
Jeremy Jones
Comment 4 2014-05-02 10:22:23 PDT
(In reply to comment #3) > (From update of attachment 230618 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=230618&action=review > > > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h:53 > > + void updateLegibleOptions(); > > This class has a strange organization. Normally in WebKit we put the private members last and explicitly mark the section private. Reordered. > > > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:126 > > + } else if (event->type() == eventNames().addtrackEvent > > + || event->type() == eventNames().removetrackEvent) > > I think this would read better on a single line. Joined. > > > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:231 > > + CaptionUserPreferences* captionPreferences = m_mediaElement->document().page()->group().captionPreferences(); > > If this can never be null it should be a reference instead of a pointer. Changed to reference. > > > Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm:238 > > + for (unsigned i = 0, length = m_legibleTracksForMenu.size(); i < length; ++i) { > > + RefPtr<TextTrack> textTrack = m_legibleTracksForMenu[i]; > > + legibleOptions.append(captionPreferences->displayNameForTrack(textTrack.get())); > > + } > > This should use a modern C++ for loop: > > for (auto& track : m_legibleTracksForMenu) > legibleOptions.append(preferences.displayNameForTrack(track.get())); Modernized.
Jeremy Jones
Comment 5 2014-05-02 10:25:58 PDT
Jeremy Jones
Comment 6 2014-05-02 14:34:45 PDT
Created attachment 230701 [details] Patch for landing
WebKit Commit Bot
Comment 7 2014-05-02 14:42:41 PDT
Comment on attachment 230701 [details] Patch for landing Rejecting attachment 230701 [details] from commit-queue. jeremyj-wk@apple.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
WebKit Commit Bot
Comment 8 2014-05-02 15:59:07 PDT
Comment on attachment 230701 [details] Patch for landing Rejecting attachment 230701 [details] from commit-queue. jeremyj-wk@apple.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
WebKit Commit Bot
Comment 9 2014-05-02 16:26:03 PDT
Comment on attachment 230701 [details] Patch for landing Rejecting attachment 230701 [details] from commit-queue. jeremyj-wk@apple.com does not have committer permissions according to http://trac.webkit.org/browser/trunk/Tools/Scripts/webkitpy/common/config/contributors.json. - If you do not have committer rights please read http://webkit.org/coding/contributing.html for instructions on how to use bugzilla flags. - If you have committer rights please correct the error in Tools/Scripts/webkitpy/common/config/contributors.json by adding yourself to the file (no review needed). The commit-queue restarts itself every 2 hours. After restart the commit-queue will correctly respect your committer rights.
WebKit Commit Bot
Comment 10 2014-05-02 18:14:09 PDT
Comment on attachment 230701 [details] Patch for landing Clearing flags on attachment: 230701 Committed r168216: <http://trac.webkit.org/changeset/168216>
WebKit Commit Bot
Comment 11 2014-05-02 18:14:13 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.