Add smartInsertDeleteEnabled setting to WebCore::Page
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 20:20:37 +0000 (20:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 27 Feb 2013 20:20:37 +0000 (20:20 +0000)
https://bugs.webkit.org/show_bug.cgi?id=107840

Patch by Manuel Rego Casasnovas <rego@igalia.com> on 2013-02-27
Reviewed by Ryosuke Niwa.

Source/WebCore:

Covered by editing/deleting/smart-editing-disabled.html.

* page/Settings.in: Add new setting with true as initial value.

Source/WebKit2:

* Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode):
(WebKit::WebPageCreationParameters::decode): Remove code related to
isSmartInsertDeleteEnabled.
* Shared/WebPageCreationParameters.h:
(WebPageCreationParameters): Remove isSmartInsertDeleteEnabled.
* Shared/WebPreferencesStore.h:
(WebKit): Add macro for smartInsertDeleteEnabled setting.
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetSmartInsertDeleteEnabled):
(WKPreferencesGetSmartInsertDeleteEnabled): Implement methods using the
new setting.
* UIProcess/API/C/WKPreferencesPrivate.h: Add new methods headers.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::initializeWebPage): Set smartInsertDeleteEnabled
setting using m_isSmartInsertDeleteEnabled to keep initial value on Mac.
(WebKit::WebPageProxy::creationParameters): Remove usage of
parameters.isSmartInsertDeleteEnabled.
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::smartInsertDeleteEnabled): Enable method for
all platforms.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage): Remove m_isSmartInsertDeleteEnabled
initialization.
(WebKit::WebPage::updatePreferences): Set smartInsertDeleteEnabled
setting.
(WebKit::WebPage::isSmartInsertDeleteEnabled): Implement method using
settings.
(WebKit):
(WebKit::WebPage::setSmartInsertDeleteEnabled): Implement method using
settings.
* WebProcess/WebPage/WebPage.h:
(WebPage): Enable methods dealing with smartInsertDeleteEnabled for all
platforms and remove m_isSmartInsertDeleteEnabled as it will be a
setting.

LayoutTests:

Replace testRunner.setSmartInsertDeleteEnabled by
internals.settings.setSmartInsertDeleteEnabled in tests.

* editing/deleting/smart-editing-disabled.html:
* editing/selection/doubleclick-beside-cr-span.html:
* editing/selection/doubleclick-whitespace-crash.html:
* editing/selection/doubleclick-whitespace-img-crash.html:
* editing/selection/doubleclick-whitespace.html:
* platform/wk2/TestExpectations: Unflag
editing/deleting/smart-editing-disabled.html as it passes now.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@144221 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
LayoutTests/ChangeLog
LayoutTests/editing/deleting/smart-editing-disabled.html
LayoutTests/editing/selection/doubleclick-beside-cr-span.html
LayoutTests/editing/selection/doubleclick-whitespace-crash.html
LayoutTests/editing/selection/doubleclick-whitespace-img-crash.html
LayoutTests/editing/selection/doubleclick-whitespace.html
LayoutTests/platform/wk2/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/page/Settings.in
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPageCreationParameters.cpp
Source/WebKit2/Shared/WebPageCreationParameters.h
Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h

index b0acbee..e722e24 100644 (file)
@@ -1,3 +1,21 @@
+2013-02-27  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        Add smartInsertDeleteEnabled setting to WebCore::Page
+        https://bugs.webkit.org/show_bug.cgi?id=107840
+
+        Reviewed by Ryosuke Niwa.
+
+        Replace testRunner.setSmartInsertDeleteEnabled by
+        internals.settings.setSmartInsertDeleteEnabled in tests.
+
+        * editing/deleting/smart-editing-disabled.html:
+        * editing/selection/doubleclick-beside-cr-span.html:
+        * editing/selection/doubleclick-whitespace-crash.html:
+        * editing/selection/doubleclick-whitespace-img-crash.html:
+        * editing/selection/doubleclick-whitespace.html:
+        * platform/wk2/TestExpectations: Unflag
+        editing/deleting/smart-editing-disabled.html as it passes now.
+
 2013-02-27  Chris Fleizach  <cfleizach@apple.com>
 
         WebSpeech: Support pause/resume ability
index ddeb81b..7eb30d2 100644 (file)
@@ -4,7 +4,7 @@
 
 if (window.testRunner) {
     testRunner.dumpAsText();
-    testRunner.setSmartInsertDeleteEnabled(false);
+    internals.settings.setSmartInsertDeleteEnabled(false);
 }
 
 function editingTest() {
index a6e1085..8b98ba7 100644 (file)
@@ -3,7 +3,7 @@
 <script>
 if (window.testRunner) {
      testRunner.dumpAsText();
-     testRunner.setSmartInsertDeleteEnabled(false);
+     internals.settings.setSmartInsertDeleteEnabled(false);
      testRunner.setSelectTrailingWhitespaceEnabled(true);
 }
 
index 8d56489..40e2413 100644 (file)
@@ -3,7 +3,7 @@
 <script>
 if (window.testRunner) {
      testRunner.dumpAsText();
-     testRunner.setSmartInsertDeleteEnabled(false);
+     internals.settings.setSmartInsertDeleteEnabled(false);
      testRunner.setSelectTrailingWhitespaceEnabled(true);
 }
 </script>
index 8074f07..f280a26 100644 (file)
@@ -3,7 +3,7 @@
 <script>
 if (window.testRunner) {
      testRunner.dumpAsText();
-     testRunner.setSmartInsertDeleteEnabled(false);
+     internals.settings.setSmartInsertDeleteEnabled(false);
      testRunner.setSelectTrailingWhitespaceEnabled(true);
      testRunner.waitUntilDone();
 }
index 1aa361f..8530fbc 100644 (file)
@@ -3,7 +3,7 @@
 <script>
 if (window.testRunner) {
      testRunner.dumpAsText();
-     testRunner.setSmartInsertDeleteEnabled(false);
+     internals.settings.setSmartInsertDeleteEnabled(false);
      testRunner.setSelectTrailingWhitespaceEnabled(true);
 }
 
index 309788a..5b98691 100644 (file)
@@ -367,9 +367,6 @@ http/tests/misc/link-rel-icon-beforeload.html
 # WebKitTestRunner should dump text/plain content as text
 http/tests/incremental/slow-utf8-text.pl
 
-# WebKitTestRunner needs layoutTestController.setSmartInsertDeleteEnabled
-editing/deleting/smart-editing-disabled.html
-
 # WebKitTestRunner needs plainText.plainText
 editing/text-iterator/basic-iteration.html
 
index 764a81b..2e5ecdc 100644 (file)
@@ -1,3 +1,14 @@
+2013-02-27  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        Add smartInsertDeleteEnabled setting to WebCore::Page
+        https://bugs.webkit.org/show_bug.cgi?id=107840
+
+        Reviewed by Ryosuke Niwa.
+
+        Covered by editing/deleting/smart-editing-disabled.html.
+
+        * page/Settings.in: Add new setting with true as initial value.
+
 2013-02-27  Chris Fleizach  <cfleizach@apple.com>
 
         WebSpeech: Support pause/resume ability
index b96bbd5..e7991ea 100644 (file)
@@ -194,3 +194,5 @@ touchDragDropEnabled initial=false
 unifiedTextCheckerEnabled initial=defaultUnifiedTextCheckerEnabled
 
 logsPageMessagesToSystemConsoleEnabled initial=false
+
+smartInsertDeleteEnabled initial=true
index db690ab..a014d3f 100644 (file)
@@ -1,3 +1,47 @@
+2013-02-27  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        Add smartInsertDeleteEnabled setting to WebCore::Page
+        https://bugs.webkit.org/show_bug.cgi?id=107840
+
+        Reviewed by Ryosuke Niwa.
+
+        * Shared/WebPageCreationParameters.cpp:
+        (WebKit::WebPageCreationParameters::encode):
+        (WebKit::WebPageCreationParameters::decode): Remove code related to
+        isSmartInsertDeleteEnabled.
+        * Shared/WebPageCreationParameters.h:
+        (WebPageCreationParameters): Remove isSmartInsertDeleteEnabled.
+        * Shared/WebPreferencesStore.h:
+        (WebKit): Add macro for smartInsertDeleteEnabled setting.
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetSmartInsertDeleteEnabled):
+        (WKPreferencesGetSmartInsertDeleteEnabled): Implement methods using the
+        new setting.
+        * UIProcess/API/C/WKPreferencesPrivate.h: Add new methods headers.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::initializeWebPage): Set smartInsertDeleteEnabled
+        setting using m_isSmartInsertDeleteEnabled to keep initial value on Mac.
+        (WebKit::WebPageProxy::creationParameters): Remove usage of
+        parameters.isSmartInsertDeleteEnabled.
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::smartInsertDeleteEnabled): Enable method for
+        all platforms.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage): Remove m_isSmartInsertDeleteEnabled
+        initialization.
+        (WebKit::WebPage::updatePreferences): Set smartInsertDeleteEnabled
+        setting.
+        (WebKit::WebPage::isSmartInsertDeleteEnabled): Implement method using
+        settings.
+        (WebKit):
+        (WebKit::WebPage::setSmartInsertDeleteEnabled): Implement method using
+        settings.
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage): Enable methods dealing with smartInsertDeleteEnabled for all
+        platforms and remove m_isSmartInsertDeleteEnabled as it will be a
+        setting.
+
+
 2013-02-27  Anders Carlsson  <andersca@apple.com>
 
         More storage scaffolding
index a6f2d01..ef2adff 100644 (file)
@@ -60,7 +60,6 @@ void WebPageCreationParameters::encode(CoreIPC::ArgumentEncoder& encoder) const
     encoder << mayStartMediaWhenInWindow;
 
 #if PLATFORM(MAC)
-    encoder << isSmartInsertDeleteEnabled;
     encoder.encodeEnum(layerHostingMode);
     encoder << colorSpace;
 #endif
@@ -120,8 +119,6 @@ bool WebPageCreationParameters::decode(CoreIPC::ArgumentDecoder& decoder, WebPag
         return false;
 
 #if PLATFORM(MAC)
-    if (!decoder.decode(parameters.isSmartInsertDeleteEnabled))
-        return false;
     if (!decoder.decodeEnum(parameters.layerHostingMode))
         return false;
     if (!decoder.decode(parameters.colorSpace))
index 906aebe..b7859bf 100644 (file)
@@ -88,7 +88,6 @@ struct WebPageCreationParameters {
     bool mayStartMediaWhenInWindow;
 
 #if PLATFORM(MAC)
-    bool isSmartInsertDeleteEnabled;
     LayerHostingMode layerHostingMode;
     ColorSpaceData colorSpace;
 #endif
index 8f4e56a..7cea90e 100644 (file)
@@ -140,6 +140,7 @@ namespace WebKit {
     macro(QTKitEnabled, isQTKitEnabled, Bool, bool, true) \
     macro(LogsPageMessagesToSystemConsoleEnabled, logsPageMessagesToSystemConsoleEnabled, Bool, bool, false) \
     macro(PageVisibilityBasedProcessSuppressionEnabled, pageVisibilityBasedProcessSuppressionEnabled, Bool, bool, false) \
+    macro(SmartInsertDeleteEnabled, smartInsertDeleteEnabled, Bool, bool, true) \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
index 6c1b68a..4bdc3df 100644 (file)
@@ -1033,3 +1033,13 @@ bool WKPreferencesGetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesR
 {
     return toImpl(preferencesRef)->pageVisibilityBasedProcessSuppressionEnabled();
 }
+
+void WKPreferencesSetSmartInsertDeleteEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setSmartInsertDeleteEnabled(enabled);
+}
+
+bool WKPreferencesGetSmartInsertDeleteEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->smartInsertDeleteEnabled();
+}
index fc448f8..11661d9 100644 (file)
@@ -249,6 +249,10 @@ WK_EXPORT bool WKPreferencesGetPageVisibilityBasedProcessSuppressionEnabled(WKPr
 
 WK_EXPORT void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef);
 
+// Defaults to true
+WK_EXPORT void WKPreferencesSetSmartInsertDeleteEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetSmartInsertDeleteEnabled(WKPreferencesRef preferences);
+
 #ifdef __cplusplus
 }
 #endif
index 0bc927f..b801d55 100644 (file)
@@ -452,6 +452,10 @@ void WebPageProxy::initializeWebPage()
 #elif ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
     m_process->send(Messages::WebPage::SetVisibilityState(m_isVisible ? PageVisibilityStateVisible : PageVisibilityStateHidden, /* isInitialState */ true), m_pageID);
 #endif
+
+#if PLATFORM(MAC)
+    m_process->send(Messages::WebPage::SetSmartInsertDeleteEnabled(m_isSmartInsertDeleteEnabled), m_pageID);
+#endif
 }
 
 void WebPageProxy::close()
@@ -3834,7 +3838,6 @@ WebPageCreationParameters WebPageProxy::creationParameters() const
     parameters.mayStartMediaWhenInWindow = m_mayStartMediaWhenInWindow;
 
 #if PLATFORM(MAC)
-    parameters.isSmartInsertDeleteEnabled = m_isSmartInsertDeleteEnabled;
     parameters.layerHostingMode = m_layerHostingMode;
     parameters.colorSpace = m_pageClient->colorSpace();
 #endif
index e8d78ec..f309aac 100644 (file)
@@ -82,12 +82,7 @@ bool WebEditorClient::shouldShowDeleteInterface(HTMLElement*)
 
 bool WebEditorClient::smartInsertDeleteEnabled()
 {
-    // FIXME: Why isn't this Mac specific like toggleSmartInsertDeleteEnabled?
-#if PLATFORM(MAC)
     return m_page->isSmartInsertDeleteEnabled();
-#else
-    return true;
-#endif
 }
  
 bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
index a5a7194..147768d 100644 (file)
@@ -237,7 +237,6 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
 #if PLATFORM(MAC)
     , m_pdfPluginEnabled(false)
     , m_windowIsVisible(false)
-    , m_isSmartInsertDeleteEnabled(parameters.isSmartInsertDeleteEnabled)
     , m_layerHostingMode(parameters.layerHostingMode)
     , m_keyboardEventBeingInterpreted(0)
 #elif PLATFORM(GTK)
@@ -2391,6 +2390,8 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 
     settings->setLogsPageMessagesToSystemConsoleEnabled(store.getBoolValueForKey(WebPreferencesKey::logsPageMessagesToSystemConsoleEnabledKey()));
 
+    settings->setSmartInsertDeleteEnabled(store.getBoolValueForKey(WebPreferencesKey::smartInsertDeleteEnabledKey()));
+
     platformPreferencesDidChange(store);
 
     if (m_drawingArea)
@@ -3782,4 +3783,14 @@ void WebPage::setMinimumLayoutWidth(double minimumLayoutWidth)
         corePage()->mainFrame()->view()->enableAutoSizeMode(false, IntSize(), IntSize());
 }
 
+bool WebPage::isSmartInsertDeleteEnabled()
+{
+    return m_page->settings()->smartInsertDeleteEnabled();
+}
+
+void WebPage::setSmartInsertDeleteEnabled(bool enabled)
+{
+    m_page->settings()->setSmartInsertDeleteEnabled(enabled);
+}
+
 } // namespace WebKit
index 97f46db..6dc7335 100644 (file)
@@ -480,9 +480,11 @@ public:
     void speak(const String&);
     void stopSpeaking();
 
-    bool isSmartInsertDeleteEnabled() const { return m_isSmartInsertDeleteEnabled; }
 #endif
 
+    bool isSmartInsertDeleteEnabled();
+    void setSmartInsertDeleteEnabled(bool);
+
     void replaceSelectionWithText(WebCore::Frame*, const String&);
     void clearSelection();
 
@@ -768,10 +770,6 @@ private:
     void capitalizeWord();
 #endif
 
-#if PLATFORM(MAC)
-    void setSmartInsertDeleteEnabled(bool isSmartInsertDeleteEnabled) { m_isSmartInsertDeleteEnabled = isSmartInsertDeleteEnabled; }
-#endif
-
 #if ENABLE(CONTEXT_MENUS)
     void didSelectItemFromActiveContextMenu(const WebContextMenuItemData&);
 #endif
@@ -822,9 +820,6 @@ private:
     // Whether the containing window is visible or not.
     bool m_windowIsVisible;
 
-    // Whether smart insert/delete is enabled or not.
-    bool m_isSmartInsertDeleteEnabled;
-
     // The frame of the containing window in screen coordinates.
     WebCore::IntRect m_windowFrameInScreenCoordinates;