Title: [180436] trunk/Tools
Revision
180436
Author
simon.fra...@apple.com
Date
2015-02-20 11:45:52 -0800 (Fri, 20 Feb 2015)

Log Message

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

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (180435 => 180436)


--- trunk/Tools/ChangeLog	2015-02-20 19:43:08 UTC (rev 180435)
+++ trunk/Tools/ChangeLog	2015-02-20 19:45:52 UTC (rev 180436)
@@ -1,3 +1,20 @@
+2015-02-20  Simon Fraser  <simon.fra...@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_hor...@apple.com>
 
         [WebEditingTester] Hook up key equivalents for new window action

Modified: trunk/Tools/WebEditingTester/WK1WebDocumentController.m (180435 => 180436)


--- trunk/Tools/WebEditingTester/WK1WebDocumentController.m	2015-02-20 19:43:08 UTC (rev 180435)
+++ trunk/Tools/WebEditingTester/WK1WebDocumentController.m	2015-02-20 19:45:52 UTC (rev 180436)
@@ -31,30 +31,33 @@
 #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

Modified: trunk/Tools/WebEditingTester/WK2WebDocumentController.m (180435 => 180436)


--- trunk/Tools/WebEditingTester/WK2WebDocumentController.m	2015-02-20 19:43:08 UTC (rev 180435)
+++ trunk/Tools/WebEditingTester/WK2WebDocumentController.m	2015-02-20 19:45:52 UTC (rev 180436)
@@ -35,11 +35,10 @@
 #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 @@
 
 - (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

Modified: trunk/Tools/WebEditingTester/WebDocument.xib (180435 => 180436)


--- trunk/Tools/WebEditingTester/WebDocument.xib	2015-02-20 19:43:08 UTC (rev 180435)
+++ trunk/Tools/WebEditingTester/WebDocument.xib	2015-02-20 19:45:52 UTC (rev 180436)
@@ -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">
@@ -12,10 +12,10 @@
         </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">
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to