Diff
Modified: trunk/Source/WebCore/ChangeLog (217790 => 217791)
--- trunk/Source/WebCore/ChangeLog 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/ChangeLog 2017-06-05 20:29:24 UTC (rev 217791)
@@ -1,3 +1,49 @@
+2017-06-05 Beth Dakin <[email protected]>
+
+ Modify Netflix controlsManager quirk to prevent only scrubbing
+ https://bugs.webkit.org/show_bug.cgi?id=172881
+ -and corresponding-
+ rdar://problem/32228660
+
+ Reviewed by Andy Estes.
+
+ Instead of preventing Netflix from getting a controlsManager at all, this patch
+ ONLY prevents touch bar scrubbing from working. This means that Netflix will now
+ get controls in the TouchBar, it means that the play/pause and PiP buttons will be
+ functional, and it means that the timeline will accurately represent the current
+ time, BUT users will not be able to use the timeline to scrub the video. This also
+ allows Netflix to work with other MediaRemote clients such as AirPods.
+
+ Remove the quirk code from here, since this is no longer the right place to test
+ if the MediaElement is hosted at Netflix.
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager):
+ (WebCore::needsPlaybackControlsManagerQuirk): Deleted.
+
+ Pass around a new bool allowsTouchBarScrubbing.
+ * platform/cocoa/WebPlaybackSessionModel.h:
+ (WebCore::WebPlaybackSessionModelClient::allowsTouchBarScrubbingChanged):
+ * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
+
+ Here’s where we check if we need quirky behavior.
+ * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
+ (WebCore::WebPlaybackSessionModelMediaElement::updateForEventName):
+ (WebCore::WebPlaybackSessionModelMediaElement::allowsTouchBarScrubbing):
+
+ Return the bool we have plumbed through tracking whether the current site
+ allowsTouchBarScrubbing from the existing delegate method
+ canBeginTouchBarScrubbing. We will always return NO for video elements on Netflix,
+ and this will prevent users from be able to scrub with the TouchBar on Netflix.
+ * platform/mac/WebPlaybackControlsManager.h:
+ * platform/mac/WebPlaybackControlsManager.mm:
+ (-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
+
+ More plumbing.
+ * platform/mac/WebPlaybackSessionInterfaceMac.h:
+ * platform/mac/WebPlaybackSessionInterfaceMac.mm:
+ (WebCore::WebPlaybackSessionInterfaceMac::allowsTouchBarScrubbingChanged):
+ (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
+
2017-06-05 Carlos Garcia Campos <[email protected]>
[GStreamer] Deadlock in MediaPlayerPrivateGStreamer::changePipelineState, web process often locks up on seeking in a youtube video that has already fully buffered
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (217790 => 217791)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2017-06-05 20:29:24 UTC (rev 217791)
@@ -606,19 +606,6 @@
return loader && loader->allowsAutoplayQuirks();
}
-static bool needsPlaybackControlsManagerQuirk(Page& page)
-{
- if (!page.settings().needsSiteSpecificQuirks())
- return false;
-
- auto* document = page.mainFrame().document();
- if (!document)
- return false;
-
- String host = document->url().host();
- return equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com");
-}
-
HTMLMediaElement* HTMLMediaElement::bestMediaElementForShowingPlaybackControlsManager(MediaElementSession::PlaybackControlsPurpose purpose)
{
auto allSessions = PlatformMediaSessionManager::sharedManager().currentSessionsMatching([] (const PlatformMediaSession& session) {
@@ -643,15 +630,7 @@
if (!strongestSessionCandidate.isVisibleInViewportOrFullscreen && !strongestSessionCandidate.isPlayingAudio && atLeastOneNonCandidateMayBeConfusedForMainContent)
return nullptr;
- HTMLMediaElement* strongestElementCandidate = &strongestSessionCandidate.session->element();
- if (strongestElementCandidate) {
- if (Page* page = strongestElementCandidate->document().page()) {
- if (needsPlaybackControlsManagerQuirk(*page))
- return nullptr;
- }
- }
-
- return strongestElementCandidate;
+ return &strongestSessionCandidate.session->element();
}
void HTMLMediaElement::registerWithDocument(Document& document)
Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h (217790 => 217791)
--- trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h 2017-06-05 20:29:24 UTC (rev 217791)
@@ -78,6 +78,7 @@
virtual String externalPlaybackLocalizedDeviceName() const = 0;
virtual bool wirelessVideoPlaybackDisabled() const = 0;
virtual bool isMuted() const = 0;
+ virtual bool allowsTouchBarScrubbing() const = 0;
};
class WebPlaybackSessionModelClient {
@@ -97,6 +98,7 @@
virtual void externalPlaybackChanged(bool /* enabled */, WebPlaybackSessionModel::ExternalPlaybackTargetType, const String& /* localizedDeviceName */) { }
virtual void wirelessVideoPlaybackDisabledChanged(bool) { }
virtual void mutedChanged(bool) { }
+ virtual void allowsTouchBarScrubbingChanged(bool) { }
};
}
Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h (217790 => 217791)
--- trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h 2017-06-05 20:29:24 UTC (rev 217791)
@@ -89,6 +89,7 @@
String externalPlaybackLocalizedDeviceName() const final;
bool wirelessVideoPlaybackDisabled() const final;
bool isMuted() const final;
+ bool allowsTouchBarScrubbing() const final;
protected:
WEBCORE_EXPORT WebPlaybackSessionModelMediaElement();
Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm (217790 => 217791)
--- trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm 2017-06-05 20:29:24 UTC (rev 217791)
@@ -35,10 +35,12 @@
#import "HTMLElement.h"
#import "HTMLMediaElement.h"
#import "Logging.h"
+#import "MainFrame.h"
#import "MediaControlsHost.h"
#import "MediaSelectionOption.h"
#import "Page.h"
#import "PageGroup.h"
+#import "Settings.h"
#import "SoftLinking.h"
#import "TextTrackList.h"
#import "TimeRanges.h"
@@ -170,6 +172,11 @@
for (auto client : m_clients)
client->mutedChanged(isMuted());
}
+
+ if (all) {
+ for (auto client : m_clients)
+ client->allowsTouchBarScrubbingChanged(allowsTouchBarScrubbing());
+ }
}
void WebPlaybackSessionModelMediaElement::addClient(WebPlaybackSessionModelClient& client)
{
@@ -506,6 +513,26 @@
return m_mediaElement ? m_mediaElement->muted() : false;
}
+bool WebPlaybackSessionModelMediaElement::allowsTouchBarScrubbing() const
+{
+ if (!m_mediaElement)
+ return false;
+
+ Page* page = m_mediaElement->document().page();
+ if (!page)
+ return false;
+
+ auto* document = page->mainFrame().document();
+ if (!document)
+ return false;
+
+ if (!page->settings().needsSiteSpecificQuirks())
+ return true;
+
+ String host = document->url().host();
+ return !(equalLettersIgnoringASCIICase(host, "netflix.com") || host.endsWithIgnoringASCIICase(".netflix.com"));
}
+}
+
#endif
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (217790 => 217791)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2017-06-05 20:29:24 UTC (rev 217791)
@@ -166,6 +166,7 @@
bool wirelessVideoPlaybackDisabled() const override;
void togglePictureInPicture() override { }
void toggleMuted() override;
+ bool allowsTouchBarScrubbing() const override { return false; }
// WebPlaybackSessionModelClient
void durationChanged(double) override;
Modified: trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h (217790 => 217791)
--- trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.h 2017-06-05 20:29:24 UTC (rev 217791)
@@ -51,6 +51,7 @@
RetainPtr<AVTouchBarMediaSelectionOption> _currentLegibleTouchBarMediaSelectionOption;
float _rate;
BOOL _canTogglePlayback;
+ BOOL _allowsTouchBarScrubbing;
RefPtr<WebCore::WebPlaybackSessionInterfaceMac> _webPlaybackSessionInterfaceMac;
}
@@ -68,6 +69,7 @@
@property BOOL allowsPictureInPicturePlayback;
@property (getter=isPictureInPictureActive) BOOL pictureInPictureActive;
@property BOOL canTogglePictureInPicture;
+@property BOOL allowsTouchBarScrubbing;
- (AVTouchBarMediaSelectionOption *)currentAudioTouchBarMediaSelectionOption;
- (void)setCurrentAudioTouchBarMediaSelectionOption:(AVTouchBarMediaSelectionOption *)option;
Modified: trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm (217790 => 217791)
--- trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm 2017-06-05 20:29:24 UTC (rev 217791)
@@ -56,6 +56,7 @@
@synthesize allowsPictureInPicturePlayback;
@synthesize pictureInPictureActive;
@synthesize canTogglePictureInPicture;
+@synthesize allowsTouchBarScrubbing=_allowsTouchBarScrubbing;
- (void)dealloc
{
@@ -116,10 +117,11 @@
- (BOOL)canBeginTouchBarScrubbing
{
- // It's not ideal to return YES all the time here. The intent of the API is that we return NO when the
- // media is being scrubbed via the on-screen scrubber. But we can only possibly get the right answer for
- // media that uses the default controls.
- return YES;
+ // At this time, _allowsTouchBarScrubbing is always YES except for Netflix, which requires a quirk to
+ // disable scrubbing. It's not ideal to return YES for all other media. The intent of the API is that
+ // we return NO when the media is being scrubbed via the on-screen scrubber. But we can only possibly
+ // get the right answer for media that uses the default controls.
+ return _allowsTouchBarScrubbing;
}
- (void)beginTouchBarScrubbing
Modified: trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h (217790 => 217791)
--- trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.h 2017-06-05 20:29:24 UTC (rev 217791)
@@ -62,6 +62,7 @@
WEBCORE_EXPORT void audioMediaSelectionIndexChanged(uint64_t) final;
WEBCORE_EXPORT void legibleMediaSelectionIndexChanged(uint64_t) final;
WEBCORE_EXPORT void externalPlaybackChanged(bool /* enabled */, WebPlaybackSessionModel::ExternalPlaybackTargetType, const String& /* localizedDeviceName */) final;
+ WEBCORE_EXPORT void allowsTouchBarScrubbingChanged(bool allowsTouchBarScrubbing) final;
WEBCORE_EXPORT void invalidate();
WEBCORE_EXPORT void ensureControlsManager();
Modified: trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm (217790 => 217791)
--- trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm 2017-06-05 20:29:24 UTC (rev 217791)
@@ -186,6 +186,15 @@
#endif
}
+void WebPlaybackSessionInterfaceMac::allowsTouchBarScrubbingChanged(bool allowsTouchBarScrubbing)
+{
+#if ENABLE(WEB_PLAYBACK_CONTROLS_MANAGER)
+ [playBackControlsManager() setAllowsTouchBarScrubbing:allowsTouchBarScrubbing];
+#else
+ UNUSED_PARAM(allowsTouchBarScrubbing);
+#endif
+}
+
void WebPlaybackSessionInterfaceMac::invalidate()
{
if (!m_playbackSessionModel)
@@ -228,6 +237,7 @@
manager.playing = m_playbackSessionModel->isPlaying();
[manager setAudioMediaSelectionOptions:m_playbackSessionModel->audioMediaSelectionOptions() withSelectedIndex:static_cast<NSUInteger>(m_playbackSessionModel->audioMediaSelectedIndex())];
[manager setLegibleMediaSelectionOptions:m_playbackSessionModel->legibleMediaSelectionOptions() withSelectedIndex:static_cast<NSUInteger>(m_playbackSessionModel->legibleMediaSelectedIndex())];
+ manager.allowsTouchBarScrubbing = m_playbackSessionModel->allowsTouchBarScrubbing();
}
void WebPlaybackSessionInterfaceMac::updatePlaybackControlsManagerTiming(double currentTime, double anchorTime, double playbackRate, bool isPlaying)
Modified: trunk/Source/WebKit2/ChangeLog (217790 => 217791)
--- trunk/Source/WebKit2/ChangeLog 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebKit2/ChangeLog 2017-06-05 20:29:24 UTC (rev 217791)
@@ -1,3 +1,24 @@
+2017-06-05 Beth Dakin <[email protected]>
+
+ Modify Netflix controlsManager quirk to prevent only scrubbing
+ https://bugs.webkit.org/show_bug.cgi?id=172881
+ -and corresponding-
+ rdar://problem/32228660
+
+ Reviewed by Andy Estes.
+
+ Plumbing for allowsTouchBarScrubbing. See WebCore ChangeLog for more details.
+
+ * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
+ * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in:
+ * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
+ (WebKit::WebPlaybackSessionModelContext::setAllowsTouchBarScrubbing):
+ (WebKit::WebPlaybackSessionManagerProxy::setAllowsTouchBarScrubbing):
+ * WebProcess/cocoa/WebPlaybackSessionManager.h:
+ * WebProcess/cocoa/WebPlaybackSessionManager.mm:
+ (WebKit::WebPlaybackSessionInterfaceContext::allowsTouchBarScrubbingChanged):
+ (WebKit::WebPlaybackSessionManager::allowsTouchBarScrubbingChanged):
+
2017-06-05 Carlos Garcia Campos <[email protected]>
Unreviewed. Fix GTK+ build with OpenGL disabled after r217779.
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h (217790 => 217791)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h 2017-06-05 20:29:24 UTC (rev 217791)
@@ -84,6 +84,7 @@
void setExternalPlayback(bool, WebPlaybackSessionModel::ExternalPlaybackTargetType, const String&);
void setWirelessVideoPlaybackDisabled(bool);
void setMuted(bool);
+ void setAllowsTouchBarScrubbing(bool);
private:
friend class WebVideoFullscreenModelContext;
@@ -128,6 +129,7 @@
String externalPlaybackLocalizedDeviceName() const final { return m_externalPlaybackLocalizedDeviceName; }
bool wirelessVideoPlaybackDisabled() const final { return m_wirelessVideoPlaybackDisabled; }
bool isMuted() const final { return m_muted; }
+ bool allowsTouchBarScrubbing() const final { return m_allowsTouchBarScrubbing; }
WebPlaybackSessionManagerProxy* m_manager;
uint64_t m_contextId;
@@ -151,6 +153,7 @@
String m_externalPlaybackLocalizedDeviceName;
bool m_wirelessVideoPlaybackDisabled { false };
bool m_muted { false };
+ bool m_allowsTouchBarScrubbing { true };
};
class WebPlaybackSessionManagerProxy : public RefCounted<WebPlaybackSessionManagerProxy>, private IPC::MessageReceiver {
@@ -197,6 +200,7 @@
void setRate(uint64_t contextId, bool isPlaying, double rate);
void handleControlledElementIDResponse(uint64_t, String) const;
void setMuted(uint64_t contextId, bool muted);
+ void setAllowsTouchBarScrubbing(uint64_t contextId, bool allowsTouchBarScrubbing);
// Messages to WebPlaybackSessionManager
void play(uint64_t contextId);
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in (217790 => 217791)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.messages.in 2017-06-05 20:29:24 UTC (rev 217791)
@@ -39,6 +39,7 @@
SetMuted(uint64_t contextId, bool muted);
SetUpPlaybackControlsManagerWithID(uint64_t contextId)
ClearPlaybackControlsManager()
+ SetAllowsTouchBarScrubbing(uint64_t contextId, bool allowsTouchBarScrubbing)
HandleControlledElementIDResponse(uint64_t contextId, String id)
}
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm (217790 => 217791)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm 2017-06-05 20:29:24 UTC (rev 217791)
@@ -251,6 +251,13 @@
client->mutedChanged(muted);
}
+void WebPlaybackSessionModelContext::setAllowsTouchBarScrubbing(bool allowsTouchBarScrubbing)
+{
+ m_allowsTouchBarScrubbing = allowsTouchBarScrubbing;
+ for (auto* client : m_clients)
+ client->allowsTouchBarScrubbingChanged(allowsTouchBarScrubbing);
+}
+
#pragma mark - WebPlaybackSessionManagerProxy
RefPtr<WebPlaybackSessionManagerProxy> WebPlaybackSessionManagerProxy::create(WebPageProxy& page)
@@ -432,6 +439,11 @@
ensureModel(contextId).setMuted(muted);
}
+void WebPlaybackSessionManagerProxy::setAllowsTouchBarScrubbing(uint64_t contextId, bool allowsTouchBarScrubbing)
+{
+ ensureModel(contextId).setAllowsTouchBarScrubbing(allowsTouchBarScrubbing);
+}
+
void WebPlaybackSessionManagerProxy::setDuration(uint64_t contextId, double duration)
{
ensureModel(contextId).setDuration(duration);
Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.h (217790 => 217791)
--- trunk/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.h 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.h 2017-06-05 20:29:24 UTC (rev 217791)
@@ -88,6 +88,7 @@
void externalPlaybackChanged(bool enabled, WebCore::WebPlaybackSessionModel::ExternalPlaybackTargetType, const String& localizedDeviceName) final;
void wirelessVideoPlaybackDisabledChanged(bool) final;
void mutedChanged(bool) final;
+ void allowsTouchBarScrubbingChanged(bool) final;
WebPlaybackSessionInterfaceContext(WebPlaybackSessionManager&, uint64_t contextId);
@@ -137,6 +138,7 @@
void externalPlaybackChanged(uint64_t contextId, bool enabled, WebCore::WebPlaybackSessionModel::ExternalPlaybackTargetType, String localizedDeviceName);
void wirelessVideoPlaybackDisabledChanged(uint64_t contextId, bool);
void mutedChanged(uint64_t contextId, bool);
+ void allowsTouchBarScrubbingChanged(uint64_t contextId, bool);
// Messages from WebPlaybackSessionManagerProxy
void play(uint64_t contextId);
Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm (217790 => 217791)
--- trunk/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm 2017-06-05 18:19:37 UTC (rev 217790)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebPlaybackSessionManager.mm 2017-06-05 20:29:24 UTC (rev 217791)
@@ -155,6 +155,12 @@
m_manager->mutedChanged(m_contextId, muted);
}
+void WebPlaybackSessionInterfaceContext::allowsTouchBarScrubbingChanged(bool allowsTouchBarScrubbing)
+{
+ if (m_manager)
+ m_manager->allowsTouchBarScrubbingChanged(m_contextId, allowsTouchBarScrubbing);
+}
+
#pragma mark - WebPlaybackSessionManager
Ref<WebPlaybackSessionManager> WebPlaybackSessionManager::create(WebPage& page)
@@ -369,6 +375,11 @@
m_page->send(Messages::WebPlaybackSessionManagerProxy::SetMuted(contextId, muted));
}
+void WebPlaybackSessionManager::allowsTouchBarScrubbingChanged(uint64_t contextId, bool allowsTouchBarScrubbing)
+{
+ m_page->send(Messages::WebPlaybackSessionManagerProxy::SetAllowsTouchBarScrubbing(contextId, allowsTouchBarScrubbing), m_page->pageID());
+}
+
#pragma mark Messages from WebPlaybackSessionManagerProxy:
void WebPlaybackSessionManager::play(uint64_t contextId)