<!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>[191648] trunk/Source/WebKit2</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/191648">191648</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-10-27 17:44:51 -0700 (Tue, 27 Oct 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>WKView being inside WKWebView leads to weird API issues
https://bugs.webkit.org/show_bug.cgi?id=150174

Reviewed by Anders Carlsson.

* UIProcess/API/mac/WKView.mm:
(-[WKView mouseDown:]):
(-[WKView mouseUp:]):
(-[WKView acceptsFirstMouse:]):
(-[WKView shouldDelayWindowOrderingForEvent:]):
(-[WKView pasteboardChangedOwner:]):
(-[WKView pasteboard:provideDataForType:]):
(-[WKView namesOfPromisedFilesDroppedAtDestination:]):
(-[WKView _startWindowDrag]):
(-[WKView _setMouseDownEvent:]): Deleted.
(-[WKView _colorSpace]): Deleted.
(-[WKView _dragImageForView:withImage:at:linkDrag:]): Deleted.
(matchesExtensionOrEquivalent): Deleted.
(-[WKView _setFileAndURLTypes:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]): Deleted.
(-[WKView _setPromisedDataForImage:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]): Deleted.
(-[WKView _setPromisedDataForAttachment:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]): Deleted.
(fileExists): Deleted.
(pathWithUniqueFilenameForPath): Deleted.
(-[WKView spellCheckerDocumentTag]): Deleted.
(-[WKView handleAcceptedAlternativeText:]): Deleted.
(-[WKView initWithFrame:processPool:configuration:webView:]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/Cocoa/WebViewImpl.h:
* UIProcess/Cocoa/WebViewImpl.mm:
(WebKit::WebViewImpl::handleAcceptedAlternativeText):
(WebKit::WebViewImpl::spellCheckerDocumentTag):
(WebKit::WebViewImpl::startWindowDrag):
(WebKit::WebViewImpl::dragImageForView):
(WebKit::matchesExtensionOrEquivalent):
(WebKit::WebViewImpl::setFileAndURLTypes):
(WebKit::WebViewImpl::setPromisedDataForImage):
(WebKit::WebViewImpl::setPromisedDataForAttachment):
(WebKit::WebViewImpl::pasteboardChangedOwner):
(WebKit::WebViewImpl::provideDataForPasteboard):
(WebKit::fileExists):
(WebKit::pathWithUniqueFilenameForPath):
(WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination):
(WebKit::WebViewImpl::setLastMouseDownEvent):
* UIProcess/mac/CorrectionPanel.h:
* UIProcess/mac/CorrectionPanel.mm:
(WebKit::CorrectionPanel::show):
(WebKit::CorrectionPanel::recordAutocorrectionResponse):
(WebKit::CorrectionPanel::handleAcceptedReplacement):
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::colorSpace):
(WebKit::PageClientImpl::setDragImage):
(WebKit::PageClientImpl::setPromisedDataForImage):
(WebKit::PageClientImpl::setPromisedDataForAttachment):
(WebKit::PageClientImpl::showCorrectionPanel):
(WebKit::PageClientImpl::recordAutocorrectionResponse):
(WebKit::PageClientImpl::showDictationAlternativeUI):
Move some pasteboard and spellcheck code.</pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebKit2UIProcessCocoaWebViewImplh">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplmm">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacCorrectionPanelh">trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacCorrectionPanelmm">trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/ChangeLog        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2015-10-27  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+        WKView being inside WKWebView leads to weird API issues
+        https://bugs.webkit.org/show_bug.cgi?id=150174
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView mouseDown:]):
+        (-[WKView mouseUp:]):
+        (-[WKView acceptsFirstMouse:]):
+        (-[WKView shouldDelayWindowOrderingForEvent:]):
+        (-[WKView pasteboardChangedOwner:]):
+        (-[WKView pasteboard:provideDataForType:]):
+        (-[WKView namesOfPromisedFilesDroppedAtDestination:]):
+        (-[WKView _startWindowDrag]):
+        (-[WKView _setMouseDownEvent:]): Deleted.
+        (-[WKView _colorSpace]): Deleted.
+        (-[WKView _dragImageForView:withImage:at:linkDrag:]): Deleted.
+        (matchesExtensionOrEquivalent): Deleted.
+        (-[WKView _setFileAndURLTypes:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]): Deleted.
+        (-[WKView _setPromisedDataForImage:withFileName:withExtension:withTitle:withURL:withVisibleURL:withArchive:forPasteboard:]): Deleted.
+        (-[WKView _setPromisedDataForAttachment:withExtension:withTitle:withURL:withVisibleURL:forPasteboard:]): Deleted.
+        (fileExists): Deleted.
+        (pathWithUniqueFilenameForPath): Deleted.
+        (-[WKView spellCheckerDocumentTag]): Deleted.
+        (-[WKView handleAcceptedAlternativeText:]): Deleted.
+        (-[WKView initWithFrame:processPool:configuration:webView:]): Deleted.
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/Cocoa/WebViewImpl.h:
+        * UIProcess/Cocoa/WebViewImpl.mm:
+        (WebKit::WebViewImpl::handleAcceptedAlternativeText):
+        (WebKit::WebViewImpl::spellCheckerDocumentTag):
+        (WebKit::WebViewImpl::startWindowDrag):
+        (WebKit::WebViewImpl::dragImageForView):
+        (WebKit::matchesExtensionOrEquivalent):
+        (WebKit::WebViewImpl::setFileAndURLTypes):
+        (WebKit::WebViewImpl::setPromisedDataForImage):
+        (WebKit::WebViewImpl::setPromisedDataForAttachment):
+        (WebKit::WebViewImpl::pasteboardChangedOwner):
+        (WebKit::WebViewImpl::provideDataForPasteboard):
+        (WebKit::fileExists):
+        (WebKit::pathWithUniqueFilenameForPath):
+        (WebKit::WebViewImpl::namesOfPromisedFilesDroppedAtDestination):
+        (WebKit::WebViewImpl::setLastMouseDownEvent):
+        * UIProcess/mac/CorrectionPanel.h:
+        * UIProcess/mac/CorrectionPanel.mm:
+        (WebKit::CorrectionPanel::show):
+        (WebKit::CorrectionPanel::recordAutocorrectionResponse):
+        (WebKit::CorrectionPanel::handleAcceptedReplacement):
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::colorSpace):
+        (WebKit::PageClientImpl::setDragImage):
+        (WebKit::PageClientImpl::setPromisedDataForImage):
+        (WebKit::PageClientImpl::setPromisedDataForAttachment):
+        (WebKit::PageClientImpl::showCorrectionPanel):
+        (WebKit::PageClientImpl::recordAutocorrectionResponse):
+        (WebKit::PageClientImpl::showDictationAlternativeUI):
+        Move some pasteboard and spellcheck code.
+
</ins><span class="cx"> 2015-10-27  Wenson Hsieh  &lt;wenson_hsieh@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Implement viewport-width-based fast-click heuristic
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -176,15 +176,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     BOOL _willBecomeFirstResponderAgain;
</span><del>-    NSEvent *_mouseDownEvent;
</del><span class="cx"> 
</span><del>-    BOOL _hasSpellCheckerDocumentTag;
-    NSInteger _spellCheckerDocumentTag;
-
-    RefPtr&lt;WebCore::Image&gt; _promisedImage;
-    String _promisedFilename;
-    String _promisedURL;
-
</del><span class="cx">     BOOL _windowOcclusionDetectionEnabled;
</span><span class="cx"> 
</span><span class="cx">     CGFloat _totalHeightOfBanners;
</span><span class="lines">@@ -896,17 +888,6 @@
</span><span class="cx">     return YES;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_setMouseDownEvent:(NSEvent *)event
-{
-    ASSERT(!event || [event type] == NSLeftMouseDown || [event type] == NSRightMouseDown || [event type] == NSOtherMouseDown);
-    
-    if (event == _data-&gt;_mouseDownEvent)
-        return;
-    
-    [_data-&gt;_mouseDownEvent release];
-    _data-&gt;_mouseDownEvent = [event retain];
-}
-
</del><span class="cx"> #if USE(ASYNC_NSTEXTINPUTCLIENT)
</span><span class="cx"> #define NATIVE_MOUSE_EVENT_HANDLER(Selector) \
</span><span class="cx">     - (void)Selector:(NSEvent *)theEvent \
</span><span class="lines">@@ -1016,7 +997,7 @@
</span><span class="cx">     if (_data-&gt;_impl-&gt;ignoresNonWheelEvents())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    [self _setMouseDownEvent:event];
</del><ins>+    _data-&gt;_impl-&gt;setLastMouseDownEvent(event);
</ins><span class="cx">     _data-&gt;_impl-&gt;setIgnoresMouseDraggedEvents(false);
</span><span class="cx"> 
</span><span class="cx">     [self mouseDownInternal:event];
</span><span class="lines">@@ -1027,7 +1008,7 @@
</span><span class="cx">     if (_data-&gt;_impl-&gt;ignoresNonWheelEvents())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    [self _setMouseDownEvent:nil];
</del><ins>+    _data-&gt;_impl-&gt;setLastMouseDownEvent(nil);
</ins><span class="cx">     [self mouseUpInternal:event];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1056,9 +1037,9 @@
</span><span class="cx">     if (![self hitTest:[event locationInWindow]])
</span><span class="cx">         return NO;
</span><span class="cx">     
</span><del>-    [self _setMouseDownEvent:event];
</del><ins>+    _data-&gt;_impl-&gt;setLastMouseDownEvent(event);
</ins><span class="cx">     bool result = _data-&gt;_page-&gt;acceptsFirstMouse([event eventNumber], WebEventFactory::createWebMouseEvent(event, _data-&gt;_impl-&gt;lastPressureEvent(), self));
</span><del>-    [self _setMouseDownEvent:nil];
</del><ins>+    _data-&gt;_impl-&gt;setLastMouseDownEvent(nil);
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1077,9 +1058,9 @@
</span><span class="cx">     if (![self hitTest:[event locationInWindow]])
</span><span class="cx">         return NO;
</span><span class="cx">     
</span><del>-    [self _setMouseDownEvent:event];
</del><ins>+    _data-&gt;_impl-&gt;setLastMouseDownEvent(event);
</ins><span class="cx">     bool result = _data-&gt;_page-&gt;shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, _data-&gt;_impl-&gt;lastPressureEvent(), self));
</span><del>-    [self _setMouseDownEvent:nil];
</del><ins>+    _data-&gt;_impl-&gt;setLastMouseDownEvent(nil);
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2220,11 +2201,6 @@
</span><span class="cx">     return std::make_unique&lt;TiledCoreAnimationDrawingAreaProxy&gt;(*_data-&gt;_page);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (WebKit::ColorSpaceData)_colorSpace
-{
-    return _data-&gt;_impl-&gt;colorSpace();
-}
-
</del><span class="cx"> - (void)_processDidExit
</span><span class="cx"> {
</span><span class="cx">     _data-&gt;_impl-&gt;notifyInputContextAboutDiscardedComposition();
</span><span class="lines">@@ -2332,161 +2308,19 @@
</span><span class="cx">     return _data-&gt;_impl-&gt;stringForToolTip(tag);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_dragImageForView:(NSView *)view withImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag
-{
-    // The call below could release this WKView.
-    RetainPtr&lt;WKView&gt; protector(self);
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
-    [view dragImage:image
-                 at:clientPoint
-             offset:NSZeroSize
-              event:(linkDrag) ? [NSApp currentEvent] : _data-&gt;_mouseDownEvent
-         pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
-             source:self
-          slideBack:YES];
-#pragma clang diagnostic pop
-}
-
-static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension)
-{
-    NSString *extensionAsSuffix = [@&quot;.&quot; stringByAppendingString:extension];
-    return hasCaseInsensitiveSuffix(filename, extensionAsSuffix) || (stringIsCaseInsensitiveEqualToString(extension, @&quot;jpeg&quot;)
-                                                                     &amp;&amp; hasCaseInsensitiveSuffix(filename, @&quot;.jpg&quot;));
-}
-
-- (void)_setFileAndURLTypes:(NSString *)filename withExtension:(NSString *)extension withTitle:(NSString *)title withURL:(NSString *)url withVisibleURL:(NSString *)visibleUrl forPasteboard:(NSPasteboard *)pasteboard
-{
-    if (!matchesExtensionOrEquivalent(filename, extension))
-        filename = [[filename stringByAppendingString:@&quot;.&quot;] stringByAppendingString:extension];
-    
-    [pasteboard setString:visibleUrl forType:NSStringPboardType];
-    [pasteboard setString:visibleUrl forType:PasteboardTypes::WebURLPboardType];
-    [pasteboard setString:title forType:PasteboardTypes::WebURLNamePboardType];
-    [pasteboard setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:visibleUrl], [NSArray arrayWithObject:title], nil] forType:PasteboardTypes::WebURLsWithTitlesPboardType];
-    [pasteboard setPropertyList:[NSArray arrayWithObject:extension] forType:NSFilesPromisePboardType];
-    _data-&gt;_promisedFilename = filename;
-    _data-&gt;_promisedURL = url;
-}
-
-- (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];
-
-    if (archiveBuffer)
-        [pasteboard setData:archiveBuffer-&gt;createNSData().get() forType:PasteboardTypes::WebArchivePboardType];
-
-    _data-&gt;_promisedImage = image;
-}
-
-#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
-
</del><span class="cx"> - (void)pasteboardChangedOwner:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><del>-    _data-&gt;_promisedImage = nullptr;
-    _data-&gt;_promisedFilename = &quot;&quot;;
-    _data-&gt;_promisedURL = &quot;&quot;;
</del><ins>+    _data-&gt;_impl-&gt;pasteboardChangedOwner(pasteboard);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)pasteboard:(NSPasteboard *)pasteboard provideDataForType:(NSString *)type
</span><span class="cx"> {
</span><del>-    // FIXME: need to support NSRTFDPboardType
-
-    if ([type isEqual:NSTIFFPboardType] &amp;&amp; _data-&gt;_promisedImage) {
-        [pasteboard setData:(NSData *)_data-&gt;_promisedImage-&gt;getTIFFRepresentation() forType:NSTIFFPboardType];
-        _data-&gt;_promisedImage = nullptr;
-    }
</del><ins>+    _data-&gt;_impl-&gt;provideDataForPasteboard(pasteboard, type);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static BOOL fileExists(NSString *path)
-{
-    struct stat statBuffer;
-    return !lstat([path fileSystemRepresentation], &amp;statBuffer);
-}
-
-static NSString *pathWithUniqueFilenameForPath(NSString *path)
-{
-    // &quot;Fix&quot; the filename of the path.
-    NSString *filename = filenameByFixingIllegalCharacters([path lastPathComponent]);
-    path = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:filename];
-    
-    if (fileExists(path)) {
-        // Don't overwrite existing file by appending &quot;-n&quot;, &quot;-n.ext&quot; or &quot;-n.ext.ext&quot; to the filename.
-        NSString *extensions = nil;
-        NSString *pathWithoutExtensions;
-        NSString *lastPathComponent = [path lastPathComponent];
-        NSRange periodRange = [lastPathComponent rangeOfString:@&quot;.&quot;];
-        
-        if (periodRange.location == NSNotFound) {
-            pathWithoutExtensions = path;
-        } else {
-            extensions = [lastPathComponent substringFromIndex:periodRange.location + 1];
-            lastPathComponent = [lastPathComponent substringToIndex:periodRange.location];
-            pathWithoutExtensions = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:lastPathComponent];
-        }
-        
-        for (unsigned i = 1; ; i++) {
-            NSString *pathWithAppendedNumber = [NSString stringWithFormat:@&quot;%@-%d&quot;, pathWithoutExtensions, i];
-            path = [extensions length] ? [pathWithAppendedNumber stringByAppendingPathExtension:extensions] : pathWithAppendedNumber;
-            if (!fileExists(path))
-                break;
-        }
-    }
-    
-    return path;
-}
-
</del><span class="cx"> - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
</span><span class="cx"> {
</span><del>-    RetainPtr&lt;NSFileWrapper&gt; wrapper;
-    RetainPtr&lt;NSData&gt; data;
-    
-    if (_data-&gt;_promisedImage) {
-        data = _data-&gt;_promisedImage-&gt;data()-&gt;createNSData();
-        wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:data.get()]);
-    } else
-        wrapper = adoptNS([[NSFileWrapper alloc] initWithURL:[NSURL URLWithString:_data-&gt;_promisedURL] options:NSFileWrapperReadingImmediate error:nil]);
-    
-    if (wrapper)
-        [wrapper setPreferredFilename:_data-&gt;_promisedFilename];
-    else {
-        LOG_ERROR(&quot;Failed to create image file.&quot;);
-        return nil;
-    }
-    
-    // FIXME: Report an error if we fail to create a file.
-    NSString *path = [[dropDestination path] stringByAppendingPathComponent:[wrapper preferredFilename]];
-    path = pathWithUniqueFilenameForPath(path);
-    if (![wrapper writeToURL:[NSURL fileURLWithPath:path] options:NSFileWrapperWritingWithNameUpdating originalContentsURL:nil error:nullptr])
-        LOG_ERROR(&quot;Failed to create image file via -[NSFileWrapper writeToURL:options:originalContentsURL:error:]&quot;);
-
-    if (!_data-&gt;_promisedURL.isEmpty())
-        WebCore::setMetadataURL(_data-&gt;_promisedURL, &quot;&quot;, String(path));
-    
-    return [NSArray arrayWithObject:[path lastPathComponent]];
</del><ins>+    return _data-&gt;_impl-&gt;namesOfPromisedFilesDroppedAtDestination(dropDestination);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (bool)_executeSavedCommandBySelector:(SEL)selector
</span><span class="lines">@@ -2500,20 +2334,6 @@
</span><span class="cx">     return ![sink didReceiveUnhandledCommand];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (NSInteger)spellCheckerDocumentTag
-{
-    if (!_data-&gt;_hasSpellCheckerDocumentTag) {
-        _data-&gt;_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag];
-        _data-&gt;_hasSpellCheckerDocumentTag = YES;
-    }
-    return _data-&gt;_spellCheckerDocumentTag;
-}
-
-- (void)handleAcceptedAlternativeText:(NSString*)text
-{
-    _data-&gt;_page-&gt;handleAlternativeTextUIResult(text);
-}
-
</del><span class="cx"> - (instancetype)initWithFrame:(NSRect)frame processPool:(WebProcessPool&amp;)processPool configuration:(Ref&lt;API::PageConfiguration&gt;&amp;&amp;)configuration webView:(WKWebView *)webView
</span><span class="cx"> {
</span><span class="cx">     self = [super initWithFrame:frame];
</span><span class="lines">@@ -2536,7 +2356,6 @@
</span><span class="cx"> 
</span><span class="cx">     _data-&gt;_page-&gt;initializeWebPage();
</span><span class="cx"> 
</span><del>-    _data-&gt;_mouseDownEvent = nil;
</del><span class="cx">     _data-&gt;_windowOcclusionDetectionEnabled = YES;
</span><span class="cx"> 
</span><span class="cx">     _data-&gt;_impl-&gt;registerDraggedTypes();
</span><span class="lines">@@ -2583,7 +2402,7 @@
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
</span><span class="cx"> - (void)_startWindowDrag
</span><span class="cx"> {
</span><del>-    [[self window] performWindowDragWithEvent:_data-&gt;_mouseDownEvent];
</del><ins>+    _data-&gt;_impl-&gt;startWindowDrag();
</ins><span class="cx"> }
</span><span class="cx"> #endif
</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 (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -37,19 +37,9 @@
</span><span class="cx"> class PageConfiguration;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-namespace IPC {
-class DataReference;
-}
-
-namespace WebCore {
-class Image;
-class SharedBuffer;
-}
-
</del><span class="cx"> namespace WebKit {
</span><span class="cx"> class DrawingAreaProxy;
</span><span class="cx"> class WebProcessPool;
</span><del>-struct ColorSpaceData;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> @class WKWebView;
</span><span class="lines">@@ -72,17 +62,6 @@
</span><span class="cx"> - (NSRect)_convertToDeviceSpace:(NSRect)rect;
</span><span class="cx"> - (NSRect)_convertToUserSpace:(NSRect)rect;
</span><span class="cx"> 
</span><del>-- (void)_dragImageForView:(NSView *)view withImage:(NSImage *)image at:(NSPoint)clientPoint linkDrag:(BOOL)linkDrag;
-- (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
-
-- (WebKit::ColorSpaceData)_colorSpace;
-
-- (NSInteger)spellCheckerDocumentTag;
-- (void)handleAcceptedAlternativeText:(NSString*)text;
-
</del><span class="cx"> #if WK_API_ENABLED
</span><span class="cx"> @property (nonatomic, setter=_setThumbnailView:) _WKThumbnailView *_thumbnailView;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -176,6 +176,9 @@
</span><span class="cx">     bool tryPostProcessPluginComplexTextInputKeyDown(NSEvent *);
</span><span class="cx">     PluginComplexTextInputState pluginComplexTextInputState() const { return m_pluginComplexTextInputState; }
</span><span class="cx">     uint64_t pluginComplexTextInputIdentifier() const { return m_pluginComplexTextInputIdentifier; }
</span><ins>+    
+    void handleAcceptedAlternativeText(const String&amp;);
+    NSInteger spellCheckerDocumentTag();
</ins><span class="cx"> 
</span><span class="cx">     void pressureChangeWithEvent(NSEvent *);
</span><span class="cx">     NSEvent *lastPressureEvent() { return m_lastPressureEvent.get(); }
</span><span class="lines">@@ -266,6 +269,20 @@
</span><span class="cx">     void registerDraggedTypes();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+    void startWindowDrag();
+#endif
+
+    void dragImageForView(NSView *, NSImage *, CGPoint clientPoint, bool linkDrag);
+    void setFileAndURLTypes(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSPasteboard *);
+    void setPromisedDataForImage(WebCore::Image*, NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, WebCore::SharedBuffer* archiveBuffer, NSString *pasteboardName);
+#if ENABLE(ATTACHMENT_ELEMENT)
+    void setPromisedDataForAttachment(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSString *pasteboardName);
+#endif
+    void pasteboardChangedOwner(NSPasteboard *);
+    void provideDataForPasteboard(NSPasteboard *, NSString *type);
+    NSArray *namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestination);
+
</ins><span class="cx">     RefPtr&lt;ViewSnapshot&gt; takeViewSnapshot();
</span><span class="cx"> 
</span><span class="cx">     ViewGestureController* gestureController() { return m_gestureController.get(); }
</span><span class="lines">@@ -290,6 +307,8 @@
</span><span class="cx">     void rotateWithEvent(NSEvent *);
</span><span class="cx">     void smartMagnifyWithEvent(NSEvent *);
</span><span class="cx"> 
</span><ins>+    void setLastMouseDownEvent(NSEvent *);
+
</ins><span class="cx">     void gestureEventWasNotHandledByWebCore(NSEvent *);
</span><span class="cx">     void gestureEventWasNotHandledByWebCoreFromViewOnly(NSEvent *);
</span><span class="cx"> 
</span><span class="lines">@@ -365,6 +384,7 @@
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSColorSpace&gt; m_colorSpace;
</span><span class="cx"> 
</span><ins>+    RetainPtr&lt;NSEvent&gt; m_lastMouseDownEvent;
</ins><span class="cx">     RetainPtr&lt;NSEvent&gt; m_lastPressureEvent;
</span><span class="cx"> 
</span><span class="cx">     bool m_ignoresNonWheelEvents { false };
</span><span class="lines">@@ -397,6 +417,12 @@
</span><span class="cx">     bool m_allowsMagnification { false };
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;id&gt; m_remoteAccessibilityChild;
</span><ins>+
+    RefPtr&lt;WebCore::Image&gt; m_promisedImage;
+    String m_promisedFilename;
+    String m_promisedURL;
+
+    WTF::Optional&lt;NSInteger&gt; m_spellCheckerDocumentTag;
</ins><span class="cx"> };
</span><span class="cx">     
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.mm        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #import &lt;WebCore/WebCoreCALayerExtras.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreFullScreenPlaceholderView.h&gt;
</span><span class="cx"> #import &lt;WebCore/WebCoreFullScreenWindow.h&gt;
</span><ins>+#import &lt;WebCore/WebCoreNSStringExtras.h&gt;
</ins><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="cx"> 
</span><span class="cx"> SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUNotificationPopoverWillClose, NSString *)
</span><span class="lines">@@ -1168,6 +1169,19 @@
</span><span class="cx">     return handlePluginComplexTextInputKeyDown(event);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebViewImpl::handleAcceptedAlternativeText(const String&amp; acceptedAlternative)
+{
+    m_page.handleAlternativeTextUIResult(acceptedAlternative);
+}
+
+
+NSInteger WebViewImpl::spellCheckerDocumentTag()
+{
+    if (!m_spellCheckerDocumentTag)
+        m_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag];
+    return m_spellCheckerDocumentTag.value();
+}
+
</ins><span class="cx"> void WebViewImpl::pressureChangeWithEvent(NSEvent *event)
</span><span class="cx"> {
</span><span class="cx"> #if defined(__LP64__) &amp;&amp; __MAC_OS_X_VERSION_MAX_ALLOWED &gt;= 101003
</span><span class="lines">@@ -1904,6 +1918,168 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(DRAG_SUPPORT)
</span><span class="cx"> 
</span><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
+void WebViewImpl::startWindowDrag()
+{
+    [m_view.window performWindowDragWithEvent:m_lastMouseDownEvent.get()];
+}
+#endif
+
+void WebViewImpl::dragImageForView(NSView *view, NSImage *image, CGPoint clientPoint, bool linkDrag)
+{
+    // The call below could release the view.
+    RetainPtr&lt;NSView&gt; protector(m_view);
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored &quot;-Wdeprecated-declarations&quot;
+    [view dragImage:image
+                 at:clientPoint
+             offset:NSZeroSize
+              event:linkDrag ? [NSApp currentEvent] : m_lastMouseDownEvent.get()
+         pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
+             source:m_view
+          slideBack:YES];
+#pragma clang diagnostic pop
+}
+
+static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension)
+{
+    NSString *extensionAsSuffix = [@&quot;.&quot; stringByAppendingString:extension];
+    return hasCaseInsensitiveSuffix(filename, extensionAsSuffix) || (stringIsCaseInsensitiveEqualToString(extension, @&quot;jpeg&quot;)
+        &amp;&amp; hasCaseInsensitiveSuffix(filename, @&quot;.jpg&quot;));
+}
+
+void WebViewImpl::setFileAndURLTypes(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSPasteboard *pasteboard)
+{
+    if (!matchesExtensionOrEquivalent(filename, extension))
+        filename = [[filename stringByAppendingString:@&quot;.&quot;] stringByAppendingString:extension];
+
+    [pasteboard setString:visibleURL forType:NSStringPboardType];
+    [pasteboard setString:visibleURL forType:PasteboardTypes::WebURLPboardType];
+    [pasteboard setString:title forType:PasteboardTypes::WebURLNamePboardType];
+    [pasteboard setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:visibleURL], [NSArray arrayWithObject:title], nil] forType:PasteboardTypes::WebURLsWithTitlesPboardType];
+    [pasteboard setPropertyList:[NSArray arrayWithObject:extension] forType:NSFilesPromisePboardType];
+    m_promisedFilename = filename;
+    m_promisedURL = url;
+}
+
+void WebViewImpl::setPromisedDataForImage(WebCore::Image* image, NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, WebCore::SharedBuffer* archiveBuffer, 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:m_view];
+    setFileAndURLTypes(filename, extension, title, url, visibleURL, pasteboard);
+
+    if (archiveBuffer)
+        [pasteboard setData:archiveBuffer-&gt;createNSData().get() forType:PasteboardTypes::WebArchivePboardType];
+
+    m_promisedImage = image;
+}
+
+#if ENABLE(ATTACHMENT_ELEMENT)
+void WebViewImpl::setPromisedDataForAttachment(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, 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:m_view];
+    setFileAndURLTypes(filename, extension, title, url, visibleURL, pasteboard);
+    
+    RetainPtr&lt;NSMutableArray&gt; paths = adoptNS([[NSMutableArray alloc] init]);
+    [paths addObject:title];
+    [pasteboard setPropertyList:paths.get() forType:NSFilenamesPboardType];
+    
+    m_promisedImage = nullptr;
+}
+#endif
+
+void WebViewImpl::pasteboardChangedOwner(NSPasteboard *pasteboard)
+{
+    m_promisedImage = nullptr;
+    m_promisedFilename = &quot;&quot;;
+    m_promisedURL = &quot;&quot;;
+}
+
+void WebViewImpl::provideDataForPasteboard(NSPasteboard *pasteboard, NSString *type)
+{
+    // FIXME: need to support NSRTFDPboardType
+
+    if ([type isEqual:NSTIFFPboardType] &amp;&amp; m_promisedImage) {
+        [pasteboard setData:(NSData *)m_promisedImage-&gt;getTIFFRepresentation() forType:NSTIFFPboardType];
+        m_promisedImage = nullptr;
+    }
+}
+
+static BOOL fileExists(NSString *path)
+{
+    struct stat statBuffer;
+    return !lstat([path fileSystemRepresentation], &amp;statBuffer);
+}
+
+static NSString *pathWithUniqueFilenameForPath(NSString *path)
+{
+    // &quot;Fix&quot; the filename of the path.
+    NSString *filename = filenameByFixingIllegalCharacters([path lastPathComponent]);
+    path = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:filename];
+    
+    if (fileExists(path)) {
+        // Don't overwrite existing file by appending &quot;-n&quot;, &quot;-n.ext&quot; or &quot;-n.ext.ext&quot; to the filename.
+        NSString *extensions = nil;
+        NSString *pathWithoutExtensions;
+        NSString *lastPathComponent = [path lastPathComponent];
+        NSRange periodRange = [lastPathComponent rangeOfString:@&quot;.&quot;];
+        
+        if (periodRange.location == NSNotFound) {
+            pathWithoutExtensions = path;
+        } else {
+            extensions = [lastPathComponent substringFromIndex:periodRange.location + 1];
+            lastPathComponent = [lastPathComponent substringToIndex:periodRange.location];
+            pathWithoutExtensions = [[path stringByDeletingLastPathComponent] stringByAppendingPathComponent:lastPathComponent];
+        }
+        
+        for (unsigned i = 1; ; i++) {
+            NSString *pathWithAppendedNumber = [NSString stringWithFormat:@&quot;%@-%d&quot;, pathWithoutExtensions, i];
+            path = [extensions length] ? [pathWithAppendedNumber stringByAppendingPathExtension:extensions] : pathWithAppendedNumber;
+            if (!fileExists(path))
+                break;
+        }
+    }
+    
+    return path;
+}
+
+NSArray *WebViewImpl::namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestination)
+{
+    RetainPtr&lt;NSFileWrapper&gt; wrapper;
+    RetainPtr&lt;NSData&gt; data;
+    
+    if (m_promisedImage) {
+        data = m_promisedImage-&gt;data()-&gt;createNSData();
+        wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:data.get()]);
+    } else
+        wrapper = adoptNS([[NSFileWrapper alloc] initWithURL:[NSURL URLWithString:m_promisedURL] options:NSFileWrapperReadingImmediate error:nil]);
+    
+    if (wrapper)
+        [wrapper setPreferredFilename:m_promisedFilename];
+    else {
+        LOG_ERROR(&quot;Failed to create image file.&quot;);
+        return nil;
+    }
+    
+    // FIXME: Report an error if we fail to create a file.
+    NSString *path = [[dropDestination path] stringByAppendingPathComponent:[wrapper preferredFilename]];
+    path = pathWithUniqueFilenameForPath(path);
+    if (![wrapper writeToURL:[NSURL fileURLWithPath:path] options:NSFileWrapperWritingWithNameUpdating originalContentsURL:nil error:nullptr])
+        LOG_ERROR(&quot;Failed to create image file via -[NSFileWrapper writeToURL:options:originalContentsURL:error:]&quot;);
+
+    if (!m_promisedURL.isEmpty())
+        WebCore::setMetadataURL(m_promisedURL, &quot;&quot;, String(path));
+    
+    return [NSArray arrayWithObject:[path lastPathComponent]];
+}
+
</ins><span class="cx"> static RetainPtr&lt;CGImageRef&gt; takeWindowSnapshot(CGSWindowID windowID, bool captureAtNominalResolution)
</span><span class="cx"> {
</span><span class="cx">     CGSWindowCaptureOptions options = kCGSCaptureIgnoreGlobalClipShape;
</span><span class="lines">@@ -2141,6 +2317,16 @@
</span><span class="cx">     ensureGestureController().handleSmartMagnificationGesture([m_view convertPoint:event.locationInWindow fromView:nil]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebViewImpl::setLastMouseDownEvent(NSEvent *event)
+{
+    ASSERT(!event || event.type == NSLeftMouseDown || event.type == NSRightMouseDown || event.type == NSOtherMouseDown);
+
+    if (event == m_lastMouseDownEvent.get())
+        return;
+
+    m_lastMouseDownEvent = event;
+}
+
</ins><span class="cx"> #if ENABLE(MAC_GESTURE_EVENTS)
</span><span class="cx"> void WebViewImpl::rotateWithEvent(NSEvent *event)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacCorrectionPanelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -34,27 +34,28 @@
</span><span class="cx"> #import &lt;WebCore/AlternativeTextClient.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><del>-@class WKView;
-
</del><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><ins>+class WebViewImpl;
+
</ins><span class="cx"> class CorrectionPanel {
</span><span class="cx"> public:
</span><span class="cx">     CorrectionPanel();
</span><span class="cx">     ~CorrectionPanel();
</span><del>-    void show(WKView*, WebCore::AlternativeTextType, const WebCore::FloatRect&amp; boundingBoxOfReplacedString, const String&amp; replacedString, const String&amp; replacementString, const Vector&lt;String&gt;&amp; alternativeReplacementStrings);
</del><ins>+    void show(NSView *, WebViewImpl&amp;, WebCore::AlternativeTextType, const WebCore::FloatRect&amp; boundingBoxOfReplacedString, const String&amp; replacedString, const String&amp; replacementString, const Vector&lt;String&gt;&amp; alternativeReplacementStrings);
</ins><span class="cx">     String dismiss(WebCore::ReasonForDismissingAlternativeText);
</span><del>-    static void recordAutocorrectionResponse(WKView*, NSCorrectionResponse, const String&amp; replacedString, const String&amp; replacementString);
</del><ins>+    static void recordAutocorrectionResponse(NSView *, NSInteger spellCheckerDocumentTag, NSCorrectionResponse, const String&amp; replacedString, const String&amp; replacementString);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     bool isShowing() const { return m_view; }
</span><span class="cx">     String dismissInternal(WebCore::ReasonForDismissingAlternativeText, bool dismissingExternally);
</span><del>-    void handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType);
</del><ins>+    void handleAcceptedReplacement(WebViewImpl&amp;, NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType);
</ins><span class="cx"> 
</span><span class="cx">     bool m_wasDismissedExternally;
</span><span class="cx">     WebCore::ReasonForDismissingAlternativeText m_reasonForDismissing;
</span><del>-    RetainPtr&lt;WKView&gt; m_view;
</del><ins>+    RetainPtr&lt;NSView&gt; m_view;
</ins><span class="cx">     RetainPtr&lt;NSString&gt; m_resultForDismissal;
</span><ins>+    NSInteger m_spellCheckerDocumentTag;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacCorrectionPanelmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -29,8 +29,7 @@
</span><span class="cx"> #if USE(AUTOCORRECTION_PANEL)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><del>-#import &quot;WKView.h&quot;
-#import &quot;WKViewInternal.h&quot;
</del><ins>+#import &quot;WebViewImpl.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><span class="lines">@@ -64,16 +63,19 @@
</span><span class="cx">     dismissInternal(ReasonForDismissingAlternativeTextIgnored, false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CorrectionPanel::show(WKView* view, AlternativeTextType type, const FloatRect&amp; boundingBoxOfReplacedString, const String&amp; replacedString, const String&amp; replacementString, const Vector&lt;String&gt;&amp; alternativeReplacementStrings)
</del><ins>+void CorrectionPanel::show(NSView *view, WebViewImpl&amp; webViewImpl, AlternativeTextType type, const FloatRect&amp; boundingBoxOfReplacedString, const String&amp; replacedString, const String&amp; replacementString, const Vector&lt;String&gt;&amp; alternativeReplacementStrings)
</ins><span class="cx"> {
</span><span class="cx">     dismissInternal(ReasonForDismissingAlternativeTextIgnored, false);
</span><span class="cx">     
</span><span class="cx">     if (!view)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    NSInteger spellCheckerDocumentTag = webViewImpl.spellCheckerDocumentTag();
+
</ins><span class="cx">     NSString* replacedStringAsNSString = replacedString;
</span><span class="cx">     NSString* replacementStringAsNSString = replacementString;
</span><span class="cx">     m_view = view;
</span><ins>+    m_spellCheckerDocumentTag = spellCheckerDocumentTag;
</ins><span class="cx">     NSCorrectionIndicatorType indicatorType = correctionIndicatorType(type);
</span><span class="cx">     
</span><span class="cx">     NSMutableArray* alternativeStrings = 0;
</span><span class="lines">@@ -86,7 +88,7 @@
</span><span class="cx"> 
</span><span class="cx">     NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
</span><span class="cx">     [spellChecker showCorrectionIndicatorOfType:indicatorType primaryString:replacementStringAsNSString alternativeStrings:alternativeStrings forStringInRect:boundingBoxOfReplacedString view:m_view.get() completionHandler:^(NSString* acceptedString) {
</span><del>-        handleAcceptedReplacement(acceptedString, replacedStringAsNSString, replacementStringAsNSString, indicatorType);
</del><ins>+        handleAcceptedReplacement(webViewImpl, acceptedString, replacedStringAsNSString, replacementStringAsNSString, indicatorType);
</ins><span class="cx">     }];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -107,42 +109,42 @@
</span><span class="cx">     return m_resultForDismissal.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CorrectionPanel::recordAutocorrectionResponse(WKView* view, NSCorrectionResponse response, const String&amp; replacedString, const String&amp; replacementString)
</del><ins>+void CorrectionPanel::recordAutocorrectionResponse(NSView *view, NSInteger spellCheckerDocumentTag, NSCorrectionResponse response, const String&amp; replacedString, const String&amp; replacementString)
</ins><span class="cx"> {
</span><del>-    [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:[view spellCheckerDocumentTag]];
</del><ins>+    [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement,  NSCorrectionIndicatorType correctionIndicatorType)
</del><ins>+void CorrectionPanel::handleAcceptedReplacement(WebViewImpl&amp; webViewImpl, NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement,  NSCorrectionIndicatorType correctionIndicatorType)
</ins><span class="cx"> {
</span><span class="cx">     if (!m_view)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
</span><del>-    NSInteger documentTag = [m_view spellCheckerDocumentTag];
</del><span class="cx">     
</span><span class="cx">     switch (correctionIndicatorType) {
</span><span class="cx">     case NSCorrectionIndicatorTypeDefault:
</span><span class="cx">         if (acceptedReplacement)
</span><del>-            [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
</del><ins>+            [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:m_spellCheckerDocumentTag];
</ins><span class="cx">         else {
</span><span class="cx">             if (!m_wasDismissedExternally || m_reasonForDismissing == ReasonForDismissingAlternativeTextCancelled)
</span><del>-                [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
</del><ins>+                [spellChecker recordResponse:NSCorrectionResponseRejected toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:m_spellCheckerDocumentTag];
</ins><span class="cx">             else
</span><del>-                [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
</del><ins>+                [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:m_spellCheckerDocumentTag];
</ins><span class="cx">         }
</span><span class="cx">         break;
</span><span class="cx">     case NSCorrectionIndicatorTypeReversion:
</span><span class="cx">         if (acceptedReplacement)
</span><del>-            [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replaced forWord:acceptedReplacement language:nil inSpellDocumentWithTag:documentTag];
</del><ins>+            [spellChecker recordResponse:NSCorrectionResponseReverted toCorrection:replaced forWord:acceptedReplacement language:nil inSpellDocumentWithTag:m_spellCheckerDocumentTag];
</ins><span class="cx">         break;
</span><span class="cx">     case NSCorrectionIndicatorTypeGuesses:
</span><span class="cx">         if (acceptedReplacement)
</span><del>-            [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
</del><ins>+            [spellChecker recordResponse:NSCorrectionResponseAccepted toCorrection:acceptedReplacement forWord:replaced language:nil inSpellDocumentWithTag:m_spellCheckerDocumentTag];
</ins><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    [m_view handleAcceptedAlternativeText:acceptedReplacement];
-    m_view.clear();
</del><ins>+    webViewImpl.handleAcceptedAlternativeText(acceptedReplacement);
+    m_spellCheckerDocumentTag = 0;
+    m_view = nullptr;
</ins><span class="cx">     if (acceptedReplacement)
</span><span class="cx">         m_resultForDismissal = adoptNS([acceptedReplacement copy]);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (191647 => 191648)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-28 00:35:24 UTC (rev 191647)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2015-10-28 00:44:51 UTC (rev 191648)
</span><span class="lines">@@ -236,7 +236,7 @@
</span><span class="cx"> 
</span><span class="cx"> ColorSpaceData PageClientImpl::colorSpace()
</span><span class="cx"> {
</span><del>-    return [m_wkView _colorSpace];
</del><ins>+    return m_impl-&gt;colorSpace();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::processDidExit()
</span><span class="lines">@@ -361,23 +361,23 @@
</span><span class="cx"> #if WK_API_ENABLED
</span><span class="cx">     if (m_webView) {
</span><span class="cx">         NSPoint webViewPosition = [m_wkView convertPoint:clientPosition toView:m_webView];
</span><del>-        [m_wkView _dragImageForView:m_webView withImage:dragNSImage.get() at:webViewPosition linkDrag:isLinkDrag];
</del><ins>+        m_impl-&gt;dragImageForView(m_webView, dragNSImage.get(), webViewPosition, isLinkDrag);
</ins><span class="cx">     } else
</span><span class="cx"> #endif
</span><del>-        [m_wkView _dragImageForView:m_wkView withImage:dragNSImage.get() at:clientPosition linkDrag:isLinkDrag];
</del><ins>+        m_impl-&gt;dragImageForView(m_wkView, dragNSImage.get(), clientPosition, isLinkDrag);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-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)
</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 _setPromisedDataForImage:image.get() withFileName:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl withArchive:archiveBuffer.get() forPasteboard:pasteboardName];
</del><ins>+    m_impl-&gt;setPromisedDataForImage(image.get(), filename, extension, title, url, visibleURL, archiveBuffer.get(), pasteboardName);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ATTACHMENT_ELEMENT)
</span><del>-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)
</del><ins>+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)
</ins><span class="cx"> {
</span><del>-    [m_wkView _setPromisedDataForAttachment:filename withExtension:extension withTitle:title withURL:url withVisibleURL:visibleUrl forPasteboard:pasteboardName];
</del><ins>+    m_impl-&gt;setPromisedDataForAttachment(filename, extension, title, url, visibleURL, pasteboardName);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -564,7 +564,7 @@
</span><span class="cx"> #if USE(AUTOCORRECTION_PANEL)
</span><span class="cx">     if (!isViewVisible() || !isViewInWindow())
</span><span class="cx">         return;
</span><del>-    m_correctionPanel.show(m_wkView, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
</del><ins>+    m_correctionPanel.show(m_wkView, *m_impl, type, boundingBoxOfReplacedString, replacedString, replacementString, alternativeReplacementStrings);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -587,7 +587,7 @@
</span><span class="cx"> void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String&amp; replacedString, const String&amp; replacementString)
</span><span class="cx"> {
</span><span class="cx">     NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
</span><del>-    CorrectionPanel::recordAutocorrectionResponse(m_wkView, response, replacedString, replacementString);
</del><ins>+    CorrectionPanel::recordAutocorrectionResponse(m_wkView, m_impl-&gt;spellCheckerDocumentTag(), response, replacedString, replacementString);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
</span><span class="lines">@@ -635,8 +635,8 @@
</span><span class="cx"> {
</span><span class="cx">     if (!isViewVisible() || !isViewInWindow())
</span><span class="cx">         return;
</span><del>-    m_alternativeTextUIController-&gt;showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){
-        [m_wkView handleAcceptedAlternativeText:acceptedAlternative];
</del><ins>+    m_alternativeTextUIController-&gt;showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString *acceptedAlternative) {
+        m_impl-&gt;handleAcceptedAlternativeText(acceptedAlternative);
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>