Add smartInsertDeleteEnabled setting to WebCore::Page

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: http://svn.webkit.org/repository/webkit/trunk@144221 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent da70c6e9
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
......@@ -4,7 +4,7 @@
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setSmartInsertDeleteEnabled(false);
internals.settings.setSmartInsertDeleteEnabled(false);
}
function editingTest() {
......
......@@ -3,7 +3,7 @@
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setSmartInsertDeleteEnabled(false);
internals.settings.setSmartInsertDeleteEnabled(false);
testRunner.setSelectTrailingWhitespaceEnabled(true);
}
......
......@@ -3,7 +3,7 @@
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setSmartInsertDeleteEnabled(false);
internals.settings.setSmartInsertDeleteEnabled(false);
testRunner.setSelectTrailingWhitespaceEnabled(true);
}
</script>
......
......@@ -3,7 +3,7 @@
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setSmartInsertDeleteEnabled(false);
internals.settings.setSmartInsertDeleteEnabled(false);
testRunner.setSelectTrailingWhitespaceEnabled(true);
testRunner.waitUntilDone();
}
......
......@@ -3,7 +3,7 @@
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setSmartInsertDeleteEnabled(false);
internals.settings.setSmartInsertDeleteEnabled(false);
testRunner.setSelectTrailingWhitespaceEnabled(true);
}
......
......@@ -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
......
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
......@@ -194,3 +194,5 @@ touchDragDropEnabled initial=false
unifiedTextCheckerEnabled initial=defaultUnifiedTextCheckerEnabled
logsPageMessagesToSystemConsoleEnabled initial=false
smartInsertDeleteEnabled initial=true
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
......@@ -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))
......
......@@ -88,7 +88,6 @@ struct WebPageCreationParameters {
bool mayStartMediaWhenInWindow;
#if PLATFORM(MAC)
bool isSmartInsertDeleteEnabled;
LayerHostingMode layerHostingMode;
ColorSpaceData colorSpace;
#endif
......
......@@ -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) \
......
......@@ -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();
}
......@@ -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
......
......@@ -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
......
......@@ -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()
......
......@@ -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
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment