<!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>[210266] 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/210266">210266</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2017-01-03 19:13:22 -0800 (Tue, 03 Jan 2017)</dd>
</dl>
<h3>Log Message</h3>
<pre>NSSpellChecker's recordResponse isn't called for unseen automatic corrections
https://bugs.webkit.org/show_bug.cgi?id=166450
<rdar://problem/29447824>
Reviewed by Darin Adler.
Source/WebCore:
Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html
* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::recordAutocorrectionResponse):
(WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted.
* editing/AlternativeTextController.h:
Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having
a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection
of the private overload of recordAutocorrectionResponseReversed, since there's only one caller.
* editing/Editor.cpp:
(WebCore::Editor::markAndReplaceFor):
Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection.
(WebCore::Editor::changeBackToReplacedString):
Adopt recordAutocorrectionResponse.
* page/AlternativeTextClient.h:
Add an "AutocorrectionAccepted" response type.
Source/WebKit/mac:
* WebCoreSupport/CorrectionPanel.h:
* WebCoreSupport/CorrectionPanel.mm:
(CorrectionPanel::recordAutocorrectionResponse):
(CorrectionPanel::handleAcceptedReplacement):
* WebCoreSupport/WebAlternativeTextClient.mm:
(toCorrectionResponse):
(WebAlternativeTextClient::recordAutocorrectionResponse):
Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
through recordAutocorrectionResponse, for debugging's sake.
Drop the NSView parameter because we don't need it, just the tag.
Convert the new AutocorrectionResponseType value to its corresponding
NSCorrectionResponse value.
Source/WebKit2:
* UIProcess/mac/CorrectionPanel.h:
* UIProcess/mac/CorrectionPanel.mm:
(WebKit::CorrectionPanel::recordAutocorrectionResponse):
(WebKit::CorrectionPanel::handleAcceptedReplacement):
Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
through recordAutocorrectionResponse, for debugging's sake.
Drop the NSView parameter because we don't need it, just the tag.
* UIProcess/mac/PageClientImpl.mm:
(WebKit::toCorrectionResponse):
(WebKit::PageClientImpl::recordAutocorrectionResponse):
Convert the new AutocorrectionResponseType value to its corresponding
NSCorrectionResponse value.
Tools:
* DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
* DumpRenderTree/TestRunner.cpp:
(TestRunner::staticFunctions):
* DumpRenderTree/mac/TestRunnerMac.mm:
(setSpellCheckerLoggingEnabledCallback):
* DumpRenderTree/win/TestRunnerWin.cpp:
(setSpellCheckerLoggingEnabledCallback):
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
* DumpRenderTree/mac/DumpRenderTreeSpellChecker.h: Added.
* DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm: Added.
(stringForCorrectionResponse):
(drt_NSSpellChecker_recordResponseToCorrection):
(swizzleNSSpellCheckerMethodsIfNeeded):
(setSpellCheckerLoggingEnabled):
Add a new testRunner method, setSpellCheckerLoggingEnabled, which, when
set to true, logs to stdout (which ends up in the test result) whenever
NSSpellChecker recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
is called, and then calls the original method. It is reset to false between tests.
LayoutTests:
* editing/editing.js:
(runEditingTest):
(runEditingTestWithCallbackLogging):
Add a way to run an editing test without enabling noisy editing callback logging.
* editing/mac/spelling/accept-unseen-candidate-records-acceptance-expected.txt: Added.
* editing/mac/spelling/accept-unseen-candidate-records-acceptance.html: Added.
Add a test that ensures that we correctly inform NSSpellChecker of an
accepted unseen correction.
* platform/mac-wk2/TestExpectations:
Disable the test because spelling tests don't work in WebKit2 at all.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestseditingeditingjs">trunk/LayoutTests/editing/editing.js</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2TestExpectations">trunk/LayoutTests/platform/mac-wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingAlternativeTextControllercpp">trunk/Source/WebCore/editing/AlternativeTextController.cpp</a></li>
<li><a href="#trunkSourceWebCoreeditingAlternativeTextControllerh">trunk/Source/WebCore/editing/AlternativeTextController.h</a></li>
<li><a href="#trunkSourceWebCoreeditingEditorcpp">trunk/Source/WebCore/editing/Editor.cpp</a></li>
<li><a href="#trunkSourceWebCorepageAlternativeTextClienth">trunk/Source/WebCore/page/AlternativeTextClient.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportCorrectionPanelh">trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportCorrectionPanelmm">trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebAlternativeTextClienth">trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h</a></li>
<li><a href="#trunkSourceWebKitmacWebCoreSupportWebAlternativeTextClientmm">trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</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="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebAlternativeTextClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportmacWebAlternativeTextClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj">trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnercpp">trunk/Tools/DumpRenderTree/TestRunner.cpp</a></li>
<li><a href="#trunkToolsDumpRenderTreeTestRunnerh">trunk/Tools/DumpRenderTree/TestRunner.h</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreemm">trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreemacTestRunnerMacmm">trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm</a></li>
<li><a href="#trunkToolsDumpRenderTreewinTestRunnerWincpp">trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestseditingmacspellingacceptunseencandidaterecordsacceptanceexpectedtxt">trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditingmacspellingacceptunseencandidaterecordsacceptancehtml">trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance.html</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreeSpellCheckerh">trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.h</a></li>
<li><a href="#trunkToolsDumpRenderTreemacDumpRenderTreeSpellCheckermm">trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/LayoutTests/ChangeLog        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2017-01-03 Tim Horton <timothy_horton@apple.com>
+
+ NSSpellChecker's recordResponse isn't called for unseen automatic corrections
+ https://bugs.webkit.org/show_bug.cgi?id=166450
+ <rdar://problem/29447824>
+
+ Reviewed by Darin Adler.
+
+ * editing/editing.js:
+ (runEditingTest):
+ (runEditingTestWithCallbackLogging):
+ Add a way to run an editing test without enabling noisy editing callback logging.
+
+ * editing/mac/spelling/accept-unseen-candidate-records-acceptance-expected.txt: Added.
+ * editing/mac/spelling/accept-unseen-candidate-records-acceptance.html: Added.
+ Add a test that ensures that we correctly inform NSSpellChecker of an
+ accepted unseen correction.
+
+ * platform/mac-wk2/TestExpectations:
+ Disable the test because spelling tests don't work in WebKit2 at all.
+
</ins><span class="cx"> 2017-01-03 Nan Wang <n_wang@apple.com>
</span><span class="cx">
</span><span class="cx"> AX: Focus should jump into modal dialogs when one appears
</span></span></pre></div>
<a id="trunkLayoutTestseditingeditingjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/editing/editing.js (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/editing.js        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/LayoutTests/editing/editing.js        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -894,7 +894,11 @@
</span><span class="cx"> })();
</span><span class="cx">
</span><span class="cx"> function runEditingTest() {
</span><del>- if (window.testRunner)
</del><ins>+ runEditingTestWithCallbackLogging(true);
+}
+
+function runEditingTestWithCallbackLogging(enableCallbackLogging) {
+ if (window.testRunner && enableCallbackLogging)
</ins><span class="cx"> testRunner.dumpEditingCallbacks();
</span><span class="cx">
</span><span class="cx"> var elem = document.getElementById("test");
</span></span></pre></div>
<a id="trunkLayoutTestseditingmacspellingacceptunseencandidaterecordsacceptanceexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance-expected.txt (0 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance-expected.txt         (rev 0)
+++ trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance-expected.txt        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -0,0 +1,4 @@
</span><ins>+NSSpellChecker recordResponseToCorrection: notationl -> notational (response: accepted)
+This test verifies that accepted candidates that were accepted immediately and unseen by the user still trigger NSSpellChecker reporting. A single "recordResponseToCorrection" logging should be output by this test, correcting "notationl" to "notational", and should be accepted.
+
+the notational
</ins></span></pre></div>
<a id="trunkLayoutTestseditingmacspellingacceptunseencandidaterecordsacceptancehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance.html (0 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance.html         (rev 0)
+++ trunk/LayoutTests/editing/mac/spelling/accept-unseen-candidate-records-acceptance.html        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -0,0 +1,40 @@
</span><ins>+<html>
+<head>
+<script src=../../editing.js language="JavaScript" type="text/JavaScript" ></script>
+<script>
+function editingTest() {
+ if (window.testRunner) {
+ testRunner.setSpellCheckerLoggingEnabled(true);
+ testRunner.dumpAsText();
+ }
+
+ typeCharacterCommand('t');
+ typeCharacterCommand('h');
+ typeCharacterCommand('e');
+ typeCharacterCommand(' ');
+ typeCharacterCommand('n');
+ typeCharacterCommand('o');
+ typeCharacterCommand('t');
+ typeCharacterCommand('a');
+ typeCharacterCommand('t');
+ typeCharacterCommand('i');
+ typeCharacterCommand('o');
+ typeCharacterCommand('n');
+ typeCharacterCommand('l');
+ typeCharacterCommand(' ');
+}
+</script>
+
+</head>
+<body>
+<p>This test verifies that accepted candidates that were accepted immediately and unseen by the user still trigger NSSpellChecker reporting. A single "recordResponseToCorrection" logging should be output by this test, correcting "notationl" to "notational", and should be accepted.</p>
+<div contenteditable id="root" class="editing">
+<span id="test"></span>
+</div>
+
+<script>
+runEditingTestWithCallbackLogging(false);
+</script>
+
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/TestExpectations        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -173,6 +173,7 @@
</span><span class="cx"> webkit.org/b/105616 editing/mac/spelling/move-cursor-to-beginning-of-autocorrected-word.html [ Failure ]
</span><span class="cx"> webkit.org/b/105616 editing/mac/spelling/removing-underline-after-accepting-autocorrection-using-punctuation.html [ Failure ]
</span><span class="cx"> webkit.org/b/105616 editing/mac/spelling/accept-candidate-allows-autocorrect-on-next-word.html [ Failure ]
</span><ins>+webkit.org/b/105616 editing/mac/spelling/accept-unseen-candidate-records-acceptance.html [ Failure ]
</ins><span class="cx">
</span><span class="cx"> # [WK2] [Mac] Support drag in mouse events for WebKit2 EventSender
</span><span class="cx"> # <https://bugs.webkit.org/show_bug.cgi?id=68552>
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebCore/ChangeLog        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2017-01-03 Tim Horton <timothy_horton@apple.com>
+
+ NSSpellChecker's recordResponse isn't called for unseen automatic corrections
+ https://bugs.webkit.org/show_bug.cgi?id=166450
+ <rdar://problem/29447824>
+
+ Reviewed by Darin Adler.
+
+ Test: editing/mac/spelling/accept-unseen-candidate-records-acceptance.html
+
+ * editing/AlternativeTextController.cpp:
+ (WebCore::AlternativeTextController::recordAutocorrectionResponse):
+ (WebCore::AlternativeTextController::recordAutocorrectionResponseReversed): Deleted.
+ * editing/AlternativeTextController.h:
+ Add recordAutocorrectionResponse, which takes a AutocorrectionResponseType, instead of having
+ a function specifically for reverted autocorrections. Also, get rid of the unnecessary indirection
+ of the private overload of recordAutocorrectionResponseReversed, since there's only one caller.
+
+ * editing/Editor.cpp:
+ (WebCore::Editor::markAndReplaceFor):
+ Call recordAutocorrectionResponse with Accepted when performing an auto-autocorrection.
+
+ (WebCore::Editor::changeBackToReplacedString):
+ Adopt recordAutocorrectionResponse.
+
+ * page/AlternativeTextClient.h:
+ Add an "AutocorrectionAccepted" response type.
+
</ins><span class="cx"> 2017-01-03 Nan Wang <n_wang@apple.com>
</span><span class="cx">
</span><span class="cx"> AX: Focus should jump into modal dialogs when one appears
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAlternativeTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AlternativeTextController.cpp        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebCore/editing/AlternativeTextController.cpp        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -314,7 +314,7 @@
</span><span class="cx"> void AlternativeTextController::respondToUnappliedSpellCorrection(const VisibleSelection& selectionOfCorrected, const String& corrected, const String& correction)
</span><span class="cx"> {
</span><span class="cx"> if (AlternativeTextClient* client = alternativeTextClient())
</span><del>- client->recordAutocorrectionResponse(AutocorrectionReverted, corrected, correction);
</del><ins>+ client->recordAutocorrectionResponse(AutocorrectionResponse::Reverted, corrected, correction);
</ins><span class="cx">
</span><span class="cx"> Ref<Frame> protector(m_frame);
</span><span class="cx"> m_frame.document()->updateLayout();
</span><span class="lines">@@ -516,17 +516,12 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AlternativeTextController::recordAutocorrectionResponseReversed(const String& replacedString, const String& replacementString)
</del><ins>+void AlternativeTextController::recordAutocorrectionResponse(AutocorrectionResponse response, const String& replacedString, PassRefPtr<Range> replacementRange)
</ins><span class="cx"> {
</span><del>- if (AlternativeTextClient* client = alternativeTextClient())
- client->recordAutocorrectionResponse(AutocorrectionReverted, replacedString, replacementString);
</del><ins>+ if (auto client = alternativeTextClient())
+ client->recordAutocorrectionResponse(response, replacedString, plainText(replacementRange.get()));
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void AlternativeTextController::recordAutocorrectionResponseReversed(const String& replacedString, PassRefPtr<Range> replacementRange)
-{
- recordAutocorrectionResponseReversed(replacedString, plainText(replacementRange.get()));
-}
-
</del><span class="cx"> void AlternativeTextController::markReversed(PassRefPtr<Range> changedRange)
</span><span class="cx"> {
</span><span class="cx"> changedRange->startContainer().document().markers().removeMarkers(changedRange.get(), DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);
</span><span class="lines">@@ -557,9 +552,9 @@
</span><span class="cx"> // Spelling corrected text has been edited. We need to determine whether user has reverted it to original text or
</span><span class="cx"> // edited it to something else, and notify spellchecker accordingly.
</span><span class="cx"> if (markersHaveIdenticalDescription(correctedOnceMarkers) && correctedOnceMarkers[0]->description() == corrected)
</span><del>- client->recordAutocorrectionResponse(AutocorrectionReverted, corrected, correction);
</del><ins>+ client->recordAutocorrectionResponse(AutocorrectionResponse::Reverted, corrected, correction);
</ins><span class="cx"> else
</span><del>- client->recordAutocorrectionResponse(AutocorrectionEdited, corrected, correction);
</del><ins>+ client->recordAutocorrectionResponse(AutocorrectionResponse::Edited, corrected, correction);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> markers.removeMarkers(rangeOfCorrection, DocumentMarker::Autocorrected, DocumentMarkerController::RemovePartiallyOverlappingMarker);
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAlternativeTextControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AlternativeTextController.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AlternativeTextController.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebCore/editing/AlternativeTextController.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx"> bool isAutomaticSpellingCorrectionEnabled() UNLESS_ENABLED({ return false; })
</span><span class="cx"> bool shouldRemoveMarkersUponEditing();
</span><span class="cx">
</span><del>- void recordAutocorrectionResponseReversed(const String& replacedString, PassRefPtr<Range> replacementRange) UNLESS_ENABLED({ UNUSED_PARAM(replacedString); UNUSED_PARAM(replacementRange); })
</del><ins>+ void recordAutocorrectionResponse(AutocorrectionResponse, const String& replacedString, PassRefPtr<Range> replacementRange) UNLESS_ENABLED({ UNUSED_PARAM(replacedString); UNUSED_PARAM(replacementRange); })
</ins><span class="cx"> void markReversed(PassRefPtr<Range> changedRange) UNLESS_ENABLED({ UNUSED_PARAM(changedRange); })
</span><span class="cx"> void markCorrection(PassRefPtr<Range> replacedRange, const String& replacedString) UNLESS_ENABLED({ UNUSED_PARAM(replacedRange); UNUSED_PARAM(replacedString); })
</span><span class="cx">
</span><span class="lines">@@ -119,7 +119,6 @@
</span><span class="cx"> String dismissSoon(ReasonForDismissingAlternativeText);
</span><span class="cx"> void applyAlternativeTextToRange(const Range*, const String& alternative, AlternativeTextType, const Vector<DocumentMarker::MarkerType>&);
</span><span class="cx"> void timerFired();
</span><del>- void recordAutocorrectionResponseReversed(const String& replacedString, const String& replacementString);
</del><span class="cx"> void recordSpellcheckerResponseForModifiedCorrection(Range* rangeOfCorrection, const String& corrected, const String& correction);
</span><span class="cx"> String markerDescriptionForAppliedAlternativeText(AlternativeTextType, DocumentMarker::MarkerType);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingEditorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/Editor.cpp (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/Editor.cpp        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebCore/editing/Editor.cpp        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -2577,9 +2577,13 @@
</span><span class="cx"> if (resultLocation < selectionOffset)
</span><span class="cx"> selectionOffset += replacement.length() - resultLength;
</span><span class="cx">
</span><del>- // Add a marker so that corrections can easily be undone and won't be re-corrected.
- if (resultType == TextCheckingTypeCorrection)
- m_alternativeTextController->markCorrection(paragraph.subrange(resultLocation, replacement.length()), replacedString);
</del><ins>+ if (resultType == TextCheckingTypeCorrection) {
+ RefPtr<Range> replacementRange = paragraph.subrange(resultLocation, replacement.length());
+ m_alternativeTextController->recordAutocorrectionResponse(AutocorrectionResponse::Accepted, replacedString, replacementRange);
+
+ // Add a marker so that corrections can easily be undone and won't be re-corrected.
+ m_alternativeTextController->markCorrection(WTFMove(replacementRange), replacedString);
+ }
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -2613,7 +2617,7 @@
</span><span class="cx"> if (!shouldInsertText(replacedString, selection.get(), EditorInsertAction::Pasted))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- m_alternativeTextController->recordAutocorrectionResponseReversed(replacedString, selection);
</del><ins>+ m_alternativeTextController->recordAutocorrectionResponse(AutocorrectionResponse::Reverted, replacedString, selection);
</ins><span class="cx"> TextCheckingParagraph paragraph(selection);
</span><span class="cx"> replaceSelectionWithText(replacedString, false, false, EditActionInsert);
</span><span class="cx"> RefPtr<Range> changedRange = paragraph.subrange(paragraph.checkingStart(), replacedString.length());
</span></span></pre></div>
<a id="trunkSourceWebCorepageAlternativeTextClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/AlternativeTextClient.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/AlternativeTextClient.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebCore/page/AlternativeTextClient.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -50,9 +50,10 @@
</span><span class="cx"> AlternativeTextTypeDictationAlternatives
</span><span class="cx"> };
</span><span class="cx">
</span><del>-enum AutocorrectionResponseType {
- AutocorrectionEdited,
- AutocorrectionReverted
</del><ins>+enum class AutocorrectionResponse {
+ Edited,
+ Reverted,
+ Accepted
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> class AlternativeTextClient {
</span><span class="lines">@@ -63,7 +64,7 @@
</span><span class="cx"> virtual void showCorrectionAlternative(AlternativeTextType, const FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacmentString, const Vector<String>& alternativeReplacementStrings) = 0;
</span><span class="cx"> virtual void dismissAlternative(ReasonForDismissingAlternativeText) = 0;
</span><span class="cx"> virtual String dismissAlternativeSoon(ReasonForDismissingAlternativeText) = 0;
</span><del>- virtual void recordAutocorrectionResponse(AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
</del><ins>+ virtual void recordAutocorrectionResponse(AutocorrectionResponse, const String& replacedString, const String& replacementString) = 0;
</ins><span class="cx"> #endif
</span><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span><span class="cx"> virtual void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit/mac/ChangeLog        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2017-01-03 Tim Horton <timothy_horton@apple.com>
+
+ NSSpellChecker's recordResponse isn't called for unseen automatic corrections
+ https://bugs.webkit.org/show_bug.cgi?id=166450
+ <rdar://problem/29447824>
+
+ Reviewed by Darin Adler.
+
+ * WebCoreSupport/CorrectionPanel.h:
+ * WebCoreSupport/CorrectionPanel.mm:
+ (CorrectionPanel::recordAutocorrectionResponse):
+ (CorrectionPanel::handleAcceptedReplacement):
+ * WebCoreSupport/WebAlternativeTextClient.mm:
+ (toCorrectionResponse):
+ (WebAlternativeTextClient::recordAutocorrectionResponse):
+ Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
+ through recordAutocorrectionResponse, for debugging's sake.
+ Drop the NSView parameter because we don't need it, just the tag.
+ Convert the new AutocorrectionResponseType value to its corresponding
+ NSCorrectionResponse value.
+
</ins><span class="cx"> 2017-01-01 Jeff Miller <jeffm@apple.com>
</span><span class="cx">
</span><span class="cx"> Update user-visible copyright strings to include 2017
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportCorrectionPanelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> ~CorrectionPanel();
</span><span class="cx"> void show(WebView*, WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
</span><span class="cx"> String dismiss(WebCore::ReasonForDismissingAlternativeText);
</span><del>- static void recordAutocorrectionResponse(WebView*, NSCorrectionResponse, const String& replacedString, const String& replacementString);
</del><ins>+ static void recordAutocorrectionResponse(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></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportCorrectionPanelmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit/mac/WebCoreSupport/CorrectionPanel.mm        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -99,9 +99,9 @@
</span><span class="cx"> return m_resultForDismissal.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CorrectionPanel::recordAutocorrectionResponse(WebView* view, NSCorrectionResponse response, const String& replacedString, const String& replacementString)
</del><ins>+void CorrectionPanel::recordAutocorrectionResponse(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><span class="cx"> void CorrectionPanel::handleAcceptedReplacement(NSString* acceptedReplacement, NSString* replaced, NSString* proposedReplacement, NSCorrectionIndicatorType correctionIndicatorType)
</span><span class="lines">@@ -109,27 +109,26 @@
</span><span class="cx"> if (!m_view)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
</del><span class="cx"> NSInteger documentTag = [m_view.get() spellCheckerDocumentTag];
</span><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>+ recordAutocorrectionResponse(documentTag, NSCorrectionResponseAccepted, replaced, acceptedReplacement);
</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>+ recordAutocorrectionResponse(documentTag, NSCorrectionResponseRejected, replaced, proposedReplacement);
</ins><span class="cx"> else
</span><del>- [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:documentTag];
</del><ins>+ recordAutocorrectionResponse(documentTag, NSCorrectionResponseIgnored, replaced, proposedReplacement);
</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>+ recordAutocorrectionResponse(documentTag, NSCorrectionResponseReverted, replaced, acceptedReplacement);
</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>+ recordAutocorrectionResponse(documentTag, NSCorrectionResponseAccepted, replaced, acceptedReplacement);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebAlternativeTextClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> void showCorrectionAlternative(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
</span><span class="cx"> void dismissAlternative(WebCore::ReasonForDismissingAlternativeText) override;
</span><span class="cx"> String dismissAlternativeSoon(WebCore::ReasonForDismissingAlternativeText) override;
</span><del>- void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) override;
</del><ins>+ void recordAutocorrectionResponse(WebCore::AutocorrectionResponse, const String& replacedString, const String& replacementString) override;
</ins><span class="cx"> #endif
</span><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span><span class="cx"> void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) override;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebCoreSupportWebAlternativeTextClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.mm (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.mm        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebAlternativeTextClient.mm        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -62,11 +62,25 @@
</span><span class="cx"> return m_correctionPanel.dismiss(reason);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebAlternativeTextClient::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
</del><ins>+static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse response)
</ins><span class="cx"> {
</span><del>- NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
- CorrectionPanel::recordAutocorrectionResponse(m_webView, response, replacedString, replacementString);
</del><ins>+ switch (response) {
+ case WebCore::AutocorrectionResponse::Reverted:
+ return NSCorrectionResponseReverted;
+ case WebCore::AutocorrectionResponse::Edited:
+ return NSCorrectionResponseEdited;
+ case WebCore::AutocorrectionResponse::Accepted:
+ return NSCorrectionResponseAccepted;
+ }
+
+ ASSERT_NOT_REACHED();
+ return NSCorrectionResponseAccepted;
</ins><span class="cx"> }
</span><ins>+
+void WebAlternativeTextClient::recordAutocorrectionResponse(AutocorrectionResponse response, const String& replacedString, const String& replacementString)
+{
+ CorrectionPanel::recordAutocorrectionResponse([m_webView spellCheckerDocumentTag], toCorrectionResponse(response), replacedString, replacementString);
+}
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/ChangeLog        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2017-01-03 Tim Horton <timothy_horton@apple.com>
+
+ NSSpellChecker's recordResponse isn't called for unseen automatic corrections
+ https://bugs.webkit.org/show_bug.cgi?id=166450
+ <rdar://problem/29447824>
+
+ Reviewed by Darin Adler.
+
+ * UIProcess/mac/CorrectionPanel.h:
+ * UIProcess/mac/CorrectionPanel.mm:
+ (WebKit::CorrectionPanel::recordAutocorrectionResponse):
+ (WebKit::CorrectionPanel::handleAcceptedReplacement):
+ Funnel all calls to recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
+ through recordAutocorrectionResponse, for debugging's sake.
+ Drop the NSView parameter because we don't need it, just the tag.
+
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::toCorrectionResponse):
+ (WebKit::PageClientImpl::recordAutocorrectionResponse):
+ Convert the new AutocorrectionResponseType value to its corresponding
+ NSCorrectionResponse value.
+
</ins><span class="cx"> 2017-01-03 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> Another attempt to fix the Apple Sierra Release 32-bit Build following <https://trac.webkit.org/changeset/210075>
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -249,7 +249,7 @@
</span><span class="cx"> virtual void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) = 0;
</span><span class="cx"> virtual void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) = 0;
</span><span class="cx"> virtual String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) = 0;
</span><del>- virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) = 0;
</del><ins>+ virtual void recordAutocorrectionResponse(WebCore::AutocorrectionResponse, const String& replacedString, const String& replacementString) = 0;
</ins><span class="cx"> virtual void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) = 0;
</span><span class="cx"> virtual void removeNavigationGestureSnapshot() = 0;
</span><span class="cx"> virtual void handleControlledElementIDResponse(const String&) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -6106,9 +6106,9 @@
</span><span class="cx"> result = m_pageClient.dismissCorrectionPanelSoon((ReasonForDismissingAlternativeText)reason);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebPageProxy::recordAutocorrectionResponse(int32_t responseType, const String& replacedString, const String& replacementString)
</del><ins>+void WebPageProxy::recordAutocorrectionResponse(int32_t response, const String& replacedString, const String& replacementString)
</ins><span class="cx"> {
</span><del>- m_pageClient.recordAutocorrectionResponse((AutocorrectionResponseType)responseType, replacedString, replacementString);
</del><ins>+ m_pageClient.recordAutocorrectionResponse(static_cast<AutocorrectionResponse>(response), replacedString, replacementString);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPageProxy::handleAlternativeTextUIResult(const String& result)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx"> ShowCorrectionPanel(int32_t panelType, WebCore::FloatRect boundingBoxOfReplacedString, String replacedString, String replacementString, Vector<String> alternativeReplacementStrings)
</span><span class="cx"> DismissCorrectionPanel(int32_t reason)
</span><span class="cx"> DismissCorrectionPanelSoon(int32_t reason) -> (String result)
</span><del>- RecordAutocorrectionResponse(int32_t responseType, String replacedString, String replacementString);
</del><ins>+ RecordAutocorrectionResponse(int32_t response, String replacedString, String replacementString);
</ins><span class="cx">
</span><span class="cx"> SetEditableElementIsFocused(bool editableElementIsFocused)
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacCorrectionPanelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> ~CorrectionPanel();
</span><span class="cx"> void show(NSView *, WebViewImpl&, WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);
</span><span class="cx"> String dismiss(WebCore::ReasonForDismissingAlternativeText);
</span><del>- static void recordAutocorrectionResponse(NSView *, NSInteger spellCheckerDocumentTag, NSCorrectionResponse, const String& replacedString, const String& replacementString);
</del><ins>+ static void recordAutocorrectionResponse(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></pre></div>
<a id="trunkSourceWebKit2UIProcessmacCorrectionPanelmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/UIProcess/mac/CorrectionPanel.mm        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -109,7 +109,7 @@
</span><span class="cx"> return m_resultForDismissal.get();
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void CorrectionPanel::recordAutocorrectionResponse(NSView *view, NSInteger spellCheckerDocumentTag, NSCorrectionResponse response, const String& replacedString, const String& replacementString)
</del><ins>+void CorrectionPanel::recordAutocorrectionResponse(NSInteger spellCheckerDocumentTag, NSCorrectionResponse response, const String& replacedString, const String& replacementString)
</ins><span class="cx"> {
</span><span class="cx"> [[NSSpellChecker sharedSpellChecker] recordResponse:response toCorrection:replacementString forWord:replacedString language:nil inSpellDocumentWithTag:spellCheckerDocumentTag];
</span><span class="cx"> }
</span><span class="lines">@@ -119,26 +119,24 @@
</span><span class="cx"> if (!m_view)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- NSSpellChecker* spellChecker = [NSSpellChecker sharedSpellChecker];
-
</del><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:m_spellCheckerDocumentTag];
</del><ins>+ recordAutocorrectionResponse(m_spellCheckerDocumentTag, NSCorrectionResponseAccepted, replaced, acceptedReplacement);
</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:m_spellCheckerDocumentTag];
</del><ins>+ recordAutocorrectionResponse(m_spellCheckerDocumentTag, NSCorrectionResponseRejected, replaced, proposedReplacement);
</ins><span class="cx"> else
</span><del>- [spellChecker recordResponse:NSCorrectionResponseIgnored toCorrection:proposedReplacement forWord:replaced language:nil inSpellDocumentWithTag:m_spellCheckerDocumentTag];
</del><ins>+ recordAutocorrectionResponse(m_spellCheckerDocumentTag, NSCorrectionResponseIgnored, replaced, proposedReplacement);
</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:m_spellCheckerDocumentTag];
</del><ins>+ recordAutocorrectionResponse(m_spellCheckerDocumentTag, NSCorrectionResponseReverted, replaced, acceptedReplacement);
</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:m_spellCheckerDocumentTag];
</del><ins>+ recordAutocorrectionResponse(m_spellCheckerDocumentTag, NSCorrectionResponseAccepted, replaced, acceptedReplacement);
</ins><span class="cx"> break;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -160,7 +160,7 @@
</span><span class="cx"> void showCorrectionPanel(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
</span><span class="cx"> void dismissCorrectionPanel(WebCore::ReasonForDismissingAlternativeText) override;
</span><span class="cx"> String dismissCorrectionPanelSoon(WebCore::ReasonForDismissingAlternativeText) override;
</span><del>- void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) override;
</del><ins>+ void recordAutocorrectionResponse(WebCore::AutocorrectionResponse, const String& replacedString, const String& replacementString) override;
</ins><span class="cx">
</span><span class="cx"> void recommendedScrollbarStyleDidChange(WebCore::ScrollbarStyle) override;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -568,12 +568,26 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
</del><ins>+static inline NSCorrectionResponse toCorrectionResponse(AutocorrectionResponse response)
</ins><span class="cx"> {
</span><del>- NSCorrectionResponse response = responseType == AutocorrectionReverted ? NSCorrectionResponseReverted : NSCorrectionResponseEdited;
- CorrectionPanel::recordAutocorrectionResponse(m_view, m_impl->spellCheckerDocumentTag(), response, replacedString, replacementString);
</del><ins>+ switch (response) {
+ case WebCore::AutocorrectionResponse::Reverted:
+ return NSCorrectionResponseReverted;
+ case WebCore::AutocorrectionResponse::Edited:
+ return NSCorrectionResponseEdited;
+ case WebCore::AutocorrectionResponse::Accepted:
+ return NSCorrectionResponseAccepted;
+ }
+
+ ASSERT_NOT_REACHED();
+ return NSCorrectionResponseAccepted;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void PageClientImpl::recordAutocorrectionResponse(AutocorrectionResponse response, const String& replacedString, const String& replacementString)
+{
+ CorrectionPanel::recordAutocorrectionResponse(m_impl->spellCheckerDocumentTag(), toCorrectionResponse(response), replacedString, replacementString);
+}
+
</ins><span class="cx"> void PageClientImpl::recommendedScrollbarStyleDidChange(ScrollbarStyle newStyle)
</span><span class="cx"> {
</span><span class="cx"> // Now re-create a tracking area with the appropriate options given the new scrollbar style
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebAlternativeTextClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebAlternativeTextClient.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> void showCorrectionAlternative(WebCore::AlternativeTextType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings) override;
</span><span class="cx"> void dismissAlternative(WebCore::ReasonForDismissingAlternativeText) override;
</span><span class="cx"> String dismissAlternativeSoon(WebCore::ReasonForDismissingAlternativeText) override;
</span><del>- void recordAutocorrectionResponse(WebCore::AutocorrectionResponseType, const String& replacedString, const String& replacementString) override;
</del><ins>+ void recordAutocorrectionResponse(WebCore::AutocorrectionResponse, const String& replacedString, const String& replacementString) override;
</ins><span class="cx"> #endif
</span><span class="cx"> #if USE(DICTATION_ALTERNATIVES)
</span><span class="cx"> void showDictationAlternativeUI(const WebCore::FloatRect& boundingBoxOfDictatedText, uint64_t dictationContext) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportmacWebAlternativeTextClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebAlternativeTextClient.cpp        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -69,9 +69,9 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebAlternativeTextClient::recordAutocorrectionResponse(AutocorrectionResponseType responseType, const String& replacedString, const String& replacementString)
</del><ins>+void WebAlternativeTextClient::recordAutocorrectionResponse(AutocorrectionResponse response, const String& replacedString, const String& replacementString)
</ins><span class="cx"> {
</span><del>- m_page->send(Messages::WebPageProxy::RecordAutocorrectionResponse(responseType, replacedString, replacementString));
</del><ins>+ m_page->send(Messages::WebPageProxy::RecordAutocorrectionResponse(static_cast<int32_t>(response), replacedString, replacementString));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Tools/ChangeLog        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2017-01-03 Tim Horton <timothy_horton@apple.com>
+
+ NSSpellChecker's recordResponse isn't called for unseen automatic corrections
+ https://bugs.webkit.org/show_bug.cgi?id=166450
+ <rdar://problem/29447824>
+
+ Reviewed by Darin Adler.
+
+ * DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj:
+ * DumpRenderTree/TestRunner.cpp:
+ (TestRunner::staticFunctions):
+ * DumpRenderTree/mac/TestRunnerMac.mm:
+ (setSpellCheckerLoggingEnabledCallback):
+ * DumpRenderTree/win/TestRunnerWin.cpp:
+ (setSpellCheckerLoggingEnabledCallback):
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetWebViewToConsistentStateBeforeTesting):
+ * DumpRenderTree/mac/DumpRenderTreeSpellChecker.h: Added.
+ * DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm: Added.
+ (stringForCorrectionResponse):
+ (drt_NSSpellChecker_recordResponseToCorrection):
+ (swizzleNSSpellCheckerMethodsIfNeeded):
+ (setSpellCheckerLoggingEnabled):
+ Add a new testRunner method, setSpellCheckerLoggingEnabled, which, when
+ set to true, logs to stdout (which ends up in the test result) whenever
+ NSSpellChecker recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:
+ is called, and then calls the original method. It is reset to false between tests.
+
</ins><span class="cx"> 2017-01-03 Sam Weinig <sam@webkit.org>
</span><span class="cx">
</span><span class="cx"> Make WTF::Expected support Ref template parameters
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeDumpRenderTreexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Tools/DumpRenderTree/DumpRenderTree.xcodeproj/project.pbxproj        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx">                 29CFBA2E12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 29CFBA2D12273A1000BC30C0 /* AccessibilityTextMarkerMac.mm */; };
</span><span class="cx">                 2CE88FA217124D8C00734FC0 /* JavaScriptThreading.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2CE88FA117124CEE00734FC0 /* JavaScriptThreading.cpp */; };
</span><span class="cx">                 2D403F1B15087209005358D2 /* LayoutTestHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 2D403EA215087142005358D2 /* LayoutTestHelper.m */; };
</span><ins>+                2DA2E3A51E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA2E3A41E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm */; };
</ins><span class="cx">                 31117B3D15D9A56A00163BC8 /* MockWebNotificationProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */; };
</span><span class="cx">                 440590711268453800CFD48D /* WebArchiveDumpSupportMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 440590701268453800CFD48D /* WebArchiveDumpSupportMac.mm */; };
</span><span class="cx">                 4437730E125CBC3600AAE02C /* WebArchiveDumpSupport.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 44A997830FCDE86400580F10 /* WebArchiveDumpSupport.cpp */; };
</span><span class="lines">@@ -291,6 +292,8 @@
</span><span class="cx">                 2CE88FA117124CEE00734FC0 /* JavaScriptThreading.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptThreading.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 2D403EA215087142005358D2 /* LayoutTestHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LayoutTestHelper.m; path = mac/LayoutTestHelper.m; sourceTree = "<group>"; };
</span><span class="cx">                 2D403F19150871F9005358D2 /* LayoutTestHelper */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = LayoutTestHelper; sourceTree = BUILT_PRODUCTS_DIR; };
</span><ins>+                2DA2E3A31E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DumpRenderTreeSpellChecker.h; path = mac/DumpRenderTreeSpellChecker.h; sourceTree = "<group>"; };
+                2DA2E3A41E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = DumpRenderTreeSpellChecker.mm; path = mac/DumpRenderTreeSpellChecker.mm; sourceTree = "<group>"; };
</ins><span class="cx">                 31117B3A15D9A56A00163BC8 /* MockWebNotificationProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MockWebNotificationProvider.h; path = mac/MockWebNotificationProvider.h; sourceTree = "<group>"; };
</span><span class="cx">                 31117B3B15D9A56A00163BC8 /* MockWebNotificationProvider.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MockWebNotificationProvider.mm; path = mac/MockWebNotificationProvider.mm; sourceTree = "<group>"; };
</span><span class="cx">                 32A70AAB03705E1F00C91783 /* DumpRenderTreePrefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DumpRenderTreePrefix.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -786,6 +789,8 @@
</span><span class="cx">                         children = (
</span><span class="cx">                                 A8B91ADF0CF3B372008F91FF /* DumpRenderTreePasteboard.h */,
</span><span class="cx">                                 A8B91AD70CF3B32F008F91FF /* DumpRenderTreePasteboard.m */,
</span><ins>+                                2DA2E3A31E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.h */,
+                                2DA2E3A41E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm */,
</ins><span class="cx">                                 A8B91ADD0CF3B372008F91FF /* DumpRenderTreeWindow.h */,
</span><span class="cx">                                 A8B91AD90CF3B32F008F91FF /* DumpRenderTreeWindow.mm */,
</span><span class="cx">                         );
</span><span class="lines">@@ -1096,6 +1101,7 @@
</span><span class="cx">                         files = (
</span><span class="cx">                                 A134E53618905EFF00901D06 /* AccessibilityCommonMac.mm in Sources */,
</span><span class="cx">                                 BCD08B3A0E1057EF00A7D0C1 /* AccessibilityController.cpp in Sources */,
</span><ins>+                                2DA2E3A51E1BA54100A3BBD0 /* DumpRenderTreeSpellChecker.mm in Sources */,
</ins><span class="cx">                                 AA5A15EF16E15CD000F7C561 /* AccessibilityControllerIOS.mm in Sources */,
</span><span class="cx">                                 BCD08B710E1059D200A7D0C1 /* AccessibilityControllerMac.mm in Sources */,
</span><span class="cx">                                 80045AEE147718E7008290A8 /* AccessibilityNotificationHandler.mm in Sources */,
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.cpp        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -1779,6 +1779,15 @@
</span><span class="cx"> return JSValueMakeNumber(context, controller->imageCountInGeneralPasteboard());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static JSValueRef setSpellCheckerLoggingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ if (argumentCount < 1)
+ return JSValueMakeUndefined(context);
+ TestRunner* controller = static_cast<TestRunner*>(JSObjectGetPrivate(thisObject));
+ controller->setSpellCheckerLoggingEnabled(JSValueToBoolean(context, arguments[0]));
+ return JSValueMakeUndefined(context);
+}
+
</ins><span class="cx"> // Static Values
</span><span class="cx">
</span><span class="cx"> static JSValueRef getTimeoutCallback(JSContextRef context, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception)
</span><span class="lines">@@ -2225,6 +2234,7 @@
</span><span class="cx"> { "accummulateLogsForChannel", accummulateLogsForChannel, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx"> { "runUIScript", runUIScriptCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><span class="cx"> { "imageCountInGeneralPasteboard", imageCountInGeneralPasteboardCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</span><ins>+ { "setSpellCheckerLoggingEnabled", setSpellCheckerLoggingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
</ins><span class="cx"> { 0, 0, 0 }
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreeTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/TestRunner.h (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/TestRunner.h        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Tools/DumpRenderTree/TestRunner.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -373,6 +373,8 @@
</span><span class="cx"> void setDumpJSConsoleLogInStdErr(bool inStdErr) { m_dumpJSConsoleLogInStdErr = inStdErr; }
</span><span class="cx"> bool dumpJSConsoleLogInStdErr() const { return m_dumpJSConsoleLogInStdErr; }
</span><span class="cx">
</span><ins>+ void setSpellCheckerLoggingEnabled(bool);
+
</ins><span class="cx"> private:
</span><span class="cx"> TestRunner(const std::string& testURL, const std::string& expectedPixelHash);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreemm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx"> #import "DefaultPolicyDelegate.h"
</span><span class="cx"> #import "DumpRenderTreeDraggingInfo.h"
</span><span class="cx"> #import "DumpRenderTreePasteboard.h"
</span><ins>+#import "DumpRenderTreeSpellChecker.h"
</ins><span class="cx"> #import "DumpRenderTreeWindow.h"
</span><span class="cx"> #import "EditingDelegate.h"
</span><span class="cx"> #import "EventSendingController.h"
</span><span class="lines">@@ -1894,6 +1895,8 @@
</span><span class="cx">
</span><span class="cx"> [mainFrame _clearOpener];
</span><span class="cx">
</span><ins>+ setSpellCheckerLoggingEnabled(false);
+
</ins><span class="cx"> resetAccumulatedLogs();
</span><span class="cx"> WebCoreTestSupport::initializeLogChannelsIfNecessary();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreeSpellCheckerh"></a>
<div class="addfile"><h4>Added: trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.h (0 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.h         (rev 0)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.h        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+void setSpellCheckerLoggingEnabled(bool);
</ins></span></pre></div>
<a id="trunkToolsDumpRenderTreemacDumpRenderTreeSpellCheckermm"></a>
<div class="addfile"><h4>Added: trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm (0 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm         (rev 0)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTreeSpellChecker.mm        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -0,0 +1,91 @@
</span><ins>+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "DumpRenderTreeSpellChecker.h"
+
+#if PLATFORM(MAC)
+
+#import <AppKit/NSSpellChecker.h>
+#import <wtf/Assertions.h>
+#import <wtf/ObjcRuntimeExtras.h>
+
+static bool spellCheckerLoggingEnabled;
+static IMP appKitRecordResponseIMP;
+
+static const char *stringForCorrectionResponse(NSCorrectionResponse correctionResponse)
+{
+ switch (correctionResponse) {
+ case NSCorrectionResponseNone:
+ return "none";
+ case NSCorrectionResponseAccepted:
+ return "accepted";
+ case NSCorrectionResponseRejected:
+ return "rejected";
+ case NSCorrectionResponseIgnored:
+ return "ignored";
+ case NSCorrectionResponseEdited:
+ return "edited";
+ case NSCorrectionResponseReverted:
+ return "reverted";
+ }
+
+ return "invalid";
+}
+
+static void drt_NSSpellChecker_recordResponseToCorrection(id self, SEL _cmd, NSCorrectionResponse response, NSString *correction, NSString *word, NSString *language, NSInteger spellDocumentTag)
+{
+ if (spellCheckerLoggingEnabled)
+ printf("NSSpellChecker recordResponseToCorrection: %s -> %s (response: %s)\n", [word UTF8String], [correction UTF8String], stringForCorrectionResponse(response));
+
+ wtfCallIMP<void, NSCorrectionResponse, NSString *, NSString *, NSString *, NSInteger>(appKitRecordResponseIMP, self, _cmd, response, correction, word, language, spellDocumentTag);
+}
+
+static void swizzleNSSpellCheckerMethodsIfNeeded()
+{
+ static bool hasSwizzled;
+ if (hasSwizzled)
+ return;
+ hasSwizzled = true;
+
+ Method recordResponseMethod = class_getInstanceMethod(objc_getClass("NSSpellChecker"), @selector(recordResponse:toCorrection:forWord:language:inSpellDocumentWithTag:));
+
+ appKitRecordResponseIMP = method_setImplementation(recordResponseMethod, (IMP)drt_NSSpellChecker_recordResponseToCorrection);
+}
+
+void setSpellCheckerLoggingEnabled(bool enabled)
+{
+ swizzleNSSpellCheckerMethodsIfNeeded();
+
+ spellCheckerLoggingEnabled = enabled;
+}
+
+#else // PLATFORM(MAC)
+
+void setSpellCheckerLoggingEnabled(bool)
+{
+}
+
+#endif // PLATFORM(MAC)
</ins></span></pre></div>
<a id="trunkToolsDumpRenderTreemacTestRunnerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Tools/DumpRenderTree/mac/TestRunnerMac.mm        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #import "TestRunner.h"
</span><span class="cx">
</span><span class="cx"> #import "DefaultPolicyDelegate.h"
</span><ins>+#import "DumpRenderTreeSpellChecker.h"
</ins><span class="cx"> #import "EditingDelegate.h"
</span><span class="cx"> #import "MockGeolocationProvider.h"
</span><span class="cx"> #import "MockWebNotificationProvider.h"
</span><span class="lines">@@ -210,6 +211,11 @@
</span><span class="cx"> [WebStorageManager setStorageDatabaseIdleInterval:interval];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TestRunner::setSpellCheckerLoggingEnabled(bool enabled)
+{
+ ::setSpellCheckerLoggingEnabled(enabled);
+}
+
</ins><span class="cx"> void TestRunner::closeIdleLocalStorageDatabases()
</span><span class="cx"> {
</span><span class="cx"> [WebStorageManager closeIdleLocalStorageDatabases];
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinTestRunnerWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp (210265 => 210266)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp        2017-01-04 03:07:03 UTC (rev 210265)
+++ trunk/Tools/DumpRenderTree/win/TestRunnerWin.cpp        2017-01-04 03:13:22 UTC (rev 210266)
</span><span class="lines">@@ -1392,3 +1392,7 @@
</span><span class="cx"> return 0;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void TestRunner::setSpellCheckerLoggingEnabled(bool enabled)
+{
+ printf("ERROR: TestRunner::setSpellCheckerLoggingEnabled() not implemented\n");
+}
</ins></span></pre>
</div>
</div>
</body>
</html>