LayoutTests:
authorthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Jul 2006 02:25:38 +0000 (02:25 +0000)
committerthatcher <thatcher@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Jul 2006 02:25:38 +0000 (02:25 +0000)
        Rolling out this fix from r15358 since it isn't resolved.

    2006-07-11  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by levi & thatcher

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9642>
        GMail Editor: Operations that use drop down menus blow away the selection

        * editing/selection/drag-to-contenteditable-iframe-expected.txt:
        * editing/selection/subframe-with-selection-expected.checksum: Added.
        * editing/selection/subframe-with-selection-expected.png: Added.
        * editing/selection/subframe-with-selection-expected.txt: Added.
        * editing/selection/subframe-with-selection.html: Added.

WebKit:

        Rolling out this fix from r15358 since it isn't resolved.

    2006-07-11  Justin Garcia  <justin.garcia@apple.com>

        Reviewed by levi & thatcher

        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9642>
        GMail Editor: Operations that use drop down menus blow away the selection

        * WebView/WebHTMLView.m:
        (-[NSArray maintainsInactiveSelection]): Maintain an inactive selection
        when resigning as first responder if the selection is editable
        or if the WebView tells us to.
        * WebView/WebView.m:
        (-[WebView maintainsInactiveSelection]): Just because a WebView is
        editable doesn't mean selections inside subframes will be.  Return
        NO by default.

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

LayoutTests/ChangeLog
LayoutTests/editing/selection/drag-to-contenteditable-iframe-expected.txt
LayoutTests/editing/selection/subframe-with-selection-expected.checksum [deleted file]
LayoutTests/editing/selection/subframe-with-selection-expected.png [deleted file]
LayoutTests/editing/selection/subframe-with-selection-expected.txt [deleted file]
LayoutTests/editing/selection/subframe-with-selection.html [deleted file]
WebKit/ChangeLog
WebKit/WebView/WebHTMLView.m
WebKit/WebView/WebView.m

index 038ba3ed5fbe43ad0bd6f514becded93979b396b..7307277bf3514a6b0520ea33643b2049215440b3 100644 (file)
@@ -1,3 +1,20 @@
+2006-07-14  Timothy Hatcher  <timothy@apple.com>
+        Rolling out this fix from r15358 since it isn't resolved.
+
+    2006-07-11  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by levi & thatcher
+
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9642>
+        GMail Editor: Operations that use drop down menus blow away the selection
+
+        * editing/selection/drag-to-contenteditable-iframe-expected.txt:
+        * editing/selection/subframe-with-selection-expected.checksum: Added.
+        * editing/selection/subframe-with-selection-expected.png: Added.
+        * editing/selection/subframe-with-selection-expected.txt: Added.
+        * editing/selection/subframe-with-selection.html: Added.
+
 2006-07-14  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Darin.
index e198bacb2b09e39135bd3e26149a3ac560c44a3e..976fdcd71c51c0963ccc351c977e426045f16028 100644 (file)
@@ -3,8 +3,6 @@ EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of IFRAME > BODY > H
 EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 5 of BODY > HTML > #document
 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
-EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of BODY > HTML > #document to 3 of BODY > HTML > #document
-EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
 EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 1 of IFRAME > BODY > HTML > #document to 1 of IFRAME > BODY > HTML > #document toDOMRange:range from 1 of IFRAME > BODY > HTML > #document to 1 of IFRAME > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document givenAction:WebViewInsertActionDropped
diff --git a/LayoutTests/editing/selection/subframe-with-selection-expected.checksum b/LayoutTests/editing/selection/subframe-with-selection-expected.checksum
deleted file mode 100644 (file)
index fc1c808..0000000
+++ /dev/null
@@ -1 +0,0 @@
-a9623e42aa66f7af5e819126c031b3d0
\ No newline at end of file
diff --git a/LayoutTests/editing/selection/subframe-with-selection-expected.png b/LayoutTests/editing/selection/subframe-with-selection-expected.png
deleted file mode 100644 (file)
index 569ad4d..0000000
Binary files a/LayoutTests/editing/selection/subframe-with-selection-expected.png and /dev/null differ
diff --git a/LayoutTests/editing/selection/subframe-with-selection-expected.txt b/LayoutTests/editing/selection/subframe-with-selection-expected.txt
deleted file mode 100644 (file)
index 0f89c2f..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 1 of BODY > HTML > #document
-EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:(null) toDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document toDOMRange:range from 12 of #text > BODY > HTML > #document to 12 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: shouldEndEditingInDOMRange:range from 0 of BODY > HTML > #document to 2 of BODY > HTML > #document
-EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification
-layer at (0,0) size 800x600
-  RenderView at (0,0) size 800x600
-layer at (0,0) size 800x600
-  RenderBlock {HTML} at (0,0) size 800x600
-    RenderBody {BODY} at (8,8) size 784x584
-      RenderBlock {P} at (0,0) size 784x36
-        RenderText {#text} at (0,0) size 734x36
-          text run at (0,0) width 650: "This test sets an editable selection inside a subframe and then makes the main frame the first responder. "
-          text run at (650,0) width 84: "The selection"
-          text run at (0,18) width 162: "shouldn't be blown away."
-      RenderBlock (anonymous) at (0,52) size 784x150
-        RenderPartObject {IFRAME} at (0,0) size 300x150
-          layer at (0,0) size 300x150
-            RenderView at (0,0) size 300x150
-          layer at (0,0) size 300x150
-            RenderBlock {HTML} at (0,0) size 300x150
-              RenderBody {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
-                RenderText {#text} at (0,0) size 81x18
-                  text run at (0,0) width 81: "Hello world!"
-        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/editing/selection/subframe-with-selection.html b/LayoutTests/editing/selection/subframe-with-selection.html
deleted file mode 100644 (file)
index a3ae82b..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<p>This test sets an editable selection inside a subframe and then makes the main frame the first responder.  The selection shouldn't be blown away.</p>
-<iframe src="../resources/contenteditable-iframe-src.html"></iframe>
-<script>
-
-function foo() {
-    var f = frames[0];
-    var s = f.getSelection();
-    var d = f.document;
-    
-    eventSender.mouseMoveTo(100, 100);
-    eventSender.mouseDown();
-    eventSender.mouseUp();
-    
-    d.execCommand("InsertText", false, "Hello world!");
-    s.modify("extend", "backward", "word");
-    
-    window.layoutTestController.setMainFrameIsFirstResponder(true);
-    
-    window.layoutTestController.notifyDone();
-}
-
-if (window.layoutTestController) {
-    window.layoutTestController.waitUntilDone();
-    
-    window.setTimeout(foo, 200);    
-}
-
-</script>
\ No newline at end of file
index 9aabdec34c322a41633e8151894b0ad9249f9f64..c0f6639c79ccc2987e5230f9d1b3dffc6fe586b5 100644 (file)
@@ -1,5 +1,25 @@
 === Safari-521.17 ===
 
+2006-07-14  Timothy Hatcher  <timothy@apple.com>
+
+        Rolling out this fix from r15358 since it isn't resolved.
+
+    2006-07-11  Justin Garcia  <justin.garcia@apple.com>
+
+        Reviewed by levi & thatcher
+
+        <http://bugzilla.opendarwin.org/show_bug.cgi?id=9642>
+        GMail Editor: Operations that use drop down menus blow away the selection
+
+        * WebView/WebHTMLView.m:
+        (-[NSArray maintainsInactiveSelection]): Maintain an inactive selection
+        when resigning as first responder if the selection is editable
+        or if the WebView tells us to.
+        * WebView/WebView.m:
+        (-[WebView maintainsInactiveSelection]): Just because a WebView is
+        editable doesn't mean selections inside subframes will be.  Return
+        NO by default.
+
 2006-07-14  Timothy Hatcher  <timothy@apple.com>
 
         <rdar://problem/4623957> SWB: gcc-5412 (new?) objc warning causes WebCore project failure
index 056eb0b57eb059eac022f74903ab0421397a27f4..04f057a6375e96f62b42b304990ebcdb52fb1f86 100644 (file)
@@ -2239,14 +2239,21 @@ static WebHTMLView *lastHitView = nil;
 
 - (BOOL)maintainsInactiveSelection
 {
-    // This method helps to determine whether the WebHTMLView should maintain
-    // an inactive selection when it's not first responder.
+    // This method helps to determing whether the view should maintain
+    // an inactive selection when the view is not first responder.
     // Traditionally, these views have not maintained such selections,
     // clearing them when the view was not first responder. However,
     // to fix bugs like this one:
     // <rdar://problem/3672088>: "Editable WebViews should maintain a selection even 
     //                            when they're not firstResponder"
     // it was decided to add a switch to act more like an NSTextView.
+    // For now, however, the view only acts in this way when the
+    // web view is set to be editable. This will maintain traditional
+    // behavior for WebKit clients dating back to before this change,
+    // and will likely be a decent switch for the long term, since
+    // clients to ste the web view to be editable probably want it
+    // to act like a "regular" Cocoa view in terms of its selection
+    // behavior.
     id nextResponder = [[self window] _newFirstResponderAfterResigning];
 
     // Predict the case where we are losing first responder status only to
@@ -2267,7 +2274,15 @@ static WebHTMLView *lastHitView = nil;
     if (nextResponder == self)
         return YES;
 
-    return [[self _webView] maintainsInactiveSelection] || [[self _bridge] isSelectionEditable];
+    if (![[self _webView] maintainsInactiveSelection])
+        return NO;
+    
+    // editable views lose selection when losing first responder status
+    // to a widget in the same page, but not otherwise
+    BOOL loseSelection = [nextResponder isKindOfClass:[NSView class]]
+        && [nextResponder isDescendantOf:[self _webView]];
+
+    return !loseSelection;
 }
 
 - (void)addMouseMovedObserver
index 2ef7b8b73995938c7d1aaa3796b33e023aacdf99..d9dc425e5761a29421fe58d105c0d5f3ca892b63 100644 (file)
@@ -3048,7 +3048,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (BOOL)maintainsInactiveSelection
 {
-    return NO;
+    return [self isEditable];
 }
 
 - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity