Only EditCommandComposition should implement unapply and reapply
https://bugs.webkit.org/show_bug.cgi?id=74490

Reviewed by Eric Seidel.

Source/WebCore: 

Introduce new abstract class UndoStep to replace EditCommand for EditorClient, and make EditCommand
private to WebCore.

* GNUmakefile.list.am:
* Target.pri:
* WebCore.exp.in:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* editing/CompositeEditCommand.cpp:
(WebCore::EditCommandComposition::create): Takes EditAction instead of boolean for CreateLinkCommand.
(WebCore::EditCommandComposition::EditCommandComposition): Ditto.
(WebCore::EditCommandComposition::unapply): Moved from EditCommand; we don't have to call isTopLevelCommand
anymore because EditCommandComposition is always top-level. In fact, the only thing unapply/reapply do
in addition to what doUnapply/doReapply do for sub-level commands is disabling and enabling delete button
and defining an event queue scope. However, these can be done at top-level command anyway, so we now only call
doApply for sub-level commands.
(WebCore::EditCommandComposition::reapply): Ditto.
(WebCore::EditCommandComposition::setStartingSelection): Added.
(WebCore::EditCommandComposition::setEndingSelection): Added.
(WebCore::applyCommand): Moved from EditCommand.
(WebCore::CompositeEditCommand::apply): Moved from EditCommand; doesn't call isTopLevelCommand for the same reason.
(WebCore::CompositeEditCommand::ensureComposition):
(WebCore::CompositeEditCommand::applyCommandToComposite): Call doApply instead of apply for the same reason.
* editing/CompositeEditCommand.h:
(WebCore::EditCommandComposition::wasCreateLinkCommand):
(WebCore::EditCommandComposition::startingSelection): Added.
(WebCore::EditCommandComposition::endingSelection): Added.
* editing/EditCommand.cpp:
(WebCore::EditCommand::setStartingSelection):
(WebCore::EditCommand::setEndingSelection):
(WebCore::SimpleEditCommand::doReapply): Moved from EditCommand.
* editing/EditCommand.h:
* editing/UndoStep.h: Added.
(WebCore::UndoStep::~UndoStep):
* loader/EmptyClients.h:
(WebCore::EmptyEditorClient::shouldInsertNode):
(WebCore::EmptyEditorClient::didSetSelectionTypesForPasteboard):
(WebCore::EmptyEditorClient::registerCommandForUndo): Takes UndoStep instead of EditCommand.
(WebCore::EmptyEditorClient::registerCommandForRedo): Ditto.
* page/EditorClient.h:

Source/WebKit/chromium: 

* src/EditorClientImpl.cpp:
(WebKit::EditorClientImpl::registerCommandForUndo):
(WebKit::EditorClientImpl::registerCommandForRedo):
(WebKit::EditorClientImpl::undo):
(WebKit::EditorClientImpl::redo):
* src/EditorClientImpl.h:

Source/WebKit/efl: 

* WebCoreSupport/EditorClientEfl.cpp:
(WebCore::EditorClientEfl::registerCommandForUndo):
(WebCore::EditorClientEfl::registerCommandForRedo):
(WebCore::EditorClientEfl::undo):
(WebCore::EditorClientEfl::redo):
* WebCoreSupport/EditorClientEfl.h:

Source/WebKit/gtk: 

* WebCoreSupport/EditorClientGtk.cpp:
(WebKit::EditorClient::registerCommandForUndo):
(WebKit::EditorClient::registerCommandForRedo):
(WebKit::EditorClient::undo):
(WebKit::EditorClient::redo):
* WebCoreSupport/EditorClientGtk.h:

Source/WebKit/mac: 

* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(-[WebUndoStep initWithUndoStep:]):
(-[WebUndoStep dealloc]):
(+[WebUndoStep stepWithUndoStep:]):
(-[WebUndoStep step]):
(-[WebEditorUndoTarget undoEditing:]):
(-[WebEditorUndoTarget redoEditing:]):
(WebEditorClient::registerCommandForUndoOrRedo):
(WebEditorClient::registerCommandForUndo):
(WebEditorClient::registerCommandForRedo):

Source/WebKit/qt: 

EditCommandQt is to be renamed to UndoStepQt in a follow up patch.

* WebCoreSupport/EditCommandQt.cpp:
(EditCommandQt::EditCommandQt):
* WebCoreSupport/EditCommandQt.h:
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::registerCommandForUndo):
(WebCore::EditorClientQt::registerCommandForRedo):

Source/WebKit/win: 

* WebCoreSupport/WebEditorClient.cpp:
(WebEditorUndoCommand::WebEditorUndoCommand):
(WebEditorUndoCommand::execute):
(WebEditorClient::registerCommandForUndo):
(WebEditorClient::registerCommandForRedo):
* WebCoreSupport/WebEditorClient.h:

Source/WebKit/wince: 

* WebCoreSupport/EditorClientWinCE.cpp:
(WebKit::EditorClientWinCE::registerCommandForUndo):
(WebKit::EditorClientWinCE::registerCommandForRedo):
* WebCoreSupport/EditorClientWinCE.h:

Source/WebKit2: 

Renamed WebEditCommand to WebUndoStep and made necessary changes.
Everything on WebProcess side should have the correct name now.

Names in the proxy and UIProcess are to be updated in a follow up.

* CMakeLists.txt:
* GNUmakefile.am:
* Target.pri:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::registerCommandForUndo):
(WebKit::WebEditorClient::registerCommandForRedo):
* WebProcess/WebCoreSupport/WebEditorClient.h:
* WebProcess/WebPage/WebEditCommand.cpp: Removed.
* WebProcess/WebPage/WebEditCommand.h: Removed.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::webUndoStep):
(WebKit::WebPage::addWebUndoStep):
(WebKit::WebPage::removeWebEditCommand):
(WebKit::WebPage::unapplyEditCommand):
(WebKit::WebPage::reapplyEditCommand):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebUndoStep.cpp: Copied from Source/WebKit2/WebProcess/WebPage/WebEditCommand.cpp.
(WebKit::generateUndoStep):
(WebKit::WebUndoStep::create):
* WebProcess/WebPage/WebUndoStep.h: Copied from Source/WebKit2/WebProcess/WebPage/WebEditCommand.h.
(WebKit::WebUndoStep::entry):
(WebKit::WebUndoStep::entryID):
(WebKit::WebUndoStep::WebUndoStep):
* win/WebKit2.vcproj:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@103104 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/GNUmakefile.list.am b/Source/WebCore/GNUmakefile.list.am
index 866cd6d..0799b18 100644
--- a/Source/WebCore/GNUmakefile.list.am
+++ b/Source/WebCore/GNUmakefile.list.am
@@ -1510,6 +1510,7 @@
 	Source/WebCore/editing/TextIterator.h \
 	Source/WebCore/editing/TypingCommand.cpp \
 	Source/WebCore/editing/TypingCommand.h \
+	Source/WebCore/editing/UndoStep.h \
 	Source/WebCore/editing/UnlinkCommand.cpp \
 	Source/WebCore/editing/UnlinkCommand.h \
 	Source/WebCore/editing/VisiblePosition.cpp \