[Mac] Expose Enable/Disable Accelerated Drawing in MiniBrowser
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Sep 2015 23:04:34 +0000 (23:04 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Sep 2015 23:04:34 +0000 (23:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=148980

Reviewed by Alexey Proskuryakov.

Source/WebKit2:

Expose SPI web preference to enable/disable- and query the state of- accelerated drawing
so that we can toggle this setting in MiniBrowser on Mac.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _acceleratedDrawingEnabled]): Added.
(-[WKPreferences _setAcceleratedDrawingEnabled:]): Added.
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

Tools:

Add setting to enable/disable accelerated drawing so as to support testing
this feature in MiniBrowser on Mac.

* MiniBrowser/mac/SettingsController.h:
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]): Add menu item.
(-[SettingsController validateMenuItem:]): Update setting when menu item is toggled.
(-[SettingsController toggleAcceleratedDrawingEnabled:]): Added.
(-[SettingsController acceleratedDrawingEnabled]): Added.
* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController didChangeSettings]): Apply setting in WebKit1.
* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController didChangeSettings]): Apply setting in WebKit2.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189513 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Tools/ChangeLog
Tools/MiniBrowser/mac/SettingsController.h
Tools/MiniBrowser/mac/SettingsController.m
Tools/MiniBrowser/mac/WK1BrowserWindowController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m

index fec9b8e..241925d 100644 (file)
@@ -1,3 +1,18 @@
+2015-09-08  Daniel Bates  <dabates@apple.com>
+
+        [Mac] Expose Enable/Disable Accelerated Drawing in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=148980
+
+        Reviewed by Alexey Proskuryakov.
+
+        Expose SPI web preference to enable/disable- and query the state of- accelerated drawing
+        so that we can toggle this setting in MiniBrowser on Mac.
+
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _acceleratedDrawingEnabled]): Added.
+        (-[WKPreferences _setAcceleratedDrawingEnabled:]): Added.
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
 2015-09-08  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Remove unused file: WebInspectorFrontendClient.h
index 8343a21..4c8dae0 100644 (file)
@@ -237,6 +237,16 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setSimpleLineLayoutDebugBordersEnabled(simpleLineLayoutDebugBordersEnabled);
 }
 
+- (BOOL)_acceleratedDrawingEnabled
+{
+    return _preferences->acceleratedDrawingEnabled();
+}
+
+- (void)_setAcceleratedDrawingEnabled:(BOOL)acceleratedDrawingEnabled
+{
+    _preferences->setAcceleratedDrawingEnabled(acceleratedDrawingEnabled);
+}
+
 - (BOOL)_developerExtrasEnabled
 {
     return _preferences->developerExtrasEnabled();
index 635f97b..97885ec 100644 (file)
@@ -57,6 +57,7 @@ typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
 @property (nonatomic, setter=_setTiledScrollingIndicatorVisible:) BOOL _tiledScrollingIndicatorVisible;
 @property (nonatomic, setter=_setVisibleDebugOverlayRegions:) _WKDebugOverlayRegions _visibleDebugOverlayRegions WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 @property (nonatomic, setter=_setSimpleLineLayoutDebugBordersEnabled:) BOOL _simpleLineLayoutDebugBordersEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
+@property (nonatomic, setter=_setAcceleratedDrawingEnabled:) BOOL _acceleratedDrawingEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
 @property (nonatomic, setter=_setDeveloperExtrasEnabled:) BOOL _developerExtrasEnabled WK_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA);
 
index d1bbaf0..4d22c06 100644 (file)
@@ -1,3 +1,24 @@
+2015-09-08  Daniel Bates  <dabates@apple.com>
+
+        [Mac] Expose Enable/Disable Accelerated Drawing in MiniBrowser
+        https://bugs.webkit.org/show_bug.cgi?id=148980
+
+        Reviewed by Alexey Proskuryakov.
+
+        Add setting to enable/disable accelerated drawing so as to support testing
+        this feature in MiniBrowser on Mac.
+
+        * MiniBrowser/mac/SettingsController.h:
+        * MiniBrowser/mac/SettingsController.m:
+        (-[SettingsController _populateMenu]): Add menu item.
+        (-[SettingsController validateMenuItem:]): Update setting when menu item is toggled.
+        (-[SettingsController toggleAcceleratedDrawingEnabled:]): Added.
+        (-[SettingsController acceleratedDrawingEnabled]): Added.
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController didChangeSettings]): Apply setting in WebKit1.
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController didChangeSettings]): Apply setting in WebKit2.
+
 2015-09-08  Jason Marcell  <jmarcell@apple.com>
 
         Unreviewed. Added myself as a commiter in contributors.json.
index 558db1b..e5687e6 100644 (file)
@@ -45,6 +45,7 @@
 @property (nonatomic, readonly) BOOL useUISideCompositing;
 @property (nonatomic, readonly) BOOL perWindowWebProcessesDisabled;
 @property (nonatomic, readonly) BOOL subPixelCSSOMMetricsEnabled;
+@property (nonatomic, readonly) BOOL acceleratedDrawingEnabled;
 @property (nonatomic, readonly) NSString *defaultURL;
 
 @end
index d4dfdc1..87652c6 100644 (file)
@@ -36,6 +36,7 @@ static NSString * const LayerBordersVisiblePreferenceKey = @"LayerBordersVisible
 static NSString * const SimpleLineLayoutDebugBordersEnabledPreferenceKey = @"SimpleLineLayoutDebugBordersEnabled";
 static NSString * const TiledScrollingIndicatorVisiblePreferenceKey = @"TiledScrollingIndicatorVisible";
 static NSString * const IncrementalRenderingSuppressedPreferenceKey = @"IncrementalRenderingSuppressed";
+static NSString * const AcceleratedDrawingEnabledPreferenceKey = @"AcceleratedDrawingEnabled";
 
 static NSString * const NonFastScrollableRegionOverlayVisiblePreferenceKey = @"NonFastScrollableRegionOverlayVisible";
 static NSString * const WheelEventHandlerRegionOverlayVisiblePreferenceKey = @"WheelEventHandlerRegionOverlayVisible";
@@ -107,6 +108,7 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     [self _addItemWithTitle:@"Show Layer Borders" action:@selector(toggleShowLayerBorders:) indented:NO];
     [self _addItemWithTitle:@"Show Simple Line Layout Borders" action:@selector(toggleSimpleLineLayoutDebugBordersEnabled:) indented:NO];
     [self _addItemWithTitle:@"Suppress Incremental Rendering in New Windows" action:@selector(toggleIncrementalRenderingSuppressed:) indented:NO];
+    [self _addItemWithTitle:@"Enable Accelerated Drawing" action:@selector(toggleAcceleratedDrawingEnabled:) indented:NO];
 
     [self _addHeaderWithTitle:@"WebKit2-only Settings"];
 
@@ -152,6 +154,8 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
         [menuItem setState:[self simpleLineLayoutDebugBordersEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleIncrementalRenderingSuppressed:))
         [menuItem setState:[self incrementalRenderingSuppressed] ? NSOnState : NSOffState];
+    else if (action == @selector(toggleAcceleratedDrawingEnabled:))
+        [menuItem setState:[self acceleratedDrawingEnabled] ? NSOnState : NSOffState];
     else if (action == @selector(toggleShowTiledScrollingIndicator:))
         [menuItem setState:[self tiledScrollingIndicatorVisible] ? NSOnState : NSOffState];
     else if (action == @selector(toggleUseUISideCompositing:))
@@ -264,6 +268,16 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     return [[NSUserDefaults standardUserDefaults] boolForKey:SimpleLineLayoutDebugBordersEnabledPreferenceKey];
 }
 
+- (void)toggleAcceleratedDrawingEnabled:(id)sender
+{
+    [self _toggleBooleanDefault:AcceleratedDrawingEnabledPreferenceKey];
+}
+
+- (BOOL)acceleratedDrawingEnabled
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:AcceleratedDrawingEnabledPreferenceKey];
+}
+
 - (void)toggleShowTiledScrollingIndicator:(id)sender
 {
     [self _toggleBooleanDefault:TiledScrollingIndicatorVisiblePreferenceKey];
index 922f7a1..12a9a42 100644 (file)
     [[WebPreferences standardPreferences] setSimpleLineLayoutDebugBordersEnabled:settings.simpleLineLayoutDebugBordersEnabled];
     [[WebPreferences standardPreferences] setShowRepaintCounter:settings.layerBordersVisible];
     [[WebPreferences standardPreferences] setSuppressesIncrementalRendering:settings.incrementalRenderingSuppressed];
+    [[WebPreferences standardPreferences] setAcceleratedDrawingEnabled:settings.acceleratedDrawingEnabled];
 
     BOOL useTransparentWindows = settings.useTransparentWindows;
     if (useTransparentWindows != !self.window.isOpaque) {
index 7d29eeb..eeff99a 100644 (file)
@@ -341,6 +341,7 @@ static CGFloat viewScaleForMenuItemTag(NSInteger tag)
     preferences._compositingBordersVisible = settings.layerBordersVisible;
     preferences._compositingRepaintCountersVisible = settings.layerBordersVisible;
     preferences._simpleLineLayoutDebugBordersEnabled = settings.simpleLineLayoutDebugBordersEnabled;
+    preferences._acceleratedDrawingEnabled = settings.acceleratedDrawingEnabled;
 
     BOOL useTransparentWindows = settings.useTransparentWindows;
     if (useTransparentWindows != _webView._drawsTransparentBackground) {