<!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>[211906] 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/211906">211906</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2017-02-08 15:30:52 -0800 (Wed, 08 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
https://bugs.webkit.org/show_bug.cgi?id=167942
&lt;rdar://problem/30315079&gt;

Reviewed by Tim Horton.

Source/WebCore:

Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm.
Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform
NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the
pasteboard as text and an image, respectively.

New TestWebKitAPI tests in DragAndDropPasteboardTests.mm.

* platform/mac/DragDataMac.mm:
(WebCore::DragData::containsCompatibleContent):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::read):

Tools:

Adds a new test case that simulates dragging from a source that only vends JPEG images or UTF8 plaintext into a
contenteditable area. An image element and the plain text content, respectively, should be inserted into the
contenteditable in these cases.

The DragSource and DragInfo are used to mock dragging into the WebView. There is no reliance on using mouse
events in this test, since we call the dragging delegate methods (draggingEntered:, draggingUpdated:, and
performDragOperation:) directly.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm: Added.
(+[FrameLoadCompletionListener listenerWithCompletionBlock:]):
(-[FrameLoadCompletionListener initWithCompletionBlock:]):
(-[FrameLoadCompletionListener webView:didFinishLoadForFrame:]):
(-[DragSource draggingSourceOperationMaskForLocal:]):
(-[DragInfo initWithImage:offset:pasteboard:source:destinationWindow:]):
(-[DragInfo lastMousePosition]):
(-[DragInfo setLastMousePosition:]):
(-[DragInfo draggingDestinationWindow]):
(-[DragInfo draggingSourceOperationMask]):
(-[DragInfo draggingLocation]):
(-[DragInfo draggedImageLocation]):
(-[DragInfo draggedImage]):
(-[DragInfo draggingPasteboard]):
(-[DragInfo draggingSource]):
(-[DragInfo draggingSequenceNumber]):
(-[DragInfo slideDraggedImageTo:]):
(-[DragInfo namesOfPromisedFilesDroppedAtDestination:]):
(-[DragInfo draggingFormation]):
(-[DragInfo setDraggingFormation:]):
(-[DragInfo animatesToDestination]):
(-[DragInfo setAnimatesToDestination:]):
(-[DragInfo numberOfValidItemsForDrop]):
(-[DragInfo setNumberOfValidItemsForDrop:]):
(-[DragInfo enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:]):
(-[DragInfo springLoadingHighlight]):
(-[DragInfo resetSpringLoading]):
(TestWebKitAPI::getTestImage):
(TestWebKitAPI::webViewAfterPerformingDragOperation):
(TestWebKitAPI::TEST):
* TestWebKitAPI/Tests/mac/full-page-contenteditable.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformmacDragDataMacmm">trunk/Source/WebCore/platform/mac/DragDataMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformmacPasteboardMacmm">trunk/Source/WebCore/platform/mac/PasteboardMac.mm</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsmacDragAndDropPasteboardTestsmm">trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsmacfullpagecontenteditablehtml">trunk/Tools/TestWebKitAPI/Tests/mac/full-page-contenteditable.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (211905 => 211906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-08 23:15:58 UTC (rev 211905)
+++ trunk/Source/WebCore/ChangeLog        2017-02-08 23:30:52 UTC (rev 211906)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2017-02-08  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
+        https://bugs.webkit.org/show_bug.cgi?id=167942
+        &lt;rdar://problem/30315079&gt;
+
+        Reviewed by Tim Horton.
+
+        Adds UTI types for dragging UTF8 plain text and JPEG images to the list of supported types in DragDataMac.mm.
+        Also handles reading these types in PasteboardMac.mm. I verified manually with a test app that if a platform
+        NSView vends only UTF8 plaintext or JPEG images when dragging, WebKit is able to read the contents of the
+        pasteboard as text and an image, respectively.
+
+        New TestWebKitAPI tests in DragAndDropPasteboardTests.mm.
+
+        * platform/mac/DragDataMac.mm:
+        (WebCore::DragData::containsCompatibleContent):
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::Pasteboard::read):
+
</ins><span class="cx"> 2017-02-08  Said Abou-Hallawa  &lt;sabouhallawa@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         getIntersectionList always returns empty NodeList until layout is complete
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacDragDataMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/DragDataMac.mm (211905 => 211906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/DragDataMac.mm        2017-02-08 23:15:58 UTC (rev 211905)
+++ trunk/Source/WebCore/platform/mac/DragDataMac.mm        2017-02-08 23:30:52 UTC (rev 211906)
</span><span class="lines">@@ -204,8 +204,10 @@
</span><span class="cx">         || types.contains(urlPasteboardType())
</span><span class="cx">         || types.contains(rtfdPasteboardType())
</span><span class="cx">         || types.contains(rtfPasteboardType())
</span><ins>+        || types.contains(String(kUTTypeUTF8PlainText))
</ins><span class="cx">         || types.contains(stringPasteboardType())
</span><span class="cx">         || types.contains(colorPasteboardType())
</span><ins>+        || types.contains(String(kUTTypeJPEG))
</ins><span class="cx">         || types.contains(String(kUTTypePNG));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacPasteboardMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/PasteboardMac.mm (211905 => 211906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/PasteboardMac.mm        2017-02-08 23:15:58 UTC (rev 211905)
+++ trunk/Source/WebCore/platform/mac/PasteboardMac.mm        2017-02-08 23:30:52 UTC (rev 211906)
</span><span class="lines">@@ -414,6 +414,13 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (types.contains(String(kUTTypeJPEG))) {
+        if (RefPtr&lt;SharedBuffer&gt; buffer = strategy.bufferForType(kUTTypeJPEG, m_pasteboardName)) {
+            if (reader.readImage(buffer.releaseNonNull(), ASCIILiteral(&quot;image/jpeg&quot;)))
+                return;
+        }
+    }
+
</ins><span class="cx">     if (types.contains(String(NSURLPboardType))) {
</span><span class="cx">         URL url = strategy.url(m_pasteboardName);
</span><span class="cx">         String title = strategy.stringForType(WebURLNamePboardType, m_pasteboardName);
</span><span class="lines">@@ -426,6 +433,12 @@
</span><span class="cx">         if (!string.isNull() &amp;&amp; reader.readPlainText(string))
</span><span class="cx">             return;
</span><span class="cx">     }
</span><ins>+
+    if (types.contains(String(kUTTypeUTF8PlainText))) {
+        String string = strategy.stringForType(kUTTypeUTF8PlainText, m_pasteboardName);
+        if (!string.isNull() &amp;&amp; reader.readPlainText(string))
+            return;
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool Pasteboard::hasData()
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (211905 => 211906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-02-08 23:15:58 UTC (rev 211905)
+++ trunk/Tools/ChangeLog        2017-02-08 23:30:52 UTC (rev 211906)
</span><span class="lines">@@ -1,3 +1,52 @@
</span><ins>+2017-02-08  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
+
+        Add kUTTypeUTF8PlainText and kUTTypeJPEG to the list of compatible content types in DragData
+        https://bugs.webkit.org/show_bug.cgi?id=167942
+        &lt;rdar://problem/30315079&gt;
+
+        Reviewed by Tim Horton.
+
+        Adds a new test case that simulates dragging from a source that only vends JPEG images or UTF8 plaintext into a
+        contenteditable area. An image element and the plain text content, respectively, should be inserted into the
+        contenteditable in these cases.
+
+        The DragSource and DragInfo are used to mock dragging into the WebView. There is no reliance on using mouse
+        events in this test, since we call the dragging delegate methods (draggingEntered:, draggingUpdated:, and
+        performDragOperation:) directly.
+
+        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+        * TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm: Added.
+        (+[FrameLoadCompletionListener listenerWithCompletionBlock:]):
+        (-[FrameLoadCompletionListener initWithCompletionBlock:]):
+        (-[FrameLoadCompletionListener webView:didFinishLoadForFrame:]):
+        (-[DragSource draggingSourceOperationMaskForLocal:]):
+        (-[DragInfo initWithImage:offset:pasteboard:source:destinationWindow:]):
+        (-[DragInfo lastMousePosition]):
+        (-[DragInfo setLastMousePosition:]):
+        (-[DragInfo draggingDestinationWindow]):
+        (-[DragInfo draggingSourceOperationMask]):
+        (-[DragInfo draggingLocation]):
+        (-[DragInfo draggedImageLocation]):
+        (-[DragInfo draggedImage]):
+        (-[DragInfo draggingPasteboard]):
+        (-[DragInfo draggingSource]):
+        (-[DragInfo draggingSequenceNumber]):
+        (-[DragInfo slideDraggedImageTo:]):
+        (-[DragInfo namesOfPromisedFilesDroppedAtDestination:]):
+        (-[DragInfo draggingFormation]):
+        (-[DragInfo setDraggingFormation:]):
+        (-[DragInfo animatesToDestination]):
+        (-[DragInfo setAnimatesToDestination:]):
+        (-[DragInfo numberOfValidItemsForDrop]):
+        (-[DragInfo setNumberOfValidItemsForDrop:]):
+        (-[DragInfo enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:]):
+        (-[DragInfo springLoadingHighlight]):
+        (-[DragInfo resetSpringLoading]):
+        (TestWebKitAPI::getTestImage):
+        (TestWebKitAPI::webViewAfterPerformingDragOperation):
+        (TestWebKitAPI::TEST):
+        * TestWebKitAPI/Tests/mac/full-page-contenteditable.html: Added.
+
</ins><span class="cx"> 2017-02-08  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move FullscreenClient creation into WebViewImpl, for use in (deprecated) WKView.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (211905 => 211906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-02-08 23:15:58 UTC (rev 211905)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2017-02-08 23:30:52 UTC (rev 211906)
</span><span class="lines">@@ -549,6 +549,8 @@
</span><span class="cx">                 E194E1BD177E53C7009C4D4E /* StopLoadingFromDidReceiveResponse.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = E194E1BC177E534A009C4D4E /* StopLoadingFromDidReceiveResponse.html */; };
</span><span class="cx">                 F415086D1DA040C50044BE9B /* play-audio-on-click.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F415086C1DA040C10044BE9B /* play-audio-on-click.html */; };
</span><span class="cx">                 F42DA5161D8CEFE400336F40 /* large-input-field-focus-onload.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */; };
</span><ins>+                F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */; };
+                F4BFA68E1E4AD08000154298 /* DragAndDropPasteboardTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */; };
</ins><span class="cx">                 F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */; };
</span><span class="cx">                 F4F137921D9B683E002BEC57 /* large-video-test-now-playing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */; };
</span><span class="cx">                 F4F405BC1D4C0D1C007A9707 /* full-size-autoplaying-video-with-audio.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */; };
</span><span class="lines">@@ -622,6 +624,7 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                F47728991E4AE3C1007ABF6A /* full-page-contenteditable.html in Copy Resources */,
</ins><span class="cx">                                 C99B675F1E39736F00FC6C80 /* no-autoplay-with-controls.html in Copy Resources */,
</span><span class="cx">                                 C99B675D1E39722000FC6C80 /* js-play-with-controls.html in Copy Resources */,
</span><span class="cx">                                 C99B675C1E39721A00FC6C80 /* autoplay-with-controls.html in Copy Resources */,
</span><span class="lines">@@ -1360,6 +1363,8 @@
</span><span class="cx">                 F3FC3EE213678B7300126A65 /* libgtest.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgtest.a; sourceTree = BUILT_PRODUCTS_DIR; };
</span><span class="cx">                 F415086C1DA040C10044BE9B /* play-audio-on-click.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;play-audio-on-click.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F42DA5151D8CEFDB00336F40 /* large-input-field-focus-onload.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = &quot;large-input-field-focus-onload.html&quot;; path = &quot;Tests/WebKit2Cocoa/large-input-field-focus-onload.html&quot;; sourceTree = SOURCE_ROOT; };
</span><ins>+                F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;full-page-contenteditable.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
+                F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DragAndDropPasteboardTests.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;enormous-video-with-sound.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F4F137911D9B6832002BEC57 /* large-video-test-now-playing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;large-video-test-now-playing.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 F4F405BA1D4C0CF8007A9707 /* full-size-autoplaying-video-with-audio.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = &quot;full-size-autoplaying-video-with-audio.html&quot;; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -2118,6 +2123,7 @@
</span><span class="cx">                                 37FB72951DB2E82F00E41BE4 /* ContextMenuDefaultItemsHaveTags.mm */,
</span><span class="cx">                                 3776BC62150946BC0043A66D /* DeviceScaleFactorInDashboardRegions.mm */,
</span><span class="cx">                                 939BA91614103412001A01BD /* DeviceScaleFactorOnBack.mm */,
</span><ins>+                                F4BFA68C1E4AD08000154298 /* DragAndDropPasteboardTests.mm */,
</ins><span class="cx">                                 37E1064A1697676400B78BD0 /* DOMHTMLTableCellCellAbove.mm */,
</span><span class="cx">                                 2D51A0C51C8BF00400765C45 /* DOMHTMLVideoElementWrapper.mm */,
</span><span class="cx">                                 46397B941DC2C850009A78AE /* DOMNode.mm */,
</span><span class="lines">@@ -2180,6 +2186,7 @@
</span><span class="cx">                                 37E1064B169767F700B78BD0 /* DOMHTMLTableCellElementCellAbove.html */,
</span><span class="cx">                                 37DC678F140D7D3A00ABCCDB /* DOMRangeOfString.html */,
</span><span class="cx">                                 1A7E8B351812093600AEB74A /* FragmentNavigation.html */,
</span><ins>+                                F47728981E4AE3AD007ABF6A /* full-page-contenteditable.html */,
</ins><span class="cx">                                 CDBFCC421A9FF44800A7B691 /* FullscreenZoomInitialFrame.html */,
</span><span class="cx">                                 9B4F8FA6159D52CA002D9F94 /* HTMLCollectionNamedItem.html */,
</span><span class="cx">                                 9B26FCB4159D15E700CC3765 /* HTMLFormCollectionNamedItem.html */,
</span><span class="lines">@@ -2783,6 +2790,7 @@
</span><span class="cx">                                 7C89D2AC1A69B80D003A5FDE /* WKPageConfiguration.cpp in Sources */,
</span><span class="cx">                                 52D673EE1AFB127300FA19FE /* WKPageCopySessionStateWithFiltering.cpp in Sources */,
</span><span class="cx">                                 7CCE7F1F1A411AE600447C4C /* WKPageGetScaleFactorNotZero.cpp in Sources */,
</span><ins>+                                F4BFA68E1E4AD08000154298 /* DragAndDropPasteboardTests.mm in Sources */,
</ins><span class="cx">                                 7CCE7F201A411AE600447C4C /* WKPageIsPlayingAudio.cpp in Sources */,
</span><span class="cx">                                 2D00065F1C1F589A0088E6A7 /* WKPDFViewResizeCrash.mm in Sources */,
</span><span class="cx">                                 7CCE7F211A411AE600447C4C /* WKPreferences.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsmacDragAndDropPasteboardTestsmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm (0 => 211906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/DragAndDropPasteboardTests.mm        2017-02-08 23:30:52 UTC (rev 211906)
</span><span class="lines">@@ -0,0 +1,260 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if PLATFORM(MAC)
+
+#import &quot;PlatformUtilities.h&quot;
+#import &lt;AppKit/NSDragging.h&gt;
+#import &lt;WebKit/WebView.h&gt;
+#import &lt;wtf/BlockPtr.h&gt;
+#import &lt;wtf/RetainPtr.h&gt;
+
+@interface FrameLoadCompletionListener : NSObject&lt;WebFrameLoadDelegate&gt; {
+    BlockPtr&lt;void (void)&gt; _completionBlock;
+}
++ (instancetype)listenerWithCompletionBlock:(dispatch_block_t)completionBlock;
+@end
+
+@implementation FrameLoadCompletionListener
+
++ (instancetype)listenerWithCompletionBlock:(dispatch_block_t)completionBlock
+{
+    return [[[FrameLoadCompletionListener alloc] initWithCompletionBlock:completionBlock] autorelease];
+}
+
+- (instancetype)initWithCompletionBlock:(dispatch_block_t)completionBlock
+{
+    if (self = [super init])
+        _completionBlock = completionBlock;
+
+    return self;
+}
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+    if (_completionBlock)
+        _completionBlock();
+}
+@end
+
+@interface DragSource : NSObject
+- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag;
+@end
+
+@implementation DragSource
+
+- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)flag
+{
+    return NSDragOperationCopy;
+}
+
+@end
+
+@interface DragInfo : NSObject&lt;NSDraggingInfo&gt; {
+    NSPoint _lastMousePosition;
+    RetainPtr&lt;NSImage&gt; _image;
+    RetainPtr&lt;NSPasteboard&gt; _pasteboard;
+    RetainPtr&lt;DragSource&gt; _source;
+    RetainPtr&lt;NSWindow&gt; _window;
+    NSSize _offset;
+}
+@property (nonatomic) NSPoint lastMousePosition;
+@end
+
+@implementation DragInfo
+
+- (id)initWithImage:(NSImage *)image offset:(NSSize)offset pasteboard:(NSPasteboard *)pasteboard source:(DragSource *)source destinationWindow:(NSWindow *)destinationWindow
+{
+    if (self = [super init]) {
+        _image = image;
+        _pasteboard = pasteboard;
+        _source = source;
+        _window = destinationWindow;
+        _offset = offset;
+    }
+    return self;
+}
+
+- (NSPoint)lastMousePosition
+{
+    return _lastMousePosition;
+}
+
+- (void)setLastMousePosition:(NSPoint)lastMousePosition
+{
+    _lastMousePosition = lastMousePosition;
+}
+
+- (NSWindow *)draggingDestinationWindow
+{
+    return _window.get();
+}
+
+- (NSDragOperation)draggingSourceOperationMask
+{
+    return NSDragOperationCopy;
+}
+
+- (NSPoint)draggingLocation
+{
+    return _lastMousePosition;
+}
+
+- (NSPoint)draggedImageLocation
+{
+    return NSMakePoint(_lastMousePosition.x + _offset.width, _lastMousePosition.y + _offset.height);
+}
+
+- (NSImage *)draggedImage
+{
+    return _image.get();
+}
+
+- (NSPasteboard *)draggingPasteboard
+{
+    return _pasteboard.get();
+}
+
+- (id)draggingSource
+{
+    return _source.get();
+}
+
+- (NSInteger)draggingSequenceNumber
+{
+    return 0;
+}
+
+- (void)slideDraggedImageTo:(NSPoint)screenPoint
+{
+}
+
+- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
+{
+    return nil;
+}
+
+- (NSDraggingFormation)draggingFormation
+{
+    return NSDraggingFormationDefault;
+}
+
+- (void)setDraggingFormation:(NSDraggingFormation)formation
+{
+}
+
+- (BOOL)animatesToDestination
+{
+    return NO;
+}
+
+- (void)setAnimatesToDestination:(BOOL)flag
+{
+}
+
+- (NSInteger)numberOfValidItemsForDrop
+{
+    return 1;
+}
+
+- (void)setNumberOfValidItemsForDrop:(NSInteger)number
+{
+}
+
+- (void)enumerateDraggingItemsWithOptions:(NSEnumerationOptions)enumOpts forView:(NSView *)view classes:(NSArray *)classArray searchOptions:(NSDictionary *)searchOptions usingBlock:(void (^)(NSDraggingItem *draggingItem, NSInteger idx, BOOL *stop))block
+{
+}
+
+#if __MAC_OS_X_VERSION_MAX_ALLOWED &gt;= 101100
+
+- (NSSpringLoadingHighlight)springLoadingHighlight
+{
+    return NSSpringLoadingHighlightNone;
+}
+
+- (void)resetSpringLoading
+{
+}
+
+#endif
+
+@end
+
+namespace TestWebKitAPI {
+
+static NSImage *getTestImage()
+{
+    return [[[NSImage alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@&quot;icon&quot; withExtension:@&quot;png&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;]] autorelease];
+}
+
+static WebView *webViewAfterPerformingDragOperation(NSPasteboard *pasteboard)
+{
+    RetainPtr&lt;WebView&gt; destination = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 400, 400)]);
+    RetainPtr&lt;NSWindow&gt; hostWindow = adoptNS([[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 400, 400) styleMask:0 backing:NSBackingStoreBuffered defer:NO]);
+    [hostWindow setFrameOrigin:NSMakePoint(0, 0)];
+    [[hostWindow contentView] addSubview:destination.get()];
+    __block bool isDone = false;
+    [destination setFrameLoadDelegate:[FrameLoadCompletionListener listenerWithCompletionBlock:^() {
+        RetainPtr&lt;DragSource&gt; source = adoptNS([[DragSource alloc] init]);
+        RetainPtr&lt;DragInfo&gt; info = adoptNS([[DragInfo alloc] initWithImage:getTestImage() offset:NSMakeSize(0, 0) pasteboard:pasteboard source:source.get() destinationWindow:hostWindow.get()]);
+        [info setLastMousePosition:NSMakePoint(0, 200)];
+        [destination draggingEntered:info.get()];
+        [info setLastMousePosition:NSMakePoint(200, 200)];
+        [destination draggingUpdated:info.get()];
+
+        EXPECT_TRUE([destination performDragOperation:info.get()]);
+        isDone = true;
+    }]];
+    [[destination mainFrame] loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@&quot;full-page-contenteditable&quot; withExtension:@&quot;html&quot; subdirectory:@&quot;TestWebKitAPI.resources&quot;]]];
+
+    TestWebKitAPI::Util::run(&amp;isDone);
+    return destination.get();
+}
+
+TEST(DragAndDropPasteboardTests, DropUTF8PlainText)
+{
+    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithUniqueName];
+    [pasteboard setData:[@&quot;I am a WebKit.&quot; dataUsingEncoding:NSUTF8StringEncoding] forType:(__bridge NSString *)kUTTypeUTF8PlainText];
+
+    RetainPtr&lt;WebView&gt; resultingWebView = webViewAfterPerformingDragOperation(pasteboard);
+    EXPECT_TRUE([[resultingWebView stringByEvaluatingJavaScriptFromString:@&quot;document.body.textContent&quot;] containsString:@&quot;I am a WebKit.&quot;]);
+}
+
+TEST(DragAndDropPasteboardTests, DropJPEG)
+{
+    NSPasteboard *pasteboard = [NSPasteboard pasteboardWithUniqueName];
+    NSImage *icon = getTestImage();
+    NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:icon.TIFFRepresentation];
+    [pasteboard setData:[imageRep representationUsingType:NSJPEGFileType properties:@{ NSImageCompressionFactor: @(0.9) }] forType:(__bridge NSString *)kUTTypeJPEG];
+
+    RetainPtr&lt;WebView&gt; resultingWebView = webViewAfterPerformingDragOperation(pasteboard);
+    EXPECT_TRUE([[resultingWebView stringByEvaluatingJavaScriptFromString:@&quot;document.querySelector('img').tagName === 'IMG'&quot;] isEqualToString:@&quot;true&quot;]);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsmacfullpagecontenteditablehtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/mac/full-page-contenteditable.html (0 => 211906)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/mac/full-page-contenteditable.html                                (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/full-page-contenteditable.html        2017-02-08 23:30:52 UTC (rev 211906)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+&lt;body contenteditable style=&quot;width: 100%; height: 100%; margin: 0;&quot;&gt;
</ins></span></pre>
</div>
</div>

</body>
</html>