From 8942d8d51af4d5267ae5204877ec6c4c504d8bcb Mon Sep 17 00:00:00 2001 From: SangYong Park Date: Fri, 30 Aug 2013 15:40:50 +0900 Subject: [PATCH] Do not notify editor state during executing command [Title] Do not notify editor state during executing command [Issue#] P130828-03335 [Problem] Keypad toggles uppercase and lowercase layout frequently. [Cause] Many intermediate editor state notify during executing command. [Solution] Do not notify editor state during executing command. Change-Id: Idf2c95f9720c3be9bcd50d58873acf6b345eb8ac --- Source/WebCore/editing/EditorCommand.cpp | 9 +++++++++ Source/WebCore/loader/EmptyClients.h | 2 ++ Source/WebCore/page/EditorClient.h | 2 ++ .../WebProcess/WebCoreSupport/WebEditorClient.cpp | 5 +++++ .../WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h | 9 +++++++++ .../WebCoreSupport/efl/WebEditorClientEfl.cpp | 17 +++++++++++++++++ Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp | 8 +++++++- 7 files changed, 51 insertions(+), 1 deletion(-) diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp index a2f147e..92e5e58 100644 --- a/Source/WebCore/editing/EditorCommand.cpp +++ b/Source/WebCore/editing/EditorCommand.cpp @@ -1687,6 +1687,15 @@ bool Editor::Command::execute(const String& parameter, Event* triggeringEvent) c return false; } m_frame->document()->updateLayoutIgnorePendingStylesheets(); +#if ENABLE(TIZEN_ISF_PORT) + EditorClient* client = m_frame->editor()->client(); + if (client) { + client->lockRespondToChangedSelection(); + bool result = m_command->execute(m_frame.get(), triggeringEvent, m_source, parameter); + client->unlockRespondToChangedSelection(); + return result; + } +#endif return m_command->execute(m_frame.get(), triggeringEvent, m_source, parameter); } diff --git a/Source/WebCore/loader/EmptyClients.h b/Source/WebCore/loader/EmptyClients.h index eb85774..77acdcf 100755 --- a/Source/WebCore/loader/EmptyClients.h +++ b/Source/WebCore/loader/EmptyClients.h @@ -551,6 +551,8 @@ public: #if ENABLE(TIZEN_ISF_PORT) virtual void didCancelComposition(Node*) { } + virtual void lockRespondToChangedSelection() { } + virtual void unlockRespondToChangedSelection() { } #endif private: diff --git a/Source/WebCore/page/EditorClient.h b/Source/WebCore/page/EditorClient.h index 43f07fa..ff8b00f 100755 --- a/Source/WebCore/page/EditorClient.h +++ b/Source/WebCore/page/EditorClient.h @@ -163,6 +163,8 @@ public: #if ENABLE(TIZEN_ISF_PORT) virtual void didCancelComposition(Node*) = 0; + virtual void lockRespondToChangedSelection() = 0; + virtual void unlockRespondToChangedSelection() = 0; #endif }; diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp index b191233..86fcda0 100755 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp @@ -185,6 +185,11 @@ void WebEditorClient::respondToChangedContents() void WebEditorClient::respondToChangedSelection(Frame* frame) { +#if ENABLE(TIZEN_ISF_PORT) + if (m_lockCountOfRespondToChangedSelection) + return; +#endif + DEFINE_STATIC_LOCAL(String, WebViewDidChangeSelectionNotification, ("WebViewDidChangeSelectionNotification")); m_page->injectedBundleEditorClient().didChangeSelection(m_page, WebViewDidChangeSelectionNotification.impl()); if (!frame) diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h index 8d3618e..85a3a0c 100755 --- a/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h +++ b/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h @@ -37,6 +37,9 @@ class WebEditorClient : public WebCore::EditorClient, public WebCore::TextChecke public: WebEditorClient(WebPage* page) : m_page(page) +#if ENABLE(TIZEN_ISF_PORT) + , m_lockCountOfRespondToChangedSelection(0) +#endif { } @@ -157,8 +160,14 @@ private: #endif #if ENABLE(TIZEN_ISF_PORT) virtual void didCancelComposition(Node*) OVERRIDE; + virtual void lockRespondToChangedSelection() OVERRIDE; + virtual void unlockRespondToChangedSelection() OVERRIDE; #endif + WebPage* m_page; +#if ENABLE(TIZEN_ISF_PORT) + unsigned m_lockCountOfRespondToChangedSelection; +#endif }; } // namespace WebKit diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp index 6a93236..338ffe5 100755 --- a/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp +++ b/Source/WebKit2/WebProcess/WebCoreSupport/efl/WebEditorClientEfl.cpp @@ -163,6 +163,23 @@ void WebEditorClient::didCancelComposition(Node* valueChangedNode) { m_page->didCancelComposition(valueChangedNode); } + +void WebEditorClient::lockRespondToChangedSelection() +{ + ++m_lockCountOfRespondToChangedSelection; +} + +void WebEditorClient::unlockRespondToChangedSelection() +{ + if (m_lockCountOfRespondToChangedSelection) + --m_lockCountOfRespondToChangedSelection; + + if (!m_lockCountOfRespondToChangedSelection) { + Frame* frame = m_page->corePage()->focusController()->focusedOrMainFrame(); + if (frame) + respondToChangedSelection(frame); + } +} #endif } diff --git a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp index a72f805..4900176 100755 --- a/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp +++ b/Source/WebKit2/WebProcess/WebPage/efl/WebPageEfl.cpp @@ -339,17 +339,23 @@ void WebPage::setComposition(const String& compositionString, const VectoreditorClient()->lockRespondToChangedSelection(); targetFrame->editor()->setComposition(newCompositionString, newUnderlines, cursorPosition, 0); + m_page->editorClient()->unlockRespondToChangedSelection(); + return; } } } + + m_page->editorClient()->lockRespondToChangedSelection(); #endif targetFrame->editor()->setComposition(compositionString, underlines, cursorPosition, 0); #if ENABLE(TIZEN_ISF_PORT) - m_page->editorClient()->respondToChangedSelection(targetFrame); + m_page->editorClient()->unlockRespondToChangedSelection(); #endif } -- 2.7.4