Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r168460 - Dragging text from one paragraph to another does not …
…render as expected https://bugs.webkit.org/show_bug.cgi?id=132633 Reviewed by Darin Adler and Ryosuke Niwa. Source/WebCore: When we are dragging and dropping into a content editable field, we detect if we are trying to put a <p> into an existing <p>, and if so, split the outer <p> and insert the new <p> as its sibling. However, the outer <p> might not be editable, so we don't want to do any splitting and inserting at that location. Test: editing/pasteboard/drag-drop-paragraph-crasher.html * editing/ReplaceSelectionCommand.cpp: (WebCore::ReplaceSelectionCommand::makeInsertedContentRoundTrippableWithHTMLTreeBuilder): LayoutTests: The problem occurs when dragging text that includes a <p> into an editable area that has a <p> as a parent. * editing/pasteboard/drag-drop-paragraph-crasher-expected.txt: Added. * editing/pasteboard/drag-drop-paragraph-crasher.html: Added.
- Loading branch information
1 parent
9048f58
commit 9b889e7
Showing
6 changed files
with
76 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
This tests text selection drag including a <p> tag, where its parent <p> tag is not editable. | ||
| "and drag it here<#selection-anchor>Select" | ||
| <p> | ||
| "me<#selection-focus>" |
35 changes: 35 additions & 0 deletions
35
LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<html> | ||
<body> | ||
<p>This tests text selection drag including a <p> tag, where its parent <p> tag is not editable.</p> | ||
To test this by hand, select the relevant text in this editable span: | ||
<div id=source>Select | ||
<p>me</p> | ||
</div> | ||
<p id=destination contenteditable>and drag it here</p> | ||
<br><br>If there is no crash, then the test passed. | ||
<script src="../../resources/dump-as-markup.js"></script> | ||
<script> | ||
function selectAllOfSource() { | ||
var selection = window.getSelection(); | ||
var range = document.createRange(); | ||
range.selectNodeContents(document.getElementById("source")); | ||
selection.removeAllRanges(); | ||
selection.addRange(range); | ||
} | ||
if (window.testRunner) { | ||
Markup.description(document.querySelector('p').innerText); | ||
selectAllOfSource(); | ||
|
||
eventSender.mouseMoveTo(source.offsetLeft + 10, source.offsetTop + source.offsetHeight / 2); | ||
eventSender.mouseDown(); | ||
var destination = document.getElementById("destination"); | ||
eventSender.leapForward(500); | ||
eventSender.mouseMoveTo(destination.offsetLeft + 700, destination.offsetTop + destination.offsetHeight / 2); | ||
eventSender.mouseUp(); | ||
|
||
Markup.dump("destination"); | ||
} else | ||
Markup.noAutoDump(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters