<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[195600] trunk/Source</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/195600">195600</a></dd>
<dt>Author</dt> <dd>adachan@apple.com</dd>
<dt>Date</dt> <dd>2016-01-26 10:56:00 -0800 (Tue, 26 Jan 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Move WebVideoFullscreenManager and related classes from iOS specific folders to cocoa folders
https://bugs.webkit.org/show_bug.cgi?id=153473
Reviewed by Eric Carlson.
Source/WebCore:
No new tests, just moving files.
* WebCore.xcodeproj/project.pbxproj:
Update due to changes to the file locations.
* platform/cocoa/WebVideoFullscreenModel.h: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModel.h.
* platform/cocoa/WebVideoFullscreenModelVideoElement.h: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h.
(WebCore::WebVideoFullscreenModelVideoElement::create):
Fix a style error by moving the opening curly brace down one line.
* platform/cocoa/WebVideoFullscreenModelVideoElement.mm: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm.
Source/WebKit2:
* DerivedSources.make:
Add new paths.
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h: Renamed from Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h.
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in: Renamed from Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in.
* UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm: Renamed from Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm.
(WebKit::WebVideoFullscreenManagerProxy::setSeekableRangesVector):
Fix a style error by moving the opening curly brace to the same line as the for statement.
* WebKit2.xcodeproj/project.pbxproj:
Update due to changes to the file locations.
* WebProcess/cocoa/WebVideoFullscreenManager.h: Renamed from Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h.
* WebProcess/cocoa/WebVideoFullscreenManager.messages.in: Renamed from Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in.
* WebProcess/cocoa/WebVideoFullscreenManager.mm: Renamed from Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm.
(WebKit::WebVideoFullscreenInterfaceContext::setSeekableRanges):
Fix a style error by adding a missing space after a comma.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2DerivedSourcesmake">trunk/Source/WebKit2/DerivedSources.make</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformcocoaWebVideoFullscreenModelh">trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementh">trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementmm">trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxyh">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymessagesin">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymm">trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagerh">trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermessagesin">trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelVideoElementh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelVideoElementmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm">trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagerh">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermessagesin">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm">trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebCore/ChangeLog        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-01-25 Ada Chan <adachan@apple.com>
+
+ Move WebVideoFullscreenManager and related classes from iOS specific folders to cocoa folders
+ https://bugs.webkit.org/show_bug.cgi?id=153473
+
+ Reviewed by Eric Carlson.
+
+ No new tests, just moving files.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ Update due to changes to the file locations.
+ * platform/cocoa/WebVideoFullscreenModel.h: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModel.h.
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.h: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h.
+ (WebCore::WebVideoFullscreenModelVideoElement::create):
+ Fix a style error by moving the opening curly brace down one line.
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.mm: Renamed from Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm.
+
</ins><span class="cx"> 2016-01-26 Konstantin Tokarev <annulen@yandex.ru>
</span><span class="cx">
</span><span class="cx"> Do not convert GlyphBufferAdvance to FloatSize
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1469,7 +1469,6 @@
</span><span class="cx">                 3F2B33EF165AF15600E3987C /* JSWebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */; };
</span><span class="cx">                 3F42B31D1881191B00278AAC /* WebVideoFullscreenControllerAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F42B31B1881191B00278AAC /* WebVideoFullscreenControllerAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 3F42B31E1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F42B31C1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm */; };
</span><del>-                3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; };
</del><span class="cx">                 3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */; };
</span><span class="cx">                 3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */; };
</span><span class="lines">@@ -2274,6 +2273,9 @@
</span><span class="cx">                 52CCA9E915E3F64C0053C77F /* DOMDOMNamedFlowCollection.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52CCA9E615E3F64C0053C77F /* DOMDOMNamedFlowCollection.mm */; };
</span><span class="cx">                 52CCA9EA15E3F64C0053C77F /* DOMDOMNamedFlowCollectionInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 52CCA9E715E3F64C0053C77F /* DOMDOMNamedFlowCollectionInternal.h */; };
</span><span class="cx">                 52D5A18F1C54592300DE34A3 /* VideoFullscreenLayerManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */; };
</span><ins>+                52D5A1A71C57489D00DE34A3 /* WebVideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A41C57488900DE34A3 /* WebVideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                52D5A1A81C5748A300DE34A3 /* WebVideoFullscreenModelVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1A51C57488900DE34A3 /* WebVideoFullscreenModelVideoElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                52D5A1A91C5748A900DE34A3 /* WebVideoFullscreenModelVideoElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A1A61C57488900DE34A3 /* WebVideoFullscreenModelVideoElement.mm */; };
</ins><span class="cx">                 52E2CAFC19FF0207001EEB4F /* MediaProducer.h in Headers */ = {isa = PBXBuildFile; fileRef = 52E2CAFB19FF0207001EEB4F /* MediaProducer.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 52F10865162B6DA4009AC81E /* MixedContentChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 52F10862162B6D82009AC81E /* MixedContentChecker.cpp */; };
</span><span class="cx">                 52F10866162B6DA8009AC81E /* MixedContentChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 52F10863162B6D82009AC81E /* MixedContentChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2498,8 +2500,6 @@
</span><span class="cx">                 65DF323C09D1DE65001BE325 /* JSCanvasProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 65DF323609D1DE65001BE325 /* JSCanvasProxy.h */; };
</span><span class="cx">                 65DF326109D1E199000BE325 /* UserAgentStyleSheetsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581AF09D14EE6000E61D7 /* UserAgentStyleSheetsData.cpp */; };
</span><span class="cx">                 65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 65E0E9431133C89F00B4CB10 /* JSDOMWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><del>-                65FD466519B596F0001E2B4D /* WebVideoFullscreenModelVideoElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 6586FE3C19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
-                65FD466619B596F6001E2B4D /* WebVideoFullscreenModelVideoElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6586FE3D19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.mm */; };
</del><span class="cx">                 65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
</span><span class="cx">                 6B3480940EEF50D400AC1B41 /* NativeImagePtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B3480920EEF50D400AC1B41 /* NativeImagePtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 6C4C96DE1AD4483500365A50 /* JSReadableStreamController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6C4C96DA1AD4483500365A50 /* JSReadableStreamController.cpp */; };
</span><span class="lines">@@ -8857,7 +8857,6 @@
</span><span class="cx">                 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSViewportRule.h; sourceTree = "<group>"; };
</span><span class="cx">                 3F42B31B1881191B00278AAC /* WebVideoFullscreenControllerAVKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenControllerAVKit.h; sourceTree = "<group>"; };
</span><span class="cx">                 3F42B31C1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenControllerAVKit.mm; sourceTree = "<group>"; };
</span><del>-                3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenModel.h; sourceTree = "<group>"; };
</del><span class="cx">                 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenInterfaceAVKit.mm; sourceTree = "<group>"; };
</span><span class="cx">                 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenInterfaceAVKit.h; sourceTree = "<group>"; };
</span><span class="cx">                 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSViewportRule.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -9755,6 +9754,9 @@
</span><span class="cx">                 52CCA9E715E3F64C0053C77F /* DOMDOMNamedFlowCollectionInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMDOMNamedFlowCollectionInternal.h; sourceTree = "<group>"; };
</span><span class="cx">                 52D5A18D1C54590300DE34A3 /* VideoFullscreenLayerManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoFullscreenLayerManager.mm; sourceTree = "<group>"; };
</span><span class="cx">                 52D5A18E1C54590300DE34A3 /* VideoFullscreenLayerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoFullscreenLayerManager.h; sourceTree = "<group>"; };
</span><ins>+                52D5A1A41C57488900DE34A3 /* WebVideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenModel.h; sourceTree = "<group>"; };
+                52D5A1A51C57488900DE34A3 /* WebVideoFullscreenModelVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenModelVideoElement.h; sourceTree = "<group>"; };
+                52D5A1A61C57488900DE34A3 /* WebVideoFullscreenModelVideoElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenModelVideoElement.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 52E2CAFB19FF0207001EEB4F /* MediaProducer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaProducer.h; sourceTree = "<group>"; };
</span><span class="cx">                 52F10862162B6D82009AC81E /* MixedContentChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MixedContentChecker.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 52F10863162B6D82009AC81E /* MixedContentChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MixedContentChecker.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -9962,8 +9964,6 @@
</span><span class="cx">                 657EDA061385CB97004E0645 /* MemoryPressureHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryPressureHandler.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 657EDA071385CB97004E0645 /* MemoryPressureHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryPressureHandler.h; sourceTree = "<group>"; };
</span><span class="cx">                 658436850AE01B7400E53753 /* FrameLoadRequest.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameLoadRequest.h; sourceTree = "<group>"; };
</span><del>-                6586FE3C19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenModelVideoElement.h; sourceTree = "<group>"; };
-                6586FE3D19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenModelVideoElement.mm; sourceTree = "<group>"; };
</del><span class="cx">                 6593923509AE4346002C531F /* URL.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = URL.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 6593923609AE4346002C531F /* URL.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = URL.h; sourceTree = "<group>"; };
</span><span class="cx">                 6593923909AE435C002C531F /* URLMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = URLMac.mm; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
</span><span class="lines">@@ -19772,9 +19772,6 @@
</span><span class="cx">                                 3F42B31C1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm */,
</span><span class="cx">                                 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */,
</span><span class="cx">                                 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */,
</span><del>-                                3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */,
-                                6586FE3C19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.h */,
-                                6586FE3D19B548BD005C3C82 /* WebVideoFullscreenModelVideoElement.mm */,
</del><span class="cx">                                 E453903C0EAFD637003695C8 /* WidgetIOS.mm */,
</span><span class="cx">                         );
</span><span class="cx">                         path = ios;
</span><span class="lines">@@ -19813,6 +19810,9 @@
</span><span class="cx">                                 CDC979F31C498C0900DB50D4 /* WebCoreNSErrorExtras.h */,
</span><span class="cx">                                 CDC979F21C498C0900DB50D4 /* WebCoreNSErrorExtras.mm */,
</span><span class="cx">                                 52131E581C4F15220033F802 /* WebVideoFullscreenInterface.h */,
</span><ins>+                                52D5A1A41C57488900DE34A3 /* WebVideoFullscreenModel.h */,
+                                52D5A1A51C57488900DE34A3 /* WebVideoFullscreenModelVideoElement.h */,
+                                52D5A1A61C57488900DE34A3 /* WebVideoFullscreenModelVideoElement.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = cocoa;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -28233,8 +28233,8 @@
</span><span class="cx">                                 CD82030C1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.h in Headers */,
</span><span class="cx">                                 52131E591C4F15350033F802 /* WebVideoFullscreenInterface.h in Headers */,
</span><span class="cx">                                 3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */,
</span><del>-                                3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */,
-                                65FD466519B596F0001E2B4D /* WebVideoFullscreenModelVideoElement.h in Headers */,
</del><ins>+                                52D5A1A71C57489D00DE34A3 /* WebVideoFullscreenModel.h in Headers */,
+                                52D5A1A81C5748A300DE34A3 /* WebVideoFullscreenModelVideoElement.h in Headers */,
</ins><span class="cx">                                 F12171F616A8CF0B000053CA /* WebVTTElement.h in Headers */,
</span><span class="cx">                                 5D21A80313ECE5DF00BB7064 /* WebVTTParser.h in Headers */,
</span><span class="cx">                                 B10B6980140C174000BC1C26 /* WebVTTToken.h in Headers */,
</span><span class="lines">@@ -31649,7 +31649,7 @@
</span><span class="cx">                                 CD82030D1395AB6A00F956C6 /* WebVideoFullscreenHUDWindowController.mm in Sources */,
</span><span class="cx">                                 3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */,
</span><span class="cx">                                 52131E5B1C4F15760033F802 /* WebVideoFullscreenInterfaceMac.mm in Sources */,
</span><del>-                                65FD466619B596F6001E2B4D /* WebVideoFullscreenModelVideoElement.mm in Sources */,
</del><ins>+                                52D5A1A91C5748A900DE34A3 /* WebVideoFullscreenModelVideoElement.mm in Sources */,
</ins><span class="cx">                                 F12171F516A8CED2000053CA /* WebVTTElement.cpp in Sources */,
</span><span class="cx">                                 5D21A80213ECE5DF00BB7064 /* WebVTTParser.cpp in Sources */,
</span><span class="cx">                                 B10B6981140C174000BC1C26 /* WebVTTTokenizer.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaWebVideoFullscreenModelhfromrev195599trunkSourceWebCoreplatformiosWebVideoFullscreenModelh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h (from rev 195599, trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h         (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 WebVideoFullscreenModel_h
+#define WebVideoFullscreenModel_h
+
+#if PLATFORM(IOS)
+
+#include <WebCore/FloatRect.h>
+
+namespace WebCore {
+
+class WebVideoFullscreenModel {
+public:
+ virtual ~WebVideoFullscreenModel() { };
+ virtual void play() = 0;
+ virtual void pause() = 0;
+ virtual void togglePlayState() = 0;
+ virtual void beginScrubbing() = 0;
+ virtual void endScrubbing() = 0;
+ virtual void seekToTime(double time) = 0;
+ virtual void fastSeek(double time) = 0;
+ virtual void beginScanningForward() = 0;
+ virtual void beginScanningBackward() = 0;
+ virtual void endScanning() = 0;
+ virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) = 0;
+ virtual void setVideoLayerFrame(FloatRect) = 0;
+ enum VideoGravity { VideoGravityResize, VideoGravityResizeAspect, VideoGravityResizeAspectFill };
+ virtual void setVideoLayerGravity(VideoGravity) = 0;
+ virtual void selectAudioMediaOption(uint64_t index) = 0;
+ virtual void selectLegibleMediaOption(uint64_t index) = 0;
+ virtual void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) = 0;
+ virtual bool isVisible() const = 0;
+};
+
+}
+
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementhfromrev195599trunkSourceWebCoreplatformiosWebVideoFullscreenModelVideoElementh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h (from rev 195599, trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h         (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,104 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 WebVideoFullscreenModelVideoElement_h
+#define WebVideoFullscreenModelVideoElement_h
+
+#if PLATFORM(IOS)
+
+#include <WebCore/EventListener.h>
+#include <WebCore/FloatRect.h>
+#include <WebCore/HTMLMediaElementEnums.h>
+#include <WebCore/PlatformLayer.h>
+#include <WebCore/WebVideoFullscreenModel.h>
+#include <wtf/RefPtr.h>
+#include <wtf/RetainPtr.h>
+#include <wtf/Vector.h>
+
+namespace WebCore {
+class AudioTrack;
+class HTMLVideoElement;
+class TextTrack;
+class WebVideoFullscreenInterface;
+
+class WebVideoFullscreenModelVideoElement : public WebVideoFullscreenModel, public EventListener {
+public:
+ static RefPtr<WebVideoFullscreenModelVideoElement> create()
+ {
+ return adoptRef(*new WebVideoFullscreenModelVideoElement());
+ }
+ WEBCORE_EXPORT virtual ~WebVideoFullscreenModelVideoElement();
+ WEBCORE_EXPORT void setWebVideoFullscreenInterface(WebVideoFullscreenInterface*);
+ WEBCORE_EXPORT void setVideoElement(HTMLVideoElement*);
+ WEBCORE_EXPORT HTMLVideoElement* videoElement() const { return m_videoElement.get(); }
+ WEBCORE_EXPORT void setVideoFullscreenLayer(PlatformLayer*);
+
+ WEBCORE_EXPORT virtual void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) override;
+ void updateForEventName(const WTF::AtomicString&);
+ bool operator==(const EventListener& rhs) override
+ {return static_cast<WebCore::EventListener*>(this) == &rhs;}
+
+ WEBCORE_EXPORT virtual void play() override;
+ WEBCORE_EXPORT virtual void pause() override;
+ WEBCORE_EXPORT virtual void togglePlayState() override;
+ WEBCORE_EXPORT virtual void beginScrubbing() override;
+ WEBCORE_EXPORT virtual void endScrubbing() override;
+ WEBCORE_EXPORT virtual void seekToTime(double time) override;
+ WEBCORE_EXPORT virtual void fastSeek(double time) override;
+ WEBCORE_EXPORT virtual void beginScanningForward() override;
+ WEBCORE_EXPORT virtual void beginScanningBackward() override;
+ WEBCORE_EXPORT virtual void endScanning() override;
+ WEBCORE_EXPORT virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
+ WEBCORE_EXPORT virtual void setVideoLayerFrame(FloatRect) override;
+ WEBCORE_EXPORT virtual void setVideoLayerGravity(VideoGravity) override;
+ WEBCORE_EXPORT virtual void selectAudioMediaOption(uint64_t index) override;
+ WEBCORE_EXPORT virtual void selectLegibleMediaOption(uint64_t index) override;
+ WEBCORE_EXPORT virtual void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) override;
+ WEBCORE_EXPORT virtual bool isVisible() const override;
+
+protected:
+ WEBCORE_EXPORT WebVideoFullscreenModelVideoElement();
+
+private:
+ static const Vector<WTF::AtomicString>& observedEventNames();
+ const WTF::AtomicString& eventNameAll();
+
+ RefPtr<HTMLVideoElement> m_videoElement;
+ RetainPtr<PlatformLayer> m_videoFullscreenLayer;
+ bool m_isListening { false };
+ WebVideoFullscreenInterface* m_videoFullscreenInterface { nullptr };
+ FloatRect m_videoFrame;
+ Vector<RefPtr<TextTrack>> m_legibleTracksForMenu;
+ Vector<RefPtr<AudioTrack>> m_audioTracksForMenu;
+
+ void updateLegibleOptions();
+};
+
+}
+
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaWebVideoFullscreenModelVideoElementmmfromrev195599trunkSourceWebCoreplatformiosWebVideoFullscreenModelVideoElementmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm (from rev 195599, trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm         (rev 0)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,402 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.
+ */
+
+#import "config.h"
+
+#if PLATFORM(IOS)
+#import "WebVideoFullscreenModelVideoElement.h"
+
+#import "DOMEventInternal.h"
+#import "Logging.h"
+#import "MediaControlsHost.h"
+#import "WebVideoFullscreenInterface.h"
+#import <QuartzCore/CoreAnimation.h>
+#import <WebCore/DOMEventListener.h>
+#import <WebCore/Event.h>
+#import <WebCore/EventListener.h>
+#import <WebCore/EventNames.h>
+#import <WebCore/HTMLElement.h>
+#import <WebCore/HTMLVideoElement.h>
+#import <WebCore/Page.h>
+#import <WebCore/PageGroup.h>
+#import <WebCore/SoftLinking.h>
+#import <WebCore/TextTrackList.h>
+#import <WebCore/TimeRanges.h>
+#import <WebCore/WebCoreThreadRun.h>
+#import <wtf/NeverDestroyed.h>
+#import <wtf/RetainPtr.h>
+
+
+using namespace WebCore;
+
+WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement()
+ : EventListener(EventListener::CPPEventListenerType)
+{
+}
+
+WebVideoFullscreenModelVideoElement::~WebVideoFullscreenModelVideoElement()
+{
+}
+
+void WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface(WebVideoFullscreenInterface* interface)
+{
+ if (interface == m_videoFullscreenInterface)
+ return;
+
+ m_videoFullscreenInterface = interface;
+
+ if (m_videoFullscreenInterface) {
+ m_videoFullscreenInterface->resetMediaState();
+ if (m_videoElement) {
+ m_videoFullscreenInterface->setVideoDimensions(true, m_videoElement->videoWidth(), m_videoElement->videoHeight());
+ m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
+ }
+ }
+}
+
+void WebVideoFullscreenModelVideoElement::setVideoElement(HTMLVideoElement* videoElement)
+{
+ if (m_videoElement == videoElement)
+ return;
+
+ if (m_videoFullscreenInterface)
+ m_videoFullscreenInterface->resetMediaState();
+
+ if (m_videoElement && m_videoElement->videoFullscreenLayer())
+ m_videoElement->setVideoFullscreenLayer(nullptr);
+
+ if (m_videoElement && m_isListening) {
+ for (auto& eventName : observedEventNames())
+ m_videoElement->removeEventListener(eventName, this, false);
+ }
+ m_isListening = false;
+
+ m_videoElement = videoElement;
+
+ if (!m_videoElement)
+ return;
+
+ for (auto& eventName : observedEventNames())
+ m_videoElement->addEventListener(eventName, this, false);
+ m_isListening = true;
+
+ updateForEventName(eventNameAll());
+
+ if (m_videoFullscreenInterface) {
+ m_videoFullscreenInterface->setVideoDimensions(true, videoElement->videoWidth(), videoElement->videoHeight());
+ m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
+ }
+}
+
+void WebVideoFullscreenModelVideoElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event)
+{
+ updateForEventName(event->type());
+}
+
+void WebVideoFullscreenModelVideoElement::updateForEventName(const WTF::AtomicString& eventName)
+{
+ if (!m_videoElement || !m_videoFullscreenInterface)
+ return;
+
+ bool all = eventName == eventNameAll();
+
+ if (all
+ || eventName == eventNames().durationchangeEvent) {
+ m_videoFullscreenInterface->setDuration(m_videoElement->duration());
+ // These is no standard event for minFastReverseRateChange; duration change is a reasonable proxy for it.
+ // It happens every time a new item becomes ready to play.
+ m_videoFullscreenInterface->setCanPlayFastReverse(m_videoElement->minFastReverseRate() < 0.0);
+ }
+
+ if (all
+ || eventName == eventNames().pauseEvent
+ || eventName == eventNames().playEvent
+ || eventName == eventNames().ratechangeEvent)
+ m_videoFullscreenInterface->setRate(!m_videoElement->paused(), m_videoElement->playbackRate());
+
+ if (all
+ || eventName == eventNames().timeupdateEvent) {
+ m_videoFullscreenInterface->setCurrentTime(m_videoElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
+ m_videoFullscreenInterface->setBufferedTime(m_videoElement->maxBufferedTime());
+ // FIXME: 130788 - find a better event to update seekable ranges from.
+ m_videoFullscreenInterface->setSeekableRanges(*m_videoElement->seekable());
+ }
+
+ if (all
+ || eventName == eventNames().addtrackEvent
+ || eventName == eventNames().removetrackEvent)
+ updateLegibleOptions();
+
+ if (all
+ || eventName == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent) {
+ bool enabled = m_videoElement->webkitCurrentPlaybackTargetIsWireless();
+ WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType = WebVideoFullscreenInterface::TargetTypeNone;
+ String localizedDeviceName;
+
+ if (m_videoElement->mediaControlsHost()) {
+ static NeverDestroyed<String> airplay(ASCIILiteral("airplay"));
+ static NeverDestroyed<String> tvout(ASCIILiteral("tvout"));
+
+ String type = m_videoElement->mediaControlsHost()->externalDeviceType();
+ if (type == airplay)
+ targetType = WebVideoFullscreenInterface::TargetTypeAirPlay;
+ else if (type == tvout)
+ targetType = WebVideoFullscreenInterface::TargetTypeTVOut;
+ localizedDeviceName = m_videoElement->mediaControlsHost()->externalDeviceDisplayName();
+ }
+ m_videoFullscreenInterface->setExternalPlayback(enabled, targetType, localizedDeviceName);
+ m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
+ }
+}
+
+void WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer(PlatformLayer* videoLayer)
+{
+ if (m_videoFullscreenLayer == videoLayer)
+ return;
+
+ m_videoFullscreenLayer = videoLayer;
+ [m_videoFullscreenLayer setAnchorPoint:CGPointMake(0.5, 0.5)];
+ [m_videoFullscreenLayer setBounds:m_videoFrame];
+
+ if (m_videoElement)
+ m_videoElement->setVideoFullscreenLayer(m_videoFullscreenLayer.get());
+}
+
+void WebVideoFullscreenModelVideoElement::play()
+{
+ if (m_videoElement)
+ m_videoElement->play();
+}
+
+void WebVideoFullscreenModelVideoElement::pause()
+{
+ if (m_videoElement)
+ m_videoElement->pause();
+}
+
+void WebVideoFullscreenModelVideoElement::togglePlayState()
+{
+ if (m_videoElement)
+ m_videoElement->togglePlayState();
+}
+
+void WebVideoFullscreenModelVideoElement::beginScrubbing()
+{
+ if (m_videoElement)
+ m_videoElement->beginScrubbing();
+}
+
+void WebVideoFullscreenModelVideoElement::endScrubbing()
+{
+ if (m_videoElement)
+ m_videoElement->endScrubbing();
+}
+
+void WebVideoFullscreenModelVideoElement::seekToTime(double time)
+{
+ if (m_videoElement)
+ m_videoElement->setCurrentTime(time);
+}
+
+void WebVideoFullscreenModelVideoElement::fastSeek(double time)
+{
+ if (m_videoElement)
+ m_videoElement->fastSeek(time);
+}
+
+void WebVideoFullscreenModelVideoElement::beginScanningForward()
+{
+ if (m_videoElement)
+ m_videoElement->beginScanning(MediaControllerInterface::Forward);
+}
+
+void WebVideoFullscreenModelVideoElement::beginScanningBackward()
+{
+ if (m_videoElement)
+ m_videoElement->beginScanning(MediaControllerInterface::Backward);
+}
+
+void WebVideoFullscreenModelVideoElement::endScanning()
+{
+ if (m_videoElement)
+ m_videoElement->endScanning();
+}
+
+void WebVideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ if (m_videoElement && m_videoElement->fullscreenMode() != mode)
+ m_videoElement->setFullscreenMode(mode);
+}
+
+void WebVideoFullscreenModelVideoElement::setVideoLayerFrame(FloatRect rect)
+{
+ m_videoFrame = rect;
+ [m_videoFullscreenLayer setBounds:CGRect(rect)];
+ if (m_videoElement)
+ m_videoElement->setVideoFullscreenFrame(rect);
+}
+
+void WebVideoFullscreenModelVideoElement::setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity gravity)
+{
+ MediaPlayer::VideoGravity videoGravity = MediaPlayer::VideoGravityResizeAspect;
+ if (gravity == WebVideoFullscreenModel::VideoGravityResize)
+ videoGravity = MediaPlayer::VideoGravityResize;
+ else if (gravity == WebVideoFullscreenModel::VideoGravityResizeAspect)
+ videoGravity = MediaPlayer::VideoGravityResizeAspect;
+ else if (gravity == WebVideoFullscreenModel::VideoGravityResizeAspectFill)
+ videoGravity = MediaPlayer::VideoGravityResizeAspectFill;
+ else
+ ASSERT_NOT_REACHED();
+
+ m_videoElement->setVideoFullscreenGravity(videoGravity);
+}
+
+void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t selectedAudioIndex)
+{
+ AudioTrack* selectedAudioTrack = nullptr;
+
+ for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
+ auto& audioTrack = m_audioTracksForMenu[index];
+ audioTrack->setEnabled(index == static_cast<size_t>(selectedAudioIndex));
+ if (audioTrack->enabled())
+ selectedAudioTrack = audioTrack.get();
+ }
+
+ m_videoElement->audioTrackEnabledChanged(selectedAudioTrack);
+}
+
+void WebVideoFullscreenModelVideoElement::selectLegibleMediaOption(uint64_t index)
+{
+ TextTrack* textTrack = nullptr;
+
+ if (index < m_legibleTracksForMenu.size())
+ textTrack = m_legibleTracksForMenu[static_cast<size_t>(index)].get();
+ else
+ textTrack = TextTrack::captionMenuOffItem();
+
+ m_videoElement->setSelectedTextTrack(textTrack);
+}
+
+void WebVideoFullscreenModelVideoElement::updateLegibleOptions()
+{
+ AudioTrackList* audioTrackList = m_videoElement->audioTracks();
+ TextTrackList* trackList = m_videoElement->textTracks();
+
+ if ((!trackList && !audioTrackList) || !m_videoElement->document().page() || !m_videoElement->mediaControlsHost())
+ return;
+
+ WTF::AtomicString displayMode = m_videoElement->mediaControlsHost()->captionDisplayMode();
+ TextTrack* offItem = m_videoElement->mediaControlsHost()->captionMenuOffItem();
+ TextTrack* automaticItem = m_videoElement->mediaControlsHost()->captionMenuAutomaticItem();
+ CaptionUserPreferences& captionPreferences = *m_videoElement->document().page()->group().captionPreferences();
+ m_legibleTracksForMenu = captionPreferences.sortedTrackListForMenu(trackList);
+
+ m_audioTracksForMenu = captionPreferences.sortedTrackListForMenu(audioTrackList);
+
+ Vector<String> audioTrackDisplayNames;
+ uint64_t selectedAudioIndex = 0;
+
+ for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
+ auto& track = m_audioTracksForMenu[index];
+ audioTrackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
+
+ if (track->enabled())
+ selectedAudioIndex = index;
+ }
+
+ m_videoFullscreenInterface->setAudioMediaSelectionOptions(audioTrackDisplayNames, selectedAudioIndex);
+
+ Vector<String> trackDisplayNames;
+ uint64_t selectedIndex = 0;
+ uint64_t offIndex = 0;
+ bool trackMenuItemSelected = false;
+
+ for (size_t index = 0; index < m_legibleTracksForMenu.size(); index++) {
+ auto& track = m_legibleTracksForMenu[index];
+ trackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
+
+ if (track == offItem)
+ offIndex = index;
+
+ if (track == automaticItem && displayMode == MediaControlsHost::automaticKeyword()) {
+ selectedIndex = index;
+ trackMenuItemSelected = true;
+ }
+
+ if (displayMode != MediaControlsHost::automaticKeyword() && track->mode() == TextTrack::showingKeyword()) {
+ selectedIndex = index;
+ trackMenuItemSelected = true;
+ }
+ }
+
+ if (offIndex && !trackMenuItemSelected && displayMode == MediaControlsHost::forcedOnlyKeyword()) {
+ selectedIndex = offIndex;
+ trackMenuItemSelected = true;
+ }
+
+ m_videoFullscreenInterface->setLegibleMediaSelectionOptions(trackDisplayNames, selectedIndex);
+}
+
+const Vector<AtomicString>& WebVideoFullscreenModelVideoElement::observedEventNames()
+{
+ static NeverDestroyed<Vector<AtomicString>> sEventNames;
+
+ if (!sEventNames.get().size()) {
+ sEventNames.get().append(eventNames().durationchangeEvent);
+ sEventNames.get().append(eventNames().pauseEvent);
+ sEventNames.get().append(eventNames().playEvent);
+ sEventNames.get().append(eventNames().ratechangeEvent);
+ sEventNames.get().append(eventNames().timeupdateEvent);
+ sEventNames.get().append(eventNames().addtrackEvent);
+ sEventNames.get().append(eventNames().removetrackEvent);
+ sEventNames.get().append(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
+ }
+ return sEventNames.get();
+}
+
+const AtomicString& WebVideoFullscreenModelVideoElement::eventNameAll()
+{
+ static NeverDestroyed<AtomicString> sEventNameAll = "allEvents";
+ return sEventNameAll;
+}
+
+void WebVideoFullscreenModelVideoElement::fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
+{
+ if (m_videoElement)
+ m_videoElement->fullscreenModeChanged(videoFullscreenMode);
+}
+
+bool WebVideoFullscreenModelVideoElement::isVisible() const
+{
+ if (!m_videoElement)
+ return false;
+
+ if (Page* page = m_videoElement->document().page())
+ return page->isVisible();
+
+ return false;
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,63 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 WebVideoFullscreenModel_h
-#define WebVideoFullscreenModel_h
-
-#if PLATFORM(IOS)
-
-#include <WebCore/FloatRect.h>
-
-namespace WebCore {
-
-class WebVideoFullscreenModel {
-public:
- virtual ~WebVideoFullscreenModel() { };
- virtual void play() = 0;
- virtual void pause() = 0;
- virtual void togglePlayState() = 0;
- virtual void beginScrubbing() = 0;
- virtual void endScrubbing() = 0;
- virtual void seekToTime(double time) = 0;
- virtual void fastSeek(double time) = 0;
- virtual void beginScanningForward() = 0;
- virtual void beginScanningBackward() = 0;
- virtual void endScanning() = 0;
- virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) = 0;
- virtual void setVideoLayerFrame(FloatRect) = 0;
- enum VideoGravity { VideoGravityResize, VideoGravityResizeAspect, VideoGravityResizeAspectFill };
- virtual void setVideoLayerGravity(VideoGravity) = 0;
- virtual void selectAudioMediaOption(uint64_t index) = 0;
- virtual void selectLegibleMediaOption(uint64_t index) = 0;
- virtual void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) = 0;
- virtual bool isVisible() const = 0;
-};
-
-}
-
-#endif
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelVideoElementh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,103 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 WebVideoFullscreenModelVideoElement_h
-#define WebVideoFullscreenModelVideoElement_h
-
-#if PLATFORM(IOS)
-
-#include <WebCore/EventListener.h>
-#include <WebCore/FloatRect.h>
-#include <WebCore/HTMLMediaElementEnums.h>
-#include <WebCore/PlatformLayer.h>
-#include <WebCore/WebVideoFullscreenModel.h>
-#include <wtf/RefPtr.h>
-#include <wtf/RetainPtr.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-class AudioTrack;
-class HTMLVideoElement;
-class TextTrack;
-class WebVideoFullscreenInterface;
-
-class WebVideoFullscreenModelVideoElement : public WebVideoFullscreenModel, public EventListener {
-public:
- static RefPtr<WebVideoFullscreenModelVideoElement> create() {
- return adoptRef(*new WebVideoFullscreenModelVideoElement());
- }
- WEBCORE_EXPORT virtual ~WebVideoFullscreenModelVideoElement();
- WEBCORE_EXPORT void setWebVideoFullscreenInterface(WebVideoFullscreenInterface*);
- WEBCORE_EXPORT void setVideoElement(HTMLVideoElement*);
- WEBCORE_EXPORT HTMLVideoElement* videoElement() const { return m_videoElement.get(); }
- WEBCORE_EXPORT void setVideoFullscreenLayer(PlatformLayer*);
-
- WEBCORE_EXPORT virtual void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) override;
- void updateForEventName(const WTF::AtomicString&);
- bool operator==(const EventListener& rhs) override
- {return static_cast<WebCore::EventListener*>(this) == &rhs;}
-
- WEBCORE_EXPORT virtual void play() override;
- WEBCORE_EXPORT virtual void pause() override;
- WEBCORE_EXPORT virtual void togglePlayState() override;
- WEBCORE_EXPORT virtual void beginScrubbing() override;
- WEBCORE_EXPORT virtual void endScrubbing() override;
- WEBCORE_EXPORT virtual void seekToTime(double time) override;
- WEBCORE_EXPORT virtual void fastSeek(double time) override;
- WEBCORE_EXPORT virtual void beginScanningForward() override;
- WEBCORE_EXPORT virtual void beginScanningBackward() override;
- WEBCORE_EXPORT virtual void endScanning() override;
- WEBCORE_EXPORT virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
- WEBCORE_EXPORT virtual void setVideoLayerFrame(FloatRect) override;
- WEBCORE_EXPORT virtual void setVideoLayerGravity(VideoGravity) override;
- WEBCORE_EXPORT virtual void selectAudioMediaOption(uint64_t index) override;
- WEBCORE_EXPORT virtual void selectLegibleMediaOption(uint64_t index) override;
- WEBCORE_EXPORT virtual void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) override;
- WEBCORE_EXPORT virtual bool isVisible() const override;
-
-protected:
- WEBCORE_EXPORT WebVideoFullscreenModelVideoElement();
-
-private:
- static const Vector<WTF::AtomicString>& observedEventNames();
- const WTF::AtomicString& eventNameAll();
-
- RefPtr<HTMLVideoElement> m_videoElement;
- RetainPtr<PlatformLayer> m_videoFullscreenLayer;
- bool m_isListening { false };
- WebVideoFullscreenInterface* m_videoFullscreenInterface { nullptr };
- FloatRect m_videoFrame;
- Vector<RefPtr<TextTrack>> m_legibleTracksForMenu;
- Vector<RefPtr<AudioTrack>> m_audioTracksForMenu;
-
- void updateLegibleOptions();
-};
-
-}
-
-#endif
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelVideoElementmm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelVideoElement.mm        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,402 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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.
- */
-
-#import "config.h"
-
-#if PLATFORM(IOS)
-#import "WebVideoFullscreenModelVideoElement.h"
-
-#import "DOMEventInternal.h"
-#import "Logging.h"
-#import "MediaControlsHost.h"
-#import "WebVideoFullscreenInterface.h"
-#import <QuartzCore/CoreAnimation.h>
-#import <WebCore/DOMEventListener.h>
-#import <WebCore/Event.h>
-#import <WebCore/EventListener.h>
-#import <WebCore/EventNames.h>
-#import <WebCore/HTMLElement.h>
-#import <WebCore/HTMLVideoElement.h>
-#import <WebCore/Page.h>
-#import <WebCore/PageGroup.h>
-#import <WebCore/SoftLinking.h>
-#import <WebCore/TextTrackList.h>
-#import <WebCore/TimeRanges.h>
-#import <WebCore/WebCoreThreadRun.h>
-#import <wtf/NeverDestroyed.h>
-#import <wtf/RetainPtr.h>
-
-
-using namespace WebCore;
-
-WebVideoFullscreenModelVideoElement::WebVideoFullscreenModelVideoElement()
- : EventListener(EventListener::CPPEventListenerType)
-{
-}
-
-WebVideoFullscreenModelVideoElement::~WebVideoFullscreenModelVideoElement()
-{
-}
-
-void WebVideoFullscreenModelVideoElement::setWebVideoFullscreenInterface(WebVideoFullscreenInterface* interface)
-{
- if (interface == m_videoFullscreenInterface)
- return;
-
- m_videoFullscreenInterface = interface;
-
- if (m_videoFullscreenInterface) {
- m_videoFullscreenInterface->resetMediaState();
- if (m_videoElement) {
- m_videoFullscreenInterface->setVideoDimensions(true, m_videoElement->videoWidth(), m_videoElement->videoHeight());
- m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
- }
- }
-}
-
-void WebVideoFullscreenModelVideoElement::setVideoElement(HTMLVideoElement* videoElement)
-{
- if (m_videoElement == videoElement)
- return;
-
- if (m_videoFullscreenInterface)
- m_videoFullscreenInterface->resetMediaState();
-
- if (m_videoElement && m_videoElement->videoFullscreenLayer())
- m_videoElement->setVideoFullscreenLayer(nullptr);
-
- if (m_videoElement && m_isListening) {
- for (auto& eventName : observedEventNames())
- m_videoElement->removeEventListener(eventName, this, false);
- }
- m_isListening = false;
-
- m_videoElement = videoElement;
-
- if (!m_videoElement)
- return;
-
- for (auto& eventName : observedEventNames())
- m_videoElement->addEventListener(eventName, this, false);
- m_isListening = true;
-
- updateForEventName(eventNameAll());
-
- if (m_videoFullscreenInterface) {
- m_videoFullscreenInterface->setVideoDimensions(true, videoElement->videoWidth(), videoElement->videoHeight());
- m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
- }
-}
-
-void WebVideoFullscreenModelVideoElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event)
-{
- updateForEventName(event->type());
-}
-
-void WebVideoFullscreenModelVideoElement::updateForEventName(const WTF::AtomicString& eventName)
-{
- if (!m_videoElement || !m_videoFullscreenInterface)
- return;
-
- bool all = eventName == eventNameAll();
-
- if (all
- || eventName == eventNames().durationchangeEvent) {
- m_videoFullscreenInterface->setDuration(m_videoElement->duration());
- // These is no standard event for minFastReverseRateChange; duration change is a reasonable proxy for it.
- // It happens every time a new item becomes ready to play.
- m_videoFullscreenInterface->setCanPlayFastReverse(m_videoElement->minFastReverseRate() < 0.0);
- }
-
- if (all
- || eventName == eventNames().pauseEvent
- || eventName == eventNames().playEvent
- || eventName == eventNames().ratechangeEvent)
- m_videoFullscreenInterface->setRate(!m_videoElement->paused(), m_videoElement->playbackRate());
-
- if (all
- || eventName == eventNames().timeupdateEvent) {
- m_videoFullscreenInterface->setCurrentTime(m_videoElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
- m_videoFullscreenInterface->setBufferedTime(m_videoElement->maxBufferedTime());
- // FIXME: 130788 - find a better event to update seekable ranges from.
- m_videoFullscreenInterface->setSeekableRanges(*m_videoElement->seekable());
- }
-
- if (all
- || eventName == eventNames().addtrackEvent
- || eventName == eventNames().removetrackEvent)
- updateLegibleOptions();
-
- if (all
- || eventName == eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent) {
- bool enabled = m_videoElement->webkitCurrentPlaybackTargetIsWireless();
- WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType = WebVideoFullscreenInterface::TargetTypeNone;
- String localizedDeviceName;
-
- if (m_videoElement->mediaControlsHost()) {
- static NeverDestroyed<String> airplay(ASCIILiteral("airplay"));
- static NeverDestroyed<String> tvout(ASCIILiteral("tvout"));
-
- String type = m_videoElement->mediaControlsHost()->externalDeviceType();
- if (type == airplay)
- targetType = WebVideoFullscreenInterface::TargetTypeAirPlay;
- else if (type == tvout)
- targetType = WebVideoFullscreenInterface::TargetTypeTVOut;
- localizedDeviceName = m_videoElement->mediaControlsHost()->externalDeviceDisplayName();
- }
- m_videoFullscreenInterface->setExternalPlayback(enabled, targetType, localizedDeviceName);
- m_videoFullscreenInterface->setWirelessVideoPlaybackDisabled(m_videoElement->mediaSession().wirelessVideoPlaybackDisabled(*m_videoElement));
- }
-}
-
-void WebVideoFullscreenModelVideoElement::setVideoFullscreenLayer(PlatformLayer* videoLayer)
-{
- if (m_videoFullscreenLayer == videoLayer)
- return;
-
- m_videoFullscreenLayer = videoLayer;
- [m_videoFullscreenLayer setAnchorPoint:CGPointMake(0.5, 0.5)];
- [m_videoFullscreenLayer setBounds:m_videoFrame];
-
- if (m_videoElement)
- m_videoElement->setVideoFullscreenLayer(m_videoFullscreenLayer.get());
-}
-
-void WebVideoFullscreenModelVideoElement::play()
-{
- if (m_videoElement)
- m_videoElement->play();
-}
-
-void WebVideoFullscreenModelVideoElement::pause()
-{
- if (m_videoElement)
- m_videoElement->pause();
-}
-
-void WebVideoFullscreenModelVideoElement::togglePlayState()
-{
- if (m_videoElement)
- m_videoElement->togglePlayState();
-}
-
-void WebVideoFullscreenModelVideoElement::beginScrubbing()
-{
- if (m_videoElement)
- m_videoElement->beginScrubbing();
-}
-
-void WebVideoFullscreenModelVideoElement::endScrubbing()
-{
- if (m_videoElement)
- m_videoElement->endScrubbing();
-}
-
-void WebVideoFullscreenModelVideoElement::seekToTime(double time)
-{
- if (m_videoElement)
- m_videoElement->setCurrentTime(time);
-}
-
-void WebVideoFullscreenModelVideoElement::fastSeek(double time)
-{
- if (m_videoElement)
- m_videoElement->fastSeek(time);
-}
-
-void WebVideoFullscreenModelVideoElement::beginScanningForward()
-{
- if (m_videoElement)
- m_videoElement->beginScanning(MediaControllerInterface::Forward);
-}
-
-void WebVideoFullscreenModelVideoElement::beginScanningBackward()
-{
- if (m_videoElement)
- m_videoElement->beginScanning(MediaControllerInterface::Backward);
-}
-
-void WebVideoFullscreenModelVideoElement::endScanning()
-{
- if (m_videoElement)
- m_videoElement->endScanning();
-}
-
-void WebVideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
-{
- if (m_videoElement && m_videoElement->fullscreenMode() != mode)
- m_videoElement->setFullscreenMode(mode);
-}
-
-void WebVideoFullscreenModelVideoElement::setVideoLayerFrame(FloatRect rect)
-{
- m_videoFrame = rect;
- [m_videoFullscreenLayer setBounds:CGRect(rect)];
- if (m_videoElement)
- m_videoElement->setVideoFullscreenFrame(rect);
-}
-
-void WebVideoFullscreenModelVideoElement::setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity gravity)
-{
- MediaPlayer::VideoGravity videoGravity = MediaPlayer::VideoGravityResizeAspect;
- if (gravity == WebVideoFullscreenModel::VideoGravityResize)
- videoGravity = MediaPlayer::VideoGravityResize;
- else if (gravity == WebVideoFullscreenModel::VideoGravityResizeAspect)
- videoGravity = MediaPlayer::VideoGravityResizeAspect;
- else if (gravity == WebVideoFullscreenModel::VideoGravityResizeAspectFill)
- videoGravity = MediaPlayer::VideoGravityResizeAspectFill;
- else
- ASSERT_NOT_REACHED();
-
- m_videoElement->setVideoFullscreenGravity(videoGravity);
-}
-
-void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t selectedAudioIndex)
-{
- AudioTrack* selectedAudioTrack = nullptr;
-
- for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
- auto& audioTrack = m_audioTracksForMenu[index];
- audioTrack->setEnabled(index == static_cast<size_t>(selectedAudioIndex));
- if (audioTrack->enabled())
- selectedAudioTrack = audioTrack.get();
- }
-
- m_videoElement->audioTrackEnabledChanged(selectedAudioTrack);
-}
-
-void WebVideoFullscreenModelVideoElement::selectLegibleMediaOption(uint64_t index)
-{
- TextTrack* textTrack = nullptr;
-
- if (index < m_legibleTracksForMenu.size())
- textTrack = m_legibleTracksForMenu[static_cast<size_t>(index)].get();
- else
- textTrack = TextTrack::captionMenuOffItem();
-
- m_videoElement->setSelectedTextTrack(textTrack);
-}
-
-void WebVideoFullscreenModelVideoElement::updateLegibleOptions()
-{
- AudioTrackList* audioTrackList = m_videoElement->audioTracks();
- TextTrackList* trackList = m_videoElement->textTracks();
-
- if ((!trackList && !audioTrackList) || !m_videoElement->document().page() || !m_videoElement->mediaControlsHost())
- return;
-
- WTF::AtomicString displayMode = m_videoElement->mediaControlsHost()->captionDisplayMode();
- TextTrack* offItem = m_videoElement->mediaControlsHost()->captionMenuOffItem();
- TextTrack* automaticItem = m_videoElement->mediaControlsHost()->captionMenuAutomaticItem();
- CaptionUserPreferences& captionPreferences = *m_videoElement->document().page()->group().captionPreferences();
- m_legibleTracksForMenu = captionPreferences.sortedTrackListForMenu(trackList);
-
- m_audioTracksForMenu = captionPreferences.sortedTrackListForMenu(audioTrackList);
-
- Vector<String> audioTrackDisplayNames;
- uint64_t selectedAudioIndex = 0;
-
- for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
- auto& track = m_audioTracksForMenu[index];
- audioTrackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
-
- if (track->enabled())
- selectedAudioIndex = index;
- }
-
- m_videoFullscreenInterface->setAudioMediaSelectionOptions(audioTrackDisplayNames, selectedAudioIndex);
-
- Vector<String> trackDisplayNames;
- uint64_t selectedIndex = 0;
- uint64_t offIndex = 0;
- bool trackMenuItemSelected = false;
-
- for (size_t index = 0; index < m_legibleTracksForMenu.size(); index++) {
- auto& track = m_legibleTracksForMenu[index];
- trackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
-
- if (track == offItem)
- offIndex = index;
-
- if (track == automaticItem && displayMode == MediaControlsHost::automaticKeyword()) {
- selectedIndex = index;
- trackMenuItemSelected = true;
- }
-
- if (displayMode != MediaControlsHost::automaticKeyword() && track->mode() == TextTrack::showingKeyword()) {
- selectedIndex = index;
- trackMenuItemSelected = true;
- }
- }
-
- if (offIndex && !trackMenuItemSelected && displayMode == MediaControlsHost::forcedOnlyKeyword()) {
- selectedIndex = offIndex;
- trackMenuItemSelected = true;
- }
-
- m_videoFullscreenInterface->setLegibleMediaSelectionOptions(trackDisplayNames, selectedIndex);
-}
-
-const Vector<AtomicString>& WebVideoFullscreenModelVideoElement::observedEventNames()
-{
- static NeverDestroyed<Vector<AtomicString>> sEventNames;
-
- if (!sEventNames.get().size()) {
- sEventNames.get().append(eventNames().durationchangeEvent);
- sEventNames.get().append(eventNames().pauseEvent);
- sEventNames.get().append(eventNames().playEvent);
- sEventNames.get().append(eventNames().ratechangeEvent);
- sEventNames.get().append(eventNames().timeupdateEvent);
- sEventNames.get().append(eventNames().addtrackEvent);
- sEventNames.get().append(eventNames().removetrackEvent);
- sEventNames.get().append(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
- }
- return sEventNames.get();
-}
-
-const AtomicString& WebVideoFullscreenModelVideoElement::eventNameAll()
-{
- static NeverDestroyed<AtomicString> sEventNameAll = "allEvents";
- return sEventNameAll;
-}
-
-void WebVideoFullscreenModelVideoElement::fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
-{
- if (m_videoElement)
- m_videoElement->fullscreenModeChanged(videoFullscreenMode);
-}
-
-bool WebVideoFullscreenModelVideoElement::isVisible() const
-{
- if (!m_videoElement)
- return false;
-
- if (Page* page = m_videoElement->document().page())
- return page->isVisible();
-
- return false;
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/ChangeLog        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-01-25 Ada Chan <adachan@apple.com>
+
+ Move WebVideoFullscreenManager and related classes from iOS specific folders to cocoa folders
+ https://bugs.webkit.org/show_bug.cgi?id=153473
+
+ Reviewed by Eric Carlson.
+
+ * DerivedSources.make:
+ Add new paths.
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h: Renamed from Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h.
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in: Renamed from Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in.
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm: Renamed from Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm.
+ (WebKit::WebVideoFullscreenManagerProxy::setSeekableRangesVector):
+ Fix a style error by moving the opening curly brace to the same line as the for statement.
+ * WebKit2.xcodeproj/project.pbxproj:
+ Update due to changes to the file locations.
+ * WebProcess/cocoa/WebVideoFullscreenManager.h: Renamed from Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h.
+ * WebProcess/cocoa/WebVideoFullscreenManager.messages.in: Renamed from Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in.
+ * WebProcess/cocoa/WebVideoFullscreenManager.mm: Renamed from Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm.
+ (WebKit::WebVideoFullscreenInterfaceContext::setSeekableRanges):
+ Fix a style error by adding a missing space after a comma.
+
</ins><span class="cx"> 2016-01-26 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> WebKitTestRunner: Credential cache is not cleared between tests
</span></span></pre></div>
<a id="trunkSourceWebKit2DerivedSourcesmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/DerivedSources.make (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/DerivedSources.make        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/DerivedSources.make        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -52,9 +52,11 @@
</span><span class="cx"> $(WebKit2)/WebProcess/UserContent \
</span><span class="cx"> $(WebKit2)/WebProcess/WebCoreSupport \
</span><span class="cx"> $(WebKit2)/WebProcess/WebPage \
</span><ins>+ $(WebKit2)/WebProcess/cocoa \
</ins><span class="cx"> $(WebKit2)/WebProcess/ios \
</span><span class="cx"> $(WebKit2)/WebProcess \
</span><span class="cx"> $(WebKit2)/UIProcess \
</span><ins>+ $(WebKit2)/UIProcess/Cocoa \
</ins><span class="cx"> $(WebKit2)/UIProcess/Databases \
</span><span class="cx"> $(WebKit2)/UIProcess/Downloads \
</span><span class="cx"> $(WebKit2)/UIProcess/Network \
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxyhfromrev195599trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h (from rev 195599, trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,174 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.
+ */
+
+#ifndef WebVideoFullscreenManagerProxy_h
+#define WebVideoFullscreenManagerProxy_h
+
+#if PLATFORM(IOS)
+
+#include "MessageReceiver.h"
+#include <WebCore/GraphicsLayer.h>
+#include <WebCore/WebVideoFullscreenInterfaceAVKit.h>
+#include <WebCore/WebVideoFullscreenModel.h>
+#include <wtf/HashMap.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+OBJC_CLASS UIView;
+
+namespace WebKit {
+
+class WebPageProxy;
+class WebVideoFullscreenManagerProxy;
+
+class WebVideoFullscreenModelContext final: public RefCounted<WebVideoFullscreenModelContext>, public WebCore::WebVideoFullscreenModel, public WebCore::WebVideoFullscreenChangeObserver {
+public:
+ static Ref<WebVideoFullscreenModelContext> create(WebVideoFullscreenManagerProxy& manager, uint64_t contextId)
+ {
+ return adoptRef(*new WebVideoFullscreenModelContext(manager, contextId));
+ }
+ virtual ~WebVideoFullscreenModelContext() { }
+
+ void invalidate() { m_manager = nullptr; }
+
+ UIView *layerHostView() const { return m_layerHostView.get(); }
+ void setLayerHostView(RetainPtr<UIView>&& layerHostView) { m_layerHostView = WTFMove(layerHostView); }
+
+private:
+ WebVideoFullscreenModelContext(WebVideoFullscreenManagerProxy& manager, uint64_t contextId)
+ : m_manager(&manager)
+ , m_contextId(contextId)
+ {
+ }
+
+ // WebVideoFullscreenModel
+ virtual void play() override;
+ virtual void pause() override;
+ virtual void togglePlayState() override;
+ virtual void beginScrubbing() override;
+ virtual void endScrubbing() override;
+ virtual void seekToTime(double) override;
+ virtual void fastSeek(double time) override;
+ virtual void beginScanningForward() override;
+ virtual void beginScanningBackward() override;
+ virtual void endScanning() override;
+ virtual void requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
+ virtual void setVideoLayerFrame(WebCore::FloatRect) override;
+ virtual void setVideoLayerGravity(VideoGravity) override;
+ virtual void selectAudioMediaOption(uint64_t) override;
+ virtual void selectLegibleMediaOption(uint64_t) override;
+ virtual void fullscreenModeChanged(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
+ virtual bool isVisible() const override;
+
+ // WebVideoFullscreenChangeObserver
+ virtual void didSetupFullscreen() override;
+ virtual void didEnterFullscreen() override;
+ virtual void didExitFullscreen() override;
+ virtual void didCleanupFullscreen() override;
+ virtual void fullscreenMayReturnToInline() override;
+
+ WebVideoFullscreenManagerProxy* m_manager;
+ uint64_t m_contextId;
+ RetainPtr<UIView *> m_layerHostView;
+};
+
+class WebVideoFullscreenManagerProxy : public RefCounted<WebVideoFullscreenManagerProxy>, private IPC::MessageReceiver {
+public:
+ static RefPtr<WebVideoFullscreenManagerProxy> create(WebPageProxy&);
+ virtual ~WebVideoFullscreenManagerProxy();
+
+ void invalidate();
+
+ void requestHideAndExitFullscreen();
+ bool hasMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
+ bool mayAutomaticallyShowVideoPictureInPicture() const;
+ void applicationDidBecomeActive();
+ bool isVisible() const;
+
+private:
+ friend class WebVideoFullscreenModelContext;
+
+ explicit WebVideoFullscreenManagerProxy(WebPageProxy&);
+ virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
+
+ typedef std::tuple<RefPtr<WebVideoFullscreenModelContext>, RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit>> ModelInterfaceTuple;
+ ModelInterfaceTuple createModelAndInterface(uint64_t contextId);
+ ModelInterfaceTuple& ensureModelAndInterface(uint64_t contextId);
+ WebVideoFullscreenModelContext& ensureModel(uint64_t contextId);
+ WebCore::WebVideoFullscreenInterfaceAVKit& ensureInterface(uint64_t contextId);
+
+ // Messages from WebVideoFullscreenManager
+ void setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture);
+ void resetMediaState(uint64_t contextId);
+ void setCurrentTime(uint64_t contextId, double currentTime, double hostTime);
+ void setBufferedTime(uint64_t contextId, double bufferedTime);
+ void setVideoDimensions(uint64_t contextId, bool hasVideo, unsigned width, unsigned height);
+ void setSeekableRangesVector(uint64_t contextId, Vector<std::pair<double, double>> ranges);
+ void setCanPlayFastReverse(uint64_t contextId, bool value);
+ void setAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex);
+ void setLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex);
+ void setExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName);
+ void setWirelessVideoPlaybackDisabled(uint64_t contextId, bool);
+ void setDuration(uint64_t contextId, double duration);
+ void setRate(uint64_t contextId, bool isPlaying, double rate);
+ void enterFullscreen(uint64_t contextId);
+ void exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect);
+ void cleanupFullscreen(uint64_t contextId);
+ void preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect);
+
+ // Messages to WebVideoFullscreenManager
+ void play(uint64_t contextId);
+ void pause(uint64_t contextId);
+ void togglePlayState(uint64_t contextId);
+ void beginScrubbing(uint64_t contextId);
+ void endScrubbing(uint64_t contextId);
+ void seekToTime(uint64_t contextId, double time);
+ void fastSeek(uint64_t contextId, double time);
+ void beginScanningForward(uint64_t contextId);
+ void beginScanningBackward(uint64_t contextId);
+ void endScanning(uint64_t contextId);
+ void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+ void didSetupFullscreen(uint64_t contextId);
+ void didExitFullscreen(uint64_t contextId);
+ void didEnterFullscreen(uint64_t contextId);
+ void didCleanupFullscreen(uint64_t contextId);
+ void setVideoLayerFrame(uint64_t contextId, WebCore::FloatRect);
+ void setVideoLayerGravity(uint64_t contextId, WebCore::WebVideoFullscreenModel::VideoGravity);
+ void selectAudioMediaOption(uint64_t contextId, uint64_t index);
+ void selectLegibleMediaOption(uint64_t contextId, uint64_t index);
+ void fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+ void fullscreenMayReturnToInline(uint64_t contextId);
+
+ WebPageProxy* m_page;
+ HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
+
+};
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
+
+#endif // WebVideoFullscreenManagerProxy_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymessagesinfromrev195599trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in (from rev 195599, trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.messages.in        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,43 @@
</span><ins>+# Copyright (C) 2014 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.
+
+#if PLATFORM(IOS)
+messages -> WebVideoFullscreenManagerProxy {
+ ResetMediaState(uint64_t contextId)
+ SetCurrentTime(uint64_t contextId, double currentTime, double hostTime)
+ SetBufferedTime(uint64_t contextId, double bufferedTime)
+ SetVideoDimensions(uint64_t contextId, bool hasVideo, unsigned width, unsigned height)
+ SetSeekableRangesVector(uint64_t contextId, Vector<std::pair<double, double>> ranges)
+ SetCanPlayFastReverse(uint64_t contextId, bool value)
+ SetAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
+ SetLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
+ SetExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName)
+ SetWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
+ SetDuration(uint64_t contextId, double duration)
+ SetRate(uint64_t contextId, bool isPlaying, double rate)
+ SetupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture)
+ EnterFullscreen(uint64_t contextId)
+ ExitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
+ CleanupFullscreen(uint64_t contextId)
+ PreparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebVideoFullscreenManagerProxymmfromrev195599trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (from rev 195599, trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm         (rev 0)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,593 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 "WebVideoFullscreenManagerProxy.h"
+
+#if PLATFORM(IOS)
+
+#import "RemoteLayerTreeDrawingAreaProxy.h"
+#import "UIKitSPI.h"
+#import "WebPageProxy.h"
+#import "WebProcessProxy.h"
+#import "WebVideoFullscreenManagerMessages.h"
+#import "WebVideoFullscreenManagerProxyMessages.h"
+#import <QuartzCore/CoreAnimation.h>
+#import <WebCore/QuartzCoreSPI.h>
+#import <WebCore/TimeRanges.h>
+#import <WebKitSystemInterface.h>
+
+@interface WKLayerHostView : UIView
+@property (nonatomic, assign) uint32_t contextID;
+@end
+
+@implementation WKLayerHostView
+
++ (Class)layerClass {
+ return [CALayerHost class];
+}
+
+- (uint32_t)contextID {
+ return [[self layerHost] contextId];
+}
+
+- (void)setContextID:(uint32_t)contextID {
+ [[self layerHost] setContextId:contextID];
+}
+
+- (CALayerHost *)layerHost {
+ return (CALayerHost *)[self layer];
+}
+
+@end
+
+using namespace WebCore;
+
+namespace WebKit {
+
+#if !HAVE(AVKIT)
+
+RefPtr<WebVideoFullscreenManagerProxy> WebVideoFullscreenManagerProxy::create(WebPageProxy&)
+{
+ return nullptr;
+}
+
+void WebVideoFullscreenManagerProxy::invalidate()
+{
+}
+
+bool WebVideoFullscreenManagerProxy::hasMode(HTMLMediaElementEnums::VideoFullscreenMode) const
+{
+ return false;
+}
+
+bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture() const
+{
+ return false;
+}
+
+void WebVideoFullscreenManagerProxy::requestHideAndExitFullscreen()
+{
+
+}
+
+void WebVideoFullscreenManagerProxy::applicationDidBecomeActive()
+{
+
+}
+#else
+
+#pragma mark - WebVideoFullscreenModelContext
+
+void WebVideoFullscreenModelContext::play()
+{
+ if (m_manager)
+ m_manager->play(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::pause()
+{
+ if (m_manager)
+ m_manager->pause(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::togglePlayState()
+{
+ if (m_manager)
+ m_manager->togglePlayState(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::beginScrubbing()
+{
+ if (m_manager)
+ m_manager->beginScrubbing(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::endScrubbing()
+{
+ if (m_manager)
+ m_manager->endScrubbing(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::seekToTime(double time)
+{
+ if (m_manager)
+ m_manager->seekToTime(m_contextId, time);
+}
+
+void WebVideoFullscreenModelContext::fastSeek(double time)
+{
+ if (m_manager)
+ m_manager->fastSeek(m_contextId, time);
+}
+
+void WebVideoFullscreenModelContext::beginScanningForward()
+{
+ if (m_manager)
+ m_manager->beginScanningForward(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::beginScanningBackward()
+{
+ if (m_manager)
+ m_manager->beginScanningBackward(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::endScanning()
+{
+ if (m_manager)
+ m_manager->endScanning(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ if (m_manager)
+ m_manager->requestFullscreenMode(m_contextId, mode);
+}
+
+void WebVideoFullscreenModelContext::setVideoLayerFrame(WebCore::FloatRect frame)
+{
+ if (m_manager)
+ m_manager->setVideoLayerFrame(m_contextId, frame);
+}
+
+void WebVideoFullscreenModelContext::setVideoLayerGravity(WebCore::WebVideoFullscreenModel::VideoGravity gravity)
+{
+ if (m_manager)
+ m_manager->setVideoLayerGravity(m_contextId, gravity);
+}
+
+void WebVideoFullscreenModelContext::selectAudioMediaOption(uint64_t optionId)
+{
+ if (m_manager)
+ m_manager->selectAudioMediaOption(m_contextId, optionId);
+}
+
+void WebVideoFullscreenModelContext::selectLegibleMediaOption(uint64_t optionId)
+{
+ if (m_manager)
+ m_manager->selectLegibleMediaOption(m_contextId, optionId);
+}
+
+void WebVideoFullscreenModelContext::fullscreenModeChanged(WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ if (m_manager)
+ m_manager->fullscreenModeChanged(m_contextId, mode);
+}
+
+bool WebVideoFullscreenModelContext::isVisible() const
+{
+ return m_manager ? m_manager->isVisible() : false;
+}
+
+void WebVideoFullscreenModelContext::didSetupFullscreen()
+{
+ if (m_manager)
+ m_manager->didSetupFullscreen(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::didEnterFullscreen()
+{
+ if (m_manager)
+ m_manager->didEnterFullscreen(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::didExitFullscreen()
+{
+ if (m_manager)
+ m_manager->didExitFullscreen(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::didCleanupFullscreen()
+{
+ if (m_manager)
+ m_manager->didCleanupFullscreen(m_contextId);
+}
+
+void WebVideoFullscreenModelContext::fullscreenMayReturnToInline()
+{
+ if (m_manager)
+ m_manager->fullscreenMayReturnToInline(m_contextId);
+}
+
+#pragma mark - WebVideoFullscreenManagerProxy
+
+RefPtr<WebVideoFullscreenManagerProxy> WebVideoFullscreenManagerProxy::create(WebPageProxy& page)
+{
+ return adoptRef(new WebVideoFullscreenManagerProxy(page));
+}
+
+WebVideoFullscreenManagerProxy::WebVideoFullscreenManagerProxy(WebPageProxy& page)
+ : m_page(&page)
+{
+ m_page->process().addMessageReceiver(Messages::WebVideoFullscreenManagerProxy::messageReceiverName(), m_page->pageID(), *this);
+}
+
+WebVideoFullscreenManagerProxy::~WebVideoFullscreenManagerProxy()
+{
+ if (!m_page)
+ return;
+ invalidate();
+}
+
+void WebVideoFullscreenManagerProxy::invalidate()
+{
+ m_page->process().removeMessageReceiver(Messages::WebVideoFullscreenManagerProxy::messageReceiverName(), m_page->pageID());
+ m_page = nullptr;
+
+ for (auto& tuple : m_contextMap.values()) {
+ RefPtr<WebVideoFullscreenModelContext> model;
+ RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit> interface;
+ std::tie(model, interface) = tuple;
+
+ interface->invalidate();
+ [model->layerHostView() removeFromSuperview];
+ model->setLayerHostView(nullptr);
+ }
+
+ m_contextMap.clear();
+}
+
+void WebVideoFullscreenManagerProxy::requestHideAndExitFullscreen()
+{
+ for (auto& tuple : m_contextMap.values())
+ std::get<1>(tuple)->requestHideAndExitFullscreen();
+}
+
+bool WebVideoFullscreenManagerProxy::hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const
+{
+ for (auto& tuple : m_contextMap.values()) {
+ if (std::get<1>(tuple)->hasMode(mode))
+ return true;
+ }
+ return false;
+}
+
+bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture() const
+{
+ for (auto& tuple : m_contextMap.values()) {
+ if (std::get<1>(tuple)->mayAutomaticallyShowVideoPictureInPicture())
+ return true;
+ }
+ return false;
+}
+
+void WebVideoFullscreenManagerProxy::applicationDidBecomeActive()
+{
+ for (auto& tuple : m_contextMap.values())
+ std::get<1>(tuple)->applicationDidBecomeActive();
+}
+
+WebVideoFullscreenManagerProxy::ModelInterfaceTuple WebVideoFullscreenManagerProxy::createModelAndInterface(uint64_t contextId)
+{
+ Ref<WebVideoFullscreenModelContext> model = WebVideoFullscreenModelContext::create(*this, contextId);
+ Ref<WebCore::WebVideoFullscreenInterfaceAVKit> interface = WebVideoFullscreenInterfaceAVKit::create();
+
+ interface->setWebVideoFullscreenModel(&model.get());
+ interface->setWebVideoFullscreenChangeObserver(&model.get());
+
+ return std::make_tuple(WTFMove(model), WTFMove(interface));
+}
+
+WebVideoFullscreenManagerProxy::ModelInterfaceTuple& WebVideoFullscreenManagerProxy::ensureModelAndInterface(uint64_t contextId)
+{
+ auto addResult = m_contextMap.add(contextId, ModelInterfaceTuple());
+ if (addResult.isNewEntry)
+ addResult.iterator->value = createModelAndInterface(contextId);
+ return addResult.iterator->value;
+}
+
+WebVideoFullscreenModelContext& WebVideoFullscreenManagerProxy::ensureModel(uint64_t contextId)
+{
+ return *std::get<0>(ensureModelAndInterface(contextId));
+}
+
+WebCore::WebVideoFullscreenInterfaceAVKit& WebVideoFullscreenManagerProxy::ensureInterface(uint64_t contextId)
+{
+ return *std::get<1>(ensureModelAndInterface(contextId));
+}
+
+#pragma mark Messages from WebVideoFullscreenManager
+
+void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingDeviceScaleFactor, HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture)
+{
+ ASSERT(videoLayerID);
+ RefPtr<WebVideoFullscreenModelContext> model;
+ RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit> interface;
+
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+
+ RetainPtr<WKLayerHostView> view = static_cast<WKLayerHostView*>(model->layerHostView());
+ if (!view) {
+ view = adoptNS([[WKLayerHostView alloc] init]);
+ model->setLayerHostView(view);
+ }
+ [view setContextID:videoLayerID];
+ if (hostingDeviceScaleFactor != 1) {
+ // Invert the scale transform added in the WebProcess to fix <rdar://problem/18316542>.
+ float inverseScale = 1 / hostingDeviceScaleFactor;
+ [[view layer] setSublayerTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)];
+ }
+
+ UIView *parentView = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_page->drawingArea()).remoteLayerTreeHost().rootLayer();
+ interface->setupFullscreen(*model->layerHostView(), initialRect, parentView, videoFullscreenMode, allowsPictureInPicture);
+}
+
+void WebVideoFullscreenManagerProxy::resetMediaState(uint64_t contextId)
+{
+ ensureInterface(contextId).resetMediaState();
+}
+
+void WebVideoFullscreenManagerProxy::setCurrentTime(uint64_t contextId, double currentTime, double hostTime)
+{
+ ensureInterface(contextId).setCurrentTime(currentTime, hostTime);
+}
+
+void WebVideoFullscreenManagerProxy::setBufferedTime(uint64_t contextId, double bufferedTime)
+{
+ ensureInterface(contextId).setBufferedTime(bufferedTime);
+}
+
+void WebVideoFullscreenManagerProxy::setVideoDimensions(uint64_t contextId, bool hasVideo, unsigned width, unsigned height)
+{
+ ensureInterface(contextId).setVideoDimensions(hasVideo, width, height);
+}
+
+void WebVideoFullscreenManagerProxy::setSeekableRangesVector(uint64_t contextId, Vector<std::pair<double, double>> ranges)
+{
+ RefPtr<TimeRanges> timeRanges = TimeRanges::create();
+ for (const auto& range : ranges) {
+ ASSERT(isfinite(range.first));
+ ASSERT(isfinite(range.second));
+ ASSERT(range.second >= range.first);
+ timeRanges->add(range.first, range.second);
+ }
+
+ ensureInterface(contextId).setSeekableRanges(*timeRanges);
+}
+
+void WebVideoFullscreenManagerProxy::setCanPlayFastReverse(uint64_t contextId, bool value)
+{
+ ensureInterface(contextId).setCanPlayFastReverse(value);
+}
+
+void WebVideoFullscreenManagerProxy::setAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
+{
+ ensureInterface(contextId).setAudioMediaSelectionOptions(options, selectedIndex);
+}
+
+void WebVideoFullscreenManagerProxy::setLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
+{
+ ensureInterface(contextId).setLegibleMediaSelectionOptions(options, selectedIndex);
+}
+
+void WebVideoFullscreenManagerProxy::setExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName)
+{
+ WebVideoFullscreenInterface::ExternalPlaybackTargetType type = static_cast<WebVideoFullscreenInterface::ExternalPlaybackTargetType>(targetType);
+ ASSERT(type == WebVideoFullscreenInterface::TargetTypeAirPlay || type == WebVideoFullscreenInterface::TargetTypeTVOut || type == WebVideoFullscreenInterface::TargetTypeNone);
+
+ ensureInterface(contextId).setExternalPlayback(enabled, type, localizedDeviceName);
+}
+
+void WebVideoFullscreenManagerProxy::setWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
+{
+ ensureInterface(contextId).setWirelessVideoPlaybackDisabled(disabled);
+}
+
+void WebVideoFullscreenManagerProxy::setDuration(uint64_t contextId, double duration)
+{
+ ensureInterface(contextId).setDuration(duration);
+}
+
+void WebVideoFullscreenManagerProxy::setRate(uint64_t contextId, bool isPlaying, double rate)
+{
+ ensureInterface(contextId).setRate(isPlaying, rate);
+}
+
+void WebVideoFullscreenManagerProxy::enterFullscreen(uint64_t contextId)
+{
+ auto& interface = ensureInterface(contextId);
+ interface.enterFullscreen();
+
+ // Only one context can be in a given full screen mode at a time:
+ for (auto& contextPair : m_contextMap) {
+ auto& otherContextId = contextPair.key;
+ if (contextId == otherContextId)
+ continue;
+
+ auto& otherInterface = std::get<1>(contextPair.value);
+ if (otherInterface->hasMode(interface.mode()))
+ otherInterface->requestHideAndExitFullscreen();
+ }
+}
+
+void WebVideoFullscreenManagerProxy::exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
+{
+ ensureInterface(contextId).exitFullscreen(finalRect);
+}
+
+void WebVideoFullscreenManagerProxy::cleanupFullscreen(uint64_t contextId)
+{
+ ensureInterface(contextId).cleanupFullscreen();
+}
+
+void WebVideoFullscreenManagerProxy::preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
+{
+ m_page->fullscreenMayReturnToInline();
+
+ ensureInterface(contextId).preparedToReturnToInline(visible, inlineRect);
+}
+
+#pragma mark Messages to WebVideoFullscreenManager
+
+void WebVideoFullscreenManagerProxy::play(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::Play(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::pause(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::Pause(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::togglePlayState(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::TogglePlayState(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::beginScrubbing(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::BeginScrubbing(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::endScrubbing(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::EndScrubbing(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::seekToTime(uint64_t contextId, double time)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::SeekToTime(contextId, time), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::fastSeek(uint64_t contextId, double time)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::FastSeek(contextId, time), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::beginScanningForward(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::BeginScanningForward(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::beginScanningBackward(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::BeginScanningBackward(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::endScanning(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::EndScanning(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::RequestFullscreenMode(contextId, mode), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::didSetupFullscreen(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::DidSetupFullscreen(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::didExitFullscreen(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::DidExitFullscreen(contextId), m_page->pageID());
+ m_page->didExitFullscreen();
+}
+
+void WebVideoFullscreenManagerProxy::didEnterFullscreen(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::DidEnterFullscreen(contextId), m_page->pageID());
+ m_page->didEnterFullscreen();
+}
+
+void WebVideoFullscreenManagerProxy::didCleanupFullscreen(uint64_t contextId)
+{
+ auto& model = ensureModel(contextId);
+
+ [CATransaction flush];
+ [model.layerHostView() removeFromSuperview];
+ model.setLayerHostView(nullptr);
+ m_page->send(Messages::WebVideoFullscreenManager::DidCleanupFullscreen(contextId), m_page->pageID());
+
+ m_contextMap.remove(contextId);
+}
+
+void WebVideoFullscreenManagerProxy::setVideoLayerFrame(uint64_t contextId, WebCore::FloatRect frame)
+{
+ @autoreleasepool {
+ mach_port_name_t fencePort = [UIWindow _synchronizeDrawingAcrossProcesses];
+
+ m_page->send(Messages::WebVideoFullscreenManager::SetVideoLayerFrameFenced(contextId, frame, IPC::Attachment(fencePort, MACH_MSG_TYPE_MOVE_SEND)), m_page->pageID());
+ }
+}
+
+void WebVideoFullscreenManagerProxy::setVideoLayerGravity(uint64_t contextId, WebCore::WebVideoFullscreenModel::VideoGravity gravity)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::SetVideoLayerGravityEnum(contextId, (unsigned)gravity), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::selectAudioMediaOption(uint64_t contextId, uint64_t index)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::SelectAudioMediaOption(contextId, index), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::selectLegibleMediaOption(uint64_t contextId, uint64_t index)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::SelectLegibleMediaOption(contextId, index), m_page->pageID());
+}
+
+void WebVideoFullscreenManagerProxy::fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ m_page->send(Messages::WebVideoFullscreenManager::FullscreenModeChanged(contextId, mode), m_page->pageID());
+}
+
+bool WebVideoFullscreenManagerProxy::isVisible() const
+{
+ return m_page->isViewVisible() && m_page->isInWindow();
+}
+
+void WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline(uint64_t contextId)
+{
+ bool isViewVisible = m_page->isViewVisible();
+ m_page->send(Messages::WebVideoFullscreenManager::FullscreenMayReturnToInline(contextId, isViewVisible), m_page->pageID());
+}
+
+#endif
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxyh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,174 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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.
- */
-
-#ifndef WebVideoFullscreenManagerProxy_h
-#define WebVideoFullscreenManagerProxy_h
-
-#if PLATFORM(IOS)
-
-#include "MessageReceiver.h"
-#include <WebCore/GraphicsLayer.h>
-#include <WebCore/WebVideoFullscreenInterfaceAVKit.h>
-#include <WebCore/WebVideoFullscreenModel.h>
-#include <wtf/HashMap.h>
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-OBJC_CLASS UIView;
-
-namespace WebKit {
-
-class WebPageProxy;
-class WebVideoFullscreenManagerProxy;
-
-class WebVideoFullscreenModelContext final: public RefCounted<WebVideoFullscreenModelContext>, public WebCore::WebVideoFullscreenModel, public WebCore::WebVideoFullscreenChangeObserver {
-public:
- static Ref<WebVideoFullscreenModelContext> create(WebVideoFullscreenManagerProxy& manager, uint64_t contextId)
- {
- return adoptRef(*new WebVideoFullscreenModelContext(manager, contextId));
- }
- virtual ~WebVideoFullscreenModelContext() { }
-
- void invalidate() { m_manager = nullptr; }
-
- UIView *layerHostView() const { return m_layerHostView.get(); }
- void setLayerHostView(RetainPtr<UIView>&& layerHostView) { m_layerHostView = WTFMove(layerHostView); }
-
-private:
- WebVideoFullscreenModelContext(WebVideoFullscreenManagerProxy& manager, uint64_t contextId)
- : m_manager(&manager)
- , m_contextId(contextId)
- {
- }
-
- // WebVideoFullscreenModel
- virtual void play() override;
- virtual void pause() override;
- virtual void togglePlayState() override;
- virtual void beginScrubbing() override;
- virtual void endScrubbing() override;
- virtual void seekToTime(double) override;
- virtual void fastSeek(double time) override;
- virtual void beginScanningForward() override;
- virtual void beginScanningBackward() override;
- virtual void endScanning() override;
- virtual void requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
- virtual void setVideoLayerFrame(WebCore::FloatRect) override;
- virtual void setVideoLayerGravity(VideoGravity) override;
- virtual void selectAudioMediaOption(uint64_t) override;
- virtual void selectLegibleMediaOption(uint64_t) override;
- virtual void fullscreenModeChanged(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
- virtual bool isVisible() const override;
-
- // WebVideoFullscreenChangeObserver
- virtual void didSetupFullscreen() override;
- virtual void didEnterFullscreen() override;
- virtual void didExitFullscreen() override;
- virtual void didCleanupFullscreen() override;
- virtual void fullscreenMayReturnToInline() override;
-
- WebVideoFullscreenManagerProxy* m_manager;
- uint64_t m_contextId;
- RetainPtr<UIView *> m_layerHostView;
-};
-
-class WebVideoFullscreenManagerProxy : public RefCounted<WebVideoFullscreenManagerProxy>, private IPC::MessageReceiver {
-public:
- static RefPtr<WebVideoFullscreenManagerProxy> create(WebPageProxy&);
- virtual ~WebVideoFullscreenManagerProxy();
-
- void invalidate();
-
- void requestHideAndExitFullscreen();
- bool hasMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) const;
- bool mayAutomaticallyShowVideoPictureInPicture() const;
- void applicationDidBecomeActive();
- bool isVisible() const;
-
-private:
- friend class WebVideoFullscreenModelContext;
-
- explicit WebVideoFullscreenManagerProxy(WebPageProxy&);
- virtual void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
-
- typedef std::tuple<RefPtr<WebVideoFullscreenModelContext>, RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit>> ModelInterfaceTuple;
- ModelInterfaceTuple createModelAndInterface(uint64_t contextId);
- ModelInterfaceTuple& ensureModelAndInterface(uint64_t contextId);
- WebVideoFullscreenModelContext& ensureModel(uint64_t contextId);
- WebCore::WebVideoFullscreenInterfaceAVKit& ensureInterface(uint64_t contextId);
-
- // Messages from WebVideoFullscreenManager
- void setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool allowsPictureInPicture);
- void resetMediaState(uint64_t contextId);
- void setCurrentTime(uint64_t contextId, double currentTime, double hostTime);
- void setBufferedTime(uint64_t contextId, double bufferedTime);
- void setVideoDimensions(uint64_t contextId, bool hasVideo, unsigned width, unsigned height);
- void setSeekableRangesVector(uint64_t contextId, Vector<std::pair<double, double>> ranges);
- void setCanPlayFastReverse(uint64_t contextId, bool value);
- void setAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex);
- void setLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex);
- void setExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName);
- void setWirelessVideoPlaybackDisabled(uint64_t contextId, bool);
- void setDuration(uint64_t contextId, double duration);
- void setRate(uint64_t contextId, bool isPlaying, double rate);
- void enterFullscreen(uint64_t contextId);
- void exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect);
- void cleanupFullscreen(uint64_t contextId);
- void preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect);
-
- // Messages to WebVideoFullscreenManager
- void play(uint64_t contextId);
- void pause(uint64_t contextId);
- void togglePlayState(uint64_t contextId);
- void beginScrubbing(uint64_t contextId);
- void endScrubbing(uint64_t contextId);
- void seekToTime(uint64_t contextId, double time);
- void fastSeek(uint64_t contextId, double time);
- void beginScanningForward(uint64_t contextId);
- void beginScanningBackward(uint64_t contextId);
- void endScanning(uint64_t contextId);
- void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
- void didSetupFullscreen(uint64_t contextId);
- void didExitFullscreen(uint64_t contextId);
- void didEnterFullscreen(uint64_t contextId);
- void didCleanupFullscreen(uint64_t contextId);
- void setVideoLayerFrame(uint64_t contextId, WebCore::FloatRect);
- void setVideoLayerGravity(uint64_t contextId, WebCore::WebVideoFullscreenModel::VideoGravity);
- void selectAudioMediaOption(uint64_t contextId, uint64_t index);
- void selectLegibleMediaOption(uint64_t contextId, uint64_t index);
- void fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
- void fullscreenMayReturnToInline(uint64_t contextId);
-
- WebPageProxy* m_page;
- HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
-
-};
-
-} // namespace WebKit
-
-#endif // PLATFORM(IOS)
-
-#endif // WebVideoFullscreenManagerProxy_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymessagesin"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.messages.in        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,43 +0,0 @@
</span><del>-# Copyright (C) 2014 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.
-
-#if PLATFORM(IOS)
-messages -> WebVideoFullscreenManagerProxy {
- ResetMediaState(uint64_t contextId)
- SetCurrentTime(uint64_t contextId, double currentTime, double hostTime)
- SetBufferedTime(uint64_t contextId, double bufferedTime)
- SetVideoDimensions(uint64_t contextId, bool hasVideo, unsigned width, unsigned height)
- SetSeekableRangesVector(uint64_t contextId, Vector<std::pair<double, double>> ranges)
- SetCanPlayFastReverse(uint64_t contextId, bool value)
- SetAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
- SetLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
- SetExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName)
- SetWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
- SetDuration(uint64_t contextId, double duration)
- SetRate(uint64_t contextId, bool isPlaying, double rate)
- SetupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, WebCore::IntRect initialRect, float hostingScaleFactor, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture)
- EnterFullscreen(uint64_t contextId)
- ExitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
- CleanupFullscreen(uint64_t contextId)
- PreparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
-}
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebVideoFullscreenManagerProxymm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/UIProcess/ios/WebVideoFullscreenManagerProxy.mm        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,594 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 "WebVideoFullscreenManagerProxy.h"
-
-#if PLATFORM(IOS)
-
-#import "RemoteLayerTreeDrawingAreaProxy.h"
-#import "UIKitSPI.h"
-#import "WebPageProxy.h"
-#import "WebProcessProxy.h"
-#import "WebVideoFullscreenManagerMessages.h"
-#import "WebVideoFullscreenManagerProxyMessages.h"
-#import <QuartzCore/CoreAnimation.h>
-#import <WebCore/QuartzCoreSPI.h>
-#import <WebCore/TimeRanges.h>
-#import <WebKitSystemInterface.h>
-
-@interface WKLayerHostView : UIView
-@property (nonatomic, assign) uint32_t contextID;
-@end
-
-@implementation WKLayerHostView
-
-+ (Class)layerClass {
- return [CALayerHost class];
-}
-
-- (uint32_t)contextID {
- return [[self layerHost] contextId];
-}
-
-- (void)setContextID:(uint32_t)contextID {
- [[self layerHost] setContextId:contextID];
-}
-
-- (CALayerHost *)layerHost {
- return (CALayerHost *)[self layer];
-}
-
-@end
-
-using namespace WebCore;
-
-namespace WebKit {
-
-#if !HAVE(AVKIT)
-
-RefPtr<WebVideoFullscreenManagerProxy> WebVideoFullscreenManagerProxy::create(WebPageProxy&)
-{
- return nullptr;
-}
-
-void WebVideoFullscreenManagerProxy::invalidate()
-{
-}
-
-bool WebVideoFullscreenManagerProxy::hasMode(HTMLMediaElementEnums::VideoFullscreenMode) const
-{
- return false;
-}
-
-bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture() const
-{
- return false;
-}
-
-void WebVideoFullscreenManagerProxy::requestHideAndExitFullscreen()
-{
-
-}
-
-void WebVideoFullscreenManagerProxy::applicationDidBecomeActive()
-{
-
-}
-#else
-
-#pragma mark - WebVideoFullscreenModelContext
-
-void WebVideoFullscreenModelContext::play()
-{
- if (m_manager)
- m_manager->play(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::pause()
-{
- if (m_manager)
- m_manager->pause(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::togglePlayState()
-{
- if (m_manager)
- m_manager->togglePlayState(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::beginScrubbing()
-{
- if (m_manager)
- m_manager->beginScrubbing(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::endScrubbing()
-{
- if (m_manager)
- m_manager->endScrubbing(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::seekToTime(double time)
-{
- if (m_manager)
- m_manager->seekToTime(m_contextId, time);
-}
-
-void WebVideoFullscreenModelContext::fastSeek(double time)
-{
- if (m_manager)
- m_manager->fastSeek(m_contextId, time);
-}
-
-void WebVideoFullscreenModelContext::beginScanningForward()
-{
- if (m_manager)
- m_manager->beginScanningForward(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::beginScanningBackward()
-{
- if (m_manager)
- m_manager->beginScanningBackward(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::endScanning()
-{
- if (m_manager)
- m_manager->endScanning(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
-{
- if (m_manager)
- m_manager->requestFullscreenMode(m_contextId, mode);
-}
-
-void WebVideoFullscreenModelContext::setVideoLayerFrame(WebCore::FloatRect frame)
-{
- if (m_manager)
- m_manager->setVideoLayerFrame(m_contextId, frame);
-}
-
-void WebVideoFullscreenModelContext::setVideoLayerGravity(WebCore::WebVideoFullscreenModel::VideoGravity gravity)
-{
- if (m_manager)
- m_manager->setVideoLayerGravity(m_contextId, gravity);
-}
-
-void WebVideoFullscreenModelContext::selectAudioMediaOption(uint64_t optionId)
-{
- if (m_manager)
- m_manager->selectAudioMediaOption(m_contextId, optionId);
-}
-
-void WebVideoFullscreenModelContext::selectLegibleMediaOption(uint64_t optionId)
-{
- if (m_manager)
- m_manager->selectLegibleMediaOption(m_contextId, optionId);
-}
-
-void WebVideoFullscreenModelContext::fullscreenModeChanged(WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
-{
- if (m_manager)
- m_manager->fullscreenModeChanged(m_contextId, mode);
-}
-
-bool WebVideoFullscreenModelContext::isVisible() const
-{
- return m_manager ? m_manager->isVisible() : false;
-}
-
-void WebVideoFullscreenModelContext::didSetupFullscreen()
-{
- if (m_manager)
- m_manager->didSetupFullscreen(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::didEnterFullscreen()
-{
- if (m_manager)
- m_manager->didEnterFullscreen(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::didExitFullscreen()
-{
- if (m_manager)
- m_manager->didExitFullscreen(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::didCleanupFullscreen()
-{
- if (m_manager)
- m_manager->didCleanupFullscreen(m_contextId);
-}
-
-void WebVideoFullscreenModelContext::fullscreenMayReturnToInline()
-{
- if (m_manager)
- m_manager->fullscreenMayReturnToInline(m_contextId);
-}
-
-#pragma mark - WebVideoFullscreenManagerProxy
-
-RefPtr<WebVideoFullscreenManagerProxy> WebVideoFullscreenManagerProxy::create(WebPageProxy& page)
-{
- return adoptRef(new WebVideoFullscreenManagerProxy(page));
-}
-
-WebVideoFullscreenManagerProxy::WebVideoFullscreenManagerProxy(WebPageProxy& page)
- : m_page(&page)
-{
- m_page->process().addMessageReceiver(Messages::WebVideoFullscreenManagerProxy::messageReceiverName(), m_page->pageID(), *this);
-}
-
-WebVideoFullscreenManagerProxy::~WebVideoFullscreenManagerProxy()
-{
- if (!m_page)
- return;
- invalidate();
-}
-
-void WebVideoFullscreenManagerProxy::invalidate()
-{
- m_page->process().removeMessageReceiver(Messages::WebVideoFullscreenManagerProxy::messageReceiverName(), m_page->pageID());
- m_page = nullptr;
-
- for (auto& tuple : m_contextMap.values()) {
- RefPtr<WebVideoFullscreenModelContext> model;
- RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit> interface;
- std::tie(model, interface) = tuple;
-
- interface->invalidate();
- [model->layerHostView() removeFromSuperview];
- model->setLayerHostView(nullptr);
- }
-
- m_contextMap.clear();
-}
-
-void WebVideoFullscreenManagerProxy::requestHideAndExitFullscreen()
-{
- for (auto& tuple : m_contextMap.values())
- std::get<1>(tuple)->requestHideAndExitFullscreen();
-}
-
-bool WebVideoFullscreenManagerProxy::hasMode(HTMLMediaElementEnums::VideoFullscreenMode mode) const
-{
- for (auto& tuple : m_contextMap.values()) {
- if (std::get<1>(tuple)->hasMode(mode))
- return true;
- }
- return false;
-}
-
-bool WebVideoFullscreenManagerProxy::mayAutomaticallyShowVideoPictureInPicture() const
-{
- for (auto& tuple : m_contextMap.values()) {
- if (std::get<1>(tuple)->mayAutomaticallyShowVideoPictureInPicture())
- return true;
- }
- return false;
-}
-
-void WebVideoFullscreenManagerProxy::applicationDidBecomeActive()
-{
- for (auto& tuple : m_contextMap.values())
- std::get<1>(tuple)->applicationDidBecomeActive();
-}
-
-WebVideoFullscreenManagerProxy::ModelInterfaceTuple WebVideoFullscreenManagerProxy::createModelAndInterface(uint64_t contextId)
-{
- Ref<WebVideoFullscreenModelContext> model = WebVideoFullscreenModelContext::create(*this, contextId);
- Ref<WebCore::WebVideoFullscreenInterfaceAVKit> interface = WebVideoFullscreenInterfaceAVKit::create();
-
- interface->setWebVideoFullscreenModel(&model.get());
- interface->setWebVideoFullscreenChangeObserver(&model.get());
-
- return std::make_tuple(WTFMove(model), WTFMove(interface));
-}
-
-WebVideoFullscreenManagerProxy::ModelInterfaceTuple& WebVideoFullscreenManagerProxy::ensureModelAndInterface(uint64_t contextId)
-{
- auto addResult = m_contextMap.add(contextId, ModelInterfaceTuple());
- if (addResult.isNewEntry)
- addResult.iterator->value = createModelAndInterface(contextId);
- return addResult.iterator->value;
-}
-
-WebVideoFullscreenModelContext& WebVideoFullscreenManagerProxy::ensureModel(uint64_t contextId)
-{
- return *std::get<0>(ensureModelAndInterface(contextId));
-}
-
-WebCore::WebVideoFullscreenInterfaceAVKit& WebVideoFullscreenManagerProxy::ensureInterface(uint64_t contextId)
-{
- return *std::get<1>(ensureModelAndInterface(contextId));
-}
-
-#pragma mark Messages from WebVideoFullscreenManager
-
-void WebVideoFullscreenManagerProxy::setupFullscreenWithID(uint64_t contextId, uint32_t videoLayerID, const WebCore::IntRect& initialRect, float hostingDeviceScaleFactor, HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode, bool allowsPictureInPicture)
-{
- ASSERT(videoLayerID);
- RefPtr<WebVideoFullscreenModelContext> model;
- RefPtr<WebCore::WebVideoFullscreenInterfaceAVKit> interface;
-
- std::tie(model, interface) = ensureModelAndInterface(contextId);
-
- RetainPtr<WKLayerHostView> view = static_cast<WKLayerHostView*>(model->layerHostView());
- if (!view) {
- view = adoptNS([[WKLayerHostView alloc] init]);
- model->setLayerHostView(view);
- }
- [view setContextID:videoLayerID];
- if (hostingDeviceScaleFactor != 1) {
- // Invert the scale transform added in the WebProcess to fix <rdar://problem/18316542>.
- float inverseScale = 1 / hostingDeviceScaleFactor;
- [[view layer] setSublayerTransform:CATransform3DMakeScale(inverseScale, inverseScale, 1)];
- }
-
- UIView *parentView = downcast<RemoteLayerTreeDrawingAreaProxy>(*m_page->drawingArea()).remoteLayerTreeHost().rootLayer();
- interface->setupFullscreen(*model->layerHostView(), initialRect, parentView, videoFullscreenMode, allowsPictureInPicture);
-}
-
-void WebVideoFullscreenManagerProxy::resetMediaState(uint64_t contextId)
-{
- ensureInterface(contextId).resetMediaState();
-}
-
-void WebVideoFullscreenManagerProxy::setCurrentTime(uint64_t contextId, double currentTime, double hostTime)
-{
- ensureInterface(contextId).setCurrentTime(currentTime, hostTime);
-}
-
-void WebVideoFullscreenManagerProxy::setBufferedTime(uint64_t contextId, double bufferedTime)
-{
- ensureInterface(contextId).setBufferedTime(bufferedTime);
-}
-
-void WebVideoFullscreenManagerProxy::setVideoDimensions(uint64_t contextId, bool hasVideo, unsigned width, unsigned height)
-{
- ensureInterface(contextId).setVideoDimensions(hasVideo, width, height);
-}
-
-void WebVideoFullscreenManagerProxy::setSeekableRangesVector(uint64_t contextId, Vector<std::pair<double, double>> ranges)
-{
- RefPtr<TimeRanges> timeRanges = TimeRanges::create();
- for (const auto& range : ranges)
- {
- ASSERT(isfinite(range.first));
- ASSERT(isfinite(range.second));
- ASSERT(range.second >= range.first);
- timeRanges->add(range.first, range.second);
- }
-
- ensureInterface(contextId).setSeekableRanges(*timeRanges);
-}
-
-void WebVideoFullscreenManagerProxy::setCanPlayFastReverse(uint64_t contextId, bool value)
-{
- ensureInterface(contextId).setCanPlayFastReverse(value);
-}
-
-void WebVideoFullscreenManagerProxy::setAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
-{
- ensureInterface(contextId).setAudioMediaSelectionOptions(options, selectedIndex);
-}
-
-void WebVideoFullscreenManagerProxy::setLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
-{
- ensureInterface(contextId).setLegibleMediaSelectionOptions(options, selectedIndex);
-}
-
-void WebVideoFullscreenManagerProxy::setExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName)
-{
- WebVideoFullscreenInterface::ExternalPlaybackTargetType type = static_cast<WebVideoFullscreenInterface::ExternalPlaybackTargetType>(targetType);
- ASSERT(type == WebVideoFullscreenInterface::TargetTypeAirPlay || type == WebVideoFullscreenInterface::TargetTypeTVOut || type == WebVideoFullscreenInterface::TargetTypeNone);
-
- ensureInterface(contextId).setExternalPlayback(enabled, type, localizedDeviceName);
-}
-
-void WebVideoFullscreenManagerProxy::setWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
-{
- ensureInterface(contextId).setWirelessVideoPlaybackDisabled(disabled);
-}
-
-void WebVideoFullscreenManagerProxy::setDuration(uint64_t contextId, double duration)
-{
- ensureInterface(contextId).setDuration(duration);
-}
-
-void WebVideoFullscreenManagerProxy::setRate(uint64_t contextId, bool isPlaying, double rate)
-{
- ensureInterface(contextId).setRate(isPlaying, rate);
-}
-
-void WebVideoFullscreenManagerProxy::enterFullscreen(uint64_t contextId)
-{
- auto& interface = ensureInterface(contextId);
- interface.enterFullscreen();
-
- // Only one context can be in a given full screen mode at a time:
- for (auto& contextPair : m_contextMap) {
- auto& otherContextId = contextPair.key;
- if (contextId == otherContextId)
- continue;
-
- auto& otherInterface = std::get<1>(contextPair.value);
- if (otherInterface->hasMode(interface.mode()))
- otherInterface->requestHideAndExitFullscreen();
- }
-}
-
-void WebVideoFullscreenManagerProxy::exitFullscreen(uint64_t contextId, WebCore::IntRect finalRect)
-{
- ensureInterface(contextId).exitFullscreen(finalRect);
-}
-
-void WebVideoFullscreenManagerProxy::cleanupFullscreen(uint64_t contextId)
-{
- ensureInterface(contextId).cleanupFullscreen();
-}
-
-void WebVideoFullscreenManagerProxy::preparedToReturnToInline(uint64_t contextId, bool visible, WebCore::IntRect inlineRect)
-{
- m_page->fullscreenMayReturnToInline();
-
- ensureInterface(contextId).preparedToReturnToInline(visible, inlineRect);
-}
-
-#pragma mark Messages to WebVideoFullscreenManager
-
-void WebVideoFullscreenManagerProxy::play(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::Play(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::pause(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::Pause(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::togglePlayState(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::TogglePlayState(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::beginScrubbing(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::BeginScrubbing(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::endScrubbing(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::EndScrubbing(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::seekToTime(uint64_t contextId, double time)
-{
- m_page->send(Messages::WebVideoFullscreenManager::SeekToTime(contextId, time), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::fastSeek(uint64_t contextId, double time)
-{
- m_page->send(Messages::WebVideoFullscreenManager::FastSeek(contextId, time), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::beginScanningForward(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::BeginScanningForward(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::beginScanningBackward(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::BeginScanningBackward(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::endScanning(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::EndScanning(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
-{
- m_page->send(Messages::WebVideoFullscreenManager::RequestFullscreenMode(contextId, mode), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::didSetupFullscreen(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::DidSetupFullscreen(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::didExitFullscreen(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::DidExitFullscreen(contextId), m_page->pageID());
- m_page->didExitFullscreen();
-}
-
-void WebVideoFullscreenManagerProxy::didEnterFullscreen(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManager::DidEnterFullscreen(contextId), m_page->pageID());
- m_page->didEnterFullscreen();
-}
-
-void WebVideoFullscreenManagerProxy::didCleanupFullscreen(uint64_t contextId)
-{
- auto& model = ensureModel(contextId);
-
- [CATransaction flush];
- [model.layerHostView() removeFromSuperview];
- model.setLayerHostView(nullptr);
- m_page->send(Messages::WebVideoFullscreenManager::DidCleanupFullscreen(contextId), m_page->pageID());
-
- m_contextMap.remove(contextId);
-}
-
-void WebVideoFullscreenManagerProxy::setVideoLayerFrame(uint64_t contextId, WebCore::FloatRect frame)
-{
- @autoreleasepool {
- mach_port_name_t fencePort = [UIWindow _synchronizeDrawingAcrossProcesses];
-
- m_page->send(Messages::WebVideoFullscreenManager::SetVideoLayerFrameFenced(contextId, frame, IPC::Attachment(fencePort, MACH_MSG_TYPE_MOVE_SEND)), m_page->pageID());
- }
-}
-
-void WebVideoFullscreenManagerProxy::setVideoLayerGravity(uint64_t contextId, WebCore::WebVideoFullscreenModel::VideoGravity gravity)
-{
- m_page->send(Messages::WebVideoFullscreenManager::SetVideoLayerGravityEnum(contextId, (unsigned)gravity), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::selectAudioMediaOption(uint64_t contextId, uint64_t index)
-{
- m_page->send(Messages::WebVideoFullscreenManager::SelectAudioMediaOption(contextId, index), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::selectLegibleMediaOption(uint64_t contextId, uint64_t index)
-{
- m_page->send(Messages::WebVideoFullscreenManager::SelectLegibleMediaOption(contextId, index), m_page->pageID());
-}
-
-void WebVideoFullscreenManagerProxy::fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
-{
- m_page->send(Messages::WebVideoFullscreenManager::FullscreenModeChanged(contextId, mode), m_page->pageID());
-}
-
-bool WebVideoFullscreenManagerProxy::isVisible() const
-{
- return m_page->isViewVisible() && m_page->isInWindow();
-}
-
-void WebVideoFullscreenManagerProxy::fullscreenMayReturnToInline(uint64_t contextId)
-{
- bool isViewVisible = m_page->isViewVisible();
- m_page->send(Messages::WebVideoFullscreenManager::FullscreenMayReturnToInline(contextId, isViewVisible), m_page->pageID());
-}
-
-#endif
-
-} // namespace WebKit
-
-#endif // PLATFORM(IOS)
</del></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -854,9 +854,6 @@
</span><span class="cx">                 3F87B9BD158940120090FF62 /* WebColorChooser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */; };
</span><span class="cx">                 3F87B9BE158940190090FF62 /* WebColorChooser.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F87B9BB15893F630090FF62 /* WebColorChooser.h */; };
</span><span class="cx">                 3F87B9C0158940D80090FF62 /* WebColorPicker.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F87B9BF158940D80090FF62 /* WebColorPicker.h */; };
</span><del>-                3F889D14188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F889D12188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm */; };
-                3F889D15188778C900FEADAF /* WebVideoFullscreenManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F889D13188778C900FEADAF /* WebVideoFullscreenManagerProxy.h */; };
-                3F889D171887859300FEADAF /* WebVideoFullscreenManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3F889D0D1887699C00FEADAF /* WebVideoFullscreenManager.mm */; };
</del><span class="cx">                 4A3CC18A19B063E700D14AEF /* UserMediaPermissionRequestManagerProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F3919AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.cpp */; };
</span><span class="cx">                 4A3CC18B19B0640F00D14AEF /* UserMediaPermissionRequestManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4A410F3A19AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.h */; };
</span><span class="cx">                 4A3CC18C19B0641500D14AEF /* UserMediaPermissionRequestProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A410F3B19AF7B04002EBAB5 /* UserMediaPermissionRequestProxy.cpp */; };
</span><span class="lines">@@ -1049,6 +1046,9 @@
</span><span class="cx">                 5272B28A1406985D0096A5D0 /* StatisticsData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5272B2881406985D0096A5D0 /* StatisticsData.cpp */; };
</span><span class="cx">                 5272B28B1406985D0096A5D0 /* StatisticsData.h in Headers */ = {isa = PBXBuildFile; fileRef = 5272B2891406985D0096A5D0 /* StatisticsData.h */; };
</span><span class="cx">                 528C37C1195CBB1A00D8B9CC /* WKBackForwardListPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A9F28101958F478008CAC72 /* WKBackForwardListPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                52D5A1B01C57495A00DE34A3 /* WebVideoFullscreenManagerProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 52D5A1AA1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.h */; };
+                52D5A1B11C57496200DE34A3 /* WebVideoFullscreenManagerProxy.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A1AC1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.mm */; };
+                52D5A1B71C574A0200DE34A3 /* WebVideoFullscreenManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 52D5A1B41C5749F200DE34A3 /* WebVideoFullscreenManager.mm */; };
</ins><span class="cx">                 5C1426EC1C23F80900D41183 /* NetworkProcessCreationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5C1426E21C23F80500D41183 /* NetworkProcessCreationParameters.cpp */; };
</span><span class="cx">                 5C1426ED1C23F80900D41183 /* NetworkProcessCreationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426E31C23F80500D41183 /* NetworkProcessCreationParameters.h */; };
</span><span class="cx">                 5C1426EE1C23F80900D41183 /* NetworkProcessSupplement.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C1426E41C23F80500D41183 /* NetworkProcessSupplement.h */; };
</span><span class="lines">@@ -3010,12 +3010,6 @@
</span><span class="cx">                 3F87B9BA15893F630090FF62 /* WebColorChooser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebColorChooser.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 3F87B9BB15893F630090FF62 /* WebColorChooser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorChooser.h; sourceTree = "<group>"; };
</span><span class="cx">                 3F87B9BF158940D80090FF62 /* WebColorPicker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPicker.h; sourceTree = "<group>"; };
</span><del>-                3F889D0D1887699C00FEADAF /* WebVideoFullscreenManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenManager.mm; path = ios/WebVideoFullscreenManager.mm; sourceTree = "<group>"; };
-                3F889D0E1887699C00FEADAF /* WebVideoFullscreenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenManager.h; path = ios/WebVideoFullscreenManager.h; sourceTree = "<group>"; };
-                3F889D101887710000FEADAF /* WebVideoFullscreenManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebVideoFullscreenManager.messages.in; path = ios/WebVideoFullscreenManager.messages.in; sourceTree = "<group>"; };
-                3F889D12188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenManagerProxy.mm; path = ios/WebVideoFullscreenManagerProxy.mm; sourceTree = "<group>"; };
-                3F889D13188778C900FEADAF /* WebVideoFullscreenManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenManagerProxy.h; path = ios/WebVideoFullscreenManagerProxy.h; sourceTree = "<group>"; };
-                3F889D1618877A2400FEADAF /* WebVideoFullscreenManagerProxy.messages.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = WebVideoFullscreenManagerProxy.messages.in; path = ios/WebVideoFullscreenManagerProxy.messages.in; sourceTree = "<group>"; };
</del><span class="cx">                 4A410F3519AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKUserMediaPermissionRequest.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 4A410F3619AF7AC3002EBAB5 /* WKUserMediaPermissionRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKUserMediaPermissionRequest.h; sourceTree = "<group>"; };
</span><span class="cx">                 4A410F3919AF7B04002EBAB5 /* UserMediaPermissionRequestManagerProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserMediaPermissionRequestManagerProxy.cpp; sourceTree = "<group>"; };
</span><span class="lines">@@ -3234,6 +3228,12 @@
</span><span class="cx">                 51FD18B41651FBAD00DBE1CE /* NetworkResourceLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkResourceLoader.h; path = NetworkProcess/NetworkResourceLoader.h; sourceTree = "<group>"; };
</span><span class="cx">                 5272B2881406985D0096A5D0 /* StatisticsData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StatisticsData.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5272B2891406985D0096A5D0 /* StatisticsData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StatisticsData.h; sourceTree = "<group>"; };
</span><ins>+                52D5A1AA1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenManagerProxy.h; sourceTree = "<group>"; };
+                52D5A1AB1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebVideoFullscreenManagerProxy.messages.in; sourceTree = "<group>"; };
+                52D5A1AC1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenManagerProxy.mm; sourceTree = "<group>"; };
+                52D5A1B21C5749F200DE34A3 /* WebVideoFullscreenManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebVideoFullscreenManager.h; sourceTree = "<group>"; };
+                52D5A1B31C5749F200DE34A3 /* WebVideoFullscreenManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebVideoFullscreenManager.messages.in; sourceTree = "<group>"; };
+                52D5A1B41C5749F200DE34A3 /* WebVideoFullscreenManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebVideoFullscreenManager.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 5C1426E21C23F80500D41183 /* NetworkProcessCreationParameters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = NetworkProcessCreationParameters.cpp; path = NetworkProcess/NetworkProcessCreationParameters.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 5C1426E31C23F80500D41183 /* NetworkProcessCreationParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessCreationParameters.h; path = NetworkProcess/NetworkProcessCreationParameters.h; sourceTree = "<group>"; };
</span><span class="cx">                 5C1426E41C23F80500D41183 /* NetworkProcessSupplement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkProcessSupplement.h; path = NetworkProcess/NetworkProcessSupplement.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4937,6 +4937,9 @@
</span><span class="cx">                                 7C4694CB1A4B510A00AD5845 /* WebPasteboardProxyCocoa.mm */,
</span><span class="cx">                                 7CE4D2151A49148400C7F152 /* WebProcessPoolCocoa.mm */,
</span><span class="cx">                                 1A04F6171A4A3A7A00A21B6E /* WebProcessProxyCocoa.mm */,
</span><ins>+                                52D5A1AA1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.h */,
+                                52D5A1AB1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.messages.in */,
+                                52D5A1AC1C57494E00DE34A3 /* WebVideoFullscreenManagerProxy.mm */,
</ins><span class="cx">                                 2DFC7DB91BCCC19500C1548C /* WebViewImpl.h */,
</span><span class="cx">                                 2DFC7DBA1BCCC19500C1548C /* WebViewImpl.mm */,
</span><span class="cx">                                 1AD01BCB1905D54900C9C45F /* WKReloadFrameErrorRecoveryAttempter.h */,
</span><span class="lines">@@ -5132,9 +5135,6 @@
</span><span class="cx">                                 2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.mm */,
</span><span class="cx">                                 2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */,
</span><span class="cx">                                 2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */,
</span><del>-                                3F889D13188778C900FEADAF /* WebVideoFullscreenManagerProxy.h */,
-                                3F889D1618877A2400FEADAF /* WebVideoFullscreenManagerProxy.messages.in */,
-                                3F889D12188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm */,
</del><span class="cx">                                 0FCB4E3818BBE044000FCFC9 /* WKActionSheet.h */,
</span><span class="cx">                                 0FCB4E3918BBE044000FCFC9 /* WKActionSheet.mm */,
</span><span class="cx">                                 0FCB4E3A18BBE044000FCFC9 /* WKActionSheetAssistant.h */,
</span><span class="lines">@@ -5164,16 +5164,6 @@
</span><span class="cx">                         name = ios;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="cx">                 };
</span><del>-                2DA944B11884E9DF00ED86DB /* ios */ = {
-                        isa = PBXGroup;
-                        children = (
-                                3F889D0E1887699C00FEADAF /* WebVideoFullscreenManager.h */,
-                                3F889D101887710000FEADAF /* WebVideoFullscreenManager.messages.in */,
-                                3F889D0D1887699C00FEADAF /* WebVideoFullscreenManager.mm */,
-                        );
-                        name = ios;
-                        sourceTree = "<group>";
-                };
</del><span class="cx">                 2DA944B41884EA2A00ED86DB /* ios */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="lines">@@ -5902,6 +5892,9 @@
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><span class="cx">                                 7C6E70F918B2D4A000F24E2E /* WebProcessCocoa.mm */,
</span><ins>+                                52D5A1B21C5749F200DE34A3 /* WebVideoFullscreenManager.h */,
+                                52D5A1B31C5749F200DE34A3 /* WebVideoFullscreenManager.messages.in */,
+                                52D5A1B41C5749F200DE34A3 /* WebVideoFullscreenManager.mm */,
</ins><span class="cx">                         );
</span><span class="cx">                         path = cocoa;
</span><span class="cx">                         sourceTree = "<group>";
</span><span class="lines">@@ -6004,7 +5997,6 @@
</span><span class="cx">                                 BC0E5FCB12D696DD0012A72A /* Geolocation */,
</span><span class="cx">                                 51FBB9C1132E079200F327B4 /* IconDatabase */,
</span><span class="cx">                                 BC204EDF11C83E72008F3375 /* InjectedBundle */,
</span><del>-                                2DA944B11884E9DF00ED86DB /* ios */,
</del><span class="cx">                                 33D3A3BD1339609800709BE4 /* MediaCache */,
</span><span class="cx">                                 4A410F4119AF7B27002EBAB5 /* MediaStream */,
</span><span class="cx">                                 5105B0D2162F7A5E00E27709 /* Network */,
</span><span class="lines">@@ -8145,7 +8137,7 @@
</span><span class="cx">                                 1AAF08A2192681D100B6390C /* WebUserContentControllerProxy.h in Headers */,
</span><span class="cx">                                 7C361D79192803BD0036A59D /* WebUserContentControllerProxyMessages.h in Headers */,
</span><span class="cx">                                 15739BBD1B42042D00D258C1 /* WebUserMediaClient.h in Headers */,
</span><del>-                                3F889D15188778C900FEADAF /* WebVideoFullscreenManagerProxy.h in Headers */,
</del><ins>+                                52D5A1B01C57495A00DE34A3 /* WebVideoFullscreenManagerProxy.h in Headers */,
</ins><span class="cx">                                 2DFC7DBB1BCCC19500C1548C /* WebViewImpl.h in Headers */,
</span><span class="cx">                                 29CD55AA128E294F00133C85 /* WKAccessibilityWebPageObjectBase.h in Headers */,
</span><span class="cx">                                 29232DF418B29D6800D0596F /* WKAccessibilityWebPageObjectMac.h in Headers */,
</span><span class="lines">@@ -9932,9 +9924,9 @@
</span><span class="cx">                                 1AAF08A1192681D100B6390C /* WebUserContentControllerProxy.cpp in Sources */,
</span><span class="cx">                                 7C361D78192803BD0036A59D /* WebUserContentControllerProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 15739BBE1B42046600D258C1 /* WebUserMediaClient.cpp in Sources */,
</span><del>-                                3F889D171887859300FEADAF /* WebVideoFullscreenManager.mm in Sources */,
</del><ins>+                                52D5A1B71C574A0200DE34A3 /* WebVideoFullscreenManager.mm in Sources */,
+                                52D5A1B11C57496200DE34A3 /* WebVideoFullscreenManagerProxy.mm in Sources */,
</ins><span class="cx">                                 3F418EF91887BD97002795FD /* WebVideoFullscreenManagerMessageReceiver.cpp in Sources */,
</span><del>-                                3F889D14188778C900FEADAF /* WebVideoFullscreenManagerProxy.mm in Sources */,
</del><span class="cx">                                 3F418EFB1887BD97002795FD /* WebVideoFullscreenManagerProxyMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 2DFC7DBC1BCCC19500C1548C /* WebViewImpl.mm in Sources */,
</span><span class="cx">                                 C0337DD1127A2980008FF4F4 /* WebWheelEvent.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagerhfromrev195599trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagerh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h (from rev 195599, trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,177 @@
</span><ins>+/*
+ * Copyright (C) 2014 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.
+ */
+#ifndef WebVideoFullscreenManager_h
+#define WebVideoFullscreenManager_h
+
+#if PLATFORM(IOS)
+
+#include "MessageReceiver.h"
+#include <WebCore/EventListener.h>
+#include <WebCore/HTMLMediaElementEnums.h>
+#include <WebCore/PlatformCALayer.h>
+#include <WebCore/WebVideoFullscreenInterface.h>
+#include <WebCore/WebVideoFullscreenModelVideoElement.h>
+#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace IPC {
+class Attachment;
+class Connection;
+class MessageDecoder;
+class MessageReceiver;
+}
+
+namespace WebCore {
+class Node;
+}
+
+namespace WebKit {
+
+class LayerHostingContext;
+class WebPage;
+class WebVideoFullscreenManager;
+
+class WebVideoFullscreenInterfaceContext : public RefCounted<WebVideoFullscreenInterfaceContext>, public WebCore::WebVideoFullscreenInterface {
+public:
+ static Ref<WebVideoFullscreenInterfaceContext> create(WebVideoFullscreenManager& manager, uint64_t contextId)
+ {
+ return adoptRef(*new WebVideoFullscreenInterfaceContext(manager, contextId));
+ }
+ virtual ~WebVideoFullscreenInterfaceContext();
+
+ void invalidate() { m_manager = nullptr; }
+
+ LayerHostingContext* layerHostingContext() { return m_layerHostingContext.get(); }
+ void setLayerHostingContext(std::unique_ptr<LayerHostingContext>&&);
+
+ bool isAnimating() const { return m_isAnimating; }
+ void setIsAnimating(bool flag) { m_isAnimating = flag; }
+
+ bool targetIsFullscreen() const { return m_targetIsFullscreen; }
+ void setTargetIsFullscreen(bool flag) { m_targetIsFullscreen = flag; }
+
+ WebCore::HTMLMediaElementEnums::VideoFullscreenMode fullscreenMode() const { return m_fullscreenMode; }
+ void setFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode) { m_fullscreenMode = mode; }
+
+ bool isFullscreen() const { return m_isFullscreen; }
+ void setIsFullscreen(bool flag) { m_isFullscreen = flag; }
+
+private:
+ // WebVideoFullscreenInterface
+ virtual void resetMediaState() override;
+ virtual void setDuration(double) override;
+ virtual void setCurrentTime(double currentTime, double anchorTime) override;
+ virtual void setBufferedTime(double) override;
+ virtual void setRate(bool isPlaying, float playbackRate) override;
+ virtual void setVideoDimensions(bool hasVideo, float width, float height) override;
+ virtual void setSeekableRanges(const WebCore::TimeRanges&) override;
+ virtual void setCanPlayFastReverse(bool value) override;
+ virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
+ virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
+ virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override;
+ virtual void setWirelessVideoPlaybackDisabled(bool) override;
+
+ WebVideoFullscreenInterfaceContext(WebVideoFullscreenManager&, uint64_t contextId);
+
+ WebVideoFullscreenManager* m_manager;
+ uint64_t m_contextId;
+ std::unique_ptr<LayerHostingContext> m_layerHostingContext;
+ bool m_isAnimating { false };
+ bool m_targetIsFullscreen { false };
+ WebCore::HTMLMediaElementEnums::VideoFullscreenMode m_fullscreenMode { WebCore::HTMLMediaElementEnums::VideoFullscreenModeNone };
+ bool m_isFullscreen { false };
+};
+
+class WebVideoFullscreenManager : public RefCounted<WebVideoFullscreenManager>, private IPC::MessageReceiver {
+public:
+ static Ref<WebVideoFullscreenManager> create(PassRefPtr<WebPage>);
+ virtual ~WebVideoFullscreenManager();
+
+ void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
+
+ // Interface to ChromeClient
+ bool supportsVideoFullscreen() const;
+ void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+ void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&);
+
+protected:
+ friend class WebVideoFullscreenInterfaceContext;
+
+ explicit WebVideoFullscreenManager(PassRefPtr<WebPage>);
+
+ typedef std::tuple<RefPtr<WebCore::WebVideoFullscreenModelVideoElement>, RefPtr<WebVideoFullscreenInterfaceContext>> ModelInterfaceTuple;
+ ModelInterfaceTuple createModelAndInterface(uint64_t contextId);
+ ModelInterfaceTuple& ensureModelAndInterface(uint64_t contextId);
+ WebCore::WebVideoFullscreenModelVideoElement& ensureModel(uint64_t contextId);
+ WebVideoFullscreenInterfaceContext& ensureInterface(uint64_t contextId);
+
+ // Interface to WebVideoFullscreenInterfaceContext
+ void resetMediaState(uint64_t contextId);
+ void setDuration(uint64_t contextId, double);
+ void setCurrentTime(uint64_t contextId, double currentTime, double anchorTime);
+ void setBufferedTime(uint64_t contextId, double bufferedTime);
+ void setRate(uint64_t contextId, bool isPlaying, float playbackRate);
+ void setVideoDimensions(uint64_t contextId, bool hasVideo, float width, float height);
+ void setSeekableRanges(uint64_t contextId, const WebCore::TimeRanges&);
+ void setCanPlayFastReverse(uint64_t contextId, bool value);
+ void setAudioMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex);
+ void setLegibleMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex);
+ void setExternalPlayback(uint64_t contextId, bool enabled, WebCore::WebVideoFullscreenInterface::ExternalPlaybackTargetType, String localizedDeviceName);
+ void setWirelessVideoPlaybackDisabled(uint64_t contextId, bool);
+
+ // Messages from WebVideoFullscreenManagerProxy
+ void play(uint64_t contextId);
+ void pause(uint64_t contextId);
+ void togglePlayState(uint64_t contextId);
+ void beginScrubbing(uint64_t contextId);
+ void endScrubbing(uint64_t contextId);
+ void seekToTime(uint64_t contextId, double time);
+ void fastSeek(uint64_t contextId, double time);
+ void beginScanningForward(uint64_t contextId);
+ void beginScanningBackward(uint64_t contextId);
+ void endScanning(uint64_t contextId);
+ void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+ void didSetupFullscreen(uint64_t contextId);
+ void didExitFullscreen(uint64_t contextId);
+ void didEnterFullscreen(uint64_t contextId);
+ void didCleanupFullscreen(uint64_t contextId);
+ void setVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort);
+ void setVideoLayerGravityEnum(uint64_t contextId, unsigned gravity);
+ void selectAudioMediaOption(uint64_t contextId, uint64_t index);
+ void selectLegibleMediaOption(uint64_t contextId, uint64_t index);
+ void fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
+ void fullscreenMayReturnToInline(uint64_t contextId, bool isPageVisible);
+
+ WebPage* m_page;
+ HashMap<WebCore::HTMLVideoElement*, uint64_t> m_videoElements;
+ HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
+};
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
+
+#endif // WebVideoFullscreenManager_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermessagesinfromrev195599trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermessagesin"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in (from rev 195599, trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.messages.in        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,47 @@
</span><ins>+# Copyright (C) 2014 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.
+
+#if PLATFORM(IOS)
+messages -> WebVideoFullscreenManager {
+ Play(uint64_t contextId)
+ Pause(uint64_t contextId)
+ TogglePlayState(uint64_t contextId)
+ BeginScrubbing(uint64_t contextId)
+ EndScrubbing(uint64_t contextId)
+ SeekToTime(uint64_t contextId, double time)
+ FastSeek(uint64_t contextId, double time)
+ BeginScanningForward(uint64_t contextId)
+ BeginScanningBackward(uint64_t contextId)
+ EndScanning(uint64_t contextId)
+ RequestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
+ DidSetupFullscreen(uint64_t contextId)
+ DidExitFullscreen(uint64_t contextId)
+ DidEnterFullscreen(uint64_t contextId)
+ DidCleanupFullscreen(uint64_t contextId)
+ SetVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
+ SetVideoLayerGravityEnum(uint64_t contextId, unsigned gravity)
+ SelectAudioMediaOption(uint64_t contextId, uint64_t index)
+ SelectLegibleMediaOption(uint64_t contextId, uint64_t index)
+ FullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
+ FullscreenMayReturnToInline(uint64_t contextId, bool isPageVisible)
+}
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebVideoFullscreenManagermmfromrev195599trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (from rev 195599, trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm) (0 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm         (rev 0)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -0,0 +1,561 @@
</span><ins>+/*
+ * Copyright (C) 2014 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 "WebVideoFullscreenManager.h"
+
+#if PLATFORM(IOS)
+
+#import "Attachment.h"
+#import "WebCoreArgumentCoders.h"
+#import "WebPage.h"
+#import "WebProcess.h"
+#import "WebVideoFullscreenManagerMessages.h"
+#import "WebVideoFullscreenManagerProxyMessages.h"
+#import <QuartzCore/CoreAnimation.h>
+#import <WebCore/Color.h>
+#import <WebCore/Event.h>
+#import <WebCore/EventNames.h>
+#import <WebCore/FrameView.h>
+#import <WebCore/HTMLVideoElement.h>
+#import <WebCore/PlatformCALayer.h>
+#import <WebCore/RenderLayer.h>
+#import <WebCore/RenderLayerBacking.h>
+#import <WebCore/RenderView.h>
+#import <WebCore/Settings.h>
+#import <WebCore/TimeRanges.h>
+#import <WebCore/WebCoreThreadRun.h>
+#import <mach/mach_port.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+static IntRect clientRectForElement(HTMLElement* element)
+{
+ if (!element)
+ return IntRect();
+
+ return element->clientRect();
+}
+
+static uint64_t nextContextId()
+{
+ static uint64_t contextId = 0;
+ return ++contextId;
+}
+
+#pragma mark - WebVideoFullscreenInterfaceContext
+
+WebVideoFullscreenInterfaceContext::WebVideoFullscreenInterfaceContext(WebVideoFullscreenManager& manager, uint64_t contextId)
+ : m_manager(&manager)
+ , m_contextId(contextId)
+{
+}
+
+WebVideoFullscreenInterfaceContext::~WebVideoFullscreenInterfaceContext()
+{
+}
+
+void WebVideoFullscreenInterfaceContext::setLayerHostingContext(std::unique_ptr<LayerHostingContext>&& context)
+{
+ m_layerHostingContext = WTFMove(context);
+}
+
+void WebVideoFullscreenInterfaceContext::resetMediaState()
+{
+ if (m_manager)
+ m_manager->resetMediaState(m_contextId);
+}
+
+void WebVideoFullscreenInterfaceContext::setDuration(double duration)
+{
+ if (m_manager)
+ m_manager->setDuration(m_contextId, duration);
+}
+
+void WebVideoFullscreenInterfaceContext::setCurrentTime(double currentTime, double anchorTime)
+{
+ if (m_manager)
+ m_manager->setCurrentTime(m_contextId, currentTime, anchorTime);
+}
+
+void WebVideoFullscreenInterfaceContext::setBufferedTime(double bufferedTime)
+{
+ if (m_manager)
+ m_manager->setBufferedTime(m_contextId, bufferedTime);
+}
+
+void WebVideoFullscreenInterfaceContext::setRate(bool isPlaying, float playbackRate)
+{
+ if (m_manager)
+ m_manager->setRate(m_contextId, isPlaying, playbackRate);
+}
+
+void WebVideoFullscreenInterfaceContext::setVideoDimensions(bool hasVideo, float width, float height)
+{
+ if (m_manager)
+ m_manager->setVideoDimensions(m_contextId, hasVideo, width, height);
+}
+
+void WebVideoFullscreenInterfaceContext::setSeekableRanges(const WebCore::TimeRanges& ranges)
+{
+ if (m_manager)
+ m_manager->setSeekableRanges(m_contextId, ranges);
+}
+
+void WebVideoFullscreenInterfaceContext::setCanPlayFastReverse(bool value)
+{
+ if (m_manager)
+ m_manager->setCanPlayFastReverse(m_contextId, value);
+}
+
+void WebVideoFullscreenInterfaceContext::setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex)
+{
+ if (m_manager)
+ m_manager->setAudioMediaSelectionOptions(m_contextId, options, selectedIndex);
+}
+
+void WebVideoFullscreenInterfaceContext::setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex)
+{
+ if (m_manager)
+ m_manager->setLegibleMediaSelectionOptions(m_contextId, options, selectedIndex);
+}
+
+void WebVideoFullscreenInterfaceContext::setExternalPlayback(bool enabled, ExternalPlaybackTargetType type, WTF::String localizedDeviceName)
+{
+ if (m_manager)
+ m_manager->setExternalPlayback(m_contextId, enabled, type, localizedDeviceName);
+}
+
+void WebVideoFullscreenInterfaceContext::setWirelessVideoPlaybackDisabled(bool disabled)
+{
+ if (m_manager)
+ m_manager->setWirelessVideoPlaybackDisabled(m_contextId, disabled);
+}
+
+#pragma mark - WebVideoFullscreenManager
+
+Ref<WebVideoFullscreenManager> WebVideoFullscreenManager::create(PassRefPtr<WebPage> page)
+{
+ return adoptRef(*new WebVideoFullscreenManager(page));
+}
+
+WebVideoFullscreenManager::WebVideoFullscreenManager(PassRefPtr<WebPage> page)
+ : m_page(page.get())
+{
+ WebProcess::singleton().addMessageReceiver(Messages::WebVideoFullscreenManager::messageReceiverName(), page->pageID(), *this);
+}
+
+WebVideoFullscreenManager::~WebVideoFullscreenManager()
+{
+ for (auto& tuple : m_contextMap.values()) {
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = tuple;
+
+ model->setWebVideoFullscreenInterface(nullptr);
+ model->setVideoElement(nullptr);
+
+ interface->invalidate();
+ }
+
+ m_contextMap.clear();
+ m_videoElements.clear();
+
+ WebProcess::singleton().removeMessageReceiver(Messages::WebVideoFullscreenManager::messageReceiverName(), m_page->pageID());
+}
+
+WebVideoFullscreenManager::ModelInterfaceTuple WebVideoFullscreenManager::createModelAndInterface(uint64_t contextId)
+{
+ RefPtr<WebVideoFullscreenModelVideoElement> model = WebVideoFullscreenModelVideoElement::create();
+ RefPtr<WebVideoFullscreenInterfaceContext> interface = WebVideoFullscreenInterfaceContext::create(*this, contextId);
+
+ interface->setLayerHostingContext(LayerHostingContext::createForExternalHostingProcess());
+ model->setWebVideoFullscreenInterface(interface.get());
+
+ return std::make_tuple(WTFMove(model), WTFMove(interface));
+}
+
+WebVideoFullscreenManager::ModelInterfaceTuple& WebVideoFullscreenManager::ensureModelAndInterface(uint64_t contextId)
+{
+ auto addResult = m_contextMap.add(contextId, ModelInterfaceTuple());
+ if (addResult.isNewEntry)
+ addResult.iterator->value = createModelAndInterface(contextId);
+ return addResult.iterator->value;
+}
+
+WebCore::WebVideoFullscreenModelVideoElement& WebVideoFullscreenManager::ensureModel(uint64_t contextId)
+{
+ return *std::get<0>(ensureModelAndInterface(contextId));
+}
+
+WebVideoFullscreenInterfaceContext& WebVideoFullscreenManager::ensureInterface(uint64_t contextId)
+{
+ return *std::get<1>(ensureModelAndInterface(contextId));
+}
+
+#pragma mark Interface to ChromeClient:
+
+bool WebVideoFullscreenManager::supportsVideoFullscreen() const
+{
+ return Settings::avKitEnabled();
+}
+
+void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone);
+
+ uint64_t contextId;
+
+ auto addResult = m_videoElements.add(&videoElement, 0);
+ if (addResult.isNewEntry)
+ addResult.iterator->value = nextContextId();
+ contextId = addResult.iterator->value;
+
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+
+ FloatRect clientRect = clientRectForElement(&videoElement);
+ FloatRect videoLayerFrame = FloatRect(0, 0, clientRect.width(), clientRect.height());
+
+ HTMLMediaElementEnums::VideoFullscreenMode oldMode = interface->fullscreenMode();
+ interface->setTargetIsFullscreen(true);
+ interface->setFullscreenMode(mode);
+ model->setVideoElement(&videoElement);
+ if (oldMode == HTMLMediaElementEnums::VideoFullscreenModeNone)
+ model->setVideoLayerFrame(videoLayerFrame);
+
+ if (interface->isAnimating())
+ return;
+ interface->setIsAnimating(true);
+
+ bool allowsPictureInPicture = videoElement.mediaSession().allowsPictureInPicture(videoElement);
+
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), clientRectForElement(&videoElement), m_page->deviceScaleFactor(), interface->fullscreenMode(), allowsPictureInPicture), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement)
+{
+ ASSERT(m_videoElements.contains(&videoElement));
+
+ uint64_t contextId = m_videoElements.get(&videoElement);
+ auto& interface = ensureInterface(contextId);
+
+ interface.setTargetIsFullscreen(false);
+
+ if (interface.isAnimating())
+ return;
+
+ interface.setIsAnimating(true);
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, clientRectForElement(&videoElement)), m_page->pageID());
+}
+
+#pragma mark Interface to WebVideoFullscreenInterfaceContext:
+
+void WebVideoFullscreenManager::resetMediaState(uint64_t contextId)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::ResetMediaState(contextId), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setDuration(uint64_t contextId, double duration)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetDuration(contextId, duration), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setCurrentTime(uint64_t contextId, double currentTime, double anchorTime)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetCurrentTime(contextId, currentTime, anchorTime), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setBufferedTime(uint64_t contextId, double bufferedTime)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetBufferedTime(contextId, bufferedTime), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setRate(uint64_t contextId, bool isPlaying, float playbackRate)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetRate(contextId, isPlaying, playbackRate), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setVideoDimensions(uint64_t contextId, bool hasVideo, float width, float height)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetVideoDimensions(contextId, hasVideo, width, height), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setSeekableRanges(uint64_t contextId, const WebCore::TimeRanges& timeRanges)
+{
+ Vector<std::pair<double, double>> rangesVector;
+
+ for (unsigned i = 0; i < timeRanges.length(); i++) {
+ ExceptionCode exceptionCode;
+ double start = timeRanges.start(i, exceptionCode);
+ double end = timeRanges.end(i, exceptionCode);
+ rangesVector.append(std::pair<double, double>(start, end));
+ }
+
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetSeekableRangesVector(contextId, WTFMove(rangesVector)), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setCanPlayFastReverse(uint64_t contextId, bool value)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetCanPlayFastReverse(contextId, value), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setAudioMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetAudioMediaSelectionOptions(contextId, options, selectedIndex), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setLegibleMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetLegibleMediaSelectionOptions(contextId, options, selectedIndex), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setExternalPlayback(uint64_t contextId, bool enabled, WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType, String localizedDeviceName)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetExternalPlaybackProperties(contextId, enabled, static_cast<uint32_t>(targetType), localizedDeviceName), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
+{
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::SetWirelessVideoPlaybackDisabled(contextId, disabled));
+}
+
+#pragma mark Messages from WebVideoFullscreenManagerProxy:
+
+void WebVideoFullscreenManager::play(uint64_t contextId)
+{
+ ensureModel(contextId).play();
+}
+
+void WebVideoFullscreenManager::pause(uint64_t contextId)
+{
+ ensureModel(contextId).pause();
+}
+
+void WebVideoFullscreenManager::togglePlayState(uint64_t contextId)
+{
+ ensureModel(contextId).togglePlayState();
+}
+
+void WebVideoFullscreenManager::beginScrubbing(uint64_t contextId)
+{
+ ensureModel(contextId).beginScrubbing();
+}
+
+void WebVideoFullscreenManager::endScrubbing(uint64_t contextId)
+{
+ ensureModel(contextId).endScrubbing();
+}
+
+void WebVideoFullscreenManager::seekToTime(uint64_t contextId, double time)
+{
+ ensureModel(contextId).seekToTime(time);
+}
+
+void WebVideoFullscreenManager::fastSeek(uint64_t contextId, double time)
+{
+ ensureModel(contextId).fastSeek(time);
+}
+
+void WebVideoFullscreenManager::beginScanningForward(uint64_t contextId)
+{
+ ensureModel(contextId).beginScanningForward();
+}
+
+void WebVideoFullscreenManager::beginScanningBackward(uint64_t contextId)
+{
+ ensureModel(contextId).beginScanningBackward();
+}
+
+void WebVideoFullscreenManager::endScanning(uint64_t contextId)
+{
+ ensureModel(contextId).endScanning();
+}
+
+void WebVideoFullscreenManager::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
+{
+ ensureModel(contextId).requestFullscreenMode(mode);
+}
+
+void WebVideoFullscreenManager::selectAudioMediaOption(uint64_t contextId, uint64_t index)
+{
+ ensureModel(contextId).selectAudioMediaOption(index);
+}
+
+void WebVideoFullscreenManager::selectLegibleMediaOption(uint64_t contextId, uint64_t index)
+{
+ ensureModel(contextId).selectLegibleMediaOption(index);
+}
+
+void WebVideoFullscreenManager::fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
+{
+ ensureModel(contextId).fullscreenModeChanged(videoFullscreenMode);
+}
+
+#pragma mark Messages from WebVideoFullscreenManager:
+
+void WebVideoFullscreenManager::didSetupFullscreen(uint64_t contextId)
+{
+ PlatformLayer* videoLayer = [CALayer layer];
+#ifndef NDEBUG
+ [videoLayer setName:@"Web video fullscreen manager layer"];
+#endif
+
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
+ [videoLayer setPosition:CGPointMake(0, 0)];
+ [videoLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent)];
+
+ // Set a scale factor here to make convertRect:toLayer:nil take scale factor into account. <rdar://problem/18316542>.
+ // This scale factor is inverted in the hosting process.
+ float hostingScaleFactor = m_page->deviceScaleFactor();
+ [videoLayer setTransform:CATransform3DMakeScale(hostingScaleFactor, hostingScaleFactor, 1)];
+
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+
+ interface->layerHostingContext()->setRootLayer(videoLayer);
+ model->setVideoFullscreenLayer(videoLayer);
+
+ [CATransaction commit];
+
+ RefPtr<WebVideoFullscreenManager> strongThis(this);
+ dispatch_async(dispatch_get_main_queue(), [strongThis, this, contextId] {
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::EnterFullscreen(contextId), m_page->pageID());
+ });
+}
+
+void WebVideoFullscreenManager::didEnterFullscreen(uint64_t contextId)
+{
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+
+ interface->setIsAnimating(false);
+ interface->setIsFullscreen(false);
+
+ if (interface->targetIsFullscreen())
+ return;
+
+ RefPtr<HTMLVideoElement> videoElement = model->videoElement();
+ if (!videoElement)
+ return;
+
+ // exit fullscreen now if it was previously requested during an animation.
+ RefPtr<WebVideoFullscreenManager> strongThis(this);
+ dispatch_async(dispatch_get_main_queue(), [strongThis, videoElement] {
+ strongThis->exitVideoFullscreenForVideoElement(*videoElement);
+ });
+}
+
+void WebVideoFullscreenManager::didExitFullscreen(uint64_t contextId)
+{
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+
+ model->setVideoFullscreenLayer(nil);
+
+ RefPtr<WebVideoFullscreenManager> strongThis(this);
+ dispatch_async(dispatch_get_main_queue(), [strongThis, contextId, interface] {
+ if (interface->layerHostingContext()) {
+ interface->layerHostingContext()->setRootLayer(nullptr);
+ interface->setLayerHostingContext(nullptr);
+ }
+ if (strongThis->m_page)
+ strongThis->m_page->send(Messages::WebVideoFullscreenManagerProxy::CleanupFullscreen(contextId), strongThis->m_page->pageID());
+ });
+}
+
+void WebVideoFullscreenManager::didCleanupFullscreen(uint64_t contextId)
+{
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+
+ interface->setIsAnimating(false);
+ interface->setIsFullscreen(false);
+ HTMLMediaElementEnums::VideoFullscreenMode mode = interface->fullscreenMode();
+ bool targetIsFullscreen = interface->targetIsFullscreen();
+
+ model->setVideoFullscreenLayer(nil);
+ RefPtr<HTMLVideoElement> videoElement = model->videoElement();
+
+ model->setVideoElement(nullptr);
+ model->setWebVideoFullscreenInterface(nullptr);
+ interface->invalidate();
+ m_videoElements.remove(videoElement.get());
+ m_contextMap.remove(contextId);
+
+ if (!videoElement || !targetIsFullscreen)
+ return;
+
+ RefPtr<WebVideoFullscreenManager> strongThis(this);
+ dispatch_async(dispatch_get_main_queue(), [strongThis, videoElement, mode] {
+ strongThis->enterVideoFullscreenForVideoElement(*videoElement, mode);
+ });
+}
+
+void WebVideoFullscreenManager::setVideoLayerGravityEnum(uint64_t contextId, unsigned gravity)
+{
+ ensureModel(contextId).setVideoLayerGravity((WebVideoFullscreenModel::VideoGravity)gravity);
+}
+
+void WebVideoFullscreenManager::fullscreenMayReturnToInline(uint64_t contextId, bool isPageVisible)
+{
+ auto& model = ensureModel(contextId);
+
+ if (!isPageVisible)
+ model.videoElement()->scrollIntoViewIfNotVisible(false);
+ m_page->send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(contextId, true, clientRectForElement(model.videoElement())), m_page->pageID());
+}
+
+void WebVideoFullscreenManager::setVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
+{
+ RefPtr<WebVideoFullscreenModelVideoElement> model;
+ RefPtr<WebVideoFullscreenInterfaceContext> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+
+ if (std::isnan(bounds.x()) || std::isnan(bounds.y()) || std::isnan(bounds.width()) || std::isnan(bounds.height())) {
+ FloatRect clientRect = clientRectForElement(model->videoElement());
+ bounds = FloatRect(0, 0, clientRect.width(), clientRect.height());
+ }
+
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:0];
+ if (interface->layerHostingContext())
+ interface->layerHostingContext()->setFencePort(fencePort.port());
+ model->setVideoLayerFrame(bounds);
+ mach_port_deallocate(mach_task_self(), fencePort.port());
+ [CATransaction commit];
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagerh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.h        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,177 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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.
- */
-#ifndef WebVideoFullscreenManager_h
-#define WebVideoFullscreenManager_h
-
-#if PLATFORM(IOS)
-
-#include "MessageReceiver.h"
-#include <WebCore/EventListener.h>
-#include <WebCore/HTMLMediaElementEnums.h>
-#include <WebCore/PlatformCALayer.h>
-#include <WebCore/WebVideoFullscreenInterface.h>
-#include <WebCore/WebVideoFullscreenModelVideoElement.h>
-#include <wtf/HashMap.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace IPC {
-class Attachment;
-class Connection;
-class MessageDecoder;
-class MessageReceiver;
-}
-
-namespace WebCore {
-class Node;
-}
-
-namespace WebKit {
-
-class LayerHostingContext;
-class WebPage;
-class WebVideoFullscreenManager;
-
-class WebVideoFullscreenInterfaceContext : public RefCounted<WebVideoFullscreenInterfaceContext>, public WebCore::WebVideoFullscreenInterface {
-public:
- static Ref<WebVideoFullscreenInterfaceContext> create(WebVideoFullscreenManager& manager, uint64_t contextId)
- {
- return adoptRef(*new WebVideoFullscreenInterfaceContext(manager, contextId));
- }
- virtual ~WebVideoFullscreenInterfaceContext();
-
- void invalidate() { m_manager = nullptr; }
-
- LayerHostingContext* layerHostingContext() { return m_layerHostingContext.get(); }
- void setLayerHostingContext(std::unique_ptr<LayerHostingContext>&&);
-
- bool isAnimating() const { return m_isAnimating; }
- void setIsAnimating(bool flag) { m_isAnimating = flag; }
-
- bool targetIsFullscreen() const { return m_targetIsFullscreen; }
- void setTargetIsFullscreen(bool flag) { m_targetIsFullscreen = flag; }
-
- WebCore::HTMLMediaElementEnums::VideoFullscreenMode fullscreenMode() const { return m_fullscreenMode; }
- void setFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode) { m_fullscreenMode = mode; }
-
- bool isFullscreen() const { return m_isFullscreen; }
- void setIsFullscreen(bool flag) { m_isFullscreen = flag; }
-
-private:
- // WebVideoFullscreenInterface
- virtual void resetMediaState() override;
- virtual void setDuration(double) override;
- virtual void setCurrentTime(double currentTime, double anchorTime) override;
- virtual void setBufferedTime(double) override;
- virtual void setRate(bool isPlaying, float playbackRate) override;
- virtual void setVideoDimensions(bool hasVideo, float width, float height) override;
- virtual void setSeekableRanges(const WebCore::TimeRanges&) override;
- virtual void setCanPlayFastReverse(bool value) override;
- virtual void setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
- virtual void setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex) override;
- virtual void setExternalPlayback(bool enabled, ExternalPlaybackTargetType, WTF::String localizedDeviceName) override;
- virtual void setWirelessVideoPlaybackDisabled(bool) override;
-
- WebVideoFullscreenInterfaceContext(WebVideoFullscreenManager&, uint64_t contextId);
-
- WebVideoFullscreenManager* m_manager;
- uint64_t m_contextId;
- std::unique_ptr<LayerHostingContext> m_layerHostingContext;
- bool m_isAnimating { false };
- bool m_targetIsFullscreen { false };
- WebCore::HTMLMediaElementEnums::VideoFullscreenMode m_fullscreenMode { WebCore::HTMLMediaElementEnums::VideoFullscreenModeNone };
- bool m_isFullscreen { false };
-};
-
-class WebVideoFullscreenManager : public RefCounted<WebVideoFullscreenManager>, private IPC::MessageReceiver {
-public:
- static Ref<WebVideoFullscreenManager> create(PassRefPtr<WebPage>);
- virtual ~WebVideoFullscreenManager();
-
- void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&) override;
-
- // Interface to ChromeClient
- bool supportsVideoFullscreen() const;
- void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
- void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&);
-
-protected:
- friend class WebVideoFullscreenInterfaceContext;
-
- explicit WebVideoFullscreenManager(PassRefPtr<WebPage>);
-
- typedef std::tuple<RefPtr<WebCore::WebVideoFullscreenModelVideoElement>, RefPtr<WebVideoFullscreenInterfaceContext>> ModelInterfaceTuple;
- ModelInterfaceTuple createModelAndInterface(uint64_t contextId);
- ModelInterfaceTuple& ensureModelAndInterface(uint64_t contextId);
- WebCore::WebVideoFullscreenModelVideoElement& ensureModel(uint64_t contextId);
- WebVideoFullscreenInterfaceContext& ensureInterface(uint64_t contextId);
-
- // Interface to WebVideoFullscreenInterfaceContext
- void resetMediaState(uint64_t contextId);
- void setDuration(uint64_t contextId, double);
- void setCurrentTime(uint64_t contextId, double currentTime, double anchorTime);
- void setBufferedTime(uint64_t contextId, double bufferedTime);
- void setRate(uint64_t contextId, bool isPlaying, float playbackRate);
- void setVideoDimensions(uint64_t contextId, bool hasVideo, float width, float height);
- void setSeekableRanges(uint64_t contextId, const WebCore::TimeRanges&);
- void setCanPlayFastReverse(uint64_t contextId, bool value);
- void setAudioMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex);
- void setLegibleMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex);
- void setExternalPlayback(uint64_t contextId, bool enabled, WebCore::WebVideoFullscreenInterface::ExternalPlaybackTargetType, String localizedDeviceName);
- void setWirelessVideoPlaybackDisabled(uint64_t contextId, bool);
-
- // Messages from WebVideoFullscreenManagerProxy
- void play(uint64_t contextId);
- void pause(uint64_t contextId);
- void togglePlayState(uint64_t contextId);
- void beginScrubbing(uint64_t contextId);
- void endScrubbing(uint64_t contextId);
- void seekToTime(uint64_t contextId, double time);
- void fastSeek(uint64_t contextId, double time);
- void beginScanningForward(uint64_t contextId);
- void beginScanningBackward(uint64_t contextId);
- void endScanning(uint64_t contextId);
- void requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
- void didSetupFullscreen(uint64_t contextId);
- void didExitFullscreen(uint64_t contextId);
- void didEnterFullscreen(uint64_t contextId);
- void didCleanupFullscreen(uint64_t contextId);
- void setVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort);
- void setVideoLayerGravityEnum(uint64_t contextId, unsigned gravity);
- void selectAudioMediaOption(uint64_t contextId, uint64_t index);
- void selectLegibleMediaOption(uint64_t contextId, uint64_t index);
- void fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode);
- void fullscreenMayReturnToInline(uint64_t contextId, bool isPageVisible);
-
- WebPage* m_page;
- HashMap<WebCore::HTMLVideoElement*, uint64_t> m_videoElements;
- HashMap<uint64_t, ModelInterfaceTuple> m_contextMap;
-};
-
-} // namespace WebKit
-
-#endif // PLATFORM(IOS)
-
-#endif // WebVideoFullscreenManager_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermessagesin"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.messages.in        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,47 +0,0 @@
</span><del>-# Copyright (C) 2014 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.
-
-#if PLATFORM(IOS)
-messages -> WebVideoFullscreenManager {
- Play(uint64_t contextId)
- Pause(uint64_t contextId)
- TogglePlayState(uint64_t contextId)
- BeginScrubbing(uint64_t contextId)
- EndScrubbing(uint64_t contextId)
- SeekToTime(uint64_t contextId, double time)
- FastSeek(uint64_t contextId, double time)
- BeginScanningForward(uint64_t contextId)
- BeginScanningBackward(uint64_t contextId)
- EndScanning(uint64_t contextId)
- RequestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
- DidSetupFullscreen(uint64_t contextId)
- DidExitFullscreen(uint64_t contextId)
- DidEnterFullscreen(uint64_t contextId)
- DidCleanupFullscreen(uint64_t contextId)
- SetVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
- SetVideoLayerGravityEnum(uint64_t contextId, unsigned gravity)
- SelectAudioMediaOption(uint64_t contextId, uint64_t index)
- SelectLegibleMediaOption(uint64_t contextId, uint64_t index)
- FullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
- FullscreenMayReturnToInline(uint64_t contextId, bool isPageVisible)
-}
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessiosWebVideoFullscreenManagermm"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm (195599 => 195600)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2016-01-26 18:46:44 UTC (rev 195599)
+++ trunk/Source/WebKit2/WebProcess/ios/WebVideoFullscreenManager.mm        2016-01-26 18:56:00 UTC (rev 195600)
</span><span class="lines">@@ -1,561 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 "WebVideoFullscreenManager.h"
-
-#if PLATFORM(IOS)
-
-#import "Attachment.h"
-#import "WebCoreArgumentCoders.h"
-#import "WebPage.h"
-#import "WebProcess.h"
-#import "WebVideoFullscreenManagerMessages.h"
-#import "WebVideoFullscreenManagerProxyMessages.h"
-#import <QuartzCore/CoreAnimation.h>
-#import <WebCore/Color.h>
-#import <WebCore/Event.h>
-#import <WebCore/EventNames.h>
-#import <WebCore/FrameView.h>
-#import <WebCore/HTMLVideoElement.h>
-#import <WebCore/PlatformCALayer.h>
-#import <WebCore/RenderLayer.h>
-#import <WebCore/RenderLayerBacking.h>
-#import <WebCore/RenderView.h>
-#import <WebCore/Settings.h>
-#import <WebCore/TimeRanges.h>
-#import <WebCore/WebCoreThreadRun.h>
-#import <mach/mach_port.h>
-
-using namespace WebCore;
-
-namespace WebKit {
-
-static IntRect clientRectForElement(HTMLElement* element)
-{
- if (!element)
- return IntRect();
-
- return element->clientRect();
-}
-
-static uint64_t nextContextId()
-{
- static uint64_t contextId = 0;
- return ++contextId;
-}
-
-#pragma mark - WebVideoFullscreenInterfaceContext
-
-WebVideoFullscreenInterfaceContext::WebVideoFullscreenInterfaceContext(WebVideoFullscreenManager& manager, uint64_t contextId)
- : m_manager(&manager)
- , m_contextId(contextId)
-{
-}
-
-WebVideoFullscreenInterfaceContext::~WebVideoFullscreenInterfaceContext()
-{
-}
-
-void WebVideoFullscreenInterfaceContext::setLayerHostingContext(std::unique_ptr<LayerHostingContext>&& context)
-{
- m_layerHostingContext = WTFMove(context);
-}
-
-void WebVideoFullscreenInterfaceContext::resetMediaState()
-{
- if (m_manager)
- m_manager->resetMediaState(m_contextId);
-}
-
-void WebVideoFullscreenInterfaceContext::setDuration(double duration)
-{
- if (m_manager)
- m_manager->setDuration(m_contextId, duration);
-}
-
-void WebVideoFullscreenInterfaceContext::setCurrentTime(double currentTime, double anchorTime)
-{
- if (m_manager)
- m_manager->setCurrentTime(m_contextId, currentTime, anchorTime);
-}
-
-void WebVideoFullscreenInterfaceContext::setBufferedTime(double bufferedTime)
-{
- if (m_manager)
- m_manager->setBufferedTime(m_contextId, bufferedTime);
-}
-
-void WebVideoFullscreenInterfaceContext::setRate(bool isPlaying, float playbackRate)
-{
- if (m_manager)
- m_manager->setRate(m_contextId, isPlaying, playbackRate);
-}
-
-void WebVideoFullscreenInterfaceContext::setVideoDimensions(bool hasVideo, float width, float height)
-{
- if (m_manager)
- m_manager->setVideoDimensions(m_contextId, hasVideo, width, height);
-}
-
-void WebVideoFullscreenInterfaceContext::setSeekableRanges(const WebCore::TimeRanges& ranges)
-{
- if (m_manager)
- m_manager->setSeekableRanges(m_contextId, ranges);
-}
-
-void WebVideoFullscreenInterfaceContext::setCanPlayFastReverse(bool value)
-{
- if (m_manager)
- m_manager->setCanPlayFastReverse(m_contextId, value);
-}
-
-void WebVideoFullscreenInterfaceContext::setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex)
-{
- if (m_manager)
- m_manager->setAudioMediaSelectionOptions(m_contextId, options, selectedIndex);
-}
-
-void WebVideoFullscreenInterfaceContext::setLegibleMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex)
-{
- if (m_manager)
- m_manager->setLegibleMediaSelectionOptions(m_contextId, options, selectedIndex);
-}
-
-void WebVideoFullscreenInterfaceContext::setExternalPlayback(bool enabled, ExternalPlaybackTargetType type, WTF::String localizedDeviceName)
-{
- if (m_manager)
- m_manager->setExternalPlayback(m_contextId, enabled, type, localizedDeviceName);
-}
-
-void WebVideoFullscreenInterfaceContext::setWirelessVideoPlaybackDisabled(bool disabled)
-{
- if (m_manager)
- m_manager->setWirelessVideoPlaybackDisabled(m_contextId, disabled);
-}
-
-#pragma mark - WebVideoFullscreenManager
-
-Ref<WebVideoFullscreenManager> WebVideoFullscreenManager::create(PassRefPtr<WebPage> page)
-{
- return adoptRef(*new WebVideoFullscreenManager(page));
-}
-
-WebVideoFullscreenManager::WebVideoFullscreenManager(PassRefPtr<WebPage> page)
- : m_page(page.get())
-{
- WebProcess::singleton().addMessageReceiver(Messages::WebVideoFullscreenManager::messageReceiverName(), page->pageID(), *this);
-}
-
-WebVideoFullscreenManager::~WebVideoFullscreenManager()
-{
- for (auto& tuple : m_contextMap.values()) {
- RefPtr<WebVideoFullscreenModelVideoElement> model;
- RefPtr<WebVideoFullscreenInterfaceContext> interface;
- std::tie(model, interface) = tuple;
-
- model->setWebVideoFullscreenInterface(nullptr);
- model->setVideoElement(nullptr);
-
- interface->invalidate();
- }
-
- m_contextMap.clear();
- m_videoElements.clear();
-
- WebProcess::singleton().removeMessageReceiver(Messages::WebVideoFullscreenManager::messageReceiverName(), m_page->pageID());
-}
-
-WebVideoFullscreenManager::ModelInterfaceTuple WebVideoFullscreenManager::createModelAndInterface(uint64_t contextId)
-{
- RefPtr<WebVideoFullscreenModelVideoElement> model = WebVideoFullscreenModelVideoElement::create();
- RefPtr<WebVideoFullscreenInterfaceContext> interface = WebVideoFullscreenInterfaceContext::create(*this, contextId);
-
- interface->setLayerHostingContext(LayerHostingContext::createForExternalHostingProcess());
- model->setWebVideoFullscreenInterface(interface.get());
-
- return std::make_tuple(WTFMove(model), WTFMove(interface));
-}
-
-WebVideoFullscreenManager::ModelInterfaceTuple& WebVideoFullscreenManager::ensureModelAndInterface(uint64_t contextId)
-{
- auto addResult = m_contextMap.add(contextId, ModelInterfaceTuple());
- if (addResult.isNewEntry)
- addResult.iterator->value = createModelAndInterface(contextId);
- return addResult.iterator->value;
-}
-
-WebCore::WebVideoFullscreenModelVideoElement& WebVideoFullscreenManager::ensureModel(uint64_t contextId)
-{
- return *std::get<0>(ensureModelAndInterface(contextId));
-}
-
-WebVideoFullscreenInterfaceContext& WebVideoFullscreenManager::ensureInterface(uint64_t contextId)
-{
- return *std::get<1>(ensureModelAndInterface(contextId));
-}
-
-#pragma mark Interface to ChromeClient:
-
-bool WebVideoFullscreenManager::supportsVideoFullscreen() const
-{
- return Settings::avKitEnabled();
-}
-
-void WebVideoFullscreenManager::enterVideoFullscreenForVideoElement(HTMLVideoElement& videoElement, HTMLMediaElementEnums::VideoFullscreenMode mode)
-{
- ASSERT(mode != HTMLMediaElementEnums::VideoFullscreenModeNone);
-
- uint64_t contextId;
-
- auto addResult = m_videoElements.add(&videoElement, 0);
- if (addResult.isNewEntry)
- addResult.iterator->value = nextContextId();
- contextId = addResult.iterator->value;
-
- RefPtr<WebVideoFullscreenModelVideoElement> model;
- RefPtr<WebVideoFullscreenInterfaceContext> interface;
- std::tie(model, interface) = ensureModelAndInterface(contextId);
-
- FloatRect clientRect = clientRectForElement(&videoElement);
- FloatRect videoLayerFrame = FloatRect(0, 0, clientRect.width(), clientRect.height());
-
- HTMLMediaElementEnums::VideoFullscreenMode oldMode = interface->fullscreenMode();
- interface->setTargetIsFullscreen(true);
- interface->setFullscreenMode(mode);
- model->setVideoElement(&videoElement);
- if (oldMode == HTMLMediaElementEnums::VideoFullscreenModeNone)
- model->setVideoLayerFrame(videoLayerFrame);
-
- if (interface->isAnimating())
- return;
- interface->setIsAnimating(true);
-
- bool allowsPictureInPicture = videoElement.mediaSession().allowsPictureInPicture(videoElement);
-
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), clientRectForElement(&videoElement), m_page->deviceScaleFactor(), interface->fullscreenMode(), allowsPictureInPicture), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement)
-{
- ASSERT(m_videoElements.contains(&videoElement));
-
- uint64_t contextId = m_videoElements.get(&videoElement);
- auto& interface = ensureInterface(contextId);
-
- interface.setTargetIsFullscreen(false);
-
- if (interface.isAnimating())
- return;
-
- interface.setIsAnimating(true);
- m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, clientRectForElement(&videoElement)), m_page->pageID());
-}
-
-#pragma mark Interface to WebVideoFullscreenInterfaceContext:
-
-void WebVideoFullscreenManager::resetMediaState(uint64_t contextId)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::ResetMediaState(contextId), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setDuration(uint64_t contextId, double duration)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetDuration(contextId, duration), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setCurrentTime(uint64_t contextId, double currentTime, double anchorTime)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetCurrentTime(contextId, currentTime, anchorTime), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setBufferedTime(uint64_t contextId, double bufferedTime)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetBufferedTime(contextId, bufferedTime), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setRate(uint64_t contextId, bool isPlaying, float playbackRate)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetRate(contextId, isPlaying, playbackRate), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setVideoDimensions(uint64_t contextId, bool hasVideo, float width, float height)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetVideoDimensions(contextId, hasVideo, width, height), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setSeekableRanges(uint64_t contextId, const WebCore::TimeRanges& timeRanges)
-{
- Vector<std::pair<double, double>> rangesVector;
-
- for (unsigned i = 0; i < timeRanges.length(); i++) {
- ExceptionCode exceptionCode;
- double start = timeRanges.start(i, exceptionCode);
- double end = timeRanges.end(i, exceptionCode);
- rangesVector.append(std::pair<double,double>(start, end));
- }
-
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetSeekableRangesVector(contextId, WTFMove(rangesVector)), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setCanPlayFastReverse(uint64_t contextId, bool value)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetCanPlayFastReverse(contextId, value), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setAudioMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetAudioMediaSelectionOptions(contextId, options, selectedIndex), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setLegibleMediaSelectionOptions(uint64_t contextId, const Vector<String>& options, uint64_t selectedIndex)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetLegibleMediaSelectionOptions(contextId, options, selectedIndex), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setExternalPlayback(uint64_t contextId, bool enabled, WebVideoFullscreenInterface::ExternalPlaybackTargetType targetType, String localizedDeviceName)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetExternalPlaybackProperties(contextId, enabled, static_cast<uint32_t>(targetType), localizedDeviceName), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
-{
- m_page->send(Messages::WebVideoFullscreenManagerProxy::SetWirelessVideoPlaybackDisabled(contextId, disabled));
-}
-
-#pragma mark Messages from WebVideoFullscreenManagerProxy:
-
-void WebVideoFullscreenManager::play(uint64_t contextId)
-{
- ensureModel(contextId).play();
-}
-
-void WebVideoFullscreenManager::pause(uint64_t contextId)
-{
- ensureModel(contextId).pause();
-}
-
-void WebVideoFullscreenManager::togglePlayState(uint64_t contextId)
-{
- ensureModel(contextId).togglePlayState();
-}
-
-void WebVideoFullscreenManager::beginScrubbing(uint64_t contextId)
-{
- ensureModel(contextId).beginScrubbing();
-}
-
-void WebVideoFullscreenManager::endScrubbing(uint64_t contextId)
-{
- ensureModel(contextId).endScrubbing();
-}
-
-void WebVideoFullscreenManager::seekToTime(uint64_t contextId, double time)
-{
- ensureModel(contextId).seekToTime(time);
-}
-
-void WebVideoFullscreenManager::fastSeek(uint64_t contextId, double time)
-{
- ensureModel(contextId).fastSeek(time);
-}
-
-void WebVideoFullscreenManager::beginScanningForward(uint64_t contextId)
-{
- ensureModel(contextId).beginScanningForward();
-}
-
-void WebVideoFullscreenManager::beginScanningBackward(uint64_t contextId)
-{
- ensureModel(contextId).beginScanningBackward();
-}
-
-void WebVideoFullscreenManager::endScanning(uint64_t contextId)
-{
- ensureModel(contextId).endScanning();
-}
-
-void WebVideoFullscreenManager::requestFullscreenMode(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
-{
- ensureModel(contextId).requestFullscreenMode(mode);
-}
-
-void WebVideoFullscreenManager::selectAudioMediaOption(uint64_t contextId, uint64_t index)
-{
- ensureModel(contextId).selectAudioMediaOption(index);
-}
-
-void WebVideoFullscreenManager::selectLegibleMediaOption(uint64_t contextId, uint64_t index)
-{
- ensureModel(contextId).selectLegibleMediaOption(index);
-}
-
-void WebVideoFullscreenManager::fullscreenModeChanged(uint64_t contextId, WebCore::HTMLMediaElementEnums::VideoFullscreenMode videoFullscreenMode)
-{
- ensureModel(contextId).fullscreenModeChanged(videoFullscreenMode);
-}
-
-#pragma mark Messages from WebVideoFullscreenManager:
-
-void WebVideoFullscreenManager::didSetupFullscreen(uint64_t contextId)
-{
- PlatformLayer* videoLayer = [CALayer layer];
-#ifndef NDEBUG
- [videoLayer setName:@"Web video fullscreen manager layer"];
-#endif
-
- [CATransaction begin];
- [CATransaction setDisableActions:YES];
-
- [videoLayer setPosition:CGPointMake(0, 0)];
- [videoLayer setBackgroundColor:cachedCGColor(WebCore::Color::transparent)];
-
- // Set a scale factor here to make convertRect:toLayer:nil take scale factor into account. <rdar://problem/18316542>.
- // This scale factor is inverted in the hosting process.
- float hostingScaleFactor = m_page->deviceScaleFactor();
- [videoLayer setTransform:CATransform3DMakeScale(hostingScaleFactor, hostingScaleFactor, 1)];
-
- RefPtr<WebVideoFullscreenModelVideoElement> model;
- RefPtr<WebVideoFullscreenInterfaceContext> interface;
- std::tie(model, interface) = ensureModelAndInterface(contextId);
-
- interface->layerHostingContext()->setRootLayer(videoLayer);
- model->setVideoFullscreenLayer(videoLayer);
-
- [CATransaction commit];
-
- RefPtr<WebVideoFullscreenManager> strongThis(this);
- dispatch_async(dispatch_get_main_queue(), [strongThis, this, contextId] {
- m_page->send(Messages::WebVideoFullscreenManagerProxy::EnterFullscreen(contextId), m_page->pageID());
- });
-}
-
-void WebVideoFullscreenManager::didEnterFullscreen(uint64_t contextId)
-{
- RefPtr<WebVideoFullscreenModelVideoElement> model;
- RefPtr<WebVideoFullscreenInterfaceContext> interface;
- std::tie(model, interface) = ensureModelAndInterface(contextId);
-
- interface->setIsAnimating(false);
- interface->setIsFullscreen(false);
-
- if (interface->targetIsFullscreen())
- return;
-
- RefPtr<HTMLVideoElement> videoElement = model->videoElement();
- if (!videoElement)
- return;
-
- // exit fullscreen now if it was previously requested during an animation.
- RefPtr<WebVideoFullscreenManager> strongThis(this);
- dispatch_async(dispatch_get_main_queue(), [strongThis, videoElement] {
- strongThis->exitVideoFullscreenForVideoElement(*videoElement);
- });
-}
-
-void WebVideoFullscreenManager::didExitFullscreen(uint64_t contextId)
-{
- RefPtr<WebVideoFullscreenModelVideoElement> model;
- RefPtr<WebVideoFullscreenInterfaceContext> interface;
- std::tie(model, interface) = ensureModelAndInterface(contextId);
-
- model->setVideoFullscreenLayer(nil);
-
- RefPtr<WebVideoFullscreenManager> strongThis(this);
- dispatch_async(dispatch_get_main_queue(), [strongThis, contextId, interface] {
- if (interface->layerHostingContext()) {
- interface->layerHostingContext()->setRootLayer(nullptr);
- interface->setLayerHostingContext(nullptr);
- }
- if (strongThis->m_page)
- strongThis->m_page->send(Messages::WebVideoFullscreenManagerProxy::CleanupFullscreen(contextId), strongThis->m_page->pageID());
- });
-}
-
-void WebVideoFullscreenManager::didCleanupFullscreen(uint64_t contextId)
-{
- RefPtr<WebVideoFullscreenModelVideoElement> model;
- RefPtr<WebVideoFullscreenInterfaceContext> interface;
- std::tie(model, interface) = ensureModelAndInterface(contextId);
-
- interface->setIsAnimating(false);
- interface->setIsFullscreen(false);
- HTMLMediaElementEnums::VideoFullscreenMode mode = interface->fullscreenMode();
- bool targetIsFullscreen = interface->targetIsFullscreen();
-
- model->setVideoFullscreenLayer(nil);
- RefPtr<HTMLVideoElement> videoElement = model->videoElement();
-
- model->setVideoElement(nullptr);
- model->setWebVideoFullscreenInterface(nullptr);
- interface->invalidate();
- m_videoElements.remove(videoElement.get());
- m_contextMap.remove(contextId);
-
- if (!videoElement || !targetIsFullscreen)
- return;
-
- RefPtr<WebVideoFullscreenManager> strongThis(this);
- dispatch_async(dispatch_get_main_queue(), [strongThis, videoElement, mode] {
- strongThis->enterVideoFullscreenForVideoElement(*videoElement, mode);
- });
-}
-
-void WebVideoFullscreenManager::setVideoLayerGravityEnum(uint64_t contextId, unsigned gravity)
-{
- ensureModel(contextId).setVideoLayerGravity((WebVideoFullscreenModel::VideoGravity)gravity);
-}
-
-void WebVideoFullscreenManager::fullscreenMayReturnToInline(uint64_t contextId, bool isPageVisible)
-{
- auto& model = ensureModel(contextId);
-
- if (!isPageVisible)
- model.videoElement()->scrollIntoViewIfNotVisible(false);
- m_page->send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(contextId, true, clientRectForElement(model.videoElement())), m_page->pageID());
-}
-
-void WebVideoFullscreenManager::setVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
-{
- RefPtr<WebVideoFullscreenModelVideoElement> model;
- RefPtr<WebVideoFullscreenInterfaceContext> interface;
- std::tie(model, interface) = ensureModelAndInterface(contextId);
-
- if (std::isnan(bounds.x()) || std::isnan(bounds.y()) || std::isnan(bounds.width()) || std::isnan(bounds.height())) {
- FloatRect clientRect = clientRectForElement(model->videoElement());
- bounds = FloatRect(0, 0, clientRect.width(), clientRect.height());
- }
-
- [CATransaction begin];
- [CATransaction setAnimationDuration:0];
- if (interface->layerHostingContext())
- interface->layerHostingContext()->setFencePort(fencePort.port());
- model->setVideoLayerFrame(bounds);
- mach_port_deallocate(mach_task_self(), fencePort.port());
- [CATransaction commit];
-}
-
-} // namespace WebKit
-
-#endif // PLATFORM(IOS)
</del></span></pre>
</div>
</div>
</body>
</html>