[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
tony at chromium.org
tony at chromium.org
Sun Feb 20 23:01:11 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit 1e26d554da350178127849fc638d65484575156f
Author: tony at chromium.org <tony at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sat Jan 15 02:06:08 2011 +0000
2011-01-14 Tony Chang <tony at chromium.org>
Reviewed by Alexey Proskuryakov.
Strip NUL character when copying text on Windows
https://bugs.webkit.org/show_bug.cgi?id=52236
* editing/pasteboard/copy-null-characters-expected.txt: Added.
* editing/pasteboard/copy-null-characters.html: Added.
2011-01-14 Tony Chang <tony at chromium.org>
Reviewed by Alexey Proskuryakov.
Strip NUL character when copying text on Windows
https://bugs.webkit.org/show_bug.cgi?id=52236
Test: editing/pasteboard/copy-null-characters.html
* editing/Editor.cpp:
(WebCore::Editor::selectedText):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::writeSelection): Use editor()->selectedText() which matches the other platforms.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index d349e2f..43c3d16 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2011-01-14 Tony Chang <tony at chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Strip NUL character when copying text on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=52236
+
+ * editing/pasteboard/copy-null-characters-expected.txt: Added.
+ * editing/pasteboard/copy-null-characters.html: Added.
+
2011-01-14 Nico Weber <thakis at chromium.org>
Unreviewed, test expectations.
diff --git a/LayoutTests/editing/pasteboard/copy-null-characters-expected.txt b/LayoutTests/editing/pasteboard/copy-null-characters-expected.txt
new file mode 100644
index 0000000..8f45144
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/copy-null-characters-expected.txt
@@ -0,0 +1,50 @@
+If there are NULL characters in text nodes, they should not be copied to the clipboard. This test requires DumpRenderTree.
+| "
+"
+| <div>
+| id="outerSource"
+| <p>
+| <b>
+| "bold"
+| "
+ "
+| "
+ "
+| <p>
+| style="color: green"
+| "green"
+| "
+"
+| "
+"
+| <div>
+| contenteditable="true"
+| id="destination-rich-text"
+| <p>
+| <b>
+| "bold"
+| <div>
+| contenteditable="true"
+| id="source"
+| "Copy paste me"
+| <span>
+| class="Apple-style-span"
+| style="color: rgb(0, 128, 0); "
+| "green"
+| "Copy paste me"
+| "
+"
+| <textarea>
+| id="destination-plain-text"
+| this.value="Copy paste mebold
+
+Copy paste me
+green"
+| "
+"
+| <div>
+| id="results"
+| "PASSED"
+| "
+
+"
diff --git a/LayoutTests/editing/pasteboard/copy-null-characters.html b/LayoutTests/editing/pasteboard/copy-null-characters.html
new file mode 100644
index 0000000..c92ab8b
--- /dev/null
+++ b/LayoutTests/editing/pasteboard/copy-null-characters.html
@@ -0,0 +1,74 @@
+<head>
+<script src="../../resources/dump-as-markup.js"></script>
+<script>
+Markup.description('If there are NULL characters in text nodes, they should not be copied to the clipboard. This test requires DumpRenderTree.');
+Markup.noAutoDump();
+
+function runTest()
+{
+ var sel = window.getSelection();
+
+ var source = document.getElementById("source");
+ var textWithNull = "Copy\0 paste me";
+ source.textContent = textWithNull;
+ sel.setPosition(source, 0);
+ document.execCommand("SelectAll");
+ document.execCommand("Copy");
+
+ var destinationRichText = document.getElementById("destination-rich-text");
+ sel.setPosition(destinationRichText, 0);
+ document.execCommand("Paste");
+
+ var destinationPlainText = document.getElementById("destination-plain-text");
+ destinationPlainText.focus();
+ document.execCommand("Paste");
+
+ var results = document.getElementById("results");
+ var expectedPlainTextValue = "Copy paste me";
+ if (expectedPlainTextValue != destinationPlainText.value) {
+ results.innerText = "Plain text field has the wrong value (expected " +
+ JSON.stringify(expectedPlainTextValue) + " but found " +
+ JSON.stringify(destinationPlainText.value) + ").";
+ return;
+ }
+
+ // Run the same test but include some richly formatted text.
+ var outerSource = document.getElementById("outerSource");
+ sel.setBaseAndExtent(outerSource, 0, destinationRichText, 0);
+ document.execCommand("Copy");
+
+ // Remove the source text so we don't end up with a null character in the
+ // expected output file.
+ source.parentNode.removeChild(source);
+
+ sel.setPosition(destinationRichText, 0);
+ document.execCommand("Paste");
+
+ destinationPlainText.focus();
+ document.execCommand("Paste");
+
+ var expectedPlainTextValue2 = "Copy paste mebold\n\nCopy paste me\ngreen";
+ if (expectedPlainTextValue2 != destinationPlainText.value) {
+ results.innerText = "Plain text field has the wrong value (expected " +
+ JSON.stringify(expectedPlainTextValue2) + " but found " +
+ JSON.stringify(destinationPlainText.value) + ").";
+ return;
+ }
+
+ results.innerText = "PASSED";
+
+ Markup.dump(document.body);
+ Markup.notifyDone();
+}
+</script>
+</head>
+
+<body onload="runTest()">
+<div id="outerSource"><p><b>bold</b></p>
+ <div id="source" contentEditable="true"></div>
+ <p style="color: green">green</p>
+</div>
+<div id="destination-rich-text" contentEditable="true"></div>
+<textarea id="destination-plain-text"></textarea>
+<div id="results">FAILED</div>
+</body>
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 0aceca3..af00d89 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,17 @@
+2011-01-14 Tony Chang <tony at chromium.org>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Strip NUL character when copying text on Windows
+ https://bugs.webkit.org/show_bug.cgi?id=52236
+
+ Test: editing/pasteboard/copy-null-characters.html
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::selectedText):
+ * platform/mac/PasteboardMac.mm:
+ (WebCore::Pasteboard::writeSelection): Use editor()->selectedText() which matches the other platforms.
+
2011-01-14 Yuzo Fujishima <yuzo at google.com>
Reviewed by Antti Koivisto.
diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp
index 93fdd3c..bea74d9 100644
--- a/Source/WebCore/editing/Editor.cpp
+++ b/Source/WebCore/editing/Editor.cpp
@@ -3032,7 +3032,8 @@ void Editor::changeSelectionAfterCommand(const VisibleSelection& newSelection, b
String Editor::selectedText() const
{
- return plainText(m_frame->selection()->toNormalizedRange().get());
+ // We remove '\0' characters because they are not visibly rendered to the user.
+ return plainText(m_frame->selection()->toNormalizedRange().get()).replace(0, "");
}
IntRect Editor::firstRectForRange(Range* range) const
diff --git a/Source/WebCore/platform/mac/PasteboardMac.mm b/Source/WebCore/platform/mac/PasteboardMac.mm
index b1f2327..71e4046 100644
--- a/Source/WebCore/platform/mac/PasteboardMac.mm
+++ b/Source/WebCore/platform/mac/PasteboardMac.mm
@@ -191,7 +191,7 @@ void Pasteboard::writeSelection(NSPasteboard* pasteboard, Range* selectedRange,
if ([types containsObject:NSStringPboardType]) {
// Map to a plain old space because this is better for source code, other browsers do it,
// and because HTML forces you to do this any time you want two spaces in a row.
- String text = selectedRange->text();
+ String text = frame->editor()->selectedText();
NSMutableString *s = [[[(NSString*)text copy] autorelease] mutableCopy];
NSString *NonBreakingSpaceString = [NSString stringWithCharacters:&noBreakSpace length:1];
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list