2009-11-26 Kinuko Yasuda <kinuko@chromium.com>
authoreric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Nov 2009 05:46:06 +0000 (05:46 +0000)
committereric@webkit.org <eric@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 27 Nov 2009 05:46:06 +0000 (05:46 +0000)
        Reviewed by Eric Seidel.

        Remove the special charset meta tag in the clipboard so that
        copy-and-paste with interchange breaklines/spaces works correctly
        within WebKit.

        No new tests.  Layout tests that involve copy-and-paste with
        interchange breaklines (like editing/pasteboard/paste-line-endings-00?)
        should pass on Mac/Chromium with this fix.

        * platform/chromium/ClipboardChromium.cpp:
        * platform/chromium/PasteboardChromium.cpp:
        (WebCore::Pasteboard::documentFragment):

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

WebCore/ChangeLog
WebCore/platform/chromium/ClipboardChromium.cpp
WebCore/platform/chromium/PasteboardChromium.cpp

index 61754997691aaac6de9624165a69a8e31b2cc3cf..3903f76e9c8af73b1e64ab569f597ed8f5e56692 100644 (file)
@@ -1,3 +1,19 @@
+2009-11-26  Kinuko Yasuda  <kinuko@chromium.com>
+
+        Reviewed by Eric Seidel.
+
+        Remove the special charset meta tag in the clipboard so that
+        copy-and-paste with interchange breaklines/spaces works correctly
+        within WebKit.
+
+        No new tests.  Layout tests that involve copy-and-paste with
+        interchange breaklines (like editing/pasteboard/paste-line-endings-00?)
+        should pass on Mac/Chromium with this fix.
+
+        * platform/chromium/ClipboardChromium.cpp:
+        * platform/chromium/PasteboardChromium.cpp:
+        (WebCore::Pasteboard::documentFragment):
+
 2009-11-26  İsmail Dönmez  <ismail@namtrac.org>
 
         Reviewed by Eric Seidel.
 2009-11-26  İsmail Dönmez  <ismail@namtrac.org>
 
         Reviewed by Eric Seidel.
index d330d3b089b5f6a93a72cd45b93adbb24a5f3514..1a2caa4782fe59262b84e28fb7e7a0b64bae93e0 100644 (file)
@@ -354,7 +354,7 @@ void ClipboardChromium::writeRange(Range* selectedRange, Frame* frame)
     m_dataObject->textHtml = createMarkup(selectedRange, 0,
         AnnotateForInterchange);
 #if PLATFORM(DARWIN)
     m_dataObject->textHtml = createMarkup(selectedRange, 0,
         AnnotateForInterchange);
 #if PLATFORM(DARWIN)
-    m_dataObject->textHtml = String("<meta charset='utf-8'>") + m_dataObject->textHtml;
+    m_dataObject->textHtml = String("<meta charset='utf-8' id='webkit-interchange-charset'>") + m_dataObject->textHtml;
 #endif
     m_dataObject->htmlBaseUrl = frame->document()->url();
 
 #endif
     m_dataObject->htmlBaseUrl = frame->document()->url();
 
index 4929eb8eba458eb6c1b0db01af93f860c510f427..ce06e55a06baed9a2cfd8b9631c50a96823ef798 100644 (file)
@@ -83,7 +83,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
 {
     String html = createMarkup(selectedRange, 0, AnnotateForInterchange);
 #if PLATFORM(DARWIN)
 {
     String html = createMarkup(selectedRange, 0, AnnotateForInterchange);
 #if PLATFORM(DARWIN)
-    html = String("<meta charset='utf-8'>") + html;
+    html = String("<meta charset='utf-8' id='webkit-interchange-charset'>") + html;
 #endif
     ExceptionCode ec = 0;
     KURL url = selectedRange->startContainer(ec)->document()->url();
 #endif
     ExceptionCode ec = 0;
     KURL url = selectedRange->startContainer(ec)->document()->url();
@@ -170,6 +170,11 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
         String markup;
         KURL srcURL;
         ChromiumBridge::clipboardReadHTML(buffer, &markup, &srcURL);
         String markup;
         KURL srcURL;
         ChromiumBridge::clipboardReadHTML(buffer, &markup, &srcURL);
+#if PLATFORM(DARWIN)
+        DEFINE_STATIC_LOCAL(const String, forceUtf8String, ("<meta charset='utf-8' id='webkit-interchange-charset'>"));
+        if (markup.startsWith(forceUtf8String))
+            markup = markup.substring(forceUtf8String.length());
+#endif
 
         RefPtr<DocumentFragment> fragment =
             createFragmentFromMarkup(frame->document(), markup, srcURL);
 
         RefPtr<DocumentFragment> fragment =
             createFragmentFromMarkup(frame->document(), markup, srcURL);