Changeset 219378 in webkit
- Timestamp:
- Jul 11, 2017 5:25:41 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r219374 r219378 1 2017-07-11 Ansh Shukla <ansh_shukla@apple.com> 2 3 WKWindowFeatures needs to expose scrollbar, fullscreen, and dialog configuration properties 4 https://bugs.webkit.org/show_bug.cgi?id=174239 5 6 Reviewed by Brady Eidson. 7 8 Add a new private header to expose getters for window feature properties already available 9 in the TFB APIWindowFeatures class. These properties are necessary for Safari to adopt more 10 modern API. 11 12 * UIProcess/API/Cocoa/WKWindowFeatures.mm: 13 (-[WKWindowFeatures _locationBarVisibility]): 14 (-[WKWindowFeatures _scrollbarsVisibility]): 15 (-[WKWindowFeatures _fullscreenDisplay]): 16 (-[WKWindowFeatures _dialogDisplay]): 17 * UIProcess/API/Cocoa/WKWindowFeaturesInternal.h: Expose some window features as read-only 18 properties. 19 * UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h: 20 * WebKit2.xcodeproj/project.pbxproj: 21 1 22 2017-07-11 Chris Dumez <cdumez@apple.com> 2 23 -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeatures.mm
r188553 r219378 102 102 @end 103 103 104 @implementation WKWindowFeatures (WKPrivate) 105 106 - (NSNumber *)_locationBarVisibility 107 { 108 return @(_windowFeatures->windowFeatures().locationBarVisible); 109 } 110 111 - (NSNumber *)_scrollbarsVisibility 112 { 113 return @(_windowFeatures->windowFeatures().scrollbarsVisible); 114 } 115 116 - (NSNumber *)_fullscreenDisplay 117 { 118 return @(_windowFeatures->windowFeatures().fullscreen); 119 } 120 121 - (NSNumber *)_dialogDisplay 122 { 123 return @(_windowFeatures->windowFeatures().dialog); 124 } 125 126 @end 127 104 128 #endif -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesInternal.h
r188553 r219378 24 24 */ 25 25 26 #import "WKWindowFeatures .h"26 #import "WKWindowFeaturesPrivate.h" 27 27 28 28 #if WK_API_ENABLED -
trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWindowFeaturesPrivate.h
r219376 r219378 1 1 /* 2 * Copyright (C) 201 4Apple Inc. All rights reserved.2 * Copyright (C) 2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import "WKWindowFeatures.h"26 #import <WebKit/WKWindowFeatures.h> 27 27 28 28 #if WK_API_ENABLED 29 29 30 #import "APIWindowFeatures.h" 31 #import "WKObject.h" 30 NS_ASSUME_NONNULL_BEGIN 32 31 33 namespace WebKit { 32 @interface WKWindowFeatures (WKPrivate) 34 33 35 inline WKWindowFeatures *wrapper(API::WindowFeatures& windowFeatures) 36 { 37 ASSERT([windowFeatures.wrapper() isKindOfClass:[WKWindowFeatures class]]); 34 @property (nullable, nonatomic, readonly) NSNumber *_locationBarVisibility WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 35 @property (nullable, nonatomic, readonly) NSNumber *_scrollbarsVisibility WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 36 @property (nullable, nonatomic, readonly) NSNumber *_fullscreenDisplay WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 37 @property (nullable, nonatomic, readonly) NSNumber *_dialogDisplay WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 38 38 39 return (WKWindowFeatures *)windowFeatures.wrapper();40 }41 42 }43 @interface WKWindowFeatures () <WKObject> {44 @package45 API::ObjectStorage<API::WindowFeatures> _windowFeatures;46 }47 39 @end 48 40 41 NS_ASSUME_NONNULL_END 42 49 43 #endif -
trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
r219312 r219378 1190 1190 659C551E130006410025C0C2 /* InjectedBundlePageResourceLoadClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6546A82913000164000CEB1C /* InjectedBundlePageResourceLoadClient.cpp */; }; 1191 1191 65B86F1E12F11DE300B7DD8A /* WKBundleInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1192 6A5080BF1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1192 1193 6B821DDC1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h in Headers */ = {isa = PBXBuildFile; fileRef = 6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */; }; 1193 1194 6B821DDD1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */; }; … … 3473 3474 65B86F1712F11D7B00B7DD8A /* WKBundleInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKBundleInspector.cpp; sourceTree = "<group>"; }; 3474 3475 65B86F1812F11D7B00B7DD8A /* WKBundleInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKBundleInspector.h; sourceTree = "<group>"; }; 3476 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WKWindowFeaturesPrivate.h; sourceTree = "<group>"; }; 3475 3477 6B821DDA1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebResourceLoadStatisticsTelemetry.h; sourceTree = "<group>"; }; 3476 3478 6B821DDB1EEF05DD00D7AF4A /* WebResourceLoadStatisticsTelemetry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebResourceLoadStatisticsTelemetry.cpp; sourceTree = "<group>"; }; … … 5741 5743 26F9A83A18A3463F00AEB88A /* WKWebViewPrivate.h */, 5742 5744 1AD60F5C18E20F4C0020C034 /* WKWindowFeatures.h */, 5745 6A5080BE1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h */, 5743 5746 1AD60F5B18E20F4C0020C034 /* WKWindowFeatures.mm */, 5744 5747 1AD60F5F18E20F740020C034 /* WKWindowFeaturesInternal.h */, … … 8766 8769 31D5929F166E060000E6BF02 /* WebPlugInClient.h in Headers */, 8767 8770 BC5744F012638FB3006F0F12 /* WebPopupItem.h in Headers */, 8771 6A5080BF1F0EDAAA00E617C5 /* WKWindowFeaturesPrivate.h in Headers */, 8768 8772 D3B9484711FF4B6500032B39 /* WebPopupMenu.h in Headers */, 8769 8773 BC574E631267D080006F0F12 /* WebPopupMenuProxy.h in Headers */, -
trunk/Tools/ChangeLog
r219376 r219378 1 2017-07-11 Ansh Shukla <ansh_shukla@apple.com> 2 3 WKWindowFeatures needs to expose scrollbar, fullscreen, and dialog configuration properties 4 https://bugs.webkit.org/show_bug.cgi?id=174239 5 6 Reviewed by Brady Eidson. 7 8 Create windows with specific features set and make sure those are properly reflected in the 9 WKWindowFeatures object. 10 11 * TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm: 12 (resetToConsistentState): 13 (-[CheckWindowFeaturesUIDelegate webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:]): 14 (TEST): 15 1 16 2017-07-11 Jonathan Bedard <jbedard@apple.com> 2 17 -
trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/OpenAndCloseWindow.mm
r215598 r219378 31 31 #import <WebKit/WKWebView.h> 32 32 #import <WebKit/WKWebViewConfiguration.h> 33 #import <WebKit/WKWindowFeaturesPrivate.h> 33 34 #import <wtf/RetainPtr.h> 34 35 … … 37 38 @class OpenAndCloseWindowUIDelegate; 38 39 @class OpenAndCloseWindowUIDelegateAsync; 40 @class CheckWindowFeaturesUIDelegate; 39 41 40 42 static bool isDone; 41 43 static RetainPtr<WKWebView> openedWebView; 44 static RetainPtr<WKWindowFeatures> openWindowFeatures; 42 45 static RetainPtr<OpenAndCloseWindowUIDelegate> sharedUIDelegate; 43 46 static RetainPtr<OpenAndCloseWindowUIDelegateAsync> sharedUIDelegateAsync; 47 static RetainPtr<CheckWindowFeaturesUIDelegate> sharedCheckWindowFeaturesUIDelegate; 44 48 45 49 static void resetToConsistentState() … … 49 53 sharedUIDelegate = nil; 50 54 sharedUIDelegateAsync = nil; 55 sharedCheckWindowFeaturesUIDelegate = nil; 51 56 } 52 57 … … 203 208 //} 204 209 210 211 @interface CheckWindowFeaturesUIDelegate : NSObject <WKUIDelegate> 212 213 @property (nullable, nonatomic, readonly) NSNumber *menuBarVisibility; 214 @property (nullable, nonatomic, readonly) NSNumber *statusBarVisibility; 215 @property (nullable, nonatomic, readonly) NSNumber *toolbarsVisibility; 216 217 @end 218 219 @implementation CheckWindowFeaturesUIDelegate 220 221 - (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures 222 { 223 openWindowFeatures = windowFeatures; 224 isDone = true; 225 226 return nil; 227 } 228 229 @end 230 231 TEST(WebKit2, OpenWindowFeatures) 232 { 233 resetToConsistentState(); 234 235 auto webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]); 236 237 sharedCheckWindowFeaturesUIDelegate = adoptNS([[CheckWindowFeaturesUIDelegate alloc] init]); 238 [webView setUIDelegate:sharedCheckWindowFeaturesUIDelegate.get()]; 239 [webView configuration].preferences.javaScriptCanOpenWindowsAutomatically = YES; 240 NSString *windowOpenFormatString = @"window.open(\"about:blank\", \"_blank\", \"%@\")"; 241 242 [webView evaluateJavaScript:@"window.open(\"about:blank\")" completionHandler:nil]; 243 TestWebKitAPI::Util::run(&isDone); 244 isDone = false; 245 246 // https://bugs.webkit.org/show_bug.cgi?id=174271 - WebCore currently doesn't distinguish between unspecified (nil) and false 247 // for the following window features. 248 // EXPECT_TRUE([openWindowFeatures menuBarVisibility] == nil); 249 // EXPECT_TRUE([openWindowFeatures statusBarVisibility] == nil); 250 // EXPECT_TRUE([openWindowFeatures toolbarsVisibility] == nil); 251 // EXPECT_TRUE([openWindowFeatures allowsResizing] == nil); 252 // EXPECT_TRUE([openWindowFeatures _locationBarVisibility] == nil); 253 // EXPECT_TRUE([openWindowFeatures _scrollbarsVisibility] == nil); 254 // EXPECT_TRUE([openWindowFeatures _fullscreenDisplay] == nil); 255 // EXPECT_TRUE([openWindowFeatures _dialogDisplay] == nil); 256 openWindowFeatures = nullptr; 257 258 NSString *featuresStringAllSpecifiedAndTrue = @"menubar=yes,status=yes,toolbar=yes,resizable=yes,location=yes,scrollbars=yes,fullscreen=yes"; 259 [webView evaluateJavaScript:[NSString stringWithFormat:windowOpenFormatString, featuresStringAllSpecifiedAndTrue] completionHandler:nil]; 260 TestWebKitAPI::Util::run(&isDone); 261 isDone = false; 262 263 EXPECT_TRUE([openWindowFeatures menuBarVisibility].boolValue); 264 EXPECT_TRUE([openWindowFeatures statusBarVisibility].boolValue); 265 EXPECT_TRUE([openWindowFeatures toolbarsVisibility].boolValue); 266 EXPECT_TRUE([openWindowFeatures allowsResizing].boolValue); 267 EXPECT_TRUE([openWindowFeatures _locationBarVisibility].boolValue); 268 EXPECT_TRUE([openWindowFeatures _scrollbarsVisibility].boolValue); 269 EXPECT_TRUE([openWindowFeatures _fullscreenDisplay].boolValue); 270 openWindowFeatures = nullptr; 271 272 NSString *featuresStringAllSpecifiedAndFalse = @"menubar=no,status=no,toolbar=no,resizable=no,location=no,scrollbars=no,fullscreen=no"; 273 [webView evaluateJavaScript:[NSString stringWithFormat:windowOpenFormatString, featuresStringAllSpecifiedAndFalse] completionHandler:nil]; 274 TestWebKitAPI::Util::run(&isDone); 275 isDone = false; 276 277 EXPECT_FALSE([openWindowFeatures menuBarVisibility].boolValue); 278 EXPECT_FALSE([openWindowFeatures statusBarVisibility ].boolValue); 279 EXPECT_FALSE([openWindowFeatures toolbarsVisibility].boolValue); 280 // https://bugs.webkit.org/show_bug.cgi?id=174388 - This property doesn't accurately reflect the parameters passed by the webpage. 281 // EXPECT_FALSE([openWindowFeatures allowsResizing].boolValue); 282 EXPECT_FALSE([openWindowFeatures _locationBarVisibility].boolValue); 283 EXPECT_FALSE([openWindowFeatures _scrollbarsVisibility].boolValue); 284 EXPECT_FALSE([openWindowFeatures _fullscreenDisplay].boolValue); 285 openWindowFeatures = nullptr; 286 } 287 205 288 #endif
Note: See TracChangeset
for help on using the changeset viewer.