Title: [110880] trunk
Revision
110880
Author
[email protected]
Date
2012-03-15 13:23:05 -0700 (Thu, 15 Mar 2012)

Log Message

<rdar://problem/11036900> and https://bugs.webkit.org/show_bug.cgi?id=81079 REGRESSION(r107844): Clipboard API only remembers most recent data set on clipboard

Reviewed by Sam Weinig.

Source/WebCore:

Test: editing/pasteboard/copy-two-pasteboard-types-both-work.html

Add the non-destructive "addTypes" to supplement the destructive "setTypes"
* platform/PasteboardStrategy.h:
(PasteboardStrategy):
* platform/PlatformPasteboard.h:
(PlatformPasteboard):
* platform/mac/PlatformPasteboardMac.mm:
(WebCore::PlatformPasteboard::addTypes):
* WebCore.exp.in:

* platform/mac/ClipboardMac.mm:
(WebCore::ClipboardMac::setData): Call the non-destructive "addTypes" instead of
  the destructive "setTypes"

Source/WebKit/mac:

Add the non-destructive "addTypes" to supplement the destructive "setTypes"
* WebCoreSupport/WebPlatformStrategies.h:
* WebCoreSupport/WebPlatformStrategies.mm:
(WebPlatformStrategies::addTypes):

Source/WebKit2:

Add the non-destructive "addTypes" to supplement the destructive "setTypes"

* UIProcess/WebContext.h:
* UIProcess/WebContext.messages.in:
* UIProcess/mac/WebContextMac.mm:
(WebKit::WebContext::addPasteboardTypes):

* WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::addTypes):
* WebProcess/WebCoreSupport/WebPlatformStrategies.h:

LayoutTests:

* editing/pasteboard/copy-two-pasteboard-types-both-work-expected.txt: Added.
* editing/pasteboard/copy-two-pasteboard-types-both-work.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (110879 => 110880)


--- trunk/LayoutTests/ChangeLog	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/LayoutTests/ChangeLog	2012-03-15 20:23:05 UTC (rev 110880)
@@ -1,3 +1,13 @@
+2012-03-15  Brady Eidson  <[email protected]>
+
+        <rdar://problem/11036900> and https://bugs.webkit.org/show_bug.cgi?id=81079
+        REGRESSION(r107844): Clipboard API only remembers most recent data set on clipboard
+
+        Reviewed by Sam Weinig.
+
+        * editing/pasteboard/copy-two-pasteboard-types-both-work-expected.txt: Added.
+        * editing/pasteboard/copy-two-pasteboard-types-both-work.html: Added.
+
 2012-03-15  Levi Weintraub  <[email protected]>
 
         Unreviewed gardening. New flaky tests and new failure modes for old flaky tests.

Added: trunk/LayoutTests/editing/pasteboard/copy-two-pasteboard-types-both-work-expected.txt (0 => 110880)


--- trunk/LayoutTests/editing/pasteboard/copy-two-pasteboard-types-both-work-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-two-pasteboard-types-both-work-expected.txt	2012-03-15 20:23:05 UTC (rev 110880)
@@ -0,0 +1,5 @@
+Copy then paste. The output should read "FooBar"
+
+Data to copy: 
+Data pasted:
+FooBar

Added: trunk/LayoutTests/editing/pasteboard/copy-two-pasteboard-types-both-work.html (0 => 110880)


--- trunk/LayoutTests/editing/pasteboard/copy-two-pasteboard-types-both-work.html	                        (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/copy-two-pasteboard-types-both-work.html	2012-03-15 20:23:05 UTC (rev 110880)
@@ -0,0 +1,47 @@
+<html> 
+<head>
+
+<script src=""
+
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+	layoutTestController.waitUntilDone();
+}
+
+var type1 = 'application/json';
+var type2 = 'text/plain';
+
+document.addEventListener('copy', function (evt){
+    if (evt.clipboardData) {
+        evt.clipboardData.setData(type1, 'Foo');
+        evt.clipboardData.setData(type2, 'Bar');
+        evt.preventDefault();
+    }
+});
+
+document.addEventListener('paste', function (evt) {
+    if (evt.clipboardData) {
+        evt.preventDefault();
+		document.getElementById('output').innerText = evt.clipboardData.getData(type1) + evt.clipboardData.getData(type2);
+    }
+
+	if (window.layoutTestController)
+		layoutTestController.notifyDone();
+});
+
+function loaded()
+{
+	document.getElementById('input').select();
+	copyCommand();
+	pasteCommand();
+}
+
+</script>
+</head> 
+<body _onload_="loaded();">
+Copy then paste.  The output should read "FooBar"<br><br>
+Data to copy: <input id="input" value='Hello World'><br>
+Data pasted:<div id="output"></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (110879 => 110880)


--- trunk/Source/WebCore/ChangeLog	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebCore/ChangeLog	2012-03-15 20:23:05 UTC (rev 110880)
@@ -1,3 +1,25 @@
+2012-03-15  Brady Eidson  <[email protected]>
+
+        <rdar://problem/11036900> and https://bugs.webkit.org/show_bug.cgi?id=81079
+        REGRESSION(r107844): Clipboard API only remembers most recent data set on clipboard
+
+        Reviewed by Sam Weinig.
+
+        Test: editing/pasteboard/copy-two-pasteboard-types-both-work.html
+
+        Add the non-destructive "addTypes" to supplement the destructive "setTypes"
+        * platform/PasteboardStrategy.h:
+        (PasteboardStrategy):
+        * platform/PlatformPasteboard.h:
+        (PlatformPasteboard):
+        * platform/mac/PlatformPasteboardMac.mm:
+        (WebCore::PlatformPasteboard::addTypes):
+        * WebCore.exp.in:
+
+        * platform/mac/ClipboardMac.mm:
+        (WebCore::ClipboardMac::setData): Call the non-destructive "addTypes" instead of
+          the destructive "setTypes"
+
 2012-03-15  Dana Jansens  <[email protected]>
 
         [Chromium] REGRESSION(r110596) CCQuadCullerTest.verifyCullChildLinesUpTopLeft fails on Windows

Modified: trunk/Source/WebCore/WebCore.exp.in (110879 => 110880)


--- trunk/Source/WebCore/WebCore.exp.in	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-03-15 20:23:05 UTC (rev 110880)
@@ -547,6 +547,7 @@
 __ZN7WebCore18PlatformPasteboard13stringForTypeERKN3WTF6StringE
 __ZN7WebCore18PlatformPasteboard19setPathnamesForTypeERKN3WTF6VectorINS1_6StringELm0EEERKS3_
 __ZN7WebCore18PlatformPasteboard19getPathnamesForTypeERN3WTF6VectorINS1_6StringELm0EEERKS3_
+__ZN7WebCore18PlatformPasteboard8addTypesERKN3WTF6VectorINS1_6StringELm0EEE
 __ZN7WebCore18PlatformPasteboard8setTypesERKN3WTF6VectorINS1_6StringELm0EEE
 __ZN7WebCore18PlatformPasteboardC1ERKN3WTF6StringE
 __ZN7WebCore18PlatformPasteboard8getTypesERN3WTF6VectorINS1_6StringELm0EEE

Modified: trunk/Source/WebCore/platform/PasteboardStrategy.h (110879 => 110880)


--- trunk/Source/WebCore/platform/PasteboardStrategy.h	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebCore/platform/PasteboardStrategy.h	2012-03-15 20:23:05 UTC (rev 110880)
@@ -49,6 +49,7 @@
     virtual Color color(const String& pasteboardName) = 0;
     
     virtual void copy(const String& fromPasteboard, const String& toPasteboard) = 0;
+    virtual void addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) = 0;
     virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) = 0;
     virtual void setBufferForType(PassRefPtr<SharedBuffer>, const String& pasteboardType, const String& pasteboardName) = 0;
     virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) = 0;

Modified: trunk/Source/WebCore/platform/PlatformPasteboard.h (110879 => 110880)


--- trunk/Source/WebCore/platform/PlatformPasteboard.h	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebCore/platform/PlatformPasteboard.h	2012-03-15 20:23:05 UTC (rev 110880)
@@ -52,6 +52,7 @@
     Color color();
     
     void copy(const String& fromPasteboard);
+    void addTypes(const Vector<String>& pasteboardTypes);
     void setTypes(const Vector<String>& pasteboardTypes);
     void setBufferForType(PassRefPtr<SharedBuffer>, const String& pasteboardType);
     void setPathnamesForType(const Vector<String>& pathnames, const String& pasteboardType);

Modified: trunk/Source/WebCore/platform/mac/ClipboardMac.mm (110879 => 110880)


--- trunk/Source/WebCore/platform/mac/ClipboardMac.mm	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebCore/platform/mac/ClipboardMac.mm	2012-03-15 20:23:05 UTC (rev 110880)
@@ -253,13 +253,13 @@
         Vector<String> types;
         types.append(String(NSURLPboardType));
 
-        platformStrategies()->pasteboardStrategy()->setTypes(types, m_pasteboardName);
+        platformStrategies()->pasteboardStrategy()->addTypes(types, m_pasteboardName);
         platformStrategies()->pasteboardStrategy()->setStringForType(cocoaData, String(NSURLPboardType), m_pasteboardName);
         NSURL *url = "" alloc] initWithString:cocoaData];
 
         if ([url isFileURL] && m_frame->document()->securityOrigin()->canLoadLocalResources()) {
             types.append(String(NSFilenamesPboardType));
-            platformStrategies()->pasteboardStrategy()->setTypes(types, m_pasteboardName);
+            platformStrategies()->pasteboardStrategy()->addTypes(types, m_pasteboardName);
             Vector<String> fileList;
             fileList.append(String([url path]));
             platformStrategies()->pasteboardStrategy()->setPathnamesForType(fileList, String(NSFilenamesPboardType), m_pasteboardName);
@@ -273,7 +273,7 @@
         // everything else we know of goes on the pboard as a string
         Vector<String> types;
         types.append(cocoaType);
-        platformStrategies()->pasteboardStrategy()->setTypes(types, m_pasteboardName);
+        platformStrategies()->pasteboardStrategy()->addTypes(types, m_pasteboardName);
         platformStrategies()->pasteboardStrategy()->setStringForType(cocoaData, cocoaType, m_pasteboardName);
         return true;
     }

Modified: trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm (110879 => 110880)


--- trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebCore/platform/mac/PlatformPasteboardMac.mm	2012-03-15 20:23:05 UTC (rev 110880)
@@ -102,6 +102,15 @@
     }    
 }
 
+void PlatformPasteboard::addTypes(const Vector<String>& pasteboardTypes)
+{
+    RetainPtr<NSMutableArray> types(AdoptNS, [[NSMutableArray alloc] init]);
+    for (size_t i = 0; i < pasteboardTypes.size(); ++i)
+        [types.get() addObject:pasteboardTypes[i]];
+
+    [m_pasteboard.get() addTypes:types.get() owner:nil];
+}
+
 void PlatformPasteboard::setTypes(const Vector<String>& pasteboardTypes)
 {
     if (pasteboardTypes.isEmpty()) {

Modified: trunk/Source/WebKit/mac/ChangeLog (110879 => 110880)


--- trunk/Source/WebKit/mac/ChangeLog	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit/mac/ChangeLog	2012-03-15 20:23:05 UTC (rev 110880)
@@ -1,3 +1,15 @@
+2012-03-15  Brady Eidson  <[email protected]>
+
+        <rdar://problem/11036900> and https://bugs.webkit.org/show_bug.cgi?id=81079
+        REGRESSION(r107844): Clipboard API only remembers most recent data set on clipboard
+
+        Reviewed by Sam Weinig.
+
+        Add the non-destructive "addTypes" to supplement the destructive "setTypes"
+        * WebCoreSupport/WebPlatformStrategies.h:
+        * WebCoreSupport/WebPlatformStrategies.mm:
+        (WebPlatformStrategies::addTypes):
+
 2012-03-14  Anders Carlsson  <[email protected]>
 
         java/java-and-plugins.html test failing

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h (110879 => 110880)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.h	2012-03-15 20:23:05 UTC (rev 110880)
@@ -66,6 +66,7 @@
     virtual WebCore::Color color(const String& pasteboardName) OVERRIDE;
     
     virtual void copy(const String& fromPasteboard, const String& toPasteboard) OVERRIDE;
+    virtual void addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE;
     virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE;
     virtual void setBufferForType(PassRefPtr<WebCore::SharedBuffer>, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
     virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) OVERRIDE;

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm (110879 => 110880)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebPlatformStrategies.mm	2012-03-15 20:23:05 UTC (rev 110880)
@@ -138,6 +138,11 @@
     return PlatformPasteboard(pasteboardName).color();    
 }
 
+void WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
+{
+    PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes);
+}
+
 void WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
 {
     PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);

Modified: trunk/Source/WebKit2/ChangeLog (110879 => 110880)


--- trunk/Source/WebKit2/ChangeLog	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-15 20:23:05 UTC (rev 110880)
@@ -1,3 +1,21 @@
+2012-03-15  Brady Eidson  <[email protected]>
+
+        <rdar://problem/11036900> and https://bugs.webkit.org/show_bug.cgi?id=81079
+        REGRESSION(r107844): Clipboard API only remembers most recent data set on clipboard
+
+        Reviewed by Sam Weinig.
+
+        Add the non-destructive "addTypes" to supplement the destructive "setTypes"
+
+        * UIProcess/WebContext.h:
+        * UIProcess/WebContext.messages.in:
+        * UIProcess/mac/WebContextMac.mm:
+        (WebKit::WebContext::addPasteboardTypes):
+
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
+        (WebKit::WebPlatformStrategies::addTypes):
+        * WebProcess/WebCoreSupport/WebPlatformStrategies.h:
+
 2012-03-15  Carlos Garcia Campos  <[email protected]>
 
         [GTK] Implement unicode submenu items

Modified: trunk/Source/WebKit2/UIProcess/WebContext.h (110879 => 110880)


--- trunk/Source/WebKit2/UIProcess/WebContext.h	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit2/UIProcess/WebContext.h	2012-03-15 20:23:05 UTC (rev 110880)
@@ -226,6 +226,7 @@
     void getPasteboardChangeCount(const String& pasteboardName, uint64_t& changeCount);
     void getPasteboardUniqueName(String& pasteboardName);
     void getPasteboardColor(const String& pasteboardName, WebCore::Color&);
+    void addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes);
     void setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes);
     void setPasteboardPathnamesForType(const String& pasteboardName, const String& pasteboardType, const Vector<String>& pathnames);
     void setPasteboardStringForType(const String& pasteboardName, const String& pasteboardType, const String&);

Modified: trunk/Source/WebKit2/UIProcess/WebContext.messages.in (110879 => 110880)


--- trunk/Source/WebKit2/UIProcess/WebContext.messages.in	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit2/UIProcess/WebContext.messages.in	2012-03-15 20:23:05 UTC (rev 110880)
@@ -53,6 +53,7 @@
     GetPasteboardChangeCount(WTF::String pasteboardName) -> (uint64_t changeCount)
     GetPasteboardUniqueName() -> (WTF::String pasteboardName)
     GetPasteboardColor(WTF::String pasteboardName) -> (WebCore::Color color)
+    AddPasteboardTypes(WTF::String pasteboardName, Vector<WTF::String> pasteboardTypes)
     SetPasteboardTypes(WTF::String pasteboardName, Vector<WTF::String> pasteboardTypes)
     SetPasteboardPathnamesForType(WTF::String pasteboardName, WTF::String pasteboardType, Vector<WTF::String> pathnames)
     SetPasteboardStringForType(WTF::String pasteboardName, WTF::String pasteboardType, WTF::String string)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm (110879 => 110880)


--- trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMac.mm	2012-03-15 20:23:05 UTC (rev 110880)
@@ -203,6 +203,11 @@
     color = PlatformPasteboard(pasteboardName).color();    
 }
 
+void WebContext::addPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes)
+{
+    PlatformPasteboard(pasteboardName).addTypes(pasteboardTypes);
+}
+
 void WebContext::setPasteboardTypes(const String& pasteboardName, const Vector<String>& pasteboardTypes)
 {
     PlatformPasteboard(pasteboardName).setTypes(pasteboardTypes);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp (110879 => 110880)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp	2012-03-15 20:23:05 UTC (rev 110880)
@@ -199,6 +199,11 @@
     return color;
 }
 
+void WebPlatformStrategies::addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
+{
+    WebProcess::shared().connection()->send(Messages::WebContext::AddPasteboardTypes(pasteboardName, pasteboardTypes), 0);
+}
+
 void WebPlatformStrategies::setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName)
 {
     WebProcess::shared().connection()->send(Messages::WebContext::SetPasteboardTypes(pasteboardName, pasteboardTypes), 0);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h (110879 => 110880)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2012-03-15 20:09:55 UTC (rev 110879)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebPlatformStrategies.h	2012-03-15 20:23:05 UTC (rev 110880)
@@ -72,6 +72,7 @@
     virtual WebCore::Color color(const String& pasteboardName) OVERRIDE;
     
     virtual void copy(const String& fromPasteboard, const String& toPasteboard) OVERRIDE;
+    virtual void addTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE;
     virtual void setTypes(const Vector<String>& pasteboardTypes, const String& pasteboardName) OVERRIDE;
     virtual void setBufferForType(PassRefPtr<WebCore::SharedBuffer>, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
     virtual void setPathnamesForType(const Vector<String>&, const String& pasteboardType, const String& pasteboardName) OVERRIDE;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to