<!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>[201056] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/201056">201056</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2016-05-17 16:24:19 -0700 (Tue, 17 May 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make handleAcceptedCandidate a public function
https://bugs.webkit.org/show_bug.cgi?id=157763
-and corresponding-
rdar://problem/26206397
Reviewed by Tim Horton.
Source/WebCore:
Define handleAcceptedCandidateWithSoftSpaces on EditorClient so that it can
be invoked on any EditorClient.
* loader/EmptyClients.h:
* page/EditorClient.h:
(WebCore::EditorClient::handleAcceptedCandidateWithSoftSpaces):
Source/WebKit/mac:
This patch re-names handleAcceptedCandidate to
handleAcceptedCandidateWithSoftSpaces. The function now takes a
WebCore::TextCheckingResult instead of an NSTextCheckingResult and it can be
called from outside of WebEditorClient.
* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::handleRequestedCandidates):
(WebEditorClient::handleAcceptedCandidateWithSoftSpaces):
(textCheckingResultFromNSTextCheckingResult): Deleted.
(WebEditorClient::handleAcceptedCandidate): Deleted.
Move showCandidates to WebViewPrivate so that it can be overridden by a test.
* WebView/WebViewInternal.h:
* WebView/WebViewPrivate.h:
Source/WebKit2:
This patch makes handleAcceptedCandidate a public member of WebViewImpl
instead of a private member.
* UIProcess/Cocoa/WebViewImpl.h:
(WebKit::WebViewImpl::createWeakPtr):
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html: Added.
* TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm: Added.
(-[DoNotLeakWebView dealloc]):
(-[DoNotLeakWebView showCandidates:forString:inRect:forSelectedRange:view:completionHandler:]):
(-[DoNotLeakFrameLoadDelegate webView:didFinishLoadForFrame:]):
(TestWebKitAPI::TEST):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreloaderEmptyClientsh">trunk/Source/WebCore/loader/EmptyClients.h</a></li>
<li><a href="#trunkSourceWebCorepageEditorClienth">trunk/Source/WebCore/page/EditorClient.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebEditorClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewInternalh">trunk/Source/WebKit/mac/WebView/WebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewPrivateh">trunk/Source/WebKit/mac/WebView/WebViewPrivate.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebViewImplh">trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj">trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2Cocoaautofocusedtextinputhtml">trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsmacViewWithEditableAreaLeakmm">trunk/Tools/TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebCore/ChangeLog        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-05-17 Beth Dakin <bdakin@apple.com>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ Define handleAcceptedCandidateWithSoftSpaces on EditorClient so that it can
+ be invoked on any EditorClient.
+ * loader/EmptyClients.h:
+ * page/EditorClient.h:
+ (WebCore::EditorClient::handleAcceptedCandidateWithSoftSpaces):
+
</ins><span class="cx"> 2016-05-17 Chris Dumez <cdumez@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed debug build fix after r201052.
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderEmptyClientsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/EmptyClients.h (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/EmptyClients.h        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebCore/loader/EmptyClients.h        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -468,6 +468,7 @@
</span><span class="cx"> void didWriteSelectionToPasteboard() override { }
</span><span class="cx"> void getClientPasteboardDataForRange(Range*, Vector<String>&, Vector<RefPtr<SharedBuffer>>&) override { }
</span><span class="cx"> void requestCandidatesForSelection(const VisibleSelection&) override { }
</span><ins>+ void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) override { }
</ins><span class="cx">
</span><span class="cx"> void registerUndoStep(PassRefPtr<UndoStep>) override;
</span><span class="cx"> void registerRedoStep(PassRefPtr<UndoStep>) override;
</span></span></pre></div>
<a id="trunkSourceWebCorepageEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EditorClient.h (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EditorClient.h        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebCore/page/EditorClient.h        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -100,6 +100,7 @@
</span><span class="cx"> virtual void didWriteSelectionToPasteboard() = 0;
</span><span class="cx"> virtual void getClientPasteboardDataForRange(Range*, Vector<String>& pasteboardTypes, Vector<RefPtr<SharedBuffer>>& pasteboardData) = 0;
</span><span class="cx"> virtual void requestCandidatesForSelection(const VisibleSelection&) { }
</span><ins>+ virtual void handleAcceptedCandidateWithSoftSpaces(TextCheckingResult) { }
</ins><span class="cx">
</span><span class="cx"> // Notify an input method that a composition was voluntarily discarded by WebCore, so that it could clean up too.
</span><span class="cx"> // This function is not called when a composition is closed per a request from an input method.
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2016-05-17 Beth Dakin <bdakin@apple.com>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ This patch re-names handleAcceptedCandidate to
+ handleAcceptedCandidateWithSoftSpaces. The function now takes a
+ WebCore::TextCheckingResult instead of an NSTextCheckingResult and it can be
+ called from outside of WebEditorClient.
+
+ * WebCoreSupport/WebEditorClient.h:
+ * WebCoreSupport/WebEditorClient.mm:
+ (WebEditorClient::handleRequestedCandidates):
+ (WebEditorClient::handleAcceptedCandidateWithSoftSpaces):
+ (textCheckingResultFromNSTextCheckingResult): Deleted.
+ (WebEditorClient::handleAcceptedCandidate): Deleted.
+
+ Move showCandidates to WebViewPrivate so that it can be overridden by a test.
+ * WebView/WebViewInternal.h:
+ * WebView/WebViewPrivate.h:
+
</ins><span class="cx"> 2016-05-17 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove ES6_GENERATORS flag
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.h        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx"> #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
</span><span class="cx"> void requestCandidatesForSelection(const WebCore::VisibleSelection&) override;
</span><span class="cx"> void handleRequestedCandidates(NSInteger, NSArray<NSTextCheckingResult *> *);
</span><del>- void handleAcceptedCandidate(NSTextCheckingResult *);
</del><ins>+ void handleAcceptedCandidateWithSoftSpaces(WebCore::TextCheckingResult) override;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> void registerUndoOrRedoStep(PassRefPtr<WebCore::UndoStep>, bool isRedo);
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebEditorClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -1197,45 +1197,12 @@
</span><span class="cx"> if (!quads.isEmpty())
</span><span class="cx"> rectForSelectionCandidates = frame->view()->contentsToWindow(quads[0].enclosingBoundingBox());
</span><span class="cx">
</span><del>- auto weakEditor = m_weakPtrFactory.createWeakPtr();
- [m_webView showCandidates:candidates forString:m_paragraphContextForCandidateRequest.get() inRect:rectForSelectionCandidates forSelectedRange:m_rangeForCandidates view:m_webView completionHandler:[weakEditor](NSTextCheckingResult *acceptedCandidate) {
- dispatch_async(dispatch_get_main_queue(), ^{
- if (!weakEditor)
- return;
- weakEditor->handleAcceptedCandidate(acceptedCandidate);
- });
- }];
</del><ins>+ [m_webView showCandidates:candidates forString:m_paragraphContextForCandidateRequest.get() inRect:rectForSelectionCandidates forSelectedRange:m_rangeForCandidates view:m_webView completionHandler:nil];
</ins><span class="cx">
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static WebCore::TextCheckingResult textCheckingResultFromNSTextCheckingResult(NSTextCheckingResult *nsResult)
</del><ins>+void WebEditorClient::handleAcceptedCandidateWithSoftSpaces(TextCheckingResult acceptedCandidate)
</ins><span class="cx"> {
</span><del>- WebCore::TextCheckingResult result;
-
- switch ([nsResult resultType]) {
- case NSTextCheckingTypeSpelling:
- result.type = WebCore::TextCheckingTypeSpelling;
- break;
- case NSTextCheckingTypeReplacement:
- result.type = WebCore::TextCheckingTypeReplacement;
- break;
- case NSTextCheckingTypeCorrection:
- result.type = WebCore::TextCheckingTypeCorrection;
- break;
- default:
- result.type = WebCore::TextCheckingTypeNone;
- }
-
- NSRange resultRange = [nsResult range];
- result.location = resultRange.location;
- result.length = resultRange.length;
- result.replacement = [nsResult replacementString];
-
- return result;
-}
-
-void WebEditorClient::handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate)
-{
</del><span class="cx"> Frame* frame = core([m_webView _selectedOrMainFrame]);
</span><span class="cx"> if (!frame)
</span><span class="cx"> return;
</span><span class="lines">@@ -1246,16 +1213,16 @@
</span><span class="cx">
</span><span class="cx"> NSView <WebDocumentView> *view = [[[m_webView selectedFrame] frameView] documentView];
</span><span class="cx"> if ([view isKindOfClass:[WebHTMLView class]]) {
</span><del>- NSRange range = [acceptedCandidate range];
- if (acceptedCandidate.replacementString && [acceptedCandidate.replacementString length] > 0) {
- NSRange replacedRange = NSMakeRange(range.location, [acceptedCandidate.replacementString length]);
</del><ins>+ unsigned replacementLength = acceptedCandidate.replacement.length();
+ if (replacementLength > 0) {
+ NSRange replacedRange = NSMakeRange(acceptedCandidate.location, replacementLength);
</ins><span class="cx"> NSRange softSpaceRange = NSMakeRange(NSMaxRange(replacedRange) - 1, 1);
</span><del>- if ([acceptedCandidate.replacementString hasSuffix:@" "])
</del><ins>+ if (acceptedCandidate.replacement.endsWith(" "))
</ins><span class="cx"> [(WebHTMLView *)view _setSoftSpaceRange:softSpaceRange];
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>- frame->editor().handleAcceptedCandidate(textCheckingResultFromNSTextCheckingResult(acceptedCandidate));
</del><ins>+ frame->editor().handleAcceptedCandidate(acceptedCandidate);
</ins><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -297,7 +297,6 @@
</span><span class="cx">
</span><span class="cx"> @interface WebView (WebUpdateWebViewAdditions)
</span><span class="cx"> - (void)updateWebViewAdditions;
</span><del>-- (void)showCandidates:(NSArray *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock;
</del><span class="cx"> - (BOOL)shouldRequestCandidates;
</span><span class="cx"> - (void)webViewAdditionsWillDestroyView;
</span><span class="cx"> @end
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -1067,6 +1067,10 @@
</span><span class="cx"> - (NSCachedURLResponse *)webView:(WebView *)sender resource:(id)identifier willCacheResponse:(NSCachedURLResponse *)response fromDataSource:(WebDataSource *)dataSource;
</span><span class="cx"> @end
</span><span class="cx">
</span><ins>+@interface WebView (WebShowCandidates)
+- (void)showCandidates:(NSArray *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock;
+@end
+
</ins><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> extern "C" {
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit2/ChangeLog        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-05-17 Beth Dakin <bdakin@apple.com>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ This patch makes handleAcceptedCandidate a public member of WebViewImpl
+ instead of a private member.
+ * UIProcess/Cocoa/WebViewImpl.h:
+ (WebKit::WebViewImpl::createWeakPtr):
+
</ins><span class="cx"> 2016-05-17 Dean Jackson <dino@apple.com>
</span><span class="cx">
</span><span class="cx"> Remove ES6_GENERATORS flag
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebViewImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebViewImpl.h        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -478,9 +478,12 @@
</span><span class="cx">
</span><span class="cx"> bool windowIsFrontWindowUnderMouse(NSEvent *);
</span><span class="cx">
</span><del>-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 && USE(APPLE_INTERNAL_SDK)
</del><ins>+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+ void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate);
+#if USE(APPLE_INTERNAL_SDK)
</ins><span class="cx"> #import <WebKitAdditions/WebViewImplAdditions.h>
</span><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> WeakPtr<WebViewImpl> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); }
</span><span class="lines">@@ -514,7 +517,6 @@
</span><span class="cx">
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
</span><span class="cx"> void handleRequestedCandidates(NSInteger sequenceNumber, NSArray<NSTextCheckingResult *> *candidates);
</span><del>- void handleAcceptedCandidate(NSTextCheckingResult *acceptedCandidate);
</del><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> NSView <WebViewImplDelegate> *m_view;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Tools/ChangeLog        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-05-17 Beth Dakin <bdakin@apple.com>
+
+ Make handleAcceptedCandidate a public function
+ https://bugs.webkit.org/show_bug.cgi?id=157763
+ -and corresponding-
+ rdar://problem/26206397
+
+ Reviewed by Tim Horton.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html: Added.
+ * TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm: Added.
+ (-[DoNotLeakWebView dealloc]):
+ (-[DoNotLeakWebView showCandidates:forString:inRect:forSelectedRange:view:completionHandler:]):
+ (-[DoNotLeakFrameLoadDelegate webView:didFinishLoadForFrame:]):
+ (TestWebKitAPI::TEST):
+
</ins><span class="cx"> 2016-05-17 Keith Miller <keith_miller@apple.com>
</span><span class="cx">
</span><span class="cx"> Add test262 harness support code
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestWebKitAPIxcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (201055 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-17 23:22:30 UTC (rev 201055)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -299,6 +299,8 @@
</span><span class="cx">                 936F72811CD7D9EC0068A0FB /* large-video-with-audio.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */; };
</span><span class="cx">                 93AF4ECE1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */; };
</span><span class="cx">                 93AF4ED11506F130007FD57E /* lots-of-images.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93AF4ECF1506F123007FD57E /* lots-of-images.html */; };
</span><ins>+                93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */; };
+                93CFA8691CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93CFA8681CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm */; };
</ins><span class="cx">                 93E943F21CD3E87E00AC08C2 /* VideoControlsManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */; };
</span><span class="cx">                 93F1DB3414DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB3314DA20870024C362 /* NewFirstVisuallyNonEmptyLayout_Bundle.cpp */; };
</span><span class="cx">                 93F1DB5714DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F1DB5614DB1B840024C362 /* NewFirstVisuallyNonEmptyLayoutFails_Bundle.cpp */; };
</span><span class="lines">@@ -422,6 +424,7 @@
</span><span class="cx">                         dstPath = TestWebKitAPI.resources;
</span><span class="cx">                         dstSubfolderSpec = 7;
</span><span class="cx">                         files = (
</span><ins>+                                93CFA8671CEB9E38000565A8 /* autofocused-text-input.html in Copy Resources */,
</ins><span class="cx">                                 93625D271CD9741C006DC1F1 /* large-video-without-audio.html in Copy Resources */,
</span><span class="cx">                                 936F72801CD7D9EC0068A0FB /* large-video-with-audio.html in Copy Resources */,
</span><span class="cx">                                 936F72811CD7D9EC0068A0FB /* large-video-with-audio.mp4 in Copy Resources */,
</span><span class="lines">@@ -743,6 +746,8 @@
</span><span class="cx">                 93AF4ECA1506F035007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutForImages.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93AF4ECD1506F064007FD57E /* NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NewFirstVisuallyNonEmptyLayoutForImages_Bundle.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93AF4ECF1506F123007FD57E /* lots-of-images.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "lots-of-images.html"; sourceTree = "<group>"; };
</span><ins>+                93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "autofocused-text-input.html"; sourceTree = "<group>"; };
+                93CFA8681CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ViewWithEditableAreaLeak.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 93D3D19B17B1A7B000C7C415 /* all-content-in-one-iframe.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "all-content-in-one-iframe.html"; sourceTree = "<group>"; };
</span><span class="cx">                 93D3D19D17B1A84200C7C415 /* LayoutMilestonesWithAllContentInFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LayoutMilestonesWithAllContentInFrame.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 93E943F11CD3E87E00AC08C2 /* VideoControlsManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VideoControlsManager.mm; sourceTree = "<group>"; };
</span><span class="lines">@@ -1156,6 +1161,7 @@
</span><span class="cx">                                 51BCEE4D1C84F52C0042C82E /* IndexedDBMultiProcess-2.html */,
</span><span class="cx">                                 51B1EE941C80FADD0064FB98 /* IndexedDBPersistence-1.html */,
</span><span class="cx">                                 51B1EE951C80FADD0064FB98 /* IndexedDBPersistence-2.html */,
</span><ins>+                                93CFA8661CEB9DE1000565A8 /* autofocused-text-input.html */,
</ins><span class="cx">                                 936F727E1CD7D9D00068A0FB /* large-video-with-audio.html */,
</span><span class="cx">                                 936F727F1CD7D9D00068A0FB /* large-video-with-audio.mp4 */,
</span><span class="cx">                                 93625D261CD973AF006DC1F1 /* large-video-without-audio.html */,
</span><span class="lines">@@ -1517,6 +1523,7 @@
</span><span class="cx">                                 939BFE3918E5548900883275 /* StringTruncator.mm */,
</span><span class="cx">                                 37A6895D148A9B50005100FA /* SubresourceErrorCrash.mm */,
</span><span class="cx">                                 E490296714E2E3A4002BEDD1 /* TypingStyleCrash.mm */,
</span><ins>+                                93CFA8681CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm */,
</ins><span class="cx">                                 51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */,
</span><span class="cx">                                 C2EB2DD116CAC7AC009B52EE /* WebViewDidCreateJavaScriptContext.mm */,
</span><span class="cx">                                 51B454EB1B4E236B0085EAA6 /* WebViewCloseInsideDidFinishLoadForFrame.mm */,
</span><span class="lines">@@ -2013,6 +2020,7 @@
</span><span class="cx">                                 41973B5B1AF2286A006C7B36 /* FileSystem.cpp in Sources */,
</span><span class="cx">                                 CD89D03A1C4EDB2A00040A04 /* WebCoreNSURLSession.mm in Sources */,
</span><span class="cx">                                 83B88A341C80056D00BB2418 /* HTMLParserIdioms.cpp in Sources */,
</span><ins>+                                93CFA8691CEBCFED000565A8 /* ViewWithEditableAreaLeak.mm in Sources */,
</ins><span class="cx">                                 A1C4FB6E1BACCE50003742D0 /* QuickLook.mm in Sources */,
</span><span class="cx">                                 51B1EE8E1C80F5880064FB98 /* IndexedDBPersistence.mm in Sources */,
</span><span class="cx">                                 7A5623111AD5AF3E0096B920 /* MenuTypesForMouseEvents.cpp in Sources */,
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2Cocoaautofocusedtextinputhtml"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html (0 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/autofocused-text-input.html        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+<body>
+<input id="input" type="text" autofocus/>
+</body>
</ins></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsmacViewWithEditableAreaLeakmm"></a>
<div class="addfile"><h4>Added: trunk/Tools/TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm (0 => 201056)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm         (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/mac/ViewWithEditableAreaLeak.mm        2016-05-17 23:24:19 UTC (rev 201056)
</span><span class="lines">@@ -0,0 +1,90 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#import "PlatformUtilities.h"
+#import <WebKit/WebViewPrivate.h>
+#import <wtf/RetainPtr.h>
+
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
+
+static bool webViewWasDeallocated = false;
+static bool didFinishLoad = false;
+static bool didCallShowCandidates = false;
+
+@interface DoNotLeakWebView : WebView
+@end
+
+@implementation DoNotLeakWebView
+
+- (void)dealloc
+{
+ webViewWasDeallocated = true;
+ [super dealloc];
+}
+
+- (void)showCandidates:(NSArray *)candidates forString:(NSString *)string inRect:(NSRect)rectOfTypedString forSelectedRange:(NSRange)range view:(NSView *)view completionHandler:(void (^)(NSTextCheckingResult *acceptedCandidate))completionBlock
+{
+ [super showCandidates:candidates forString:string inRect:rectOfTypedString forSelectedRange:range view:view completionHandler:completionBlock];
+ didCallShowCandidates = true;
+}
+
+@end
+
+@interface DoNotLeakFrameLoadDelegate : NSObject <WebFrameLoadDelegate> {
+}
+@end
+
+@implementation DoNotLeakFrameLoadDelegate
+
+- (void)webView:(WebView *)sender didFinishLoadForFrame:(WebFrame *)frame
+{
+ didFinishLoad = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(DoNotLeakWebView, ViewThatLoadsEditableArea)
+{
+ DoNotLeakWebView *webView = [[DoNotLeakWebView alloc] initWithFrame:NSMakeRect(0, 0, 100, 100)];
+ DoNotLeakFrameLoadDelegate *delegate = [[DoNotLeakFrameLoadDelegate alloc] init];
+ [webView setFrameLoadDelegate:delegate];
+
+ NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@"autofocused-text-input" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"];
+ [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:contentURL]];
+
+ TestWebKitAPI::Util::run(&didFinishLoad);
+ TestWebKitAPI::Util::run(&didCallShowCandidates);
+
+ [webView release];
+ EXPECT_TRUE(webViewWasDeallocated);
+}
+
+}
+
+#endif // PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200
</ins></span></pre>
</div>
</div>
</body>
</html>