Reviewed by john
* editing/pasteboard/subframe-dragndrop-1-expected.checksum: Added.
* editing/pasteboard/subframe-dragndrop-1-expected.png: Added.
* editing/pasteboard/subframe-dragndrop-1-expected.txt: Added.
* editing/pasteboard/subframe-dragndrop-1.html: Added.
WebCore:
Reviewed by john
<http://bugzilla.opendarwin.org/show_bug.cgi?id=7165>
TinyMCE: Dragging & dropping content always leaves a copy when editing inside a subframe
* editing/MoveSelectionCommand.cpp:
(WebCore::MoveSelectionCommand::MoveSelectionCommand): Set the document
to the position-to-move-to's document, not the fragment's document. The
fragment's document is the document used to create the fragment and is irrelavant.
WebKit:
Reviewed by john
<http://bugzilla.opendarwin.org/show_bug.cgi?id=7165>
TinyMCE: Dragging & dropping content always leaves a copy when editing inside a subframe
The top level WebHTMLView is responsible for performing dragging operations, but
the inner view, the view that holds the drag caret, should be consulted to determine
if the drag is a move drag.
* WebCoreSupport/WebFrameBridge.m:
(-[WebFrameBridge startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
* WebKit.xcodeproj/project.pbxproj:
* WebView/WebHTMLView.m:
(-[NSArray dragImage:at:offset:event:pasteboard:source:slideBack:]): Don't set initatedDrag here, because
it's only the top level WebHTMLView that performs this operation.
(-[WebHTMLView _setInitiatedDrag:]): Added.
(-[WebHTMLView _initiatedDrag]): Ditto.
(-[WebHTMLView _canProcessDragWithDraggingInfo:]): Ask the innerView if it initiated the drag,
not the top level view.
(-[WebHTMLView _isMoveDrag]): The top level view asks the innerView if it should perform
a move drag, so don't ASSERT _isTopHTMLView.
(-[WebHTMLView draggingUpdatedWithDraggingInfo:actionMask:]): Ask the innerView if _isMoveDrag.
(-[WebHTMLView concludeDragForDraggingInfo:actionMask:]): Ditto.
* WebView/WebHTMLViewInternal.h: Added two private SPI so that
the top level WebHTMLView can set and get the initiatedDrag BOOL.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16500
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2006-09-20 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by john
+
+ * editing/pasteboard/subframe-dragndrop-1-expected.checksum: Added.
+ * editing/pasteboard/subframe-dragndrop-1-expected.png: Added.
+ * editing/pasteboard/subframe-dragndrop-1-expected.txt: Added.
+ * editing/pasteboard/subframe-dragndrop-1.html: Added.
+
2006-09-20 Rob Buis <buis@kde.org>
Reviewed by eseidel.
* svg/W3C-SVG-1.1/painting-marker-02-f-expected.checksum:
* svg/W3C-SVG-1.1/painting-marker-02-f-expected.png:
* svg/custom/invalid-css-expected.txt:
-
+
2006-09-20 Julien Palmas <julien.palmas@gmail.com>
Reviewed by eseidel. Landed by eseidel.
--- /dev/null
+2a7b32ad6cb0b2b7231c0956bcbc5a24
\ No newline at end of file
--- /dev/null
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 0 of BODY > HTML > #document to 0 of BODY > HTML > #document toDOMRange:range from 11 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of BODY > HTML > #document to 2 of BODY > HTML > #document
+EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 11 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document toDOMRange:range from 6 of #text > BODY > HTML > #document to 6 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 6 of #text > BODY > HTML > #document to 6 of #text > BODY > HTML > #document toDOMRange:range from 4 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: shouldInsertNode:#document-fragment replacingDOMRange:range from 11 of #text > BODY > HTML > #document to 11 of #text > BODY > HTML > #document givenAction:WebViewInsertActionDropped
+EDITING DELEGATE: shouldChangeSelectedDOMRange:range from 4 of #text > BODY > HTML > #document to 7 of #text > BODY > HTML > #document toDOMRange:range from 0 of #text > BODY > HTML > #document to 4 of #text > BODY > HTML > #document affinity:NSSelectionAffinityDownstream stillSelecting:FALSE
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+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 (0,0) size 800x584
+ RenderBlock (anonymous) at (0,0) size 800x300
+ RenderPartObject {IFRAME} at (0,0) size 300x300
+ layer at (0,0) size 300x300
+ RenderView at (0,0) size 300x300
+ layer at (0,0) size 300x300
+ RenderBlock {HTML} at (0,0) size 300x300
+ RenderBody {BODY} at (8,8) size 284x284 [bgcolor=#FFFFE0]
+ RenderText {#text} at (0,0) size 47x18
+ text run at (0,0) width 47: "foo baz"
+ RenderText {#text} at (47,0) size 24x18
+ text run at (47,0) width 24: " bar"
+ RenderText {#text} at (0,0) size 0x0
+ RenderBlock {P} at (0,316) size 800x36
+ RenderText {#text} at (0,0) size 795x36
+ text run at (0,0) width 795: "This test uses the eventSender to do drag and drop. To run it manually, drag the word selected in the above subframe and drop"
+ text run at (0,18) width 80: "it after 'baz'. "
+ text run at (80,18) width 213: "The result should be 'foo baz bar'."
--- /dev/null
+<body style="margin: 0px; padding: 0px;">
+<iframe style="margin: 0; padding: 0; height: 300px; width: 300px;" src="../resources/contenteditable-iframe-src.html"></iframe>
+<p>This test uses the eventSender to do drag and drop. To run it manually, drag the word selected in the above subframe and drop it after 'baz'. The result should be 'foo baz bar'.</p>
+<script>
+function runTest() {
+ var frame = frames[0];
+ var doc = frame.document;
+ var sel = frame.getSelection();
+ sel.setPosition(doc.body, 0);
+ doc.execCommand("InsertText", false, "foo bar baz");
+
+ if (window.layoutTestController) {
+ // Attempt to put the mouse over the word 'bar'. The proper way to do this
+ // would be to put 'bar' inside an id'd span so that we'd know it's coordinates exactly.
+ var x = 50;
+ var y = 15;
+ eventSender.mouseMoveTo(x, y);
+
+ // Select 'bar'
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+
+ // Pause so that the mouse down will start a drag instead of a triple click.
+ eventSender.leapForward(1500);
+
+ eventSender.mouseDown();
+ eventSender.leapForward(1000);
+
+ x += 100;
+ // Drop it like it's hot.
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseUp();
+
+ window.layoutTestController.notifyDone();
+ }
+}
+if (window.layoutTestController)
+ window.layoutTestController.waitUntilDone();
+// Give the subframe a moment to load.
+window.setTimeout(runTest, 100);
+</script>
+</body>
\ No newline at end of file
+2006-09-20 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by john
+
+ <http://bugzilla.opendarwin.org/show_bug.cgi?id=7165>
+ TinyMCE: Dragging & dropping content always leaves a copy when editing inside a subframe
+
+ * editing/MoveSelectionCommand.cpp:
+ (WebCore::MoveSelectionCommand::MoveSelectionCommand): Set the document
+ to the position-to-move-to's document, not the fragment's document. The
+ fragment's document is the document used to create the fragment and is irrelavant.
+
2006-09-21 Brady Eidson <beidson@apple.com>
Reviewed by Anders
namespace WebCore {
MoveSelectionCommand::MoveSelectionCommand(PassRefPtr<DocumentFragment> fragment, const Position& position, bool smartMove)
- : CompositeEditCommand(fragment->document()), m_fragment(fragment), m_position(position), m_smartMove(smartMove)
+ : CompositeEditCommand(position.node()->document()), m_fragment(fragment), m_position(position), m_smartMove(smartMove)
{
ASSERT(m_fragment);
}
+2006-09-20 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by john
+
+ <http://bugzilla.opendarwin.org/show_bug.cgi?id=7165>
+ TinyMCE: Dragging & dropping content always leaves a copy when editing inside a subframe
+
+ The top level WebHTMLView is responsible for performing dragging operations, but
+ the inner view, the view that holds the drag caret, should be consulted to determine
+ if the drag is a move drag.
+
+ * WebCoreSupport/WebFrameBridge.m:
+ (-[WebFrameBridge startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebView/WebHTMLView.m:
+ (-[NSArray dragImage:at:offset:event:pasteboard:source:slideBack:]): Don't set initatedDrag here, because
+ it's only the top level WebHTMLView that performs this operation.
+ (-[WebHTMLView _setInitiatedDrag:]): Added.
+ (-[WebHTMLView _initiatedDrag]): Ditto.
+ (-[WebHTMLView _canProcessDragWithDraggingInfo:]): Ask the innerView if it initiated the drag,
+ not the top level view.
+ (-[WebHTMLView _isMoveDrag]): The top level view asks the innerView if it should perform
+ a move drag, so don't ASSERT _isTopHTMLView.
+ (-[WebHTMLView draggingUpdatedWithDraggingInfo:actionMask:]): Ask the innerView if _isMoveDrag.
+ (-[WebHTMLView concludeDragForDraggingInfo:actionMask:]): Ditto.
+ * WebView/WebHTMLViewInternal.h: Added two private SPI so that
+ the top level WebHTMLView can set and get the initiatedDrag BOOL.
+
2006-09-20 Brady Eidson <beidson@apple.com>
Reviewed by Tim Omernick
{
WebHTMLView *docView = (WebHTMLView *)[[_frame frameView] documentView];
ASSERT([docView isKindOfClass:[WebHTMLView class]]);
+ [docView _setInitiatedDrag:YES];
return [docView _startDraggingImage:dragImage at:dragLoc operation:op event:event sourceIsDHTML:flag DHTMLWroteData:dhtmlWroteData];
}
}
WebView *webView = [self _webView];
-
- _private->initiatedDrag = YES;
+
[webView _setInitiatedDrag:YES];
// Retain this view during the drag because it may be released before the drag ends.
return [_private->dataSource webFrame];
}
+- (void)_setInitiatedDrag:(BOOL)flag
+{
+ _private->initiatedDrag = flag;
+}
+
+- (BOOL)_initiatedDrag
+{
+ return _private->initiatedDrag;
+}
+
@end
@implementation WebHTMLView (WebNSTextInputSupport)
NSPoint point = [self convertPoint:[draggingInfo draggingLocation] fromView:nil];
NSDictionary *element = [self elementAtPoint:point allowShadowContent:YES];
- if ([[self _webView] isEditable] || [[element objectForKey:WebElementDOMNodeKey] isContentEditable]) {
+ ASSERT(element);
+ WebFrame *innerFrame = (WebFrame *)[element objectForKey:WebElementFrameKey];
+ ASSERT(innerFrame);
+ ASSERT([innerFrame isKindOfClass:[WebFrame class]]);
+ WebHTMLView* innerView = (WebHTMLView *)[[innerFrame frameView] documentView];
+ if ([[element objectForKey:WebElementDOMNodeKey] isContentEditable]) {
// Can't drag onto the selection being dragged.
- if (_private->initiatedDrag && [[element objectForKey:WebElementIsSelectedKey] boolValue])
+ if ([innerView _initiatedDrag] && [[element objectForKey:WebElementIsSelectedKey] boolValue])
return NO;
return YES;
}
- (BOOL)_isMoveDrag
{
- ASSERT([self _isTopHTMLView]);
return _private->initiatedDrag
- && [self _isEditable] && [self _hasSelection]
+ && [[self _bridge] isSelectionEditable]
&& !([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask);
}
else {
WebView *webView = [self _webView];
[webView moveDragCaretToPoint:[webView convertPoint:[draggingInfo draggingLocation] fromView:nil]];
- operation = [self _isMoveDrag] ? NSDragOperationMove : NSDragOperationCopy;
+ NSPoint point = [self convertPoint:[draggingInfo draggingLocation] fromView:nil];
+ NSDictionary *element = [self elementAtPoint:point allowShadowContent:YES];
+ ASSERT(element);
+ WebFrame *innerFrame = (WebFrame *)[element objectForKey:WebElementFrameKey];
+ ASSERT(innerFrame);
+ ASSERT([innerFrame isKindOfClass:[WebFrame class]]);
+ WebHTMLView* innerView = (WebHTMLView *)[[innerFrame frameView] documentView];
+ operation = [innerView _isMoveDrag] ? NSDragOperationMove : NSDragOperationCopy;
}
} else
[[self _webView] removeDragCaret];
WebFrame *innerFrame = (WebFrame *)[element objectForKey:WebElementFrameKey];
ASSERT(innerFrame);
ASSERT([innerFrame isKindOfClass:[WebFrame class]]);
+ WebHTMLView* innerView = (WebHTMLView *)[[innerFrame frameView] documentView];
WebFrameBridge *innerBridge = [innerFrame _bridge];
if ([self _isNSColorDrag:draggingInfo]) {
BOOL didInsert = NO;
if ([self _canProcessDragWithDraggingInfo:draggingInfo]) {
NSPasteboard *pasteboard = [draggingInfo draggingPasteboard];
- if ([self _isMoveDrag] || [innerBridge isDragCaretRichlyEditable]) {
+ if ([innerView _isMoveDrag] || [innerBridge isDragCaretRichlyEditable]) {
DOMRange *range = [innerBridge dragCaretDOMRange];
BOOL chosePlainText;
DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard
inContext:range allowPlainText:YES chosePlainText:&chosePlainText];
if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionDropped]) {
[[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
- if ([self _isMoveDrag]) {
+ if ([innerView _isMoveDrag]) {
BOOL smartMove = [innerBridge selectionGranularity] == WebBridgeSelectByWord && [self _canSmartReplaceWithPasteboard:pasteboard];
[innerBridge moveSelectionToDragCaret:fragment smartMove:smartMove];
} else {
- (void)_willMakeFirstResponderForNodeFocus;
- (id<WebHTMLHighlighter>)_highlighterForType:(NSString*)type;
- (WebFrame *)_frame;
+- (void)_setInitiatedDrag:(BOOL)flag;
+- (BOOL)_initiatedDrag;
@end