Bug 1448780 - Get rid of nsIEditor.numberOfUndoItems and nsIEditor.numberOfRedoItems r?m_kato draft
authorMasayuki Nakano <masayuki@d-toybox.com>
Mon, 26 Mar 2018 18:11:06 +0900
changeset 772591 7495ec97e4efb917fa0199dd830cda0df0ebf6ec
parent 772562 67827a5165321a5a5039e35f7565dfe1f9582e58
push id103972
push usermasayuki@d-toybox.com
push dateMon, 26 Mar 2018 15:03:11 +0000
reviewersm_kato
bugs1448780
milestone61.0a1
Bug 1448780 - Get rid of nsIEditor.numberOfUndoItems and nsIEditor.numberOfRedoItems r?m_kato nsIEditor.numberOfUndoItems and nsIEditor.numberOfRedoItems are shortcut property for nsITransactionManager.numberOfUndoItems and nsITransactionManager.numberOfRedoItems of the editor. However, anybody uses nsITransactionManager directly. So, we can get rid of them. MozReview-Commit-ID: 70J0bsxDNCC
editor/libeditor/EditorBase.cpp
editor/nsIEditor.idl
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -823,32 +823,16 @@ EditorBase::EnableUndo(bool aEnable)
   }
   DebugOnly<bool> disabledUndoRedo = DisableUndoRedo();
   NS_WARNING_ASSERTION(disabledUndoRedo,
     "Failed to disable undo/redo transactions");
   return NS_OK;
 }
 
 NS_IMETHODIMP
-EditorBase::GetNumberOfUndoItems(int32_t* aNumItems)
-{
-  *aNumItems = static_cast<int32_t>(NumberOfUndoItems());
-  MOZ_ASSERT(*aNumItems >= 0);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-EditorBase::GetNumberOfRedoItems(int32_t* aNumItems)
-{
-  *aNumItems = static_cast<int32_t>(NumberOfRedoItems());
-  MOZ_ASSERT(*aNumItems >= 0);
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 EditorBase::GetTransactionManager(nsITransactionManager** aTransactionManager)
 {
   if (NS_WARN_IF(!aTransactionManager)) {
     return NS_ERROR_INVALID_ARG;
   }
   if (NS_WARN_IF(!mTransactionManager)) {
     return NS_ERROR_FAILURE;
   }
--- a/editor/nsIEditor.idl
+++ b/editor/nsIEditor.idl
@@ -164,26 +164,16 @@ interface nsIEditor  : nsISupports
     *                 if PR_FALSE the undo system is turned off if it
     *                 was previously on
     * @return         if aEnable is PR_TRUE, returns NS_OK if
     *                 the undo system could be initialized properly
     *                 if aEnable is PR_FALSE, returns NS_OK.
     */
   void enableUndo(in boolean enable);
 
-  /**
-   * The number of items on the undo stack.
-   */
-  readonly attribute long numberOfUndoItems;
-
-  /**
-   * The number of items on the redo stack.
-   */
-  readonly attribute long numberOfRedoItems;
-
   /** undo reverses the effects of the last Do operation,
     * if Undo is enabled in the editor.
     * It is provided here so clients need no knowledge of whether
     * the editor has a transaction manager or not.
     * If a transaction manager is present, it is told to undo,
     * and the result of that undo is returned.
     * Otherwise, the Undo request is ignored and an
     * error NS_ERROR_NOT_AVAILABLE is returned.