REGRESSION(r224179): layer flush now requires sync IPC to compute undo/redo availabil...
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Nov 2017 00:48:21 +0000 (00:48 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Nov 2017 00:48:21 +0000 (00:48 +0000)
commit1781838d6b6eae391e88fcbb605d5eaf269374a0
tree684c1e9452e6a94a76659916917d41a13f695a5c
parenteaf72dc3e721467da098ccf5115c24630b5d1dc1
REGRESSION(r224179): layer flush now requires sync IPC to compute undo/redo availability in EditorState
https://bugs.webkit.org/show_bug.cgi?id=179797

Reviewed by Simon Fraser.

Source/WebCore:

Editor::canUndo and Editor::CanRedo no longer need to be exported.

* editing/Editor.h:

Source/WebKit:

r224179 introduced a performance regression. The newly-added code in WebPage::editorState is
part of a performance-critical path. (The editor state is computed and sent to the UI
process during the layer flush.) Calls to Editor::canUndo and Editor::canRedo were added,
but these calls are both implemented with sync IPC calls to WebPageProxy in the UI process.
WebPageProxy passes them along to PageClientImpl to compute the availability of the
commands.

That's all pointless because this code only exists for the purpose of getting editing
command availability to the UI process. In the case of undo and redo, it's not needed at
all. I did not realize that when writing the code. So canUndo and canRedo should be removed
from EditorState. This ought to be sufficient to avoid the perf regression.

No changes are needed to the GTK/WPE WebKitEditorState API. The API is reimplemented using
WebPageProxy::canUndoRedo instead of EditorState. There should be no changes in behavior,
only performance.

* Shared/EditorState.cpp:
(WebKit::EditorState::PostLayoutData::encode const):
(WebKit::EditorState::PostLayoutData::decode):
* Shared/EditorState.h:
* UIProcess/API/glib/WebKitEditorState.cpp:
(webkitEditorStateCreate):
(webkitEditorStateChanged):
* UIProcess/API/glib/WebKitEditorStatePrivate.h:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_get_editor_state):
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::canUndo):
(WebKit::WebPageProxy::canRedo):
* UIProcess/WebPageProxy.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224945 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/EditorState.cpp
Source/WebKit/Shared/EditorState.h
Source/WebKit/UIProcess/API/glib/WebKitEditorState.cpp
Source/WebKit/UIProcess/API/glib/WebKitEditorStatePrivate.h
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp