Title: [168460] trunk
- Revision
- 168460
- Author
- mmaxfi...@apple.com
- Date
- 2014-05-07 19:51:55 -0700 (Wed, 07 May 2014)
Log Message
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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (168459 => 168460)
--- trunk/LayoutTests/ChangeLog 2014-05-08 02:35:22 UTC (rev 168459)
+++ trunk/LayoutTests/ChangeLog 2014-05-08 02:51:55 UTC (rev 168460)
@@ -1,3 +1,16 @@
+2014-05-06 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ 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.
+
+ 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.
+
2014-05-07 Dean Jackson <d...@apple.com>
Using a fill pattern much larger than actual canvas reliably segfaults browser
Added: trunk/LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher-expected.txt (0 => 168460)
--- trunk/LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher-expected.txt 2014-05-08 02:51:55 UTC (rev 168460)
@@ -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>"
Added: trunk/LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher.html (0 => 168460)
--- trunk/LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-paragraph-crasher.html 2014-05-08 02:51:55 UTC (rev 168460)
@@ -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=""
+<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>
Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (168459 => 168460)
--- trunk/LayoutTests/platform/mac-wk2/TestExpectations 2014-05-08 02:35:22 UTC (rev 168459)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations 2014-05-08 02:51:55 UTC (rev 168460)
@@ -114,6 +114,7 @@
platform/mac/editing/pasteboard/dataTransfer-set-data-file-url.html
platform/mac/editing/pasteboard/drag-selections-to-contenteditable.html
platform/mac/fast/forms/listbox-scrollbar-hit-test.html
+editing/pasteboard/drag-drop-paragraph-crasher.html
# [WK2] [Mac] Spellcheck tests don't seem to work
webkit.org/b/105616 editing/spelling/context-menu-suggestions-multiword-selection.html
Modified: trunk/Source/WebCore/ChangeLog (168459 => 168460)
--- trunk/Source/WebCore/ChangeLog 2014-05-08 02:35:22 UTC (rev 168459)
+++ trunk/Source/WebCore/ChangeLog 2014-05-08 02:51:55 UTC (rev 168460)
@@ -1,3 +1,21 @@
+2014-05-06 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ 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.
+
+ 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):
+
2014-05-07 Gyuyoung Kim <gyuyoung....@samsung.com>
[CoordinatedGraphics][WK2] Scale factor and scroll position is not being restored properly in a back/forward load
Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (168459 => 168460)
--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2014-05-08 02:35:22 UTC (rev 168459)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp 2014-05-08 02:51:55 UTC (rev 168460)
@@ -629,8 +629,11 @@
continue;
if (isProhibitedParagraphChild(toHTMLElement(node.get())->localName())) {
- if (auto* paragraphElement = enclosingElementWithTag(positionInParentBeforeNode(node.get()), pTag))
- moveNodeOutOfAncestor(node, paragraphElement);
+ if (auto* paragraphElement = enclosingElementWithTag(positionInParentBeforeNode(node.get()), pTag)) {
+ auto* parent = paragraphElement->parentNode();
+ if (parent && parent->hasEditableStyle())
+ moveNodeOutOfAncestor(node, paragraphElement);
+ }
}
if (isHeaderElement(node.get())) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes