Title: [104655] trunk
- Revision
- 104655
- Author
- [email protected]
- Date
- 2012-01-10 17:19:14 -0800 (Tue, 10 Jan 2012)
Log Message
[chromium] Pasteboard::documentFragment should fall back to text if there's no HTML text
https://bugs.webkit.org/show_bug.cgi?id=75923
Reviewed by Tony Chang.
Source/WebCore:
Test: editing/pasteboard/pasting-empty-html-falls-back-to-text.html
* platform/chromium/PasteboardChromium.cpp:
(WebCore::Pasteboard::documentFragment):
LayoutTests:
* editing/pasteboard/pasting-empty-html-falls-back-to-text-expected.txt: Added.
* editing/pasteboard/pasting-empty-html-falls-back-to-text.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (104654 => 104655)
--- trunk/LayoutTests/ChangeLog 2012-01-11 01:12:22 UTC (rev 104654)
+++ trunk/LayoutTests/ChangeLog 2012-01-11 01:19:14 UTC (rev 104655)
@@ -1,3 +1,13 @@
+2012-01-10 Daniel Cheng <[email protected]>
+
+ [chromium] Pasteboard::documentFragment should fall back to text if there's no HTML text
+ https://bugs.webkit.org/show_bug.cgi?id=75923
+
+ Reviewed by Tony Chang.
+
+ * editing/pasteboard/pasting-empty-html-falls-back-to-text-expected.txt: Added.
+ * editing/pasteboard/pasting-empty-html-falls-back-to-text.html: Added.
+
2012-01-10 Mike Lawther <[email protected]>
padding test for CSS3 calc
Added: trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text-expected.txt (0 => 104655)
--- trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text-expected.txt (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text-expected.txt 2012-01-11 01:19:14 UTC (rev 104655)
@@ -0,0 +1,5 @@
+This test requires DRT. It verifies that pasting in a richly editable area falls back to text if the HTML content is an empty string.
+
+
+
+PASS
Property changes on: trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text-expected.txt
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text.html (0 => 104655)
--- trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text.html (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text.html 2012-01-11 01:19:14 UTC (rev 104655)
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script>
+function handleCopy(event)
+{
+ event.clipboardData.setData('text/html', '');
+ event.clipboardData.setData('text/plain', '\nPASS');
+ event.preventDefault();
+}
+
+function runTest()
+{
+ if (!window.layoutTestController)
+ return;
+ layoutTestController.dumpAsText();
+
+ document.body.addEventListener('copy', handleCopy);
+ document.execCommand('copy');
+ var selection = window.getSelection();
+ var range = document.createRange();
+ range.selectNode(document.getElementById('description'));
+ selection.addRange(range);
+ selection.collapseToEnd();
+ document.execCommand('paste');
+}
+</script>
+<body _onload_="runTest()" contenteditable="true">
+<p id="description">This test requires DRT. It verifies that pasting in a richly editable area falls back to text if the HTML content is an empty string.
+</body>
+</html>
Property changes on: trunk/LayoutTests/editing/pasteboard/pasting-empty-html-falls-back-to-text.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/Source/WebCore/ChangeLog (104654 => 104655)
--- trunk/Source/WebCore/ChangeLog 2012-01-11 01:12:22 UTC (rev 104654)
+++ trunk/Source/WebCore/ChangeLog 2012-01-11 01:19:14 UTC (rev 104655)
@@ -1,3 +1,15 @@
+2012-01-10 Daniel Cheng <[email protected]>
+
+ [chromium] Pasteboard::documentFragment should fall back to text if there's no HTML text
+ https://bugs.webkit.org/show_bug.cgi?id=75923
+
+ Reviewed by Tony Chang.
+
+ Test: editing/pasteboard/pasting-empty-html-falls-back-to-text.html
+
+ * platform/chromium/PasteboardChromium.cpp:
+ (WebCore::Pasteboard::documentFragment):
+
2012-01-10 Kentaro Hara <[email protected]>
Use the [Supplemental] IDL in SQLDatabase
Modified: trunk/Source/WebCore/platform/chromium/PasteboardChromium.cpp (104654 => 104655)
--- trunk/Source/WebCore/platform/chromium/PasteboardChromium.cpp 2012-01-11 01:12:22 UTC (rev 104654)
+++ trunk/Source/WebCore/platform/chromium/PasteboardChromium.cpp 2012-01-11 01:19:14 UTC (rev 104655)
@@ -182,10 +182,12 @@
unsigned fragmentEnd = 0;
PlatformSupport::clipboardReadHTML(buffer, &markup, &srcURL, &fragmentStart, &fragmentEnd);
- RefPtr<DocumentFragment> fragment =
- createFragmentFromMarkupWithContext(frame->document(), markup, fragmentStart, fragmentEnd, srcURL, FragmentScriptingNotAllowed);
- if (fragment)
- return fragment.release();
+ if (!markup.isEmpty()) {
+ RefPtr<DocumentFragment> fragment =
+ createFragmentFromMarkupWithContext(frame->document(), markup, fragmentStart, fragmentEnd, srcURL, FragmentScriptingNotAllowed);
+ if (fragment)
+ return fragment.release();
+ }
}
if (allowPlainText) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes