Changeset 180436 in webkit


Ignore:
Timestamp:
Feb 20, 2015, 11:45:52 AM (10 years ago)
Author:
Simon Fraser
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:
Location:
trunk/Tools
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r180429 r180436  
     12015-02-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [WebEditingTester] @properties, dot syntax, and remember the window position
     4        https://bugs.webkit.org/show_bug.cgi?id=141843
     5
     6        Reviewed by Tim Horton.
     7       
     8        Modernize a bit with more dot syntax, use @property for the web views,
     9        and give the main window an Autosave name so it remembers the widow position.
     10
     11        * WebEditingTester/WK1WebDocumentController.m:
     12        (-[WK1WebDocumentController awakeFromNib]):
     13        (-[WK1WebDocumentController loadHTMLString:]):
     14        * WebEditingTester/WK2WebDocumentController.m:
     15        (-[WK2WebDocumentController awakeFromNib]):
     16        * WebEditingTester/WebDocument.xib:
     17
    1182015-02-20  Timothy Horton  <timothy_horton@apple.com>
    219
  • trunk/Tools/WebEditingTester/WK1WebDocumentController.m

    r180429 r180436  
    3232#import <WebKit/WebViewPrivate.h>
    3333
    34 @implementation WK1WebDocumentController {
    35     WebView *_webView;
    36 }
     34@interface WK1WebDocumentController()
     35@property (nonatomic, strong) WebView *webView;
     36@end
     37
     38@implementation WK1WebDocumentController
    3739
    3840- (void)awakeFromNib
    3941{
    40     _webView = [[WebView alloc] initWithFrame:[containerView bounds] frameName:nil groupName:@"WebEditingTester"];
    41     [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
     42    self.webView = [[WebView alloc] initWithFrame:[containerView bounds] frameName:nil groupName:@"WebEditingTester"];
     43    _webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
    4244   
    43     [_webView setEditable:YES];
    44     [_webView setUIDelegate:self];
     45    _webView.editable = YES;
     46    _webView.UIDelegate = self;
    4547   
    46     [[WebPreferences standardPreferences] setFullScreenEnabled:YES];
    47     [[WebPreferences standardPreferences] setDeveloperExtrasEnabled:YES];
    48     [[WebPreferences standardPreferences] setImageControlsEnabled:YES];
    49     [[WebPreferences standardPreferences] setServiceControlsEnabled:YES];
     48    WebPreferences *preferences = [WebPreferences standardPreferences];
     49    preferences.fullScreenEnabled = YES;
     50    preferences.developerExtrasEnabled = YES;
     51    preferences.imageControlsEnabled = YES;
     52    preferences.serviceControlsEnabled = YES;
    5053   
    51     [self.window setTitle:@"WebEditor [WK1]"];
     54    self.window.title = @"WebEditor [WK1]";
    5255    [containerView addSubview:_webView];
    5356}
     
    5558- (void)loadHTMLString:(NSString *)content
    5659{
    57     [[_webView mainFrame] loadHTMLString:content baseURL:nil];
     60    [_webView.mainFrame loadHTMLString:content baseURL:nil];
    5861}
    5962
  • trunk/Tools/WebEditingTester/WK2WebDocumentController.m

    r180429 r180436  
    3636
    3737@interface WK2WebDocumentController () <WKUIDelegate>
     38@property (nonatomic, strong) WKWebView *webView;
    3839@end
    3940
    40 @implementation WK2WebDocumentController {
    41     WKWebView *_webView;
    42 }
     41@implementation WK2WebDocumentController
    4342
    4443static WKWebViewConfiguration *defaultConfiguration()
     
    6261- (void)awakeFromNib
    6362{
    64     _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:defaultConfiguration()];
    65     [_webView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)];
    66     [_webView _setEditable:YES];
    67     [_webView setUIDelegate:self];
     63    self.webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:defaultConfiguration()];
     64    _webView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
     65    _webView._editable = YES;
     66    _webView.UIDelegate = self;
    6867   
    6968    [containerView addSubview:_webView];
    70     [self.window setTitle:@"WebEditor [WK2]"];
     69    self.window.title = @"WebEditor [WK2]";
    7170}
    7271
  • trunk/Tools/WebEditingTester/WebDocument.xib

    r180348 r180436  
    11<?xml version="1.0" encoding="UTF-8" standalone="no"?>
    2 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8034" systemVersion="14D87" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     2<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7504.2" systemVersion="14D77" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
    33    <dependencies>
    4         <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8034"/>
     4        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7504.2"/>
    55    </dependencies>
    66    <objects>
     
    1313        <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
    1414        <customObject id="-3" userLabel="Application" customClass="NSObject"/>
    15         <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" animationBehavior="default" id="xOd-HO-29H" userLabel="Window">
     15        <window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" frameAutosaveName="Main Window" animationBehavior="default" id="xOd-HO-29H" userLabel="Window">
    1616            <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES" fullSizeContentView="YES"/>
    1717            <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
    18             <rect key="contentRect" x="133" y="235" width="507" height="413"/>
     18            <rect key="contentRect" x="115" y="862" width="507" height="413"/>
    1919            <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
    2020            <value key="minSize" type="size" width="94" height="86"/>
Note: See TracChangeset for help on using the changeset viewer.