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.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@206261 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebKit2/ChangeLog b/Source/WebKit2/ChangeLog
index 8f9a7fc..46ba654 100644
--- a/Source/WebKit2/ChangeLog
+++ b/Source/WebKit2/ChangeLog
@@ -1,3 +1,52 @@
+2016-09-22 Jonathan Bedard <jbedard@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 <cgarcia@igalia.com>
[GTK] Rename DataObjectGtk as SelectionData
diff --git a/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp b/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp
index 3279dd7..ef2f6b7 100644
--- a/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp
+++ b/Source/WebKit2/UIProcess/API/C/WKTextChecker.cpp
@@ -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
diff --git a/Source/WebKit2/UIProcess/API/C/WKTextChecker.h b/Source/WebKit2/UIProcess/API/C/WKTextChecker.h
index a324694..e605988 100644
--- a/Source/WebKit2/UIProcess/API/C/WKTextChecker.h
+++ b/Source/WebKit2/UIProcess/API/C/WKTextChecker.h
@@ -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
diff --git a/Source/WebKit2/UIProcess/TextChecker.h b/Source/WebKit2/UIProcess/TextChecker.h
index a64fd291..41378c2 100644
--- a/Source/WebKit2/UIProcess/TextChecker.h
+++ b/Source/WebKit2/UIProcess/TextChecker.h
@@ -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);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.cpp b/Source/WebKit2/UIProcess/WebPageProxy.cpp
index 4ed8a48..5e574ba 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit2/UIProcess/WebPageProxy.cpp
@@ -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)
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.h b/Source/WebKit2/UIProcess/WebPageProxy.h
index 57ed18d..d67c585 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.h
+++ b/Source/WebKit2/UIProcess/WebPageProxy.h
@@ -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);
diff --git a/Source/WebKit2/UIProcess/WebPageProxy.messages.in b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
index 13052bd..faff2e7 100644
--- a/Source/WebKit2/UIProcess/WebPageProxy.messages.in
+++ b/Source/WebKit2/UIProcess/WebPageProxy.messages.in
@@ -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)
diff --git a/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp b/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp
index 3403e6c..a7aa619 100644
--- a/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp
+++ b/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp
@@ -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()
{
diff --git a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
index 4098607..c6dcf13 100644
--- a/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
+++ b/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
@@ -63,6 +63,18 @@
{
return checkerState();
}
+
+static bool testingModeEnabled = false;
+
+void TextChecker::setTestingMode(bool enabled)
+{
+ testingModeEnabled = enabled;
+}
+
+bool TextChecker::isTestingMode()
+{
+ return testingModeEnabled;
+}
#if ENABLE(SPELLCHECK)
static void updateStateForAllProcessPools()
diff --git a/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm b/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm
index 879a781..d7871b2 100644
--- a/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm
+++ b/Source/WebKit2/UIProcess/ios/TextCheckerIOS.mm
@@ -84,6 +84,19 @@
{
notImplemented();
}
+
+static bool testingModeEnabled = false;
+
+void TextChecker::setTestingMode(bool enabled)
+{
+ testingModeEnabled = enabled;
+}
+
+bool TextChecker::isTestingMode()
+{
+ return testingModeEnabled;
+}
+
static bool smartInsertDeleteEnabled;
diff --git a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
index 0cddb40..f4dd017 100644
--- a/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
+++ b/Source/WebKit2/UIProcess/mac/TextCheckerMac.mm
@@ -115,6 +115,28 @@
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()
{
@@ -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()
diff --git a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
index 80418b5..dd084a6 100644
--- a/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
+++ b/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
@@ -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 */,
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
index 097383c..9ec773f 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp
@@ -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);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
index a25a60c..cc127c7 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/API/c/WKBundlePrivate.h
@@ -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);
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
index 3d62636..d03c59f 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp
@@ -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) {
diff --git a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
index 8c04982..7fdf5c6 100644
--- a/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
+++ b/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.h
@@ -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);
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
index 2c6aad8..e794764 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebEditorClientMac.mm
@@ -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()