Bug 1191354 part 8 - Typedefs in headers for readability; r=ehsan

This commit is contained in:
Aryeh Gregor 2016-05-01 16:15:14 +03:00
Родитель ef040f7942
Коммит f9d2d13cb5
5 изменённых файлов: 219 добавлений и 241 удалений

Просмотреть файл

@ -143,6 +143,11 @@ class nsEditor : public nsIEditor,
public nsIPhonetic public nsIPhonetic
{ {
public: public:
typedef mozilla::ErrorResult ErrorResult;
typedef mozilla::dom::Element Element;
typedef mozilla::dom::Selection Selection;
typedef mozilla::dom::Text Text;
template<typename T> using OwningNonNull = mozilla::OwningNonNull<T>;
enum IterDirection enum IterDirection
{ {
@ -199,36 +204,33 @@ public:
int32_t* aInOutOffset, int32_t* aInOutOffset,
nsIDocument* aDoc); nsIDocument* aDoc);
nsresult InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert, nsresult InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert,
mozilla::dom::Text& aTextNode, Text& aTextNode, int32_t aOffset,
int32_t aOffset,
bool aSuppressIME = false); bool aSuppressIME = false);
NS_IMETHOD DeleteSelectionImpl(EDirection aAction, NS_IMETHOD DeleteSelectionImpl(EDirection aAction,
EStripWrappers aStripWrappers); EStripWrappers aStripWrappers);
already_AddRefed<mozilla::dom::Element> already_AddRefed<Element> DeleteSelectionAndCreateElement(nsIAtom& aTag);
DeleteSelectionAndCreateElement(nsIAtom& aTag);
/* helper routines for node/parent manipulations */ /* helper routines for node/parent manipulations */
nsresult DeleteNode(nsINode* aNode); nsresult DeleteNode(nsINode* aNode);
nsresult InsertNode(nsIContent& aNode, nsINode& aParent, int32_t aPosition); nsresult InsertNode(nsIContent& aNode, nsINode& aParent, int32_t aPosition);
enum ECloneAttributes { eDontCloneAttributes, eCloneAttributes }; enum ECloneAttributes { eDontCloneAttributes, eCloneAttributes };
already_AddRefed<mozilla::dom::Element> ReplaceContainer( already_AddRefed<Element> ReplaceContainer(Element* aOldContainer,
mozilla::dom::Element* aOldContainer, nsIAtom* aNodeType,
nsIAtom* aNodeType, nsIAtom* aAttribute = nullptr,
nsIAtom* aAttribute = nullptr, const nsAString* aValue = nullptr,
const nsAString* aValue = nullptr, ECloneAttributes aCloneAttributes
ECloneAttributes aCloneAttributes = eDontCloneAttributes); = eDontCloneAttributes);
void CloneAttributes(mozilla::dom::Element* aDest, void CloneAttributes(Element* aDest, Element* aSource);
mozilla::dom::Element* aSource);
nsresult RemoveContainer(nsIContent* aNode); nsresult RemoveContainer(nsIContent* aNode);
already_AddRefed<mozilla::dom::Element> InsertContainerAbove( already_AddRefed<Element> InsertContainerAbove(nsIContent* aNode,
nsIContent* aNode, nsIAtom* aNodeType,
nsIAtom* aNodeType, nsIAtom* aAttribute = nullptr,
nsIAtom* aAttribute = nullptr, const nsAString* aValue =
const nsAString* aValue = nullptr); nullptr);
nsIContent* SplitNode(nsIContent& aNode, int32_t aOffset, nsIContent* SplitNode(nsIContent& aNode, int32_t aOffset,
mozilla::ErrorResult& aResult); ErrorResult& aResult);
nsresult JoinNodes(nsINode& aLeftNode, nsINode& aRightNode); nsresult JoinNodes(nsINode& aLeftNode, nsINode& aRightNode);
nsresult MoveNode(nsIContent* aNode, nsINode* aParent, int32_t aOffset); nsresult MoveNode(nsIContent* aNode, nsINode* aParent, int32_t aOffset);
@ -236,7 +238,7 @@ public:
Arguments: Arguments:
nsIAtom* aTag - tag you want nsIAtom* aTag - tag you want
*/ */
already_AddRefed<mozilla::dom::Element> CreateHTMLContent(nsIAtom* aTag); already_AddRefed<Element> CreateHTMLContent(nsIAtom* aTag);
// IME event handlers // IME event handlers
virtual nsresult BeginIMEComposition(mozilla::WidgetCompositionEvent* aEvent); virtual nsresult BeginIMEComposition(mozilla::WidgetCompositionEvent* aEvent);
@ -253,15 +255,14 @@ protected:
* returns null. * returns null.
*/ */
already_AddRefed<mozilla::dom::ChangeAttributeTxn> already_AddRefed<mozilla::dom::ChangeAttributeTxn>
CreateTxnForSetAttribute(mozilla::dom::Element& aElement, CreateTxnForSetAttribute(Element& aElement, nsIAtom& aAttribute,
nsIAtom& aAttribute, const nsAString& aValue); const nsAString& aValue);
/** Create a transaction for removing aAttribute on aElement. Never returns /** Create a transaction for removing aAttribute on aElement. Never returns
* null. * null.
*/ */
already_AddRefed<mozilla::dom::ChangeAttributeTxn> already_AddRefed<mozilla::dom::ChangeAttributeTxn>
CreateTxnForRemoveAttribute(mozilla::dom::Element& aElement, CreateTxnForRemoveAttribute(Element& aElement, nsIAtom& aAttribute);
nsIAtom& aAttribute);
/** create a transaction for creating a new child node of aParent of type aTag. /** create a transaction for creating a new child node of aParent of type aTag.
*/ */
@ -270,9 +271,8 @@ protected:
nsINode& aParent, nsINode& aParent,
int32_t aPosition); int32_t aPosition);
already_AddRefed<mozilla::dom::Element> CreateNode(nsIAtom* aTag, already_AddRefed<Element> CreateNode(nsIAtom* aTag, nsINode* aParent,
nsINode* aParent, int32_t aPosition);
int32_t aPosition);
/** create a transaction for inserting aNode as a child of aParent. /** create a transaction for inserting aNode as a child of aParent.
*/ */
@ -302,8 +302,8 @@ protected:
* returns null. * returns null.
*/ */
already_AddRefed<mozilla::dom::InsertTextTxn> already_AddRefed<mozilla::dom::InsertTextTxn>
CreateTxnForInsertText(const nsAString& aStringToInsert, CreateTxnForInsertText(const nsAString& aStringToInsert, Text& aTextNode,
mozilla::dom::Text& aTextNode, int32_t aOffset); int32_t aOffset);
// Never returns null. // Never returns null.
already_AddRefed<mozilla::dom::IMETextTxn> already_AddRefed<mozilla::dom::IMETextTxn>
@ -365,7 +365,7 @@ protected:
NS_IMETHOD NotifyDocumentListeners(TDocumentListenerNotification aNotificationType); NS_IMETHOD NotifyDocumentListeners(TDocumentListenerNotification aNotificationType);
/** make the given selection span the entire document */ /** make the given selection span the entire document */
virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection); virtual nsresult SelectEntireDocument(Selection* aSelection);
/** helper method for scrolling the selection into view after /** helper method for scrolling the selection into view after
* an edit operation. aScrollToAnchor should be true if you * an edit operation. aScrollToAnchor should be true if you
@ -431,8 +431,8 @@ public:
/** routines for managing the preservation of selection across /** routines for managing the preservation of selection across
* various editor actions */ * various editor actions */
bool ArePreservingSelection(); bool ArePreservingSelection();
void PreserveSelectionAcrossActions(mozilla::dom::Selection* aSel); void PreserveSelectionAcrossActions(Selection* aSel);
nsresult RestorePreservedSelection(mozilla::dom::Selection* aSel); nsresult RestorePreservedSelection(Selection* aSel);
void StopPreservingSelection(); void StopPreservingSelection();
/** /**
@ -603,22 +603,22 @@ public:
static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, int32_t aOffset); static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, int32_t aOffset);
static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, int32_t aOffset); static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, int32_t aOffset);
static nsresult GetStartNodeAndOffset(mozilla::dom::Selection* aSelection, static nsresult GetStartNodeAndOffset(Selection* aSelection,
nsIDOMNode** outStartNode, nsIDOMNode** outStartNode,
int32_t* outStartOffset); int32_t* outStartOffset);
static nsresult GetStartNodeAndOffset(mozilla::dom::Selection* aSelection, static nsresult GetStartNodeAndOffset(Selection* aSelection,
nsINode** aStartNode, nsINode** aStartNode,
int32_t* aStartOffset); int32_t* aStartOffset);
static nsresult GetEndNodeAndOffset(mozilla::dom::Selection* aSelection, static nsresult GetEndNodeAndOffset(Selection* aSelection,
nsIDOMNode** outEndNode, nsIDOMNode** outEndNode,
int32_t* outEndOffset); int32_t* outEndOffset);
static nsresult GetEndNodeAndOffset(mozilla::dom::Selection* aSelection, static nsresult GetEndNodeAndOffset(Selection* aSelection,
nsINode** aEndNode, nsINode** aEndNode,
int32_t* aEndOffset); int32_t* aEndOffset);
#if DEBUG_JOE #if DEBUG_JOE
static void DumpNode(nsIDOMNode *aNode, int32_t indent=0); static void DumpNode(nsIDOMNode *aNode, int32_t indent=0);
#endif #endif
mozilla::dom::Selection* GetSelection(int16_t aSelectionType = Selection* GetSelection(int16_t aSelectionType =
nsISelectionController::SELECTION_NORMAL); nsISelectionController::SELECTION_NORMAL);
// Helpers to add a node to the selection. // Helpers to add a node to the selection.
@ -653,7 +653,7 @@ public:
virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent); virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
nsresult HandleInlineSpellCheck(EditAction action, nsresult HandleInlineSpellCheck(EditAction action,
mozilla::dom::Selection* aSelection, Selection* aSelection,
nsIDOMNode *previousSelectedNode, nsIDOMNode *previousSelectedNode,
int32_t previousSelectedOffset, int32_t previousSelectedOffset,
nsIDOMNode *aStartNode, nsIDOMNode *aStartNode,
@ -664,15 +664,15 @@ public:
virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget() = 0; virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget() = 0;
// Fast non-refcounting editor root element accessor // Fast non-refcounting editor root element accessor
mozilla::dom::Element *GetRoot(); Element* GetRoot();
// Likewise, but gets the editor's root instead, which is different for HTML // Likewise, but gets the editor's root instead, which is different for HTML
// editors // editors
virtual mozilla::dom::Element* GetEditorRoot(); virtual Element* GetEditorRoot();
// Likewise, but gets the text control element instead of the root for // Likewise, but gets the text control element instead of the root for
// plaintext editors // plaintext editors
mozilla::dom::Element* GetExposedRoot(); Element* GetExposedRoot();
// Accessor methods to flags // Accessor methods to flags
bool IsPlaintextEditor() const bool IsPlaintextEditor() const
@ -835,8 +835,8 @@ protected:
nsCOMPtr<nsIInlineSpellChecker> mInlineSpellChecker; nsCOMPtr<nsIInlineSpellChecker> mInlineSpellChecker;
RefPtr<nsTransactionManager> mTxnMgr; RefPtr<nsTransactionManager> mTxnMgr;
nsCOMPtr<mozilla::dom::Element> mRootElement; // cached root node nsCOMPtr<Element> mRootElement; // cached root node
RefPtr<mozilla::dom::Text> mIMETextNode; // current IME text node RefPtr<Text> mIMETextNode; // current IME text node
nsCOMPtr<mozilla::dom::EventTarget> mEventTarget; // The form field as an event receiver nsCOMPtr<mozilla::dom::EventTarget> mEventTarget; // The form field as an event receiver
nsCOMPtr<nsIDOMEventListener> mEventListener; nsCOMPtr<nsIDOMEventListener> mEventListener;
nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController
@ -851,11 +851,11 @@ protected:
// various listeners // various listeners
// Listens to all low level actions on the doc // Listens to all low level actions on the doc
nsTArray<mozilla::OwningNonNull<nsIEditActionListener>> mActionListeners; nsTArray<OwningNonNull<nsIEditActionListener>> mActionListeners;
// Just notify once per high level change // Just notify once per high level change
nsTArray<mozilla::OwningNonNull<nsIEditorObserver>> mEditorObservers; nsTArray<OwningNonNull<nsIEditorObserver>> mEditorObservers;
// Listen to overall doc state (dirty or not, just created, etc) // Listen to overall doc state (dirty or not, just created, etc)
nsTArray<mozilla::OwningNonNull<nsIDocumentStateListener>> mDocStateListeners; nsTArray<OwningNonNull<nsIDocumentStateListener>> mDocStateListeners;
nsSelectionState mSavedSel; // cached selection for nsAutoSelectionReset nsSelectionState mSavedSel; // cached selection for nsAutoSelectionReset
nsRangeUpdater mRangeUpdater; // utility class object for maintaining preserved ranges nsRangeUpdater mRangeUpdater; // utility class object for maintaining preserved ranges

Просмотреть файл

@ -75,10 +75,10 @@ public:
nsIEditor::EDirection aDirection) override; nsIEditor::EDirection aDirection) override;
NS_IMETHOD AfterEdit(EditAction action, NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection) override; nsIEditor::EDirection aDirection) override;
NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo, NS_IMETHOD WillDoAction(Selection* aSelection, nsRulesInfo* aInfo,
bool* aCancel, bool* aHandled) override; bool* aCancel, bool* aHandled) override;
NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection, NS_IMETHOD DidDoAction(Selection* aSelection, nsRulesInfo* aInfo,
nsRulesInfo* aInfo, nsresult aResult) override; nsresult aResult) override;
NS_IMETHOD DocumentModified() override; NS_IMETHOD DocumentModified() override;
nsresult GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL); nsresult GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL);
@ -120,30 +120,29 @@ protected:
void InitFields(); void InitFields();
// nsHTMLEditRules implementation methods // nsHTMLEditRules implementation methods
void WillInsert(mozilla::dom::Selection& aSelection, bool* aCancel); void WillInsert(Selection& aSelection, bool* aCancel);
nsresult WillInsertText( EditAction aAction, nsresult WillInsertText( EditAction aAction,
mozilla::dom::Selection* aSelection, Selection* aSelection,
bool *aCancel, bool *aCancel,
bool *aHandled, bool *aHandled,
const nsAString *inString, const nsAString *inString,
nsAString *outString, nsAString *outString,
int32_t aMaxLength); int32_t aMaxLength);
nsresult WillLoadHTML(mozilla::dom::Selection* aSelection, bool* aCancel); nsresult WillLoadHTML(Selection* aSelection, bool* aCancel);
nsresult WillInsertBreak(mozilla::dom::Selection& aSelection, nsresult WillInsertBreak(Selection& aSelection, bool* aCancel,
bool* aCancel, bool* aHandled); bool* aHandled);
nsresult StandardBreakImpl(nsINode& aNode, int32_t aOffset, nsresult StandardBreakImpl(nsINode& aNode, int32_t aOffset,
mozilla::dom::Selection& aSelection); Selection& aSelection);
nsresult DidInsertBreak(mozilla::dom::Selection* aSelection, nsresult DidInsertBreak(Selection* aSelection, nsresult aResult);
nsresult aResult); nsresult SplitMailCites(Selection* aSelection, bool* aHandled);
nsresult SplitMailCites(mozilla::dom::Selection* aSelection, bool* aHandled); nsresult WillDeleteSelection(Selection* aSelection,
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection,
nsIEditor::EDirection aAction, nsIEditor::EDirection aAction,
nsIEditor::EStripWrappers aStripWrappers, nsIEditor::EStripWrappers aStripWrappers,
bool* aCancel, bool* aHandled); bool* aCancel, bool* aHandled);
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection, nsresult DidDeleteSelection(Selection* aSelection,
nsIEditor::EDirection aDir, nsIEditor::EDirection aDir,
nsresult aResult); nsresult aResult);
nsresult InsertBRIfNeeded(mozilla::dom::Selection* aSelection); nsresult InsertBRIfNeeded(Selection* aSelection);
::DOMPoint GetGoodSelPointForNode(nsINode& aNode, ::DOMPoint GetGoodSelPointForNode(nsINode& aNode,
nsIEditor::EDirection aAction); nsIEditor::EDirection aAction);
nsresult JoinBlocks(nsIContent& aLeftNode, nsIContent& aRightNode, nsresult JoinBlocks(nsIContent& aLeftNode, nsIContent& aRightNode,
@ -152,72 +151,63 @@ protected:
nsresult MoveNodeSmart(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset); nsresult MoveNodeSmart(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset);
nsresult MoveContents(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset); nsresult MoveContents(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset);
nsresult DeleteNonTableElements(nsINode* aNode); nsresult DeleteNonTableElements(nsINode* aNode);
nsresult WillMakeList(mozilla::dom::Selection* aSelection, nsresult WillMakeList(Selection* aSelection,
const nsAString* aListType, const nsAString* aListType,
bool aEntireList, bool aEntireList,
const nsAString* aBulletType, const nsAString* aBulletType,
bool* aCancel, bool* aHandled, bool* aCancel, bool* aHandled,
const nsAString* aItemType = nullptr); const nsAString* aItemType = nullptr);
nsresult WillRemoveList(mozilla::dom::Selection* aSelection, nsresult WillRemoveList(Selection* aSelection, bool aOrdered, bool* aCancel,
bool aOrdered, bool* aCancel, bool* aHandled); bool* aHandled);
nsresult WillIndent(mozilla::dom::Selection* aSelection, nsresult WillIndent(Selection* aSelection, bool* aCancel, bool* aHandled);
bool* aCancel, bool* aHandled); nsresult WillCSSIndent(Selection* aSelection, bool* aCancel, bool* aHandled);
nsresult WillCSSIndent(mozilla::dom::Selection* aSelection, nsresult WillHTMLIndent(Selection* aSelection, bool* aCancel,
bool* aCancel, bool* aHandled); bool* aHandled);
nsresult WillHTMLIndent(mozilla::dom::Selection* aSelection, nsresult WillOutdent(Selection* aSelection, bool* aCancel, bool* aHandled);
bool* aCancel, bool* aHandled); nsresult WillAlign(Selection& aSelection, const nsAString& aAlignType,
nsresult WillOutdent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillAlign(mozilla::dom::Selection& aSelection,
const nsAString& aAlignType,
bool* aCancel, bool* aHandled); bool* aCancel, bool* aHandled);
nsresult WillAbsolutePosition(mozilla::dom::Selection* aSelection, nsresult WillAbsolutePosition(Selection* aSelection, bool* aCancel,
bool* aCancel, bool* aHandled); bool* aHandled);
nsresult WillRemoveAbsolutePosition(mozilla::dom::Selection* aSelection, nsresult WillRemoveAbsolutePosition(Selection* aSelection, bool* aCancel,
bool* aCancel, bool* aHandled); bool* aHandled);
nsresult WillRelativeChangeZIndex(mozilla::dom::Selection* aSelection, nsresult WillRelativeChangeZIndex(Selection* aSelection, int32_t aChange,
int32_t aChange,
bool* aCancel, bool* aHandled); bool* aCancel, bool* aHandled);
nsresult WillMakeDefListItem(mozilla::dom::Selection* aSelection, nsresult WillMakeDefListItem(Selection* aSelection,
const nsAString* aBlockType, bool aEntireList, const nsAString* aBlockType, bool aEntireList,
bool* aCancel, bool* aHandled); bool* aCancel, bool* aHandled);
nsresult WillMakeBasicBlock(mozilla::dom::Selection* aSelection, nsresult WillMakeBasicBlock(Selection* aSelection,
const nsAString* aBlockType, const nsAString* aBlockType,
bool* aCancel, bool* aHandled); bool* aCancel, bool* aHandled);
nsresult DidMakeBasicBlock(mozilla::dom::Selection* aSelection, nsresult DidMakeBasicBlock(Selection* aSelection, nsRulesInfo* aInfo,
nsRulesInfo* aInfo, nsresult aResult); nsresult aResult);
nsresult DidAbsolutePosition(); nsresult DidAbsolutePosition();
nsresult AlignInnerBlocks(nsINode& aNode, const nsAString* alignType); nsresult AlignInnerBlocks(nsINode& aNode, const nsAString* alignType);
nsresult AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType); nsresult AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType);
nsresult AppendInnerFormatNodes(nsTArray<mozilla::OwningNonNull<nsINode>>& aArray, nsresult AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
nsINode* aNode); nsINode* aNode);
nsresult GetFormatString(nsIDOMNode *aNode, nsAString &outFormat); nsresult GetFormatString(nsIDOMNode *aNode, nsAString &outFormat);
enum class Lists { no, yes }; enum class Lists { no, yes };
enum class Tables { no, yes }; enum class Tables { no, yes };
void GetInnerContent(nsINode& aNode, void GetInnerContent(nsINode& aNode,
nsTArray<mozilla::OwningNonNull<nsINode>>& aOutArrayOfNodes, nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
int32_t* aIndex, Lists aLists = Lists::yes, int32_t* aIndex, Lists aLists = Lists::yes,
Tables aTables = Tables::yes); Tables aTables = Tables::yes);
mozilla::dom::Element* IsInListItem(nsINode* aNode); Element* IsInListItem(nsINode* aNode);
nsresult ReturnInHeader(mozilla::dom::Selection& aSelection, nsresult ReturnInHeader(Selection& aSelection, Element& aHeader,
mozilla::dom::Element& aHeader, nsINode& aNode, nsINode& aNode, int32_t aOffset);
int32_t aOffset); nsresult ReturnInParagraph(Selection* aSelection, nsIDOMNode* aHeader,
nsresult ReturnInParagraph(mozilla::dom::Selection* aSelection, nsIDOMNode* aTextNode, int32_t aOffset,
nsIDOMNode* aHeader, nsIDOMNode* aTextNode, bool* aCancel, bool* aHandled);
int32_t aOffset, bool* aCancel, bool* aHandled);
nsresult SplitParagraph(nsIDOMNode *aPara, nsresult SplitParagraph(nsIDOMNode *aPara,
nsIDOMNode *aBRNode, nsIDOMNode *aBRNode,
mozilla::dom::Selection* aSelection, Selection* aSelection,
nsCOMPtr<nsIDOMNode> *aSelNode, nsCOMPtr<nsIDOMNode> *aSelNode,
int32_t *aOffset); int32_t *aOffset);
nsresult ReturnInListItem(mozilla::dom::Selection& aSelection, nsresult ReturnInListItem(Selection& aSelection, Element& aHeader,
mozilla::dom::Element& aHeader, nsINode& aNode, int32_t aOffset);
nsINode& aNode,
int32_t aOffset);
nsresult AfterEditInner(EditAction action, nsresult AfterEditInner(EditAction action,
nsIEditor::EDirection aDirection); nsIEditor::EDirection aDirection);
nsresult RemovePartOfBlock(mozilla::dom::Element& aBlock, nsresult RemovePartOfBlock(Element& aBlock, nsIContent& aStartChild,
nsIContent& aStartChild,
nsIContent& aEndChild); nsIContent& aEndChild);
nsresult SplitBlock(nsIDOMNode *aBlock, nsresult SplitBlock(nsIDOMNode *aBlock,
nsIDOMNode *aStartChild, nsIDOMNode *aStartChild,
@ -236,86 +226,79 @@ protected:
nsCOMPtr<nsIDOMNode>* outList, nsCOMPtr<nsIDOMNode>* outList,
nsIAtom* aListType, nsIAtom* aListType,
nsIAtom* aItemType); nsIAtom* aItemType);
nsresult ConvertListType(mozilla::dom::Element* aList, nsresult ConvertListType(Element* aList, Element** aOutList,
mozilla::dom::Element** aOutList, nsIAtom* aListType, nsIAtom* aItemType);
nsIAtom* aListType,
nsIAtom* aItemType);
nsresult CreateStyleForInsertText(mozilla::dom::Selection& aSelection, nsresult CreateStyleForInsertText(Selection& aSelection, nsIDocument& aDoc);
nsIDocument& aDoc);
enum class MozBRCounts { yes, no }; enum class MozBRCounts { yes, no };
nsresult IsEmptyBlock(mozilla::dom::Element& aNode, nsresult IsEmptyBlock(Element& aNode, bool* aOutIsEmptyBlock,
bool* aOutIsEmptyBlock,
MozBRCounts aMozBRCounts = MozBRCounts::yes); MozBRCounts aMozBRCounts = MozBRCounts::yes);
nsresult CheckForEmptyBlock(nsINode* aStartNode, nsresult CheckForEmptyBlock(nsINode* aStartNode, Element* aBodyNode,
mozilla::dom::Element* aBodyNode, Selection* aSelection,
mozilla::dom::Selection* aSelection, nsIEditor::EDirection aAction, bool* aHandled);
nsIEditor::EDirection aAction,
bool* aHandled);
enum class BRLocation { beforeBlock, blockEnd }; enum class BRLocation { beforeBlock, blockEnd };
mozilla::dom::Element* CheckForInvisibleBR(mozilla::dom::Element& aBlock, Element* CheckForInvisibleBR(Element& aBlock, BRLocation aWhere,
BRLocation aWhere, int32_t aOffset = 0);
int32_t aOffset = 0); nsresult ExpandSelectionForDeletion(Selection& aSelection);
nsresult ExpandSelectionForDeletion(mozilla::dom::Selection& aSelection);
bool IsFirstNode(nsIDOMNode *aNode); bool IsFirstNode(nsIDOMNode *aNode);
bool IsLastNode(nsIDOMNode *aNode); bool IsLastNode(nsIDOMNode *aNode);
nsresult NormalizeSelection(mozilla::dom::Selection* aSelection); nsresult NormalizeSelection(Selection* aSelection);
void GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, void GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
int32_t aOffset, EditAction actionID, int32_t aOffset, EditAction actionID,
nsCOMPtr<nsIDOMNode>* outNode, int32_t* outOffset); nsCOMPtr<nsIDOMNode>* outNode, int32_t* outOffset);
void GetPromotedRanges(mozilla::dom::Selection& aSelection, void GetPromotedRanges(Selection& aSelection,
nsTArray<RefPtr<nsRange>>& outArrayOfRanges, nsTArray<RefPtr<nsRange>>& outArrayOfRanges,
EditAction inOperationType); EditAction inOperationType);
void PromoteRange(nsRange& aRange, EditAction inOperationType); void PromoteRange(nsRange& aRange, EditAction inOperationType);
enum class TouchContent { no, yes }; enum class TouchContent { no, yes };
nsresult GetNodesForOperation(nsTArray<RefPtr<nsRange>>& aArrayOfRanges, nsresult GetNodesForOperation(nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
nsTArray<mozilla::OwningNonNull<nsINode>>& aOutArrayOfNodes, nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
EditAction aOperationType, EditAction aOperationType,
TouchContent aTouchContent = TouchContent::yes); TouchContent aTouchContent = TouchContent::yes);
void GetChildNodesForOperation(nsINode& aNode, void GetChildNodesForOperation(nsINode& aNode,
nsTArray<mozilla::OwningNonNull<nsINode>>& outArrayOfNodes); nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes);
nsresult GetNodesFromPoint(::DOMPoint aPoint, nsresult GetNodesFromPoint(::DOMPoint aPoint,
EditAction aOperation, EditAction aOperation,
nsTArray<mozilla::OwningNonNull<nsINode>>& outArrayOfNodes, nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
TouchContent aTouchContent); TouchContent aTouchContent);
nsresult GetNodesFromSelection(mozilla::dom::Selection& aSelection, nsresult GetNodesFromSelection(Selection& aSelection,
EditAction aOperation, EditAction aOperation,
nsTArray<mozilla::OwningNonNull<nsINode>>& outArrayOfNodes, nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
TouchContent aTouchContent = TouchContent::yes); TouchContent aTouchContent = TouchContent::yes);
enum class EntireList { no, yes }; enum class EntireList { no, yes };
nsresult GetListActionNodes(nsTArray<mozilla::OwningNonNull<nsINode>>& aOutArrayOfNodes, nsresult GetListActionNodes(nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
EntireList aEntireList, EntireList aEntireList,
TouchContent aTouchContent = TouchContent::yes); TouchContent aTouchContent = TouchContent::yes);
void GetDefinitionListItemTypes(mozilla::dom::Element* aElement, bool* aDT, bool* aDD); void GetDefinitionListItemTypes(Element* aElement, bool* aDT, bool* aDD);
nsresult GetParagraphFormatNodes( nsresult GetParagraphFormatNodes(
nsTArray<mozilla::OwningNonNull<nsINode>>& outArrayOfNodes, nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
TouchContent aTouchContent = TouchContent::yes); TouchContent aTouchContent = TouchContent::yes);
void LookInsideDivBQandList(nsTArray<mozilla::OwningNonNull<nsINode>>& aNodeArray); void LookInsideDivBQandList(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
nsresult BustUpInlinesAtRangeEndpoints(nsRangeStore &inRange); nsresult BustUpInlinesAtRangeEndpoints(nsRangeStore &inRange);
nsresult BustUpInlinesAtBRs(nsIContent& aNode, nsresult BustUpInlinesAtBRs(nsIContent& aNode,
nsTArray<mozilla::OwningNonNull<nsINode>>& aOutArrayOfNodes); nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes);
nsIContent* GetHighestInlineParent(nsINode& aNode); nsIContent* GetHighestInlineParent(nsINode& aNode);
void MakeTransitionList(nsTArray<mozilla::OwningNonNull<nsINode>>& aNodeArray, void MakeTransitionList(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
nsTArray<bool>& aTransitionArray); nsTArray<bool>& aTransitionArray);
nsresult RemoveBlockStyle(nsTArray<mozilla::OwningNonNull<nsINode>>& aNodeArray); nsresult RemoveBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
nsresult ApplyBlockStyle(nsTArray<mozilla::OwningNonNull<nsINode>>& aNodeArray, nsresult ApplyBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
nsIAtom& aBlockTag); nsIAtom& aBlockTag);
nsresult MakeBlockquote(nsTArray<mozilla::OwningNonNull<nsINode>>& aNodeArray); nsresult MakeBlockquote(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
nsresult SplitAsNeeded(nsIAtom& aTag, nsCOMPtr<nsINode>& inOutParent, nsresult SplitAsNeeded(nsIAtom& aTag, nsCOMPtr<nsINode>& inOutParent,
int32_t& inOutOffset); int32_t& inOutOffset);
nsresult AddTerminatingBR(nsIDOMNode *aBlock); nsresult AddTerminatingBR(nsIDOMNode *aBlock);
::DOMPoint JoinNodesSmart(nsIContent& aNodeLeft, nsIContent& aNodeRight); ::DOMPoint JoinNodesSmart(nsIContent& aNodeLeft, nsIContent& aNodeRight);
mozilla::dom::Element* GetTopEnclosingMailCite(nsINode& aNode); Element* GetTopEnclosingMailCite(nsINode& aNode);
nsresult PopListItem(nsIDOMNode *aListItem, bool *aOutOfList); nsresult PopListItem(nsIDOMNode *aListItem, bool *aOutOfList);
nsresult RemoveListStructure(nsIDOMNode *aList); nsresult RemoveListStructure(nsIDOMNode *aList);
nsresult CacheInlineStyles(nsIDOMNode *aNode); nsresult CacheInlineStyles(nsIDOMNode *aNode);
nsresult ReapplyCachedStyles(); nsresult ReapplyCachedStyles();
void ClearCachedStyles(); void ClearCachedStyles();
void AdjustSpecialBreaks(); void AdjustSpecialBreaks();
nsresult AdjustWhitespace(mozilla::dom::Selection* aSelection); nsresult AdjustWhitespace(Selection* aSelection);
nsresult PinSelectionToNewBlock(mozilla::dom::Selection* aSelection); nsresult PinSelectionToNewBlock(Selection* aSelection);
void CheckInterlinePosition(mozilla::dom::Selection& aSelection); void CheckInterlinePosition(Selection& aSelection);
nsresult AdjustSelection(mozilla::dom::Selection* aSelection, nsresult AdjustSelection(Selection* aSelection,
nsIEditor::EDirection aAction); nsIEditor::EDirection aAction);
nsresult FindNearSelectableNode(nsIDOMNode *aSelNode, nsresult FindNearSelectableNode(nsIDOMNode *aSelNode,
int32_t aSelOffset, int32_t aSelOffset,
@ -336,11 +319,11 @@ protected:
nsresult ConfirmSelectionInBody(); nsresult ConfirmSelectionInBody();
nsresult InsertMozBRIfNeeded(nsINode& aNode); nsresult InsertMozBRIfNeeded(nsINode& aNode);
bool IsEmptyInline(nsINode& aNode); bool IsEmptyInline(nsINode& aNode);
bool ListIsEmptyLine(nsTArray<mozilla::OwningNonNull<nsINode>>& arrayOfNodes); bool ListIsEmptyLine(nsTArray<OwningNonNull<nsINode>>& arrayOfNodes);
nsresult RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignType, bool aChildrenOnly); nsresult RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignType, bool aChildrenOnly);
nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, bool aStarts); nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, bool aStarts);
enum class ContentsOnly { no, yes }; enum class ContentsOnly { no, yes };
nsresult AlignBlock(mozilla::dom::Element& aElement, nsresult AlignBlock(Element& aElement,
const nsAString& aAlignType, ContentsOnly aContentsOnly); const nsAString& aAlignType, ContentsOnly aContentsOnly);
nsresult RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, int8_t aRelativeChange); nsresult RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, int8_t aRelativeChange);
void DocumentModifiedWorker(); void DocumentModifiedWorker();

Просмотреть файл

@ -110,7 +110,7 @@ public:
virtual already_AddRefed<nsIContent> GetFocusedContentForIME() override; virtual already_AddRefed<nsIContent> GetFocusedContentForIME() override;
virtual bool IsActiveInDOMWindow() override; virtual bool IsActiveInDOMWindow() override;
virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget() override; virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget() override;
virtual mozilla::dom::Element* GetEditorRoot() override; virtual Element* GetEditorRoot() override;
virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode) override; virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode) override;
virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent) override; virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent) override;
virtual already_AddRefed<nsIContent> GetInputEventTargetContent() override; virtual already_AddRefed<nsIContent> GetInputEventTargetContent() override;
@ -143,7 +143,7 @@ public:
/* ------------ nsIHTMLEditor methods -------------- */ /* ------------ nsIHTMLEditor methods -------------- */
nsresult CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock, nsresult CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
mozilla::dom::Element** aOutBrNode); Element** aOutBrNode);
nsresult LoadHTML(const nsAString &aInputString); nsresult LoadHTML(const nsAString &aInputString);
@ -232,9 +232,9 @@ public:
nsresult SetHTMLBackgroundColor(const nsAString& aColor); nsresult SetHTMLBackgroundColor(const nsAString& aColor);
/* ------------ Block methods moved from nsEditor -------------- */ /* ------------ Block methods moved from nsEditor -------------- */
static mozilla::dom::Element* GetBlockNodeParent(nsINode* aNode); static Element* GetBlockNodeParent(nsINode* aNode);
static nsIDOMNode* GetBlockNodeParent(nsIDOMNode* aNode); static nsIDOMNode* GetBlockNodeParent(nsIDOMNode* aNode);
static mozilla::dom::Element* GetBlock(nsINode& aNode); static Element* GetBlock(nsINode& aNode);
void IsNextCharInNodeWhitespace(nsIContent* aContent, void IsNextCharInNodeWhitespace(nsIContent* aContent,
int32_t aOffset, int32_t aOffset,
@ -298,7 +298,7 @@ public:
virtual bool IsContainer(nsIDOMNode* aNode) override; virtual bool IsContainer(nsIDOMNode* aNode) override;
/** make the given selection span the entire document */ /** make the given selection span the entire document */
virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection) override; virtual nsresult SelectEntireDocument(Selection* aSelection) override;
NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement, NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
const nsAString & aAttribute, const nsAString & aAttribute,
@ -350,8 +350,8 @@ public:
// This will stop at a table, however, since we don't want to // This will stop at a table, however, since we don't want to
// "drill down" into nested tables. // "drill down" into nested tables.
// aSelection is optional -- if null, we get current seletion // aSelection is optional -- if null, we get current seletion
void CollapseSelectionToDeepestNonTableFirstChild( void CollapseSelectionToDeepestNonTableFirstChild(Selection* aSelection,
mozilla::dom::Selection* aSelection, nsINode* aNode); nsINode* aNode);
/** /**
* aNode must be a non-null text node. * aNode must be a non-null text node.
@ -395,7 +395,7 @@ public:
return mCSSAware && mHTMLCSSUtils && mHTMLCSSUtils->IsCSSPrefChecked(); return mCSSAware && mHTMLCSSUtils && mHTMLCSSUtils->IsCSSPrefChecked();
} }
static bool HasAttributes(mozilla::dom::Element* aElement) static bool HasAttributes(Element* aElement)
{ {
MOZ_ASSERT(aElement); MOZ_ASSERT(aElement);
uint32_t attrCount = aElement->GetAttrCount(); uint32_t attrCount = aElement->GetAttrCount();
@ -426,8 +426,8 @@ protected:
// key event helpers // key event helpers
NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled); NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled);
mozilla::dom::Element* CreateBR(nsINode* aNode, int32_t aOffset, Element* CreateBR(nsINode* aNode, int32_t aOffset,
EDirection aSelect = eNone); EDirection aSelect = eNone);
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset, NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset,
nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone) override; nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone) override;
@ -449,8 +449,7 @@ protected:
// Move all contents from aCellToMerge into aTargetCell (append at end) // Move all contents from aCellToMerge into aTargetCell (append at end)
NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, bool aDeleteCellToMerge); NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, bool aDeleteCellToMerge);
nsresult DeleteTable2(nsIDOMElement* aTable, nsresult DeleteTable2(nsIDOMElement* aTable, Selection* aSelection);
mozilla::dom::Selection* aSelection);
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, int32_t aColSpan); NS_IMETHOD SetColSpan(nsIDOMElement *aCell, int32_t aColSpan);
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan); NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan);
@ -463,17 +462,17 @@ protected:
bool AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aNumberOfColumns); bool AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aNumberOfColumns);
bool AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex, int32_t aNumberOfRows); bool AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex, int32_t aNumberOfRows);
bool IsEmptyCell(mozilla::dom::Element* aCell); bool IsEmptyCell(Element* aCell);
// Most insert methods need to get the same basic context data // Most insert methods need to get the same basic context data
// Any of the pointers may be null if you don't need that datum (for more efficiency) // Any of the pointers may be null if you don't need that datum (for more efficiency)
// Input: *aCell is a known cell, // Input: *aCell is a known cell,
// if null, cell is obtained from the anchor node of the selection // if null, cell is obtained from the anchor node of the selection
// Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null // Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
nsresult GetCellContext(mozilla::dom::Selection** aSelection, nsresult GetCellContext(Selection** aSelection, nsIDOMElement** aTable,
nsIDOMElement** aTable, nsIDOMElement** aCell, nsIDOMElement** aCell, nsIDOMNode** aCellParent,
nsIDOMNode** aCellParent, int32_t* aCellOffset, int32_t* aCellOffset, int32_t* aRowIndex,
int32_t* aRowIndex, int32_t* aColIndex); int32_t* aColIndex);
NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
int32_t& aActualRowSpan, int32_t& aActualColSpan); int32_t& aActualRowSpan, int32_t& aActualColSpan);
@ -492,11 +491,11 @@ protected:
// Fallback method: Call this after using ClearSelection() and you // Fallback method: Call this after using ClearSelection() and you
// failed to set selection to some other content in the document // failed to set selection to some other content in the document
nsresult SetSelectionAtDocumentStart(mozilla::dom::Selection* aSelection); nsresult SetSelectionAtDocumentStart(Selection* aSelection);
// End of Table Editing utilities // End of Table Editing utilities
static mozilla::dom::Element* GetEnclosingTable(nsINode* aNode); static Element* GetEnclosingTable(nsINode* aNode);
static nsIDOMNode* GetEnclosingTable(nsIDOMNode *aNode); static nsIDOMNode* GetEnclosingTable(nsIDOMNode *aNode);
/** content-based query returns true if <aProperty aAttribute=aValue> effects aNode /** content-based query returns true if <aProperty aAttribute=aValue> effects aNode
@ -597,7 +596,7 @@ protected:
mozilla::dom::DocumentFragment** aFragment, mozilla::dom::DocumentFragment** aFragment,
bool aTrustedInput); bool aTrustedInput);
void CreateListOfNodesToPaste(mozilla::dom::DocumentFragment& aFragment, void CreateListOfNodesToPaste(mozilla::dom::DocumentFragment& aFragment,
nsTArray<mozilla::OwningNonNull<nsINode>>& outNodeList, nsTArray<OwningNonNull<nsINode>>& outNodeList,
nsINode* aStartNode, nsINode* aStartNode,
int32_t aStartOffset, int32_t aStartOffset,
nsINode* aEndNode, nsINode* aEndNode,
@ -606,16 +605,16 @@ protected:
nsIDOMNode *aNode); nsIDOMNode *aNode);
enum class StartOrEnd { start, end }; enum class StartOrEnd { start, end };
void GetListAndTableParents(StartOrEnd aStartOrEnd, void GetListAndTableParents(StartOrEnd aStartOrEnd,
nsTArray<mozilla::OwningNonNull<nsINode>>& aNodeList, nsTArray<OwningNonNull<nsINode>>& aNodeList,
nsTArray<mozilla::OwningNonNull<mozilla::dom::Element>>& outArray); nsTArray<OwningNonNull<Element>>& outArray);
int32_t DiscoverPartialListsAndTables(nsTArray<mozilla::OwningNonNull<nsINode>>& aPasteNodes, int32_t DiscoverPartialListsAndTables(nsTArray<OwningNonNull<nsINode>>& aPasteNodes,
nsTArray<mozilla::OwningNonNull<mozilla::dom::Element>>& aListsAndTables); nsTArray<OwningNonNull<Element>>& aListsAndTables);
nsINode* ScanForListAndTableStructure(StartOrEnd aStartOrEnd, nsINode* ScanForListAndTableStructure(StartOrEnd aStartOrEnd,
nsTArray<mozilla::OwningNonNull<nsINode>>& aNodes, nsTArray<OwningNonNull<nsINode>>& aNodes,
mozilla::dom::Element& aListOrTable); Element& aListOrTable);
void ReplaceOrphanedStructure(StartOrEnd aStartOrEnd, void ReplaceOrphanedStructure(StartOrEnd aStartOrEnd,
nsTArray<mozilla::OwningNonNull<nsINode>>& aNodeArray, nsTArray<OwningNonNull<nsINode>>& aNodeArray,
nsTArray<mozilla::OwningNonNull<mozilla::dom::Element>>& aListAndTableArray, nsTArray<OwningNonNull<Element>>& aListAndTableArray,
int32_t aHighWaterMark); int32_t aHighWaterMark);
/* small utility routine to test if a break node is visible to user */ /* small utility routine to test if a break node is visible to user */
@ -641,14 +640,14 @@ protected:
/* helper routines for font size changing */ /* helper routines for font size changing */
nsresult RelativeFontChangeOnTextNode(FontSize aDir, nsresult RelativeFontChangeOnTextNode(FontSize aDir,
mozilla::dom::Text& aTextNode, Text& aTextNode,
int32_t aStartOffset, int32_t aStartOffset,
int32_t aEndOffset); int32_t aEndOffset);
nsresult RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode); nsresult RelativeFontChangeOnNode(int32_t aSizeChange, nsIContent* aNode);
nsresult RelativeFontChangeHelper(int32_t aSizeChange, nsINode* aNode); nsresult RelativeFontChangeHelper(int32_t aSizeChange, nsINode* aNode);
/* helper routines for inline style */ /* helper routines for inline style */
nsresult SetInlinePropertyOnTextNode(mozilla::dom::Text& aData, nsresult SetInlinePropertyOnTextNode(Text& aData,
int32_t aStartOffset, int32_t aStartOffset,
int32_t aEndOffset, int32_t aEndOffset,
nsIAtom& aProperty, nsIAtom& aProperty,
@ -722,8 +721,8 @@ protected:
bool* aAll, bool* aAll,
nsAString* outValue, nsAString* outValue,
bool aCheckDefaults = true); bool aCheckDefaults = true);
bool HasStyleOrIdOrClass(mozilla::dom::Element* aElement); bool HasStyleOrIdOrClass(Element* aElement);
nsresult RemoveElementIfNoStyleOrIdOrClass(mozilla::dom::Element& aElement); nsresult RemoveElementIfNoStyleOrIdOrClass(Element& aElement);
// Whether the outer window of the DOM event target has focus or not. // Whether the outer window of the DOM event target has focus or not.
bool OurWindowHasFocus(); bool OurWindowHasFocus();
@ -752,13 +751,12 @@ protected:
nsresult ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset, nsresult ClearStyle(nsCOMPtr<nsINode>* aNode, int32_t* aOffset,
nsIAtom* aProperty, const nsAString* aAttribute); nsIAtom* aProperty, const nsAString* aAttribute);
void SetElementPosition(mozilla::dom::Element& aElement, void SetElementPosition(Element& aElement, int32_t aX, int32_t aY);
int32_t aX, int32_t aY);
// Data members // Data members
protected: protected:
nsTArray<mozilla::OwningNonNull<nsIContentFilter>> mContentFilters; nsTArray<OwningNonNull<nsIContentFilter>> mContentFilters;
RefPtr<TypeInState> mTypeInState; RefPtr<TypeInState> mTypeInState;
@ -786,7 +784,7 @@ protected:
void RemoveListenerAndDeleteRef(const nsAString& aEvent, void RemoveListenerAndDeleteRef(const nsAString& aEvent,
nsIDOMEventListener* aListener, nsIDOMEventListener* aListener,
bool aUseCapture, bool aUseCapture,
mozilla::dom::Element* aElement, Element* aElement,
nsIContent* aParentContent, nsIContent* aParentContent,
nsIPresShell* aShell); nsIPresShell* aShell);
void DeleteRefToAnonymousNode(nsIDOMElement* aElement, void DeleteRefToAnonymousNode(nsIDOMElement* aElement,
@ -828,27 +826,27 @@ protected:
/* RESIZING */ /* RESIZING */
nsCOMPtr<mozilla::dom::Element> mTopLeftHandle; nsCOMPtr<Element> mTopLeftHandle;
nsCOMPtr<mozilla::dom::Element> mTopHandle; nsCOMPtr<Element> mTopHandle;
nsCOMPtr<mozilla::dom::Element> mTopRightHandle; nsCOMPtr<Element> mTopRightHandle;
nsCOMPtr<mozilla::dom::Element> mLeftHandle; nsCOMPtr<Element> mLeftHandle;
nsCOMPtr<mozilla::dom::Element> mRightHandle; nsCOMPtr<Element> mRightHandle;
nsCOMPtr<mozilla::dom::Element> mBottomLeftHandle; nsCOMPtr<Element> mBottomLeftHandle;
nsCOMPtr<mozilla::dom::Element> mBottomHandle; nsCOMPtr<Element> mBottomHandle;
nsCOMPtr<mozilla::dom::Element> mBottomRightHandle; nsCOMPtr<Element> mBottomRightHandle;
nsCOMPtr<mozilla::dom::Element> mActivatedHandle; nsCOMPtr<Element> mActivatedHandle;
nsCOMPtr<mozilla::dom::Element> mResizingShadow; nsCOMPtr<Element> mResizingShadow;
nsCOMPtr<mozilla::dom::Element> mResizingInfo; nsCOMPtr<Element> mResizingInfo;
nsCOMPtr<mozilla::dom::Element> mResizedObject; nsCOMPtr<Element> mResizedObject;
nsCOMPtr<nsIDOMEventListener> mMouseMotionListenerP; nsCOMPtr<nsIDOMEventListener> mMouseMotionListenerP;
nsCOMPtr<nsISelectionListener> mSelectionListenerP; nsCOMPtr<nsISelectionListener> mSelectionListenerP;
nsCOMPtr<nsIDOMEventListener> mResizeEventListenerP; nsCOMPtr<nsIDOMEventListener> mResizeEventListenerP;
nsTArray<mozilla::OwningNonNull<nsIHTMLObjectResizeListener>> mObjectResizeEventListeners; nsTArray<OwningNonNull<nsIHTMLObjectResizeListener>> mObjectResizeEventListeners;
int32_t mOriginalX; int32_t mOriginalX;
int32_t mOriginalY; int32_t mOriginalY;
@ -873,18 +871,17 @@ protected:
nsresult SetAllResizersPosition(); nsresult SetAllResizersPosition();
already_AddRefed<mozilla::dom::Element> already_AddRefed<Element> CreateResizer(int16_t aLocation,
CreateResizer(int16_t aLocation, nsIDOMNode* aParentNode); nsIDOMNode* aParentNode);
void SetAnonymousElementPosition(int32_t aX, int32_t aY, nsIDOMElement *aResizer); void SetAnonymousElementPosition(int32_t aX, int32_t aY, nsIDOMElement *aResizer);
already_AddRefed<mozilla::dom::Element> already_AddRefed<Element> CreateShadow(nsIDOMNode* aParentNode,
CreateShadow(nsIDOMNode* aParentNode, nsIDOMElement* aOriginalObject); nsIDOMElement* aOriginalObject);
nsresult SetShadowPosition(mozilla::dom::Element* aShadow, nsresult SetShadowPosition(Element* aShadow, Element* aOriginalObject,
mozilla::dom::Element* aOriginalObject,
int32_t aOriginalObjectX, int32_t aOriginalObjectX,
int32_t aOriginalObjectY); int32_t aOriginalObjectY);
already_AddRefed<mozilla::dom::Element> CreateResizingInfo(nsIDOMNode* aParentNode); already_AddRefed<Element> CreateResizingInfo(nsIDOMNode* aParentNode);
nsresult SetResizingInfoPosition(int32_t aX, int32_t aY, nsresult SetResizingInfoPosition(int32_t aX, int32_t aY,
int32_t aW, int32_t aH); int32_t aW, int32_t aH);
@ -912,13 +909,13 @@ protected:
int32_t mPositionedObjectBorderLeft; int32_t mPositionedObjectBorderLeft;
int32_t mPositionedObjectBorderTop; int32_t mPositionedObjectBorderTop;
nsCOMPtr<mozilla::dom::Element> mAbsolutelyPositionedObject; nsCOMPtr<Element> mAbsolutelyPositionedObject;
nsCOMPtr<mozilla::dom::Element> mGrabber; nsCOMPtr<Element> mGrabber;
nsCOMPtr<mozilla::dom::Element> mPositioningShadow; nsCOMPtr<Element> mPositioningShadow;
int32_t mGridSize; int32_t mGridSize;
already_AddRefed<mozilla::dom::Element> CreateGrabber(nsINode* aParentNode); already_AddRefed<Element> CreateGrabber(nsINode* aParentNode);
nsresult StartMoving(nsIDOMElement * aHandle); nsresult StartMoving(nsIDOMElement * aHandle);
nsresult SetFinalPosition(int32_t aX, int32_t aY); nsresult SetFinalPosition(int32_t aX, int32_t aY);
void AddPositioningOffset(int32_t & aX, int32_t & aY); void AddPositioningOffset(int32_t & aX, int32_t & aY);
@ -967,9 +964,9 @@ private:
void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer, void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
nsIContent* aChild, int32_t aIndexInContainer, nsIContent* aChild, int32_t aIndexInContainer,
InsertedOrAppended aInsertedOrAppended); InsertedOrAppended aInsertedOrAppended);
already_AddRefed<mozilla::dom::Element> GetElementOrParentByTagName( already_AddRefed<Element> GetElementOrParentByTagName(
const nsAString& aTagName, nsINode* aNode); const nsAString& aTagName, nsINode* aNode);
already_AddRefed<mozilla::dom::Element> CreateElementWithDefaults( already_AddRefed<Element> CreateElementWithDefaults(
const nsAString& aTagName); const nsAString& aTagName);
}; };
#endif //nsHTMLEditor_h__ #endif //nsHTMLEditor_h__

Просмотреть файл

@ -120,7 +120,7 @@ public:
NS_IMETHOD EndOperation() override; NS_IMETHOD EndOperation() override;
/** make the given selection span the entire document */ /** make the given selection span the entire document */
virtual nsresult SelectEntireDocument(mozilla::dom::Selection* aSelection) override; virtual nsresult SelectEntireDocument(Selection* aSelection) override;
virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) override; virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent) override;
@ -153,7 +153,7 @@ public:
* If done, also update aAction to what's actually left to do after the * If done, also update aAction to what's actually left to do after the
* extension. * extension.
*/ */
nsresult ExtendSelectionForDelete(mozilla::dom::Selection* aSelection, nsresult ExtendSelectionForDelete(Selection* aSelection,
nsIEditor::EDirection *aAction); nsIEditor::EDirection *aAction);
// Return true if the data is safe to insert as the source and destination // Return true if the data is safe to insert as the source and destination
@ -180,9 +180,8 @@ protected:
// key event helpers // key event helpers
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset, NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset,
nsCOMPtr<nsIDOMNode> *outBRNode, EDirection aSelect = eNone); nsCOMPtr<nsIDOMNode> *outBRNode, EDirection aSelect = eNone);
mozilla::dom::Element* CreateBRImpl(nsCOMPtr<nsINode>* aInOutParent, Element* CreateBRImpl(nsCOMPtr<nsINode>* aInOutParent, int32_t* aInOutOffset,
int32_t* aInOutOffset, EDirection aSelect);
EDirection aSelect);
nsresult CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent, nsresult CreateBRImpl(nsCOMPtr<nsIDOMNode>* aInOutParent,
int32_t* aInOutOffset, int32_t* aInOutOffset,
nsCOMPtr<nsIDOMNode>* outBRNode, nsCOMPtr<nsIDOMNode>* outBRNode,

Просмотреть файл

@ -39,6 +39,11 @@ class Selection;
class nsTextEditRules : public nsIEditRules, public nsITimerCallback class nsTextEditRules : public nsIEditRules, public nsITimerCallback
{ {
public: public:
typedef mozilla::dom::Element Element;
typedef mozilla::dom::Selection Selection;
typedef mozilla::dom::Text Text;
template<typename T> using OwningNonNull = mozilla::OwningNonNull<T>;
NS_DECL_NSITIMERCALLBACK NS_DECL_NSITIMERCALLBACK
NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextEditRules, nsIEditRules) NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsTextEditRules, nsIEditRules)
@ -53,10 +58,10 @@ public:
nsIEditor::EDirection aDirection) override; nsIEditor::EDirection aDirection) override;
NS_IMETHOD AfterEdit(EditAction action, NS_IMETHOD AfterEdit(EditAction action,
nsIEditor::EDirection aDirection) override; nsIEditor::EDirection aDirection) override;
NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, NS_IMETHOD WillDoAction(Selection* aSelection, nsRulesInfo* aInfo,
nsRulesInfo* aInfo, bool* aCancel, bool* aHandled) override; bool* aCancel, bool* aHandled) override;
NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection, NS_IMETHOD DidDoAction(Selection* aSelection, nsRulesInfo* aInfo,
nsRulesInfo* aInfo, nsresult aResult) override; nsresult aResult) override;
NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty) override; NS_IMETHOD DocumentIsEmpty(bool *aDocumentIsEmpty) override;
NS_IMETHOD DocumentModified() override; NS_IMETHOD DocumentModified() override;
@ -108,49 +113,43 @@ protected:
// nsTextEditRules implementation methods // nsTextEditRules implementation methods
nsresult WillInsertText( EditAction aAction, nsresult WillInsertText( EditAction aAction,
mozilla::dom::Selection* aSelection, Selection* aSelection,
bool *aCancel, bool *aCancel,
bool *aHandled, bool *aHandled,
const nsAString *inString, const nsAString *inString,
nsAString *outString, nsAString *outString,
int32_t aMaxLength); int32_t aMaxLength);
nsresult DidInsertText(mozilla::dom::Selection* aSelection, nsresult DidInsertText(Selection* aSelection, nsresult aResult);
nsresult aResult);
nsresult GetTopEnclosingPre(nsIDOMNode *aNode, nsIDOMNode** aOutPreNode); nsresult GetTopEnclosingPre(nsIDOMNode *aNode, nsIDOMNode** aOutPreNode);
nsresult WillInsertBreak(mozilla::dom::Selection* aSelection, bool* aCancel, nsresult WillInsertBreak(Selection* aSelection, bool* aCancel,
bool *aHandled, int32_t aMaxLength); bool *aHandled, int32_t aMaxLength);
nsresult DidInsertBreak(mozilla::dom::Selection* aSelection, nsresult DidInsertBreak(Selection* aSelection, nsresult aResult);
nsresult aResult);
void WillInsert(mozilla::dom::Selection& aSelection, bool* aCancel); void WillInsert(Selection& aSelection, bool* aCancel);
nsresult DidInsert(mozilla::dom::Selection* aSelection, nsresult aResult); nsresult DidInsert(Selection* aSelection, nsresult aResult);
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection, nsresult WillDeleteSelection(Selection* aSelection,
nsIEditor::EDirection aCollapsedAction, nsIEditor::EDirection aCollapsedAction,
bool *aCancel, bool *aCancel,
bool *aHandled); bool *aHandled);
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection, nsresult DidDeleteSelection(Selection* aSelection,
nsIEditor::EDirection aCollapsedAction, nsIEditor::EDirection aCollapsedAction,
nsresult aResult); nsresult aResult);
nsresult WillSetTextProperty(mozilla::dom::Selection* aSelection, nsresult WillSetTextProperty(Selection* aSelection, bool* aCancel,
bool* aCancel, bool* aHandled); bool* aHandled);
nsresult DidSetTextProperty(mozilla::dom::Selection* aSelection, nsresult DidSetTextProperty(Selection* aSelection, nsresult aResult);
nsresult aResult);
nsresult WillRemoveTextProperty(mozilla::dom::Selection* aSelection, nsresult WillRemoveTextProperty(Selection* aSelection, bool* aCancel,
bool* aCancel, bool* aHandled); bool* aHandled);
nsresult DidRemoveTextProperty(mozilla::dom::Selection* aSelection, nsresult DidRemoveTextProperty(Selection* aSelection, nsresult aResult);
nsresult aResult);
nsresult WillUndo(mozilla::dom::Selection* aSelection, bool* aCancel, nsresult WillUndo(Selection* aSelection, bool* aCancel, bool* aHandled);
bool* aHandled); nsresult DidUndo(Selection* aSelection, nsresult aResult);
nsresult DidUndo(mozilla::dom::Selection* aSelection, nsresult aResult);
nsresult WillRedo(mozilla::dom::Selection* aSelection, bool* aCancel, nsresult WillRedo(Selection* aSelection, bool* aCancel, bool* aHandled);
bool* aHandled); nsresult DidRedo(Selection* aSelection, nsresult aResult);
nsresult DidRedo(mozilla::dom::Selection* aSelection, nsresult aResult);
/** called prior to nsIEditor::OutputToString /** called prior to nsIEditor::OutputToString
* @param aSelection * @param aSelection
@ -159,13 +158,13 @@ protected:
* @param aOutCancel if set to true, the caller should cancel the operation * @param aOutCancel if set to true, the caller should cancel the operation
* and use aOutText as the result. * and use aOutText as the result.
*/ */
nsresult WillOutputText(mozilla::dom::Selection* aSelection, nsresult WillOutputText(Selection* aSelection,
const nsAString *aInFormat, const nsAString *aInFormat,
nsAString *aOutText, nsAString *aOutText,
bool *aOutCancel, bool *aOutCancel,
bool *aHandled); bool *aHandled);
nsresult DidOutputText(mozilla::dom::Selection* aSelection, nsresult aResult); nsresult DidOutputText(Selection* aSelection, nsresult aResult);
// helper functions // helper functions
@ -177,11 +176,11 @@ protected:
nsresult CreateTrailingBRIfNeeded(); nsresult CreateTrailingBRIfNeeded();
/** creates a bogus text node if the document has no editable content */ /** creates a bogus text node if the document has no editable content */
nsresult CreateBogusNodeIfNeeded(mozilla::dom::Selection* aSelection); nsresult CreateBogusNodeIfNeeded(Selection* aSelection);
/** returns a truncated insertion string if insertion would place us /** returns a truncated insertion string if insertion would place us
over aMaxLength */ over aMaxLength */
nsresult TruncateInsertionIfNeeded(mozilla::dom::Selection* aSelection, nsresult TruncateInsertionIfNeeded(Selection* aSelection,
const nsAString *aInString, const nsAString *aInString,
nsAString *aOutString, nsAString *aOutString,
int32_t aMaxLength, int32_t aMaxLength,
@ -193,9 +192,9 @@ protected:
nsresult CreateMozBR(nsIDOMNode* inParent, int32_t inOffset, nsresult CreateMozBR(nsIDOMNode* inParent, int32_t inOffset,
nsIDOMNode** outBRNode = nullptr); nsIDOMNode** outBRNode = nullptr);
void UndefineCaretBidiLevel(mozilla::dom::Selection* aSelection); void UndefineCaretBidiLevel(Selection* aSelection);
nsresult CheckBidiLevelForDeletion(mozilla::dom::Selection* aSelection, nsresult CheckBidiLevelForDeletion(Selection* aSelection,
nsIDOMNode *aSelNode, nsIDOMNode *aSelNode,
int32_t aSelOffset, int32_t aSelOffset,
nsIEditor::EDirection aAction, nsIEditor::EDirection aAction,
@ -203,7 +202,7 @@ protected:
nsresult HideLastPWInput(); nsresult HideLastPWInput();
nsresult CollapseSelectionToTrailingBRIfNeeded(mozilla::dom::Selection* aSelection); nsresult CollapseSelectionToTrailingBRIfNeeded(Selection* aSelection);
bool IsPasswordEditor() const bool IsPasswordEditor() const
{ {