[Automake] Add missing $(feature_defines) when generating InjectedBundle bindings
https://bugs.webkit.org/show_bug.cgi?id=128170

Patch by Carlos Garnacho <carlosg@gnome.org> on 2014-02-04
Reviewed by Carlos Garcia Campos.

* WebKitTestRunner/GNUmakefile.am: Add missing $(feature_defines) when
generating the InjectedBundle bindings. So the various ENABLE_* defines
are available there.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163375 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Refine MediaSession interruptions
https://bugs.webkit.org/show_bug.cgi?id=128125

Reviewed by Jer Noble.

Source/WebCore: 

Test: media/video-background-playback.html

* WebCore.exp.in: Export applicationWillEnterForeground and applicationWillEnterBackground for
    Internals.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::play): Ask the media session if playback is allowed instead of check
    to see if it is interrupted directly.
(WebCore::HTMLMediaElement::pause): Ask the media session if pausing is allowed instead of check
    to see if it is interrupted directly.
(WebCore::HTMLMediaElement::mediaType): Return media type based on media characteristics once
    the information is available.
(WebCore::HTMLMediaElement::resumePlayback): New.
* html/HTMLMediaElement.h:

* html/HTMLMediaSession.cpp:
(WebCore::restrictionName): New, use for logging only.
(WebCore::HTMLMediaSession::addBehaviorRestriction): Log  restriction changes.
(WebCore::HTMLMediaSession::removeBehaviorRestriction): Ditto.
* html/HTMLMediaSession.h:

* platform/audio/MediaSession.cpp:
(WebCore::stateName): New, used for logging.
(WebCore::MediaSession::MediaSession): Don't cache client media type because it can change.
(WebCore::MediaSession::setState): Log state changes.
(WebCore::MediaSession::beginInterruption): Remember the current state in case we want to use it
    to restore state when the interruption ends.
(WebCore::MediaSession::endInterruption): Resume playback if appropriate.
(WebCore::MediaSession::clientWillBeginPlayback): Track the client's playback state.
(WebCore::MediaSession::clientWillPausePlayback): Ditto.
(WebCore::MediaSession::mediaType): Ask client for state.
* platform/audio/MediaSession.h:

* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::MediaSessionManager): m_interruptions -> m_interrupted.
(WebCore::MediaSessionManager::beginInterruption): Don't assume interruptions are always balanced.
(WebCore::MediaSessionManager::endInterruption): Ditto.
(WebCore::MediaSessionManager::addSession): 
(WebCore::MediaSessionManager::applicationWillEnterBackground): Interrupt client if it is not
    allowed to play in the background.
(WebCore::MediaSessionManager::applicationWillEnterForeground): End client interruption if it
    was stopped by an interruption.
* platform/audio/MediaSessionManager.h:

* platform/audio/ios/MediaSessionManagerIOS.h:
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::~MediaSessionManageriOS): Clear the helper callback.
(WebCore::MediaSessionManageriOS::resetRestrictions): Mark video as not allowed to play
    while the application is in the background. Register for application suspend/resume
    notifications.
(-[WebMediaSessionHelper clearCallback]): Set _callback to nil.
(-[WebMediaSessionHelper applicationWillEnterForeground:]): New, notify client of application 
    state change.
(-[WebMediaSessionHelper applicationWillResignActive:]): Ditto.

* platform/audio/mac/AudioDestinationMac.h: Add resumePlayback.

* testing/Internals.cpp:
(WebCore::Internals::applicationWillEnterForeground): New, simulate application context switch.
(WebCore::Internals::applicationWillEnterBackground): Ditto.
(WebCore::Internals::setMediaSessionRestrictions): Add "BackgroundPlaybackNotPermitted" restriction.
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit: 

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Export applicationWillEnterForeground
    and applicationWillEnterBackground for Internals.

LayoutTests: 

* media/video-background-playback-expected.txt: Added.
* media/video-background-playback.html: Added.
* media/video-interruption-active-when-element-created-expected.txt: Removed.
* media/video-interruption-active-when-element-created.html: Removed.
* media/video-interruption-with-resume-allowing-play-expected.txt:
* media/video-interruption-with-resume-allowing-play.html:
* media/video-interruption-with-resume-not-allowing-play-expected.txt:
* media/video-interruption-with-resume-not-allowing-play.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163376 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Unreviewed, rolling out r163376.
http://trac.webkit.org/changeset/163376
https://bugs.webkit.org/show_bug.cgi?id=128184

Unexpected test failures. (Requested by eric_carlson on
#webkit).

Source/WebCore:

* WebCore.exp.in:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::parseAttribute):
* html/HTMLMediaElement.h:
* html/HTMLMediaSession.cpp:
(WebCore::HTMLMediaSession::addBehaviorRestriction):
(WebCore::HTMLMediaSession::removeBehaviorRestriction):
(WebCore::HTMLMediaSession::clientWillBeginPlayback):
* html/HTMLMediaSession.h:
* platform/audio/MediaSession.cpp:
(WebCore::MediaSession::MediaSession):
(WebCore::MediaSession::beginInterruption):
(WebCore::MediaSession::endInterruption):
* platform/audio/MediaSession.h:
(WebCore::MediaSession::mediaType):
(WebCore::MediaSession::setState):
(WebCore::MediaSessionClient::beginInterruption):
(WebCore::MediaSessionClient::endInterruption):
* platform/audio/MediaSessionManager.cpp:
(WebCore::MediaSessionManager::MediaSessionManager):
(WebCore::MediaSessionManager::beginInterruption):
(WebCore::MediaSessionManager::endInterruption):
(WebCore::MediaSessionManager::addSession):
* platform/audio/MediaSessionManager.h:
* platform/audio/ios/MediaSessionManagerIOS.h:
(WebCore::MediaSessionManageriOS::~MediaSessionManageriOS):
* platform/audio/ios/MediaSessionManagerIOS.mm:
(WebCore::MediaSessionManageriOS::resetRestrictions):
(-[WebMediaSessionHelper initWithCallback:]):
* platform/audio/mac/AudioDestinationMac.h:
* testing/Internals.cpp:
(WebCore::Internals::setMediaSessionRestrictions):
* testing/Internals.h:
* testing/Internals.idl:

Source/WebKit:

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in:

LayoutTests:

* media/video-background-playback-expected.txt: Removed.
* media/video-background-playback.html: Removed.
* media/video-interruption-active-when-element-created-expected.txt: Copied from LayoutTests/media/video-interruption-with-resume-allowing-play-expected.txt.
* media/video-interruption-active-when-element-created.html: Copied from LayoutTests/media/video-interruption-with-resume-not-allowing-play.html.
* media/video-interruption-with-resume-allowing-play-expected.txt:
* media/video-interruption-with-resume-allowing-play.html:
* media/video-interruption-with-resume-not-allowing-play-expected.txt:
* media/video-interruption-with-resume-not-allowing-play.html:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163377 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Manage RuleSet and RuleData classes through std::unique_ptr instead of OwnPtr
https://bugs.webkit.org/show_bug.cgi?id=128116

Reviewed by Darin Adler.

Replace uses of OwnPtr for the RuleSet and RuleData classes with std::unique_ptr.

* css/CSSDefaultStyleSheets.cpp:
(WebCore::CSSDefaultStyleSheets::loadFullDefaultStyle):
(WebCore::CSSDefaultStyleSheets::loadSimpleDefaultStyle):
(WebCore::CSSDefaultStyleSheets::viewSourceStyle):
* css/DocumentRuleSets.cpp:
(WebCore::DocumentRuleSets::initUserStyle):
(WebCore::makeRuleSet):
(WebCore::DocumentRuleSets::resetAuthorStyle):
* css/DocumentRuleSets.h:
* css/RuleSet.cpp:
(WebCore::RuleSet::addToRuleSet):
(WebCore::RuleSet::addRegionRule):
* css/RuleSet.h:
(WebCore::RuleSet::RuleSetSelectorPair::RuleSetSelectorPair):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@163378 268f45cc-cd09-0410-ab3c-d52691b4dbfc
[CMAKE] Remove workaround for GCC 4.6
https://bugs.webkit.org/show_bug.cgi?id=128176

Reviewed by Csaba Osztrogonác.

Since r162126, WebKit requires at least 4.7.

* CMakeLists.txt:


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