Diff
Modified: trunk/Source/WebCore/ChangeLog (185476 => 185477)
--- trunk/Source/WebCore/ChangeLog 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/ChangeLog 2015-06-11 21:49:49 UTC (rev 185477)
@@ -1,3 +1,16 @@
+2015-06-11 Matt Rajca <[email protected]>
+
+ Media Session: Add plumbing for media control event delivery.
+ https://bugs.webkit.org/show_bug.cgi?id=145859
+
+ Reviewed by Anders Carlsson.
+
+ * Modules/mediasession/MediaEventTypes.h: Added.
+ * WebCore.xcodeproj/project.pbxproj:
+ * page/Page.cpp:
+ (WebCore::Page::handleMediaEvent): Toggle media playback upon receiving the PlayPause event as described in the spec.
+ * page/Page.h:
+
2015-06-11 Jon Lee <[email protected]>
Update media controls JS and CSS to use picture-in-picture
Added: trunk/Source/WebCore/Modules/mediasession/MediaEventTypes.h (0 => 185477)
--- trunk/Source/WebCore/Modules/mediasession/MediaEventTypes.h (rev 0)
+++ trunk/Source/WebCore/Modules/mediasession/MediaEventTypes.h 2015-06-11 21:49:49 UTC (rev 185477)
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MediaEventTypes_h
+#define MediaEventTypes_h
+
+#if ENABLE(MEDIA_SESSION)
+
+namespace WebCore {
+
+enum MediaEventType {
+ PlayPause,
+ TrackNext,
+ TrackPrevious
+};
+
+}
+
+#endif
+
+#endif /* MediaEventTypes_h */
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (185476 => 185477)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2015-06-11 21:49:49 UTC (rev 185477)
@@ -5702,6 +5702,7 @@
C937FE8D1B1F6821008ECC5D /* HTMLMediaElementMediaSession.h in Headers */ = {isa = PBXBuildFile; fileRef = C968B2E61B1E72F700EF1F81 /* HTMLMediaElementMediaSession.h */; };
C968B2E81B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C968B2E71B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp */; };
C9DADBCB1B1D3B97001F17D8 /* JSMediaSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */; };
+ C9F87CFE1B28F40E00979B83 /* MediaEventTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = C9F87CFD1B28E5F600979B83 /* MediaEventTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
CA3BF67C10D99BAE00E6CE53 /* ScrollAnimator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */; };
CA3BF67E10D99BAE00E6CE53 /* ScrollAnimator.h in Headers */ = {isa = PBXBuildFile; fileRef = CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */; settings = {ATTRIBUTES = (Private, ); }; };
CAE9F90F146441F000C245B0 /* CSSAspectRatioValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */; };
@@ -13276,6 +13277,7 @@
C968B2E71B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLMediaElementMediaSession.cpp; sourceTree = "<group>"; };
C9DADBC91B1D3B25001F17D8 /* JSMediaSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSMediaSession.cpp; sourceTree = "<group>"; };
C9DADBCA1B1D3B25001F17D8 /* JSMediaSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSMediaSession.h; sourceTree = "<group>"; };
+ C9F87CFD1B28E5F600979B83 /* MediaEventTypes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MediaEventTypes.h; sourceTree = "<group>"; };
CA3BF67B10D99BAE00E6CE53 /* ScrollAnimator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollAnimator.cpp; sourceTree = "<group>"; };
CA3BF67D10D99BAE00E6CE53 /* ScrollAnimator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollAnimator.h; sourceTree = "<group>"; };
CAE9F90D146441F000C245B0 /* CSSAspectRatioValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSAspectRatioValue.cpp; sourceTree = "<group>"; };
@@ -14622,6 +14624,7 @@
C968B2E71B1E778100EF1F81 /* HTMLMediaElementMediaSession.cpp */,
C968B2E61B1E72F700EF1F81 /* HTMLMediaElementMediaSession.h */,
C968B2E51B1E704500EF1F81 /* HTMLMediaElementMediaSession.idl */,
+ C9F87CFD1B28E5F600979B83 /* MediaEventTypes.h */,
C90843CD1B18E47D00B68564 /* MediaRemoteControls.cpp */,
C90843CE1B18E47D00B68564 /* MediaRemoteControls.h */,
C93458BB1B18D77E0088EE12 /* MediaRemoteControls.idl */,
@@ -25839,6 +25842,7 @@
FD6F252D13F5EF0E0065165F /* MediaElementAudioSourceNode.h in Headers */,
07FE99DD18807A7D00256648 /* MediaElementSession.h in Headers */,
E44613AD0CD6331000FADA75 /* MediaError.h in Headers */,
+ C9F87CFE1B28F40E00979B83 /* MediaEventTypes.h in Headers */,
4E1959220A39DABA00220FE5 /* MediaFeatureNames.h in Headers */,
07A6D1EC1491137700051D0C /* MediaFragmentURIParser.h in Headers */,
A8EA800E0A19516E00A8EF5F /* MediaList.h in Headers */,
Modified: trunk/Source/WebCore/page/Page.cpp (185476 => 185477)
--- trunk/Source/WebCore/page/Page.cpp 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/page/Page.cpp 2015-06-11 21:49:49 UTC (rev 185477)
@@ -110,6 +110,10 @@
#include "MediaPlaybackTarget.h"
#endif
+#if ENABLE(MEDIA_SESSION)
+#include "MediaSessionManager.h"
+#endif
+
namespace WebCore {
static HashSet<Page*>* allPages;
@@ -1227,6 +1231,19 @@
frame->document()->pageMutedStateDidChange();
}
+#if ENABLE(MEDIA_SESSION)
+void Page::handleMediaEvent(MediaEventType eventType)
+{
+ switch (eventType) {
+ case MediaEventType::PlayPause:
+ MediaSessionManager::singleton().togglePlayback();
+ break;
+ default:
+ break;
+ }
+}
+#endif
+
#if !ASSERT_DISABLED
void Page::checkSubframeCountConsistency() const
{
Modified: trunk/Source/WebCore/page/Page.h (185476 => 185477)
--- trunk/Source/WebCore/page/Page.h 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebCore/page/Page.h 2015-06-11 21:49:49 UTC (rev 185477)
@@ -54,6 +54,10 @@
#include <wtf/SchedulePair.h>
#endif
+#if ENABLE(MEDIA_SESSION)
+#include "MediaEventTypes.h"
+#endif
+
namespace JSC {
class Debugger;
}
@@ -443,6 +447,10 @@
bool isMuted() const { return m_muted; }
WEBCORE_EXPORT void setMuted(bool);
+#if ENABLE(MEDIA_SESSION)
+ WEBCORE_EXPORT void handleMediaEvent(MediaEventType);
+#endif
+
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
void addPlaybackTargetPickerClient(uint64_t);
void removePlaybackTargetPickerClient(uint64_t);
Modified: trunk/Source/WebKit2/ChangeLog (185476 => 185477)
--- trunk/Source/WebKit2/ChangeLog 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/ChangeLog 2015-06-11 21:49:49 UTC (rev 185477)
@@ -1,3 +1,21 @@
+2015-06-11 Matt Rajca <[email protected]>
+
+ Media Session: Add plumbing for media control event delivery.
+ https://bugs.webkit.org/show_bug.cgi?id=145859
+
+ Reviewed by Anders Carlsson.
+
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageHandleMediaEvent):
+ * UIProcess/API/C/WKPagePrivate.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::handleMediaEvent):
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::handleMediaEvent):
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/WebPage.messages.in:
+
2015-06-11 Myles C. Maxfield <[email protected]>
[OS X] Decoding fonts may return nil when using force click
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp (185476 => 185477)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPage.cpp 2015-06-11 21:49:49 UTC (rev 185477)
@@ -78,6 +78,10 @@
#include "WebVibrationProxy.h"
#endif
+#if ENABLE(MEDIA_SESSION)
+#include <WebCore/MediaEventTypes.h>
+#endif
+
using namespace WebCore;
using namespace WebKit;
@@ -2121,6 +2125,32 @@
toImpl(page)->setMuted(muted);
}
+void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType wkEventType)
+{
+#if ENABLE(MEDIA_SESSION)
+ MediaEventType eventType;
+
+ switch (wkEventType) {
+ case kWKMediaEventTypePlayPause:
+ eventType = MediaEventType::PlayPause;
+ break;
+ case kWKMediaEventTypeTrackNext:
+ eventType = MediaEventType::TrackNext;
+ break;
+ case kWKMediaEventTypeTrackPrevious:
+ eventType = MediaEventType::TrackPrevious;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ }
+
+ toImpl(page)->handleMediaEvent(eventType);
+#else
+ UNUSED_PARAM(page);
+ UNUSED_PARAM(wkEventType);
+#endif
+}
+
void WKPagePostMessageToInjectedBundle(WKPageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef)
{
toImpl(pageRef)->postMessageToInjectedBundle(toImpl(messageNameRef)->string(), toImpl(messageBodyRef));
Modified: trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h (185476 => 185477)
--- trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKPagePrivate.h 2015-06-11 21:49:49 UTC (rev 185477)
@@ -111,6 +111,15 @@
WK_EXPORT bool WKPageIsPlayingAudio(WKPageRef page);
WK_EXPORT void WKPageSetMuted(WKPageRef page, bool muted);
+enum {
+ kWKMediaEventTypePlayPause,
+ kWKMediaEventTypeTrackNext,
+ kWKMediaEventTypeTrackPrevious
+};
+typedef uint32_t WKMediaEventType;
+
+WK_EXPORT void WKPageHandleMediaEvent(WKPageRef page, WKMediaEventType event);
+
WK_EXPORT void WKPageLoadURLWithShouldOpenExternalURLsPolicy(WKPageRef page, WKURLRef url, bool shouldOpenExternalURLs);
#ifdef __cplusplus
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (185476 => 185477)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2015-06-11 21:49:49 UTC (rev 185477)
@@ -3774,6 +3774,16 @@
m_process->send(Messages::WebPage::SetMuted(muted), m_pageID);
}
+#if ENABLE(MEDIA_SESSION)
+void WebPageProxy::handleMediaEvent(MediaEventType eventType)
+{
+ if (!isValid())
+ return;
+
+ m_process->send(Messages::WebPage::HandleMediaEvent(eventType), m_pageID);
+}
+#endif
+
void WebPageProxy::setMayStartMediaWhenInWindow(bool mayStartMedia)
{
if (mayStartMedia == m_mayStartMediaWhenInWindow)
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (185476 => 185477)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2015-06-11 21:49:49 UTC (rev 185477)
@@ -922,6 +922,10 @@
void setMayStartMediaWhenInWindow(bool);
bool mayStartMediaWhenInWindow() const { return m_mayStartMediaWhenInWindow; }
+#if ENABLE(MEDIA_SESSION)
+ void handleMediaEvent(WebCore::MediaEventType);
+#endif
+
// WebPopupMenuProxy::Client
virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent() override;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (185476 => 185477)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-06-11 21:49:49 UTC (rev 185477)
@@ -4048,6 +4048,13 @@
m_page->setMuted(muted);
}
+#if ENABLE(MEDIA_SESSION)
+void WebPage::handleMediaEvent(uint32_t eventType)
+{
+ m_page->handleMediaEvent(static_cast<MediaEventType>(eventType));
+}
+#endif
+
void WebPage::setMayStartMediaWhenInWindow(bool mayStartMedia)
{
if (mayStartMedia == m_mayStartMediaWhenInWindow)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (185476 => 185477)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-06-11 21:49:49 UTC (rev 185477)
@@ -740,6 +740,10 @@
void setMuted(bool);
void setMayStartMediaWhenInWindow(bool);
+#if ENABLE(MEDIA_SESSION)
+ void handleMediaEvent(uint32_t /* WebCore::MediaEventType */);
+#endif
+
void updateMainFrameScrollOffsetPinning();
bool mainFrameHasCustomContentProvider() const;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (185476 => 185477)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2015-06-11 21:40:22 UTC (rev 185476)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in 2015-06-11 21:49:49 UTC (rev 185477)
@@ -314,6 +314,10 @@
SetMuted(bool muted)
SetMayStartMediaWhenInWindow(bool mayStartMedia)
+#if ENABLE(MEDIA_SESSION)
+ HandleMediaEvent(uint32_t eventType)
+#endif
+
// FIXME: This a dummy message, to avoid breaking the build for platforms that don't require
// any synchronous messages, and should be removed when <rdar://problem/8775115> is fixed.
Dummy() -> (bool dummyReturn)