Граф коммитов

7 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 52cffc3290 Bug 1447924 - part 7: Implement AddTransactionListener() and RemoveTransactionListener() in EditorBase and TransactionManager r=m_kato
nsITransactionListener::AddListener() and
nsITransactionListener::RemoveListener() are of course virtual methods.
Additionally, they are safe to call without grabbing the TransactionManager's
instance with local variable.  Therefore, if EditorBase has methods to
add/remove transaction listener to/from its transaction manager, we don't
need EditorBase::GetTransactionManager() anymore.

So, this patch adds AddTransactionListener() and RemoveTransactionListener() to
EditorBase and TransactionManager, and remove
EditorBase::GetTransactionManager() (not nsIEditor's one).

MozReview-Commit-ID: FkPa1YgfagD

--HG--
extra : rebase_source : 8ef7796136804e3d7604c5ca5417fb3379606b93
2018-03-23 18:55:56 +09:00
Masayuki Nakano f882fa6959 Bug 1447924 - part 6: Implement EnableUndoRedo(), DisableUndoRedo() and ClearUndoRedo() in EditorBase and TransactionManager r=m_kato
nsIEditor::EnableUndo() and nsITransactionManager::Clear(),
nsITransactionManager::SetMaxTransactionCount() are called a lot but they are
virtual and some of or all of them are called once.  There should be each
non-virtual method to do what each root caller wants.  Therefore, this patch
adds EditorBase::EnableUndoRedo(), EditorBase::DisableUndoRedo(),
EditorBase::ClearUndoRedo(), TransactionManager::EnableUndoRedo(),
TransactionManager::DisableUndoRedo() and TransactionManager::ClearUndoRedo().

Note that this patch makes TransactionManager won't clear mUndoStack nor
mRedoStack if mDoStack is not empty.  This is checked only by
TransactionManager::SetMaxTransactionCount() but according to the comment,
TransactionManager::Clear(), TransactionManager::UndoStack() and
TransactionManager::RedoStack() should check it too.

MozReview-Commit-ID: 6qBZOQNwdhw

--HG--
extra : rebase_source : 3249137f7acca0b4698713ab732774140bcc27e8
2018-03-23 15:25:13 +09:00
Masayuki Nakano a1f13e5b38 Bug 1447924 - part 5: Merge TextEditor::Undo()/Redo() with EditorBase::Undo()/Redo() r=m_kato
EditorBase::Undo() and EditorBase::Redo() implement only undo/redo function.
TextEditor::Undo() and TextEditor::Redo() call them with calling some
notification methods.  However, this causes redundant AutoRules instance
creation and doesn't make sense to separate them under current design.

Therefore this patch merges them into TextEditor.  Unfortunately, they are
XPCOM methods but we cannot implement proper overloads of non-virtual since
they are already minimized design.  Fortunately, reducing only one virtual
call per undo/redo isn't so effective.  So, let's keep simpler design.

Additionally, this patch makes them stop committing composition because
Chrome does not commit composition even if "undo"/"redo" is requested with
execCommand() during composition and it doesn't make sense to try to
undo/redo after committing composition since first undoable transaction
becomes the committing composition and committing composition causes
removing all transactions from redo transaction queue.

MozReview-Commit-ID: 78qlV2I9Lzk

--HG--
extra : rebase_source : 545c787d47fe02bf7e085be9d3ae028816750e69
2018-03-23 01:21:17 +09:00
Masayuki Nakano 6273aa5604 Bug 1447924 - part 4: Optimize NumbeOfUndoItems(), NumbeOfRedoItems(), CanUndo() and CanRedo() of EditorBase r=m_kato
Now, both TransactionManager.h and TransactionStack.h are exposed.  So,
TransactionManager::GetNumberOfUndoItems() and
TransactionManager::GetNumberOfRedoItems() can be rewritten with non-virtual
inline methods because they just return mUndoStack.GetSize() and
mRedoStack.GetSize().  Then, we can implement EditorBase::NumbeOfUndoItems(),
EditorBase::NumberOfRedoItems(), EditorBase::CanUndo() and
EditorBase::CanRedo() as inline methods.

MozReview-Commit-ID: 3CJd0VrlvFY

--HG--
extra : rebase_source : 6848d80a395f1c161e10bfb50d15bd63de288095
2018-03-23 00:08:38 +09:00
Masayuki Nakano 0f92a44d6b Bug 1447924 - part 3: Rename nsTransactionStack to mozilla::TransactionStack r=m_kato
Then, all classes in editor/txmgr is now in mozilla namespace and all
headers which are included by other directory are now exposed.  So,
we can remote local includes from other directories now.

MozReview-Commit-ID: Kdb1c4Hp9Sy

--HG--
rename : editor/txmgr/nsTransactionStack.cpp => editor/txmgr/TransactionStack.cpp
rename : editor/txmgr/nsTransactionStack.h => editor/txmgr/TransactionStack.h
extra : rebase_source : 75035e9e618680af9188820595ab050b612a456f
2018-03-22 23:30:48 +09:00
Masayuki Nakano 01bb2a5690 Bug 1447924 - part 2: Rename nsTransactionItem to mozilla::TransactionItem r=m_kato
MozReview-Commit-ID: 5EmFPCaRYWm

--HG--
rename : editor/txmgr/nsTransactionItem.cpp => editor/txmgr/TransactionItem.cpp
rename : editor/txmgr/nsTransactionItem.h => editor/txmgr/TransactionItem.h
extra : rebase_source : 3d5e39b26dc077bb63f7d39542a42cb3d06b6b21
2018-03-22 23:07:36 +09:00
Masayuki Nakano c525b695b9 Bug 1447924 - part 1: Rename nsTransactionManager to mozilla::TransactionManager r=m_kato
We should rename nsTransactionManager to mozilla::TransactionManager before
adding new non-virtual methods.

MozReview-Commit-ID: JsivNVfDhex

--HG--
rename : editor/txmgr/nsTransactionManager.cpp => editor/txmgr/TransactionManager.cpp
rename : editor/txmgr/nsTransactionManager.h => editor/txmgr/TransactionManager.h
rename : editor/txmgr/nsTransactionManagerFactory.cpp => editor/txmgr/TransactionManagerFactory.cpp
extra : rebase_source : ff5bf76fec8be8f6a1202c17d488cf6c607d8f03
2018-03-22 22:15:54 +09:00