[WebEditingTester] @properties, dot syntax, and remember the window position
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Feb 2015 19:45:52 +0000 (19:45 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Feb 2015 19:45:52 +0000 (19:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=141843

Reviewed by Tim Horton.

Modernize a bit with more dot syntax, use @property for the web views,
and give the main window an Autosave name so it remembers the widow position.

* WebEditingTester/WK1WebDocumentController.m:
(-[WK1WebDocumentController awakeFromNib]):
(-[WK1WebDocumentController loadHTMLString:]):
* WebEditingTester/WK2WebDocumentController.m:
(-[WK2WebDocumentController awakeFromNib]):
* WebEditingTester/WebDocument.xib:

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

Tools/ChangeLog
Tools/WebEditingTester/WK1WebDocumentController.m
Tools/WebEditingTester/WK2WebDocumentController.m
Tools/WebEditingTester/WebDocument.xib

index 260eba1..dda2dac 100644 (file)
@@ -1,3 +1,20 @@
+2015-02-20  Simon Fraser  <simon.fraser@apple.com>
+
+        [WebEditingTester] @properties, dot syntax, and remember the window position
+        https://bugs.webkit.org/show_bug.cgi?id=141843
+
+        Reviewed by Tim Horton.
+        
+        Modernize a bit with more dot syntax, use @property for the web views,
+        and give the main window an Autosave name so it remembers the widow position.
+
+        * WebEditingTester/WK1WebDocumentController.m:
+        (-[WK1WebDocumentController awakeFromNib]):
+        (-[WK1WebDocumentController loadHTMLString:]):
+        * WebEditingTester/WK2WebDocumentController.m:
+        (-[WK2WebDocumentController awakeFromNib]):
+        * WebEditingTester/WebDocument.xib:
+
 2015-02-20  Timothy Horton  <timothy_horton@apple.com>
 
         [WebEditingTester] Hook up key equivalents for new window action
index 8906075..de05662 100644 (file)
 #import <WebKit/WebPreferenceKeysPrivate.h>
 #import <WebKit/WebViewPrivate.h>
 
-@implementation WK1WebDocumentController {
-    WebView *_webView;
-}
+@interface WK1WebDocumentController()
+@property (nonatomic, strong) WebView *webView;
+@end
+
+@implementation WK1WebDocumentController
 
 - (void)awakeFromNib
 {
-    _webView = [[WebView alloc] initWithFrame:[containerView bounds] frameName:nil groupName:@"WebEditingTester"];
-    [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
+    self.webView = [[WebView alloc] initWithFrame:[containerView bounds] frameName:nil groupName:@"WebEditingTester"];
+    _webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
     
-    [_webView setEditable:YES];
-    [_webView setUIDelegate:self];
+    _webView.editable = YES;
+    _webView.UIDelegate = self;
     
-    [[WebPreferences standardPreferences] setFullScreenEnabled:YES];
-    [[WebPreferences standardPreferences] setDeveloperExtrasEnabled:YES];
-    [[WebPreferences standardPreferences] setImageControlsEnabled:YES];
-    [[WebPreferences standardPreferences] setServiceControlsEnabled:YES];
+    WebPreferences *preferences = [WebPreferences standardPreferences];
+    preferences.fullScreenEnabled = YES;
+    preferences.developerExtrasEnabled = YES;
+    preferences.imageControlsEnabled = YES;
+    preferences.serviceControlsEnabled = YES;
     
-    [self.window setTitle:@"WebEditor [WK1]"];
+    self.window.title = @"WebEditor [WK1]";
     [containerView addSubview:_webView];
 }
 
 - (void)loadHTMLString:(NSString *)content
 {
-    [[_webView mainFrame] loadHTMLString:content baseURL:nil];
+    [_webView.mainFrame loadHTMLString:content baseURL:nil];
 }
 
 - (IBAction)pasteAsMarkup:(id)sender
index 9abff20..9913774 100644 (file)
 #import <WebKit/_WKWebsiteDataStore.h>
 
 @interface WK2WebDocumentController () <WKUIDelegate>
+@property (nonatomic, strong) WKWebView *webView;
 @end
 
-@implementation WK2WebDocumentController {
-    WKWebView *_webView;
-}
+@implementation WK2WebDocumentController
 
 static WKWebViewConfiguration *defaultConfiguration()
 {
@@ -61,13 +60,13 @@ static WKWebViewConfiguration *defaultConfiguration()
 
 - (void)awakeFromNib
 {
-    _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:defaultConfiguration()];
-    [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
-    [_webView _setEditable:YES];
-    [_webView setUIDelegate:self];
+    self.webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:defaultConfiguration()];
+    _webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
+    _webView._editable = YES;
+    _webView.UIDelegate = self;
     
     [containerView addSubview:_webView];
-    [self.window setTitle:@"WebEditor [WK2]"];
+    self.window.title = @"WebEditor [WK2]";
 }
 
 - (void)loadHTMLString:(NSString *)content
index 6a8f2cc..b1026d4 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8034" systemVersion="14D87" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7504.2" systemVersion="14D77" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8034"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7504.2"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="WebDocumentController">
         </customObject>
         <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
         <customObject id="-3" userLabel="Application" customClass="NSObject"/>
-        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" animationBehavior="default" id="xOd-HO-29H" userLabel="Window">
+        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" frameAutosaveName="Main Window" animationBehavior="default" id="xOd-HO-29H" userLabel="Window">
             <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
             <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
-            <rect key="contentRect" x="133" y="235" width="507" height="413"/>
+            <rect key="contentRect" x="115" y="862" width="507" height="413"/>
             <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
             <value key="minSize" type="size" width="94" height="86"/>
             <view key="contentView" id="gIp-Ho-8D9">