Bug 131311 - Use displayNameForTrack instead of textTrack->label() for captions.
Summary: Use displayNameForTrack instead of textTrack->label() for captions.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad Unspecified
: P2 Normal
Assignee: Jeremy Jones
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-04-07 12:36 PDT by Jeremy Jones
Modified: 2014-05-02 18:14 PDT (History)
8 users (show)

See Also:


Attachments
Patch (7.10 KB, patch)
2014-05-01 15:36 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch (7.51 KB, patch)
2014-05-02 10:25 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff
Patch for landing (7.51 KB, patch)
2014-05-02 14:34 PDT, Jeremy Jones
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Jones 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.
Comment 1 Radar WebKit Bug Importer 2014-04-08 09:14:14 PDT
<rdar://problem/16552360>
Comment 2 Jeremy Jones 2014-05-01 15:36:42 PDT
Created attachment 230618 [details]
Patch
Comment 3 Darin Adler 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()));
Comment 4 Jeremy Jones 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.
Comment 5 Jeremy Jones 2014-05-02 10:25:58 PDT
Created attachment 230669 [details]
Patch
Comment 6 Jeremy Jones 2014-05-02 14:34:45 PDT
Created attachment 230701 [details]
Patch for landing
Comment 7 WebKit Commit Bot 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.
Comment 8 WebKit Commit Bot 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.
Comment 9 WebKit Commit Bot 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.
Comment 10 WebKit Commit Bot 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>
Comment 11 WebKit Commit Bot 2014-05-02 18:14:13 PDT
All reviewed patches have been landed.  Closing bug.