<!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>[265509] 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/265509">265509</a></dd>
<dt>Author</dt> <dd>wenson_hsieh@apple.com</dd>
<dt>Date</dt> <dd>2020-08-11 12:45:57 -0700 (Tue, 11 Aug 2020)</dd>
</dl>

<h3>Log Message</h3>
<pre>Text input autocorrect="off" attribute ignored on Mac
https://bugs.webkit.org/show_bug.cgi?id=151019
<rdar://problem/65061700>

Reviewed by Simon Fraser.

Source/WebCore:

Add support for the `autocorrect` attribute on macOS, by not showing the automatic spell checking popup or
automatically correcting misspelled words if the root editable element has `autocorrect="off"`.

Tests:  editing/input/cocoa/autocorrect-off.html
        editing/input/cocoa/autocorrect-on.html

* editing/AlternativeTextController.cpp:
(WebCore::AlternativeTextController::isAutomaticSpellingCorrectionEnabled):

Source/WTF:

* wtf/PlatformEnableCocoa.h: Turn the feature on for macOS.

LayoutTests:

Move the existing test `fast/events/ios/contenteditable-autocorrect.html` into `editing/input/cocoa`, and
refactor it so that it:
-   Works on both iOS and macOS.
-   Tests both the `contenteditable` case and the form control case.
-   Is split into two tests: one of which uses autocorrect="off" by typing "Tset" and expecting it to remain
    as-is, and a second test that uses autocorrect="on" and verifies that "Tset" is autocorrected to "Test",
    firing an input event with `inputType` `"insertReplacementText"` in the process.

* TestExpectations:
* editing/input/cocoa/autocorrect-off-expected.txt: Added.
* editing/input/cocoa/autocorrect-off.html: Added.
* editing/input/cocoa/autocorrect-on-expected.txt: Added.
* editing/input/cocoa/autocorrect-on.html: Added.
* fast/events/ios/contenteditable-autocorrect-expected.txt: Removed.
* fast/events/ios/contenteditable-autocorrect.html: Removed.
* js/dom/dom-static-property-for-in-iteration-expected.txt:

Rebaseline a couple of existing layout tests, as well.

* platform/ios/TestExpectations:
* platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
* platform/mac/TestExpectations:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsTestExpectations">trunk/LayoutTests/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsjsdomdomstaticpropertyforiniterationexpectedtxt">trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiosTestExpectations">trunk/LayoutTests/platform/ios/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacTestExpectations">trunk/LayoutTests/platform/mac/TestExpectations</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2jsdomdomstaticpropertyforiniterationexpectedtxt">trunk/LayoutTests/platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfPlatformEnableCocoah">trunk/Source/WTF/wtf/PlatformEnableCocoa.h</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreeditingAlternativeTextControllercpp">trunk/Source/WebCore/editing/AlternativeTextController.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/editing/input/cocoa/</li>
<li><a href="#trunkLayoutTestseditinginputcocoaautocorrectoffexpectedtxt">trunk/LayoutTests/editing/input/cocoa/autocorrect-off-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditinginputcocoaautocorrectoffhtml">trunk/LayoutTests/editing/input/cocoa/autocorrect-off.html</a></li>
<li><a href="#trunkLayoutTestseditinginputcocoaautocorrectonexpectedtxt">trunk/LayoutTests/editing/input/cocoa/autocorrect-on-expected.txt</a></li>
<li><a href="#trunkLayoutTestseditinginputcocoaautocorrectonhtml">trunk/LayoutTests/editing/input/cocoa/autocorrect-on.html</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventsioscontenteditableautocorrectexpectedtxt">trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsioscontenteditableautocorrecthtml">trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/ChangeLog 2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2020-08-11  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Text input autocorrect="off" attribute ignored on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=151019
+        <rdar://problem/65061700>
+
+        Reviewed by Simon Fraser.
+
+        Move the existing test `fast/events/ios/contenteditable-autocorrect.html` into `editing/input/cocoa`, and
+        refactor it so that it:
+        -   Works on both iOS and macOS.
+        -   Tests both the `contenteditable` case and the form control case.
+        -   Is split into two tests: one of which uses autocorrect="off" by typing "Tset" and expecting it to remain
+            as-is, and a second test that uses autocorrect="on" and verifies that "Tset" is autocorrected to "Test",
+            firing an input event with `inputType` `"insertReplacementText"` in the process.
+
+        * TestExpectations:
+        * editing/input/cocoa/autocorrect-off-expected.txt: Added.
+        * editing/input/cocoa/autocorrect-off.html: Added.
+        * editing/input/cocoa/autocorrect-on-expected.txt: Added.
+        * editing/input/cocoa/autocorrect-on.html: Added.
+        * fast/events/ios/contenteditable-autocorrect-expected.txt: Removed.
+        * fast/events/ios/contenteditable-autocorrect.html: Removed.
+        * js/dom/dom-static-property-for-in-iteration-expected.txt:
+
+        Rebaseline a couple of existing layout tests, as well.
+
+        * platform/ios/TestExpectations:
+        * platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt:
+        * platform/mac/TestExpectations:
+
</ins><span class="cx"> 2020-08-11  Kenneth Russell  <kbr@chromium.org>
</span><span class="cx"> 
</span><span class="cx">         [WebGL2] expando-loss and expando-loss-2 conformance tests are failing
</span></span></pre></div>
<a id="trunkLayoutTestsTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/TestExpectations (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/TestExpectations       2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/TestExpectations  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -20,6 +20,7 @@
</span><span class="cx"> editing/caret/ios [ Skip ]
</span><span class="cx"> editing/editable-region [ Skip ]
</span><span class="cx"> editing/execCommand/ios [ Skip ]
</span><ins>+editing/input/cocoa [ Skip ]
</ins><span class="cx"> editing/input/ios [ Skip ]
</span><span class="cx"> editing/find [ Skip ]
</span><span class="cx"> editing/pasteboard/gtk [ Skip ]
</span></span></pre></div>
<a id="trunkLayoutTestseditinginputcocoaautocorrectoffexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/input/cocoa/autocorrect-off-expected.txt (0 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/input/cocoa/autocorrect-off-expected.txt                               (rev 0)
+++ trunk/LayoutTests/editing/input/cocoa/autocorrect-off-expected.txt  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+ This test verifies that autocorrect=off disables autocorrection. To manually test, type 'Tset' into both editable areas and a period, and verify that it is not autocorrected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS contenteditable.textContent is "Tset."
+PASS textarea.value is "Tset."
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestseditinginputcocoaautocorrectoffhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/input/cocoa/autocorrect-off.html (0 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/input/cocoa/autocorrect-off.html                               (rev 0)
+++ trunk/LayoutTests/editing/input/cocoa/autocorrect-off.html  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+    <meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no">
+    <script src="../../../resources/ui-helper.js"></script>
+    <script src="../../../resources/js-test.js"></script>
+    <style>
+    div[contenteditable], textarea {
+        width: 200px;
+        height: 100px;
+        font-size: 24px;
+        border: 1px solid tomato;
+        margin: 10px;
+    }
+    </style>
+</head>
+<body>
+    <div contenteditable autocorrect="off"></div>
+    <textarea autocorrect="off"></textarea>
+    <pre id="description"></pre>
+    <pre id="console"></pre>
+    <script>
+    const stringToType = "Tset.";
+    window.jsTestIsAsync = true;
+    description("This test verifies that autocorrect=off disables autocorrection. To manually test, type 'Tset' into both editable areas and a period, and verify that it is not autocorrected.");
+
+    async function runTestForElement(element, stringToType)
+    {
+        if (window.testRunner)
+            await UIHelper.activateElementAndWaitForInputSession(element);
+
+        for (let character of [...stringToType]) {
+            await UIHelper.callFunctionAndWaitForEvent(() => {
+                return window.testRunner ? UIHelper.typeCharacter(character) : Promise.resolve();
+            }, element, "input");
+        }
+
+        element.blur();
+
+        if (window.testRunner)
+            await UIHelper.waitForKeyboardToHide();
+    }
+
+    addEventListener("load", async () => {
+        if (window.testRunner) {
+            await UIHelper.setContinuousSpellCheckingEnabled(true);
+            await UIHelper.setSpellCheckerResults({
+                "Tset.": [
+                    {
+                        "replacement": "Test",
+                        "type": "correction",
+                        "from": 0,
+                        "to": 4
+                    }
+                ]
+            });
+
+            internals.setAutomaticTextReplacementEnabled(true);
+            internals.setAutomaticSpellingCorrectionEnabled(true);
+        }
+
+        contenteditable = document.querySelector("div[contenteditable]");
+        textarea = document.querySelector("textarea");
+
+        await runTestForElement(contenteditable, stringToType);
+        shouldBeEqualToString("contenteditable.textContent", stringToType);
+
+        await runTestForElement(textarea, stringToType);
+        shouldBeEqualToString("textarea.value", stringToType);
+
+        contenteditable.remove();
+        textarea.remove();
+        finishJSTest();
+    });
+    </script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestseditinginputcocoaautocorrectonexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/input/cocoa/autocorrect-on-expected.txt (0 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/input/cocoa/autocorrect-on-expected.txt                                (rev 0)
+++ trunk/LayoutTests/editing/input/cocoa/autocorrect-on-expected.txt   2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+ This test verifies that autocorrection=on enables autocorrection. To manually test, type 'Tset' into both editable areas and a period, and verify that it is not autocorrected.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedReplacementText became true
+PASS contenteditable.textContent is "Test."
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedText became true
+PASS insertedReplacementText became true
+PASS textarea.value is "Test."
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestseditinginputcocoaautocorrectonhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/editing/input/cocoa/autocorrect-on.html (0 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/editing/input/cocoa/autocorrect-on.html                                (rev 0)
+++ trunk/LayoutTests/editing/input/cocoa/autocorrect-on.html   2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -0,0 +1,94 @@
</span><ins>+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+    <meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no">
+    <script src="../../../resources/ui-helper.js"></script>
+    <script src="../../../resources/js-test.js"></script>
+    <style>
+    div[contenteditable], textarea {
+        width: 200px;
+        height: 100px;
+        font-size: 24px;
+        border: 1px solid tomato;
+        margin: 10px;
+    }
+    </style>
+</head>
+<body>
+    <div contenteditable autocorrect="on"></div>
+    <textarea autocorrect="on"></textarea>
+    <pre id="description"></pre>
+    <pre id="console"></pre>
+    <script>
+    const stringToType = "Tset.";
+    const autocorrectedString = "Test.";
+    window.jsTestIsAsync = true;
+    window.insertedText = false;
+    window.insertedReplacementText = false;
+    description("This test verifies that autocorrection=on enables autocorrection. To manually test, type 'Tset' into both editable areas and a period, and verify that it is not autocorrected.");
+
+    function handleInput(event) {
+        if (event.inputType === "insertText")
+            window.insertedText = true;
+        else if (event.inputType === "insertReplacementText")
+            window.insertedReplacementText = true;
+    }
+
+    async function runTestForElement(element, stringToType)
+    {
+        if (window.testRunner)
+            await UIHelper.activateElementAndWaitForInputSession(element);
+
+        window.insertedReplacementText = false;
+
+        for (let character of [...stringToType]) {
+            window.insertedText = false;
+            if (window.testRunner)
+                await UIHelper.typeCharacter(character);
+            await new Promise(resolve => shouldBecomeEqual("insertedText", "true", resolve));
+        }
+
+        await new Promise(resolve => shouldBecomeEqual("insertedReplacementText", "true", resolve));
+
+        element.blur();
+
+        if (window.testRunner)
+            await UIHelper.waitForKeyboardToHide();
+    }
+
+    addEventListener("load", async () => {
+        if (window.testRunner) {
+            await UIHelper.setContinuousSpellCheckingEnabled(true);
+            await UIHelper.setSpellCheckerResults({
+                "Tset.": [
+                    {
+                        "replacement": "Test",
+                        "type": "correction",
+                        "from": 0,
+                        "to": 4
+                    }
+                ]
+            });
+
+            internals.setAutomaticTextReplacementEnabled(true);
+            internals.setAutomaticSpellingCorrectionEnabled(true);
+        }
+
+        contenteditable = document.querySelector("div[contenteditable]");
+        contenteditable.addEventListener("input", handleInput);
+        textarea = document.querySelector("textarea");
+        textarea.addEventListener("input", handleInput);
+
+        await runTestForElement(contenteditable, stringToType);
+        shouldBeEqualToString("contenteditable.textContent", autocorrectedString);
+
+        await runTestForElement(textarea, stringToType);
+        shouldBeEqualToString("textarea.value", autocorrectedString);
+
+        contenteditable.remove();
+        textarea.remove();
+        finishJSTest();
+    });
+    </script>
+</body>
+</html>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsioscontenteditableautocorrectexpectedtxt"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect-expected.txt (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect-expected.txt       2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect-expected.txt  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -1,5 +0,0 @@
</span><del>-To manually test, type 'Ti' into the contenteditable and a space. The 'Ti' should not be autocorrected.
-
-With autocorrect off, the result is: "Ti"
-With autocorrect on, the result is: "To"
-
</del></span></pre></div>
<a id="trunkLayoutTestsfasteventsioscontenteditableautocorrecthtml"></a>
<div class="delfile"><h4>Deleted: trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect.html (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect.html       2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/fast/events/ios/contenteditable-autocorrect.html  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -1,77 +0,0 @@
</span><del>-<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
-
-<html>
-
-<head>
-    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
-    <script>
-        let write = message => output.innerHTML += message + "<br>";
-        if (window.testRunner) {
-            testRunner.dumpAsText();
-            testRunner.waitUntilDone();
-        }
-
-        let remainingInputEventCount = 0;
-        let resolveExpectedInputEvents = null;
-        function handleInput() {
-            remainingInputEventCount--;
-            if (resolveExpectedInputEvents && !remainingInputEventCount)
-                resolveExpectedInputEvents();
-        }
-
-        function runUIScriptAndExpectInputEvents(inputEventCount, nextAutocorrectValue)
-        {
-            remainingInputEventCount = inputEventCount;
-            resolveExpectedInputEvents = () => {
-                write(`With autocorrect ${editable.autocorrect ? "on" : "off"}, the result is: "${editable.textContent.trim()}"`);
-                editable.textContent = "";
-                editable.autocorrect = nextAutocorrectValue;
-                editable.blur();
-            };
-
-            return new Promise(function(resolve) {
-                let rect = editable.getBoundingClientRect();
-                testRunner.runUIScript(`(function() {
-                    uiController.didShowKeyboardCallback = function() {
-                        uiController.typeCharacterUsingHardwareKeyboard("t", function() {
-                            uiController.typeCharacterUsingHardwareKeyboard("i", function() {
-                                uiController.typeCharacterUsingHardwareKeyboard(" ", function() { });
-                            });
-                        });
-                    }
-                    uiController.didHideKeyboardCallback = function() {
-                        uiController.uiScriptComplete();
-                    }
-                    uiController.singleTapAtPoint(${rect.left + rect.width / 2}, ${rect.top + rect.height / 2}, function() {});
-                })();`, resolve);
-            });
-        }
-
-        function runTest()
-        {
-            if (!window.testRunner || !testRunner.runUIScript)
-                return;
-
-            runUIScriptAndExpectInputEvents(3, "on")
-                .then(() => runUIScriptAndExpectInputEvents(4, null))
-                .then(() => testRunner.notifyDone());
-        }
-    </script>
-    <style>
-    #editable {
-        width: 200px;
-        height: 100px;
-        top: 0;
-        left: 0;
-        position: absolute;
-    }
-    </style>
-</head>
-
-<body onload=runTest()>
-    <div style="font-size: 24px;" contenteditable autocorrect="off" id="editable" oninput=handleInput()></div>
-    <p>To manually test, type 'Ti' into the contenteditable and a space. The 'Ti' should not be autocorrected.</p>
-    <code><div id="output"></div></code>
-</body>
-
-</html>
</del></span></pre></div>
<a id="trunkLayoutTestsjsdomdomstaticpropertyforiniterationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt       2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -50,6 +50,7 @@
</span><span class="cx"> PASS a["offsetWidth"] is 40
</span><span class="cx"> PASS a["offsetHeight"] is 18
</span><span class="cx"> PASS a["outerText"] is nerget
</span><ins>+PASS a["autocorrect"] is true
</ins><span class="cx"> PASS a["webkitdropzone"] is 
</span><span class="cx"> PASS a["inputMode"] is 
</span><span class="cx"> PASS a["style"] is [object CSSStyleDeclaration]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiosTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios/TestExpectations (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios/TestExpectations  2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/platform/ios/TestExpectations     2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -11,6 +11,7 @@
</span><span class="cx"> editing/editable-region [ Pass ]
</span><span class="cx"> editing/execCommand/ios [ Pass ]
</span><span class="cx"> editing/deleting/ios [ Pass ]
</span><ins>+editing/input/cocoa [ Pass ]
</ins><span class="cx"> http/tests/quicklook [ Pass ]
</span><span class="cx"> media/ios [ Pass ]
</span><span class="cx"> quicklook [ Pass ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacTestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/TestExpectations (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/TestExpectations  2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/platform/mac/TestExpectations     2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -9,6 +9,7 @@
</span><span class="cx"> accessibility/mac [ Pass ]
</span><span class="cx"> compositing/scrolling/async-overflow-scrolling/mac [ Pass ]
</span><span class="cx"> displaylists [ Pass ]
</span><ins>+editing/input/cocoa [ Pass ]
</ins><span class="cx"> editing/mac [ Pass ]
</span><span class="cx"> editing/pasteboard/mac [ Pass ]
</span><span class="cx"> fast/dom/Range/mac [ Pass ]
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2jsdomdomstaticpropertyforiniterationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt      2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/LayoutTests/platform/mac-wk2/js/dom/dom-static-property-for-in-iteration-expected.txt 2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> PASS a["offsetWidth"] is 40
</span><span class="cx"> PASS a["offsetHeight"] is 18
</span><span class="cx"> PASS a["outerText"] is nerget
</span><ins>+PASS a["autocorrect"] is true
</ins><span class="cx"> PASS a["webkitdropzone"] is 
</span><span class="cx"> PASS a["inputMode"] is 
</span><span class="cx"> PASS a["enterKeyHint"] is 
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog       2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/Source/WTF/ChangeLog  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2020-08-11  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Text input autocorrect="off" attribute ignored on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=151019
+        <rdar://problem/65061700>
+
+        Reviewed by Simon Fraser.
+
+        * wtf/PlatformEnableCocoa.h: Turn the feature on for macOS.
+
</ins><span class="cx"> 2020-08-10  Myles C. Maxfield  <mmaxfield@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Cocoa] Migrate from CTFontTransformGlyphsWithLanguage() to CTFontShapeGlyphs()
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformEnableCocoah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/PlatformEnableCocoa.h (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/PlatformEnableCocoa.h       2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/Source/WTF/wtf/PlatformEnableCocoa.h  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -87,7 +87,7 @@
</span><span class="cx"> #define ENABLE_AUTOCAPITALIZE 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if !defined(ENABLE_AUTOCORRECT) && !PLATFORM(MAC)
</del><ins>+#if !defined(ENABLE_AUTOCORRECT)
</ins><span class="cx"> #define ENABLE_AUTOCORRECT 1
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/Source/WebCore/ChangeLog      2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2020-08-11  Wenson Hsieh  <wenson_hsieh@apple.com>
+
+        Text input autocorrect="off" attribute ignored on Mac
+        https://bugs.webkit.org/show_bug.cgi?id=151019
+        <rdar://problem/65061700>
+
+        Reviewed by Simon Fraser.
+
+        Add support for the `autocorrect` attribute on macOS, by not showing the automatic spell checking popup or
+        automatically correcting misspelled words if the root editable element has `autocorrect="off"`.
+
+        Tests:  editing/input/cocoa/autocorrect-off.html
+                editing/input/cocoa/autocorrect-on.html
+
+        * editing/AlternativeTextController.cpp:
+        (WebCore::AlternativeTextController::isAutomaticSpellingCorrectionEnabled):
+
</ins><span class="cx"> 2020-08-11  Sihui Liu  <sihui_liu@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Text manipulation crashes when replacing element with img role
</span></span></pre></div>
<a id="trunkSourceWebCoreeditingAlternativeTextControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/editing/AlternativeTextController.cpp (265508 => 265509)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/editing/AlternativeTextController.cpp       2020-08-11 18:14:26 UTC (rev 265508)
+++ trunk/Source/WebCore/editing/AlternativeTextController.cpp  2020-08-11 19:45:57 UTC (rev 265509)
</span><span class="lines">@@ -337,7 +337,23 @@
</span><span class="cx"> 
</span><span class="cx"> bool AlternativeTextController::isAutomaticSpellingCorrectionEnabled()
</span><span class="cx"> {
</span><del>-    return editorClient() && editorClient()->isAutomaticSpellingCorrectionEnabled();
</del><ins>+    if (!editorClient() || !editorClient()->isAutomaticSpellingCorrectionEnabled())
+        return false;
+
+#if ENABLE(AUTOCORRECT)
+    auto position = m_document.selection().selection().start();
+    if (auto editableRoot = position.rootEditableElement()) {
+        if (is<HTMLElement>(editableRoot) && !downcast<HTMLElement>(*editableRoot).shouldAutocorrect())
+            return false;
+    }
+
+    if (auto control = enclosingTextFormControl(position)) {
+        if (!control->shouldAutocorrect())
+            return false;
+    }
+#endif
+
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatRect AlternativeTextController::rootViewRectForRange(const SimpleRange& range) const
</span></span></pre>
</div>
</div>

</body>
</html>