[WPE][GTK] Expose availability of certain editing commands in WebKitEditorState
authormcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Oct 2017 14:20:47 +0000 (14:20 +0000)
committermcatanzaro@igalia.com <mcatanzaro@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Oct 2017 14:20:47 +0000 (14:20 +0000)
commit9adfd776036707dce03e5e237d2374e843cc4523
treee21f488cd0274bc479216414c03999d715e81a7b
parent9a33c27d40d35e56b4d653ecad2583d80ce6905c
[WPE][GTK] Expose availability of certain editing commands in WebKitEditorState
https://bugs.webkit.org/show_bug.cgi?id=168219

Reviewed by Ryosuke Niwa.

Source/WebCore:

Make Editor::canUndo and Editor::canRedo const.

Also, remove unused allowsCopy from HitTestResult.

* editing/Editor.cpp:
(WebCore::Editor::canUndo const):
(WebCore::Editor::canRedo const):
(WebCore::Editor::canUndo): Deleted.
(WebCore::Editor::canRedo): Deleted.
* editing/Editor.h:
* rendering/HitTestResult.cpp:
(WebCore::HitTestResult::allowsCopy const): Deleted.
* rendering/HitTestResult.h:
* rendering/SelectionRangeData.cpp:

Source/WebKit:

Expose canCut, canCopy, canPaste, canUndo, and canRedo in EditorState::PostLayouData.

Add corresponding new WPE/GTK API.

Remove allowsCopy from WebKitTestResultData. It's unused, does not work correctly in all
circumstances, and irritates Ryosuke.

Also, remove a bunch of #ifs guarding post layout data, since it's now used on all ports.

* Shared/EditorState.cpp:
(WebKit::EditorState::encode const):
(WebKit::EditorState::decode):
(WebKit::EditorState::PostLayoutData::encode const):
(WebKit::EditorState::PostLayoutData::decode):
* Shared/EditorState.h:
(WebKit::EditorState::postLayoutData const const):
* Shared/WebHitTestResultData.cpp:
(WebKit::WebHitTestResultData::WebHitTestResultData):
(WebKit::WebHitTestResultData::encode const):
(WebKit::WebHitTestResultData::decode):
* Shared/WebHitTestResultData.h:
* UIProcess/API/APIHitTestResult.h:
(API::HitTestResult::allowsCopy const): Deleted.
* UIProcess/API/glib/WebKitEditorState.cpp:
(webkitEditorStateChanged):
(webkit_editor_state_is_cut_available):
(webkit_editor_state_is_copy_available):
(webkit_editor_state_is_paste_available):
(webkit_editor_state_is_undo_available):
(webkit_editor_state_is_redo_available):
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_can_execute_editing_command):
* UIProcess/API/gtk/WebKitEditorState.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/wpe/WebKitEditorState.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::editorState const):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performImmediateActionHitTestAtLocation):

Tools:

Test it.

* TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp:
(testWebViewEditorCutCopyPasteNonEditable):
(testWebViewEditorCutCopyPasteEditable):
(testWebViewEditorSelectAllNonEditable):
(testWebViewEditorSelectAllEditable):
(loadContentsAndTryToCutSelection):
(testWebViewEditorNonEditable):
(testWebViewEditorEditorStateTypingAttributes):
(testWebViewEditorInsertImage):
(testWebViewEditorCreateLink):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
20 files changed:
Source/WebCore/ChangeLog
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/Editor.h
Source/WebCore/rendering/HitTestResult.cpp
Source/WebCore/rendering/HitTestResult.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/EditorState.cpp
Source/WebKit/Shared/EditorState.h
Source/WebKit/Shared/WebHitTestResultData.cpp
Source/WebKit/Shared/WebHitTestResultData.h
Source/WebKit/UIProcess/API/APIHitTestResult.h
Source/WebKit/UIProcess/API/glib/WebKitEditorState.cpp
Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
Source/WebKit/UIProcess/API/gtk/WebKitEditorState.h
Source/WebKit/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt
Source/WebKit/UIProcess/API/wpe/WebKitEditorState.h
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKitGtk/TestWebViewEditor.cpp