<!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>[201530] trunk</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/201530">201530</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2016-05-31 14:59:03 -0700 (Tue, 31 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>REGRESSION (<a href="http://trac.webkit.org/projects/webkit/changeset/201405">r201405</a>): trailers.apple.com HUD is missing in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=158156
&lt;rdar://problem/26519589&gt;

Reviewed by Darin Adler.

Source/WebKit2:

Only increase the frame of the webView (to account for top content inset) in one dimension.

* UIProcess/mac/WKFullScreenWindowController.mm:
(-[WKFullScreenWindowController enterFullScreen:]):

Tools:

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html: Added.
* TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm: Added.
(-[FullscreenChangeMessageHandler userContentController:didReceiveScriptMessage:]):
(TestWebKitAPI::TEST):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKFullScreenWindowControllermm">trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaFullscreenTopContentInsethtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2CocoaFullscreenTopContentInsetmm">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201529 => 201530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-05-31 21:57:39 UTC (rev 201529)
+++ trunk/Source/WebKit2/ChangeLog        2016-05-31 21:59:03 UTC (rev 201530)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-05-31  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        REGRESSION (r201405): trailers.apple.com HUD is missing in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=158156
+        &lt;rdar://problem/26519589&gt;
+
+        Reviewed by Darin Adler.
+
+        Only increase the frame of the webView (to account for top content inset) in one dimension.
+
+        * UIProcess/mac/WKFullScreenWindowController.mm:
+        (-[WKFullScreenWindowController enterFullScreen:]):
+
</ins><span class="cx"> 2016-05-31  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Better deal with WebProcess suspension due to screen locking
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKFullScreenWindowControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (201529 => 201530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm        2016-05-31 21:57:39 UTC (rev 201529)
+++ trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm        2016-05-31 21:59:03 UTC (rev 201530)
</span><span class="lines">@@ -240,7 +240,9 @@
</span><span class="cx">     // Then insert the WebView into the full screen window
</span><span class="cx">     NSView *contentView = [[self window] contentView];
</span><span class="cx">     [_clipView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
</span><del>-    _webView.frame = NSInsetRect(contentView.bounds, 0, -_page-&gt;topContentInset());
</del><ins>+    NSRect contentViewBounds = contentView.bounds;
+    contentViewBounds.size.height += _page-&gt;topContentInset();
+    _webView.frame = contentViewBounds;
</ins><span class="cx"> 
</span><span class="cx">     makeResponderFirstResponderIfDescendantOfView(self.window, webWindowFirstResponder, _webView);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (201529 => 201530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-05-31 21:57:39 UTC (rev 201529)
+++ trunk/Tools/ChangeLog        2016-05-31 21:59:03 UTC (rev 201530)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-05-31  Jer Noble  &lt;jer.noble@apple.com&gt;
+
+        REGRESSION (r201405): trailers.apple.com HUD is missing in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=158156
+        &lt;rdar://problem/26519589&gt;
+
+        Reviewed by Darin Adler.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html: Added.
+        * TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm: Added.
+        (-[FullscreenChangeMessageHandler userContentController:didReceiveScriptMessage:]):
+        (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2016-05-31  Jon Lee  &lt;jonlee@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed: add myself to the reviewers list.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (201529 => 201530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-31 21:57:39 UTC (rev 201529)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-31 21:59:03 UTC (rev 201530)
</span><span class="lines">@@ -365,6 +365,8 @@
</span><span class="cx">                 CDC8E4951BC6F10800594FEC /* video-with-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */; };
</span><span class="cx">                 CDC8E4961BC6F10800594FEC /* video-without-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48B1BC5C96200594FEC /* video-without-audio.html */; };
</span><span class="cx">                 CDC8E4971BC6F10800594FEC /* video-without-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48C1BC5C96200594FEC /* video-without-audio.mp4 */; };
</span><ins>+                CDE195B41CFE0ADE0053D256 /* FullscreenTopContentInset.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */; };
+                CDE195B51CFE0B880053D256 /* FullscreenTopContentInset.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */; };
</ins><span class="cx">                 CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */; };
</span><span class="cx">                 CE3524F81B1431F60028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F21B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp */; };
</span><span class="cx">                 CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */; };
</span><span class="lines">@@ -429,6 +431,7 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */,
</span><span class="cx">                                 51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */,
</span><ins>+                                CDE195B51CFE0B880053D256 /* FullscreenTopContentInset.html in Copy Resources */,
</ins><span class="cx">                                 93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */,
</span><span class="cx">                                 93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */,
</span><span class="cx">                                 936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */,
</span><span class="lines">@@ -906,6 +909,8 @@
</span><span class="cx">                 CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = &quot;video-with-audio.mp4&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDC8E48B1BC5C96200594FEC /* video-without-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;video-without-audio.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CDC8E48C1BC5C96200594FEC /* video-without-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = &quot;video-without-audio.mp4&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenTopContentInset.html; sourceTree = &quot;&lt;group&gt;&quot;; };
+                CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenTopContentInset.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = WillPerformClientRedirectToURLCrash.html; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WillPerformClientRedirectToURLCrash.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextFieldDidBeginAndEndEditing.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -1064,6 +1069,7 @@
</span><span class="cx">                                 A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
</span><span class="cx">                                 2D8104CB1BEC13E70020DA46 /* FindInPage.mm */,
</span><span class="cx">                                 2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */,
</span><ins>+                                CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */,
</ins><span class="cx">                                 51BCEE491C84F4AF0042C82E /* IndexedDBMultiProcess.mm */,
</span><span class="cx">                                 51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */,
</span><span class="cx">                                 37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
</span><span class="lines">@@ -1162,6 +1168,7 @@
</span><span class="cx">                 A16F66B81C40E9E100BD4D24 /* Resources */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */,
</ins><span class="cx">                                 A16F66B91C40EA2000BD4D24 /* ContentFiltering.html */,
</span><span class="cx">                                 5714ECB81CA8B58800051AC8 /* DownloadRequestOriginalURL.html */,
</span><span class="cx">                                 5714ECBC1CA8C21800051AC8 /* DownloadRequestOriginalURL2.html */,
</span><span class="lines">@@ -2019,6 +2026,7 @@
</span><span class="cx">                                 1CB9BC381A67482300FE5678 /* WeakPtr.cpp in Sources */,
</span><span class="cx">                                 2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */,
</span><span class="cx">                                 2D8104CC1BEC13E70020DA46 /* FindInPage.mm in Sources */,
</span><ins>+                                CDE195B41CFE0ADE0053D256 /* FullscreenTopContentInset.mm in Sources */,
</ins><span class="cx">                                 93E943F21CD3E87E00AC08C2 /* VideoControlsManager.mm in Sources */,
</span><span class="cx">                                 5798E2B01CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm in Sources */,
</span><span class="cx">                                 CD225C081C45A69200140761 /* ParsedContentRange.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaFullscreenTopContentInsethtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html (0 => 201530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html        2016-05-31 21:59:03 UTC (rev 201530)
</span><span class="lines">@@ -0,0 +1,31 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script&gt;
+        function load() {
+            window.webkit.messageHandlers.fullscreenChangeHandler.postMessage('load');
+        }
+        document.addEventListener('webkitfullscreenchange', function(event) {
+            window.webkit.messageHandlers.fullscreenChangeHandler.postMessage('fullscreenchange');
+        });
+        document.addEventListener('mousedown', function(event) {
+            // Toggle fullscreen
+            var target = document.getElementById('target');
+            if (document.webkitFullscreenElement == target)
+                document.webkitExitFullscreen();
+            else
+                target.webkitRequestFullScreen();
+        });
+    &lt;/script&gt;
+    &lt;style&gt;
+    #target {
+        background-color: red;
+        width: 150px;
+        height: 150px;
+    }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;load()&quot;&gt;
+    &lt;div id=&quot;target&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2CocoaFullscreenTopContentInsetmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm (0 => 201530)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm        2016-05-31 21:59:03 UTC (rev 201530)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2016 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.
+ */
+
+#include &quot;config.h&quot;
+
+#import &quot;PlatformUtilities.h&quot;
+#import &lt;WebKit/WKPreferencesPrivate.h&gt;
+#import &lt;WebKit/WKWebViewConfigurationPrivate.h&gt;
+#import &lt;WebKit/WKWebViewPrivate.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+static bool receivedLoadedMessage;
+static bool receivedFullscreenChangeMessage;
+
+@interface FullscreenChangeMessageHandler : NSObject &lt;WKScriptMessageHandler&gt;
+@end
+
+@implementation FullscreenChangeMessageHandler
+- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
+{
+    NSString *bodyString = (NSString *)[message body];
+    if ([bodyString isEqualToString:@&quot;fullscreenchange&quot;])
+        receivedFullscreenChangeMessage = true;
+    else if ([bodyString isEqualToString:@&quot;load&quot;])
+        receivedLoadedMessage = true;
+}
+@end
+
+namespace TestWebKitAPI {
+
+TEST(Fullscreen, TopContentInset)
+{
+    RetainPtr&lt;WKWebViewConfiguration&gt; configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    RetainPtr&lt;WKWebView&gt; webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+    [webView _setTopContentInset:10];
+    [configuration preferences]._fullScreenEnabled = YES;
+    RetainPtr&lt;FullscreenChangeMessageHandler&gt; handler = adoptNS([[FullscreenChangeMessageHandler alloc] init]);
+    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@&quot;fullscreenChangeHandler&quot;];
+
+    RetainPtr&lt;NSWindow&gt; window = adoptNS([[NSWindow alloc] initWithContentRect:[webView frame] styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]);
+    [[window contentView] addSubview:webView.get()];
+
+    NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@&quot;FullscreenTopContentInset&quot; withExtension:@&quot;html&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;]];
+    [webView loadRequest:request];
+    TestWebKitAPI::Util::run(&amp;receivedLoadedMessage);
+
+    NSEvent *event = [NSEvent mouseEventWithType:NSLeftMouseDown location:NSMakePoint(5, 5) modifierFlags:0 timestamp:0 windowNumber:window.get().windowNumber context:0 eventNumber:0 clickCount:0 pressure:0];
+    [webView mouseDown:event];
+
+    TestWebKitAPI::Util::run(&amp;receivedFullscreenChangeMessage);
+    ASSERT_EQ(window.get().screen.frame.size.width, webView.get().frame.size.width);
+    ASSERT_EQ(window.get().screen.frame.size.height + webView.get()._topContentInset, webView.get().frame.size.height);
+}
+
+} // namespace TestWebKitAPI
</ins></span></pre>
</div>
</div>

</body>
</html>