Introduce CustomUndoStep.h and CustomUndoStep.cpp
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 06:10:45 +0000 (06:10 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Jan 2019 06:10:45 +0000 (06:10 +0000)
commit78150019b7444d56018b0d1d4da9178184b9ae53
tree0acc8cc68d71ce7d3a1d0c70802870abe2aca973
parent380daa83c88e78ba85fe5a17b84c1e32ad4f446f
Introduce CustomUndoStep.h and CustomUndoStep.cpp
https://bugs.webkit.org/show_bug.cgi?id=193704
<rdar://problem/44807048>

Reviewed by Ryosuke Niwa.

This patch is more work in progress towards supporting `UndoManager.addItem()`. Here, we introduce a helper
class, CustomUndoStep, that holds a weak reference to a script-defined UndoItem. See below for more details.

No change in behavior.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* editing/CustomUndoStep.cpp:
(WebCore::CustomUndoStep::CustomUndoStep):

Subclass UndoStep.

(WebCore::CustomUndoStep::unapply):
(WebCore::CustomUndoStep::reapply):

If possible, invoke the UndoItem's undo and redo handlers.

(WebCore::CustomUndoStep::isValid const):
* editing/CustomUndoStep.h:
* editing/EditingStyle.cpp:
* editing/InsertEditableImageCommand.cpp:
(WebCore::InsertEditableImageCommand::doApply):

Unified build fixes.

* page/UndoItem.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240328 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/editing/CustomUndoStep.cpp [new file with mode: 0644]
Source/WebCore/editing/CustomUndoStep.h [new file with mode: 0644]
Source/WebCore/editing/EditingStyle.cpp
Source/WebCore/editing/InsertEditableImageCommand.cpp
Source/WebCore/page/UndoItem.h