Title: [206261] trunk
Revision
206261
Author
jbed...@apple.com
Date
2016-09-22 10:39:51 -0700 (Thu, 22 Sep 2016)

Log Message

Automatic Text Replacement Testing in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=161919

Reviewed by Ryosuke Niwa.

Source/WebCore:

Fixing existing tests:
    editing/inserting/smart-link-when-caret-is-moved-before-URL.html
    editing/inserting/typing-space-to-trigger-smart-link.html

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* testing/Internals.cpp:
(WebCore::Internals::Internals): Reset TextChecker.
(WebCore::Internals::setContinuousSpellCheckingEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticQuoteSubstitutionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticLinkDetectionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticDashSubstitutionEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticTextReplacementEnabled): Converted exception to an assert.
(WebCore::Internals::setAutomaticSpellingCorrectionEnabled): Converted exception to an assert.
* testing/Internals.h: Removed exception argument for TextChecker setters.
* testing/Internals.idl: Ditto.

Source/WebKit2:

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* UIProcess/API/C/WKTextChecker.cpp: Added #ifdefs to include file for iOS and Mac.
(WKTextCheckerSetTestingMode): Added.
* UIProcess/API/C/WKTextChecker.h: Added #ifdefs to include file for iOS and Mac.
* UIProcess/TextChecker.h: Added hooks to bypass writing to NSUserDefaults.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::toggleSmartInsertDelete):  New message to toggle TextChecker flag.
(WebKit::WebPageProxy::toggleAutomaticQuoteSubstitution): Ditto.
(WebKit::WebPageProxy::toggleAutomaticLinkDetection): Ditto.
(WebKit::WebPageProxy::toggleAutomaticDashSubstitution): Ditto.
(WebKit::WebPageProxy::toggleAutomaticTextReplacement): Ditto.
* UIProcess/WebPageProxy.h: Added messages to toggle TextChecker flags.
* UIProcess/WebPageProxy.messages.in: Ditto.
* UIProcess/efl/TextCheckerEfl.cpp: Implemented new TextChecker hooks for non-Cocoa platforms.
* UIProcess/gtk/TextCheckerGtk.cpp: Ditto.
(WebKit::TextChecker::mutableState): Ditto.
* UIProcess/ios/TextCheckerIOS.mm: Implemented new TextChecker hooks.
(WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
(WebKit::TextChecker::state): Call mutableState.
(WebKit::TextChecker::accessSmartInsertDeleteEnabled): Dummy function.
* UIProcess/mac/TextCheckerMac.mm:
(WebKit::refresh): Reload TextChecker configuration from NSUserDefaults.
(WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
(WebKit::TextChecker::state): Call mutableState().
(WebKit::TextChecker::accessSmartInsertDeleteEnabled): Allow toggling of smartInsertDeleteEnabled without writing to NSUserDefaults.
(WebKit::initializeState): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundle.cpp:
(WKBundleSetAutomaticLinkDetectionEnabled): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Removed WKBundleSetAutomaticLinkDetectionEnabled.
* WebProcess/InjectedBundle/InjectedBundle.cpp:
(WebKit::InjectedBundle::setAutomaticLinkDetectionEnabled): Deleted.
* WebKit2.xcodeproj/project.pbxproj: Added WKTextChecker to Mac and iOS.
* WebProcess/InjectedBundle/InjectedBundle.h: Remove setAutomaticLinkDetectionEnabled.
* WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
(WebKit::WebEditorClient::toggleSmartInsertDelete): Send message to UI process to toggle TextChecker.
(WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution): Ditto.
(WebKit::WebEditorClient::toggleAutomaticLinkDetection): Ditto.
(WebKit::WebEditorClient::toggleAutomaticDashSubstitution): Ditto.
(WebKit::WebEditorClient::toggleAutomaticTextReplacement): Ditto.

Tools:

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Removed setAutomaticLinkDetectionEnabled from TestRunner, moved to Internals.
* WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: Ditto.
(WTR::InjectedBundle::beginTesting): Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.cpp: Ditto.
* WebKitTestRunner/InjectedBundle/TestRunner.h: Ditto.
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::runTest): Place TextChecker into testing mode.

LayoutTests:

Implemented test hooks for text replacement for WebKit2.
Note that spell checking has not been implemented, so most tests which use text replacement still fail.

* editing/inserting/smart-link-when-caret-is-moved-before-URL.html: Use internals instead of TestRunner.
* editing/inserting/typing-space-to-trigger-smart-link.html: Ditto.
* platform/efl/TestExpectations: Added port specific tests.
* platform/gtk/TestExpectations: Added port specific tests.
* platform/ios-simulator/TestExpectations: Added port specific tests.
* platform/ios-simulator-wk1/TestExpectations: Moved skipped tests to ios-simulator.
* platform/ios-simulator-wk2/TestExpectations: Moved skipped tests to ios-simulator.
* platform/mac-wk2/TestExpectations: Removed passing test.
* platform/win/TestExpectations: Added port specific tests.
* platform/wk2/TestExpectations: Added better explanation for failing test.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (206260 => 206261)


--- trunk/LayoutTests/ChangeLog	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/ChangeLog	2016-09-22 17:39:51 UTC (rev 206261)
@@ -1,3 +1,24 @@
+2016-09-22  Jonathan Bedard  <jbed...@apple.com>
+
+        Automatic Text Replacement Testing in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=161919
+
+        Reviewed by Ryosuke Niwa.
+
+        Implemented test hooks for text replacement for WebKit2.
+        Note that spell checking has not been implemented, so most tests which use text replacement still fail.
+
+        * editing/inserting/smart-link-when-caret-is-moved-before-URL.html: Use internals instead of TestRunner.
+        * editing/inserting/typing-space-to-trigger-smart-link.html: Ditto.
+        * platform/efl/TestExpectations: Added port specific tests.
+        * platform/gtk/TestExpectations: Added port specific tests.
+        * platform/ios-simulator/TestExpectations: Added port specific tests.
+        * platform/ios-simulator-wk1/TestExpectations: Moved skipped tests to ios-simulator.
+        * platform/ios-simulator-wk2/TestExpectations: Moved skipped tests to ios-simulator.
+        * platform/mac-wk2/TestExpectations: Removed passing test.
+        * platform/win/TestExpectations: Added port specific tests.
+        * platform/wk2/TestExpectations: Added better explanation for failing test.
+
 2016-09-22  Youenn Fablet  <you...@apple.com>
 
         Sync web-platform-tests up to revision 3801ab5

Modified: trunk/LayoutTests/editing/inserting/smart-link-when-caret-is-moved-before-URL.html (206260 => 206261)


--- trunk/LayoutTests/editing/inserting/smart-link-when-caret-is-moved-before-URL.html	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/editing/inserting/smart-link-when-caret-is-moved-before-URL.html	2016-09-22 17:39:51 UTC (rev 206261)
@@ -6,10 +6,10 @@
 <script src=""
 <script>
 
-if (window.testRunner) {
+if (window.testRunner)
     testRunner.dumpAsText();
-    testRunner.setAutomaticLinkDetectionEnabled(true);
-}
+if (window.internals)
+    internals.setAutomaticLinkDetectionEnabled(true);
 
 description('This test demonstrates that smart link doesn\'t erroneously trigger when the user moves the caret immediately before an URL.');
 

Modified: trunk/LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html (206260 => 206261)


--- trunk/LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/editing/inserting/typing-space-to-trigger-smart-link.html	2016-09-22 17:39:51 UTC (rev 206261)
@@ -4,10 +4,10 @@
 <script>
 function runTest()
 {
-    if (window.testRunner) {
+    if (window.testRunner)
         testRunner.dumpAsText();
-        testRunner.setAutomaticLinkDetectionEnabled(true);
-    }
+    if (window.internals)
+        internals.setAutomaticLinkDetectionEnabled(true);
 
     var testTypeSpaceDiv = document.getElementById('testTypeSpace');
     var targetText = testTypeSpaceDiv.firstChild;
@@ -40,8 +40,8 @@
     else
         document.getElementById('log').textContent += "Failed: the expected content was '" + expectedContents + "', but the actual result was '" + testTypeLinkDiv.innerHTML + "'."
 
-    if (window.testRunner)
-        testRunner.setAutomaticLinkDetectionEnabled(false);
+    if (window.internals)
+        internals.setAutomaticLinkDetectionEnabled(false);
 }
 
 function pressKey(key)

Modified: trunk/LayoutTests/platform/efl/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/efl/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -1666,9 +1666,9 @@
 webkit.org/b/83704 media/event-attributes.html [ Failure Crash Pass ]
 
 # EFL's LayoutTestController does not implement setAutomaticLinkDetectionEnabled
-webkit.org/b/85463 editing/inserting/typing-space-to-trigger-smart-link.html
-webkit.org/b/85463 editing/inserting/smart-link-when-caret-is-moved-before-URL.html
-editing/inserting/smart-quote-with-all-configurations.html
+editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
+editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Skip ]
+editing/inserting/smart-quote-with-all-configurations.html [ Skip ]
 
 # Failing after r119268 on GTK and EFL
 webkit.org/b/88138 http/tests/media/video-buffered.html [ Failure ]

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -389,6 +389,11 @@
 webkit.org/b/133320 crypto/subtle/hmac-sign-verify-empty-key.html [ Pass ]
 webkit.org/b/133320 crypto/subtle/hmac-sign-verify.html [ Pass ]
 
+# GTK does not implement setAutomaticLinkDetectionEnabled
+editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
+editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Skip ]
+editing/inserting/smart-quote-with-all-configurations.html [ Skip ]
+
 # QuickTime plug-in not relevant to this port
 Bug(GTK) plugins/quicktime-plugin-replacement.html [ Skip ]
 
@@ -2596,8 +2601,6 @@
 webkit.org/b/161588 css3/font-variant-synthesis-jdaggett.html [ ImageOnlyFailure ]
 webkit.org/b/161589 css3/masking/mask-repeat-space-padding.html [ ImageOnlyFailure ]
 
-webkit.org/b/161590 editing/inserting/typing-space-to-trigger-smart-link.html [ Failure ]
-
 #////////////////////////////////////////////////////////////////////////////////////////
 # End of non-crashing, non-flaky tests failing
 #////////////////////////////////////////////////////////////////////////////////////////

Modified: trunk/LayoutTests/platform/ios-simulator/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/ios-simulator/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -308,6 +308,11 @@
 http/tests/security/history-username-password.html [ Skip ]
 fast/selectors/hover-invalidation-descendant-dynamic.html [ Skip ]
 
+# IOS does not implement setAutomaticLinkDetectionEnabled
+editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
+editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Skip ]
+editing/inserting/smart-quote-with-all-configurations.html [ Skip ]
+
 webkit.org/b/148695 fast/shadow-dom [ Pass ]
 
 # No tab navigation support on iOS

Modified: trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -247,8 +247,6 @@
 editing/inserting/insert-br-007.html [ Failure ]
 editing/inserting/insert-character-in-first-letter-crash.html [ Failure ]
 editing/inserting/insert-tab-001.html [ Failure ]
-editing/inserting/smart-quote-with-all-configurations.html [ Failure ]
-editing/inserting/typing-space-to-trigger-smart-link.html [ Failure ]
 editing/secure-input/password-input-changed-type.html [ Failure ]
 editing/secure-input/password-input-focusing-to-different-frame.html [ Failure ]
 editing/secure-input/password-input-focusing.html [ Failure ]

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -982,13 +982,10 @@
 editing/inserting/insert-tab-002.html [ Failure ]
 editing/inserting/insert-tab-004.html [ Failure ]
 editing/inserting/paragraph-outside-nested-divs.html [ Failure ]
-editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Failure ]
-editing/inserting/smart-quote-with-all-configurations.html [ Failure ]
 editing/inserting/typing-001.html [ Failure ]
 editing/inserting/typing-003.html [ Failure ]
 editing/inserting/typing-around-br-001.html [ Failure ]
 editing/inserting/typing-around-image-001.html [ Failure ]
-editing/inserting/typing-space-to-trigger-smart-link.html [ Failure ]
 editing/inserting/typing-tab-designmode-forms.html [ Failure ]
 editing/inserting/typing-tab-designmode.html [ Failure ]
 editing/secure-input/password-input-changed-type.html [ Failure ]

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -131,7 +131,6 @@
 webkit.org/b/105616 editing/spelling/editing-multiple-words-with-markers.html
 webkit.org/b/105616 editing/spelling/editing-word-with-marker-2.html
 webkit.org/b/105616 editing/spelling/move-cursor-around-misspelled-word.html
-webkit.org/b/105616 editing/inserting/inserting-slash-inside-url-with-smart-link.html
 webkit.org/b/105616 editing/spelling/spelling-changed-text.html
 webkit.org/b/105616 editing/spelling/spelling-backspace-between-lines.html
 webkit.org/b/105616 editing/spelling/design-mode-spellcheck-off.html
@@ -538,10 +537,6 @@
 
 webkit.org/b/161148 gamepad/gamepad-timestamp.html [ Pass Failure ]
 
-webkit.org/b/161366 editing/pasteboard/5478250.html [ Pass Failure ]
-webkit.org/b/161366 [ Debug ] editing/mac/spelling/accept-misspelled-candidate.html [ Pass Failure ]
-webkit.org/b/161366 [ Debug ] editing/mac/spelling/autocorrection-contraction.html [ Pass Failure ]
-
 webkit.org/b/161633 [ Debug ] storage/indexeddb/objectstore-cursor.html [ Pass Timeout ]
 
 webkit.org/b/161539 [ Release ] http/tests/security/cross-origin-plugin-allowed.html [ Pass Failure ]
@@ -552,4 +547,7 @@
 
 webkit.org/b/161549 fast/scrolling/arrow-key-scroll-in-rtl-document.html [ Pass Failure ]
 
+webkit.org/b/162081 editing/inserting/typing-space-to-trigger-smart-link.html [ Failure ]
+webkit.org/b/162081 editing/inserting/smart-quote-with-all-configurations.html [ Failure ]
+
 webkit.org/b/160017 [ Debug ] js/regress-139548.html [ Pass Timeout ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/win/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/win/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -1241,7 +1241,7 @@
 webkit.org/b/101539 editing/execCommand/switch-list-type-with-orphaned-li.html [ Failure ]
 
 ###### Inserting
-# TODO testRunner::setAutomaticLinkDetectionEnabled isn't implemented
+# Windows does not implement setAutomaticLinkDetectionEnabled
 editing/inserting/typing-space-to-trigger-smart-link.html [ Skip ]
 editing/inserting/smart-link-when-caret-is-moved-before-URL.html [ Skip ]
 editing/inserting/smart-quote-with-all-configurations.html [ Skip ]

Modified: trunk/LayoutTests/platform/wk2/TestExpectations (206260 => 206261)


--- trunk/LayoutTests/platform/wk2/TestExpectations	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/LayoutTests/platform/wk2/TestExpectations	2016-09-22 17:39:51 UTC (rev 206261)
@@ -237,9 +237,6 @@
 fast/block/lineboxcontain/block-glyphs.html
 fast/block/lineboxcontain/font.html
 
-# Strange error in “Internals”
-editing/inserting/smart-quote-with-all-configurations.html
-
 # https://bugs.webkit.org/show_bug.cgi?id=115203
 # Downloaded file name tests fail because of incorrect custom policy delegate implementation
 http/tests/download/default-encoding.html

Modified: trunk/Source/WebCore/ChangeLog (206260 => 206261)


--- trunk/Source/WebCore/ChangeLog	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebCore/ChangeLog	2016-09-22 17:39:51 UTC (rev 206261)
@@ -1,3 +1,28 @@
+2016-09-22  Jonathan Bedard  <jbed...@apple.com>
+
+        Automatic Text Replacement Testing in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=161919
+
+        Reviewed by Ryosuke Niwa.
+
+        Fixing existing tests:
+            editing/inserting/smart-link-when-caret-is-moved-before-URL.html
+            editing/inserting/typing-space-to-trigger-smart-link.html
+
+        Implemented test hooks for text replacement for WebKit2.
+        Note that spell checking has not been implemented, so most tests which use text replacement still fail.
+
+        * testing/Internals.cpp:
+        (WebCore::Internals::Internals): Reset TextChecker.
+        (WebCore::Internals::setContinuousSpellCheckingEnabled): Converted exception to an assert.
+        (WebCore::Internals::setAutomaticQuoteSubstitutionEnabled): Converted exception to an assert.
+        (WebCore::Internals::setAutomaticLinkDetectionEnabled): Converted exception to an assert.
+        (WebCore::Internals::setAutomaticDashSubstitutionEnabled): Converted exception to an assert.
+        (WebCore::Internals::setAutomaticTextReplacementEnabled): Converted exception to an assert.
+        (WebCore::Internals::setAutomaticSpellingCorrectionEnabled): Converted exception to an assert.
+        * testing/Internals.h: Removed exception argument for TextChecker setters.
+        * testing/Internals.idl: Ditto.
+
 2016-09-22  Nan Wang  <n_w...@apple.com>
 
         AX: aria-pressed state not correctly conveyed to VoiceOver iOS on <button> unless role=button added

Modified: trunk/Source/WebCore/testing/Internals.cpp (206260 => 206261)


--- trunk/Source/WebCore/testing/Internals.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebCore/testing/Internals.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -433,6 +433,14 @@
         document.page()->setMockMediaPlaybackTargetPickerEnabled(true);
 #endif
     RuntimeEnabledFeatures::sharedFeatures().reset();
+
+    if (contextDocument() && contextDocument()->frame()) {
+        setAutomaticSpellingCorrectionEnabled(true);
+        setAutomaticQuoteSubstitutionEnabled(false);
+        setAutomaticDashSubstitutionEnabled(false);
+        setAutomaticLinkDetectionEnabled(false);
+        setAutomaticTextReplacementEnabled(true);
+    }
 }
 
 Document* Internals::contextDocument() const
@@ -1610,7 +1618,7 @@
     return document->frame()->editor().selectionStartHasMarkerFor(DocumentMarker::Autocorrected, from, length);
 }
 
-void Internals::setContinuousSpellCheckingEnabled(bool enabled, ExceptionCode&)
+void Internals::setContinuousSpellCheckingEnabled(bool enabled)
 {
     if (!contextDocument() || !contextDocument()->frame())
         return;
@@ -1619,7 +1627,7 @@
         contextDocument()->frame()->editor().toggleContinuousSpellChecking();
 }
 
-void Internals::setAutomaticQuoteSubstitutionEnabled(bool enabled, ExceptionCode&)
+void Internals::setAutomaticQuoteSubstitutionEnabled(bool enabled)
 {
     if (!contextDocument() || !contextDocument()->frame())
         return;
@@ -1632,7 +1640,7 @@
 #endif
 }
 
-void Internals::setAutomaticLinkDetectionEnabled(bool enabled, ExceptionCode&)
+void Internals::setAutomaticLinkDetectionEnabled(bool enabled)
 {
     if (!contextDocument() || !contextDocument()->frame())
         return;
@@ -1645,7 +1653,7 @@
 #endif
 }
 
-void Internals::setAutomaticDashSubstitutionEnabled(bool enabled, ExceptionCode&)
+void Internals::setAutomaticDashSubstitutionEnabled(bool enabled)
 {
     if (!contextDocument() || !contextDocument()->frame())
         return;
@@ -1658,7 +1666,7 @@
 #endif
 }
 
-void Internals::setAutomaticTextReplacementEnabled(bool enabled, ExceptionCode&)
+void Internals::setAutomaticTextReplacementEnabled(bool enabled)
 {
     if (!contextDocument() || !contextDocument()->frame())
         return;
@@ -1671,7 +1679,7 @@
 #endif
 }
 
-void Internals::setAutomaticSpellingCorrectionEnabled(bool enabled, ExceptionCode&)
+void Internals::setAutomaticSpellingCorrectionEnabled(bool enabled)
 {
     if (!contextDocument() || !contextDocument()->frame())
         return;

Modified: trunk/Source/WebCore/testing/Internals.h (206260 => 206261)


--- trunk/Source/WebCore/testing/Internals.h	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebCore/testing/Internals.h	2016-09-22 17:39:51 UTC (rev 206261)
@@ -211,12 +211,12 @@
     bool hasSpellingMarker(int from, int length, ExceptionCode&);
     bool hasGrammarMarker(int from, int length, ExceptionCode&);
     bool hasAutocorrectedMarker(int from, int length, ExceptionCode&);
-    void setContinuousSpellCheckingEnabled(bool enabled, ExceptionCode&);
-    void setAutomaticQuoteSubstitutionEnabled(bool enabled, ExceptionCode&);
-    void setAutomaticLinkDetectionEnabled(bool enabled, ExceptionCode&);
-    void setAutomaticDashSubstitutionEnabled(bool enabled, ExceptionCode&);
-    void setAutomaticTextReplacementEnabled(bool enabled, ExceptionCode&);
-    void setAutomaticSpellingCorrectionEnabled(bool enabled, ExceptionCode&);
+    void setContinuousSpellCheckingEnabled(bool);
+    void setAutomaticQuoteSubstitutionEnabled(bool);
+    void setAutomaticLinkDetectionEnabled(bool);
+    void setAutomaticDashSubstitutionEnabled(bool);
+    void setAutomaticTextReplacementEnabled(bool);
+    void setAutomaticSpellingCorrectionEnabled(bool);
 
     void handleAcceptedCandidate(const String& candidate, unsigned location, unsigned length, ExceptionCode&);
 

Modified: trunk/Source/WebCore/testing/Internals.idl (206260 => 206261)


--- trunk/Source/WebCore/testing/Internals.idl	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebCore/testing/Internals.idl	2016-09-22 17:39:51 UTC (rev 206261)
@@ -207,12 +207,12 @@
     [RaisesException] boolean hasSpellingMarker(long from, long length);
     [RaisesException] boolean hasGrammarMarker(long from, long length);
     [RaisesException] boolean hasAutocorrectedMarker(long from, long length);
-    [RaisesException] void setContinuousSpellCheckingEnabled(boolean enabled);
-    [RaisesException] void setAutomaticQuoteSubstitutionEnabled(boolean enabled);
-    [RaisesException] void setAutomaticLinkDetectionEnabled(boolean enabled);
-    [RaisesException] void setAutomaticDashSubstitutionEnabled(boolean enabled);
-    [RaisesException] void setAutomaticTextReplacementEnabled(boolean enabled);
-    [RaisesException] void setAutomaticSpellingCorrectionEnabled(boolean enabled);
+    void setContinuousSpellCheckingEnabled(boolean enabled);
+    void setAutomaticQuoteSubstitutionEnabled(boolean enabled);
+    void setAutomaticLinkDetectionEnabled(boolean enabled);
+    void setAutomaticDashSubstitutionEnabled(boolean enabled);
+    void setAutomaticTextReplacementEnabled(boolean enabled);
+    void setAutomaticSpellingCorrectionEnabled(boolean enabled);
 
     [RaisesException] void handleAcceptedCandidate(DOMString candidate, unsigned long location, unsigned long length);
 

Modified: trunk/Source/WebKit2/ChangeLog (206260 => 206261)


--- trunk/Source/WebKit2/ChangeLog	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/ChangeLog	2016-09-22 17:39:51 UTC (rev 206261)
@@ -1,3 +1,52 @@
+2016-09-22  Jonathan Bedard  <jbed...@apple.com>
+
+        Automatic Text Replacement Testing in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=161919
+
+        Reviewed by Ryosuke Niwa.
+
+        Implemented test hooks for text replacement for WebKit2.
+        Note that spell checking has not been implemented, so most tests which use text replacement still fail.
+
+        * UIProcess/API/C/WKTextChecker.cpp: Added #ifdefs to include file for iOS and Mac.
+        (WKTextCheckerSetTestingMode): Added.
+        * UIProcess/API/C/WKTextChecker.h: Added #ifdefs to include file for iOS and Mac.
+        * UIProcess/TextChecker.h: Added hooks to bypass writing to NSUserDefaults.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::toggleSmartInsertDelete):  New message to toggle TextChecker flag.
+        (WebKit::WebPageProxy::toggleAutomaticQuoteSubstitution): Ditto.
+        (WebKit::WebPageProxy::toggleAutomaticLinkDetection): Ditto.
+        (WebKit::WebPageProxy::toggleAutomaticDashSubstitution): Ditto.
+        (WebKit::WebPageProxy::toggleAutomaticTextReplacement): Ditto.
+        * UIProcess/WebPageProxy.h: Added messages to toggle TextChecker flags.
+        * UIProcess/WebPageProxy.messages.in: Ditto.
+        * UIProcess/efl/TextCheckerEfl.cpp: Implemented new TextChecker hooks for non-Cocoa platforms.
+        * UIProcess/gtk/TextCheckerGtk.cpp: Ditto.
+        (WebKit::TextChecker::mutableState): Ditto.
+        * UIProcess/ios/TextCheckerIOS.mm: Implemented new TextChecker hooks.
+        (WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
+        (WebKit::TextChecker::state): Call mutableState.
+        (WebKit::TextChecker::accessSmartInsertDeleteEnabled): Dummy function.
+        * UIProcess/mac/TextCheckerMac.mm:
+        (WebKit::refresh): Reload TextChecker configuration from NSUserDefaults.
+        (WebKit::TextChecker::mutableState): Allow modification of text checker without writing to NSUserDefaults.
+        (WebKit::TextChecker::state): Call mutableState().
+        (WebKit::TextChecker::accessSmartInsertDeleteEnabled): Allow toggling of smartInsertDeleteEnabled without writing to NSUserDefaults.
+        (WebKit::initializeState): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundle.cpp:
+        (WKBundleSetAutomaticLinkDetectionEnabled): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundlePrivate.h: Removed WKBundleSetAutomaticLinkDetectionEnabled.
+        * WebProcess/InjectedBundle/InjectedBundle.cpp:
+        (WebKit::InjectedBundle::setAutomaticLinkDetectionEnabled): Deleted.
+        * WebKit2.xcodeproj/project.pbxproj: Added WKTextChecker to Mac and iOS.
+        * WebProcess/InjectedBundle/InjectedBundle.h: Remove setAutomaticLinkDetectionEnabled.
+        * WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm:
+        (WebKit::WebEditorClient::toggleSmartInsertDelete): Send message to UI process to toggle TextChecker.
+        (WebKit::WebEditorClient::toggleAutomaticQuoteSubstitution): Ditto.
+        (WebKit::WebEditorClient::toggleAutomaticLinkDetection): Ditto.
+        (WebKit::WebEditorClient::toggleAutomaticDashSubstitution): Ditto.
+        (WebKit::WebEditorClient::toggleAutomaticTextReplacement): Ditto.
+
 2016-09-22  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Rename DataObjectGtk as SelectionData

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -25,13 +25,23 @@
 
 #include "config.h"
 #include "WKTextChecker.h"
+#include "TextChecker.h"
 
+#if !defined(__APPLE__)
 #include "WKAPICast.h"
 #include "WebPageProxy.h"
 #include "WebTextChecker.h"
+#endif
 
 using namespace WebKit;
 
+void WKTextCheckerSetTestingMode(bool enabled)
+{
+    TextChecker::setTestingMode(enabled);
+}
+
+#if !defined(__APPLE__)
+
 void WKTextCheckerSetClient(const WKTextCheckerClientBase* wkClient)
 {
     if (wkClient && wkClient->version)
@@ -58,3 +68,5 @@
 {
     WebTextChecker::singleton()->changeSpellingToWord(toImpl(page), toWTFString(word));
 }
+
+#endif

Modified: trunk/Source/WebKit2/UIProcess/API/C/WKTextChecker.h (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/API/C/WKTextChecker.h	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/API/C/WKTextChecker.h	2016-09-22 17:39:51 UTC (rev 206261)
@@ -32,6 +32,10 @@
 extern "C" {
 #endif
 
+WK_EXPORT void WKTextCheckerSetTestingMode(bool enabled);
+
+#if !defined(__APPLE__)
+
 // TextChecker Client
 typedef bool (*WKTextCheckerContinousSpellCheckingAllowed)(const void *clientInfo);
 typedef bool (*WKTextCheckerContinousSpellCheckingEnabled)(const void *clientInfo);
@@ -84,6 +88,8 @@
 WK_EXPORT void WKTextCheckerCheckSpelling(WKPageRef page, bool startBeforeSelection);
 WK_EXPORT void WKTextCheckerChangeSpellingToWord(WKPageRef page, WKStringRef word);
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif

Modified: trunk/Source/WebKit2/UIProcess/TextChecker.h (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/TextChecker.h	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/TextChecker.h	2016-09-22 17:39:51 UTC (rev 206261)
@@ -42,6 +42,9 @@
 
     static void setContinuousSpellCheckingEnabled(bool);
     static void setGrammarCheckingEnabled(bool);
+    
+    static void setTestingMode(bool);
+    static bool isTestingMode();
 
 #if PLATFORM(COCOA)
     static void setAutomaticSpellingCorrectionEnabled(bool);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -5976,6 +5976,40 @@
     m_process->send(Messages::WebPage::SetAutoSizingShouldExpandToViewHeight(shouldExpand), m_pageID);
 }
 
+#if USE(AUTOMATIC_TEXT_REPLACEMENT)
+
+void WebPageProxy::toggleSmartInsertDelete()
+{
+    if (TextChecker::isTestingMode())
+        TextChecker::setSmartInsertDeleteEnabled(!TextChecker::isSmartInsertDeleteEnabled());
+}
+
+void WebPageProxy::toggleAutomaticQuoteSubstitution()
+{
+    if (TextChecker::isTestingMode())
+        TextChecker::setAutomaticQuoteSubstitutionEnabled(!TextChecker::state().isAutomaticQuoteSubstitutionEnabled);
+}
+
+void WebPageProxy::toggleAutomaticLinkDetection()
+{
+    if (TextChecker::isTestingMode())
+        TextChecker::setAutomaticLinkDetectionEnabled(!TextChecker::state().isAutomaticLinkDetectionEnabled);
+}
+
+void WebPageProxy::toggleAutomaticDashSubstitution()
+{
+    if (TextChecker::isTestingMode())
+        TextChecker::setAutomaticDashSubstitutionEnabled(!TextChecker::state().isAutomaticDashSubstitutionEnabled);
+}
+
+void WebPageProxy::toggleAutomaticTextReplacement()
+{
+    if (TextChecker::isTestingMode())
+        TextChecker::setAutomaticTextReplacementEnabled(!TextChecker::state().isAutomaticTextReplacementEnabled);
+}
+
+#endif
+
 #if PLATFORM(MAC)
 
 void WebPageProxy::substitutionsPanelIsShowing(bool& isShowing)

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2016-09-22 17:39:51 UTC (rev 206261)
@@ -1423,6 +1423,14 @@
 
     bool maybeInitializeSandboxExtensionHandle(const WebCore::URL&, SandboxExtension::Handle&);
 
+#if USE(AUTOMATIC_TEXT_REPLACEMENT)
+    void toggleSmartInsertDelete();
+    void toggleAutomaticQuoteSubstitution();
+    void toggleAutomaticLinkDetection();
+    void toggleAutomaticDashSubstitution();
+    void toggleAutomaticTextReplacement();
+#endif
+
 #if PLATFORM(MAC)
     void substitutionsPanelIsShowing(bool&);
     void showCorrectionPanel(int32_t panelType, const WebCore::FloatRect& boundingBoxOfReplacedString, const String& replacedString, const String& replacementString, const Vector<String>& alternativeReplacementStrings);

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in	2016-09-22 17:39:51 UTC (rev 206261)
@@ -341,6 +341,13 @@
 #if USE(APPKIT)
     SubstitutionsPanelIsShowing() -> (bool isShowing)
 #endif
+#if USE(AUTOMATIC_TEXT_REPLACEMENT)
+    toggleSmartInsertDelete()
+    toggleAutomaticQuoteSubstitution()
+    toggleAutomaticLinkDetection()
+    toggleAutomaticDashSubstitution()
+    toggleAutomaticTextReplacement()
+#endif
 #if PLATFORM(MAC)
     # Autocorrection messages
     ShowCorrectionPanel(int32_t panelType, WebCore::FloatRect boundingBoxOfReplacedString, String replacedString, String replacementString, Vector<String> alternativeReplacementStrings)

Modified: trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -56,6 +56,18 @@
 
     return textCheckerState;
 }
+    
+static bool testingModeEnabled = false;
+    
+void TextChecker::setTestingMode(bool enabled)
+{
+    testingModeEnabled = enabled;
+}
+    
+bool TextChecker::isTestingMode()
+{
+    return testingModeEnabled;
+}
 
 bool TextChecker::isContinuousSpellCheckingAllowed()
 {

Modified: trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -63,7 +63,19 @@
 {
     return checkerState();
 }
+    
+static bool testingModeEnabled = false;
+    
+void TextChecker::setTestingMode(bool enabled)
+{
+    testingModeEnabled = enabled;
+}
 
+bool TextChecker::isTestingMode()
+{
+    return testingModeEnabled;
+}
+
 #if ENABLE(SPELLCHECK)
 static void updateStateForAllProcessPools()
 {

Modified: trunk/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm	2016-09-22 17:39:51 UTC (rev 206261)
@@ -84,7 +84,20 @@
 {
     notImplemented();
 }
+    
+static bool testingModeEnabled = false;
+    
+void TextChecker::setTestingMode(bool enabled)
+{
+    testingModeEnabled = enabled;
+}
+    
+bool TextChecker::isTestingMode()
+{
+    return testingModeEnabled;
+}
 
+
 static bool smartInsertDeleteEnabled;
 
 bool TextChecker::isSmartInsertDeleteEnabled()

Modified: trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm (206260 => 206261)


--- trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm	2016-09-22 17:39:51 UTC (rev 206261)
@@ -115,7 +115,29 @@
     initializeState();
     return textCheckerState;
 }
+    
+static bool testingModeEnabled = false;
 
+void TextChecker::setTestingMode(bool enabled)
+{
+    if (enabled && !testingModeEnabled) {
+        [[NSUserDefaults standardUserDefaults] setBool:textCheckerState.isContinuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled];
+        [[NSUserDefaults standardUserDefaults] setBool:textCheckerState.isGrammarCheckingEnabled forKey:WebGrammarCheckingEnabled];
+        [[NSUserDefaults standardUserDefaults] setBool:textCheckerState.isAutomaticSpellingCorrectionEnabled forKey:WebAutomaticSpellingCorrectionEnabled];
+        [[NSUserDefaults standardUserDefaults] setBool:textCheckerState.isAutomaticQuoteSubstitutionEnabled forKey:WebAutomaticQuoteSubstitutionEnabled];
+        [[NSUserDefaults standardUserDefaults] setBool:textCheckerState.isAutomaticDashSubstitutionEnabled forKey:WebAutomaticDashSubstitutionEnabled];
+        [[NSUserDefaults standardUserDefaults] setBool:textCheckerState.isAutomaticLinkDetectionEnabled forKey:WebAutomaticLinkDetectionEnabled];
+        [[NSUserDefaults standardUserDefaults] setBool:textCheckerState.isAutomaticTextReplacementEnabled forKey:WebAutomaticTextReplacementEnabled];
+        [[NSUserDefaults standardUserDefaults] setBool:isSmartInsertDeleteEnabled() forKey:WebSmartInsertDeleteEnabled];
+    }
+    testingModeEnabled = enabled;
+}
+
+bool TextChecker::isTestingMode()
+{
+    return testingModeEnabled;
+}
+
 bool TextChecker::isContinuousSpellCheckingAllowed()
 {
     static bool allowContinuousSpellChecking = true;
@@ -137,7 +159,8 @@
         return;
                                                                                       
     textCheckerState.isContinuousSpellCheckingEnabled = isContinuousSpellCheckingEnabled;
-    [[NSUserDefaults standardUserDefaults] setBool:isContinuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled];
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:isContinuousSpellCheckingEnabled forKey:WebContinuousSpellCheckingEnabled];
 
     // FIXME: preflight the spell checker.
 }
@@ -148,7 +171,8 @@
         return;
 
     textCheckerState.isGrammarCheckingEnabled = isGrammarCheckingEnabled;
-    [[NSUserDefaults standardUserDefaults] setBool:isGrammarCheckingEnabled forKey:WebGrammarCheckingEnabled];    
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:isGrammarCheckingEnabled forKey:WebGrammarCheckingEnabled];
     [[NSSpellChecker sharedSpellChecker] updatePanels];
     
     // We call preflightSpellChecker() when turning continuous spell checking on, but we don't need to do that here
@@ -161,7 +185,8 @@
         return;
 
     textCheckerState.isAutomaticSpellingCorrectionEnabled = isAutomaticSpellingCorrectionEnabled;
-    [[NSUserDefaults standardUserDefaults] setBool:isAutomaticSpellingCorrectionEnabled forKey:WebAutomaticSpellingCorrectionEnabled];    
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:isAutomaticSpellingCorrectionEnabled forKey:WebAutomaticSpellingCorrectionEnabled];
 
     [[NSSpellChecker sharedSpellChecker] updatePanels];
 }
@@ -172,7 +197,8 @@
         return;
 
     textCheckerState.isAutomaticQuoteSubstitutionEnabled = isAutomaticQuoteSubstitutionEnabled;
-    [[NSUserDefaults standardUserDefaults] setBool:isAutomaticQuoteSubstitutionEnabled forKey:WebAutomaticQuoteSubstitutionEnabled];    
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:isAutomaticQuoteSubstitutionEnabled forKey:WebAutomaticQuoteSubstitutionEnabled];
     
     [[NSSpellChecker sharedSpellChecker] updatePanels];
 }
@@ -183,7 +209,8 @@
         return;
 
     textCheckerState.isAutomaticDashSubstitutionEnabled = isAutomaticDashSubstitutionEnabled;
-    [[NSUserDefaults standardUserDefaults] setBool:isAutomaticDashSubstitutionEnabled forKey:WebAutomaticDashSubstitutionEnabled];
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:isAutomaticDashSubstitutionEnabled forKey:WebAutomaticDashSubstitutionEnabled];
 
     [[NSSpellChecker sharedSpellChecker] updatePanels];
 }
@@ -194,7 +221,8 @@
         return;
     
     textCheckerState.isAutomaticLinkDetectionEnabled = isAutomaticLinkDetectionEnabled;
-    [[NSUserDefaults standardUserDefaults] setBool:isAutomaticLinkDetectionEnabled forKey:WebAutomaticLinkDetectionEnabled];
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:isAutomaticLinkDetectionEnabled forKey:WebAutomaticLinkDetectionEnabled];
     
     [[NSSpellChecker sharedSpellChecker] updatePanels];
 }
@@ -205,7 +233,8 @@
         return;
     
     textCheckerState.isAutomaticTextReplacementEnabled = isAutomaticTextReplacementEnabled;
-    [[NSUserDefaults standardUserDefaults] setBool:isAutomaticTextReplacementEnabled forKey:WebAutomaticTextReplacementEnabled];
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:isAutomaticTextReplacementEnabled forKey:WebAutomaticTextReplacementEnabled];
 
     [[NSSpellChecker sharedSpellChecker] updatePanels];
 }
@@ -232,7 +261,8 @@
 
     smartInsertDeleteEnabled = flag;
 
-    [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebSmartInsertDeleteEnabled];
+    if (!testingModeEnabled)
+        [[NSUserDefaults standardUserDefaults] setBool:flag forKey:WebSmartInsertDeleteEnabled];
 }
 
 void TextChecker::didChangeAutomaticTextReplacementEnabled()

Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (206260 => 206261)


--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj	2016-09-22 17:39:51 UTC (rev 206261)
@@ -749,6 +749,8 @@
 		31BA924E148831260062EDB5 /* WebNotificationManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 31BA9249148830810062EDB5 /* WebNotificationManagerMessages.h */; };
 		31D5929E166E060000E6BF02 /* WebPlugInClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31D5929C166E05FF00E6BF02 /* WebPlugInClient.cpp */; };
 		31D5929F166E060000E6BF02 /* WebPlugInClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D5929D166E060000E6BF02 /* WebPlugInClient.h */; };
+		31D755C11D91B81500843BD1 /* WKTextChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = 314888FF1D91B11D00377042 /* WKTextChecker.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		31D755C21D91B81B00843BD1 /* WKTextChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 314888FE1D91B11D00377042 /* WKTextChecker.cpp */; };
 		31EA25D2134F78C0005B1452 /* NativeWebMouseEventMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 31EA25D0134F78B2005B1452 /* NativeWebMouseEventMac.mm */; };
 		330934471315B9220097A7BC /* WebCookieManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 330934431315B9220097A7BC /* WebCookieManagerMessageReceiver.cpp */; };
 		330934481315B9220097A7BC /* WebCookieManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 330934441315B9220097A7BC /* WebCookieManagerMessages.h */; };
@@ -2769,6 +2771,8 @@
 		3131261B148FF82B00BA2A39 /* WebNotificationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationManager.cpp; sourceTree = "<group>"; };
 		3131261C148FF82B00BA2A39 /* WebNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNotificationManager.h; sourceTree = "<group>"; };
 		3131261D148FF82C00BA2A39 /* WebNotificationManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebNotificationManager.messages.in; sourceTree = "<group>"; };
+		314888FE1D91B11D00377042 /* WKTextChecker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKTextChecker.cpp; sourceTree = "<group>"; };
+		314888FF1D91B11D00377042 /* WKTextChecker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKTextChecker.h; sourceTree = "<group>"; };
 		31607F3819627002009B87DA /* LegacySessionStateCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacySessionStateCoding.h; sourceTree = "<group>"; };
 		317FE7C11C487A6600A0CA89 /* APIExperimentalFeature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIExperimentalFeature.cpp; sourceTree = "<group>"; };
 		317FE7C21C487A6600A0CA89 /* APIExperimentalFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIExperimentalFeature.h; sourceTree = "<group>"; };
@@ -6276,6 +6280,8 @@
 		BC0C376610F807660076D7CB /* C */ = {
 			isa = PBXGroup;
 			children = (
+				314888FE1D91B11D00377042 /* WKTextChecker.cpp */,
+				314888FF1D91B11D00377042 /* WKTextChecker.h */,
 				5123CF18133D25E60056F800 /* cg */,
 				6EE849C41368D9040038D481 /* mac */,
 				BCB63477116BF10600603215 /* WebKit2_C.h */,
@@ -7565,6 +7571,7 @@
 				1AEFD2F711D1807B008219D3 /* ArgumentCoders.h in Headers */,
 				1AAF0C4A12B16334008E49E2 /* ArgumentCodersCF.h in Headers */,
 				E179FD9C134D38060015B883 /* ArgumentCodersMac.h in Headers */,
+				31D755C11D91B81500843BD1 /* WKTextChecker.h in Headers */,
 				CE1A0BD21A48E6C60054EF74 /* AssertionServicesSPI.h in Headers */,
 				C59C4A5918B81174007BDCB6 /* AssistedNodeInformation.h in Headers */,
 				515E7728183DD6F60007203F /* AsyncRequest.h in Headers */,
@@ -9338,6 +9345,7 @@
 				1ZZ417EF12C00D87002BE67B /* TextCheckerCompletion.cpp in Sources */,
 				2DA944AD1884E9BA00ED86DB /* TextCheckerIOS.mm in Sources */,
 				1AA417EF12C00D87002BE67B /* TextCheckerMac.mm in Sources */,
+				31D755C21D91B81B00843BD1 /* WKTextChecker.cpp in Sources */,
 				1AAF263814687C39004A1E8A /* TiledCoreAnimationDrawingArea.mm in Sources */,
 				1AF05D8614688348008B1E81 /* TiledCoreAnimationDrawingAreaProxy.mm in Sources */,
 				1AFE436518B6C081009C7A48 /* UIDelegate.mm in Sources */,

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp (206260 => 206261)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -155,11 +155,6 @@
     toImpl(bundleRef)->setJavaScriptCanAccessClipboard(toImpl(pageGroupRef), enabled);
 }
 
-void WKBundleSetAutomaticLinkDetectionEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
-{
-    toImpl(bundleRef)->setAutomaticLinkDetectionEnabled(toImpl(pageGroupRef), enabled);
-}
-
 void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled)
 {
     toImpl(bundleRef)->setPrivateBrowsingEnabled(toImpl(pageGroupRef), enabled);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h (206260 => 206261)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h	2016-09-22 17:39:51 UTC (rev 206261)
@@ -49,7 +49,6 @@
 WK_EXPORT void WKBundleSetFrameFlatteningEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetPluginsEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetJavaScriptCanAccessClipboard(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
-WK_EXPORT void WKBundleSetAutomaticLinkDetectionEnabled(WKBundleRef bundleRef, WKBundlePageGroupRef pageGroupRef, bool enabled);
 WK_EXPORT void WKBundleSetPrivateBrowsingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetUseDashboardCompatibilityMode(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);
 WK_EXPORT void WKBundleSetPopupBlockingEnabled(WKBundleRef bundle, WKBundlePageGroupRef pageGroup, bool enabled);

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (206260 => 206261)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -31,7 +31,6 @@
 #include "InjectedBundleScriptWorld.h"
 #include "NotificationPermissionRequestManager.h"
 #include "SessionTracker.h"
-#include "TextChecker.h"
 #include "UserData.h"
 #include "WKAPICast.h"
 #include "WKBundleAPICast.h"
@@ -304,16 +303,6 @@
         (*iter)->settings().setJavaScriptCanAccessClipboard(enabled);
 }
 
-void InjectedBundle::setAutomaticLinkDetectionEnabled(WebPageGroupProxy* pageGroup, bool enabled)
-{
-#if USE(APPKIT)
-    if (enabled == TextChecker::state().isAutomaticLinkDetectionEnabled)
-        return;
-    TextChecker::setAutomaticLinkDetectionEnabled(enabled);
-    WebProcess::singleton().setTextCheckerState(TextChecker::state());
-#endif
-}
-
 void InjectedBundle::setPrivateBrowsingEnabled(WebPageGroupProxy* pageGroup, bool enabled)
 {
     if (enabled) {

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h (206260 => 206261)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h	2016-09-22 17:39:51 UTC (rev 206261)
@@ -106,7 +106,6 @@
     void setFrameFlatteningEnabled(WebPageGroupProxy*, bool);
     void setPluginsEnabled(WebPageGroupProxy*, bool);
     void setJavaScriptCanAccessClipboard(WebPageGroupProxy*, bool);
-    void setAutomaticLinkDetectionEnabled(WebPageGroupProxy*, bool enabled);
     void setPrivateBrowsingEnabled(WebPageGroupProxy*, bool);
     void setUseDashboardCompatibilityMode(WebPageGroupProxy*, bool);
     void setPopupBlockingEnabled(WebPageGroupProxy*, bool);

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm (206260 => 206261)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm	2016-09-22 17:39:51 UTC (rev 206261)
@@ -124,8 +124,7 @@
 
 void WebEditorClient::toggleSmartInsertDelete()
 {
-    // This is handled in the UI process.
-    ASSERT_NOT_REACHED();
+    m_page->send(Messages::WebPageProxy::toggleSmartInsertDelete());
 }
 
 bool WebEditorClient::isAutomaticQuoteSubstitutionEnabled()
@@ -138,8 +137,7 @@
 
 void WebEditorClient::toggleAutomaticQuoteSubstitution()
 {
-    // This is handled in the UI process.
-    ASSERT_NOT_REACHED();
+    m_page->send(Messages::WebPageProxy::toggleAutomaticQuoteSubstitution());
 }
 
 bool WebEditorClient::isAutomaticLinkDetectionEnabled()
@@ -149,8 +147,7 @@
 
 void WebEditorClient::toggleAutomaticLinkDetection()
 {
-    // This is handled in the UI process.
-    ASSERT_NOT_REACHED();
+    m_page->send(Messages::WebPageProxy::toggleAutomaticLinkDetection());
 }
 
 bool WebEditorClient::isAutomaticDashSubstitutionEnabled()
@@ -163,8 +160,7 @@
 
 void WebEditorClient::toggleAutomaticDashSubstitution()
 {
-    // This is handled in the UI process.
-    ASSERT_NOT_REACHED();
+    m_page->send(Messages::WebPageProxy::toggleAutomaticDashSubstitution());
 }
 
 bool WebEditorClient::isAutomaticTextReplacementEnabled()
@@ -177,8 +173,7 @@
 
 void WebEditorClient::toggleAutomaticTextReplacement()
 {
-    // This is handled in the UI process.
-    ASSERT_NOT_REACHED();
+    m_page->send(Messages::WebPageProxy::toggleAutomaticTextReplacement());
 }
 
 bool WebEditorClient::isAutomaticSpellingCorrectionEnabled()

Modified: trunk/Tools/ChangeLog (206260 => 206261)


--- trunk/Tools/ChangeLog	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Tools/ChangeLog	2016-09-22 17:39:51 UTC (rev 206261)
@@ -1,3 +1,21 @@
+2016-09-22  Jonathan Bedard  <jbed...@apple.com>
+
+        Automatic Text Replacement Testing in WebKit2
+        https://bugs.webkit.org/show_bug.cgi?id=161919
+
+        Reviewed by Ryosuke Niwa.
+
+        Implemented test hooks for text replacement for WebKit2.
+        Note that spell checking has not been implemented, so most tests which use text replacement still fail.
+
+        * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: Removed setAutomaticLinkDetectionEnabled from TestRunner, moved to Internals.
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: Ditto.
+        (WTR::InjectedBundle::beginTesting): Ditto.
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp: Ditto.
+        * WebKitTestRunner/InjectedBundle/TestRunner.h: Ditto.
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::runTest): Place TextChecker into testing mode.
+
 2016-09-21  Dan Bernstein  <m...@apple.com>
 
         [macOS] Upon layout, _webView:renderingProgressDidChange: fires before the intrinsic content size is updated

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl (206260 => 206261)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl	2016-09-22 17:39:51 UTC (rev 206261)
@@ -62,7 +62,6 @@
     void setAllowFileAccessFromFileURLs(boolean value);
     void setPluginsEnabled(boolean value);
     void setJavaScriptCanAccessClipboard(boolean value);
-    void setAutomaticLinkDetectionEnabled(boolean value);
     void setPrivateBrowsingEnabled(boolean value);
     void setUseDashboardCompatibilityMode(boolean value);
     void setPopupBlockingEnabled(boolean value);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp (206260 => 206261)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -294,7 +294,6 @@
 
     WKBundleSetAllowUniversalAccessFromFileURLs(m_bundle, m_pageGroup, true);
     WKBundleSetJavaScriptCanAccessClipboard(m_bundle, m_pageGroup, true);
-    WKBundleSetAutomaticLinkDetectionEnabled(m_bundle, m_pageGroup, false);
     WKBundleSetPrivateBrowsingEnabled(m_bundle, m_pageGroup, false);
     WKBundleSetUseDashboardCompatibilityMode(m_bundle, m_pageGroup, false);
     WKBundleSetAuthorAndUserStylesEnabled(m_bundle, m_pageGroup, true);

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (206260 => 206261)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -411,12 +411,6 @@
     WKBundleSetJavaScriptCanAccessClipboard(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
 }
 
-void TestRunner::setAutomaticLinkDetectionEnabled(bool enabled)
-{
-    auto& injectedBundle = InjectedBundle::singleton();
-    WKBundleSetAutomaticLinkDetectionEnabled(injectedBundle.bundle(), injectedBundle.pageGroup(), enabled);
-}
-
 void TestRunner::setPrivateBrowsingEnabled(bool enabled)
 {
     auto& injectedBundle = InjectedBundle::singleton();

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (206260 => 206261)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h	2016-09-22 17:39:51 UTC (rev 206261)
@@ -109,7 +109,6 @@
     void setAllowFileAccessFromFileURLs(bool);
     void setPluginsEnabled(bool);
     void setJavaScriptCanAccessClipboard(bool);
-    void setAutomaticLinkDetectionEnabled(bool);
     void setPrivateBrowsingEnabled(bool);
     void setUseDashboardCompatibilityMode(bool);
     void setPopupBlockingEnabled(bool);

Modified: trunk/Tools/WebKitTestRunner/TestController.cpp (206260 => 206261)


--- trunk/Tools/WebKitTestRunner/TestController.cpp	2016-09-22 16:20:59 UTC (rev 206260)
+++ trunk/Tools/WebKitTestRunner/TestController.cpp	2016-09-22 17:39:51 UTC (rev 206261)
@@ -57,6 +57,7 @@
 #include <WebKit/WKProtectionSpace.h>
 #include <WebKit/WKRetainPtr.h>
 #include <WebKit/WKSecurityOriginRef.h>
+#include <WebKit/WKTextChecker.h>
 #include <WebKit/WKUserMediaPermissionCheck.h>
 #include <algorithm>
 #include <cstdio>
@@ -80,10 +81,6 @@
 #include <WebKit/WKPagePrivateMac.h>
 #endif
 
-#if !PLATFORM(COCOA)
-#include <WebKit/WKTextChecker.h>
-#endif
-
 namespace WTR {
 
 const unsigned TestController::viewWidth = 800;
@@ -1083,6 +1080,7 @@
 
 bool TestController::runTest(const char* inputLine)
 {
+    WKTextCheckerSetTestingMode(true);
     TestCommand command = parseInputLine(std::string(inputLine));
 
     m_state = RunningTest;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to