Reviewed and tweaked by Darin.
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Aug 2006 03:53:29 +0000 (03:53 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 16 Aug 2006 03:53:29 +0000 (03:53 +0000)
        - added DumpRenderTree support so editing delegate can be made to refuse edits
          to enable tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=10129

        * DumpRenderTree/DumpRenderTree.m:
        (+[LayoutTestController isSelectorExcludedFromWebScript:]): Add setAcceptsEditing:
        to the list of methods.
        (+[LayoutTestController webScriptNameForSelector:]): Use the name setAcceptsEditing,
        without the colon, for the JavaScript name.
        (-[LayoutTestController setAcceptsEditing:]): Added. Calls through to the editing
        delegate.
        (dumpRenderTree): Set the acceptsEditing flag to YES before each test.

        * DumpRenderTree/EditingDelegate.h: Added an "acceptsEditing" flag and getter and
        setter methods to the class.
        * DumpRenderTree/EditingDelegate.m:
        (-[EditingDelegate init]): Initialize acceptsEditing to YES.
        (-[EditingDelegate webView:shouldBeginEditingInDOMRange:]): Instead of always returning YES,
        return the value of acceptsEditing.
        (-[EditingDelegate webView:shouldEndEditingInDOMRange:]): Ditto.
        (-[EditingDelegate webView:shouldInsertNode:replacingDOMRange:givenAction:]): Ditto.
        (-[EditingDelegate webView:shouldInsertText:replacingDOMRange:givenAction:]): Ditto.
        (-[EditingDelegate webView:shouldDeleteDOMRange:]): Ditto.
        (-[EditingDelegate webView:shouldChangeSelectedDOMRange:toDOMRange:affinity:stillSelecting:]):
        Ditto.
        (-[EditingDelegate webView:shouldApplyStyle:toElementsInDOMRange:]): Ditto.
        (-[EditingDelegate webView:shouldChangeTypingStyle:toStyle:]): Ditto.
        (-[EditingDelegate setAcceptsEditing:]): Added.

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

WebKitTools/ChangeLog
WebKitTools/DumpRenderTree/DumpRenderTree.m
WebKitTools/DumpRenderTree/EditingDelegate.h
WebKitTools/DumpRenderTree/EditingDelegate.m

index 65d05eb375dfeff7fc5eb7499b286c3e0d67ab64..7cd8ab1adcfd23b8716cb06316a51e1a8fd8d6d3 100644 (file)
@@ -1,3 +1,35 @@
+2006-08-15  Duncan Wilcox  <duncan@mclink.it>
+
+        Reviewed and tweaked by Darin.
+
+        - added DumpRenderTree support so editing delegate can be made to refuse edits
+          to enable tests for http://bugzilla.opendarwin.org/show_bug.cgi?id=10129
+
+        * DumpRenderTree/DumpRenderTree.m:
+        (+[LayoutTestController isSelectorExcludedFromWebScript:]): Add setAcceptsEditing:
+        to the list of methods.
+        (+[LayoutTestController webScriptNameForSelector:]): Use the name setAcceptsEditing,
+        without the colon, for the JavaScript name.
+        (-[LayoutTestController setAcceptsEditing:]): Added. Calls through to the editing
+        delegate.
+        (dumpRenderTree): Set the acceptsEditing flag to YES before each test.
+
+        * DumpRenderTree/EditingDelegate.h: Added an "acceptsEditing" flag and getter and
+        setter methods to the class.
+        * DumpRenderTree/EditingDelegate.m:
+        (-[EditingDelegate init]): Initialize acceptsEditing to YES.
+        (-[EditingDelegate webView:shouldBeginEditingInDOMRange:]): Instead of always returning YES,
+        return the value of acceptsEditing.
+        (-[EditingDelegate webView:shouldEndEditingInDOMRange:]): Ditto.
+        (-[EditingDelegate webView:shouldInsertNode:replacingDOMRange:givenAction:]): Ditto.
+        (-[EditingDelegate webView:shouldInsertText:replacingDOMRange:givenAction:]): Ditto.
+        (-[EditingDelegate webView:shouldDeleteDOMRange:]): Ditto.
+        (-[EditingDelegate webView:shouldChangeSelectedDOMRange:toDOMRange:affinity:stillSelecting:]):
+        Ditto.
+        (-[EditingDelegate webView:shouldApplyStyle:toElementsInDOMRange:]): Ditto.
+        (-[EditingDelegate webView:shouldChangeTypingStyle:toStyle:]): Ditto.
+        (-[EditingDelegate setAcceptsEditing:]): Added.
+
 2006-08-03  Mark Rowe  <opendarwin.org@bdash.net.nz>
 
         Reviewed by Darin.
index 40528586bf98db98f09cfc5beaae9916f32e056a..114aa33ab3b524a49e79676c5ea242889ebfdb70 100644 (file)
@@ -328,9 +328,8 @@ int main(int argc, const char *argv[])
         }
     } else {
         printSeparators = (optind < argc-1 || (dumpPixels && dumpTree));
-        for (int i = optind; i != argc; ++i) {
+        for (int i = optind; i != argc; ++i)
             dumpRenderTree(argv[i]);
-        }
     }
     
     [webView setFrameLoadDelegate:nil];
@@ -607,7 +606,8 @@ static void dump(void)
             || aSelector == @selector(testRepaint)
             || aSelector == @selector(repaintSweepHorizontally)
             || aSelector == @selector(clearBackForwardList)
-            || aSelector == @selector(keepWebHistory))
+            || aSelector == @selector(keepWebHistory)
+            || aSelector == @selector(setAcceptsEditing:))
         return NO;
     return YES;
 }
@@ -618,6 +618,8 @@ static void dump(void)
         return @"setWindowIsKey";
     if (aSelector == @selector(setMainFrameIsFirstResponder:))
         return @"setMainFrameIsFirstResponder";
+    if (aSelector == @selector(setAcceptsEditing:))
+        return @"setAcceptsEditing";
     return nil;
 }
 
@@ -717,6 +719,11 @@ static void dump(void)
     return nil;
 }
 
+- (void)setAcceptsEditing:(BOOL)newAcceptsEditing
+{
+    [(EditingDelegate *)[[frame webView] editingDelegate] setAcceptsEditing:newAcceptsEditing];
+}
+
 @end
 
 static void dumpRenderTree(const char *pathOrURL)
@@ -739,6 +746,7 @@ static void dumpRenderTree(const char *pathOrURL)
         return;
     }
 
+    [(EditingDelegate *)[[frame webView] editingDelegate] setAcceptsEditing:YES];
     done = NO;
     readyToDump = NO;
     waitToDump = NO;
index 709c7f5166ccb62f0f0e52840e30ce3a5519f978..b5563c887b81fe5b847b353964e9ed7ff6646c96 100644 (file)
 #import <Cocoa/Cocoa.h>
 
 @interface EditingDelegate : NSObject
+{
+    BOOL acceptsEditing;
+}
+
+- (void)setAcceptsEditing:(BOOL)newAcceptsEditing;
+
 @end
index 3a20fec954aa4699013c0e1625932a9be5f987d2..e69ffe85e89e99913b4ee797555a7dbb8008b073 100644 (file)
 
 @implementation EditingDelegate
 
+- (id)init
+{
+    self = [super init];
+    if (!self)
+        return nil;
+    acceptsEditing = YES;
+    return self;
+}
+
 - (BOOL)webView:(WebView *)webView shouldBeginEditingInDOMRange:(DOMRange *)range
 {
     printf("EDITING DELEGATE: shouldBeginEditingInDOMRange:%s\n", [[range dump] UTF8String]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (BOOL)webView:(WebView *)webView shouldEndEditingInDOMRange:(DOMRange *)range
 {
     printf("EDITING DELEGATE: shouldEndEditingInDOMRange:%s\n", [[range dump] UTF8String]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (BOOL)webView:(WebView *)webView shouldInsertNode:(DOMNode *)node replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action
@@ -82,7 +91,7 @@
     };
 
     printf("EDITING DELEGATE: shouldInsertNode:%s replacingDOMRange:%s givenAction:%s\n", [[node dumpPath] UTF8String], [[range dump] UTF8String], insertactionstring[action]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (BOOL)webView:(WebView *)webView shouldInsertText:(NSString *)text replacingDOMRange:(DOMRange *)range givenAction:(WebViewInsertAction)action
     };
 
     printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:%s givenAction:%s\n", [[text description] UTF8String], [[range dump] UTF8String], insertactionstring[action]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (BOOL)webView:(WebView *)webView shouldDeleteDOMRange:(DOMRange *)range
 {
     printf("EDITING DELEGATE: shouldDeleteDOMRange:%s\n", [[range dump] UTF8String]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (BOOL)webView:(WebView *)webView shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(NSSelectionAffinity)selectionAffinity stillSelecting:(BOOL)flag
     };
 
     printf("EDITING DELEGATE: shouldChangeSelectedDOMRange:%s toDOMRange:%s affinity:%s stillSelecting:%s\n", [[currentRange dump] UTF8String], [[proposedRange dump] UTF8String], affinitystring[selectionAffinity], boolstring[flag]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (BOOL)webView:(WebView *)webView shouldApplyStyle:(DOMCSSStyleDeclaration *)style toElementsInDOMRange:(DOMRange *)range
 {
     printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:%s\n", [[style description] UTF8String], [[range dump] UTF8String]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (BOOL)webView:(WebView *)webView shouldChangeTypingStyle:(DOMCSSStyleDeclaration *)currentStyle toStyle:(DOMCSSStyleDeclaration *)proposedStyle
 {
     printf("EDITING DELEGATE: shouldChangeTypingStyle:%s toStyle:%s\n", [[currentStyle description] UTF8String], [[proposedStyle description] UTF8String]);
-    return YES;
+    return acceptsEditing;
 }
 
 - (void)webViewDidBeginEditing:(NSNotification *)notification
         printf("EDITING DELEGATE: webViewDidChangeSelection:%s\n", [[notification name] UTF8String]);
 }
 
+- (void)setAcceptsEditing:(BOOL)newAcceptsEditing
+{
+    acceptsEditing = newAcceptsEditing;
+}
+
 @end