Diff
Modified: trunk/Source/WebKit/ChangeLog (221488 => 221489)
--- trunk/Source/WebKit/ChangeLog 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/ChangeLog 2017-09-01 18:54:50 UTC (rev 221489)
@@ -1,5 +1,43 @@
2017-09-01 Alex Christensen <[email protected]>
+ Replace WKUIDelegatePrivate's isPlayingMediaDidChange with KVO _isPlayingAudio on WKWebView
+ https://bugs.webkit.org/show_bug.cgi?id=176212
+
+ Reviewed by Tim Horton.
+
+ Dan suggested this in bug 176203, I think it's a good idea,
+ and I'll need to add more KVO properties soon anyways so I'd better learn how.
+ Determining if audio playing changed is important for Safari, so WKPageUIClient's
+ isPlayingAudioDidChange was correctly named but incorrectly fired if either audio
+ or video playing changed and had you check if audio was playing, possibly too often.
+
+ * UIProcess/API/APIUIClient.h:
+ (API::UIClient::isPlayingMediaDidChange):
+ * UIProcess/API/C/WKPage.cpp:
+ (WKPageSetPageUIClient):
+ * UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
+ * UIProcess/API/Cocoa/WKWebView.mm:
+ (-[WKWebView _isPlayingAudio]):
+ * UIProcess/API/Cocoa/WKWebViewPrivate.h:
+ * UIProcess/API/glib/WebKitUIClient.cpp:
+ * UIProcess/Cocoa/UIDelegate.h:
+ * UIProcess/Cocoa/UIDelegate.mm:
+ (WebKit::UIDelegate::setDelegate):
+ (WebKit::UIDelegate::UIClient::isPlayingMediaDidChange): Deleted.
+ * UIProcess/Cocoa/WebViewImpl.h:
+ * UIProcess/Cocoa/WebViewImpl.mm:
+ (WebKit::WebViewImpl::isPlayingAudioWillChange):
+ (WebKit::WebViewImpl::isPlayingAudioDidChange):
+ * UIProcess/PageClient.h:
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::isPlayingMediaDidChange):
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::isPlayingAudioDidChange):
+ (WebKit::PageClientImpl::isPlayingAudioWillChange):
+
+2017-09-01 Alex Christensen <[email protected]>
+
Disable ObjC WebGL policy SPI on iOS
https://bugs.webkit.org/show_bug.cgi?id=176233
Modified: trunk/Source/WebKit/PlatformMac.cmake (221488 => 221489)
--- trunk/Source/WebKit/PlatformMac.cmake 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/PlatformMac.cmake 2017-09-01 18:54:50 UTC (rev 221489)
@@ -252,6 +252,7 @@
UIProcess/Cocoa/IconLoadingDelegate.mm
UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm
UIProcess/Cocoa/NavigationState.mm
+ UIProcess/Cocoa/PageClientImplCocoa.mm
UIProcess/Cocoa/RemoteLayerTreeScrollingPerformanceData.mm
UIProcess/Cocoa/SessionStateCoding.mm
UIProcess/Cocoa/UIDelegate.mm
Modified: trunk/Source/WebKit/UIProcess/API/APIUIClient.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/APIUIClient.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -146,7 +146,7 @@
virtual void pinnedStateDidChange(WebKit::WebPageProxy&) { }
- virtual void isPlayingMediaDidChange(WebKit::WebPageProxy&, bool) { }
+ virtual void isPlayingMediaDidChange(WebKit::WebPageProxy&) { }
virtual void mediaCaptureStateDidChange(WebCore::MediaProducer::MediaStateFlags) { }
virtual void handleAutoplayEvent(WebKit::WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) { }
Modified: trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/C/WKPage.cpp 2017-09-01 18:54:50 UTC (rev 221489)
@@ -2059,7 +2059,7 @@
m_client.pinnedStateDidChange(toAPI(&page), m_client.base.clientInfo);
}
- void isPlayingMediaDidChange(WebPageProxy& page, bool) final
+ void isPlayingMediaDidChange(WebPageProxy& page) final
{
if (!m_client.isPlayingAudioDidChange)
return;
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -149,7 +149,6 @@
- (void)_webView:(WKWebView *)webView takeFocus:(_WKFocusDirection)direction WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView didNotHandleWheelEvent:(NSEvent *)event WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView handleAutoplayEvent:(_WKAutoplayEvent)event withFlags:(_WKAutoplayEventFlags)flags WK_API_AVAILABLE(macosx(WK_MAC_TBA));
-- (void)_webView:(WKWebView *)webView isPlayingMediaDidChange:(BOOL)playingMedia WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView didClickAutoFillButtonWithUserInfo:(id <NSSecureCoding>)userInfo WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView saveDataToFile:(NSData *)data suggestedFilename:(NSString *)suggestedFilename mimeType:(NSString *)mimeType originatingURL:(NSURL *)url WK_API_AVAILABLE(macosx(WK_MAC_TBA));
- (void)_webView:(WKWebView *)webView didExceedBackgroundResourceLimitWhileInForeground:(_WKResourceLimit)limit WK_API_AVAILABLE(macosx(WK_MAC_TBA));
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2017-09-01 18:54:50 UTC (rev 221489)
@@ -4512,6 +4512,11 @@
return NO;
}
+- (BOOL)_isPlayingAudio
+{
+ return _page->isPlayingAudio();
+}
+
- (BOOL)_isShowingNavigationGestureSnapshot
{
return _page->isShowingNavigationGestureSnapshot();
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -120,6 +120,8 @@
@property (nonatomic, readonly) NSString *_MIMEType;
@property (nonatomic, readonly) NSString *_userAgent WK_API_AVAILABLE(macosx(10.11), ios(9.0));
+@property (nonatomic, readonly, getter=_isPlayingAudio) BOOL _playingAudio WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
@property (copy, setter=_setApplicationNameForUserAgent:) NSString *_applicationNameForUserAgent;
@property (copy, setter=_setCustomUserAgent:) NSString *_customUserAgent;
Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUIClient.cpp 2017-09-01 18:54:50 UTC (rev 221489)
@@ -217,7 +217,7 @@
webkitWebViewRunAsModal(m_webView);
}
- void isPlayingMediaDidChange(WebPageProxy&, bool) final
+ void isPlayingMediaDidChange(WebPageProxy&) final
{
webkitWebViewIsPlayingAudioChanged(m_webView);
}
Modified: trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/gtk/PageClientImpl.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -26,8 +26,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PageClientImpl_h
-#define PageClientImpl_h
+#pragma once
#include "DefaultUndoController.h"
#include "PageClient.h"
@@ -139,6 +138,8 @@
void derefView() override;
void didRestoreScrollPosition() override { }
+ void isPlayingAudioWillChange() final { }
+ void isPlayingAudioDidChange() final { }
#if ENABLE(VIDEO) && USE(GSTREAMER)
bool decidePolicyForInstallMissingMediaPluginsPermissionRequest(InstallMissingMediaPluginsPermissionRequest&) override;
@@ -154,5 +155,3 @@
};
} // namespace WebKit
-
-#endif // PageClientImpl_h
Modified: trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/API/wpe/PageClientImpl.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -105,6 +105,8 @@
void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) override;
void didChangeBackgroundColor() override;
+ void isPlayingAudioWillChange() final { }
+ void isPlayingAudioDidChange() final { }
void refView() override;
void derefView() override;
Added: trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm (0 => 221489)
--- trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm (rev 0)
+++ trunk/Source/WebKit/UIProcess/Cocoa/PageClientImplCocoa.mm 2017-09-01 18:54:50 UTC (rev 221489)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 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. AND ITS CONTRIBUTORS ``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 ITS 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.
+ */
+
+#import "config.h"
+#import "PageClientImpl.h"
+
+#import "PageClientImplIOS.h"
+#import "WKWebViewPrivate.h"
+
+namespace WebKit {
+
+void PageClientImpl::isPlayingAudioWillChange()
+{
+#if WK_API_ENABLED
+ [m_webView willChangeValueForKey:NSStringFromSelector(@selector(_isPlayingAudio))];
+#endif
+}
+
+void PageClientImpl::isPlayingAudioDidChange()
+{
+#if WK_API_ENABLED
+ [m_webView didChangeValueForKey:NSStringFromSelector(@selector(_isPlayingAudio))];
+#endif
+}
+
+}
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -100,7 +100,6 @@
void takeFocus(WebPageProxy*, WKFocusDirection) final;
void focus(WebPageProxy*) final;
void unfocus(WebPageProxy*) final;
- void isPlayingMediaDidChange(WebKit::WebPageProxy&, bool) final;
void didNotHandleWheelEvent(WebPageProxy*, const NativeWebWheelEvent&) final;
void handleAutoplayEvent(WebPageProxy&, WebCore::AutoplayEvent, OptionSet<WebCore::AutoplayEventFlags>) final;
void didClickAutoFillButton(WebPageProxy&, API::Object*) final;
@@ -151,7 +150,6 @@
bool unfocusWebView : 1;
bool webViewTakeFocus : 1;
bool webViewDidNotHandleWheelEvent : 1;
- bool webViewIsPlayingMediaDidChange : 1;
bool webViewHandleAutoplayEventWithFlags : 1;
bool webViewDidClickAutoFillButtonWithUserInfo : 1;
bool webViewDidExceedBackgroundResourceLimitWhileInForeground : 1;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2017-09-01 18:54:50 UTC (rev 221489)
@@ -107,7 +107,6 @@
m_delegateMethods.unfocusWebView = [delegate respondsToSelector:@selector(_unfocusWebView:)];
m_delegateMethods.webViewTakeFocus = [delegate respondsToSelector:@selector(_webView:takeFocus:)];
m_delegateMethods.webViewDidNotHandleWheelEvent = [delegate respondsToSelector:@selector(_webView:didNotHandleWheelEvent:)];
- m_delegateMethods.webViewIsPlayingMediaDidChange = [delegate respondsToSelector:@selector(_webView:isPlayingMediaDidChange:)];
m_delegateMethods.webViewHandleAutoplayEventWithFlags = [delegate respondsToSelector:@selector(_webView:handleAutoplayEvent:withFlags:)];
m_delegateMethods.webViewDidClickAutoFillButtonWithUserInfo = [delegate respondsToSelector:@selector(_webView:didClickAutoFillButtonWithUserInfo:)];
m_delegateMethods.webViewDidExceedBackgroundResourceLimitWhileInForeground = [delegate respondsToSelector:@selector(_webView:didExceedBackgroundResourceLimitWhileInForeground:)];
@@ -466,18 +465,6 @@
[(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView didNotHandleWheelEvent:event.nativeEvent()];
}
-void UIDelegate::UIClient::isPlayingMediaDidChange(WebKit::WebPageProxy&, bool isPlaying)
-{
- if (!m_uiDelegate.m_delegateMethods.webViewIsPlayingMediaDidChange)
- return;
-
- auto delegate = m_uiDelegate.m_delegate.get();
- if (!delegate)
- return;
-
- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView isPlayingMediaDidChange:isPlaying];
-}
-
static _WKAutoplayEventFlags toWKAutoplayEventFlags(OptionSet<WebCore::AutoplayEventFlags> flags)
{
_WKAutoplayEventFlags wkFlags = _WKAutoplayEventFlagsNone;
Modified: trunk/Source/WebKit/UIProcess/PageClient.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/PageClient.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/PageClient.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -344,6 +344,8 @@
virtual void didSameDocumentNavigationForMainFrame(SameDocumentNavigationType) = 0;
virtual void didChangeBackgroundColor() = 0;
+ virtual void isPlayingAudioWillChange() = 0;
+ virtual void isPlayingAudioDidChange() = 0;
#if PLATFORM(MAC)
virtual void didPerformImmediateActionHitTest(const WebHitTestResultData&, bool contentPreventsDefault, API::Object*) = 0;
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2017-09-01 18:54:50 UTC (rev 221489)
@@ -6549,26 +6549,32 @@
m_navigationClient->didRemoveNavigationGestureSnapshot(*this);
}
-void WebPageProxy::isPlayingMediaDidChange(MediaProducer::MediaStateFlags state, uint64_t sourceElementID)
+void WebPageProxy::isPlayingMediaDidChange(MediaProducer::MediaStateFlags newState, uint64_t sourceElementID)
{
#if ENABLE(MEDIA_SESSION)
WebMediaSessionFocusManager* focusManager = process().processPool().supplement<WebMediaSessionFocusManager>();
ASSERT(focusManager);
- focusManager->updatePlaybackAttributesFromMediaState(this, sourceElementID, state);
+ focusManager->updatePlaybackAttributesFromMediaState(this, sourceElementID, newState);
#endif
- if (state == m_mediaState)
+ if (newState == m_mediaState)
return;
#if ENABLE(MEDIA_STREAM)
WebCore::MediaProducer::MediaStateFlags oldMediaCaptureState = m_mediaState & WebCore::MediaProducer::MediaCaptureMask;
- WebCore::MediaProducer::MediaStateFlags newMediaCaptureState = state & WebCore::MediaProducer::MediaCaptureMask;
+ WebCore::MediaProducer::MediaStateFlags newMediaCaptureState = newState & WebCore::MediaProducer::MediaCaptureMask;
#endif
MediaProducer::MediaStateFlags playingMediaMask = MediaProducer::IsPlayingAudio | MediaProducer::IsPlayingVideo;
MediaProducer::MediaStateFlags oldState = m_mediaState;
- m_mediaState = state;
+ bool playingAudioChanges = (oldState & MediaProducer::IsPlayingAudio) != (newState & MediaProducer::IsPlayingAudio);
+ if (playingAudioChanges)
+ m_pageClient.isPlayingAudioWillChange();
+ m_mediaState = newState;
+ if (playingAudioChanges)
+ m_pageClient.isPlayingAudioDidChange();
+
#if ENABLE(MEDIA_STREAM)
if (oldMediaCaptureState != newMediaCaptureState) {
m_uiClient->mediaCaptureStateDidChange(m_mediaState);
@@ -6580,7 +6586,7 @@
playingMediaMask |= WebCore::MediaProducer::MediaCaptureMask;
if ((oldState & playingMediaMask) != (m_mediaState & playingMediaMask))
- m_uiClient->isPlayingMediaDidChange(*this, (m_mediaState & playingMediaMask));
+ m_uiClient->isPlayingMediaDidChange(*this);
#if PLATFORM(MAC)
if ((oldState & MediaProducer::HasAudioOrVideo) != (m_mediaState & MediaProducer::HasAudioOrVideo))
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -194,6 +194,8 @@
void derefView() override;
void didRestoreScrollPosition() override;
+ void isPlayingAudioWillChange() final;
+ void isPlayingAudioDidChange() final;
WebCore::UserInterfaceLayoutDirection userInterfaceLayoutDirection() override;
Modified: trunk/Source/WebKit/UIProcess/mac/PageClientImpl.h (221488 => 221489)
--- trunk/Source/WebKit/UIProcess/mac/PageClientImpl.h 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/UIProcess/mac/PageClientImpl.h 2017-09-01 18:54:50 UTC (rev 221489)
@@ -23,8 +23,7 @@
* THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PageClientImpl_h
-#define PageClientImpl_h
+#pragma once
#if PLATFORM(MAC)
@@ -90,6 +89,8 @@
void setCursor(const WebCore::Cursor&) override;
void setCursorHiddenUntilMouseMoves(bool) override;
void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
+ void isPlayingAudioWillChange() final;
+ void isPlayingAudioDidChange() final;
void registerEditCommand(Ref<WebEditCommandProxy>&&, WebPageProxy::UndoOrRedo) override;
void clearAllEditCommands() override;
@@ -258,5 +259,3 @@
} // namespace WebKit
#endif // PLATFORM(MAC)
-
-#endif // PageClientImpl_h
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (221488 => 221489)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2017-09-01 18:54:50 UTC (rev 221489)
@@ -1183,6 +1183,7 @@
5C20CBA01BB1ECD800895BB1 /* NetworkSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */; };
5C298DA01C3DF02100470AFE /* PendingDownload.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C298D9E1C3DEF2900470AFE /* PendingDownload.h */; };
5C62FDF91EFC271C00CE072E /* WKURLSchemeTaskPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 5C6CE6D11F59BC7A0007C6CB /* PageClientImplCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */; };
5C7706741D1138380012700F /* WebSocketProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C7706731D111D8B0012700F /* WebSocketProvider.cpp */; };
5C85C7881C3F23CE0061A4FA /* PendingDownload.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C85C7861C3F23C50061A4FA /* PendingDownload.cpp */; };
5C9E56821DF7F1AB00C9EE33 /* WKWebsitePolicies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C9E56801DF7F05500C9EE33 /* WKWebsitePolicies.cpp */; };
@@ -3509,6 +3510,7 @@
5C20CB9E1BB0DD1800895BB1 /* NetworkSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkSession.h; path = NetworkProcess/NetworkSession.h; sourceTree = "<group>"; };
5C298D9E1C3DEF2900470AFE /* PendingDownload.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PendingDownload.h; path = NetworkProcess/Downloads/PendingDownload.h; sourceTree = "<group>"; };
5C62FDF81EFC263C00CE072E /* WKURLSchemeTaskPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKURLSchemeTaskPrivate.h; sourceTree = "<group>"; };
+ 5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PageClientImplCocoa.mm; sourceTree = "<group>"; };
5C7706731D111D8B0012700F /* WebSocketProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebSocketProvider.cpp; path = Network/WebSocketProvider.cpp; sourceTree = "<group>"; };
5C7C88DC1D0F41A0009D2F6D /* WebSocketProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebSocketProvider.h; path = Network/WebSocketProvider.h; sourceTree = "<group>"; };
5C85C7861C3F23C50061A4FA /* PendingDownload.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PendingDownload.cpp; path = NetworkProcess/Downloads/PendingDownload.cpp; sourceTree = "<group>"; };
@@ -5273,6 +5275,7 @@
7A821F4D1E2F679E00604577 /* LegacyCustomProtocolManagerClient.mm */,
1ABC3DF41899E437004F0626 /* NavigationState.h */,
1ABC3DF31899E437004F0626 /* NavigationState.mm */,
+ 5C6CE6D01F59BC460007C6CB /* PageClientImplCocoa.mm */,
CDA29A1E1CBEB5FB00901CCF /* PlaybackSessionManagerProxy.h */,
CDA29A221CBEB61A00901CCF /* PlaybackSessionManagerProxy.messages.in */,
CDA29A1F1CBEB5FB00901CCF /* PlaybackSessionManagerProxy.mm */,
@@ -10200,6 +10203,7 @@
7C387434172F5615001BD88A /* PageBanner.cpp in Sources */,
7C6D37FC172F555F009D2847 /* PageBannerMac.mm in Sources */,
0FCB4E6318BBE3D9000FCFC9 /* PageClientImpl.mm in Sources */,
+ 5C6CE6D11F59BC7A0007C6CB /* PageClientImplCocoa.mm in Sources */,
0FCB4E4718BBE044000FCFC9 /* PageClientImplIOS.mm in Sources */,
1AC7537B183A9FDB0072CB15 /* PageLoadState.cpp in Sources */,
C574A58212E66681002DFE98 /* PasteboardTypes.mm in Sources */,
Modified: trunk/Tools/ChangeLog (221488 => 221489)
--- trunk/Tools/ChangeLog 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Tools/ChangeLog 2017-09-01 18:54:50 UTC (rev 221489)
@@ -1,3 +1,15 @@
+2017-09-01 Alex Christensen <[email protected]>
+
+ Replace WKUIDelegatePrivate's isPlayingMediaDidChange with KVO _isPlayingAudio on WKWebView
+ https://bugs.webkit.org/show_bug.cgi?id=176212
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm:
+ (-[AudioObserver observeValueForKeyPath:ofObject:change:context:]):
+ (TEST):
+ (-[MediaDelegate _webView:isPlayingMediaDidChange:]): Deleted.
+
2017-09-01 Filip Pizlo <[email protected]>
WSL Rewriter should be an identity on things that aren't inside function bodies
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm (221488 => 221489)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2017-09-01 18:49:00 UTC (rev 221488)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/UIDelegate.mm 2017-09-01 18:54:50 UTC (rev 221489)
@@ -27,24 +27,55 @@
#if WK_API_ENABLED
-#if PLATFORM(MAC)
-
#import "TestWKWebView.h"
#import "Utilities.h"
#import "WKWebViewConfigurationExtras.h"
-#import <Carbon/Carbon.h>
#import <WebKit/WKPreferencesPrivate.h>
#import <WebKit/WKUIDelegatePrivate.h>
#import <WebKit/WKWebViewPrivate.h>
#import <wtf/RetainPtr.h>
+
+#if PLATFORM(MAC)
+#import <Carbon/Carbon.h>
#import <wtf/mac/AppKitCompatibilityDeclarations.h>
+#endif
+static bool done;
+
+@interface AudioObserver : NSObject
+@end
+
+@implementation AudioObserver
+
+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSString *, id> *)change context:(void *)context
+{
+ EXPECT_TRUE([keyPath isEqualToString:NSStringFromSelector(@selector(_isPlayingAudio))]);
+ EXPECT_TRUE([[object class] isEqual:[TestWKWebView class]]);
+ EXPECT_FALSE([[change objectForKey:NSKeyValueChangeOldKey] boolValue]);
+ EXPECT_TRUE([[change objectForKey:NSKeyValueChangeNewKey] boolValue]);
+ EXPECT_TRUE(context == nullptr);
+ done = true;
+}
+
+@end
+
+TEST(WebKit2, WKWebViewIsPlayingAudio)
+{
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:[[[WKWebViewConfiguration alloc] init] autorelease]]);
+ auto observer = adoptNS([[AudioObserver alloc] init]);
+ [webView addObserver:observer.get() forKeyPath:@"_isPlayingAudio" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil];
+ [webView synchronouslyLoadTestPageNamed:@"file-with-video"];
+ [webView evaluateJavaScript:@"playVideo()" completionHandler:nil];
+ TestWebKitAPI::Util::run(&done);
+}
+
+#if PLATFORM(MAC)
+
@class UITestDelegate;
static RetainPtr<WKWebView> webViewFromDelegateCallback;
static RetainPtr<WKWebView> createdWebView;
static RetainPtr<UITestDelegate> delegate;
-static bool done;
@interface UITestDelegate : NSObject <WKUIDelegatePrivate, WKURLSchemeHandler>
@end
@@ -91,29 +122,6 @@
ASSERT_EQ(webViewFromDelegateCallback, createdWebView);
}
-@interface MediaDelegate : NSObject <WKUIDelegatePrivate>
-@end
-
-@implementation MediaDelegate
-
-- (void)_webView:(WKWebView *)webView isPlayingMediaDidChange:(BOOL)playingMedia
-{
- ASSERT_TRUE(playingMedia);
- done = true;
-}
-
-@end
-
-TEST(WebKit2, WKWebViewIsPlayingMedia)
-{
- auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectMake(0, 0, 800, 600) configuration:[[[WKWebViewConfiguration alloc] init] autorelease]]);
- auto delegate = adoptNS([[MediaDelegate alloc] init]);
- [webView setUIDelegate:delegate.get()];
- [webView synchronouslyLoadTestPageNamed:@"file-with-video"];
- [webView evaluateJavaScript:@"playVideo()" completionHandler:nil];
- TestWebKitAPI::Util::run(&done);
-}
-
static bool readyForClick;
@interface AutoFillDelegate : NSObject <WKUIDelegatePrivate>