Bug 1260651 part.53 Rename nsRulesInfo to mozilla::RulesInfo and rename nsEditRules.h to nsIEditRules.h r=mccr8
MozReview-Commit-ID: LGqyvjv9pr6
--- a/editor/libeditor/HTMLEditRules.cpp
+++ b/editor/libeditor/HTMLEditRules.cpp
@@ -57,20 +57,21 @@
#include <algorithm>
// Workaround for windows headers
#ifdef SetProp
#undef SetProp
#endif
class nsISupports;
-class nsRulesInfo;
namespace mozilla {
+class RulesInfo;
+
using namespace dom;
//const static char* kMOZEditorBogusNodeAttr="MOZ_EDITOR_BOGUS_NODE";
//const static char* kMOZEditorBogusNodeValue="TRUE";
enum
{
kLonely = 0,
@@ -553,17 +554,17 @@ HTMLEditRules::AfterEditInner(EditAction
CheckInterlinePosition(*selection);
}
return NS_OK;
}
NS_IMETHODIMP
HTMLEditRules::WillDoAction(Selection* aSelection,
- nsRulesInfo* aInfo,
+ RulesInfo* aInfo,
bool* aCancel,
bool* aHandled)
{
MOZ_ASSERT(aInfo && aCancel && aHandled);
*aCancel = false;
*aHandled = false;
@@ -654,17 +655,17 @@ HTMLEditRules::WillDoAction(Selection* a
default:
return TextEditRules::WillDoAction(aSelection, aInfo,
aCancel, aHandled);
}
}
NS_IMETHODIMP
HTMLEditRules::DidDoAction(Selection* aSelection,
- nsRulesInfo* aInfo,
+ RulesInfo* aInfo,
nsresult aResult)
{
TextRulesInfo* info = static_cast<TextRulesInfo*>(aInfo);
switch (info->action)
{
case EditAction::insertBreak:
return DidInsertBreak(aSelection, aResult);
case EditAction::deleteSelection:
@@ -3447,17 +3448,17 @@ HTMLEditRules::WillMakeBasicBlock(Select
res = ApplyBlockStyle(arrayOfNodes, blockType);
NS_ENSURE_SUCCESS(res, res);
}
return NS_OK;
}
nsresult
HTMLEditRules::DidMakeBasicBlock(Selection* aSelection,
- nsRulesInfo* aInfo,
+ RulesInfo* aInfo,
nsresult aResult)
{
NS_ENSURE_TRUE(aSelection, NS_ERROR_NULL_POINTER);
// check for empty block. if so, put a moz br in it.
if (!aSelection->Collapsed()) {
return NS_OK;
}
--- a/editor/libeditor/HTMLEditRules.h
+++ b/editor/libeditor/HTMLEditRules.h
@@ -23,20 +23,20 @@ class nsIAtom;
class nsIDOMCharacterData;
class nsIDOMDocument;
class nsIDOMElement;
class nsIDOMNode;
class nsIEditor;
class nsINode;
class nsPlaintextEditor;
class nsRange;
-class nsRulesInfo;
namespace mozilla {
+class RulesInfo;
struct EditorDOMPoint;
namespace dom {
class Element;
class Selection;
} // namespace dom
struct StyleCache final : public PropItem
{
@@ -77,19 +77,19 @@ public:
// nsIEditRules methods
NS_IMETHOD Init(nsPlaintextEditor* aTextEditor) override;
NS_IMETHOD DetachEditor() override;
NS_IMETHOD BeforeEdit(EditAction action,
nsIEditor::EDirection aDirection) override;
NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection) override;
- NS_IMETHOD WillDoAction(Selection* aSelection, nsRulesInfo* aInfo,
+ NS_IMETHOD WillDoAction(Selection* aSelection, RulesInfo* aInfo,
bool* aCancel, bool* aHandled) override;
- NS_IMETHOD DidDoAction(Selection* aSelection, nsRulesInfo* aInfo,
+ NS_IMETHOD DidDoAction(Selection* aSelection, RulesInfo* aInfo,
nsresult aResult) override;
NS_IMETHOD DocumentModified() override;
nsresult GetListState(bool* aMixed, bool* aOL, bool* aUL, bool* aDL);
nsresult GetListItemState(bool* aMixed, bool* aLI, bool* aDT, bool* aDD);
nsresult GetIndentState(bool* aCanIndent, bool* aCanOutdent);
nsresult GetAlignment(bool* aMixed, nsIHTMLEditor::EAlignment* aAlign);
nsresult GetParagraphState(bool* aMixed, nsAString& outFormat);
@@ -195,17 +195,17 @@ protected:
nsresult WillRelativeChangeZIndex(Selection* aSelection, int32_t aChange,
bool* aCancel, bool* aHandled);
nsresult WillMakeDefListItem(Selection* aSelection,
const nsAString* aBlockType, bool aEntireList,
bool* aCancel, bool* aHandled);
nsresult WillMakeBasicBlock(Selection& aSelection,
const nsAString& aBlockType,
bool* aCancel, bool* aHandled);
- nsresult DidMakeBasicBlock(Selection* aSelection, nsRulesInfo* aInfo,
+ nsresult DidMakeBasicBlock(Selection* aSelection, RulesInfo* aInfo,
nsresult aResult);
nsresult DidAbsolutePosition();
nsresult AlignInnerBlocks(nsINode& aNode, const nsAString* alignType);
nsresult AlignBlockContents(nsIDOMNode* aNode, const nsAString* alignType);
nsresult AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
nsINode* aNode);
nsresult GetFormatString(nsIDOMNode* aNode, nsAString &outFormat);
enum class Lists { no, yes };
--- a/editor/libeditor/TextEditRules.cpp
+++ b/editor/libeditor/TextEditRules.cpp
@@ -235,17 +235,17 @@ TextEditRules::AfterEdit(EditAction acti
// collapse the selection to the trailing BR if it's at the end of our text node
CollapseSelectionToTrailingBRIfNeeded(selection);
}
return res;
}
NS_IMETHODIMP
TextEditRules::WillDoAction(Selection* aSelection,
- nsRulesInfo* aInfo,
+ RulesInfo* aInfo,
bool* aCancel,
bool* aHandled)
{
// null selection is legal
MOZ_ASSERT(aInfo && aCancel && aHandled);
*aCancel = false;
*aHandled = false;
@@ -283,17 +283,17 @@ TextEditRules::WillDoAction(Selection* a
return NS_OK;
default:
return NS_ERROR_FAILURE;
}
}
NS_IMETHODIMP
TextEditRules::DidDoAction(Selection* aSelection,
- nsRulesInfo* aInfo,
+ RulesInfo* aInfo,
nsresult aResult)
{
NS_ENSURE_STATE(mEditor);
// don't let any txns in here move the selection around behind our back.
// Note that this won't prevent explicit selection setting from working.
AutoTransactionsConserveSelection dontSpazMySelection(mEditor);
NS_ENSURE_TRUE(aSelection && aInfo, NS_ERROR_NULL_POINTER);
--- a/editor/libeditor/TextEditRules.h
+++ b/editor/libeditor/TextEditRules.h
@@ -3,18 +3,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_TextEditRules_h
#define mozilla_TextEditRules_h
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
-#include "nsEditRules.h"
#include "nsEditor.h"
+#include "nsIEditRules.h"
#include "nsIEditor.h"
#include "nsISupportsImpl.h"
#include "nsITimer.h"
#include "nsString.h"
#include "nscore.h"
class nsIDOMElement;
class nsIDOMNode;
@@ -57,19 +57,19 @@ public:
// nsIEditRules methods
NS_IMETHOD Init(nsPlaintextEditor* aTextEditor) override;
NS_IMETHOD SetInitialValue(const nsAString& aValue) override;
NS_IMETHOD DetachEditor() override;
NS_IMETHOD BeforeEdit(EditAction action,
nsIEditor::EDirection aDirection) override;
NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection) override;
- NS_IMETHOD WillDoAction(Selection* aSelection, nsRulesInfo* aInfo,
+ NS_IMETHOD WillDoAction(Selection* aSelection, RulesInfo* aInfo,
bool* aCancel, bool* aHandled) override;
- NS_IMETHOD DidDoAction(Selection* aSelection, nsRulesInfo* aInfo,
+ NS_IMETHOD DidDoAction(Selection* aSelection, RulesInfo* aInfo,
nsresult aResult) override;
NS_IMETHOD DocumentIsEmpty(bool* aDocumentIsEmpty) override;
NS_IMETHOD DocumentModified() override;
protected:
virtual ~TextEditRules();
public:
@@ -248,21 +248,21 @@ protected:
nsCOMPtr<nsITimer> mTimer;
uint32_t mLastStart;
uint32_t mLastLength;
// friends
friend class AutoLockRulesSniffing;
};
-class TextRulesInfo final : public nsRulesInfo
+class TextRulesInfo final : public RulesInfo
{
public:
explicit TextRulesInfo(EditAction aAction)
- : nsRulesInfo(aAction)
+ : RulesInfo(aAction)
, inString(nullptr)
, outString(nullptr)
, outputFormat(nullptr)
, maxLength(-1)
, collapsedAction(nsIEditor::eNext)
, stripWrappers(nsIEditor::eStrip)
, bOrdered(false)
, entireList(false)
--- a/editor/libeditor/moz.build
+++ b/editor/libeditor/moz.build
@@ -10,17 +10,17 @@ MOCHITEST_MANIFESTS += [
]
MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
BROWSER_CHROME_MANIFESTS += ['tests/browser.ini']
EXPORTS += [
'nsEditor.h',
- 'nsEditRules.h',
+ 'nsIEditRules.h',
]
EXPORTS.mozilla += [
'EditorController.h',
'SelectionState.h',
'TextEditRules.h',
]
--- a/editor/libeditor/nsHTMLAbsPosition.cpp
+++ b/editor/libeditor/nsHTMLAbsPosition.cpp
@@ -12,32 +12,32 @@
#include "mozilla/dom/Selection.h"
#include "mozilla/dom/Element.h"
#include "mozilla/mozalloc.h"
#include "nsAString.h"
#include "nsAlgorithm.h"
#include "nsCOMPtr.h"
#include "nsComputedDOMStyle.h"
#include "nsDebug.h"
-#include "nsEditRules.h"
#include "nsEditor.h"
#include "nsError.h"
#include "nsGkAtoms.h"
#include "nsHTMLEditor.h"
#include "nsHTMLObjectResizer.h"
#include "nsIContent.h"
#include "nsROCSSPrimitiveValue.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMNode.h"
#include "nsDOMCSSRGBColor.h"
#include "nsIDOMWindow.h"
#include "nsIEditor.h"
+#include "nsIEditRules.h"
#include "nsIHTMLEditor.h"
#include "nsIHTMLObjectResizer.h"
#include "nsINode.h"
#include "nsIPresShell.h"
#include "nsISupportsImpl.h"
#include "nsISupportsUtils.h"
#include "nsLiteralString.h"
#include "nsReadableUtils.h"
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -24,17 +24,16 @@
#include "nsCOMPtr.h"
#include "nsCRT.h"
#include "nsCRTGlue.h"
#include "nsComponentManagerUtils.h"
#include "nsIScriptError.h"
#include "nsContentUtils.h"
#include "nsDebug.h"
#include "nsDependentSubstring.h"
-#include "nsEditRules.h"
#include "nsEditor.h"
#include "nsError.h"
#include "nsGkAtoms.h"
#include "nsHTMLEditor.h"
#include "nsIClipboard.h"
#include "nsIContent.h"
#include "nsIContentFilter.h"
#include "nsIDOMComment.h"
@@ -50,16 +49,17 @@
#include "nsIDOMHTMLLinkElement.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLScriptElement.h"
#include "nsIDOMNode.h"
#include "nsIDocument.h"
#include "nsIEditor.h"
#include "nsIEditorIMESupport.h"
#include "nsIEditorMailSupport.h"
+#include "nsIEditRules.h"
#include "nsIFile.h"
#include "nsIInputStream.h"
#include "nsIMIMEService.h"
#include "nsNameSpaceManager.h"
#include "nsINode.h"
#include "nsIParserUtils.h"
#include "nsIPlaintextEditor.h"
#include "nsISupportsImpl.h"
--- a/editor/libeditor/nsHTMLEditor.h
+++ b/editor/libeditor/nsHTMLEditor.h
@@ -7,26 +7,25 @@
#define nsHTMLEditor_h__
#include "nsCOMPtr.h"
#include "nsPlaintextEditor.h"
#include "nsIEditor.h"
#include "nsIHTMLEditor.h"
#include "nsITableEditor.h"
#include "nsIEditorMailSupport.h"
+#include "nsIEditRules.h"
#include "nsIEditorStyleSheets.h"
#include "nsIEditorUtils.h"
#include "nsEditor.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventListener.h"
#include "nsICSSLoaderObserver.h"
-#include "nsEditRules.h"
-
#include "CSSEditUtils.h"
#include "nsHTMLObjectResizer.h"
#include "nsIHTMLAbsPosEditor.h"
#include "nsIHTMLInlineTableEditor.h"
#include "nsIHTMLObjectResizeListener.h"
#include "nsIHTMLObjectResizer.h"
--- a/editor/libeditor/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/nsHTMLEditorStyle.cpp
@@ -13,27 +13,27 @@
#include "mozilla/dom/Element.h"
#include "mozilla/mozalloc.h"
#include "nsAString.h"
#include "nsAttrName.h"
#include "nsCOMPtr.h"
#include "nsCaseTreatment.h"
#include "nsComponentManagerUtils.h"
#include "nsDebug.h"
-#include "nsEditRules.h"
#include "nsEditor.h"
#include "nsError.h"
#include "nsGkAtoms.h"
#include "nsHTMLEditor.h"
#include "nsIAtom.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
#include "nsIDOMElement.h"
#include "nsIEditor.h"
#include "nsIEditorIMESupport.h"
+#include "nsIEditRules.h"
#include "nsNameSpaceManager.h"
#include "nsINode.h"
#include "nsISupportsImpl.h"
#include "nsLiteralString.h"
#include "nsRange.h"
#include "nsReadableUtils.h"
#include "nsString.h"
#include "nsStringFwd.h"
rename from editor/libeditor/nsEditRules.h
rename to editor/libeditor/nsIEditRules.h
--- a/editor/libeditor/nsEditRules.h
+++ b/editor/libeditor/nsIEditRules.h
@@ -1,66 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef nsEditRules_h__
-#define nsEditRules_h__
+#ifndef nsIEditRules_h
+#define nsIEditRules_h
#define NS_IEDITRULES_IID \
{ 0x3836386d, 0x806a, 0x488d, \
{ 0x8b, 0xab, 0xaf, 0x42, 0xbb, 0x4c, 0x90, 0x66 } }
#include "nsEditor.h" // for EditAction enum
class nsPlaintextEditor;
+
namespace mozilla {
+
namespace dom {
class Selection;
} // namespace dom
-} // namespace mozilla
-/***************************************************************************
- * base for an object to encapsulate any additional info needed to be passed
- * to rules system by the editor
+/**
+ * Base for an object to encapsulate any additional info needed to be passed
+ * to rules system by the editor.
*/
-class nsRulesInfo
+class RulesInfo
{
- public:
-
- explicit nsRulesInfo(EditAction aAction) : action(aAction) {}
- virtual ~nsRulesInfo() {}
+public:
+ explicit RulesInfo(EditAction aAction)
+ : action(aAction)
+ {}
+ virtual ~RulesInfo() {}
EditAction action;
};
-/***************************************************************************
+} // namespace mozilla
+
+/**
* Interface of editing rules.
- *
*/
class nsIEditRules : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEDITRULES_IID)
//Interfaces for addref and release and queryinterface
//NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsIEditRules
- NS_IMETHOD Init(nsPlaintextEditor *aEditor)=0;
+ NS_IMETHOD Init(nsPlaintextEditor* aEditor) = 0;
NS_IMETHOD SetInitialValue(const nsAString& aValue) = 0;
- NS_IMETHOD DetachEditor()=0;
+ NS_IMETHOD DetachEditor() = 0;
NS_IMETHOD BeforeEdit(EditAction action,
nsIEditor::EDirection aDirection) = 0;
NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection) = 0;
- NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo,
- bool* aCancel, bool* aHandled) = 0;
+ NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection,
+ mozilla::RulesInfo* aInfo, bool* aCancel,
+ bool* aHandled) = 0;
NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection,
- nsRulesInfo* aInfo, nsresult aResult) = 0;
- NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty)=0;
- NS_IMETHOD DocumentModified()=0;
+ mozilla::RulesInfo* aInfo, nsresult aResult) = 0;
+ NS_IMETHOD DocumentIsEmpty(bool* aDocumentIsEmpty) = 0;
+ NS_IMETHOD DocumentModified() = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIEditRules, NS_IEDITRULES_IID)
-#endif //nsEditRules_h__
-
+#endif // #ifndef nsIEditRules_h
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -22,38 +22,38 @@
#include "nsCRT.h"
#include "nsCaret.h"
#include "nsCharTraits.h"
#include "nsComponentManagerUtils.h"
#include "nsContentCID.h"
#include "nsCopySupport.h"
#include "nsDebug.h"
#include "nsDependentSubstring.h"
-#include "nsEditRules.h"
#include "nsError.h"
#include "nsGkAtoms.h"
#include "nsIClipboard.h"
#include "nsIContent.h"
#include "nsIContentIterator.h"
#include "nsIDOMCharacterData.h"
#include "nsIDOMDocument.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMKeyEvent.h"
#include "nsIDOMNode.h"
#include "nsIDOMNodeList.h"
#include "nsIDocumentEncoder.h"
#include "nsIEditorIMESupport.h"
-#include "nsNameSpaceManager.h"
+#include "nsIEditRules.h"
#include "nsINode.h"
#include "nsIPresShell.h"
#include "nsISelectionController.h"
#include "nsISupportsPrimitives.h"
#include "nsITransferable.h"
#include "nsIWeakReferenceUtils.h"
+#include "nsNameSpaceManager.h"
#include "nsLiteralString.h"
#include "nsReadableUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsStringFwd.h"
#include "nsSubstringTuple.h"
#include "nsUnicharUtils.h"
#include "nsXPCOM.h"