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
+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.
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
+++ /dev/null
-a9623e42aa66f7af5e819126c031b3d0
\ No newline at end of file
+++ /dev/null
-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
+++ /dev/null
-<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
=== 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
- (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
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
- (BOOL)maintainsInactiveSelection
{
- return NO;
+ return [self isEditable];
}
- (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity