[WK2] Add support for selectTrailingWhitespaceEnabled setting
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2013 19:50:45 +0000 (19:50 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 May 2013 19:50:45 +0000 (19:50 +0000)
https://bugs.webkit.org/show_bug.cgi?id=112426

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

* Shared/WebPreferencesStore.h:
(WebKit): Add macro for selectTrailingWhitespaceEnabled.
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetSelectTrailingWhitespaceEnabled):
(WKPreferencesGetSelectTrailingWhitespaceEnabled): Implement methods
using the new setting.
* UIProcess/API/C/WKPreferencesPrivate.h: Add new methods headers.
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::isSelectTrailingWhitespaceEnabled): Implement
method delegating in WebPage.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updatePreferences): Set
selectTrailingWhitespaceEnabled setting.
(WebKit::WebPage::setSmartInsertDeleteEnabled): Set
selectTrailingWhitespaceEnabled as they are mutually exclusive.
(WebKit):
(WebKit::WebPage::isSelectTrailingWhitespaceEnabled): Implement method
using settings.
(WebKit::WebPage::setSelectTrailingWhitespaceEnabled): Implement method
using settings and set smartInsertDeleteEnabled as they are mutually
exclusive.
* WebProcess/WebPage/WebPage.h:
(WebPage): Add new methods headers.

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

Source/WebKit2/ChangeLog
Source/WebKit2/Shared/WebPreferencesStore.h
Source/WebKit2/UIProcess/API/C/WKPreferences.cpp
Source/WebKit2/UIProcess/API/C/WKPreferencesPrivate.h
Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h

index 058419b..c930af4 100644 (file)
@@ -1,3 +1,34 @@
+2013-05-17  Manuel Rego Casasnovas  <rego@igalia.com>
+
+        [WK2] Add support for selectTrailingWhitespaceEnabled setting
+        https://bugs.webkit.org/show_bug.cgi?id=112426
+
+        Reviewed by Ryosuke Niwa.
+
+        * Shared/WebPreferencesStore.h:
+        (WebKit): Add macro for selectTrailingWhitespaceEnabled.
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetSelectTrailingWhitespaceEnabled):
+        (WKPreferencesGetSelectTrailingWhitespaceEnabled): Implement methods
+        using the new setting.
+        * UIProcess/API/C/WKPreferencesPrivate.h: Add new methods headers.
+        * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+        (WebKit::WebEditorClient::isSelectTrailingWhitespaceEnabled): Implement
+        method delegating in WebPage.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::updatePreferences): Set
+        selectTrailingWhitespaceEnabled setting.
+        (WebKit::WebPage::setSmartInsertDeleteEnabled): Set
+        selectTrailingWhitespaceEnabled as they are mutually exclusive.
+        (WebKit):
+        (WebKit::WebPage::isSelectTrailingWhitespaceEnabled): Implement method
+        using settings.
+        (WebKit::WebPage::setSelectTrailingWhitespaceEnabled): Implement method
+        using settings and set smartInsertDeleteEnabled as they are mutually
+        exclusive.
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage): Add new methods headers.
+
 2013-05-17  Brady Eidson  <beidson@apple.com>
 
         Fix crash introduced by http://trac.webkit.org/changeset/150282
index 3f2d751..33d783e 100644 (file)
@@ -155,6 +155,7 @@ namespace WebKit {
     macro(LogsPageMessagesToSystemConsoleEnabled, logsPageMessagesToSystemConsoleEnabled, Bool, bool, false) \
     macro(PageVisibilityBasedProcessSuppressionEnabled, pageVisibilityBasedProcessSuppressionEnabled, Bool, bool, false) \
     macro(SmartInsertDeleteEnabled, smartInsertDeleteEnabled, Bool, bool, true) \
+    macro(SelectTrailingWhitespaceEnabled, selectTrailingWhitespaceEnabled, Bool, bool, false) \
     macro(ShowsURLsInToolTipsEnabled, showsURLsInToolTipsEnabled, Bool, bool, false) \
     macro(AcceleratedCompositingForOverflowScrollEnabled, acceleratedCompositingForOverflowScrollEnabled, Bool, bool, false) \
     macro(HiddenPageDOMTimerThrottlingEnabled, hiddenPageDOMTimerThrottlingEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED) \
index 23f9e87..3da937d 100644 (file)
@@ -1104,6 +1104,16 @@ bool WKPreferencesGetSmartInsertDeleteEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->smartInsertDeleteEnabled();
 }
 
+void WKPreferencesSetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferencesRef, bool enabled)
+{
+    toImpl(preferencesRef)->setSelectTrailingWhitespaceEnabled(enabled);
+}
+
+bool WKPreferencesGetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->selectTrailingWhitespaceEnabled();
+}
+
 void WKPreferencesSetShowsURLsInToolTipsEnabled(WKPreferencesRef preferencesRef, bool enabled)
 {
     toImpl(preferencesRef)->setShowsURLsInToolTipsEnabled(enabled);
index 5ea6d34..2b5c712 100644 (file)
@@ -256,6 +256,10 @@ WK_EXPORT void WKPreferencesSetSmartInsertDeleteEnabled(WKPreferencesRef prefere
 WK_EXPORT bool WKPreferencesGetSmartInsertDeleteEnabled(WKPreferencesRef preferences);
 
 // Defaults to false
+WK_EXPORT void WKPreferencesSetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferences, bool enabled);
+WK_EXPORT bool WKPreferencesGetSelectTrailingWhitespaceEnabled(WKPreferencesRef preferences);
+
+// Defaults to false
 WK_EXPORT void WKPreferencesSetShowsURLsInToolTipsEnabled(WKPreferencesRef preferences, bool enabled);
 WK_EXPORT bool WKPreferencesGetShowsURLsInToolTipsEnabled(WKPreferencesRef preferences);
 
index 6d5ddab..d83e456 100644 (file)
@@ -95,8 +95,7 @@ bool WebEditorClient::smartInsertDeleteEnabled()
  
 bool WebEditorClient::isSelectTrailingWhitespaceEnabled()
 {
-    notImplemented();
-    return false;
+    return m_page->isSelectTrailingWhitespaceEnabled();
 }
 
 bool WebEditorClient::isContinuousSpellCheckingEnabled()
index 8b48627..d19146d 100644 (file)
@@ -2536,6 +2536,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     settings->setAsynchronousSpellCheckingEnabled(store.getBoolValueForKey(WebPreferencesKey::asynchronousSpellCheckingEnabledKey()));
 
     settings->setSmartInsertDeleteEnabled(store.getBoolValueForKey(WebPreferencesKey::smartInsertDeleteEnabledKey()));
+    settings->setSelectTrailingWhitespaceEnabled(store.getBoolValueForKey(WebPreferencesKey::selectTrailingWhitespaceEnabledKey()));
     settings->setShowsURLsInToolTips(store.getBoolValueForKey(WebPreferencesKey::showsURLsInToolTipsEnabledKey()));
 
 #if ENABLE(HIDDEN_PAGE_DOM_TIMER_THROTTLING)
@@ -3954,7 +3955,23 @@ bool WebPage::isSmartInsertDeleteEnabled()
 
 void WebPage::setSmartInsertDeleteEnabled(bool enabled)
 {
-    m_page->settings()->setSmartInsertDeleteEnabled(enabled);
+    if (m_page->settings()->smartInsertDeleteEnabled() != enabled) {
+        m_page->settings()->setSmartInsertDeleteEnabled(enabled);
+        setSelectTrailingWhitespaceEnabled(!enabled);
+    }
+}
+
+bool WebPage::isSelectTrailingWhitespaceEnabled()
+{
+    return m_page->settings()->selectTrailingWhitespaceEnabled();
+}
+
+void WebPage::setSelectTrailingWhitespaceEnabled(bool enabled)
+{
+    if (m_page->settings()->selectTrailingWhitespaceEnabled() != enabled) {
+        m_page->settings()->setSelectTrailingWhitespaceEnabled(enabled);
+        setSmartInsertDeleteEnabled(!enabled);
+    }
 }
 
 bool WebPage::canShowMIMEType(const String& MIMEType) const
index bfca379..8545685 100644 (file)
@@ -520,6 +520,9 @@ public:
     bool isSmartInsertDeleteEnabled();
     void setSmartInsertDeleteEnabled(bool);
 
+    bool isSelectTrailingWhitespaceEnabled();
+    void setSelectTrailingWhitespaceEnabled(bool);
+
     void replaceSelectionWithText(WebCore::Frame*, const String&);
     void clearSelection();