<!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 <timothy_horton@apple.com>
+
+ 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 <wenson_hsieh@apple.com>
</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<WebCore::Image> _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->_mouseDownEvent)
- return;
-
- [_data->_mouseDownEvent release];
- _data->_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->_impl->ignoresNonWheelEvents())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- [self _setMouseDownEvent:event];
</del><ins>+ _data->_impl->setLastMouseDownEvent(event);
</ins><span class="cx"> _data->_impl->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->_impl->ignoresNonWheelEvents())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- [self _setMouseDownEvent:nil];
</del><ins>+ _data->_impl->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->_impl->setLastMouseDownEvent(event);
</ins><span class="cx"> bool result = _data->_page->acceptsFirstMouse([event eventNumber], WebEventFactory::createWebMouseEvent(event, _data->_impl->lastPressureEvent(), self));
</span><del>- [self _setMouseDownEvent:nil];
</del><ins>+ _data->_impl->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->_impl->setLastMouseDownEvent(event);
</ins><span class="cx"> bool result = _data->_page->shouldDelayWindowOrderingForEvent(WebEventFactory::createWebMouseEvent(event, _data->_impl->lastPressureEvent(), self));
</span><del>- [self _setMouseDownEvent:nil];
</del><ins>+ _data->_impl->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<TiledCoreAnimationDrawingAreaProxy>(*_data->_page);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-- (WebKit::ColorSpaceData)_colorSpace
-{
- return _data->_impl->colorSpace();
-}
-
</del><span class="cx"> - (void)_processDidExit
</span><span class="cx"> {
</span><span class="cx"> _data->_impl->notifyInputContextAboutDiscardedComposition();
</span><span class="lines">@@ -2332,161 +2308,19 @@
</span><span class="cx"> return _data->_impl->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<WKView> protector(self);
-
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- [view dragImage:image
- at:clientPoint
- offset:NSZeroSize
- event:(linkDrag) ? [NSApp currentEvent] : _data->_mouseDownEvent
- pasteboard:[NSPasteboard pasteboardWithName:NSDragPboard]
- source:self
- slideBack:YES];
-#pragma clang diagnostic pop
-}
-
-static bool matchesExtensionOrEquivalent(NSString *filename, NSString *extension)
-{
- NSString *extensionAsSuffix = [@"." stringByAppendingString:extension];
- return hasCaseInsensitiveSuffix(filename, extensionAsSuffix) || (stringIsCaseInsensitiveEqualToString(extension, @"jpeg")
- && hasCaseInsensitiveSuffix(filename, @".jpg"));
-}
-
-- (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:@"."] 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->_promisedFilename = filename;
- _data->_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<NSMutableArray> 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->createNSData().get() forType:PasteboardTypes::WebArchivePboardType];
-
- _data->_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<NSMutableArray> 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<NSMutableArray> paths = adoptNS([[NSMutableArray alloc] init]);
- [paths addObject:title];
- [pasteboard setPropertyList:paths.get() forType:NSFilenamesPboardType];
-
- _data->_promisedImage = nullptr;
-}
-#endif
-
</del><span class="cx"> - (void)pasteboardChangedOwner:(NSPasteboard *)pasteboard
</span><span class="cx"> {
</span><del>- _data->_promisedImage = nullptr;
- _data->_promisedFilename = "";
- _data->_promisedURL = "";
</del><ins>+ _data->_impl->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] && _data->_promisedImage) {
- [pasteboard setData:(NSData *)_data->_promisedImage->getTIFFRepresentation() forType:NSTIFFPboardType];
- _data->_promisedImage = nullptr;
- }
</del><ins>+ _data->_impl->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], &statBuffer);
-}
-
-static NSString *pathWithUniqueFilenameForPath(NSString *path)
-{
- // "Fix" 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 "-n", "-n.ext" or "-n.ext.ext" to the filename.
- NSString *extensions = nil;
- NSString *pathWithoutExtensions;
- NSString *lastPathComponent = [path lastPathComponent];
- NSRange periodRange = [lastPathComponent rangeOfString:@"."];
-
- 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:@"%@-%d", 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<NSFileWrapper> wrapper;
- RetainPtr<NSData> data;
-
- if (_data->_promisedImage) {
- data = _data->_promisedImage->data()->createNSData();
- wrapper = adoptNS([[NSFileWrapper alloc] initRegularFileWithContents:data.get()]);
- } else
- wrapper = adoptNS([[NSFileWrapper alloc] initWithURL:[NSURL URLWithString:_data->_promisedURL] options:NSFileWrapperReadingImmediate error:nil]);
-
- if (wrapper)
- [wrapper setPreferredFilename:_data->_promisedFilename];
- else {
- LOG_ERROR("Failed to create image file.");
- 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("Failed to create image file via -[NSFileWrapper writeToURL:options:originalContentsURL:error:]");
-
- if (!_data->_promisedURL.isEmpty())
- WebCore::setMetadataURL(_data->_promisedURL, "", String(path));
-
- return [NSArray arrayWithObject:[path lastPathComponent]];
</del><ins>+ return _data->_impl->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->_hasSpellCheckerDocumentTag) {
- _data->_spellCheckerDocumentTag = [NSSpellChecker uniqueSpellDocumentTag];
- _data->_hasSpellCheckerDocumentTag = YES;
- }
- return _data->_spellCheckerDocumentTag;
-}
-
-- (void)handleAcceptedAlternativeText:(NSString*)text
-{
- _data->_page->handleAlternativeTextUIResult(text);
-}
-
</del><span class="cx"> - (instancetype)initWithFrame:(NSRect)frame processPool:(WebProcessPool&)processPool configuration:(Ref<API::PageConfiguration>&&)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->_page->initializeWebPage();
</span><span class="cx">
</span><del>- _data->_mouseDownEvent = nil;
</del><span class="cx"> _data->_windowOcclusionDetectionEnabled = YES;
</span><span class="cx">
</span><span class="cx"> _data->_impl->registerDraggedTypes();
</span><span class="lines">@@ -2583,7 +2402,7 @@
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100
</span><span class="cx"> - (void)_startWindowDrag
</span><span class="cx"> {
</span><del>- [[self window] performWindowDragWithEvent:_data->_mouseDownEvent];
</del><ins>+ _data->_impl->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&);
+ 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 >= 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<ViewSnapshot> 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<NSColorSpace> m_colorSpace;
</span><span class="cx">
</span><ins>+ RetainPtr<NSEvent> m_lastMouseDownEvent;
</ins><span class="cx"> RetainPtr<NSEvent> 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<id> m_remoteAccessibilityChild;
</span><ins>+
+ RefPtr<WebCore::Image> m_promisedImage;
+ String m_promisedFilename;
+ String m_promisedURL;
+
+ WTF::Optional<NSInteger> 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 <WebCore/WebCoreCALayerExtras.h>
</span><span class="cx"> #import <WebCore/WebCoreFullScreenPlaceholderView.h>
</span><span class="cx"> #import <WebCore/WebCoreFullScreenWindow.h>
</span><ins>+#import <WebCore/WebCoreNSStringExtras.h>
</ins><span class="cx"> #import <WebKitSystemInterface.h>
</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& 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__) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 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 >= 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<NSView> protector(m_view);
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ [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 = [@"." stringByAppendingString:extension];
+ return hasCaseInsensitiveSuffix(filename, extensionAsSuffix) || (stringIsCaseInsensitiveEqualToString(extension, @"jpeg")
+ && hasCaseInsensitiveSuffix(filename, @".jpg"));
+}
+
+void WebViewImpl::setFileAndURLTypes(NSString *filename, NSString *extension, NSString *title, NSString *url, NSString *visibleURL, NSPasteboard *pasteboard)
+{
+ if (!matchesExtensionOrEquivalent(filename, extension))
+ filename = [[filename stringByAppendingString:@"."] 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<NSMutableArray> 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->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<NSMutableArray> 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<NSMutableArray> 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 = "";
+ m_promisedURL = "";
+}
+
+void WebViewImpl::provideDataForPasteboard(NSPasteboard *pasteboard, NSString *type)
+{
+ // FIXME: need to support NSRTFDPboardType
+
+ if ([type isEqual:NSTIFFPboardType] && m_promisedImage) {
+ [pasteboard setData:(NSData *)m_promisedImage->getTIFFRepresentation() forType:NSTIFFPboardType];
+ m_promisedImage = nullptr;
+ }
+}
+
+static BOOL fileExists(NSString *path)
+{
+ struct stat statBuffer;
+ return !lstat([path fileSystemRepresentation], &statBuffer);
+}
+
+static NSString *pathWithUniqueFilenameForPath(NSString *path)
+{
+ // "Fix" 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 "-n", "-n.ext" or "-n.ext.ext" to the filename.
+ NSString *extensions = nil;
+ NSString *pathWithoutExtensions;
+ NSString *lastPathComponent = [path lastPathComponent];
+ NSRange periodRange = [lastPathComponent rangeOfString:@"."];
+
+ 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:@"%@-%d", pathWithoutExtensions, i];
+ path = [extensions length] ? [pathWithAppendedNumber stringByAppendingPathExtension:extensions] : pathWithAppendedNumber;
+ if (!fileExists(path))
+ break;
+ }
+ }
+
+ return path;
+}
+
+NSArray *WebViewImpl::namesOfPromisedFilesDroppedAtDestination(NSURL *dropDestination)
+{
+ RetainPtr<NSFileWrapper> wrapper;
+ RetainPtr<NSData> data;
+
+ if (m_promisedImage) {
+ data = m_promisedImage->data()->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("Failed to create image file.");
+ 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("Failed to create image file via -[NSFileWrapper writeToURL:options:originalContentsURL:error:]");
+
+ if (!m_promisedURL.isEmpty())
+ WebCore::setMetadataURL(m_promisedURL, "", String(path));
+
+ return [NSArray arrayWithObject:[path lastPathComponent]];
+}
+
</ins><span class="cx"> static RetainPtr<CGImageRef> 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 <WebCore/AlternativeTextClient.h>
</span><span class="cx"> #import <wtf/RetainPtr.h>
</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& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
</del><ins>+ void show(NSView *, WebViewImpl&, WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
</ins><span class="cx"> String dismiss(WebCore::ReasonForDismissingAlternativeText);
</span><del>- static void recordAutocorrectionResponse(WKView*, NSCorrectionResponse, const String& replacedString, const String& replacementString);
</del><ins>+ static void recordAutocorrectionResponse(NSView *, NSInteger spellCheckerDocumentTag, NSCorrectionResponse, const String& replacedString, const String& 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&, 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<WKView> m_view;
</del><ins>+ RetainPtr<NSView> m_view;
</ins><span class="cx"> RetainPtr<NSString> 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 "WebPageProxy.h"
</span><del>-#import "WKView.h"
-#import "WKViewInternal.h"
</del><ins>+#import "WebViewImpl.h"
</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& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings)
</del><ins>+void CorrectionPanel::show(NSView *view, WebViewImpl& webViewImpl, AlternativeTextType type, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& 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& replacedString, const String& replacementString)
</del><ins>+void CorrectionPanel::recordAutocorrectionResponse(NSView *view, NSInteger spellCheckerDocumentTag, NSCorrectionResponse response, const String& replacedString, const String& 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& 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->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->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->dragImageForView(m_wkView, dragNSImage.get(), clientPosition, isLinkDrag);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void PageClientImpl::setPromisedDataForImage(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl, PassRefPtr<SharedBuffer> archiveBuffer)
</del><ins>+void PageClientImpl::setPromisedDataForImage(const String& pasteboardName, PassRefPtr<SharedBuffer> imageBuffer, const String& filename, const String& extension, const String& title, const String& url, const String& visibleURL, PassRefPtr<SharedBuffer> archiveBuffer)
</ins><span class="cx"> {
</span><span class="cx"> RefPtr<Image> image = BitmapImage::create();
</span><span class="cx"> image->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->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& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& visibleUrl)
</del><ins>+void PageClientImpl::setPromisedDataForAttachment(const String& pasteboardName, const String& filename, const String& extension, const String& title, const String& url, const String& 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->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& replacedString, const String& 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->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->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString* acceptedAlternative){
- [m_wkView handleAcceptedAlternativeText:acceptedAlternative];
</del><ins>+ m_alternativeTextUIController->showAlternatives(m_wkView, boundingBoxOfDictatedText, dictationContext, ^(NSString *acceptedAlternative) {
+ m_impl->handleAcceptedAlternativeText(acceptedAlternative);
</ins><span class="cx"> });
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>