<!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>[163097] trunk/Source/WebCore</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/163097">163097</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-30 11:50:03 -0800 (Thu, 30 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactor WebVideoFullscreenController separating AVKit from MediaElement.
https://bugs.webkit.org/show_bug.cgi?id=127762

Patch by Jeremy Jones &lt;jeremyj@apple.com&gt; on 2014-01-30
Reviewed by Jer Noble.

Refactor WebVideoFullscreenControllerAVKit implementation into two abstract interfaces with concrete implementations:
WebVideoFullscreenModel, WebVideoFullscreenInterface, WebVideoFullscreenModelMediaElement, WebVideoFullscreenInterfaceAVKit.

* WebCore.xcodeproj/project.pbxproj:
* platform/ios/WebVideoFullscreenControllerAVKit.h:
* platform/ios/WebVideoFullscreenControllerAVKit.mm:
(-[WebVideoFullscreenController init]):
(-[WebVideoFullscreenController dealloc]):
(-[WebVideoFullscreenController enterFullscreen:]):
(-[WebVideoFullscreenController exitFullscreen]):
* platform/ios/WebVideoFullscreenInterface.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
(WebCore::WebVideoFullscreenInterface::~WebVideoFullscreenInterface):
* platform/ios/WebVideoFullscreenInterfaceAVKit.h: Added.
(WebCore::WebVideoFullscreenInterfaceAVKit::~WebVideoFullscreenInterfaceAVKit):
* platform/ios/WebVideoFullscreenInterfaceAVKit.mm: Added.
(NS_ENUM):
(-[WebAVPlayerController init]):
(-[WebAVPlayerController dealloc]):
(-[WebAVPlayerController forwardingTargetForSelector:]):
(-[WebAVPlayerController playerViewController:shouldDismissWithReason:]):
(-[WebAVPlayerController play:]):
(-[WebAVPlayerController pause:]):
(-[WebAVPlayerController togglePlayback:]):
(-[WebAVPlayerController isPlaying]):
(-[WebAVPlayerController setPlaying:]):
(+[WebAVPlayerController keyPathsForValuesAffectingPlaying]):
(-[WebAVPlayerController seekToTime:]):
(:m_videoFullscreenModel):
(WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel):
(WebVideoFullscreenInterfaceAVKit::setDuration):
(WebVideoFullscreenInterfaceAVKit::setCurrentTime):
(WebVideoFullscreenInterfaceAVKit::setRate):
(WebVideoFullscreenInterfaceAVKit::setVideoDimensions):
(WebVideoFullscreenInterfaceAVKit::setVideoLayer):
(WebVideoFullscreenInterfaceAVKit::enterFullscreen):
(WebVideoFullscreenInterfaceAVKit::exitFullscreen):
* platform/ios/WebVideoFullscreenModel.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
(WebCore::WebVideoFullscreenModel::~WebVideoFullscreenModel):
* platform/ios/WebVideoFullscreenModelMediaElement.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
(WebCore::WebVideoFullscreenModelMediaElement::~WebVideoFullscreenModelMediaElement):
(WebCore::WebVideoFullscreenModelMediaElement::setWebVideoFullscreenInterface):
* platform/ios/WebVideoFullscreenModelMediaElement.mm: Added.
(WebVideoFullscreenModelMediaElement::setMediaElement):
(WebVideoFullscreenModelMediaElement::handleEvent):
(WebVideoFullscreenModelMediaElement::requestExitFullScreen):
(WebVideoFullscreenModelMediaElement::play):
(WebVideoFullscreenModelMediaElement::pause):
(WebVideoFullscreenModelMediaElement::togglePlayState):
(WebVideoFullscreenModelMediaElement::seekToTime):
(WebVideoFullscreenModelMediaElement::didExitFullscreen):</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="#trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKith">trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKitmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKith">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKitmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementh">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h</a></li>
<li><a href="#trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementmm">trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163096 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-30 19:37:32 UTC (rev 163096)
+++ trunk/Source/WebCore/ChangeLog        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2014-01-30  Jeremy Jones  &lt;jeremyj@apple.com&gt;
+
+        Refactor WebVideoFullscreenController separating AVKit from MediaElement.
+        https://bugs.webkit.org/show_bug.cgi?id=127762
+
+        Reviewed by Jer Noble.
+
+        Refactor WebVideoFullscreenControllerAVKit implementation into two abstract interfaces with concrete implementations: 
+        WebVideoFullscreenModel, WebVideoFullscreenInterface, WebVideoFullscreenModelMediaElement, WebVideoFullscreenInterfaceAVKit.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/ios/WebVideoFullscreenControllerAVKit.h:
+        * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+        (-[WebVideoFullscreenController init]):
+        (-[WebVideoFullscreenController dealloc]):
+        (-[WebVideoFullscreenController enterFullscreen:]):
+        (-[WebVideoFullscreenController exitFullscreen]):
+        * platform/ios/WebVideoFullscreenInterface.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
+        (WebCore::WebVideoFullscreenInterface::~WebVideoFullscreenInterface):
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.h: Added.
+        (WebCore::WebVideoFullscreenInterfaceAVKit::~WebVideoFullscreenInterfaceAVKit):
+        * platform/ios/WebVideoFullscreenInterfaceAVKit.mm: Added.
+        (NS_ENUM):
+        (-[WebAVPlayerController init]):
+        (-[WebAVPlayerController dealloc]):
+        (-[WebAVPlayerController forwardingTargetForSelector:]):
+        (-[WebAVPlayerController playerViewController:shouldDismissWithReason:]):
+        (-[WebAVPlayerController play:]):
+        (-[WebAVPlayerController pause:]):
+        (-[WebAVPlayerController togglePlayback:]):
+        (-[WebAVPlayerController isPlaying]):
+        (-[WebAVPlayerController setPlaying:]):
+        (+[WebAVPlayerController keyPathsForValuesAffectingPlaying]):
+        (-[WebAVPlayerController seekToTime:]):
+        (:m_videoFullscreenModel):
+        (WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel):
+        (WebVideoFullscreenInterfaceAVKit::setDuration):
+        (WebVideoFullscreenInterfaceAVKit::setCurrentTime):
+        (WebVideoFullscreenInterfaceAVKit::setRate):
+        (WebVideoFullscreenInterfaceAVKit::setVideoDimensions):
+        (WebVideoFullscreenInterfaceAVKit::setVideoLayer):
+        (WebVideoFullscreenInterfaceAVKit::enterFullscreen):
+        (WebVideoFullscreenInterfaceAVKit::exitFullscreen):
+        * platform/ios/WebVideoFullscreenModel.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
+        (WebCore::WebVideoFullscreenModel::~WebVideoFullscreenModel):
+        * platform/ios/WebVideoFullscreenModelMediaElement.h: Copied from Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h.
+        (WebCore::WebVideoFullscreenModelMediaElement::~WebVideoFullscreenModelMediaElement):
+        (WebCore::WebVideoFullscreenModelMediaElement::setWebVideoFullscreenInterface):
+        * platform/ios/WebVideoFullscreenModelMediaElement.mm: Added.
+        (WebVideoFullscreenModelMediaElement::setMediaElement):
+        (WebVideoFullscreenModelMediaElement::handleEvent):
+        (WebVideoFullscreenModelMediaElement::requestExitFullScreen):
+        (WebVideoFullscreenModelMediaElement::play):
+        (WebVideoFullscreenModelMediaElement::pause):
+        (WebVideoFullscreenModelMediaElement::togglePlayState):
+        (WebVideoFullscreenModelMediaElement::seekToTime):
+        (WebVideoFullscreenModelMediaElement::didExitFullscreen):
+
</ins><span class="cx"> 2014-01-30  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [MediaControls][iOS] Add a &quot;start load&quot; button.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (163096 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-30 19:37:32 UTC (rev 163096)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -1300,6 +1300,12 @@
</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><ins>+                3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                3FBC4AEC1898810E0046EE38 /* WebVideoFullscreenInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AEB1898810E0046EE38 /* WebVideoFullscreenInterface.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                3FBC4AEF189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FBC4AED189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm */; };
+                3FBC4AF0189881380046EE38 /* WebVideoFullscreenModelMediaElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AEE189881380046EE38 /* WebVideoFullscreenModelMediaElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */; };
+                3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 3FFFF9A8159D9A550020BBD5 /* WebKitCSSViewportRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */; };
</span><span class="cx">                 3FFFF9A9159D9A550020BBD5 /* WebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */; };
</span><span class="cx">                 3FFFF9AD159D9B060020BBD5 /* ViewportStyleResolver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3FFFF9AB159D9B060020BBD5 /* ViewportStyleResolver.cpp */; };
</span><span class="lines">@@ -8124,6 +8130,12 @@
</span><span class="cx">                 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebKitCSSViewportRule.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3F42B31B1881191B00278AAC /* WebVideoFullscreenControllerAVKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenControllerAVKit.h; path = ios/WebVideoFullscreenControllerAVKit.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3F42B31C1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenControllerAVKit.mm; path = ios/WebVideoFullscreenControllerAVKit.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenModel.h; path = ios/WebVideoFullscreenModel.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                3FBC4AEB1898810E0046EE38 /* WebVideoFullscreenInterface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenInterface.h; path = ios/WebVideoFullscreenInterface.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                3FBC4AED189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenModelMediaElement.mm; path = ios/WebVideoFullscreenModelMediaElement.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                3FBC4AEE189881380046EE38 /* WebVideoFullscreenModelMediaElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenModelMediaElement.h; path = ios/WebVideoFullscreenModelMediaElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebVideoFullscreenInterfaceAVKit.mm; path = ios/WebVideoFullscreenInterfaceAVKit.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
+                3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebVideoFullscreenInterfaceAVKit.h; path = ios/WebVideoFullscreenInterfaceAVKit.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 3FFFF9A6159D9A550020BBD5 /* WebKitCSSViewportRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebKitCSSViewportRule.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3FFFF9A7159D9A550020BBD5 /* WebKitCSSViewportRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitCSSViewportRule.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 3FFFF9AB159D9B060020BBD5 /* ViewportStyleResolver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ViewportStyleResolver.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17950,6 +17962,12 @@
</span><span class="cx">                                 3F42B31B1881191B00278AAC /* WebVideoFullscreenControllerAVKit.h */,
</span><span class="cx">                                 3F42B31C1881191B00278AAC /* WebVideoFullscreenControllerAVKit.mm */,
</span><span class="cx">                                 E453903C0EAFD637003695C8 /* WidgetIOS.mm */,
</span><ins>+                                3FBC4AE9189880EF0046EE38 /* WebVideoFullscreenModel.h */,
+                                3FBC4AEB1898810E0046EE38 /* WebVideoFullscreenInterface.h */,
+                                3FBC4AED189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm */,
+                                3FBC4AEE189881380046EE38 /* WebVideoFullscreenModelMediaElement.h */,
+                                3FBC4AF1189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm */,
+                                3FBC4AF2189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = ios;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -23530,6 +23548,7 @@
</span><span class="cx">                                 A74BB76B13BDA86300FF7BF0 /* ExceptionCodePlaceholder.h in Headers */,
</span><span class="cx">                                 148AFDA50AF58360008CC700 /* ExceptionHandlers.h in Headers */,
</span><span class="cx">                                 9767CE0B145ABC13005E64DB /* ExceptionHeaders.h in Headers */,
</span><ins>+                                3FBC4AEC1898810E0046EE38 /* WebVideoFullscreenInterface.h in Headers */,
</ins><span class="cx">                                 9767CE0C145ABC13005E64DB /* ExceptionInterfaces.h in Headers */,
</span><span class="cx">                                 A024575216CEAA27000E5671 /* EXTDrawBuffers.h in Headers */,
</span><span class="cx">                                 6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */,
</span><span class="lines">@@ -23814,6 +23833,7 @@
</span><span class="cx">                                 977B3875122883E900B81FF8 /* HTMLScriptRunner.h in Headers */,
</span><span class="cx">                                 977B3876122883E900B81FF8 /* HTMLScriptRunnerHost.h in Headers */,
</span><span class="cx">                                 A81369D8097374F600D74463 /* HTMLSelectElement.h in Headers */,
</span><ins>+                                3FBC4AEA189880EF0046EE38 /* WebVideoFullscreenModel.h in Headers */,
</ins><span class="cx">                                 E44613A80CD6331000FADA75 /* HTMLSourceElement.h in Headers */,
</span><span class="cx">                                 977E2DCE12F0E28300C13379 /* HTMLSourceTracker.h in Headers */,
</span><span class="cx">                                 978AD67514130A8D00C7CAE3 /* HTMLSpanElement.h in Headers */,
</span><span class="lines">@@ -24028,6 +24048,7 @@
</span><span class="cx">                                 B59DD699119029E5007E9684 /* JSDatabaseCallback.h in Headers */,
</span><span class="cx">                                 B58CEB6911913607002A6790 /* JSDatabaseSync.h in Headers */,
</span><span class="cx">                                 4162A4581011464700DFF3ED /* JSDedicatedWorkerGlobalScope.h in Headers */,
</span><ins>+                                3FBC4AF0189881380046EE38 /* WebVideoFullscreenModelMediaElement.h in Headers */,
</ins><span class="cx">                                 FDA15ED212B03F94003A583A /* JSDelayNode.h in Headers */,
</span><span class="cx">                                 31FB1A66120A5D3F00DC02A0 /* JSDeviceMotionEvent.h in Headers */,
</span><span class="cx">                                 59A86008119DAFA100DEF1EF /* JSDeviceOrientationEvent.h in Headers */,
</span><span class="lines">@@ -24241,6 +24262,7 @@
</span><span class="cx">                                 6EBF0E7712A9868800DB1709 /* JSOESTextureFloat.h in Headers */,
</span><span class="cx">                                 A31C4E5416E02B40002F7957 /* JSOESTextureHalfFloat.h in Headers */,
</span><span class="cx">                                 77A17AA712F28B2A004E02F6 /* JSOESVertexArrayObject.h in Headers */,
</span><ins>+                                3FBC4AF4189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.h in Headers */,
</ins><span class="cx">                                 FDF6BAF9134A4C9800822920 /* JSOfflineAudioCompletionEvent.h in Headers */,
</span><span class="cx">                                 FDA9326716703BA9008982DC /* JSOfflineAudioContext.h in Headers */,
</span><span class="cx">                                 FDEA6243152102E200479DF0 /* JSOscillatorNode.h in Headers */,
</span><span class="lines">@@ -27701,6 +27723,7 @@
</span><span class="cx">                                 24D9129513CA956100D21915 /* JSSVGAltGlyphItemElement.cpp in Sources */,
</span><span class="cx">                                 B222F6980AB771950022EFAD /* JSSVGAngle.cpp in Sources */,
</span><span class="cx">                                 51D719C3181106E00016DC51 /* IDBCursorWithValue.cpp in Sources */,
</span><ins>+                                3FBC4AEF189881380046EE38 /* WebVideoFullscreenModelMediaElement.mm in Sources */,
</ins><span class="cx">                                 B2FA3D360AB75A6F000E5AC4 /* JSSVGAnimateColorElement.cpp in Sources */,
</span><span class="cx">                                 B2FA3D380AB75A6F000E5AC4 /* JSSVGAnimatedAngle.cpp in Sources */,
</span><span class="cx">                                 B2FA3D3A0AB75A6F000E5AC4 /* JSSVGAnimatedBoolean.cpp in Sources */,
</span><span class="lines">@@ -28693,6 +28716,7 @@
</span><span class="cx">                                 B25599840D00D8BA00BB825C /* SVGFEImage.cpp in Sources */,
</span><span class="cx">                                 B22279EE0D00BF220071B782 /* SVGFEImageElement.cpp in Sources */,
</span><span class="cx">                                 51D719EB181106E00016DC51 /* IDBRequest.cpp in Sources */,
</span><ins>+                                3FBC4AF3189881560046EE38 /* WebVideoFullscreenInterfaceAVKit.mm in Sources */,
</ins><span class="cx">                                 0FDA7C1A188322EB00C954B5 /* JSTouchList.cpp in Sources */,
</span><span class="cx">                                 A584FE2B1863870F00843B10 /* CommandLineAPIModule.cpp in Sources */,
</span><span class="cx">                                 B22279F10D00BF220071B782 /* SVGFELightElement.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKith"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h (163096 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h        2014-01-30 19:37:32 UTC (rev 163096)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -28,19 +28,13 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> 
</span><del>-#import &lt;wtf/RefPtr.h&gt;
</del><ins>+#import &lt;WebCore/HTMLMediaElement.h&gt;
</ins><span class="cx"> 
</span><del>-@class UIScreen;
</del><ins>+OBJC_CLASS UIScreen;
</ins><span class="cx"> 
</span><del>-namespace WebCore {
-class HTMLMediaElement;
-}
-
</del><span class="cx"> @interface WebVideoFullscreenController : NSObject
</span><del>-
</del><span class="cx"> - (void)setMediaElement:(WebCore::HTMLMediaElement*)mediaElement;
</span><span class="cx"> - (WebCore::HTMLMediaElement*)mediaElement;
</span><del>-
</del><span class="cx"> - (void)enterFullscreen:(UIScreen *)screen;
</span><span class="cx"> - (void)exitFullscreen;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKitmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (163096 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm        2014-01-30 19:37:32 UTC (rev 163096)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -29,312 +29,18 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebVideoFullscreenControllerAVKit.h&quot;
</span><span class="cx"> 
</span><del>-#import &quot;DOMEventInternal.h&quot;
</del><span class="cx"> #import &quot;Logging.h&quot;
</span><del>-#import &lt;CoreMedia/CMTime.h&gt;
-#import &lt;UIKit/UIKit.h&gt;
-#import &lt;WebCore/DOMEventListener.h&gt;
-#import &lt;WebCore/Event.h&gt;
-#import &lt;WebCore/EventListener.h&gt;
-#import &lt;WebCore/EventNames.h&gt;
-#import &lt;WebCore/HTMLElement.h&gt;
-#import &lt;WebCore/HTMLVideoElement.h&gt;
-#import &lt;WebCore/ObjCEventListener.h&gt;
-#import &lt;WebCore/SoftLinking.h&gt;
</del><ins>+#import &quot;WebVideoFullscreenInterfaceAVKit.h&quot;
+#import &quot;WebVideoFullscreenModelMediaElement.h&quot;
</ins><span class="cx"> #import &lt;WebCore/WebCoreThreadRun.h&gt;
</span><del>-#import &lt;WebCore/RenderElement.h&gt;
-#import &lt;wtf/RetainPtr.h&gt;
</del><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-SOFT_LINK_FRAMEWORK(AVFoundation)
-SOFT_LINK_CLASS(AVFoundation, AVPlayerLayer)
-
-SOFT_LINK_FRAMEWORK(AVKit)
-SOFT_LINK_CLASS(AVKit, AVPlayerController)
-SOFT_LINK_CLASS(AVKit, AVPlayerViewController)
-SOFT_LINK_CLASS(AVKit, AVValueTiming)
-
-SOFT_LINK_FRAMEWORK(UIKit)
-SOFT_LINK_CLASS(UIKit, UIScreen)
-SOFT_LINK_CLASS(UIKit, UIWindow)
-SOFT_LINK_CLASS(UIKit, UIView)
-SOFT_LINK_CLASS(UIKit, UIViewController)
-SOFT_LINK_CLASS(UIKit, UIColor)
-
-SOFT_LINK_FRAMEWORK(CoreMedia)
-SOFT_LINK(CoreMedia, CMTimeMakeWithSeconds, CMTime, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale))
-SOFT_LINK(CoreMedia, CMTimeGetSeconds, Float64, (CMTime time), (time))
-
-@interface AVValueTiming : NSObject &lt;NSCoding, NSCopying, NSMutableCopying&gt;
-+ (id)valueTimingWithAnchorValue:(double)anchorValue anchorTimeStamp:(NSTimeInterval) timeStamp rate:(double)rate;
-+ (NSTimeInterval)currentTimeStamp;
-@end
-
-@protocol AVPlayerViewControllerDelegate
-@end
-
-@protocol AVPlayerLayer
-@end
-
-@interface AVPlayerController : UIResponder
-@end
-
-@interface AVPlayerViewController : UIViewController
-@property (nonatomic, weak) id &lt;AVPlayerViewControllerDelegate&gt; delegate;
-@property (nonatomic, strong) AVPlayerController *playerController;
-@end
-
-typedef NS_ENUM(NSInteger, AVPlayerViewControllerDismissalReason) {
-    AVPlayerViewControllerDismissalReasonDoneButtonTapped,
-    AVPlayerViewControllerDismissalReasonRemoteControlStopEventReceived,
-    AVPlayerViewControllerDismissalReasonError
-} NS_ENUM_AVAILABLE_IOS(8_0);
-
-typedef NS_ENUM(NSInteger, AVPlayerControllerStatus) {
-    AVPlayerControllerStatusUnknown,
-    AVPlayerControllerStatusLoading,
-    AVPlayerControllerStatusReadyToPlay,
-    AVPlayerControllerStatusFailed
-} NS_ENUM_AVAILABLE(10_10, 8_0);
-
-@interface WebAVPlayerController : NSObject &lt;DOMEventListener, AVPlayerViewControllerDelegate&gt;
-
-@property(retain) AVPlayerController* playerControllerProxy;
-@property(retain) CALayer&lt;AVPlayerLayer&gt; *playerLayer;
-
-@property BOOL canPlay;
-@property(getter=isPlaying) BOOL playing;
-@property BOOL canPause;
-@property BOOL canTogglePlayback;
-@property double rate;
-@property BOOL canSeek;
-@property NSTimeInterval contentDuration;
-@property NSSize contentDimensions;
-@property BOOL hasEnabledAudio;
-@property BOOL hasEnabledVideo;
-@property NSTimeInterval minTime;
-@property NSTimeInterval maxTime;
-@property NSTimeInterval contentDurationWithinEndTimes;
-@property(retain) NSArray *loadedTimeRanges;
-@property AVPlayerControllerStatus status;
-@property(retain) AVValueTiming *timing;
-
-- (void)handleEvent:(DOMEvent *)evt;
-
-- (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldDismissWithReason:(AVPlayerViewControllerDismissalReason)reason;
-
-@end
-
-
-@implementation WebAVPlayerController
-{
-    RefPtr&lt;HTMLMediaElement&gt; _mediaElement;
-    RefPtr&lt;EventListener&gt; _listener;
-}
-
-- (instancetype)init
-{
-    if (!(self = [super init]))
-        return self;
-    
-    initAVPlayerController();
-    self.playerControllerProxy = [[classAVPlayerController alloc] init];
-    return self;
-}
-
-- (void)dealloc
-{
-    self.playerControllerProxy = nil;
-    self.playerLayer = nil;
-    self.loadedTimeRanges = nil;
-    self.timing = nil;
-    [super dealloc];
-}
-
-- (id)forwardingTargetForSelector:(SEL)selector
-{
-    UNUSED_PARAM(selector);
-    return self.playerControllerProxy;
-}
-
-- (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldDismissWithReason:(AVPlayerViewControllerDismissalReason)reason
-{
-    UNUSED_PARAM(playerViewController);
-    UNUSED_PARAM(reason);
-
-    WebThreadRun(^{
-        _mediaElement-&gt;pause();
-        _mediaElement-&gt;exitFullscreen();
-    });
-    return NO;
-}
-
-- (void)play:(id)sender
-{
-    UNUSED_PARAM(sender);
-    WebThreadRun(^{
-        _mediaElement-&gt;play();
-    });
-}
-
-- (void)pause:(id)sender
-{
-    UNUSED_PARAM(sender);
-    WebThreadRun(^{
-        _mediaElement-&gt;pause();
-    });
-}
-
-- (void)togglePlayback:(id)sender
-{
-    UNUSED_PARAM(sender);
-    WebThreadRun(^{
-        _mediaElement-&gt;togglePlayState();
-    });
-}
-
-- (BOOL)isPlaying
-{
-    return [self rate] != 0;
-}
-
-- (void)setPlaying:(BOOL)playing
-{
-    WebThreadRun(^{
-        if (playing)
-            _mediaElement-&gt;play();
-        else
-            _mediaElement-&gt;pause();
-    });
-}
-
-+ (NSSet *)keyPathsForValuesAffectingPlaying
-{
-    return [NSSet setWithObject:@&quot;rate&quot;];
-}
-
-- (void)seekToTime:(NSTimeInterval)time
-{
-    WebThreadRun(^{
-        _mediaElement-&gt;setCurrentTime(time);
-    });
-}
-
-- (void)updateTimingWithCurrentTime:(NSTimeInterval)currentTime
-{
-    NSTimeInterval anchorTimeStamp = (![self rate]) ? NAN : [classAVValueTiming currentTimeStamp];
-    AVValueTiming *timing = [classAVValueTiming valueTimingWithAnchorValue:currentTime
-      anchorTimeStamp:anchorTimeStamp rate:0];
-    [self setTiming:timing];
-}
-
-- (double)effectiveRate
-{
-    return _mediaElement-&gt;isPlaying() ? _mediaElement-&gt;playbackRate() : 0.;
-}
-
-- (void)updateDuration
-{
-    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=127017 use correct values instead of duration for all these
-    NSTimeInterval duration = _mediaElement-&gt;duration();
-    self.contentDuration = duration;
-    self.maxTime = duration;
-    self.contentDurationWithinEndTimes = duration;
-    self.loadedTimeRanges = @[@0, @(duration)];
-}
-
-- (void)setMediaElement:(PassRefPtr&lt;HTMLMediaElement&gt;)passedMediaElement
-{
-    RefPtr&lt;HTMLMediaElement&gt; mediaElement = passedMediaElement;
-
-    if (_mediaElement == mediaElement)
-        return;
-    
-    if (_mediaElement &amp;&amp; _listener)
-    {
-        _mediaElement-&gt;removeEventListener(eventNames().durationchangeEvent, _listener.get(), false);
-        _mediaElement-&gt;removeEventListener(eventNames().pauseEvent, _listener.get(), false);
-        _mediaElement-&gt;removeEventListener(eventNames().playEvent, _listener.get(), false);
-        _mediaElement-&gt;removeEventListener(eventNames().ratechangeEvent, _listener.get(), false);
-        _mediaElement-&gt;removeEventListener(eventNames().timeupdateEvent, _listener.get(), false);
-    }
-    
-    if (_mediaElement)
-    {
-        [self.playerLayer removeFromSuperlayer];
-        _mediaElement-&gt;returnPlatformLayer(self.playerLayer);
-        self.playerLayer = nil;
-    }
-    
-    _mediaElement = mediaElement;
-    _listener = nullptr;
-    
-    if (!_mediaElement)
-        return;
-
-    _listener = ObjCEventListener::wrap(self);
-
-    _mediaElement-&gt;addEventListener(eventNames().durationchangeEvent, _listener, false);
-    _mediaElement-&gt;addEventListener(eventNames().pauseEvent, _listener, false);
-    _mediaElement-&gt;addEventListener(eventNames().playEvent, _listener, false);
-    _mediaElement-&gt;addEventListener(eventNames().ratechangeEvent, _listener, false);
-    _mediaElement-&gt;addEventListener(eventNames().timeupdateEvent, _listener, false);
-
-    [self updateDuration];
-    self.canPlay = YES;
-    self.canPause = YES;
-    self.canTogglePlayback = YES;
-    self.hasEnabledAudio = YES;
-    self.canSeek = YES;
-    self.minTime = 0;
-    self.rate = [self effectiveRate];
-    self.status = AVPlayerControllerStatusReadyToPlay;
-
-    self.playerLayer = (CALayer&lt;AVPlayerLayer&gt; *)_mediaElement-&gt;borrowPlatformLayer();
-    ASSERT([self.playerLayer isKindOfClass:classAVPlayerLayer]);
-    [self.playerLayer removeFromSuperlayer];
-
-    [self updateTimingWithCurrentTime:_mediaElement-&gt;currentTime()];
-
-    if (isHTMLVideoElement(_mediaElement.get())) {
-        HTMLVideoElement *videoElement = toHTMLVideoElement(_mediaElement.get());
-        self.hasEnabledVideo = YES;
-        self.contentDimensions = CGSizeMake(videoElement-&gt;videoWidth(), videoElement-&gt;videoHeight());
-    }
-}
-
-- (void)handleEvent:(DOMEvent *)evnt
-{
-    Event* event = core(evnt);
-    
-    if (!_mediaElement)
-        return;
-
-    LOG(Media, &quot;handleEvent %s&quot;, event-&gt;type().characters8());
-
-    if (event-&gt;type() == eventNames().durationchangeEvent)
-        [self updateDuration];
-    else if (event-&gt;type() == eventNames().pauseEvent
-        || event-&gt;type() == eventNames().playEvent
-        || event-&gt;type() == eventNames().ratechangeEvent)
-        self.rate = [self effectiveRate];
-    else if (event-&gt;type() == eventNames().timeupdateEvent)
-        [self updateTimingWithCurrentTime:_mediaElement-&gt;currentTime()];
-}
-
-@end
-
-@interface WebVideoFullscreenController () &lt;UIViewControllerTransitioningDelegate&gt;
-@property(retain) UIWindow *window;
-@property(retain) UIViewController *viewController;
-@property(retain) AVPlayerViewController *playerViewController;
-@property(retain) WebAVPlayerController *playerController;
-@end
-
</del><span class="cx"> @implementation WebVideoFullscreenController
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;HTMLMediaElement&gt; _mediaElement;
</span><ins>+    RefPtr&lt;WebVideoFullscreenInterfaceAVKit&gt; _interface;
+    RefPtr&lt;WebVideoFullscreenModelMediaElement&gt; _model;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (instancetype)init
</span><span class="lines">@@ -342,24 +48,11 @@
</span><span class="cx">     if (!(self = [super init]))
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    initUIScreen();
-    initUIView();
-    initUIColor();
-    initUIWindow();
-    initAVPlayerController();
-    initAVPlayerViewController();
-    initAVValueTiming();
-    initUIViewController();
-    initAVPlayerLayer();
</del><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)dealloc
</span><span class="cx"> {
</span><del>-    self.window = nil;
-    self.viewController = nil;
-    self.playerViewController = nil;
-    self.playerController = nil;
</del><span class="cx">     _mediaElement = nullptr;
</span><span class="cx">     [super dealloc];
</span><span class="cx"> }
</span><span class="lines">@@ -376,47 +69,28 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)enterFullscreen:(UIScreen *)screen
</span><span class="cx"> {
</span><del>-    if (!screen)
-        screen = [classUIScreen mainScreen];
-
-    self.playerController = [[[WebAVPlayerController alloc] init] autorelease];
-    self.playerController.mediaElement = _mediaElement;
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        self.playerViewController = [[[classAVPlayerViewController alloc] init] autorelease];
-        self.playerViewController.playerController = (AVPlayerController *)self.playerController;
-        
-        if ([self.playerViewController respondsToSelector:@selector(setDelegate:)])
-            self.playerViewController.delegate = self.playerController;
-       
-        self.viewController = [[[classUIViewController alloc] init] autorelease];
-        
-        self.window = [[[classUIWindow alloc] initWithFrame:[screen bounds]] autorelease];
-        self.window.backgroundColor = [classUIColor clearColor];
-        self.window.rootViewController = (UIViewController *)self.viewController;
-        [self.window makeKeyAndVisible];
-        
-        [self.viewController presentViewController:self.playerViewController animated:YES completion:nil];
-    });
</del><ins>+    UNUSED_PARAM(screen);
+    _interface = adoptRef(new WebVideoFullscreenInterfaceAVKit);
+    _model = adoptRef(new WebVideoFullscreenModelMediaElement);
+    _model-&gt;setWebVideoFullscreenInterface(_interface.get());
+    _interface-&gt;setWebVideoFullscreenModel(_model.get());
+    _model-&gt;setMediaElement(_mediaElement.get());
+    _interface-&gt;enterFullscreen();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)exitFullscreen
</span><span class="cx"> {
</span><del>-    self.playerController.mediaElement = nullptr;
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [self.viewController dismissViewControllerAnimated:YES completion:^{
-            self.window.hidden = YES;
-            self.window.rootViewController = nil;
-            
-            self.playerViewController = nil;
-            self.viewController = nil;
-            self.window = nil;
-            WebThreadRun(^{
-                _mediaElement = nullptr;
-            });
-            
-        }];
</del><ins>+    __block RetainPtr&lt;WebVideoFullscreenController&gt; protect{self};
+    
+    _interface-&gt;exitFullscreen(^{
+        WebThreadRun(^{
+            _model-&gt;setMediaElement(nullptr);
+            _interface-&gt;setWebVideoFullscreenModel(nullptr);
+            _model-&gt;setWebVideoFullscreenInterface(nullptr);
+            _model = nullptr;
+            _interface = nullptr;
+            protect.clear();
+        });
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfacehfromrev163096trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKith"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h (from rev 163096, trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h) (0 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterface.h        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -0,0 +1,52 @@
</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 WebVideoFullscreenInterface_h
+#define WebVideoFullscreenInterface_h
+
+#if PLATFORM(IOS)
+
+#import &lt;WebCore/PlatformLayer.h&gt;
+
+namespace WebCore {
+    
+class WebVideoFullscreenInterface {
+public:
+    virtual ~WebVideoFullscreenInterface() { };
+    virtual void setDuration(double) = 0;
+    virtual void setCurrentTime(double currentTime, double anchorTime) = 0;
+    virtual void setRate(bool isPlaying, float playbackRate) = 0;
+    virtual void setVideoDimensions(bool hasVideo, float width, float height) = 0;
+    virtual void setVideoLayer(PlatformLayer*) = 0;
+    virtual void setVideoLayerID(uint32_t) = 0;
+    virtual void enterFullscreen() = 0;
+    virtual void exitFullscreen() = 0;
+};
+
+}
+
+#endif
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKith"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (0 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -0,0 +1,78 @@
</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 WebVideoFullscreenInterfaceAVKit_h
+#define WebVideoFullscreenInterfaceAVKit_h
+
+#if PLATFORM(IOS)
+
+#include &lt;WebCore/EventListener.h&gt;
+#include &lt;WebCore/HTMLMediaElement.h&gt;
+#include &lt;WebCore/PlatformLayer.h&gt;
+#include &lt;WebCore/WebVideoFullscreenInterface.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+
+OBJC_CLASS WebAVPlayerController;
+OBJC_CLASS AVPlayerViewController;
+OBJC_CLASS UIViewController;
+OBJC_CLASS UIWindow;
+
+namespace WebCore {
+class WebVideoFullscreenModel;
+    
+class WebVideoFullscreenInterfaceAVKit
+    : public WebVideoFullscreenInterface
+    , public RefCounted&lt;WebVideoFullscreenInterfaceAVKit&gt; {
+        
+    RetainPtr&lt;WebAVPlayerController&gt; m_playerController;
+    RetainPtr&lt;AVPlayerViewController&gt; m_playerViewController;
+    RetainPtr&lt;UIViewController&gt; m_viewController;
+    RetainPtr&lt;UIWindow&gt; m_window;
+    WebVideoFullscreenModel* m_videoFullscreenModel;
+    
+public:
+    WebVideoFullscreenInterfaceAVKit();
+    virtual ~WebVideoFullscreenInterfaceAVKit() { }
+    void setWebVideoFullscreenModel(WebVideoFullscreenModel*);
+    
+    void setDuration(double) override;
+    void setCurrentTime(double currentTime, double anchorTime) override;
+    void setRate(bool isPlaying, float playbackRate) override;
+    void setVideoDimensions(bool hasVideo, float width, float height) override;
+    void setVideoLayer(PlatformLayer*) override;
+    void setVideoLayerID(uint32_t videoContextID) override {UNUSED_PARAM(videoContextID);};
+    void enterFullscreen() override;
+    void enterFullscreen(std::function&lt;void()&gt; completion);
+    void exitFullscreen() override;
+    void exitFullscreen(std::function&lt;void()&gt; completion);
+};
+
+}
+
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenInterfaceAVKitmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (0 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -0,0 +1,329 @@
</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 &quot;config.h&quot;
+
+#if PLATFORM(IOS)
+
+#import &quot;WebVideoFullscreenInterfaceAVKit.h&quot;
+
+#import &quot;Logging.h&quot;
+#import &lt;CoreMedia/CMTime.h&gt;
+#import &lt;UIKit/UIKit.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;WebCore/WebCoreThreadRun.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+#import &quot;WebVideoFullscreenModel.h&quot;
+
+using namespace WebCore;
+
+SOFT_LINK_FRAMEWORK(AVFoundation)
+SOFT_LINK_CLASS(AVFoundation, AVPlayerLayer)
+
+SOFT_LINK_FRAMEWORK(AVKit)
+SOFT_LINK_CLASS(AVKit, AVPlayerController)
+SOFT_LINK_CLASS(AVKit, AVPlayerViewController)
+SOFT_LINK_CLASS(AVKit, AVValueTiming)
+
+SOFT_LINK_FRAMEWORK(UIKit)
+SOFT_LINK_CLASS(UIKit, UIScreen)
+SOFT_LINK_CLASS(UIKit, UIWindow)
+SOFT_LINK_CLASS(UIKit, UIView)
+SOFT_LINK_CLASS(UIKit, UIViewController)
+SOFT_LINK_CLASS(UIKit, UIColor)
+
+SOFT_LINK_FRAMEWORK(CoreMedia)
+SOFT_LINK(CoreMedia, CMTimeMakeWithSeconds, CMTime, (Float64 seconds, int32_t preferredTimeScale), (seconds, preferredTimeScale))
+SOFT_LINK(CoreMedia, CMTimeGetSeconds, Float64, (CMTime time), (time))
+
+@interface AVValueTiming : NSObject &lt;NSCoding, NSCopying, NSMutableCopying&gt;
++ (id)valueTimingWithAnchorValue:(double)anchorValue anchorTimeStamp:(NSTimeInterval) timeStamp rate:(double)rate;
++ (NSTimeInterval)currentTimeStamp;
+@end
+
+@protocol AVPlayerViewControllerDelegate
+@end
+
+@protocol AVPlayerLayer
+@end
+
+@interface AVPlayerController : UIResponder
+@end
+
+@interface AVPlayerViewController : UIViewController
+@property (nonatomic, weak) id &lt;AVPlayerViewControllerDelegate&gt; delegate;
+@property (nonatomic, strong) AVPlayerController *playerController;
+@end
+
+typedef NS_ENUM(NSInteger, AVPlayerViewControllerDismissalReason) {
+    AVPlayerViewControllerDismissalReasonDoneButtonTapped,
+    AVPlayerViewControllerDismissalReasonRemoteControlStopEventReceived,
+    AVPlayerViewControllerDismissalReasonError
+} NS_ENUM_AVAILABLE_IOS(8_0);
+
+typedef NS_ENUM(NSInteger, AVPlayerControllerStatus) {
+    AVPlayerControllerStatusUnknown,
+    AVPlayerControllerStatusLoading,
+    AVPlayerControllerStatusReadyToPlay,
+    AVPlayerControllerStatusFailed
+} NS_ENUM_AVAILABLE(10_10, 8_0);
+
+@interface WebAVPlayerController : NSObject &lt;AVPlayerViewControllerDelegate&gt;
+
+@property(retain) AVPlayerController* playerControllerProxy;
+@property(retain) CALayer&lt;AVPlayerLayer&gt; *playerLayer;
+@property(assign) WebVideoFullscreenModel* delegate;
+
+@property BOOL canPlay;
+@property(getter=isPlaying) BOOL playing;
+@property BOOL canPause;
+@property BOOL canTogglePlayback;
+@property double rate;
+@property BOOL canSeek;
+@property NSTimeInterval contentDuration;
+@property NSSize contentDimensions;
+@property BOOL hasEnabledAudio;
+@property BOOL hasEnabledVideo;
+@property NSTimeInterval minTime;
+@property NSTimeInterval maxTime;
+@property NSTimeInterval contentDurationWithinEndTimes;
+@property(retain) NSArray *loadedTimeRanges;
+@property AVPlayerControllerStatus status;
+@property(retain) AVValueTiming *timing;
+
+- (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldDismissWithReason:(AVPlayerViewControllerDismissalReason)reason;
+@end
+
+@implementation WebAVPlayerController
+
+- (instancetype)init
+{
+    if (!(self = [super init]))
+        return self;
+    
+    initAVPlayerController();
+    self.playerControllerProxy = [[classAVPlayerController alloc] init];
+    return self;
+}
+
+- (void)dealloc
+{
+    self.delegate = nil;
+    self.playerControllerProxy = nil;
+    self.playerLayer = nil;
+    self.loadedTimeRanges = nil;
+    self.timing = nil;
+    [super dealloc];
+}
+
+- (id)forwardingTargetForSelector:(SEL)selector
+{
+    UNUSED_PARAM(selector);
+    return self.playerControllerProxy;
+}
+
+- (BOOL)playerViewController:(AVPlayerViewController *)playerViewController shouldDismissWithReason:(AVPlayerViewControllerDismissalReason)reason
+{
+    UNUSED_PARAM(playerViewController);
+    UNUSED_PARAM(reason);
+    ASSERT(self.delegate);
+    self.delegate-&gt;requestExitFullScreen();
+    return NO;
+}
+
+- (void)play:(id)sender
+{
+    UNUSED_PARAM(sender);
+    ASSERT(self.delegate);
+    self.delegate-&gt;play();
+}
+
+- (void)pause:(id)sender
+{
+    UNUSED_PARAM(sender);
+    ASSERT(self.delegate);
+    self.delegate-&gt;pause();
+}
+
+- (void)togglePlayback:(id)sender
+{
+    UNUSED_PARAM(sender);
+    ASSERT(self.delegate);
+    self.delegate-&gt;togglePlayState();
+}
+
+- (BOOL)isPlaying
+{
+    return [self rate] != 0;
+}
+
+- (void)setPlaying:(BOOL)playing
+{
+    ASSERT(self.delegate);
+    if (playing)
+        self.delegate-&gt;play();
+    else
+        self.delegate-&gt;pause();
+    }
+
++ (NSSet *)keyPathsForValuesAffectingPlaying
+{
+    return [NSSet setWithObject:@&quot;rate&quot;];
+}
+
+- (void)seekToTime:(NSTimeInterval)time
+{
+    ASSERT(self.delegate);
+    self.delegate-&gt;seekToTime(time);
+}
+
+@end
+
+WebVideoFullscreenInterfaceAVKit::WebVideoFullscreenInterfaceAVKit()
+    : m_videoFullscreenModel(nullptr)
+{
+    initUIScreen();
+    initUIView();
+    initUIColor();
+    initUIWindow();
+    initAVPlayerController();
+    initAVPlayerViewController();
+    initAVValueTiming();
+    initUIViewController();
+    initAVPlayerLayer();
+    
+    m_playerController = adoptNS([[WebAVPlayerController alloc] init]);
+}
+
+void WebVideoFullscreenInterfaceAVKit::setWebVideoFullscreenModel(WebVideoFullscreenModel* model)
+{
+    m_videoFullscreenModel = model;
+    m_playerController.get().delegate = m_videoFullscreenModel;
+}
+
+void WebVideoFullscreenInterfaceAVKit::setDuration(double duration)
+{
+    WebAVPlayerController* playerController = m_playerController.get();
+    
+    // FIXME: https://bugs.webkit.org/show_bug.cgi?id=127017 use correct values instead of duration for all these
+    playerController.contentDuration = duration;
+    playerController.maxTime = duration;
+    playerController.contentDurationWithinEndTimes = duration;
+    playerController.loadedTimeRanges = @[@0, @(duration)];
+    
+    // FIXME: we take this as an indication that playback is ready.
+    playerController.canPlay = YES;
+    playerController.canPause = YES;
+    playerController.canTogglePlayback = YES;
+    playerController.hasEnabledAudio = YES;
+    playerController.canSeek = YES;
+    playerController.minTime = 0;
+    playerController.status = AVPlayerControllerStatusReadyToPlay;
+}
+
+void WebVideoFullscreenInterfaceAVKit::setCurrentTime(double currentTime, double anchorTime)
+{
+    NSTimeInterval anchorTimeStamp = ![m_playerController rate] ? NAN : anchorTime;
+    AVValueTiming *timing = [classAVValueTiming valueTimingWithAnchorValue:currentTime
+        anchorTimeStamp:anchorTimeStamp rate:0];
+    m_playerController.get().timing = timing;
+}
+
+void WebVideoFullscreenInterfaceAVKit::setRate(bool isPlaying, float playbackRate)
+{
+    m_playerController.get().rate = isPlaying ? playbackRate : 0.;
+}
+
+void WebVideoFullscreenInterfaceAVKit::setVideoDimensions(bool hasVideo, float width, float height)
+{
+    m_playerController.get().hasEnabledVideo = hasVideo;
+    m_playerController.get().contentDimensions = CGSizeMake(width, height);
+}
+
+void WebVideoFullscreenInterfaceAVKit::setVideoLayer(PlatformLayer* videoLayer)
+{
+    [m_playerController.get().playerLayer removeFromSuperlayer];
+    [videoLayer removeFromSuperlayer];
+    ASSERT([videoLayer isKindOfClass:[classAVPlayerLayer class]]
+        || ([videoLayer isKindOfClass:[CALayer class]] &amp;&amp; [videoLayer conformsToProtocol:@protocol(AVPlayerLayer)]));
+    m_playerController.get().playerLayer = (CALayer&lt;AVPlayerLayer&gt;*)videoLayer;
+}
+
+void WebVideoFullscreenInterfaceAVKit::enterFullscreen(std::function&lt;void()&gt; completion)
+{
+    __block RefPtr&lt;WebVideoFullscreenInterfaceAVKit&gt; protect(this);
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        m_playerViewController = [[[classAVPlayerViewController alloc] init] autorelease];
+        m_playerViewController.get().playerController = (AVPlayerController *)m_playerController.get();
+        
+        if ([m_playerViewController respondsToSelector:@selector(setDelegate:)])
+            m_playerViewController.get().delegate = m_playerController.get();
+        
+        m_viewController = adoptNS([[classUIViewController alloc] init]);
+        
+        m_window = [[[classUIWindow alloc] initWithFrame:[[classUIScreen mainScreen] bounds]] autorelease];
+        m_window.get().backgroundColor = [classUIColor clearColor];
+        m_window.get().rootViewController = m_viewController.get();
+        [m_window makeKeyAndVisible];
+        
+        [m_viewController presentViewController:m_playerViewController.get() animated:YES completion:nil];
+        completion();
+        protect.clear();
+    });
+}
+
+void WebVideoFullscreenInterfaceAVKit::enterFullscreen()
+{
+    enterFullscreen(^{ });
+}
+
+void WebVideoFullscreenInterfaceAVKit::exitFullscreen(std::function&lt;void()&gt; completion)
+{
+    m_playerController.clear();
+    __block RefPtr&lt;WebVideoFullscreenInterfaceAVKit&gt; protect(this);
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        [m_viewController dismissViewControllerAnimated:YES completion:^{
+            m_window.get().hidden = YES;
+            m_window.get().rootViewController = nil;
+            m_playerViewController = nil;
+            m_viewController = nil;
+            m_window = nil;
+            if (m_videoFullscreenModel)
+                m_videoFullscreenModel-&gt;didExitFullscreen();
+            completion();
+            protect.clear();
+        }];
+    });
+}
+
+void WebVideoFullscreenInterfaceAVKit::exitFullscreen()
+{
+    exitFullscreen(^{ });
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelhfromrev163096trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKith"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h (from rev 163096, trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h) (0 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModel.h        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -0,0 +1,49 @@
</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)
+
+namespace WebCore {
+
+class WebVideoFullscreenModel {
+public:
+    virtual ~WebVideoFullscreenModel() { };
+    virtual void requestExitFullScreen() = 0;
+    virtual void play() = 0;
+    virtual void pause() = 0;
+    virtual void togglePlayState() = 0;
+    virtual void seekToTime(double time) = 0;
+    virtual void didExitFullscreen() = 0;
+};
+
+}
+
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementhfromrev163096trunkSourceWebCoreplatformiosWebVideoFullscreenControllerAVKith"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h (from rev 163096, trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.h) (0 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.h        2014-01-30 19:50:03 UTC (rev 163097)
</span><span class="lines">@@ -0,0 +1,70 @@
</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 WebVideoFullscreenModelMediaElement_h
+#define WebVideoFullscreenModelMediaElement_h
+
+#if PLATFORM(IOS)
+
+#include &lt;WebCore/EventListener.h&gt;
+#include &lt;WebCore/PlatformLayer.h&gt;
+#include &lt;WebCore/WebVideoFullscreenModel.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+#include &lt;wtf/RetainPtr.h&gt;
+
+namespace WebCore {
+class HTMLMediaElement;
+class WebVideoFullscreenInterface;
+
+class WebVideoFullscreenModelMediaElement : public WebVideoFullscreenModel, public EventListener {
+    RefPtr&lt;HTMLMediaElement&gt; m_mediaElement;
+    RetainPtr&lt;PlatformLayer&gt; m_borrowedVideoLayer;
+    bool m_isListening;
+    WebVideoFullscreenInterface* m_videoFullscreenInterface;
+    
+public:
+    WebVideoFullscreenModelMediaElement();
+    virtual ~WebVideoFullscreenModelMediaElement() { }
+    void setWebVideoFullscreenInterface(WebVideoFullscreenInterface* interface) {m_videoFullscreenInterface = interface;}
+    void setMediaElement(HTMLMediaElement*);
+    
+    void handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) override;
+    bool operator==(const EventListener&amp; rhs) override
+        {return static_cast&lt;WebCore::EventListener*&gt;(this) == &amp;rhs;}
+
+    void requestExitFullScreen() override;
+    void play() override;
+    void pause() override;
+    void togglePlayState() override;
+    void seekToTime(double time) override;
+    void didExitFullscreen();
+};
+
+}
+
+#endif
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformiosWebVideoFullscreenModelMediaElementmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm (0 => 163097)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm                                (rev 0)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenModelMediaElement.mm        2014-01-30 19:50:03 UTC (rev 163097)
</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. ``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 &quot;config.h&quot;
+
+#if PLATFORM(IOS)
+
+#import &quot;WebVideoFullscreenModelMediaElement.h&quot;
+
+#import &quot;DOMEventInternal.h&quot;
+#import &quot;Logging.h&quot;
+#import &quot;WebVideoFullscreenInterface.h&quot;
+#import &lt;WebCore/DOMEventListener.h&gt;
+#import &lt;WebCore/Event.h&gt;
+#import &lt;WebCore/EventListener.h&gt;
+#import &lt;WebCore/EventNames.h&gt;
+#import &lt;WebCore/HTMLElement.h&gt;
+#import &lt;WebCore/HTMLVideoElement.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;WebCore/WebCoreThreadRun.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+using namespace WebCore;
+
+WebVideoFullscreenModelMediaElement::WebVideoFullscreenModelMediaElement()
+    : EventListener(EventListener::CPPEventListenerType)
+    , m_isListening{false}
+{
+}
+
+void WebVideoFullscreenModelMediaElement::setMediaElement(HTMLMediaElement* mediaElement)
+{
+    if (m_mediaElement == mediaElement)
+        return;
+
+    if (m_mediaElement &amp;&amp; m_isListening) {
+        m_mediaElement-&gt;removeEventListener(eventNames().durationchangeEvent, this, false);
+        m_mediaElement-&gt;removeEventListener(eventNames().pauseEvent, this, false);
+        m_mediaElement-&gt;removeEventListener(eventNames().playEvent, this, false);
+        m_mediaElement-&gt;removeEventListener(eventNames().ratechangeEvent, this, false);
+        m_mediaElement-&gt;removeEventListener(eventNames().timeupdateEvent, this, false);
+    }
+    m_isListening = false;
+
+    if (m_mediaElement &amp;&amp; m_borrowedVideoLayer) {
+        if (m_videoFullscreenInterface)
+            m_videoFullscreenInterface-&gt;setVideoLayer(nullptr);
+        m_mediaElement-&gt;returnPlatformLayer(m_borrowedVideoLayer.get());
+        m_borrowedVideoLayer.clear();
+    }
+
+    m_mediaElement = mediaElement;
+
+    if (!m_mediaElement)
+        return;
+
+    m_mediaElement-&gt;addEventListener(eventNames().durationchangeEvent, this, false);
+    m_mediaElement-&gt;addEventListener(eventNames().pauseEvent, this, false);
+    m_mediaElement-&gt;addEventListener(eventNames().playEvent, this, false);
+    m_mediaElement-&gt;addEventListener(eventNames().ratechangeEvent, this, false);
+    m_mediaElement-&gt;addEventListener(eventNames().timeupdateEvent, this, false);
+    m_isListening = true;
+
+    if (!m_videoFullscreenInterface)
+        return;
+
+    m_videoFullscreenInterface-&gt;setDuration(m_mediaElement-&gt;duration());
+    m_videoFullscreenInterface-&gt;setRate(m_mediaElement-&gt;isPlaying(), m_mediaElement-&gt;playbackRate());
+
+    m_borrowedVideoLayer = m_mediaElement-&gt;borrowPlatformLayer();
+    m_videoFullscreenInterface-&gt;setVideoLayer(m_borrowedVideoLayer.get());
+
+    m_videoFullscreenInterface-&gt;setCurrentTime(m_mediaElement-&gt;currentTime(), [[NSProcessInfo processInfo] systemUptime]);
+
+    if (isHTMLVideoElement(m_mediaElement.get())) {
+        HTMLVideoElement *videoElement = toHTMLVideoElement(m_mediaElement.get());
+        m_videoFullscreenInterface-&gt;setVideoDimensions(true, videoElement-&gt;videoWidth(), videoElement-&gt;videoHeight());
+    }
+}
+
+void WebVideoFullscreenModelMediaElement::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event* event)
+{
+    if (!m_mediaElement)
+        return;
+
+    LOG(Media, &quot;handleEvent %s&quot;, event-&gt;type().characters8());
+    
+    if (event-&gt;type() == eventNames().durationchangeEvent)
+        m_videoFullscreenInterface-&gt;setDuration(m_mediaElement-&gt;duration());
+    else if (event-&gt;type() == eventNames().pauseEvent
+        || event-&gt;type() == eventNames().playEvent
+        || event-&gt;type() == eventNames().ratechangeEvent)
+        m_videoFullscreenInterface-&gt;setRate(m_mediaElement-&gt;isPlaying(), m_mediaElement-&gt;playbackRate());
+    else if (event-&gt;type() == eventNames().timeupdateEvent)
+        m_videoFullscreenInterface-&gt;setCurrentTime(m_mediaElement-&gt;currentTime(), [[NSProcessInfo processInfo] systemUptime]);
+}
+
+void WebVideoFullscreenModelMediaElement::requestExitFullScreen()
+{
+    __block RefPtr&lt;WebVideoFullscreenModelMediaElement&gt; protect(this);
+    WebThreadRun(^{
+        m_mediaElement-&gt;pause();
+        m_mediaElement-&gt;exitFullscreen();
+        protect.clear();
+    });
+}
+
+void WebVideoFullscreenModelMediaElement::play() {
+    __block RefPtr&lt;WebVideoFullscreenModelMediaElement&gt; protect(this);
+    WebThreadRun(^{
+        m_mediaElement-&gt;play();
+        protect.clear();
+    });
+}
+
+void WebVideoFullscreenModelMediaElement::pause()
+{
+    __block RefPtr&lt;WebVideoFullscreenModelMediaElement&gt; protect(this);
+    WebThreadRun(^{
+        m_mediaElement-&gt;pause();
+        protect.clear();
+    });
+}
+
+void WebVideoFullscreenModelMediaElement::togglePlayState()
+{
+    __block RefPtr&lt;WebVideoFullscreenModelMediaElement&gt; protect(this);
+    WebThreadRun(^{
+        m_mediaElement-&gt;togglePlayState();
+        protect.clear();
+    });
+}
+
+void WebVideoFullscreenModelMediaElement::seekToTime(double time)
+{
+    __block RefPtr&lt;WebVideoFullscreenModelMediaElement&gt; protect(this);
+    WebThreadRun(^{
+        m_mediaElement-&gt;setCurrentTime(time);
+        protect.clear();
+    });
+}
+
+void WebVideoFullscreenModelMediaElement::didExitFullscreen()
+{
+    __block RefPtr&lt;WebVideoFullscreenModelMediaElement&gt; protect(this);
+    WebThreadRun(^{
+        setMediaElement(nullptr);
+        protect.clear();
+    });
+}
+
+#endif
</ins></span></pre>
</div>
</div>

</body>
</html>