[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
REGRESSION (r132545): Some PDFs generated by WebKit are blank when viewed in 
Adobe Reader
https://bugs.webkit.org/show_bug.cgi?id=120240
-and corresponding-
<rdar://problem/14634453>

Reviewed by Anders Carlsson.

Source/WebCore: 

This patch makes it so that we don’t use the infinite rect for the PDF context, 
and it adds WebCoreSystemInterface API to find out if the current content is the 
PDF context. 

* WebCore.exp.in:
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::clipOut):
* platform/mac/WebCoreSystemInterface.h:
* platform/mac/WebCoreSystemInterface.mm:

Source/WebKit/mac: 

Hook up new WebSystemInterface API to find out if the current context is the PDF 
context.

* WebCoreSupport/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

Source/WebKit2: 

Hook up new WebSystemInterface API to find out if the current context is the PDF 
context. 

* WebProcess/WebCoreSupport/mac/WebSystemInterface.mm:
(InitWebCoreSystemInterface):

WebKitLibraries: 

* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLion.a:
* libWebKitSystemInterfaceMountainLion.a:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154528 268f45cc-cd09-0410-ab3c-d52691b4dbfc
REGRESSION (r150516): Media controls are messed up on right-to-left webpages
https://bugs.webkit.org/show_bug.cgi?id=120234

Reviewed by Dan Bernstein.

Source/WebCore:

Test: media/video-rtl.html

Make the media control panel explicitly direction:ltr. The captions menu and captions
display are unaffected, so rtl content will continue to appear rtl there.

* css/mediaControls.css:
(audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel):

LayoutTests:

* media/video-rtl-expected.html: Added.
* media/video-rtl.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154529 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Rebaseline after r154518.  Also fix the test to expect "0" instead of "-0".

Reviewed by Gavin Barraclough.

* fast/js/dfg-div-by-neg1-and-then-or-zero-interesting-reg-alloc-expected.txt:
* fast/js/script-tests/dfg-div-by-neg1-and-then-or-zero-interesting-reg-alloc.js:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154530 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Simplify some Settings access where we have a Frame in reach.
<http://webkit.org/b/120239>

Reviewed by Anders Carlsson.

In three cases where we can grab at a Frame, we can reach all the way to some Settings
without having to use pointers.

* loader/FrameLoader.cpp:
(WebCore::FrameLoader::didBeginDocument):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::addToOverlapMap):
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154531 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Build fix after r154515.

* dom/ElementTraversal.h:
(WebCore::Traversal<ElementType>::firstChild):
(WebCore::Traversal<ElementType>::lastChild):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
MediaQuery::expressions() should return a reference
<https://webkit.org/b/120215>

Reviewed by Anders Carlsson.

m_expressions is never NULL so we can just return a reference.

* css/MediaList.cpp:
(WebCore::reportMediaQueryWarningIfNeeded):
* css/MediaQuery.cpp:
(WebCore::MediaQuery::MediaQuery):
* css/MediaQuery.h:
(WebCore::MediaQuery::expressions):
* css/MediaQueryEvaluator.cpp:
(WebCore::MediaQueryEvaluator::eval):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154533 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Unreviewed build correction.

* win/lib32/WebKitSystemInterface.lib: Update with new API for r132545.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154534 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Improve scrolling behavior in iTunes
https://bugs.webkit.org/show_bug.cgi?id=120241
<rdar://problem/14825344>

Reviewed by Sam Weinig.

When vertically scrolling a page with horizontally scrollable overflow areas,
vertical scroll gestures would be interrupted when wheel events with non-zero
X deltas were intercepted by the overflow areas.

Fix by storing a small history of wheel events deltas and using
it to determine of the scroll gesture is primarily vertical or horizontal.
When this is detected, avoid dispatching scroll events on the on the
non-dominant axis.

Currently this behavior is conditionalized to only apply in iTunes.

* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):
(WebCore::EventHandler::recordWheelEventDelta):
(WebCore::deltaIsPredominantlyVertical):
(WebCore::EventHandler::dominantScrollGestureDirection):
(WebCore::EventHandler::handleWheelEvent):
(WebCore::EventHandler::defaultWheelEventHandler):
* page/EventHandler.h:
* platform/RuntimeApplicationChecks.cpp:
(WebCore::applicationIsITunes):
* platform/RuntimeApplicationChecks.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154535 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[Windows] Forgot to check in the header as well!

* win/include/WebKitSystemInterface/WebKitSystemInterface.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154536 268f45cc-cd09-0410-ab3c-d52691b4dbfc