[WK2] Expose a few drawing/compositing settings on WKPreferences(Private)
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jul 2014 22:24:41 +0000 (22:24 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 8 Jul 2014 22:24:41 +0000 (22:24 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134645

Reviewed by Dan Bernstein.

* UIProcess/API/Cocoa/WKPreferences.mm:
(-[WKPreferences _compositingBordersVisible]):
(-[WKPreferences _setCompositingBordersVisible:]):
(-[WKPreferences _compositingRepaintCountersVisible]):
(-[WKPreferences _setCompositingRepaintCountersVisible:]):
(-[WKPreferences _tiledScrollingIndicatorVisible]):
(-[WKPreferences _setTiledScrollingIndicatorVisible:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:
Expose layer borders, repaint counters, and the tiled scrolling indicator on WKPreferences, as SPI.

* WebView/WebPreferences.mm:
(-[WebPreferences setSubpixelCSSOMElementMetricsEnabled:]):
Remove an extra unnecessary space.

* MiniBrowser/mac/BrowserWindowController.h:
* MiniBrowser/mac/MainMenu.xib:
Add menu items for layer borders and the tiled scrolling indicator.

* MiniBrowser/mac/WK1BrowserWindowController.m:
(-[WK1BrowserWindowController validateMenuItem:]):
(-[WK1BrowserWindowController layerBordersAreVisible]):
(-[WK1BrowserWindowController toggleLayerBordersVisibility:]):
Add getters/setters/validators for layer borders.

* MiniBrowser/mac/WK2BrowserWindowController.m:
(-[WK2BrowserWindowController awakeFromNib]):
(-[WK2BrowserWindowController validateMenuItem:]):
(-[WK2BrowserWindowController layerBordersAreVisible]):
(-[WK2BrowserWindowController toggleLayerBordersVisibility:]):
(-[WK2BrowserWindowController tiledScrollingIndicatorIsVisible]):
(-[WK2BrowserWindowController toggleTiledScrollingIndicatorVisibility:]):
Add getters/setters/validators for layer borders and the tiled scrolling indicator.

(-[WK2BrowserWindowController isSubpixelCSSOMElementMetricsEnabled]): Deleted.
(-[WK2BrowserWindowController toggleSubpixelCSSOMElementMetricsEnabled:]): Deleted.
Remove the WebKit2 version of the subpixel metrics pref, because it doesn't work, because
nothing in WebKit2 reads this default, and there is no WebKit2 API for adjusting this preference.

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

Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebPreferences.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Tools/ChangeLog
Tools/MiniBrowser/mac/BrowserWindowController.h
Tools/MiniBrowser/mac/MainMenu.xib
Tools/MiniBrowser/mac/WK1BrowserWindowController.m
Tools/MiniBrowser/mac/WK2BrowserWindowController.m

index 10d763246166b0374de86144e3c6d335f4159ca9..3cbcc9194292a7d8939bed00326eb940f7ca872f 100644 (file)
@@ -1,3 +1,14 @@
+2014-07-08  Tim Horton  <timothy_horton@apple.com>
+
+        [WK2] Expose a few drawing/compositing settings on WKPreferences(Private)
+        https://bugs.webkit.org/show_bug.cgi?id=134645
+
+        Reviewed by Dan Bernstein.
+
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences setSubpixelCSSOMElementMetricsEnabled:]):
+        Remove an extra unnecessary space.
+
 2014-07-03  Daniel Bates  <dabates@apple.com>
 
         Add WTF::move()
index 2694ddcc7aed139ce5067893c84e3ae62e070844..994da0c607f828f9c51481ed52f752f0957a6f45 100644 (file)
@@ -1915,7 +1915,7 @@ static NSString *classIBCreatorID = nil;
     return [self _boolValueForKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
 }
 
-- (void) setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
+- (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
 {
     [self _setBoolValue:enabled forKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
 }
index 511e4b92a119b9bb73df79a94d34c2ffd343616f..d06cfc79cebf2d2915ad81fe53c23d282ccc6221 100644 (file)
@@ -1,3 +1,20 @@
+2014-07-08  Tim Horton  <timothy_horton@apple.com>
+
+        [WK2] Expose a few drawing/compositing settings on WKPreferences(Private)
+        https://bugs.webkit.org/show_bug.cgi?id=134645
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/API/Cocoa/WKPreferences.mm:
+        (-[WKPreferences _compositingBordersVisible]):
+        (-[WKPreferences _setCompositingBordersVisible:]):
+        (-[WKPreferences _compositingRepaintCountersVisible]):
+        (-[WKPreferences _setCompositingRepaintCountersVisible:]):
+        (-[WKPreferences _tiledScrollingIndicatorVisible]):
+        (-[WKPreferences _setTiledScrollingIndicatorVisible:]):
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+        Expose layer borders, repaint counters, and the tiled scrolling indicator on WKPreferences, as SPI.
+
 2014-07-08  Tim Horton  <timothy_horton@apple.com>
 
         WKProcessPoolConfigurationPrivate's maximumProcessCount property has no effect
index 1d9248d0e48b150a9c1d6fb28dc9b79d64046906..d3c7e464ddf8ee98d134b834ced4ff2323ddb385 100644 (file)
@@ -163,6 +163,36 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setOfflineWebApplicationCacheEnabled(offlineApplicationCacheIsEnabled);
 }
 
+- (BOOL)_compositingBordersVisible
+{
+    return _preferences->compositingBordersVisible();
+}
+
+- (void)_setCompositingBordersVisible:(BOOL)compositingBordersVisible
+{
+    _preferences->setCompositingBordersVisible(compositingBordersVisible);
+}
+
+- (BOOL)_compositingRepaintCountersVisible
+{
+    return _preferences->compositingRepaintCountersVisible();
+}
+
+- (void)_setCompositingRepaintCountersVisible:(BOOL)repaintCountersVisible
+{
+    _preferences->setCompositingRepaintCountersVisible(repaintCountersVisible);
+}
+
+- (BOOL)_tiledScrollingIndicatorVisible
+{
+    return _preferences->tiledScrollingIndicatorVisible();
+}
+
+- (void)_setTiledScrollingIndicatorVisible:(BOOL)tiledScrollingIndicatorVisible
+{
+    _preferences->setTiledScrollingIndicatorVisible(tiledScrollingIndicatorVisible);
+}
+
 @end
 
 #endif // WK_API_ENABLED
index 1f92375dfaee395a15d99edebf74b56230c593bb..cdf6b8d7cddc595b0d5d5aec96d52a0508598803 100644 (file)
@@ -39,10 +39,16 @@ typedef NS_ENUM(NSInteger, _WKStorageBlockingPolicy) {
 
 @interface WKPreferences (WKPrivate)
 
+// FIXME: This property should not have the verb "is" in it.
 @property (nonatomic, setter=_setTelephoneNumberDetectionIsEnabled:) BOOL _telephoneNumberDetectionIsEnabled;
 @property (nonatomic, setter=_setStorageBlockingPolicy:) _WKStorageBlockingPolicy _storageBlockingPolicy;
 
+@property (nonatomic, setter=_setCompositingBordersVisible:) BOOL _compositingBordersVisible;
+@property (nonatomic, setter=_setCompositingRepaintCountersVisible:) BOOL _compositingRepaintCountersVisible;
+@property (nonatomic, setter=_setTiledScrollingIndicatorVisible:) BOOL _tiledScrollingIndicatorVisible;
+
 // FIXME: This should be configured on the WKWebsiteDataStore.
+// FIXME: This property should not have the verb "is" in it.
 @property (nonatomic, setter=_setOfflineApplicationCacheIsEnabled:) BOOL _offlineApplicationCacheIsEnabled;
 
 @end
index ae0e0288504685e6f61cadde4bccc9b17b222ef9..886a43167184f245aff6fe9e650ddd01d8a02cb4 100644 (file)
@@ -1,3 +1,34 @@
+2014-07-08  Tim Horton  <timothy_horton@apple.com>
+
+        [WK2] Expose a few drawing/compositing settings on WKPreferences(Private)
+        https://bugs.webkit.org/show_bug.cgi?id=134645
+
+        Reviewed by Dan Bernstein.
+
+        * MiniBrowser/mac/BrowserWindowController.h:
+        * MiniBrowser/mac/MainMenu.xib:
+        Add menu items for layer borders and the tiled scrolling indicator.
+
+        * MiniBrowser/mac/WK1BrowserWindowController.m:
+        (-[WK1BrowserWindowController validateMenuItem:]):
+        (-[WK1BrowserWindowController layerBordersAreVisible]):
+        (-[WK1BrowserWindowController toggleLayerBordersVisibility:]):
+        Add getters/setters/validators for layer borders.
+
+        * MiniBrowser/mac/WK2BrowserWindowController.m:
+        (-[WK2BrowserWindowController awakeFromNib]):
+        (-[WK2BrowserWindowController validateMenuItem:]):
+        (-[WK2BrowserWindowController layerBordersAreVisible]):
+        (-[WK2BrowserWindowController toggleLayerBordersVisibility:]):
+        (-[WK2BrowserWindowController tiledScrollingIndicatorIsVisible]):
+        (-[WK2BrowserWindowController toggleTiledScrollingIndicatorVisibility:]):
+        Add getters/setters/validators for layer borders and the tiled scrolling indicator.
+
+        (-[WK2BrowserWindowController isSubpixelCSSOMElementMetricsEnabled]): Deleted.
+        (-[WK2BrowserWindowController toggleSubpixelCSSOMElementMetricsEnabled:]): Deleted.
+        Remove the WebKit2 version of the subpixel metrics pref, because it doesn't work, because
+        nothing in WebKit2 reads this default, and there is no WebKit2 API for adjusting this preference.
+
 2014-07-08  Adrian Perez de Castro  <aperez@igalia.com>
 
         [GTK] Move user style sheet API out of WebKitWebViewGroup
index 4c9345dc977727b24fd2089dbcdaef4e6b62e592..96346793a4407dbfd53d7da55b80003a234c413a 100644 (file)
 - (IBAction)toggleZoomMode:(id)sender;
 - (IBAction)togglePaginationMode:(id)sender;
 - (IBAction)toggleTransparentWindow:(id)sender;
-- (IBAction)toggleSubpixelCSSOMElementMetricsEnabled:(id)sender;
+- (IBAction)toggleLayerBordersVisibility:(id)sender;
 
 - (IBAction)dumpSourceToConsole:(id)sender;
 - (IBAction)find:(id)sender;
 
 @optional
+- (IBAction)toggleSubpixelCSSOMElementMetricsEnabled:(id)sender;
 - (IBAction)toggleUISideCompositing:(id)sender;
+- (IBAction)toggleTiledScrollingIndicatorVisibility:(id)sender;
 
 @end
 
index 6b53323e65ecd941ab880c4c81cf34a2535be407..99d651c56d4903b67484c602870b57e2368c2a5e 100644 (file)
                                     <action selector="toggleUISideCompositing:" target="-1" id="1Ed-C5-0po"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Layer Borders" id="00T-EI-Wqj">
+                                <modifierMask key="keyEquivalentModifierMask"/>
+                                <connections>
+                                    <action selector="toggleLayerBordersVisibility:" target="-1" id="gmt-1Z-XcQ"/>
+                                </connections>
+                            </menuItem>
+                            <menuItem title="Tiled Scrolling Indicator" id="iBU-Yy-GuV">
+                                <modifierMask key="keyEquivalentModifierMask"/>
+                                <connections>
+                                    <action selector="toggleTiledScrollingIndicatorVisibility:" target="-1" id="RJB-dt-xSR"/>
+                                </connections>
+                            </menuItem>
                             <menuItem title="Enable Sub-Pixel offsetWidth etc." state="on" id="8X5-i6-t2d">
                                 <modifierMask key="keyEquivalentModifierMask"/>
                                 <connections>
index e38f21a40aec93fc1dba6131bf2b6d9e4350f621..340bce40ffa228c88c657e8e2c53c7b75ff8611d 100644 (file)
         [menuItem setState:[[self window] isOpaque] ? NSOffState : NSOnState];
     else if (action == @selector(toggleSubpixelCSSOMElementMetricsEnabled:))
         [menuItem setState:[self isSubpixelCSSOMElementMetricsEnabled] ? NSOnState : NSOffState];
+    else if (action == @selector(toggleLayerBordersVisibility:))
+        [menuItem setState:[self layerBordersVisible] ? NSOnState : NSOffState];
 
     return YES;
 }
     [[WebPreferences standardPreferences] setSubpixelCSSOMElementMetricsEnabled:![self isSubpixelCSSOMElementMetricsEnabled]];
 }
 
+- (BOOL)layerBordersVisible
+{
+    return [[WebPreferences standardPreferences] showDebugBorders];
+}
+
+- (IBAction)toggleLayerBordersVisibility:(id)sender
+{
+    BOOL newValue = ![self layerBordersVisible];
+    [[WebPreferences standardPreferences] setShowDebugBorders:newValue];
+    [[WebPreferences standardPreferences] setShowRepaintCounter:newValue];
+}
+
 - (IBAction)find:(id)sender
 {
 }
index 4ae93de4da9700bb0c158a3f643d3499111e9b42..8b3fc7886291cafbe9f83546687f289a51abe62b 100644 (file)
@@ -30,6 +30,7 @@
 #import "AppDelegate.h"
 #import <WebKit/WKFrameInfo.h>
 #import <WebKit/WKNavigationDelegate.h>
+#import <WebKit/WKPreferencesPrivate.h>
 #import <WebKit/WKUIDelegate.h>
 #import <WebKit/WKWebView.h>
 #import <WebKit/WKWebViewConfiguration.h>
@@ -37,7 +38,9 @@
 
 static void* keyValueObservingContext = &keyValueObservingContext;
 static NSString * const WebKit2UseRemoteLayerTreeDrawingAreaKey = @"WebKit2UseRemoteLayerTreeDrawingArea";
-static NSString * const WebKit2SubpixelCSSOMElementMetricsEnabledKey = @"WebKitSubpixelCSSOMElementMetricsEnabled";
+
+static NSString * const LayerBordersVisiblePreferenceKey = @"LayerBordersVisible";
+static NSString * const TiledScrollingIndicatorVisiblePreferenceKey = @"TiledScrollingIndicatorVisibleKey";
 
 @interface WK2BrowserWindowController () <WKNavigationDelegate, WKUIDelegate>
 @end
@@ -50,8 +53,13 @@ static NSString * const WebKit2SubpixelCSSOMElementMetricsEnabledKey = @"WebKitS
 - (void)awakeFromNib
 {
     static WKWebViewConfiguration *configuration;
-    if (!configuration)
+    if (!configuration) {
         configuration = [[WKWebViewConfiguration alloc] init];
+
+        configuration.preferences._tiledScrollingIndicatorVisible = [self tiledScrollingIndicatorVisible];
+        configuration.preferences._compositingBordersVisible = [self layerBordersVisible];
+        configuration.preferences._compositingRepaintCountersVisible = [self layerBordersVisible];
+    }
     _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:configuration];
 
     _webView.allowsMagnification = YES;
@@ -138,8 +146,10 @@ static NSString * const WebKit2SubpixelCSSOMElementMetricsEnabledKey = @"WebKitS
         [menuItem setState:[[self window] isOpaque] ? NSOffState : NSOnState];
     else if (action == @selector(toggleUISideCompositing:))
         [menuItem setState:[self isUISideCompositingEnabled] ? NSOnState : NSOffState];
-    else if (action == @selector(toggleSubpixelCSSOMElementMetricsEnabled:))
-        [menuItem setState:[self isSubpixelCSSOMElementMetricsEnabled] ? NSOnState : NSOffState];
+    else if (action == @selector(toggleLayerBordersVisibility:))
+        [menuItem setState:[self layerBordersVisible] ? NSOnState : NSOffState];
+    else if (action == @selector(toggleTiledScrollingIndicatorVisibility:))
+        [menuItem setState:[self tiledScrollingIndicatorVisible] ? NSOnState : NSOffState];
 
     return YES;
 }
@@ -301,26 +311,39 @@ static NSString * const WebKit2SubpixelCSSOMElementMetricsEnabledKey = @"WebKitS
     [[self window] display];    
 }
 
-- (BOOL)isSubpixelCSSOMElementMetricsEnabled
+- (BOOL)isUISideCompositingEnabled
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKit2SubpixelCSSOMElementMetricsEnabledKey];
+    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKit2UseRemoteLayerTreeDrawingAreaKey];
 }
 
-- (IBAction)toggleSubpixelCSSOMElementMetricsEnabled:(id)sender
+- (IBAction)toggleUISideCompositing:(id)sender
 {
-    [[NSUserDefaults standardUserDefaults] setBool:![self isSubpixelCSSOMElementMetricsEnabled] forKey:WebKit2SubpixelCSSOMElementMetricsEnabledKey];
+    [[NSUserDefaults standardUserDefaults] setBool:![self isUISideCompositingEnabled] forKey:WebKit2UseRemoteLayerTreeDrawingAreaKey];
 }
 
-- (BOOL)isUISideCompositingEnabled
+- (BOOL)layerBordersVisible
 {
-    return [[NSUserDefaults standardUserDefaults] boolForKey:WebKit2UseRemoteLayerTreeDrawingAreaKey];
+    return [[NSUserDefaults standardUserDefaults] boolForKey:LayerBordersVisiblePreferenceKey];
 }
 
-- (IBAction)toggleUISideCompositing:(id)sender
+- (IBAction)toggleLayerBordersVisibility:(id)sender
+{
+    BOOL newState = ![self layerBordersVisible];
+    [[NSUserDefaults standardUserDefaults] setBool:newState forKey:LayerBordersVisiblePreferenceKey];
+    _webView.configuration.preferences._compositingBordersVisible = newState;
+    _webView.configuration.preferences._compositingRepaintCountersVisible = newState;
+}
+
+- (BOOL)tiledScrollingIndicatorVisible
+{
+    return [[NSUserDefaults standardUserDefaults] boolForKey:TiledScrollingIndicatorVisiblePreferenceKey];
+}
+
+- (IBAction)toggleTiledScrollingIndicatorVisibility:(id)sender
 {
-    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
-    BOOL newValue = ![userDefaults boolForKey:WebKit2UseRemoteLayerTreeDrawingAreaKey];
-    [userDefaults setBool:newValue forKey:WebKit2UseRemoteLayerTreeDrawingAreaKey];
+    BOOL newState = ![self tiledScrollingIndicatorVisible];
+    [[NSUserDefaults standardUserDefaults] setBool:newState forKey:TiledScrollingIndicatorVisiblePreferenceKey];
+    _webView.configuration.preferences._tiledScrollingIndicatorVisible = newState;
 }
 
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context