2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsHTMLEditRules_h__
|
|
|
|
#define nsHTMLEditRules_h__
|
|
|
|
|
|
|
|
#include "TypeInState.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsEditor.h"
|
|
|
|
#include "nsIEditActionListener.h"
|
|
|
|
#include "nsIEditor.h"
|
|
|
|
#include "nsIHTMLEditor.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
|
|
|
#include "nsSelectionState.h"
|
2009-04-22 01:43:15 -07:00
|
|
|
#include "nsTArray.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsTextEditRules.h"
|
|
|
|
#include "nscore.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-12 23:33:42 -07:00
|
|
|
class nsHTMLEditor;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsIDOMCharacterData;
|
|
|
|
class nsIDOMDocument;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIDOMElement;
|
2012-07-12 23:33:42 -07:00
|
|
|
class nsIDOMNode;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIEditor;
|
2012-07-12 23:33:42 -07:00
|
|
|
class nsINode;
|
|
|
|
class nsPlaintextEditor;
|
|
|
|
class nsRange;
|
|
|
|
class nsRulesInfo;
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
class Element;
|
2014-04-10 09:09:40 -07:00
|
|
|
class Selection;
|
2012-07-12 23:33:42 -07:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
|
|
|
struct DOMPoint;
|
|
|
|
template <class E> class nsCOMArray;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
struct StyleCache : public PropItem
|
|
|
|
{
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mPresent;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
StyleCache() : PropItem(), mPresent(false) {
|
2007-12-11 19:23:34 -08:00
|
|
|
MOZ_COUNT_CTOR(StyleCache);
|
|
|
|
}
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) :
|
2011-10-17 07:59:28 -07:00
|
|
|
PropItem(aTag, aAttr, aValue), mPresent(false) {
|
2007-12-11 19:23:34 -08:00
|
|
|
MOZ_COUNT_CTOR(StyleCache);
|
|
|
|
}
|
|
|
|
|
|
|
|
~StyleCache() {
|
|
|
|
MOZ_COUNT_DTOR(StyleCache);
|
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#define SIZE_STYLE_TABLE 19
|
|
|
|
|
2011-05-07 01:04:56 -07:00
|
|
|
class nsHTMLEditRules : public nsTextEditRules, public nsIEditActionListener
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
|
2014-07-08 14:23:18 -07:00
|
|
|
nsHTMLEditRules();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIEditRules methods
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD Init(nsPlaintextEditor *aEditor) override;
|
|
|
|
NS_IMETHOD DetachEditor() override;
|
2012-08-12 11:28:26 -07:00
|
|
|
NS_IMETHOD BeforeEdit(EditAction action,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIEditor::EDirection aDirection) override;
|
2012-08-12 11:28:26 -07:00
|
|
|
NS_IMETHOD AfterEdit(EditAction action,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsIEditor::EDirection aDirection) override;
|
2014-04-10 09:09:40 -07:00
|
|
|
NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo,
|
2015-03-21 09:28:04 -07:00
|
|
|
bool* aCancel, bool* aHandled) override;
|
2014-11-02 04:04:13 -08:00
|
|
|
NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection,
|
2015-03-21 09:28:04 -07:00
|
|
|
nsRulesInfo* aInfo, nsresult aResult) override;
|
|
|
|
NS_IMETHOD DocumentModified() override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
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);
|
2011-05-07 01:04:56 -07:00
|
|
|
nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIEditActionListener methods
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition) override;
|
|
|
|
NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) override;
|
|
|
|
NS_IMETHOD WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition) override;
|
|
|
|
NS_IMETHOD DidInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult) override;
|
|
|
|
NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild) override;
|
|
|
|
NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult) override;
|
|
|
|
NS_IMETHOD WillSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset) override;
|
|
|
|
NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset, nsIDOMNode *aNewLeftNode, nsresult aResult) override;
|
|
|
|
NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent) override;
|
|
|
|
NS_IMETHOD DidJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent, nsresult aResult) override;
|
|
|
|
NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString) override;
|
|
|
|
NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString, nsresult aResult) override;
|
|
|
|
NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength) override;
|
|
|
|
NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength, nsresult aResult) override;
|
|
|
|
NS_IMETHOD WillDeleteSelection(nsISelection *aSelection) override;
|
|
|
|
NS_IMETHOD DidDeleteSelection(nsISelection *aSelection) override;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
2014-07-08 14:23:18 -07:00
|
|
|
virtual ~nsHTMLEditRules();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
enum RulesEndpoint
|
|
|
|
{
|
|
|
|
kStart,
|
|
|
|
kEnd
|
|
|
|
};
|
|
|
|
|
|
|
|
enum BRLocation
|
|
|
|
{
|
|
|
|
kBeforeBlock,
|
|
|
|
kBlockEnd
|
|
|
|
};
|
|
|
|
|
2014-05-09 14:02:29 -07:00
|
|
|
void InitFields();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// nsHTMLEditRules implementation methods
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult WillInsert(mozilla::dom::Selection* aSelection, bool* aCancel);
|
2012-08-12 11:28:26 -07:00
|
|
|
nsresult WillInsertText( EditAction aAction,
|
2014-04-10 09:09:40 -07:00
|
|
|
mozilla::dom::Selection* aSelection,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aCancel,
|
|
|
|
bool *aHandled,
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsAString *inString,
|
|
|
|
nsAString *outString,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aMaxLength);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult WillLoadHTML(mozilla::dom::Selection* aSelection, bool* aCancel);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillInsertBreak(mozilla::dom::Selection* aSelection,
|
2012-06-10 16:44:50 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult StandardBreakImpl(nsIDOMNode* aNode, int32_t aOffset,
|
|
|
|
mozilla::dom::Selection* aSelection);
|
|
|
|
nsresult DidInsertBreak(mozilla::dom::Selection* aSelection,
|
|
|
|
nsresult aResult);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult SplitMailCites(mozilla::dom::Selection* aSelection, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection,
|
2012-05-10 07:54:33 -07:00
|
|
|
nsIEditor::EDirection aAction,
|
|
|
|
nsIEditor::EStripWrappers aStripWrappers,
|
|
|
|
bool* aCancel, bool* aHandled);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIEditor::EDirection aDir,
|
|
|
|
nsresult aResult);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult InsertBRIfNeeded(mozilla::dom::Selection* aSelection);
|
2014-11-02 04:04:13 -08:00
|
|
|
::DOMPoint GetGoodSelPointForNode(nsINode& aNode,
|
|
|
|
nsIEditor::EDirection aAction);
|
2012-11-25 04:38:23 -08:00
|
|
|
nsresult JoinBlocks(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, bool *aCanceled);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult MoveBlock(nsIDOMNode *aLeft, nsIDOMNode *aRight, int32_t aLeftOffset, int32_t aRightOffset);
|
|
|
|
nsresult MoveNodeSmart(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset);
|
|
|
|
nsresult MoveContents(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset);
|
2012-05-18 01:29:39 -07:00
|
|
|
nsresult DeleteNonTableElements(nsINode* aNode);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillMakeList(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
const nsAString* aListType,
|
|
|
|
bool aEntireList,
|
|
|
|
const nsAString* aBulletType,
|
|
|
|
bool* aCancel, bool* aHandled,
|
2012-07-30 07:20:58 -07:00
|
|
|
const nsAString* aItemType = nullptr);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillRemoveList(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool aOrdered, bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillIndent(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillCSSIndent(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillHTMLIndent(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillOutdent(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillAlign(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
const nsAString* alignType,
|
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillAbsolutePosition(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillRemoveAbsolutePosition(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillRelativeChangeZIndex(mozilla::dom::Selection* aSelection,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aChange,
|
2012-07-23 03:27:22 -07:00
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillMakeDefListItem(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
const nsAString* aBlockType, bool aEntireList,
|
|
|
|
bool* aCancel, bool* aHandled);
|
2014-04-10 09:09:40 -07:00
|
|
|
nsresult WillMakeBasicBlock(mozilla::dom::Selection* aSelection,
|
2012-07-23 03:27:22 -07:00
|
|
|
const nsAString* aBlockType,
|
|
|
|
bool* aCancel, bool* aHandled);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult DidMakeBasicBlock(mozilla::dom::Selection* aSelection,
|
|
|
|
nsRulesInfo* aInfo, nsresult aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult DidAbsolutePosition();
|
|
|
|
nsresult AlignInnerBlocks(nsIDOMNode *aNode, const nsAString *alignType);
|
|
|
|
nsresult AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType);
|
2012-05-18 01:29:39 -07:00
|
|
|
nsresult AppendInnerFormatNodes(nsCOMArray<nsIDOMNode>& aArray,
|
|
|
|
nsINode* aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult AppendInnerFormatNodes(nsCOMArray<nsIDOMNode>& aArray,
|
|
|
|
nsIDOMNode *aNode);
|
|
|
|
nsresult GetFormatString(nsIDOMNode *aNode, nsAString &outFormat);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult GetInnerContent(nsIDOMNode *aNode, nsCOMArray<nsIDOMNode>& outArrayOfNodes, int32_t *aIndex, bool aList = true, bool aTble = true);
|
2012-02-10 02:04:46 -08:00
|
|
|
already_AddRefed<nsIDOMNode> IsInListItem(nsIDOMNode* aNode);
|
2014-08-20 05:25:16 -07:00
|
|
|
mozilla::dom::Element* IsInListItem(nsINode* aNode);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult ReturnInHeader(mozilla::dom::Selection* aSelection,
|
|
|
|
nsIDOMNode* aHeader, nsIDOMNode* aTextNode,
|
|
|
|
int32_t aOffset);
|
|
|
|
nsresult ReturnInParagraph(mozilla::dom::Selection* aSelection,
|
|
|
|
nsIDOMNode* aHeader, nsIDOMNode* aTextNode,
|
|
|
|
int32_t aOffset, bool* aCancel, bool* aHandled);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult SplitParagraph(nsIDOMNode *aPara,
|
|
|
|
nsIDOMNode *aBRNode,
|
2014-11-02 04:04:13 -08:00
|
|
|
mozilla::dom::Selection* aSelection,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> *aSelNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aOffset);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult ReturnInListItem(mozilla::dom::Selection* aSelection,
|
|
|
|
nsIDOMNode* aHeader, nsIDOMNode* aTextNode,
|
|
|
|
int32_t aOffset);
|
2012-08-12 11:28:26 -07:00
|
|
|
nsresult AfterEditInner(EditAction action,
|
2012-05-05 11:52:29 -07:00
|
|
|
nsIEditor::EDirection aDirection);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult RemovePartOfBlock(nsIDOMNode *aBlock,
|
|
|
|
nsIDOMNode *aStartChild,
|
|
|
|
nsIDOMNode *aEndChild,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aRightNode = 0);
|
|
|
|
nsresult SplitBlock(nsIDOMNode *aBlock,
|
|
|
|
nsIDOMNode *aStartChild,
|
|
|
|
nsIDOMNode *aEndChild,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aRightNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aMiddleNode = 0);
|
|
|
|
nsresult OutdentPartOfBlock(nsIDOMNode *aBlock,
|
|
|
|
nsIDOMNode *aStartChild,
|
|
|
|
nsIDOMNode *aEndChild,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIsBlockIndentedWithCSS,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aRightNode = 0);
|
2012-06-06 00:36:46 -07:00
|
|
|
|
|
|
|
nsresult ConvertListType(nsIDOMNode* aList,
|
|
|
|
nsCOMPtr<nsIDOMNode>* outList,
|
|
|
|
nsIAtom* aListType,
|
|
|
|
nsIAtom* aItemType);
|
2014-08-13 04:53:33 -07:00
|
|
|
nsresult ConvertListType(mozilla::dom::Element* aList,
|
2012-06-06 00:36:46 -07:00
|
|
|
mozilla::dom::Element** aOutList,
|
|
|
|
nsIAtom* aListType,
|
|
|
|
nsIAtom* aItemType);
|
|
|
|
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult CreateStyleForInsertText(mozilla::dom::Selection* aSelection,
|
|
|
|
nsIDOMDocument* aDoc);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult IsEmptyBlock(nsIDOMNode *aNode,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *outIsEmptyBlock,
|
|
|
|
bool aMozBRDoesntCount = false,
|
|
|
|
bool aListItemsNotEmpty = false);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult CheckForEmptyBlock(nsINode* aStartNode,
|
|
|
|
mozilla::dom::Element* aBodyNode,
|
2014-11-02 04:04:13 -08:00
|
|
|
mozilla::dom::Selection* aSelection,
|
2014-11-02 04:04:13 -08:00
|
|
|
bool* aHandled);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere,
|
2012-08-22 08:56:38 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> *outBRNode, int32_t aOffset=0);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult ExpandSelectionForDeletion(mozilla::dom::Selection* aSelection);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsFirstNode(nsIDOMNode *aNode);
|
|
|
|
bool IsLastNode(nsIDOMNode *aNode);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult NormalizeSelection(mozilla::dom::Selection* aSelection);
|
2012-07-01 04:53:45 -07:00
|
|
|
void GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aOffset, EditAction actionID,
|
|
|
|
nsCOMPtr<nsIDOMNode>* outNode, int32_t* outOffset);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult GetPromotedRanges(mozilla::dom::Selection* aSelection,
|
2014-11-02 04:04:13 -08:00
|
|
|
nsTArray<nsRefPtr<nsRange>>& outArrayOfRanges,
|
2012-08-12 11:28:26 -07:00
|
|
|
EditAction inOperationType);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult PromoteRange(nsRange* inRange, EditAction inOperationType);
|
|
|
|
nsresult GetNodesForOperation(nsTArray<nsRefPtr<nsRange>>& inArrayOfRanges,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMArray<nsIDOMNode>& outArrayOfNodes,
|
2012-08-12 11:28:26 -07:00
|
|
|
EditAction inOperationType,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDontTouchContent=false);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetChildNodesForOperation(nsIDOMNode *inNode,
|
|
|
|
nsCOMArray<nsIDOMNode>& outArrayOfNodes);
|
2014-08-18 14:28:17 -07:00
|
|
|
nsresult GetNodesFromPoint(::DOMPoint point,
|
2012-08-12 11:28:26 -07:00
|
|
|
EditAction operation,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMArray<nsIDOMNode>& arrayOfNodes,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool dontTouchContent);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult GetNodesFromSelection(mozilla::dom::Selection* selection,
|
2012-08-12 11:28:26 -07:00
|
|
|
EditAction operation,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMArray<nsIDOMNode>& arrayOfNodes,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDontTouchContent=false);
|
|
|
|
nsresult GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes, bool aEntireList, bool aDontTouchContent=false);
|
2012-06-17 01:11:16 -07:00
|
|
|
void GetDefinitionListItemTypes(mozilla::dom::Element* aElement, bool* aDT, bool* aDD);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult GetParagraphFormatNodes(nsCOMArray<nsIDOMNode>& outArrayOfNodes, bool aDontTouchContent=false);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult LookInsideDivBQandList(nsCOMArray<nsIDOMNode>& aNodeArray);
|
|
|
|
nsresult BustUpInlinesAtRangeEndpoints(nsRangeStore &inRange);
|
|
|
|
nsresult BustUpInlinesAtBRs(nsIDOMNode *inNode,
|
|
|
|
nsCOMArray<nsIDOMNode>& outArrayOfNodes);
|
|
|
|
nsCOMPtr<nsIDOMNode> GetHighestInlineParent(nsIDOMNode* aNode);
|
|
|
|
nsresult MakeTransitionList(nsCOMArray<nsIDOMNode>& inArrayOfNodes,
|
2011-09-28 23:19:26 -07:00
|
|
|
nsTArray<bool> &inTransitionArray);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult RemoveBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes);
|
|
|
|
nsresult ApplyBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes, const nsAString *aBlockTag);
|
|
|
|
nsresult MakeBlockquote(nsCOMArray<nsIDOMNode>& arrayOfNodes);
|
2014-08-29 04:43:23 -07:00
|
|
|
nsresult SplitAsNeeded(nsIAtom& aTag, nsCOMPtr<nsINode>& inOutParent,
|
|
|
|
int32_t& inOutOffset);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult AddTerminatingBR(nsIDOMNode *aBlock);
|
2014-11-02 04:04:13 -08:00
|
|
|
::DOMPoint JoinNodesSmart(nsIContent& aNodeLeft, nsIContent& aNodeRight);
|
2014-11-02 04:04:13 -08:00
|
|
|
mozilla::dom::Element* GetTopEnclosingMailCite(nsINode& aNode);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult PopListItem(nsIDOMNode *aListItem, bool *aOutOfList);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult RemoveListStructure(nsIDOMNode *aList);
|
|
|
|
nsresult CacheInlineStyles(nsIDOMNode *aNode);
|
2012-05-22 03:15:09 -07:00
|
|
|
nsresult ReapplyCachedStyles();
|
2013-02-07 00:08:57 -08:00
|
|
|
void ClearCachedStyles();
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult AdjustSpecialBreaks(bool aSafeToAskFrames = false);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult AdjustWhitespace(mozilla::dom::Selection* aSelection);
|
|
|
|
nsresult PinSelectionToNewBlock(mozilla::dom::Selection* aSelection);
|
|
|
|
nsresult CheckInterlinePosition(mozilla::dom::Selection* aSelection);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult AdjustSelection(mozilla::dom::Selection* aSelection,
|
|
|
|
nsIEditor::EDirection aAction);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult FindNearSelectableNode(nsIDOMNode *aSelNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aSelOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIEditor::EDirection &aDirection,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outSelectableNode);
|
2012-07-27 07:03:28 -07:00
|
|
|
/**
|
|
|
|
* Returns true if aNode1 or aNode2 or both is the descendant of some type of
|
|
|
|
* table element, but their nearest table element ancestors differ. "Table
|
|
|
|
* element" here includes not just <table> but also <td>, <tbody>, <tr>, etc.
|
|
|
|
* The nodes count as being their own descendants for this purpose, so a
|
|
|
|
* table element is its own nearest table element ancestor.
|
|
|
|
*/
|
|
|
|
bool InDifferentTableElements(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
|
|
|
|
bool InDifferentTableElements(nsINode* aNode1, nsINode* aNode2);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult RemoveEmptyNodes();
|
2012-05-05 02:00:06 -07:00
|
|
|
nsresult SelectionEndpointInNode(nsINode *aNode, bool *aResult);
|
2014-11-02 04:04:13 -08:00
|
|
|
nsresult UpdateDocChangeRange(nsRange* aRange);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult ConfirmSelectionInBody();
|
|
|
|
nsresult InsertMozBRIfNeeded(nsIDOMNode *aNode);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsEmptyInline(nsIDOMNode *aNode);
|
|
|
|
bool ListIsEmptyLine(nsCOMArray<nsIDOMNode> &arrayOfNodes);
|
|
|
|
nsresult RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignType, bool aChildrenOnly);
|
|
|
|
nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, bool aStarts);
|
|
|
|
nsresult AlignBlock(nsIDOMElement * aElement, const nsAString * aAlignType, bool aContentsOnly);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, int8_t aRelativeChange);
|
2010-11-11 13:40:52 -08:00
|
|
|
void DocumentModifiedWorker();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// data members
|
|
|
|
protected:
|
|
|
|
nsHTMLEditor *mHTMLEditor;
|
2012-01-10 06:19:54 -08:00
|
|
|
nsRefPtr<nsRange> mDocChangeRange;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mListenerEnabled;
|
|
|
|
bool mReturnInEmptyLIKillsList;
|
|
|
|
bool mDidDeleteSelection;
|
|
|
|
bool mDidRangedDelete;
|
|
|
|
bool mRestoreContentEditableCount;
|
2012-01-10 06:19:54 -08:00
|
|
|
nsRefPtr<nsRange> mUtilRange;
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t mJoinOffset; // need to remember an int across willJoin/didJoin...
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> mNewBlock;
|
2012-07-12 23:31:15 -07:00
|
|
|
nsRefPtr<nsRangeStore> mRangeItem;
|
2007-03-22 10:30:00 -07:00
|
|
|
StyleCache mCachedStyles[SIZE_STYLE_TABLE];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif //nsHTMLEditRules_h__
|
|
|
|
|