Changeset 59917 in webkit
- Timestamp:
- May 21, 2010 12:57:42 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r59903 r59917 1 2010-05-20 Tony Chang <tony@chromium.org> 2 3 Reviewed by Kent Tamura. 4 5 escape link text when copying or dragging links on win or chromium 6 https://bugs.webkit.org/show_bug.cgi?id=39413 7 8 * editing/pasteboard/drop-link-expected.txt: Added. 9 * editing/pasteboard/drop-link.html: 10 * platform/chromium-linux/editing/pasteboard/drop-link-expected.checksum: Removed. 11 * platform/chromium-linux/editing/pasteboard/drop-link-expected.png: Removed. 12 * platform/chromium-linux/editing/pasteboard/drop-link-expected.txt: Removed. 13 * platform/chromium-win/editing/pasteboard/drop-link-expected.checksum: Removed. 14 * platform/chromium-win/editing/pasteboard/drop-link-expected.png: Removed. 15 * platform/chromium-win/editing/pasteboard/drop-link-expected.txt: Removed. 16 * platform/mac/editing/pasteboard/drop-link-expected.checksum: Removed. 17 * platform/mac/editing/pasteboard/drop-link-expected.png: Removed. 18 * platform/mac/editing/pasteboard/drop-link-expected.txt: Removed. 19 1 20 2010-05-20 Fumitoshi Ukai <ukai@chromium.org> 2 21 -
trunk/LayoutTests/editing/pasteboard/drop-link.html
r17562 r59917 6 6 7 7 <div contenteditable="true" id="destination">Hello</div> 8 <div contenteditable="true" id="destination2">Goodbye</div> 8 9 9 10 <div><a href="http://apple.com" id="grabme">This is a link</a></div> 11 <div><a href="http://apple.com" id="grabme2">This </a><a href="http://webkit.org/">is another link</a></div> 10 12 11 13 <ul id="console"></ul> 12 14 13 <div>To run this test manually, drag the link into the box with 'hello' in it, and then click on the button.<br><input type="button" value="Verify" onClick="verifier()"></div> 15 <div>To run this test manually, drag the first link into the box with 'Hello' in it, 16 drag the second link into the box with 'Goodbye' in it, and then click on the button.<br><input type="button" value="Verify" onClick="verifier()"></div> 14 17 15 18 <script> … … 27 30 if (!window.layoutTestController) 28 31 return; 29 30 var anchorToDrag = document.getElementById("grabme"); 32 layoutTestController.dumpAsText(); 33 34 dragLink('grabme', 'destination'); 35 dragLink('grabme2', 'destination2'); 36 37 verifier(); 38 } 39 40 function dragLink(srcId, targetId) 41 { 42 var anchorToDrag = document.getElementById(srcId); 43 window.getSelection().setBaseAndExtent(anchorToDrag, 0, anchorToDrag, 0); 44 31 45 var x = anchorToDrag.offsetLeft + anchorToDrag.offsetWidth / 2; 32 46 var y = anchorToDrag.offsetTop + anchorToDrag.offsetHeight / 2; … … 37 51 // Wait a moment so that the mouseDown will kick off a drag instead of navigating to the link 38 52 eventSender.leapForward(400); 39 40 var destinationObject = document.getElementById( "destination");53 54 var destinationObject = document.getElementById(targetId); 41 55 var x = destinationObject.offsetLeft + destinationObject.offsetWidth / 2; 42 56 var y = destinationObject.offsetTop + destinationObject.offsetHeight / 2; 43 57 44 45 58 eventSender.mouseMoveTo(x, y); 46 59 eventSender.mouseUp(); 47 48 verifier();49 60 } 50 61 51 62 function verifier() { 52 63 var anchorToDrag = document.getElementById("grabme"); 64 var anchorToDrag2 = document.getElementById("grabme2"); 65 66 var passed = verifyLink('grabme', 0) && verifyLink('grabme2', 1); 67 68 var anchors = document.getElementsByTagName("a"); 69 if (anchors.length != 2) { 70 log("Failure, incorrect number of anchor tags present"); 71 passed = false; 72 } 73 74 if (passed) 75 log("Success!"); 76 } 77 78 function verifyLink(linkId, linkNumber) 79 { 80 var anchorToDrag = document.getElementById(linkId); 53 81 54 82 var originalTarget = anchorToDrag.href; … … 56 84 var anchorParent = anchorToDrag.parentNode; 57 85 anchorParent.removeChild(anchorToDrag); 58 86 59 87 var anchors = document.getElementsByTagName("a"); 60 if (anchors.length != 1) { 61 log("Failure, incorrect number of anchor tags present"); 88 if (!anchors[linkNumber]) { 89 log("Link " + linkNumber + " not found"); 90 passed = false; 62 91 } else { 63 log("Link is " + anchors[ 0].href);92 log("Link is " + anchors[linkNumber].href); 64 93 var passed = true; 65 if (anchors[ 0].href != originalTarget) {94 if (anchors[linkNumber].href != originalTarget) { 66 95 log("Failure! Link targets differ"); 67 96 passed = false; 68 97 } 69 if (anchors[ 0].innerText != originalText) {98 if (anchors[linkNumber].innerText != originalText) { 70 99 log("Failure! Link texts differ"); 71 100 passed = false; 72 101 } 73 if (passed)74 log("Success!");75 102 } 103 return passed; 76 104 } 77 105 -
trunk/WebCore/ChangeLog
r59915 r59917 1 2010-05-20 Tony Chang <tony@chromium.org> 2 3 Reviewed by Kent Tamura. 4 5 escape link text when copying or dragging links on win or chromium 6 https://bugs.webkit.org/show_bug.cgi?id=39413 7 8 * editing/markup.cpp: 9 (WebCore::urlToMarkup): 10 * editing/markup.h: 11 * platform/chromium/ClipboardUtilitiesChromium.cpp: 12 * platform/chromium/ClipboardUtilitiesChromium.h: 13 * platform/win/ClipboardUtilitiesWin.cpp: 14 * platform/win/ClipboardUtilitiesWin.h: 15 1 16 2010-05-18 Philippe Normand <pnormand@igalia.com> 2 17 -
trunk/WebCore/editing/markup.cpp
r59241 r59917 50 50 #include "HTMLNames.h" 51 51 #include "InlineTextBox.h" 52 #include "KURL.h" 52 53 #include "Logging.h" 53 54 #include "ProcessingInstruction.h" … … 1288 1289 } 1289 1290 1290 } 1291 String urlToMarkup(const KURL& url, const String& title) 1292 { 1293 Vector<UChar> markup; 1294 append(markup, "<a href=\""); 1295 append(markup, url.string()); 1296 append(markup, "\">"); 1297 appendEscapedContent(markup, make_pair(title.characters(), title.length()), false); 1298 append(markup, "</a>"); 1299 return String::adopt(markup); 1300 } 1301 1302 } -
trunk/WebCore/editing/markup.h
r54036 r59917 36 36 class Document; 37 37 class DocumentFragment; 38 class KURL; 38 39 class Node; 39 40 class Range; … … 55 56 String createFullMarkup(const Range*); 56 57 58 String urlToMarkup(const KURL&, const String& title); 57 59 } 58 60 -
trunk/WebCore/platform/chromium/ClipboardUtilitiesChromium.cpp
r52791 r59917 53 53 } 54 54 55 String urlToMarkup(const KURL& url, const String& title)56 {57 String markup("<a href=\"");58 markup.append(url.string());59 markup.append("\">");60 // FIXME: HTML escape this, possibly by moving into the glue layer so we61 // can use net/base/escape.h.62 markup.append(title);63 markup.append("</a>");64 return markup;65 }66 67 55 } // namespace WebCore -
trunk/WebCore/platform/chromium/ClipboardUtilitiesChromium.h
r52791 r59917 39 39 void replaceNBSPWithSpace(String&); 40 40 41 String urlToMarkup(const KURL&, const String&);42 43 41 } // namespace WebCore -
trunk/WebCore/platform/win/ClipboardUtilitiesWin.cpp
r56825 r59917 203 203 } 204 204 205 String urlToMarkup(const KURL& url, const String& title)206 {207 Vector<UChar> markup;208 append(markup, "<a href=\"");209 append(markup, url.string());210 append(markup, "\">");211 append(markup, title);212 append(markup, "</a>");213 return String::adopt(markup);214 }215 216 205 void replaceNewlinesWithWindowsStyleNewlines(String& str) 217 206 { -
trunk/WebCore/platform/win/ClipboardUtilitiesWin.h
r30613 r59917 51 51 52 52 void markupToCF_HTML(const String& markup, const String& srcURL, Vector<char>& result); 53 String urlToMarkup(const KURL& url, const String& title);54 53 55 54 void replaceNewlinesWithWindowsStyleNewlines(String&);
Note: See TracChangeset
for help on using the changeset viewer.