<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181760] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181760">181760</a></dd>
<dt>Author</dt> <dd>enrica@apple.com</dd>
<dt>Date</dt> <dd>2015-03-19 14:59:23 -0700 (Thu, 19 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>&lt;attachment&gt; should put URLs on the pasteboard so that Finder can accept drops.
https://bugs.webkit.org/show_bug.cgi?id=142801
rdar://problem/19982527

Reviewed by Tim Horton.

Source/WebCore:

Test: editing/pasteboard/drag-and-drop-attachment-contenteditable.html

This patch adds all the necessary support to write attachment elements into
the pasteboard, including the promised type.

* WebCore.xcodeproj/project.pbxproj:
* page/DragActions.h:
* page/DragClient.h:
(WebCore::DragClient::declareAndWriteAttachment):
* page/DragController.cpp:
(WebCore::DragController::draggableElement):
(WebCore::DragController::startDrag):
* page/DragController.h:
(WebCore::DragController::draggingAttachmentURL):
* page/EventHandler.cpp:
(WebCore::EventHandler::dragHysteresisExceeded):
(WebCore::EventHandler::handleDrag):
* page/mac/DragControllerMac.mm:
(WebCore::DragController::declareAndWriteAttachment):
* page/win/DragControllerWin.cpp:
(WebCore::DragController::declareAndWriteAttachment):
* platform/URL.cpp:
(WebCore::URL::fileURLWithFileSystemPath):
* platform/URL.h:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::absoluteAttachmentURL):
* rendering/HitTestResult.h:

Source/WebKit/mac:

This patch adds all the necessary support to write attachment elements into
the pasteboard, including the promised type in WK1.

* Misc/WebNSPasteboardExtras.mm:
(-[NSPasteboard _web_declareAndWriteDragImageForElement:URL:title:archive:source:]):
* WebCoreSupport/WebDragClient.h:
* WebCoreSupport/WebDragClient.mm:
(WebDragClient::declareAndWriteAttachment):
* WebView/WebHTMLView.mm:
(-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):
* WebView/WebUIDelegate.h:

Source/WebKit2:

This patch adds all the necessary support to write attachment elements into
the pasteboard, including the promised type in WK2.

* UIProcess/API/mac/WKView.mm:
(-[WKView _setPromisedDataForImage:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]):
(-[WKView _setPromisedDataForAttachment:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]):
(-[WKView namesOfPromisedFilesDroppedAtDestination:]):
(-[WKView _setPromisedData:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::setPromisedDataForImage):
(WebKit::PageClientImpl::setPromisedDataForAttachment):
(WebKit::PageClientImpl::setPromisedData): Deleted.
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::setPromisedDataForImage):
(WebKit::WebPageProxy::setPromisedDataForAttachment):
(WebKit::WebPageProxy::setPromisedData): Deleted.
* WebProcess/WebCoreSupport/WebDragClient.h:
* WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
(WebKit::WebDragClient::declareAndWriteAttachment):
(WebKit::WebDragClient::declareAndWriteDragImage):

LayoutTests:

* editing/pasteboard/drag-and-drop-attachment-contenteditable-expected.txt: Added.
* editing/pasteboard/drag-and-drop-attachment-contenteditable.html: Added.
* platform/mac-wk2/TestExpectations: Skipping new test on WK2 since it uses eventSender.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepageDragActionsh">trunk/Source/WebCore/page/DragActions.h</a></li>
<li><a href="#trunkSourceWebCorepageDragClienth">trunk/Source/WebCore/page/DragClient.h</a></li>
<li><a href="#trunkSourceWebCorepageDragControllercpp">trunk/Source/WebCore/page/DragController.cpp</a></li>
<li><a href="#trunkSourceWebCorepageDragControllerh">trunk/Source/WebCore/page/DragController.h</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepagemacDragControllerMacmm">trunk/Source/WebCore/page/mac/DragControllerMac.mm</a></li>
<li><a href="#trunkSourceWebCorepagewinDragControllerWincpp">trunk/Source/WebCore/page/win/DragControllerWin.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformURLcpp">trunk/Source/WebCore/platform/URL.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformURLh">trunk/Source/WebCore/platform/URL.h</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestResultcpp">trunk/Source/WebCore/rendering/HitTestResult.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingHitTestResulth">trunk/Source/WebCore/rendering/HitTestResult.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacMiscWebNSPasteboardExtrasmm">trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebDragClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebDragClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebUIDelegateh">trunk/Source/WebKit/mac/WebView/WebUIDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewInternalh">trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebDragClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebDragClientMacmm">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingpasteboarddraganddropattachmentcontenteditableexpectedtxt">trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingpasteboarddraganddropattachmentcontenteditablehtml">trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/LayoutTests/ChangeLog        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2015-03-19  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        &lt;attachment&gt; should put URLs on the pasteboard so that Finder can accept drops.
+        https://bugs.webkit.org/show_bug.cgi?id=142801
+        rdar://problem/19982527
+
+        Reviewed by Tim Horton.
+
+        * editing/pasteboard/drag-and-drop-attachment-contenteditable-expected.txt: Added.
+        * editing/pasteboard/drag-and-drop-attachment-contenteditable.html: Added.
+        * platform/mac-wk2/TestExpectations: Skipping new test on WK2 since it uses eventSender.
+
</ins><span class="cx"> 2015-03-19  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         http://webkit.org/b/142790
</span><span class="lines">@@ -122,6 +134,7 @@
</span><span class="cx">         * fast/repaint/multiple-backgrounds-style-change-expected.txt: Added.
</span><span class="cx">         * fast/repaint/multiple-backgrounds-style-change.html: Added.
</span><span class="cx"> 
</span><ins>+&gt;&gt;&gt;&gt;&gt;&gt;&gt; .r181712
</ins><span class="cx"> 2015-03-18  Marcos Chavarría Teijeiro  &lt;chavarria1991@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed GTK Gardening 18th March
</span></span></pre></div>
<a id="trunkLayoutTestseditingpasteboarddraganddropattachmentcontenteditableexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable-expected.txt (0 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable-expected.txt                                (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable-expected.txt        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+These tests dragging an attachment element into contenteditable
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS target.getElementsByTagName(&quot;attachment&quot;).length is 1
+PASS target.getElementsByTagName(&quot;attachment&quot;)[0].file.name is &quot;apple.gif&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestseditingpasteboarddraganddropattachmentcontenteditablehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html (0 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html                                (rev 0)
+++ trunk/LayoutTests/editing/pasteboard/drag-and-drop-attachment-contenteditable.html        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;style&gt;
+#target {
+    height: 200px;
+    width: 220px;
+    border: 5px solid blue;
+}
+&lt;/style&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
+&lt;div id=&quot;test1&quot;&gt;&lt;attachment id='attachment'&gt;&lt;/attachment&gt;&lt;/div&gt;
+&lt;div contenteditable=true id=&quot;target&quot;&gt;&lt;/div&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+
+&lt;script&gt;
+    description('These tests dragging an attachment element into contenteditable');
+var jsTestIsAsync = true;
+var target = document.getElementById('target');
+
+function contentInserted() {
+    shouldBe('target.getElementsByTagName(&quot;attachment&quot;).length', '1');
+    shouldBeEqualToString('target.getElementsByTagName(&quot;attachment&quot;)[0].file.name', 'apple.gif');
+    finishJSTest();
+}
+
+function setupAttachment() {
+    if (window.internals) {
+        var attachment = document.getElementById('attachment');
+        attachment.file = window.internals.createFile(&quot;resources/apple.gif&quot;);
+    }
+}
+
+function runTest() {
+    setupAttachment();
+    target.addEventListener('DOMNodeInserted', contentInserted, false);
+    if (!window.testRunner)
+        return;
+    
+    testRunner.waitUntilDone();
+
+    e = document.getElementById(&quot;attachment&quot;);
+    x = e.offsetLeft + e.offsetWidth / 2;
+    y = e.offsetTop + e.offsetHeight / 2;
+
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseDown();
+    eventSender.leapForward(100);
+    e = document.getElementById(&quot;target&quot;);
+    x = e.offsetLeft + e.offsetWidth / 2;
+    y = e.offsetTop + e.offsetHeight / 2;
+
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseUp();
+}
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -23,6 +23,7 @@
</span><span class="cx"> editing/pasteboard/drag-and-drop-image-contenteditable.html
</span><span class="cx"> editing/pasteboard/drag-and-drop-inputimage-contenteditable.html
</span><span class="cx"> editing/pasteboard/drag-and-drop-objectimage-contenteditable.html
</span><ins>+editing/pasteboard/drag-and-drop-attachment-contenteditable.html
</ins><span class="cx"> editing/pasteboard/drag-drop-dead-frame.html
</span><span class="cx"> editing/pasteboard/drag-drop-input-textarea.html
</span><span class="cx"> editing/pasteboard/drag-drop-list.html
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/ChangeLog        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2015-03-19  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        &lt;attachment&gt; should put URLs on the pasteboard so that Finder can accept drops.
+        https://bugs.webkit.org/show_bug.cgi?id=142801
+        rdar://problem/19982527
+
+        Reviewed by Tim Horton.
+
+        Test: editing/pasteboard/drag-and-drop-attachment-contenteditable.html
+
+        This patch adds all the necessary support to write attachment elements into
+        the pasteboard, including the promised type.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * page/DragActions.h:
+        * page/DragClient.h:
+        (WebCore::DragClient::declareAndWriteAttachment):
+        * page/DragController.cpp:
+        (WebCore::DragController::draggableElement):
+        (WebCore::DragController::startDrag):
+        * page/DragController.h:
+        (WebCore::DragController::draggingAttachmentURL):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::dragHysteresisExceeded):
+        (WebCore::EventHandler::handleDrag):
+        * page/mac/DragControllerMac.mm:
+        (WebCore::DragController::declareAndWriteAttachment):
+        * page/win/DragControllerWin.cpp:
+        (WebCore::DragController::declareAndWriteAttachment):
+        * platform/URL.cpp:
+        (WebCore::URL::fileURLWithFileSystemPath):
+        * platform/URL.h:
+        * rendering/HitTestResult.cpp:
+        (WebCore::HitTestResult::absoluteAttachmentURL):
+        * rendering/HitTestResult.h:
+
</ins><span class="cx"> 2015-03-19  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, fix linking error after r181753.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -2527,7 +2527,7 @@
</span><span class="cx">                 7CC69941191EC5F500AF2270 /* JSWebKitNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CC6993F191EC5F500AF2270 /* JSWebKitNamespace.h */; };
</span><span class="cx">                 7CC7E3D717208C0F003C5277 /* IDNScriptWhiteList.txt in Resources */ = {isa = PBXBuildFile; fileRef = 7CC7E3D617208C0F003C5277 /* IDNScriptWhiteList.txt */; };
</span><span class="cx">                 7CD494CC1A86EB1D000A87EC /* RenderAttachment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CD494CA1A86EB1D000A87EC /* RenderAttachment.cpp */; };
</span><del>-                7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; };
</del><ins>+                7CD494CD1A86EB1D000A87EC /* RenderAttachment.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CD494CB1A86EB1D000A87EC /* RenderAttachment.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 7CDEEE1E197610D700E352CD /* ViewStateChangeObserver.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CDEEE1D197610D700E352CD /* ViewStateChangeObserver.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 7CE68344192143A800F4D928 /* UserMessageHandlerDescriptor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CE68342192143A800F4D928 /* UserMessageHandlerDescriptor.cpp */; };
</span><span class="cx">                 7CE68345192143A800F4D928 /* UserMessageHandlerDescriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 7CE68343192143A800F4D928 /* UserMessageHandlerDescriptor.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragActionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragActions.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragActions.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/page/DragActions.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -46,6 +46,9 @@
</span><span class="cx">         DragSourceActionImage        = 2,
</span><span class="cx">         DragSourceActionLink         = 4,
</span><span class="cx">         DragSourceActionSelection    = 8,
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+        DragSourceActionAttachment   = 16,
+#endif
</ins><span class="cx">         DragSourceActionAny          = UINT_MAX
</span><span class="cx">     } DragSourceAction;
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragClient.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragClient.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/page/DragClient.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -55,7 +55,10 @@
</span><span class="cx">     // Mac-specific helper function to allow access to web archives and NSPasteboard extras in WebKit.
</span><span class="cx">     // This is not abstract as that would require another #if PLATFORM(COCOA) for the SVGImage client empty implentation.
</span><span class="cx">     virtual void declareAndWriteDragImage(const String&amp;, Element&amp;, const URL&amp;, const String&amp;, Frame*) { }
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual void declareAndWriteAttachment(const String&amp;, Element&amp;, const URL&amp;, const String&amp;, Frame*) { }
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     virtual ~DragClient() { }
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.cpp (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.cpp        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/page/DragController.cpp        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><span class="cx"> #include &quot;FrameView.h&quot;
</span><span class="cx"> #include &quot;HTMLAnchorElement.h&quot;
</span><ins>+#include &quot;HTMLAttachmentElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLImageElement.h&quot;
</span><span class="cx"> #include &quot;HTMLInputElement.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="lines">@@ -623,6 +624,14 @@
</span><span class="cx">     state.type = (sourceFrame-&gt;selection().contains(dragOrigin)) ? DragSourceActionSelection : DragSourceActionNone;
</span><span class="cx">     if (!startElement)
</span><span class="cx">         return nullptr;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    // Unlike image elements, attachment elements are immediately selected upon mouse down,
+    // but for those elements we still want to use the single element drag behavior as long as
+    // the element is the only content of the selection.
+    const VisibleSelection&amp; selection = sourceFrame-&gt;selection().selection();
+    if (selection.isRange() &amp;&amp; is&lt;HTMLAttachmentElement&gt;(selection.start().anchorNode()) &amp;&amp; selection.start().anchorNode() == selection.end().anchorNode())
+        state.type = DragSourceActionNone;
+#endif
</ins><span class="cx"> 
</span><span class="cx">     for (auto renderer = startElement-&gt;renderer(); renderer; renderer = renderer-&gt;parent()) {
</span><span class="cx">         Element* element = renderer-&gt;nonPseudoElement();
</span><span class="lines">@@ -649,6 +658,14 @@
</span><span class="cx">                 state.type = static_cast&lt;DragSourceAction&gt;(state.type | DragSourceActionLink);
</span><span class="cx">                 return element;
</span><span class="cx">             }
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+            if ((m_dragSourceAction &amp; DragSourceActionAttachment)
+                &amp;&amp; is&lt;HTMLAttachmentElement&gt;(*element)
+                &amp;&amp; downcast&lt;HTMLAttachmentElement&gt;(*element).file()) {
+                state.type = static_cast&lt;DragSourceAction&gt;(state.type | DragSourceActionAttachment);
+                return element;
+            }
+#endif
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -738,6 +755,10 @@
</span><span class="cx">         return false;
</span><span class="cx">     URL linkURL = hitTestResult.absoluteLinkURL();
</span><span class="cx">     URL imageURL = hitTestResult.absoluteImageURL();
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    URL attachmentURL = hitTestResult.absoluteAttachmentURL();
+    m_draggingAttachmentURL = URL();
+#endif
</ins><span class="cx"> 
</span><span class="cx">     IntPoint mouseDraggedPoint = src.view()-&gt;windowToContents(dragEvent.position());
</span><span class="cx"> 
</span><span class="lines">@@ -853,6 +874,23 @@
</span><span class="cx">             dragImage = scaleDragImage(dragImage, FloatSize(m_page.deviceScaleFactor(), m_page.deviceScaleFactor()));
</span><span class="cx">         }
</span><span class="cx">         doSystemDrag(dragImage, dragLoc, mouseDraggedPoint, dataTransfer, src, true);
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    } else if (!attachmentURL.isEmpty() &amp;&amp; (m_dragSourceAction &amp; DragSourceActionAttachment)) {
+        if (!dataTransfer.pasteboard().hasData()) {
+            m_draggingAttachmentURL = attachmentURL;
+            selectElement(element);
+            declareAndWriteAttachment(dataTransfer, element, attachmentURL);
+        }
+        
+        m_client.willPerformDragSourceAction(DragSourceActionAttachment, dragOrigin, dataTransfer);
+        
+        if (!dragImage) {
+            dragImage = dissolveDragImageToFraction(createDragImageForSelection(src), DragImageAlpha);
+            dragLoc = dragLocForSelectionDrag(src);
+            m_dragOffset = IntPoint(dragOrigin.x() - dragLoc.x(), dragOrigin.y() - dragLoc.y());
+        }
+        doSystemDrag(dragImage, dragLoc, dragOrigin, dataTransfer, src, false);
+#endif
</ins><span class="cx">     } else if (state.type == DragSourceActionDHTML) {
</span><span class="cx">         if (dragImage) {
</span><span class="cx">             ASSERT(m_dragSourceAction &amp; DragSourceActionDHTML);
</span></span></pre></div>
<a id="trunkSourceWebCorepageDragControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/DragController.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/DragController.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/page/DragController.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -73,6 +73,9 @@
</span><span class="cx">         bool didInitiateDrag() const { return m_didInitiateDrag; }
</span><span class="cx">         DragOperation sourceDragOperation() const { return m_sourceDragOperation; }
</span><span class="cx">         const URL&amp; draggingImageURL() const { return m_draggingImageURL; }
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+        const URL&amp; draggingAttachmentURL() const { return m_draggingAttachmentURL; }
+#endif
</ins><span class="cx">         void setDragOffset(const IntPoint&amp; offset) { m_dragOffset = offset; }
</span><span class="cx">         const IntPoint&amp; dragOffset() const { return m_dragOffset; }
</span><span class="cx">         DragSourceAction dragSourceAction() const { return m_dragSourceAction; }
</span><span class="lines">@@ -114,7 +117,9 @@
</span><span class="cx">         void doSystemDrag(DragImageRef, const IntPoint&amp;, const IntPoint&amp;, DataTransfer&amp;, Frame&amp;, bool forLink);
</span><span class="cx">         void cleanupAfterSystemDrag();
</span><span class="cx">         void declareAndWriteDragImage(DataTransfer&amp;, Element&amp;, const URL&amp;, const String&amp; label);
</span><del>-
</del><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+        void declareAndWriteAttachment(DataTransfer&amp;, Element&amp;, const URL&amp;);
+#endif
</ins><span class="cx">         Page&amp; m_page;
</span><span class="cx">         DragClient&amp; m_client;
</span><span class="cx"> 
</span><span class="lines">@@ -130,6 +135,9 @@
</span><span class="cx">         DragOperation m_sourceDragOperation; // Set in startDrag when a drag starts from a mouse down within WebKit
</span><span class="cx">         IntPoint m_dragOffset;
</span><span class="cx">         URL m_draggingImageURL;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+        URL m_draggingAttachmentURL;
+#endif
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -3308,6 +3308,9 @@
</span><span class="cx">         threshold = TextDragHysteresis;
</span><span class="cx">         break;
</span><span class="cx">     case DragSourceActionImage:
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    case DragSourceActionAttachment:
+#endif
</ins><span class="cx">         threshold = ImageDragHysteresis;
</span><span class="cx">         break;
</span><span class="cx">     case DragSourceActionLink:
</span><span class="lines">@@ -3430,6 +3433,9 @@
</span><span class="cx">         ASSERT((dragState().type &amp; DragSourceActionSelection));
</span><span class="cx">         ASSERT((dragState().type &amp; ~DragSourceActionSelection) == DragSourceActionDHTML
</span><span class="cx">             || (dragState().type &amp; ~DragSourceActionSelection) == DragSourceActionImage
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+            || (dragState().type &amp; ~DragSourceActionSelection) == DragSourceActionAttachment
+#endif
</ins><span class="cx">             || (dragState().type &amp; ~DragSourceActionSelection) == DragSourceActionLink);
</span><span class="cx">         dragState().type = DragSourceActionSelection;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorepagemacDragControllerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/mac/DragControllerMac.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/DragControllerMac.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/page/mac/DragControllerMac.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -36,7 +36,9 @@
</span><span class="cx"> #import &quot;Editor.h&quot;
</span><span class="cx"> #import &quot;EditorClient.h&quot;
</span><span class="cx"> #import &quot;Element.h&quot;
</span><ins>+#import &quot;File.h&quot;
</ins><span class="cx"> #import &quot;FrameView.h&quot;
</span><ins>+#import &quot;HTMLAttachmentElement.h&quot;
</ins><span class="cx"> #import &quot;MainFrame.h&quot;
</span><span class="cx"> #import &quot;Page.h&quot;
</span><span class="cx"> #import &quot;Pasteboard.h&quot;
</span><span class="lines">@@ -87,6 +89,14 @@
</span><span class="cx">         dragEnded();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+void DragController::declareAndWriteAttachment(DataTransfer&amp; dataTransfer, Element&amp; element, const URL&amp; url)
+{
+    const HTMLAttachmentElement&amp; attachment = downcast&lt;HTMLAttachmentElement&gt;(element);
+    m_client.declareAndWriteAttachment(dataTransfer.pasteboard().name(), element, url, attachment.file()-&gt;path(), element.document().frame());
+}
+#endif
+    
</ins><span class="cx"> void DragController::declareAndWriteDragImage(DataTransfer&amp; dataTransfer, Element&amp; element, const URL&amp; url, const String&amp; label)
</span><span class="cx"> {
</span><span class="cx">     m_client.declareAndWriteDragImage(dataTransfer.pasteboard().name(), element, url, label, element.document().frame());
</span></span></pre></div>
<a id="trunkSourceWebCorepagewinDragControllerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/win/DragControllerWin.cpp (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/win/DragControllerWin.cpp        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/page/win/DragControllerWin.cpp        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -69,6 +69,12 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+void DragController::declareAndWriteAttachment(DataTransfer&amp;, Element&amp;, const URL&amp;)
+{
+}
+#endif
+
</ins><span class="cx"> void DragController::declareAndWriteDragImage(DataTransfer&amp; dataTransfer, Element&amp; element, const URL&amp; url, const String&amp; label)
</span><span class="cx"> {
</span><span class="cx">     Pasteboard&amp; pasteboard = dataTransfer.pasteboard();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformURLcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/URL.cpp (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/URL.cpp        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/platform/URL.cpp        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -2119,4 +2119,9 @@
</span><span class="cx">     return URL(URL(), &quot;webkit-fake-url://&quot; + createCanonicalUUIDString() + '/' + relativePart);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+URL URL::fileURLWithFileSystemPath(const String&amp; filePath)
+{
+    return URL(URL(), &quot;file:///&quot; + filePath);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoreplatformURLh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/URL.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/URL.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/platform/URL.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx">     URL(const URL&amp; base, const String&amp; relative, const TextEncoding&amp;);
</span><span class="cx"> 
</span><span class="cx">     static URL fakeURLWithRelativePart(const String&amp;);
</span><ins>+    static URL fileURLWithFileSystemPath(const String&amp;);
</ins><span class="cx"> 
</span><span class="cx">     String strippedForUseAsReferrer() const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestResult.cpp (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestResult.cpp        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/rendering/HitTestResult.cpp        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -25,11 +25,13 @@
</span><span class="cx"> #include &quot;CachedImage.h&quot;
</span><span class="cx"> #include &quot;DocumentMarkerController.h&quot;
</span><span class="cx"> #include &quot;Editor.h&quot;
</span><ins>+#include &quot;File.h&quot;
</ins><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><span class="cx"> #include &quot;FrameTree.h&quot;
</span><span class="cx"> #include &quot;HTMLAnchorElement.h&quot;
</span><span class="cx"> #include &quot;HTMLAreaElement.h&quot;
</span><ins>+#include &quot;HTMLAttachmentElement.h&quot;
</ins><span class="cx"> #include &quot;HTMLAudioElement.h&quot;
</span><span class="cx"> #include &quot;HTMLImageElement.h&quot;
</span><span class="cx"> #include &quot;HTMLInputElement.h&quot;
</span><span class="lines">@@ -310,6 +312,25 @@
</span><span class="cx">     return m_innerNonSharedNode-&gt;renderBox()-&gt;absoluteContentQuad().enclosingBoundingBox();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+URL HitTestResult::absoluteAttachmentURL() const
+{
+    if (!m_innerNonSharedNode)
+        return URL();
+    
+    if (!(m_innerNonSharedNode-&gt;renderer() &amp;&amp; m_innerNonSharedNode-&gt;renderer()-&gt;isAttachment()))
+        return URL();
+    
+    if (!is&lt;HTMLAttachmentElement&gt;(*m_innerNonSharedNode))
+        return URL();
+    File* attachmentFile = downcast&lt;HTMLAttachmentElement&gt;(*m_innerNonSharedNode).file();
+    if (!attachmentFile)
+        return URL();
+    
+    return URL::fileURLWithFileSystemPath(attachmentFile-&gt;path());
+}
+#endif
+
</ins><span class="cx"> URL HitTestResult::absoluteImageURL() const
</span><span class="cx"> {
</span><span class="cx">     if (!m_innerNonSharedNode)
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingHitTestResulth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/HitTestResult.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/HitTestResult.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebCore/rendering/HitTestResult.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -106,6 +106,9 @@
</span><span class="cx">     WEBCORE_EXPORT URL absolutePDFURL() const;
</span><span class="cx">     WEBCORE_EXPORT URL absoluteMediaURL() const;
</span><span class="cx">     WEBCORE_EXPORT URL absoluteLinkURL() const;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    WEBCORE_EXPORT URL absoluteAttachmentURL() const;
+#endif
</ins><span class="cx">     WEBCORE_EXPORT String textContent() const;
</span><span class="cx">     WEBCORE_EXPORT bool isLiveLink() const;
</span><span class="cx">     bool isOverLink() const;
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-03-19  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        &lt;attachment&gt; should put URLs on the pasteboard so that Finder can accept drops.
+        https://bugs.webkit.org/show_bug.cgi?id=142801
+        rdar://problem/19982527
+
+        Reviewed by Tim Horton.
+
+        This patch adds all the necessary support to write attachment elements into
+        the pasteboard, including the promised type in WK1.
+
+        * Misc/WebNSPasteboardExtras.mm:
+        (-[NSPasteboard _web_declareAndWriteDragImageForElement:URL:title:archive:source:]):
+        * WebCoreSupport/WebDragClient.h:
+        * WebCoreSupport/WebDragClient.mm:
+        (WebDragClient::declareAndWriteAttachment):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):
+        * WebView/WebUIDelegate.h:
+
</ins><span class="cx"> 2015-03-19  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Clean up DOMTimer related settings
</span></span></pre></div>
<a id="trunkSourceWebKitmacMiscWebNSPasteboardExtrasmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit/mac/Misc/WebNSPasteboardExtras.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx"> #import &lt;WebCore/Element.h&gt;
</span><span class="cx"> #import &lt;WebCore/Image.h&gt;
</span><span class="cx"> #import &lt;WebCore/MIMETypeRegistry.h&gt;
</span><ins>+#import &lt;WebCore/RenderAttachment.h&gt;
</ins><span class="cx"> #import &lt;WebCore/RenderImage.h&gt;
</span><span class="cx"> #import &lt;WebKitLegacy/DOMExtensions.h&gt;
</span><span class="cx"> #import &lt;WebKitLegacy/DOMPrivate.h&gt;
</span><span class="lines">@@ -271,21 +272,30 @@
</span><span class="cx">     ASSERT(self == [NSPasteboard pasteboardWithName:NSDragPboard]);
</span><span class="cx"> 
</span><span class="cx">     NSString *extension = @&quot;&quot;;
</span><ins>+    RetainPtr&lt;NSMutableArray&gt; types = adoptNS([[NSMutableArray alloc] initWithObjects:NSFilesPromisePboardType, nil]);
</ins><span class="cx">     if (auto* renderer = core(element)-&gt;renderer()) {
</span><span class="cx">         if (is&lt;RenderImage&gt;(*renderer)) {
</span><span class="cx">             if (CachedImage* image = downcast&lt;RenderImage&gt;(*renderer).cachedImage()) {
</span><span class="cx">                 extension = image-&gt;image()-&gt;filenameExtension();
</span><span class="cx">                 if (![extension length])
</span><span class="cx">                     return nullptr;
</span><ins>+                [types addObjectsFromArray:[NSPasteboard _web_writableTypesForImageIncludingArchive:(archive != nil)]];
+                [self declareTypes:types.get() owner:source];
</ins><span class="cx">             }
</span><span class="cx">         }
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+        else if (is&lt;RenderAttachment&gt;(*renderer)) {
+            extension = URL.pathExtension;
+            [types addObjectsFromArray:[NSPasteboard _web_dragTypesForURL]];
+            [self declareTypes:types.get() owner:source];
+            RetainPtr&lt;NSMutableArray&gt; paths = adoptNS([[NSMutableArray alloc] init]);
+            [paths.get() addObject:title];
+            [self setPropertyList:paths.get() forType:NSFilenamesPboardType];
+        }
+#endif
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    NSMutableArray *types = [[NSMutableArray alloc] initWithObjects:NSFilesPromisePboardType, nil];
-    [types addObjectsFromArray:[NSPasteboard _web_writableTypesForImageIncludingArchive:(archive != nil)]];
-    [self declareTypes:types owner:source];    
-    [self _web_writeImage:nil element:element URL:URL title:title archive:archive types:types source:source];
-    [types release];
</del><ins>+    [self _web_writeImage:nil element:element URL:URL title:title archive:archive types:types.get() source:source];
</ins><span class="cx"> 
</span><span class="cx">     NSArray *extensions = [[NSArray alloc] initWithObjects:extension, nil];
</span><span class="cx">     [self setPropertyList:extensions forType:NSFilesPromisePboardType];
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebDragClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -39,6 +39,9 @@
</span><span class="cx">     virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&amp; windowPoint) override;
</span><span class="cx">     virtual void startDrag(WebCore::DragImageRef, const WebCore::IntPoint&amp; dragPos, const WebCore::IntPoint&amp; eventPos, WebCore::DataTransfer&amp;, WebCore::Frame&amp;, bool linkDrag) override;
</span><span class="cx">     virtual void declareAndWriteDragImage(const String&amp; pasteboardName, WebCore::Element&amp;, const WebCore::URL&amp;, const String&amp;, WebCore::Frame*) override;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual void declareAndWriteAttachment(const String&amp; pasteboardName, WebCore::Element&amp;, const WebCore::URL&amp;, const String&amp; path, WebCore::Frame*) override;
+#endif
</ins><span class="cx"> private:
</span><span class="cx">     WebView* m_webView;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebDragClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebDragClient.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -127,11 +127,17 @@
</span><span class="cx"> void WebDragClient::declareAndWriteDragImage(const String&amp; pasteboardName, Element&amp; element, const URL&amp; url, const String&amp; title, WebCore::Frame* frame)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(pasteboardName);
</span><del>-    WebHTMLView *source = getTopHTMLView(frame);
-    WebArchive *archive = [kit(&amp;element) webArchive];
</del><ins>+    [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:kit(&amp;element) URL:url title:title archive:[kit(&amp;element) webArchive] source:getTopHTMLView(frame)];
+}
+
+#if ENABLE(ATTACHMENT_ELEMENT)
+void WebDragClient::declareAndWriteAttachment(const String&amp; pasteboardName, Element&amp; element, const URL&amp; url, const String&amp; path, WebCore::Frame* frame)
+{
+    ASSERT(pasteboardName);
</ins><span class="cx">     
</span><del>-    [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:kit(&amp;element) URL:url title:title archive:archive source:source];
</del><ins>+    [[NSPasteboard pasteboardWithName:pasteboardName] _web_declareAndWriteDragImageForElement:kit(&amp;element) URL:url title:path archive:nil source:getTopHTMLView(frame)];
</ins><span class="cx"> }
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> void WebDragClient::dragControllerDestroyed() 
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -3962,12 +3962,12 @@
</span><span class="cx"> - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
</span><span class="cx"> {
</span><span class="cx">     NSFileWrapper *wrapper = nil;
</span><del>-    NSURL *draggingImageURL = nil;
</del><ins>+    NSURL *draggingElementURL = nil;
</ins><span class="cx">     
</span><span class="cx">     if (WebCore::CachedImage* tiffResource = [self promisedDragTIFFDataSource]) {
</span><span class="cx">         if (auto* buffer = tiffResource-&gt;resourceBuffer()) {
</span><span class="cx">             NSURLResponse *response = tiffResource-&gt;response().nsURLResponse();
</span><del>-            draggingImageURL = [response URL];
</del><ins>+            draggingElementURL = [response URL];
</ins><span class="cx">             wrapper = [[[NSFileWrapper alloc] initRegularFileWithContents:buffer-&gt;createNSData().get()] autorelease];
</span><span class="cx">             NSString* filename = [response suggestedFilename];
</span><span class="cx">             NSString* trueExtension(tiffResource-&gt;image()-&gt;filenameExtension());
</span><span class="lines">@@ -3988,10 +3988,14 @@
</span><span class="cx">             return nil; 
</span><span class="cx">         
</span><span class="cx">         const URL&amp; imageURL = page-&gt;dragController().draggingImageURL();
</span><del>-        ASSERT(!imageURL.isEmpty());
-        draggingImageURL = imageURL;
</del><ins>+        if (!imageURL.isEmpty())
+            draggingElementURL = imageURL;
+#if ENABLE(ATTACHMENT_ELEMENT)
+        else
+            draggingElementURL = page-&gt;dragController().draggingAttachmentURL();
+#endif
</ins><span class="cx"> 
</span><del>-        wrapper = [[self _dataSource] _fileWrapperForURL:draggingImageURL];
</del><ins>+        wrapper = [[self _dataSource] _fileWrapperForURL:draggingElementURL];
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     if (wrapper == nil) {
</span><span class="lines">@@ -4005,8 +4009,8 @@
</span><span class="cx">     if (![wrapper writeToURL:[NSURL fileURLWithPath:path] options:NSFileWrapperWritingWithNameUpdating originalContentsURL:nil error:nullptr])
</span><span class="cx">         LOG_ERROR(&quot;Failed to create image file via -[NSFileWrapper writeToURL:options:originalContentsURL:error:]&quot;);
</span><span class="cx">     
</span><del>-    if (draggingImageURL)
-        [[NSFileManager defaultManager] _webkit_setMetadataURL:[draggingImageURL absoluteString] referrer:nil atPath:path];
</del><ins>+    if (draggingElementURL)
+        [[NSFileManager defaultManager] _webkit_setMetadataURL:[draggingElementURL absoluteString] referrer:nil atPath:path];
</ins><span class="cx">     
</span><span class="cx">     return [NSArray arrayWithObject:[path lastPathComponent]];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebUIDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebUIDelegate.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebUIDelegate.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit/mac/WebView/WebUIDelegate.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -112,6 +112,7 @@
</span><span class="cx">     WebDragSourceActionImage        = 2,
</span><span class="cx">     WebDragSourceActionLink         = 4,
</span><span class="cx">     WebDragSourceActionSelection    = 8,
</span><ins>+    WebDragSourceActionAttachment   = 16,
</ins><span class="cx">     WebDragSourceActionAny          = UINT_MAX
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/ChangeLog        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2015-03-19  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+        &lt;attachment&gt; should put URLs on the pasteboard so that Finder can accept drops.
+        https://bugs.webkit.org/show_bug.cgi?id=142801
+        rdar://problem/19982527
+
+        Reviewed by Tim Horton.
+
+        This patch adds all the necessary support to write attachment elements into
+        the pasteboard, including the promised type in WK2.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _setPromisedDataForImage:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]):
+        (-[WKView _setPromisedDataForAttachment:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]):
+        (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
+        (-[WKView _setPromisedData:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]): Deleted.
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::setPromisedDataForImage):
+        (WebKit::PageClientImpl::setPromisedDataForAttachment):
+        (WebKit::PageClientImpl::setPromisedData): Deleted.
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::setPromisedDataForImage):
+        (WebKit::WebPageProxy::setPromisedDataForAttachment):
+        (WebKit::WebPageProxy::setPromisedData): Deleted.
+        * WebProcess/WebCoreSupport/WebDragClient.h:
+        * WebProcess/WebCoreSupport/mac/WebDragClientMac.mm:
+        (WebKit::WebDragClient::declareAndWriteAttachment):
+        (WebKit::WebDragClient::declareAndWriteDragImage):
+
</ins><span class="cx"> 2015-03-19  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Cache::remove should take a Key instead of an entry
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -3379,31 +3379,54 @@
</span><span class="cx">                                                                      &amp;&amp; hasCaseInsensitiveSuffix(filename, @&quot;.jpg&quot;));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName
-
</del><ins>+- (void)_setFileAndURLTypes:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl forPasteboard:(NSPasteboard *)pasteboard
</ins><span class="cx"> {
</span><del>-    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:pasteboardName];
-    RetainPtr&lt;NSMutableArray&gt; types = adoptNS([[NSMutableArray alloc] initWithObjects:NSFilesPromisePboardType, nil]);
-    
-    [types addObjectsFromArray:archiveBuffer ? PasteboardTypes::forImagesWithArchive() : PasteboardTypes::forImages()];
-    [pasteboard declareTypes:types.get() owner:self];
</del><span class="cx">     if (!matchesExtensionOrEquivalent(filename, extension))
</span><span class="cx">         filename = [[filename stringByAppendingString:@&quot;.&quot;] stringByAppendingString:extension];
</span><del>-
</del><ins>+    
</ins><span class="cx">     [pasteboard setString:visibleUrl forType:NSStringPboardType];
</span><span class="cx">     [pasteboard setString:visibleUrl forType:PasteboardTypes::WebURLPboardType];
</span><span class="cx">     [pasteboard setString:title forType:PasteboardTypes::WebURLNamePboardType];
</span><span class="cx">     [pasteboard setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:visibleUrl], [NSArray arrayWithObject:title], nil] forType:PasteboardTypes::WebURLsWithTitlesPboardType];
</span><span class="cx">     [pasteboard setPropertyList:[NSArray arrayWithObject:extension] forType:NSFilesPromisePboardType];
</span><ins>+    _data-&gt;_promisedFilename = filename;
+    _data-&gt;_promisedURL = url;
+}
</ins><span class="cx"> 
</span><ins>+- (void)_setPromisedDataForImage:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName
+
+{
+    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:pasteboardName];
+    RetainPtr&lt;NSMutableArray&gt; types = adoptNS([[NSMutableArray alloc] initWithObjects:NSFilesPromisePboardType, nil]);
+    
+    [types addObjectsFromArray:archiveBuffer ? PasteboardTypes::forImagesWithArchive() : PasteboardTypes::forImages()];
+    [pasteboard declareTypes:types.get() owner:self];
+    [self _setFileAndURLTypes:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl forPasteboard:pasteboard];
+
</ins><span class="cx">     if (archiveBuffer)
</span><span class="cx">         [pasteboard setData:archiveBuffer-&gt;createNSData().get() forType:PasteboardTypes::WebArchivePboardType];
</span><span class="cx"> 
</span><span class="cx">     _data-&gt;_promisedImage = image;
</span><del>-    _data-&gt;_promisedFilename = filename;
-    _data-&gt;_promisedURL = url;
</del><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+- (void)_setPromisedDataForAttachment:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl forPasteboard:(NSString *)pasteboardName
+
+{
+    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:pasteboardName];
+    RetainPtr&lt;NSMutableArray&gt; types = adoptNS([[NSMutableArray alloc] initWithObjects:NSFilesPromisePboardType, nil]);
+    [types addObjectsFromArray:PasteboardTypes::forURL()];
+    [pasteboard declareTypes:types.get() owner:self];
+    [self _setFileAndURLTypes:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl forPasteboard:pasteboard];
+
+    RetainPtr&lt;NSMutableArray&gt; paths = adoptNS([[NSMutableArray alloc] init]);
+    [paths addObject:title];
+    [pasteboard setPropertyList:paths.get() forType:NSFilenamesPboardType];
+
+    _data-&gt;_promisedImage = nullptr;
+}
+#endif
+
</ins><span class="cx"> - (void)pasteboardChangedOwner:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><span class="cx">     _data-&gt;_promisedImage = 0;
</span><span class="lines">@@ -3467,10 +3490,12 @@
</span><span class="cx">     if (_data-&gt;_promisedImage) {
</span><span class="cx">         data = _data-&gt;_promisedImage-&gt;data()-&gt;createNSData();
</span><span class="cx">         wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:data.get()]);
</span><ins>+    } else
+        wrapper = adoptNS([[NSFileWrapper alloc] initWithURL:[NSURL URLWithString:_data-&gt;_promisedURL] options:NSFileWrapperReadingImmediate error:nil]);
+    
+    if (wrapper)
</ins><span class="cx">         [wrapper setPreferredFilename:_data-&gt;_promisedFilename];
</span><del>-    }
-    
-    if (!wrapper) {
</del><ins>+    else {
</ins><span class="cx">         LOG_ERROR(&quot;Failed to create image file.&quot;);
</span><span class="cx">         return nil;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -101,7 +101,10 @@
</span><span class="cx"> - (void)_setPluginComplexTextInputState:(WebKit::PluginComplexTextInputState)pluginComplexTextInputState pluginComplexTextInputIdentifier:(uint64_t)pluginComplexTextInputIdentifier;
</span><span class="cx"> 
</span><span class="cx"> - (void)_setDragImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag;
</span><del>-- (void)_setPromisedData:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName;
</del><ins>+- (void)_setPromisedDataForImage:(WebCore::Image *)image withFileName:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl withArchive:(WebCore::SharedBuffer*) archiveBuffer forPasteboard:(NSString *)pasteboardName;
+#if ENABLE(ATTACHMENT_ELEMENT)
+- (void)_setPromisedDataForAttachment:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl forPasteboard:(NSString *)pasteboardName;
+#endif
</ins><span class="cx"> - (void)_updateSecureInputState;
</span><span class="cx"> - (void)_resetSecureInputState;
</span><span class="cx"> - (void)_notifyInputContextAboutDiscardedComposition;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -191,9 +191,14 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(APPKIT)
</span><del>-    virtual void setPromisedData(const String&amp; pasteboardName, PassRefPtr&lt;WebCore::SharedBuffer&gt; imageBuffer, const String&amp; filename, const String&amp; extension, const String&amp; title,
</del><ins>+    virtual void setPromisedDataForImage(const String&amp; pasteboardName, PassRefPtr&lt;WebCore::SharedBuffer&gt; imageBuffer, const String&amp; filename, const String&amp; extension, const String&amp; title,
</ins><span class="cx">                                  const String&amp; url, const String&amp; visibleUrl, PassRefPtr&lt;WebCore::SharedBuffer&gt; archiveBuffer) = 0;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual void setPromisedDataForAttachment(const String&amp; pasteboardName, const String&amp; filename, const String&amp; extension, const String&amp; title,
+                                         const String&amp; url, const String&amp; visibleUrl) = 0;
+
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     virtual void getEditorCommandsForKeyEvent(const NativeWebKeyboardEvent&amp;, const AtomicString&amp;, Vector&lt;WTF::String&gt;&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -769,9 +769,12 @@
</span><span class="cx">     void dragEnded(const WebCore::IntPoint&amp; clientPosition, const WebCore::IntPoint&amp; globalPosition, uint64_t operation);
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     void setDragImage(const WebCore::IntPoint&amp; clientPosition, const ShareableBitmap::Handle&amp; dragImageHandle, bool isLinkDrag);
</span><del>-    void setPromisedData(const String&amp; pasteboardName, const SharedMemory::Handle&amp; imageHandle, uint64_t imageSize, const String&amp; filename, const String&amp; extension,
</del><ins>+    void setPromisedDataForImage(const String&amp; pasteboardName, const SharedMemory::Handle&amp; imageHandle, uint64_t imageSize, const String&amp; filename, const String&amp; extension,
</ins><span class="cx">                          const String&amp; title, const String&amp; url, const String&amp; visibleURL, const SharedMemory::Handle&amp; archiveHandle, uint64_t archiveSize);
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    void setPromisedDataForAttachment(const String&amp; pasteboardName, const String&amp; filename, const String&amp; extension, const String&amp; title, const String&amp; url, const String&amp; visibleURL);
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     void startDrag(const WebCore::DragData&amp;, const ShareableBitmap::Handle&amp; dragImage);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -297,8 +297,11 @@
</span><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(COCOA) &amp;&amp; ENABLE(DRAG_SUPPORT)
</span><span class="cx">     SetDragImage(WebCore::IntPoint clientPosition, WebKit::ShareableBitmap::Handle dragImage, bool linkDrag)
</span><del>-    SetPromisedData(String pasteboardName, WebKit::SharedMemory::Handle imageHandle, uint64_t imageSize, String filename, String extension, String title, String url, String visibleURL, WebKit::SharedMemory::Handle archiveHandle, uint64_t archiveSize)
</del><ins>+    SetPromisedDataForImage(String pasteboardName, WebKit::SharedMemory::Handle imageHandle, uint64_t imageSize, String filename, String extension, String title, String url, String visibleURL, WebKit::SharedMemory::Handle archiveHandle, uint64_t archiveSize)
+#if ENABLE(ATTACHMENT_ELEMENT)
+    SetPromisedDataForAttachment(String pasteboardName, String filename, String extension, String title, String url, String visibleURL)
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> #if PLATFORM(GTK) &amp;&amp; ENABLE(DRAG_SUPPORT)
</span><span class="cx">     StartDrag(WebCore::DragData dragData, WebKit::ShareableBitmap::Handle dragImage)
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -94,8 +94,11 @@
</span><span class="cx">     virtual void executeUndoRedo(WebPageProxy::UndoOrRedo) override;
</span><span class="cx">     virtual bool executeSavedCommandBySelector(const String&amp; selector) override;
</span><span class="cx">     virtual void setDragImage(const WebCore::IntPoint&amp; clientPosition, PassRefPtr&lt;ShareableBitmap&gt; dragImage, bool isLinkDrag) override;
</span><del>-    virtual void setPromisedData(const String&amp; pasteboardName, PassRefPtr&lt;WebCore::SharedBuffer&gt; imageBuffer, const String&amp; filename, const String&amp; extension, const String&amp; title,
</del><ins>+    virtual void setPromisedDataForImage(const String&amp; pasteboardName, PassRefPtr&lt;WebCore::SharedBuffer&gt; imageBuffer, const String&amp; filename, const String&amp; extension, const String&amp; title,
</ins><span class="cx">         const String&amp; url, const String&amp; visibleUrl, PassRefPtr&lt;WebCore::SharedBuffer&gt; archiveBuffer) override;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual void setPromisedDataForAttachment(const String&amp; pasteboardName, const String&amp; filename, const String&amp; extension, const String&amp; title, const String&amp; url, const String&amp; visibleUrl) override;
+#endif
</ins><span class="cx">     virtual void updateSecureInputState() override;
</span><span class="cx">     virtual void resetSecureInputState() override;
</span><span class="cx">     virtual void notifyInputContextAboutDiscardedComposition() override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -407,13 +407,20 @@
</span><span class="cx">     [m_wkView _setDragImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageClientImpl::setPromisedData(const String&amp; pasteboardName, PassRefPtr&lt;SharedBuffer&gt; imageBuffer, const String&amp; filename, const String&amp; extension, const String&amp; title, const String&amp; url, const String&amp; visibleUrl, PassRefPtr&lt;SharedBuffer&gt; archiveBuffer)
</del><ins>+void PageClientImpl::setPromisedDataForImage(const String&amp; pasteboardName, PassRefPtr&lt;SharedBuffer&gt; imageBuffer, const String&amp; filename, const String&amp; extension, const String&amp; title, const String&amp; url, const String&amp; visibleUrl, PassRefPtr&lt;SharedBuffer&gt; archiveBuffer)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Image&gt; image = BitmapImage::create();
</span><span class="cx">     image-&gt;setData(imageBuffer.get(), true);
</span><del>-    [m_wkView _setPromisedData:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName];
</del><ins>+    [m_wkView _setPromisedDataForImage:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+void PageClientImpl::setPromisedDataForAttachment(const String&amp; pasteboardName, const String&amp; filename, const String&amp; extension, const String&amp; title, const String&amp; url, const String&amp; visibleUrl)
+{
+    [m_wkView _setPromisedDataForAttachment:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl forPasteboard:pasteboardName];
+}
+#endif
+
</ins><span class="cx"> void PageClientImpl::updateSecureInputState()
</span><span class="cx"> {
</span><span class="cx">     [m_wkView _updateSecureInputState];
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -60,6 +60,7 @@
</span><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process().connection())
</span><ins>+#define MESSAGE_CHECK_URL(url) MESSAGE_CHECK_BASE(m_process-&gt;checkURLReceivedFromWebProcess(url), m_process-&gt;connection())
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -407,9 +408,11 @@
</span><span class="cx">     process().send(Messages::WebPage::DidStartDrag(), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::setPromisedData(const String&amp; pasteboardName, const SharedMemory::Handle&amp; imageHandle, uint64_t imageSize, const String&amp; filename, const String&amp; extension,
</del><ins>+void WebPageProxy::setPromisedDataForImage(const String&amp; pasteboardName, const SharedMemory::Handle&amp; imageHandle, uint64_t imageSize, const String&amp; filename, const String&amp; extension,
</ins><span class="cx">                                    const String&amp; title, const String&amp; url, const String&amp; visibleURL, const SharedMemory::Handle&amp; archiveHandle, uint64_t archiveSize)
</span><span class="cx"> {
</span><ins>+    MESSAGE_CHECK_URL(url);
+    MESSAGE_CHECK_URL(visibleURL);
</ins><span class="cx">     RefPtr&lt;SharedMemory&gt; sharedMemoryImage = SharedMemory::create(imageHandle, SharedMemory::ReadOnly);
</span><span class="cx">     RefPtr&lt;SharedBuffer&gt; imageBuffer = SharedBuffer::create(static_cast&lt;unsigned char*&gt;(sharedMemoryImage-&gt;data()), imageSize);
</span><span class="cx">     RefPtr&lt;SharedBuffer&gt; archiveBuffer;
</span><span class="lines">@@ -418,9 +421,18 @@
</span><span class="cx">         RefPtr&lt;SharedMemory&gt; sharedMemoryArchive = SharedMemory::create(archiveHandle, SharedMemory::ReadOnly);;
</span><span class="cx">         archiveBuffer = SharedBuffer::create(static_cast&lt;unsigned char*&gt;(sharedMemoryArchive-&gt;data()), archiveSize);
</span><span class="cx">     }
</span><del>-    m_pageClient.setPromisedData(pasteboardName, imageBuffer, filename, extension, title, url, visibleURL, archiveBuffer);
</del><ins>+    m_pageClient.setPromisedDataForImage(pasteboardName, imageBuffer, filename, extension, title, url, visibleURL, archiveBuffer);
</ins><span class="cx"> }
</span><ins>+
+#if ENABLE(ATTACHMENT_ELEMENT)
+void WebPageProxy::setPromisedDataForAttachment(const String&amp; pasteboardName, const String&amp; filename, const String&amp; extension, const String&amp; title, const String&amp; url, const String&amp; visibleURL)
+{
+    MESSAGE_CHECK_URL(url);
+    MESSAGE_CHECK_URL(visibleURL);
+    m_pageClient.setPromisedDataForAttachment(pasteboardName, filename, extension, title, url, visibleURL);
+}
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx"> void WebPageProxy::performDictionaryLookupAtLocation(const WebCore::FloatPoint&amp; point)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebDragClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebDragClient.h        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -51,7 +51,10 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     virtual void declareAndWriteDragImage(const String&amp; pasteboardName, WebCore::Element&amp;, const WebCore::URL&amp;, const String&amp;, WebCore::Frame*) override;
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+    virtual void declareAndWriteAttachment(const String&amp; pasteboardName, WebCore::Element&amp;, const WebCore::URL&amp;, const String&amp; path, WebCore::Frame*) override;
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     virtual void dragControllerDestroyed() override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebDragClientMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm (181759 => 181760)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm        2015-03-19 21:44:59 UTC (rev 181759)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebDragClientMac.mm        2015-03-19 21:59:23 UTC (rev 181760)
</span><span class="lines">@@ -97,6 +97,16 @@
</span><span class="cx">     return image;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(ATTACHMENT_ELEMENT)
+void WebDragClient::declareAndWriteAttachment(const String&amp; pasteboardName, Element&amp; element, const URL&amp; url, const String&amp; path, WebCore::Frame* frame)
+{
+    ASSERT(pasteboardName == String(NSDragPboard));
+    
+    NSURL* nsURL = (NSURL *)url;
+    m_page-&gt;send(Messages::WebPageProxy::SetPromisedDataForAttachment(pasteboardName, String(nsURL.lastPathComponent), String(nsURL.pathExtension), path, String(nsURL.absoluteString), userVisibleString(nsURL)));
+}
+#endif
+
</ins><span class="cx"> void WebDragClient::declareAndWriteDragImage(const String&amp; pasteboardName, Element&amp; element, const URL&amp; url, const String&amp; label, Frame*)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(pasteboardName == String(NSDragPboard));
</span><span class="lines">@@ -143,7 +153,7 @@
</span><span class="cx">         memcpy(archiveSharedMemoryBuffer-&gt;data(), archiveBuffer-&gt;data(), archiveSize);
</span><span class="cx">         archiveSharedMemoryBuffer-&gt;createHandle(archiveHandle, SharedMemory::ReadOnly);
</span><span class="cx">     }
</span><del>-    m_page-&gt;send(Messages::WebPageProxy::SetPromisedData(pasteboardName, imageHandle, imageSize, String([response suggestedFilename]), extension, title, String([[response URL] absoluteString]), userVisibleString((NSURL *)url), archiveHandle, archiveSize));
</del><ins>+    m_page-&gt;send(Messages::WebPageProxy::SetPromisedDataForImage(pasteboardName, imageHandle, imageSize, String([response suggestedFilename]), extension, title, String([[response URL] absoluteString]), userVisibleString((NSURL *)url), archiveHandle, archiveSize));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>