Title: [201530] trunk
Revision
201530
Author
jer.no...@apple.com
Date
2016-05-31 14:59:03 -0700 (Tue, 31 May 2016)

Log Message

REGRESSION (r201405): trailers.apple.com HUD is missing in fullscreen
https://bugs.webkit.org/show_bug.cgi?id=158156
<rdar://problem/26519589>

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):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (201529 => 201530)


--- 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)
@@ -1,3 +1,16 @@
+2016-05-31  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION (r201405): trailers.apple.com HUD is missing in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=158156
+        <rdar://problem/26519589>
+
+        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:]):
+
 2016-05-31  Chris Dumez  <cdu...@apple.com>
 
         [iOS] Better deal with WebProcess suspension due to screen locking

Modified: trunk/Source/WebKit2/UIProcess/mac/WKFullScreenWindowController.mm (201529 => 201530)


--- 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)
@@ -240,7 +240,9 @@
     // Then insert the WebView into the full screen window
     NSView *contentView = [[self window] contentView];
     [_clipView addSubview:_webView positioned:NSWindowBelow relativeTo:nil];
-    _webView.frame = NSInsetRect(contentView.bounds, 0, -_page->topContentInset());
+    NSRect contentViewBounds = contentView.bounds;
+    contentViewBounds.size.height += _page->topContentInset();
+    _webView.frame = contentViewBounds;
 
     makeResponderFirstResponderIfDescendantOfView(self.window, webWindowFirstResponder, _webView);
 

Modified: trunk/Tools/ChangeLog (201529 => 201530)


--- trunk/Tools/ChangeLog	2016-05-31 21:57:39 UTC (rev 201529)
+++ trunk/Tools/ChangeLog	2016-05-31 21:59:03 UTC (rev 201530)
@@ -1,3 +1,17 @@
+2016-05-31  Jer Noble  <jer.no...@apple.com>
+
+        REGRESSION (r201405): trailers.apple.com HUD is missing in fullscreen
+        https://bugs.webkit.org/show_bug.cgi?id=158156
+        <rdar://problem/26519589>
+
+        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):
+
 2016-05-31  Jon Lee  <jon...@apple.com>
 
         Unreviewed: add myself to the reviewers list.

Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (201529 => 201530)


--- 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)
@@ -365,6 +365,8 @@
 		CDC8E4951BC6F10800594FEC /* video-with-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */; };
 		CDC8E4961BC6F10800594FEC /* video-without-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48B1BC5C96200594FEC /* video-without-audio.html */; };
 		CDC8E4971BC6F10800594FEC /* video-without-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDC8E48C1BC5C96200594FEC /* video-without-audio.mp4 */; };
+		CDE195B41CFE0ADE0053D256 /* FullscreenTopContentInset.mm in Sources */ = {isa = PBXBuildFile; fileRef = CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */; };
+		CDE195B51CFE0B880053D256 /* FullscreenTopContentInset.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */; };
 		CE14F1A4181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */; };
 		CE3524F81B1431F60028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F21B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp */; };
 		CE3524F91B1441C40028A7C5 /* TextFieldDidBeginAndEndEditing.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */; };
@@ -429,6 +431,7 @@
 			files = (
 				51714EB41CF8C78C004723C4 /* WebProcessKillIDBCleanup-1.html in Copy Resources */,
 				51714EB51CF8C78C004723C4 /* WebProcessKillIDBCleanup-2.html in Copy Resources */,
+				CDE195B51CFE0B880053D256 /* FullscreenTopContentInset.html in Copy Resources */,
 				93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */,
 				93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */,
 				936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */,
@@ -906,6 +909,8 @@
 		CDC8E48A1BC5C96200594FEC /* video-with-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "video-with-audio.mp4"; sourceTree = "<group>"; };
 		CDC8E48B1BC5C96200594FEC /* video-without-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "video-without-audio.html"; sourceTree = "<group>"; };
 		CDC8E48C1BC5C96200594FEC /* video-without-audio.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "video-without-audio.mp4"; sourceTree = "<group>"; };
+		CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = FullscreenTopContentInset.html; sourceTree = "<group>"; };
+		CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = FullscreenTopContentInset.mm; sourceTree = "<group>"; };
 		CE14F1A2181873B0001C2705 /* WillPerformClientRedirectToURLCrash.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = WillPerformClientRedirectToURLCrash.html; sourceTree = "<group>"; };
 		CE32C7C718184C4900CD8C28 /* WillPerformClientRedirectToURLCrash.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WillPerformClientRedirectToURLCrash.mm; sourceTree = "<group>"; };
 		CE3524F11B142B8D0028A7C5 /* TextFieldDidBeginAndEndEditing.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextFieldDidBeginAndEndEditing.cpp; sourceTree = "<group>"; };
@@ -1064,6 +1069,7 @@
 				A1A4FE5D18DD3DB700B5EA8A /* Download.mm */,
 				2D8104CB1BEC13E70020DA46 /* FindInPage.mm */,
 				2D1FE0AF1AD465C1006CD9E6 /* FixedLayoutSize.mm */,
+				CDE195B31CFE0ADE0053D256 /* FullscreenTopContentInset.mm */,
 				51BCEE491C84F4AF0042C82E /* IndexedDBMultiProcess.mm */,
 				51B1EE8D1C80F5880064FB98 /* IndexedDBPersistence.mm */,
 				37D36ED61AF42ECD00BAF5D9 /* LoadAlternateHTMLString.mm */,
@@ -1162,6 +1168,7 @@
 		A16F66B81C40E9E100BD4D24 /* Resources */ = {
 			isa = PBXGroup;
 			children = (
+				CDE195B21CFE0ADE0053D256 /* FullscreenTopContentInset.html */,
 				A16F66B91C40EA2000BD4D24 /* ContentFiltering.html */,
 				5714ECB81CA8B58800051AC8 /* DownloadRequestOriginalURL.html */,
 				5714ECBC1CA8C21800051AC8 /* DownloadRequestOriginalURL2.html */,
@@ -2019,6 +2026,7 @@
 				1CB9BC381A67482300FE5678 /* WeakPtr.cpp in Sources */,
 				2E7765CD16C4D80A00BA2BB1 /* mainIOS.mm in Sources */,
 				2D8104CC1BEC13E70020DA46 /* FindInPage.mm in Sources */,
+				CDE195B41CFE0ADE0053D256 /* FullscreenTopContentInset.mm in Sources */,
 				93E943F21CD3E87E00AC08C2 /* VideoControlsManager.mm in Sources */,
 				5798E2B01CAF5C2800C5CBA0 /* ProvisionalURLNotChange.mm in Sources */,
 				CD225C081C45A69200140761 /* ParsedContentRange.cpp in Sources */,

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.html (0 => 201530)


--- 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)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <script>
+        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();
+        });
+    </script>
+    <style>
+    #target {
+        background-color: red;
+        width: 150px;
+        height: 150px;
+    }
+    </style>
+</head>
+<body _onload_="load()">
+    <div id="target"></div>
+</body>
+</html>
\ No newline at end of file

Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FullscreenTopContentInset.mm (0 => 201530)


--- 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)
@@ -0,0 +1,77 @@
+/*
+ * 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 "config.h"
+
+#import "PlatformUtilities.h"
+#import <WebKit/WKPreferencesPrivate.h>
+#import <WebKit/WKWebViewConfigurationPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+static bool receivedLoadedMessage;
+static bool receivedFullscreenChangeMessage;
+
+@interface FullscreenChangeMessageHandler : NSObject <WKScriptMessageHandler>
+@end
+
+@implementation FullscreenChangeMessageHandler
+- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message
+{
+    NSString *bodyString = (NSString *)[message body];
+    if ([bodyString isEqualToString:@"fullscreenchange"])
+        receivedFullscreenChangeMessage = true;
+    else if ([bodyString isEqualToString:@"load"])
+        receivedLoadedMessage = true;
+}
+@end
+
+namespace TestWebKitAPI {
+
+TEST(Fullscreen, TopContentInset)
+{
+    RetainPtr<WKWebViewConfiguration> configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
+    RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100) configuration:configuration.get()]);
+    [webView _setTopContentInset:10];
+    [configuration preferences]._fullScreenEnabled = YES;
+    RetainPtr<FullscreenChangeMessageHandler> handler = adoptNS([[FullscreenChangeMessageHandler alloc] init]);
+    [[configuration userContentController] addScriptMessageHandler:handler.get() name:@"fullscreenChangeHandler"];
+
+    RetainPtr<NSWindow> 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:@"FullscreenTopContentInset" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+    [webView loadRequest:request];
+    TestWebKitAPI::Util::run(&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(&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
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to