https://bugs.webkit.org/show_bug.cgi?id=78655
Reviewed by Enrica Casucci.
Source/WebCore:
This patch fixes the code to make a plain text for pasted file names.
The code should return a string of concatenated file names.
Test: editing/pasteboard/drag-files-to-editable-element.html
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::plainText):
LayoutTests:
The added test drops multiple files onto an editable element,
and checks if the filenames are inserted into the editable element.
* editing/pasteboard/drag-files-to-editable-element-expected.txt: Added.
* editing/pasteboard/drag-files-to-editable-element.html: Added.
* platform/chromium/test_expectations.txt:
* platform/efl/Skipped:
* platform/gtk/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
* platform/wk2/Skipped:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@107886
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-15 Kentaro Hara <haraken@chromium.org>
+
+ [Mac] PasteboardMac.mm build fails
+ https://bugs.webkit.org/show_bug.cgi?id=78655
+
+ Reviewed by Enrica Casucci.
+
+ The added test drops multiple files onto an editable element,
+ and checks if the filenames are inserted into the editable element.
+
+ * editing/pasteboard/drag-files-to-editable-element-expected.txt: Added.
+ * editing/pasteboard/drag-files-to-editable-element.html: Added.
+ * platform/chromium/test_expectations.txt:
+ * platform/efl/Skipped:
+ * platform/gtk/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * platform/wk2/Skipped:
+
2012-02-15 Ilya Tikhonovsky <loislo@chromium.org>
[chromium] Unreviewed rebaseline after r107864.
--- /dev/null
+If we drag files onto an editable area, then the filenames should be inserted into the editable area.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS result is "<div>LayoutTests/editing/pasteboard/foo</div><div>LayoutTests/editing/pasteboard/bar</div><div>LayoutTests/editing/pasteboard/baz</div>"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<html>
+<head>
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<div id="editable" contentEditable=true style="width:200px; height:200px"></div>
+<script>
+description('If we drag files onto an editable area, then the filenames should be inserted into the editable area.');
+
+var editable = document.getElementById("editable");
+if (window.eventSender) {
+ dragFilesOntoEditable(['foo', 'bar', 'baz']);
+ var result = editable.innerHTML.replace(/file.*?LayoutTests/g, "LayoutTests");
+ shouldBeEqualToString('result', '<div>LayoutTests/editing/pasteboard/foo</div><div>LayoutTests/editing/pasteboard/bar</div><div>LayoutTests/editing/pasteboard/baz</div>');
+ editable.innerHTML = '';
+}
+
+function moveMouseToCenterOfElement(element)
+{
+ var centerX = element.offsetLeft + element.offsetWidth / 2;
+ var centerY = element.offsetTop + element.offsetHeight / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+}
+
+function dragFilesOntoEditable(files)
+{
+ eventSender.beginDragWithFiles(files);
+ moveMouseToCenterOfElement(editable);
+ eventSender.mouseUp();
+}
+
+var successfullyParsed = true;
+</script>
+<script src="../../fast/js/resources/js-test-post.js"></script>
+</body>
+</html>
BUGWK61624 WIN : editing/pasteboard/smart-paste-003.html = TEXT
BUGWK61624 WIN : editing/pasteboard/smart-paste-004.html = TEXT
+// PasteBoard::plainText() does not support file names.
+BUGWK78655 : editing/pasteboard/drag-files-to-editable-element.html = FAIL
+
// New test in r93068
BUGWK66268 WIN LINUX : editing/deleting/regional-indicators.html = TEXT
# The EFL port has no global history delegate
http/tests/globalhistory
+# PasteBoard::plainText() does not support file names.
+editing/pasteboard/drag-files-to-editable-element.html
+
# Fails because MutationObservers are not notified at end-of-task
# https://bugs.webkit.org/show_bug.cgi?id=78290
fast/mutation/end-of-task-delivery.html
editing/pasteboard/clipboard-customData.html
fast/events/drag-customData.html
+# PasteBoard::plainText() does not support file names.
+editing/pasteboard/drag-files-to-editable-element.html
+
# Needs grammar checking.
editing/spelling/markers.html
editing/pasteboard/data-transfer-items-drag-drop-file.html
editing/pasteboard/data-transfer-items-drag-drop-string.html
+# PasteBoard::plainText() does not support file names.
+editing/pasteboard/drag-files-to-editable-element.html
+
# Missing drag & drop functionality in DRT
editing/pasteboard/drop-inputtext-acquires-style.html
fast/css/user-drag-none.html
# https://bugs.webkit.org/show_bug.cgi?id=61829
fast/events/drag-image-filename.html
+# PasteBoard::plainText() does not support file names.
+editing/pasteboard/drag-files-to-editable-element.html
+
# <rdar://problem/5643675> window.scrollTo scrolls a window with no scrollbars
fast/events/attempt-scroll-with-no-scrollbars.html
# http://webkit.org/b/58990
editing/undo/undo-iframe-location-change.html
+# PasteBoard::plainText() does not support file names.
+editing/pasteboard/drag-files-to-editable-element.html
+
# Times out
# https://bugs.webkit.org/show_bug.cgi?id=63806
http/tests/cache/history-only-cached-subresource-loads-max-age-https.html
+2012-02-15 Kentaro Hara <haraken@chromium.org>
+
+ [Mac] PasteboardMac.mm build fails
+ https://bugs.webkit.org/show_bug.cgi?id=78655
+
+ Reviewed by Enrica Casucci.
+
+ This patch fixes the code to make a plain text for pasted file names.
+ The code should return a string of concatenated file names.
+
+ Test: editing/pasteboard/drag-files-to-editable-element.html
+
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::plainText):
+
2012-02-15 Anders Carlsson <andersca@apple.com>
Another attempt at fixing the Snow Leopard build.
#import <wtf/StdLibExtras.h>
#import <wtf/RetainPtr.h>
#import <wtf/UnusedParam.h>
+#import <wtf/text/StringBuilder.h>
#import <wtf/unicode/CharacterNames.h>
#if USE(PLATFORM_STRATEGIES)
return [(NSString *)platformStrategies()->pasteboardStrategy()->stringForType(NSStringPboardType, m_pasteboardName) precomposedStringWithCanonicalMapping];
NSAttributedString *attributedString = nil;
- NSString *string = nil;
+ NSString *string;
if (types.contains(String(NSRTFDPboardType))) {
RefPtr<SharedBuffer> data = platformStrategies()->pasteboardStrategy()->bufferForType(NSRTFDPboardType, m_pasteboardName);
if (types.contains(String(NSFilenamesPboardType))) {
Vector<String> pathnames;
platformStrategies()->pasteboardStrategy()->getPathnamesForType(pathnames, NSFilenamesPboardType, m_pasteboardName);
+ StringBuilder builder;
for (size_t i = 0; i < pathnames.size(); i++)
- string = [string length] ? @"\n" + pathnames[i] : pathnames[i];
- string = [string precomposedStringWithCanonicalMapping];
- if (string != nil)
- return string;
+ builder.append(i ? "\n" + pathnames[i] : pathnames[i]);
+ string = builder.toString();
+ return [string precomposedStringWithCanonicalMapping];
}
string = platformStrategies()->pasteboardStrategy()->stringForType(NSURLPboardType, m_pasteboardName);