Title: [87248] trunk
Revision
87248
Author
[email protected]
Date
2011-05-24 18:26:53 -0700 (Tue, 24 May 2011)

Log Message

2011-05-24  Leo Yang  <[email protected]>

        Reviewed by Ryosuke Niwa.

        [SVG] Assertion failure by dragging text between input fields inside <foreignObject>s
        https://bugs.webkit.org/show_bug.cgi?id=60692

        Add NULL check of 'holder' in WebCore::ReplacementFragment::ReplacementFragment()
        before call VisibleSelection::selectionFromContentsOfNode() to prevent crashing.

        Test: editing/pasteboard/drag-drop-input-in-svg.svg

        * editing/ReplaceSelectionCommand.cpp:
        (WebCore::ReplacementFragment::ReplacementFragment):
2011-05-24  Leo Yang  <[email protected]>

        Reviewed by Ryosuke Niwa.

        [SVG] Assertion failure by dragging text between input fields inside <foreignObject>s
        https://bugs.webkit.org/show_bug.cgi?id=60692

        Test case to verify dragging and dropping text between input fields
        inside SVG <foreignObject>s. Test passes if no crash occurs in debug mode.

        Drag and drop is not supported in Qt DRT, so skip this case on Qt platform.

        * editing/pasteboard/drag-drop-input-in-svg-expected.txt: Added.
        * editing/pasteboard/drag-drop-input-in-svg.svg: Added.
        * platform/qt/Skipped:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (87247 => 87248)


--- trunk/LayoutTests/ChangeLog	2011-05-25 01:05:21 UTC (rev 87247)
+++ trunk/LayoutTests/ChangeLog	2011-05-25 01:26:53 UTC (rev 87248)
@@ -1,3 +1,19 @@
+2011-05-24  Leo Yang  <[email protected]>
+
+        Reviewed by Ryosuke Niwa.
+
+        [SVG] Assertion failure by dragging text between input fields inside <foreignObject>s
+        https://bugs.webkit.org/show_bug.cgi?id=60692
+
+        Test case to verify dragging and dropping text between input fields
+        inside SVG <foreignObject>s. Test passes if no crash occurs in debug mode.
+
+        Drag and drop is not supported in Qt DRT, so skip this case on Qt platform.
+
+        * editing/pasteboard/drag-drop-input-in-svg-expected.txt: Added.
+        * editing/pasteboard/drag-drop-input-in-svg.svg: Added.
+        * platform/qt/Skipped:
+
 2011-05-24  Ryosuke Niwa  <[email protected]>
 
         Yet another attempt to make Chromium Windows test bots happy.

Added: trunk/LayoutTests/editing/pasteboard/drag-drop-input-in-svg-expected.txt (0 => 87248)


--- trunk/LayoutTests/editing/pasteboard/drag-drop-input-in-svg-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-input-in-svg-expected.txt	2011-05-25 01:26:53 UTC (rev 87248)
@@ -0,0 +1 @@
+PASS without crash in Debug mode.

Added: trunk/LayoutTests/editing/pasteboard/drag-drop-input-in-svg.svg (0 => 87248)


--- trunk/LayoutTests/editing/pasteboard/drag-drop-input-in-svg.svg	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-drop-input-in-svg.svg	2011-05-25 01:26:53 UTC (rev 87248)
@@ -0,0 +1,41 @@
+<?xml version="1.0"?>
+<svg xmlns="http://www.w3.org/2000/svg"
+     xmlns:xlink="http://www.w3.org/1999/xlink"
+     xmlns:xhtml="http://www.w3.org/1999/xhtml">
+<foreignObject width="200" height="80">
+    <xhtml:div>
+        <xhtml:input id="src" type="text" value="Select and drag this text"></xhtml:input>
+        <xhtml:input id="dst" type="text" value="to here"></xhtml:input>
+    </xhtml:div>
+</foreignObject>
+<text>PASS without crash in Debug mode.</text>
+<script>
+(function runTest()
+{
+    if (!window.layoutTestController)
+        return;
+
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+
+    var sourceInput = document.getElementById("src");
+    sourceInput.focus();
+    sourceInput.setSelectionRange(0, 6);
+    var x = sourceInput.offsetLeft + 10;
+    var y = sourceInput.offsetTop + sourceInput.offsetHeight / 2;
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+
+    eventSender.leapForward(500);
+
+    var destinationInput = document.getElementById("dst");
+    eventSender.mouseMoveTo(destinationInput.offsetLeft + 10, destinationInput.offsetTop + destinationInput.offsetHeight / 2);
+    eventSender.mouseUp();
+
+    sourceInput.parentNode.removeChild(sourceInput);
+    destinationInput.parentNode.removeChild(destinationInput);
+
+    layoutTestController.notifyDone();
+})();
+</script>
+</svg>

Modified: trunk/LayoutTests/platform/qt/Skipped (87247 => 87248)


--- trunk/LayoutTests/platform/qt/Skipped	2011-05-25 01:05:21 UTC (rev 87247)
+++ trunk/LayoutTests/platform/qt/Skipped	2011-05-25 01:26:53 UTC (rev 87248)
@@ -144,6 +144,7 @@
 editing/pasteboard/copy-standalone-image.html
 editing/pasteboard/drag-drop-dead-frame.html
 editing/pasteboard/drag-drop-input-textarea.html
+editing/pasteboard/drag-drop-input-in-svg.svg
 editing/pasteboard/drag-drop-iframe-refresh-crash.html
 editing/pasteboard/drag-drop-modifies-page.html
 editing/pasteboard/drag-drop-url-text.html

Modified: trunk/Source/WebCore/ChangeLog (87247 => 87248)


--- trunk/Source/WebCore/ChangeLog	2011-05-25 01:05:21 UTC (rev 87247)
+++ trunk/Source/WebCore/ChangeLog	2011-05-25 01:26:53 UTC (rev 87248)
@@ -1,3 +1,18 @@
+2011-05-24  Leo Yang  <[email protected]>
+
+        Reviewed by Ryosuke Niwa.
+
+        [SVG] Assertion failure by dragging text between input fields inside <foreignObject>s
+        https://bugs.webkit.org/show_bug.cgi?id=60692
+
+        Add NULL check of 'holder' in WebCore::ReplacementFragment::ReplacementFragment()
+        before call VisibleSelection::selectionFromContentsOfNode() to prevent crashing.
+
+        Test: editing/pasteboard/drag-drop-input-in-svg.svg
+
+        * editing/ReplaceSelectionCommand.cpp:
+        (WebCore::ReplacementFragment::ReplacementFragment):
+
 2011-05-24  Andy Estes  <[email protected]>
 
         Reviewed by Geoffrey Garen.

Modified: trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp (87247 => 87248)


--- trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-05-25 01:05:21 UTC (rev 87247)
+++ trunk/Source/WebCore/editing/ReplaceSelectionCommand.cpp	2011-05-25 01:26:53 UTC (rev 87248)
@@ -156,6 +156,10 @@
 
     Node* styleNode = selection.base().deprecatedNode();
     RefPtr<StyledElement> holder = insertFragmentForTestRendering(styleNode);
+    if (!holder) {
+        removeInterchangeNodes(m_fragment.get());
+        return;
+    }
     
     RefPtr<Range> range = VisibleSelection::selectionFromContentsOfNode(holder.get()).toNormalizedRange();
     String text = plainText(range.get());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to