[webkit-reviews] review granted: [Bug 115043] [Mac] forced subtitle track should change when audio track language changes : [Attachment 199246] Proposed patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 23 10:36:21 PDT 2013


Jer Noble <jer.noble at apple.com> has granted Eric Carlson
<eric.carlson at apple.com>'s request for review:
Bug 115043: [Mac] forced subtitle track should change when audio track language
changes
https://bugs.webkit.org/show_bug.cgi?id=115043

Attachment 199246: Proposed patch
https://bugs.webkit.org/attachment.cgi?id=199246&action=review

------- Additional Comments from Jer Noble <jer.noble at apple.com>
View in context: https://bugs.webkit.org/attachment.cgi?id=199246&action=review


> Source/WebCore/ChangeLog:16
> +	  
(WebCore::HTMLMediaElement::markCaptionAndSubtitleTracksAsUnconfigured): Take
parameter toa allow

Nit: toa -> to

> Source/WebCore/html/HTMLMediaElement.cpp:3244
> +    if (trackToEnable && m_captionDisplayMode !=
CaptionUserPreferences::AlwaysOn && !defaultTrack && trackToEnable !=
fallbackTrack)

Can we move the "trackToEnable" checks together?  They all seem equally cheap
(i.e., pointer comparisons).  Also, should this be an else-if?

> Source/WebCore/html/HTMLMediaElement.h:557
> +    enum ReconfigureMode {
> +	   Immediately,
> +	   AfterDelay,
> +    };
> +    void markCaptionAndSubtitleTracksAsUnconfigured(ReconfigureMode);

Ooh, good use of a boolean enum!

> Source/WebCore/page/CaptionUserPreferencesMac.mm:630
> +    if ((trackHasOnlyForcedSubtitles && displayMode != ForcedOnly) ||
(displayMode == ForcedOnly && !trackHasOnlyForcedSubtitles))

Why is the trackHasOnlyForcedSubtitles check order reversed?  I mean, if you
want to go all funhouse-mirror, it should be:

if ((trackHasOnlyForcedSubtitles && displayMode != ForcedOnly) || (ForcedOnly
== displayMode && !trackHasOnlyForcedSubtitles))

:-D

Or, this could just be re-written as:

if (trackHasOnlyForcedSubtitles == (displayMode != ForcedOnly))

But if that's "too clever by half", I'd just move things around to make the two
halves more parallel:

if ((trackHasOnlyForcedSubtitles && displayMode != ForcedOnly) 
    || (!trackHasOnlyForcedSubtitles && displayMode == ForcedOnly))


More information about the webkit-reviews mailing list