Reviewed by Darin.
authorap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Dec 2007 06:13:40 +0000 (06:13 +0000)
committerap@webkit.org <ap@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 30 Dec 2007 06:13:40 +0000 (06:13 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=14428
        FCKEditor: Images disappear on drag/drop and copy/paste

        Test: editing/pasteboard/drag-image-in-about-blank-frame.html

        * editing/markup.cpp: (WebCore::createFragmentFromMarkup): Don't use "about:blank" as a
        base URL, just like we don't use an empty one.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@29034 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/editing/pasteboard/drag-image-in-about-blank-frame-expected.txt [new file with mode: 0644]
LayoutTests/editing/pasteboard/drag-image-in-about-blank-frame.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/editing/markup.cpp

index f8139a5..8d5000d 100644 (file)
@@ -1,3 +1,13 @@
+2007-12-29  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=14428
+        FCKEditor: Images disappear on drag/drop and copy/paste
+
+        * editing/pasteboard/drag-image-in-about-blank-frame-expected.txt: Added.
+        * editing/pasteboard/drag-image-in-about-blank-frame.html: Added.
+
 2007-12-28  Alexey Proskuryakov  <ap@webkit.org>
 
         Reviewed by Mitz.
diff --git a/LayoutTests/editing/pasteboard/drag-image-in-about-blank-frame-expected.txt b/LayoutTests/editing/pasteboard/drag-image-in-about-blank-frame-expected.txt
new file mode 100644 (file)
index 0000000..8ad048b
--- /dev/null
@@ -0,0 +1,3 @@
+Bug 14428: FCKEditor: Images disappear on drag/drop and copy/paste
+
+SUCCESS
diff --git a/LayoutTests/editing/pasteboard/drag-image-in-about-blank-frame.html b/LayoutTests/editing/pasteboard/drag-image-in-about-blank-frame.html
new file mode 100644 (file)
index 0000000..80d4f1d
--- /dev/null
@@ -0,0 +1,58 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.waitUntilDone();
+    layoutTestController.dumpAsText();
+}
+
+function log(message) {
+    var console = document.getElementById("console");
+    var li = document.createElement("li");
+    var text = document.createTextNode(message);
+    
+    console.appendChild(li);
+    li.appendChild(text);
+}
+
+function step1() {
+    window.frames[0].document.write("<div contenteditable>drag<img src='../resources/abe.png' id=dragme>me<span id=target>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></div>");
+    setTimeout("step2()", 100);
+}
+
+function step2() {
+    if (!window.layoutTestController) {
+        log("This test uses eventSender. To run it manually, drag the selected image to another position in the editable div and drop it. It should not disappear.");
+        return;
+    }
+    
+    var doc = window.frames[0].document;
+    e = doc.getElementById("dragme");
+    x = e.offsetLeft + e.offsetWidth / 2;
+    y = e.offsetTop + e.offsetHeight / 2;
+    
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();    
+    e = doc.getElementById("target");
+    x = e.offsetLeft + e.offsetWidth / 2;
+    y = e.offsetTop + e.offsetHeight / 2;
+    
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseUp();
+
+    document.write("<p><a href='http://bugs.webkit.org/show_bug.cgi?id=14428'>Bug 14428</a>: FCKEditor: Images disappear on drag/drop and copy/paste</p>");
+
+    if (doc.getElementById("dragme").parentNode.tagName == "SPAN" && doc.getElementById("dragme").src.length > 10)
+        document.write("<p>SUCCESS</p>");
+    else
+        document.write("<p>FAILURE</p>");
+
+    layoutTestController.notifyDone();
+}
+</script>
+</head>
+<body onload="setTimeout('step1()', 100)">
+<iframe src="about:blank"></iframe>
+<ul id="console"></ul>
+</body>
+</html>
index 2b593ec..86de68c 100644 (file)
@@ -1,3 +1,15 @@
+2007-12-29  Alexey Proskuryakov  <ap@webkit.org>
+
+        Reviewed by Darin.
+
+        http://bugs.webkit.org/show_bug.cgi?id=14428
+        FCKEditor: Images disappear on drag/drop and copy/paste
+
+        Test: editing/pasteboard/drag-image-in-about-blank-frame.html
+
+        * editing/markup.cpp: (WebCore::createFragmentFromMarkup): Don't use "about:blank" as a
+        base URL, just like we don't use an empty one.
+
 2007-12-29  Jan Michael Alonzo  <jmalonzo@unpluggable.com>
 
         Reviewed by Alp Toker.
index 5cdeb47..e824000 100644 (file)
@@ -890,7 +890,7 @@ PassRefPtr<DocumentFragment> createFragmentFromMarkup(Document* document, const
 
     RefPtr<DocumentFragment> fragment = element->createContextualFragment(markup);
 
-    if (fragment && !baseURL.isEmpty() && baseURL != document->baseURL())
+    if (fragment && !baseURL.isEmpty() && baseURL != "about:blank" && baseURL != document->baseURL())
         completeURLs(fragment.get(), baseURL);
 
     return fragment.release();