Commit e2ae3748 authored by eric.carlson@apple.com's avatar eric.carlson@apple.com
Browse files

[Mac] some track language tags are not recognized

https://bugs.webkit.org/show_bug.cgi?id=119643

Source/WebCore: 

Reviewed by Jere Noble.

No new tests, existing tests updated.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_captionDisplayMode from settings
    if possible.
(WebCore::HTMLMediaElement::configureTextTrackGroup): Don't enable a default track when preferences
    say captions should be disabled. Don't disable an already visible track if we don't find
    a match unless preferences say captions should be disabled. m_forcedOrAutomaticSubtitleTrackLanguage ->
    m_subtitleTrackLanguage.
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): If the language of the primary
    audio track changes, only kick off a text track recalc if caption preference are set to "automatic".
* html/HTMLMediaElement.h:

* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): Initialize m_characteristicsChanged
    and m_delayCharacteristicsChangedNotification.
(WebCore::MediaPlayerPrivateAVFoundation::setHasVideo): Call characteristicsChanged.
(WebCore::MediaPlayerPrivateAVFoundation::setHasAudio): Ditto.
(WebCore::MediaPlayerPrivateAVFoundation::setHasClosedCaptions): Ditto.
(WebCore::MediaPlayerPrivateAVFoundation::characteristicsChanged): New, allows us to coalesce 
    calls to the media player when we know several characteristics may change.
(WebCore::MediaPlayerPrivateAVFoundation::setDelayCharacteristicsChangedNotification): Enable or
    disable notification delay.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:

* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Always call languageOfPrimaryAudioTrack(),
    a track may have changed so we may have a new language.
(WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack): Call [AVAssetTrack languageCode]
    if [AVAssetTrack extendedLanguageTag] returns NULL in case the media file has an old
    QuickTime language code.

LayoutTests: 

Reviewed by Jer Noble.

Explicitly set caption mode to "Automatic" so the track 'default' attribute works.

* media/track/text-track-cue-is-reachable.html: 
* media/track/text-track-is-reachable.html: 
* media/track/track-active-cues.html:
* media/track/track-cue-overlap-snap-to-lines-not-set.html:
* media/track/track-cue-rendering-horizontal.html:
* media/track/track-cue-rendering-vertical.html:
* media/track/track-kind.html:
* media/track/track-large-timestamp.html:
* media/track/track-mode.html:
* media/track/track-text-track-cue-list.html:
* media/track/track-webvtt-tc000-empty.html:
* media/track/track-webvtt-tc002-bom.html:
* media/track/track-webvtt-tc010-no-timings.html:
* media/track/track-webvtt-tc027-empty-cue.html:
* media/track/track-webvtt-tc028-unsupported-markup.html:
* media/track/track-word-breaking.html:
* media/video-test.js:
(setCaptionDisplayMode):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154527 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c7859a57
2013-08-23 Eric Carlson <eric.carlson@apple.com>
[Mac] some track language tags are not recognized
https://bugs.webkit.org/show_bug.cgi?id=119643
Reviewed by Jer Noble.
Explicitly set caption mode to "Automatic" so the track 'default' attribute works.
* media/track/text-track-cue-is-reachable.html:
* media/track/text-track-is-reachable.html:
* media/track/track-active-cues.html:
* media/track/track-cue-overlap-snap-to-lines-not-set.html:
* media/track/track-cue-rendering-horizontal.html:
* media/track/track-cue-rendering-vertical.html:
* media/track/track-kind.html:
* media/track/track-large-timestamp.html:
* media/track/track-mode.html:
* media/track/track-text-track-cue-list.html:
* media/track/track-webvtt-tc000-empty.html:
* media/track/track-webvtt-tc002-bom.html:
* media/track/track-webvtt-tc010-no-timings.html:
* media/track/track-webvtt-tc027-empty-cue.html:
* media/track/track-webvtt-tc028-unsupported-markup.html:
* media/track/track-word-breaking.html:
* media/video-test.js:
(setCaptionDisplayMode):
2013-08-23 Filip Pizlo <fpizlo@apple.com>
 
Incorrect TypedArray#set behavior
......@@ -37,6 +37,8 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -38,6 +38,8 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -39,6 +39,8 @@
video.src = findMediaFile("video", "../content/test");
}
setCaptionDisplayMode('Automatic');
</script>
</head>
......
......@@ -65,6 +65,7 @@
});
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body onload="loaded()">
......
......@@ -26,6 +26,9 @@
</script>
<script src=../video-test.js></script>
<script>
setCaptionDisplayMode('Automatic');
</script>
</head>
<body onload="loaded()">
<video>
......
......@@ -27,6 +27,9 @@
</script>
<script src=../video-test.js></script>
<script>
setCaptionDisplayMode('Automatic');
</script>
</head>
<body onload="loaded()">
<video>
......
......@@ -76,6 +76,8 @@
video.src = findMediaFile('video', '../content/counting');
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body onload="loaded()">
......
......@@ -20,6 +20,7 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -45,6 +45,8 @@
consoleWrite("<b>++ 'disabled'</b>");
setMode("disabled");
setCaptionDisplayMode('ForcedOnly');
waitForEvent('cuechange', cuechange);
video.addEventListener('playing', playing);
video.src = findMediaFile("video", "../content/test");
......@@ -86,6 +88,7 @@
}
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -31,6 +31,7 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -15,6 +15,7 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -37,6 +37,8 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -21,6 +21,7 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -15,6 +15,7 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -34,6 +34,7 @@
endTest();
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body>
......
......@@ -31,6 +31,7 @@
video.src = findMediaFile('video', '../content/test');
}
setCaptionDisplayMode('Automatic');
</script>
</head>
<body onload="loaded()">
......
......@@ -357,3 +357,12 @@ function waitForEventsAndCall(eventList, func)
eventList[i][0].addEventListener(requiredEvents[i], _eventCallback, true);
}
}
function setCaptionDisplayMode(mode)
{
if (window.internals)
internals.setCaptionDisplayMode(mode);
else
consoleWrite("<br><b>** This test only works in DRT! **<" + "/b><br>");
}
\ No newline at end of file
2013-08-23 Brent Fulgham <bfulgham@apple.com>
2013-08-23 Eric Carlson <eric.carlson@apple.com>
 
[Windows] Unreviewed build correction. Need to force environment variable
to be escaped when running nmake command.
* WebCore.vcxproj/WebCoreGenerated.make:
2013-08-23 Antti Koivisto <antti@apple.com>
Use ElementTraversal some more
https://bugs.webkit.org/show_bug.cgi?id=120226
[Mac] some track language tags are not recognized
https://bugs.webkit.org/show_bug.cgi?id=119643
 
Reviewed by Darin Adler.
Reviewed by Jere Noble.
 
More traversal with tighter typing.
No new tests, existing tests updated.
 
* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::canvasHasFallbackContent):
(WebCore::siblingWithAriaRole):
* accessibility/AccessibilityTable.cpp:
(WebCore::AccessibilityTable::isDataTable):
* css/CSSFontFaceSource.cpp:
(WebCore::CSSFontFaceSource::getFontData):
* dom/ContainerNode.cpp:
(WebCore::willRemoveChild):
* dom/ContainerNodeAlgorithms.h:
(WebCore::ChildFrameDisconnector::ChildFrameDisconnector):
(WebCore::ChildFrameDisconnector::collectFrameOwners):
(WebCore::ChildFrameDisconnector::disconnect):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::selectMediaResource):
(WebCore::HTMLMediaElement::textTrackModeChanged):
(WebCore::HTMLMediaElement::cancelPendingEventsAndCallbacks):
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::parametersForPlugin):
(WebCore::HTMLObjectElement::containsJavaApplet):
* html/HTMLParamElement.h:
(WebCore::isHTMLParamElement):
(WebCore::HTMLParamElement):
* html/HTMLSourceElement.h:
(WebCore::isHTMLSourceElement):
(WebCore::HTMLSourceElement):
* svg/SVGFontFaceElement.h:
(WebCore::isSVGFontFaceElement):
(WebCore::SVGFontFaceElement):
(WebCore::toSVGFontFaceElement):
2013-08-23 Andreas Kling <akling@apple.com>
Let Document keep its RenderView during render tree attach.
<https://webkit.org/b/120224>
Reviewed by Antti Koivisto.
Remove prehistoric code that cleared Document's renderer pointer during tree attach.
* dom/Document.cpp:
(WebCore::Document::attach):
2013-08-23 Darin Adler <darin@apple.com>
Reduce use of Node in HTMLTableRowsCollection, and use modern traversal idiom
https://bugs.webkit.org/show_bug.cgi?id=120222
Reviewed by Antti Koivisto.
* html/HTMLTableRowElement.h:
(WebCore::isHTMLTableRowElement): Added.
(WebCore::isElementOfType<HTMLTableRowElement>): Added.
(WebCore::toHTMLTableRowElement): Added.
* html/HTMLTableRowsCollection.cpp:
(WebCore::assertRowIsInTable): Refactored a bit. Changed #if as Andy Estes
requested during rewview and got rid of local variables.
(WebCore::HTMLTableRowsCollection::rowAfter): Moved a ocmment in here.
Changed code to traverse elements instead of nodes, and used the Traversal<>
template to eliminate some loops entirely.
(WebCore::HTMLTableRowsCollection::lastRow): Ditto.
(WebCore::HTMLTableRowsCollection::HTMLTableRowsCollection): Changed argument
type from Node to HTMLTableElement.
(WebCore::HTMLTableRowsCollection::create): Added an assertion for the value
of the collection type argument, and added the typecast here needed for the
change above.
(WebCore::HTMLTableRowsCollection::virtualItemAfter): Removed the assertion
here that was a subset of the assertion we now have inside the rowAfter function.
* html/HTMLTableRowsCollection.h: Added FINAL. Made single-argument constructor
explicit.
2013-08-23 Alex Christensen <achristensen@apple.com>
Re-separating Win32 and Win64 builds.
https://bugs.webkit.org/show_bug.cgi?id=120178
Reviewed by Brent Fulgham.
(WebCore::HTMLMediaElement::HTMLMediaElement): Initialize m_captionDisplayMode from settings
if possible.
(WebCore::HTMLMediaElement::configureTextTrackGroup): Don't enable a default track when preferences
say captions should be disabled. Don't disable an already visible track if we don't find
a match unless preferences say captions should be disabled. m_forcedOrAutomaticSubtitleTrackLanguage ->
m_subtitleTrackLanguage.
(WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged): If the language of the primary
audio track changes, only kick off a text track recalc if caption preference are set to "automatic".
* html/HTMLMediaElement.h:
 
* WebCore.vcxproj/WebCoreGenerated.make:
* WebCore.vcxproj/WebCoreGeneratedWinCairo.make:
Pass PlatformArchitecture as a command line parameter to bash scripts
and use PlatformArchitecture to determine which directory to delete
while cleaning (obj32 or obj64).
* WebCore.vcxproj/WebCoreGeneratedWinCairoCommon.props:
Export PlatformArchitecture to be used by make and cmd scripts.
* WebCore.vcxproj/build-generated-files.sh:
Use PlatformArchitecture from command line to determine which object directory to use (obj32 or obj64).
* WebCore.vcxproj/copyForwardingHeaders.cmd:
* WebCore.vcxproj/copyWebCoreResourceFiles.cmd:
Use PlatformArchitecture to determine which directory to copy to (obj32 or obj64).
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
(WebCore::MediaPlayerPrivateAVFoundation::MediaPlayerPrivateAVFoundation): Initialize m_characteristicsChanged
and m_delayCharacteristicsChangedNotification.
(WebCore::MediaPlayerPrivateAVFoundation::setHasVideo): Call characteristicsChanged.
(WebCore::MediaPlayerPrivateAVFoundation::setHasAudio): Ditto.
(WebCore::MediaPlayerPrivateAVFoundation::setHasClosedCaptions): Ditto.
(WebCore::MediaPlayerPrivateAVFoundation::characteristicsChanged): New, allows us to coalesce
calls to the media player when we know several characteristics may change.
(WebCore::MediaPlayerPrivateAVFoundation::setDelayCharacteristicsChangedNotification): Enable or
disable notification delay.
* platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
 
* platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::tracksChanged): Always call languageOfPrimaryAudioTrack(),
a track may have changed so we may have a new language.
(WebCore::MediaPlayerPrivateAVFoundationObjC::languageOfPrimaryAudioTrack): Call [AVAssetTrack languageCode]
if [AVAssetTrack extendedLanguageTag] returns NULL in case the media file has an old
QuickTime language code.
 
2013-08-23 Andreas Kling <akling@apple.com>
 
......@@ -340,6 +340,8 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document* docum
#if ENABLE(VIDEO_TRACK)
document->registerForCaptionPreferencesChangedCallbacks(this);
if (document->page())
m_captionDisplayMode = document->page()->group().captionPreferences()->captionDisplayMode();
#endif
}
......@@ -3213,6 +3215,7 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
Page* page = document()->page();
CaptionUserPreferences* captionPreferences = page? page->group().captionPreferences() : 0;
CaptionUserPreferences::CaptionDisplayMode displayMode = captionPreferences ? captionPreferences->captionDisplayMode() : CaptionUserPreferences::Automatic;
// First, find the track in the group that should be enabled (if any).
Vector<RefPtr<TextTrack> > currentlyEnabledTracks;
......@@ -3259,27 +3262,34 @@ void HTMLMediaElement::configureTextTrackGroup(const TrackGroup& group)
// * If the track element has a default attribute specified, and there is no other text track in the media
// element's list of text tracks whose text track mode is showing or showing by default
// Let the text track mode be showing by default.
defaultTrack = textTrack;
if (group.kind != TrackGroup::CaptionsAndSubtitles || displayMode != CaptionUserPreferences::ForcedOnly)
defaultTrack = textTrack;
}
}
if (!trackToEnable && defaultTrack)
trackToEnable = defaultTrack;
// If no track matches the user's preferred language, none was marked as 'default', and there is a forced subtitle track
// in the same language as the language of the primary audio track, enable it.
if (!trackToEnable && forcedSubitleTrack)
trackToEnable = forcedSubitleTrack;
// If no track matches, don't disable an already visible track unless preferences say they all should be off.
if (group.kind != TrackGroup::CaptionsAndSubtitles || displayMode != CaptionUserPreferences::ForcedOnly) {
if (!trackToEnable && !defaultTrack && group.visibleTrack)
trackToEnable = group.visibleTrack;
}
// If no track matches the user's preferred language and non was marked 'default', enable the first track
// because the user has explicitly stated a preference for this kind of track.
if (!trackToEnable && fallbackTrack)
trackToEnable = fallbackTrack;
if (!defaultTrack && trackToEnable && trackToEnable != fallbackTrack && m_captionDisplayMode != CaptionUserPreferences::AlwaysOn)
m_forcedOrAutomaticSubtitleTrackLanguage = trackToEnable->language();
if (trackToEnable)
m_subtitleTrackLanguage = trackToEnable->language();
else
m_forcedOrAutomaticSubtitleTrackLanguage = emptyString();
m_subtitleTrackLanguage = emptyString();
if (currentlyEnabledTracks.size()) {
for (size_t i = 0; i < currentlyEnabledTracks.size(); ++i) {
......@@ -3840,7 +3850,7 @@ void HTMLMediaElement::mediaPlayerCharacteristicChanged(MediaPlayer*)
beginProcessingMediaPlayerCallback();
#if ENABLE(VIDEO_TRACK)
if (m_forcedOrAutomaticSubtitleTrackLanguage != m_player->languageOfPrimaryAudioTrack())
if (m_captionDisplayMode == CaptionUserPreferences::Automatic && m_subtitleTrackLanguage != m_player->languageOfPrimaryAudioTrack())
markCaptionAndSubtitleTracksAsUnconfigured(AfterDelay);
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment