gecko/editor/libeditor/nsHTMLEditRules.h

357 lines
18 KiB
C
Raw Normal View History

/* -*- 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/. */
#ifndef nsHTMLEditRules_h__
#define nsHTMLEditRules_h__
#include "TypeInState.h"
#include "nsAutoPtr.h"
#include "nsCOMPtr.h"
#include "nsEditor.h"
#include "nsIEditActionListener.h"
#include "nsIEditor.h"
#include "nsIHTMLEditor.h"
#include "nsISupportsImpl.h"
#include "nsSelectionState.h"
#include "nsTArray.h"
#include "nsTextEditRules.h"
#include "nscore.h"
class nsHTMLEditor;
class nsIAtom;
class nsIDOMCharacterData;
class nsIDOMDocument;
class nsIDOMElement;
class nsIDOMNode;
class nsIEditor;
class nsINode;
class nsPlaintextEditor;
class nsRange;
class nsRulesInfo;
namespace mozilla {
namespace dom {
class Element;
class Selection;
} // namespace dom
} // namespace mozilla
struct DOMPoint;
template <class E> class nsCOMArray;
struct StyleCache : public PropItem
{
bool mPresent;
StyleCache() : PropItem(), mPresent(false) {
MOZ_COUNT_CTOR(StyleCache);
}
StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) :
PropItem(aTag, aAttr, aValue), mPresent(false) {
MOZ_COUNT_CTOR(StyleCache);
}
~StyleCache() {
MOZ_COUNT_DTOR(StyleCache);
}
};
#define SIZE_STYLE_TABLE 19
class nsHTMLEditRules : public nsTextEditRules, public nsIEditActionListener
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsHTMLEditRules();
// nsIEditRules methods
NS_IMETHOD Init(nsPlaintextEditor *aEditor) 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(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo,
bool* aCancel, bool* aHandled) override;
NS_IMETHOD DidDoAction(mozilla::dom::Selection* aSelection,
nsRulesInfo* 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);
nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode);
// nsIEditActionListener methods
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;
protected:
virtual ~nsHTMLEditRules();
enum RulesEndpoint
{
kStart,
kEnd
};
enum BRLocation
{
kBeforeBlock,
kBlockEnd
};
void InitFields();
// nsHTMLEditRules implementation methods
nsresult WillInsert(mozilla::dom::Selection* aSelection, bool* aCancel);
nsresult WillInsertText( EditAction aAction,
mozilla::dom::Selection* aSelection,
bool *aCancel,
bool *aHandled,
const nsAString *inString,
nsAString *outString,
int32_t aMaxLength);
nsresult WillLoadHTML(mozilla::dom::Selection* aSelection, bool* aCancel);
nsresult WillInsertBreak(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult StandardBreakImpl(nsIDOMNode* aNode, int32_t aOffset,
mozilla::dom::Selection* aSelection);
nsresult DidInsertBreak(mozilla::dom::Selection* aSelection,
nsresult aResult);
nsresult SplitMailCites(mozilla::dom::Selection* aSelection, bool* aHandled);
nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection,
nsIEditor::EDirection aAction,
nsIEditor::EStripWrappers aStripWrappers,
bool* aCancel, bool* aHandled);
nsresult DidDeleteSelection(mozilla::dom::Selection* aSelection,
nsIEditor::EDirection aDir,
nsresult aResult);
nsresult InsertBRIfNeeded(mozilla::dom::Selection* aSelection);
::DOMPoint GetGoodSelPointForNode(nsINode& aNode,
nsIEditor::EDirection aAction);
nsresult JoinBlocks(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, bool *aCanceled);
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);
nsresult DeleteNonTableElements(nsINode* aNode);
nsresult WillMakeList(mozilla::dom::Selection* aSelection,
const nsAString* aListType,
bool aEntireList,
const nsAString* aBulletType,
bool* aCancel, bool* aHandled,
const nsAString* aItemType = nullptr);
nsresult WillRemoveList(mozilla::dom::Selection* aSelection,
bool aOrdered, bool* aCancel, bool* aHandled);
nsresult WillIndent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillCSSIndent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillHTMLIndent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillOutdent(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillAlign(mozilla::dom::Selection* aSelection,
const nsAString* alignType,
bool* aCancel, bool* aHandled);
nsresult WillAbsolutePosition(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillRemoveAbsolutePosition(mozilla::dom::Selection* aSelection,
bool* aCancel, bool* aHandled);
nsresult WillRelativeChangeZIndex(mozilla::dom::Selection* aSelection,
int32_t aChange,
bool* aCancel, bool* aHandled);
nsresult WillMakeDefListItem(mozilla::dom::Selection* aSelection,
const nsAString* aBlockType, bool aEntireList,
bool* aCancel, bool* aHandled);
nsresult WillMakeBasicBlock(mozilla::dom::Selection* aSelection,
const nsAString* aBlockType,
bool* aCancel, bool* aHandled);
nsresult DidMakeBasicBlock(mozilla::dom::Selection* aSelection,
nsRulesInfo* aInfo, nsresult aResult);
nsresult DidAbsolutePosition();
nsresult AlignInnerBlocks(nsIDOMNode *aNode, const nsAString *alignType);
nsresult AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType);
nsresult AppendInnerFormatNodes(nsCOMArray<nsIDOMNode>& aArray,
nsINode* aNode);
nsresult AppendInnerFormatNodes(nsCOMArray<nsIDOMNode>& aArray,
nsIDOMNode *aNode);
nsresult GetFormatString(nsIDOMNode *aNode, nsAString &outFormat);
nsresult GetInnerContent(nsIDOMNode *aNode, nsCOMArray<nsIDOMNode>& outArrayOfNodes, int32_t *aIndex, bool aList = true, bool aTble = true);
already_AddRefed<nsIDOMNode> IsInListItem(nsIDOMNode* aNode);
mozilla::dom::Element* IsInListItem(nsINode* aNode);
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);
nsresult SplitParagraph(nsIDOMNode *aPara,
nsIDOMNode *aBRNode,
mozilla::dom::Selection* aSelection,
nsCOMPtr<nsIDOMNode> *aSelNode,
int32_t *aOffset);
nsresult ReturnInListItem(mozilla::dom::Selection* aSelection,
nsIDOMNode* aHeader, nsIDOMNode* aTextNode,
int32_t aOffset);
nsresult AfterEditInner(EditAction action,
nsIEditor::EDirection aDirection);
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,
bool aIsBlockIndentedWithCSS,
nsCOMPtr<nsIDOMNode> *aLeftNode = 0,
nsCOMPtr<nsIDOMNode> *aRightNode = 0);
nsresult ConvertListType(nsIDOMNode* aList,
nsCOMPtr<nsIDOMNode>* outList,
nsIAtom* aListType,
nsIAtom* aItemType);
nsresult ConvertListType(mozilla::dom::Element* aList,
mozilla::dom::Element** aOutList,
nsIAtom* aListType,
nsIAtom* aItemType);
nsresult CreateStyleForInsertText(mozilla::dom::Selection* aSelection,
nsIDOMDocument* aDoc);
nsresult IsEmptyBlock(nsIDOMNode *aNode,
bool *outIsEmptyBlock,
bool aMozBRDoesntCount = false,
bool aListItemsNotEmpty = false);
nsresult CheckForEmptyBlock(nsINode* aStartNode,
mozilla::dom::Element* aBodyNode,
mozilla::dom::Selection* aSelection,
bool* aHandled);
nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere,
nsCOMPtr<nsIDOMNode> *outBRNode, int32_t aOffset=0);
nsresult ExpandSelectionForDeletion(mozilla::dom::Selection* aSelection);
bool IsFirstNode(nsIDOMNode *aNode);
bool IsLastNode(nsIDOMNode *aNode);
nsresult NormalizeSelection(mozilla::dom::Selection* aSelection);
void GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode,
int32_t aOffset, EditAction actionID,
nsCOMPtr<nsIDOMNode>* outNode, int32_t* outOffset);
nsresult GetPromotedRanges(mozilla::dom::Selection* aSelection,
nsTArray<nsRefPtr<nsRange>>& outArrayOfRanges,
EditAction inOperationType);
nsresult PromoteRange(nsRange* inRange, EditAction inOperationType);
nsresult GetNodesForOperation(nsTArray<nsRefPtr<nsRange>>& inArrayOfRanges,
nsCOMArray<nsIDOMNode>& outArrayOfNodes,
EditAction inOperationType,
bool aDontTouchContent=false);
nsresult GetChildNodesForOperation(nsIDOMNode *inNode,
nsCOMArray<nsIDOMNode>& outArrayOfNodes);
Bug 1055105 - Flatten editor/libeditor/html to editor/libeditor; r=poiru --HG-- rename : editor/libeditor/html/TextEditorTest.cpp => editor/libeditor/TextEditorTest.cpp rename : editor/libeditor/html/TextEditorTest.h => editor/libeditor/TextEditorTest.h rename : editor/libeditor/html/TypeInState.cpp => editor/libeditor/TypeInState.cpp rename : editor/libeditor/html/TypeInState.h => editor/libeditor/TypeInState.h rename : editor/libeditor/html/crashtests/336081-1.xhtml => editor/libeditor/crashtests/336081-1.xhtml rename : editor/libeditor/html/crashtests/382778-1.html => editor/libeditor/crashtests/382778-1.html rename : editor/libeditor/html/crashtests/407074-1.html => editor/libeditor/crashtests/407074-1.html rename : editor/libeditor/html/crashtests/407277-1.html => editor/libeditor/crashtests/407277-1.html rename : editor/libeditor/html/crashtests/414178-1.html => editor/libeditor/crashtests/414178-1.html rename : editor/libeditor/html/crashtests/418923-1.html => editor/libeditor/crashtests/418923-1.html rename : editor/libeditor/html/crashtests/420439.html => editor/libeditor/crashtests/420439.html rename : editor/libeditor/html/crashtests/428489-1.html => editor/libeditor/crashtests/428489-1.html rename : editor/libeditor/html/crashtests/431086-1.xhtml => editor/libeditor/crashtests/431086-1.xhtml rename : editor/libeditor/html/crashtests/448329-1.html => editor/libeditor/crashtests/448329-1.html rename : editor/libeditor/html/crashtests/448329-2.html => editor/libeditor/crashtests/448329-2.html rename : editor/libeditor/html/crashtests/448329-3.html => editor/libeditor/crashtests/448329-3.html rename : editor/libeditor/html/crashtests/456727-1.html => editor/libeditor/crashtests/456727-1.html rename : editor/libeditor/html/crashtests/456727-2.html => editor/libeditor/crashtests/456727-2.html rename : editor/libeditor/html/crashtests/467647-1.html => editor/libeditor/crashtests/467647-1.html rename : editor/libeditor/html/crashtests/499844-1.html => editor/libeditor/crashtests/499844-1.html rename : editor/libeditor/html/crashtests/503709-1.xhtml => editor/libeditor/crashtests/503709-1.xhtml rename : editor/libeditor/html/crashtests/513375-1.xhtml => editor/libeditor/crashtests/513375-1.xhtml rename : editor/libeditor/html/crashtests/535632-1.xhtml => editor/libeditor/crashtests/535632-1.xhtml rename : editor/libeditor/html/crashtests/574558-1.xhtml => editor/libeditor/crashtests/574558-1.xhtml rename : editor/libeditor/html/crashtests/582138-1.xhtml => editor/libeditor/crashtests/582138-1.xhtml rename : editor/libeditor/html/crashtests/612565-1.html => editor/libeditor/crashtests/612565-1.html rename : editor/libeditor/html/crashtests/615015-1.html => editor/libeditor/crashtests/615015-1.html rename : editor/libeditor/html/crashtests/615450-1.html => editor/libeditor/crashtests/615450-1.html rename : editor/libeditor/html/crashtests/639736-1.xhtml => editor/libeditor/crashtests/639736-1.xhtml rename : editor/libeditor/html/crashtests/643786-1.html => editor/libeditor/crashtests/643786-1.html rename : editor/libeditor/html/crashtests/682650-1.html => editor/libeditor/crashtests/682650-1.html rename : editor/libeditor/html/crashtests/716456-1.html => editor/libeditor/crashtests/716456-1.html rename : editor/libeditor/html/crashtests/759748.html => editor/libeditor/crashtests/759748.html rename : editor/libeditor/html/crashtests/761861.html => editor/libeditor/crashtests/761861.html rename : editor/libeditor/html/crashtests/766305.html => editor/libeditor/crashtests/766305.html rename : editor/libeditor/html/crashtests/766387.html => editor/libeditor/crashtests/766387.html rename : editor/libeditor/html/crashtests/766795.html => editor/libeditor/crashtests/766795.html rename : editor/libeditor/html/crashtests/767169.html => editor/libeditor/crashtests/767169.html rename : editor/libeditor/html/crashtests/768748.html => editor/libeditor/crashtests/768748.html rename : editor/libeditor/html/crashtests/769008-1.html => editor/libeditor/crashtests/769008-1.html rename : editor/libeditor/html/crashtests/769967.xhtml => editor/libeditor/crashtests/769967.xhtml rename : editor/libeditor/html/crashtests/793866.html => editor/libeditor/crashtests/793866.html rename : editor/libeditor/html/nsEditProperty.cpp => editor/libeditor/nsEditProperty.cpp rename : editor/libeditor/html/nsHTMLAbsPosition.cpp => editor/libeditor/nsHTMLAbsPosition.cpp rename : editor/libeditor/html/nsHTMLAnonymousUtils.cpp => editor/libeditor/nsHTMLAnonymousUtils.cpp rename : editor/libeditor/html/nsHTMLCSSUtils.cpp => editor/libeditor/nsHTMLCSSUtils.cpp rename : editor/libeditor/html/nsHTMLCSSUtils.h => editor/libeditor/nsHTMLCSSUtils.h rename : editor/libeditor/html/nsHTMLDataTransfer.cpp => editor/libeditor/nsHTMLDataTransfer.cpp rename : editor/libeditor/html/nsHTMLEditRules.cpp => editor/libeditor/nsHTMLEditRules.cpp rename : editor/libeditor/html/nsHTMLEditRules.h => editor/libeditor/nsHTMLEditRules.h rename : editor/libeditor/html/nsHTMLEditUtils.cpp => editor/libeditor/nsHTMLEditUtils.cpp rename : editor/libeditor/html/nsHTMLEditUtils.h => editor/libeditor/nsHTMLEditUtils.h rename : editor/libeditor/html/nsHTMLEditor.cpp => editor/libeditor/nsHTMLEditor.cpp rename : editor/libeditor/html/nsHTMLEditor.h => editor/libeditor/nsHTMLEditor.h rename : editor/libeditor/html/nsHTMLEditorEventListener.cpp => editor/libeditor/nsHTMLEditorEventListener.cpp rename : editor/libeditor/html/nsHTMLEditorEventListener.h => editor/libeditor/nsHTMLEditorEventListener.h rename : editor/libeditor/html/nsHTMLEditorStyle.cpp => editor/libeditor/nsHTMLEditorStyle.cpp rename : editor/libeditor/html/nsHTMLInlineTableEditor.cpp => editor/libeditor/nsHTMLInlineTableEditor.cpp rename : editor/libeditor/html/nsHTMLObjectResizer.cpp => editor/libeditor/nsHTMLObjectResizer.cpp rename : editor/libeditor/html/nsHTMLObjectResizer.h => editor/libeditor/nsHTMLObjectResizer.h rename : editor/libeditor/html/nsHTMLURIRefObject.cpp => editor/libeditor/nsHTMLURIRefObject.cpp rename : editor/libeditor/html/nsHTMLURIRefObject.h => editor/libeditor/nsHTMLURIRefObject.h rename : editor/libeditor/html/nsTableEditor.cpp => editor/libeditor/nsTableEditor.cpp rename : editor/libeditor/html/nsWSRunObject.cpp => editor/libeditor/nsWSRunObject.cpp rename : editor/libeditor/html/nsWSRunObject.h => editor/libeditor/nsWSRunObject.h rename : editor/libeditor/html/tests/browserscope/lib/richtext/LICENSE => editor/libeditor/tests/browserscope/lib/richtext/LICENSE rename : editor/libeditor/html/tests/browserscope/lib/richtext/README => editor/libeditor/tests/browserscope/lib/richtext/README rename : editor/libeditor/html/tests/browserscope/lib/richtext/README.Mozilla => editor/libeditor/tests/browserscope/lib/richtext/README.Mozilla rename : editor/libeditor/html/tests/browserscope/lib/richtext/currentStatus.js => editor/libeditor/tests/browserscope/lib/richtext/currentStatus.js rename : editor/libeditor/html/tests/browserscope/lib/richtext/current_revision => editor/libeditor/tests/browserscope/lib/richtext/current_revision rename : editor/libeditor/html/tests/browserscope/lib/richtext/richtext/editable.html => editor/libeditor/tests/browserscope/lib/richtext/richtext/editable.html rename : editor/libeditor/html/tests/browserscope/lib/richtext/richtext/js/range.js => editor/libeditor/tests/browserscope/lib/richtext/richtext/js/range.js rename : editor/libeditor/html/tests/browserscope/lib/richtext/richtext/richtext.html => editor/libeditor/tests/browserscope/lib/richtext/richtext/richtext.html rename : editor/libeditor/html/tests/browserscope/lib/richtext/update_from_upstream => editor/libeditor/tests/browserscope/lib/richtext/update_from_upstream rename : editor/libeditor/html/tests/browserscope/lib/richtext2/LICENSE => editor/libeditor/tests/browserscope/lib/richtext2/LICENSE rename : editor/libeditor/html/tests/browserscope/lib/richtext2/README => editor/libeditor/tests/browserscope/lib/richtext2/README rename : editor/libeditor/html/tests/browserscope/lib/richtext2/README.Mozilla => editor/libeditor/tests/browserscope/lib/richtext2/README.Mozilla rename : editor/libeditor/html/tests/browserscope/lib/richtext2/currentStatus.js => editor/libeditor/tests/browserscope/lib/richtext2/currentStatus.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/current_revision => editor/libeditor/tests/browserscope/lib/richtext2/current_revision rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/__init__.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/__init__.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/common.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/common.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/handlers.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/handlers.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/common.css => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/common.css rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/editable-body.html => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable-body.html rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/editable-dM.html => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable-dM.html rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/editable-div.html => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable-div.html rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/editable.css => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/editable.css rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/canonicalize.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/canonicalize.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/compare.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/compare.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/output.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/output.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/pad.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/pad.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/range-bootstrap.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/range-bootstrap.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/range.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/range.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/run.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/run.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/units.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/units.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/static/js/variables.js => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/static/js/variables.js rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/templates/output.html => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/templates/output.html rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/templates/richtext2.html => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/templates/richtext2.html rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/__init__.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/__init__.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/apply.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/apply.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/applyCSS.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/applyCSS.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/change.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/change.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/changeCSS.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/changeCSS.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/delete.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/delete.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/forwarddelete.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/forwarddelete.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/insert.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/insert.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/queryEnabled.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryEnabled.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/queryIndeterm.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryIndeterm.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/queryState.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryState.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/querySupported.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/querySupported.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/queryValue.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/queryValue.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/selection.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/selection.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/unapply.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/unapply.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/tests/unapplyCSS.py => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/tests/unapplyCSS.py rename : editor/libeditor/html/tests/browserscope/lib/richtext2/richtext2/unittestexample.html => editor/libeditor/tests/browserscope/lib/richtext2/richtext2/unittestexample.html rename : editor/libeditor/html/tests/browserscope/lib/richtext2/update_from_upstream => editor/libeditor/tests/browserscope/lib/richtext2/update_from_upstream rename : editor/libeditor/html/tests/browserscope/mochitest.ini => editor/libeditor/tests/browserscope/mochitest.ini rename : editor/libeditor/html/tests/browserscope/test_richtext.html => editor/libeditor/tests/browserscope/test_richtext.html rename : editor/libeditor/html/tests/browserscope/test_richtext2.html => editor/libeditor/tests/browserscope/test_richtext2.html rename : editor/libeditor/html/tests/data/cfhtml-chromium.txt => editor/libeditor/tests/data/cfhtml-chromium.txt rename : editor/libeditor/html/tests/data/cfhtml-firefox.txt => editor/libeditor/tests/data/cfhtml-firefox.txt rename : editor/libeditor/html/tests/data/cfhtml-ie.txt => editor/libeditor/tests/data/cfhtml-ie.txt rename : editor/libeditor/html/tests/data/cfhtml-nocontext.txt => editor/libeditor/tests/data/cfhtml-nocontext.txt rename : editor/libeditor/html/tests/data/cfhtml-ooo.txt => editor/libeditor/tests/data/cfhtml-ooo.txt rename : editor/libeditor/html/tests/file_bug549262.html => editor/libeditor/tests/file_bug549262.html rename : editor/libeditor/html/tests/file_bug674770-1.html => editor/libeditor/tests/file_bug674770-1.html rename : editor/libeditor/html/tests/file_select_all_without_body.html => editor/libeditor/tests/file_select_all_without_body.html rename : editor/libeditor/html/tests/green.png => editor/libeditor/tests/green.png rename : editor/libeditor/html/tests/test_CF_HTML_clipboard.html => editor/libeditor/tests/test_CF_HTML_clipboard.html rename : editor/libeditor/html/tests/test_bug200416.html => editor/libeditor/tests/test_bug200416.html rename : editor/libeditor/html/tests/test_bug289384.html => editor/libeditor/tests/test_bug289384.html rename : editor/libeditor/html/tests/test_bug290026.html => editor/libeditor/tests/test_bug290026.html rename : editor/libeditor/html/tests/test_bug291780.html => editor/libeditor/tests/test_bug291780.html rename : editor/libeditor/html/tests/test_bug316447.html => editor/libeditor/tests/test_bug316447.html rename : editor/libeditor/html/tests/test_bug332636.html => editor/libeditor/tests/test_bug332636.html rename : editor/libeditor/html/tests/test_bug332636.html^headers^ => editor/libeditor/tests/test_bug332636.html^headers^ rename : editor/libeditor/html/tests/test_bug366682.html => editor/libeditor/tests/test_bug366682.html rename : editor/libeditor/html/tests/test_bug372345.html => editor/libeditor/tests/test_bug372345.html rename : editor/libeditor/html/tests/test_bug404320.html => editor/libeditor/tests/test_bug404320.html rename : editor/libeditor/html/tests/test_bug410986.html => editor/libeditor/tests/test_bug410986.html rename : editor/libeditor/html/tests/test_bug414526.html => editor/libeditor/tests/test_bug414526.html rename : editor/libeditor/html/tests/test_bug417418.html => editor/libeditor/tests/test_bug417418.html rename : editor/libeditor/html/tests/test_bug432225.html => editor/libeditor/tests/test_bug432225.html rename : editor/libeditor/html/tests/test_bug439808.html => editor/libeditor/tests/test_bug439808.html rename : editor/libeditor/html/tests/test_bug442186.html => editor/libeditor/tests/test_bug442186.html rename : editor/libeditor/html/tests/test_bug449243.html => editor/libeditor/tests/test_bug449243.html rename : editor/libeditor/html/tests/test_bug455992.html => editor/libeditor/tests/test_bug455992.html rename : editor/libeditor/html/tests/test_bug456244.html => editor/libeditor/tests/test_bug456244.html rename : editor/libeditor/html/tests/test_bug460740.html => editor/libeditor/tests/test_bug460740.html rename : editor/libeditor/html/tests/test_bug468353.html => editor/libeditor/tests/test_bug468353.html rename : editor/libeditor/html/tests/test_bug478725.html => editor/libeditor/tests/test_bug478725.html rename : editor/libeditor/html/tests/test_bug480647.html => editor/libeditor/tests/test_bug480647.html rename : editor/libeditor/html/tests/test_bug480972.html => editor/libeditor/tests/test_bug480972.html rename : editor/libeditor/html/tests/test_bug484181.html => editor/libeditor/tests/test_bug484181.html rename : editor/libeditor/html/tests/test_bug487524.html => editor/libeditor/tests/test_bug487524.html rename : editor/libeditor/html/tests/test_bug489202.xul => editor/libeditor/tests/test_bug489202.xul rename : editor/libeditor/html/tests/test_bug490879.xul => editor/libeditor/tests/test_bug490879.xul rename : editor/libeditor/html/tests/test_bug520189.html => editor/libeditor/tests/test_bug520189.html rename : editor/libeditor/html/tests/test_bug525389.html => editor/libeditor/tests/test_bug525389.html rename : editor/libeditor/html/tests/test_bug537046.html => editor/libeditor/tests/test_bug537046.html rename : editor/libeditor/html/tests/test_bug549262.html => editor/libeditor/tests/test_bug549262.html rename : editor/libeditor/html/tests/test_bug550434.html => editor/libeditor/tests/test_bug550434.html rename : editor/libeditor/html/tests/test_bug551704.html => editor/libeditor/tests/test_bug551704.html rename : editor/libeditor/html/tests/test_bug552782.html => editor/libeditor/tests/test_bug552782.html rename : editor/libeditor/html/tests/test_bug570144.html => editor/libeditor/tests/test_bug570144.html rename : editor/libeditor/html/tests/test_bug578771.html => editor/libeditor/tests/test_bug578771.html rename : editor/libeditor/html/tests/test_bug587461.html => editor/libeditor/tests/test_bug587461.html rename : editor/libeditor/html/tests/test_bug592592.html => editor/libeditor/tests/test_bug592592.html rename : editor/libeditor/html/tests/test_bug597784.html => editor/libeditor/tests/test_bug597784.html rename : editor/libeditor/html/tests/test_bug599322.html => editor/libeditor/tests/test_bug599322.html rename : editor/libeditor/html/tests/test_bug607584.html => editor/libeditor/tests/test_bug607584.html rename : editor/libeditor/html/tests/test_bug607584.xul => editor/libeditor/tests/test_bug607584.xul rename : editor/libeditor/html/tests/test_bug611182.html => editor/libeditor/tests/test_bug611182.html rename : editor/libeditor/html/tests/test_bug612128.html => editor/libeditor/tests/test_bug612128.html rename : editor/libeditor/html/tests/test_bug612447.html => editor/libeditor/tests/test_bug612447.html rename : editor/libeditor/html/tests/test_bug616590.xul => editor/libeditor/tests/test_bug616590.xul rename : editor/libeditor/html/tests/test_bug620906.html => editor/libeditor/tests/test_bug620906.html rename : editor/libeditor/html/tests/test_bug622371.html => editor/libeditor/tests/test_bug622371.html rename : editor/libeditor/html/tests/test_bug629845.html => editor/libeditor/tests/test_bug629845.html rename : editor/libeditor/html/tests/test_bug635636.html => editor/libeditor/tests/test_bug635636.html rename : editor/libeditor/html/tests/test_bug640321.html => editor/libeditor/tests/test_bug640321.html rename : editor/libeditor/html/tests/test_bug668599.html => editor/libeditor/tests/test_bug668599.html rename : editor/libeditor/html/tests/test_bug674770-1.html => editor/libeditor/tests/test_bug674770-1.html rename : editor/libeditor/html/tests/test_bug674770-2.html => editor/libeditor/tests/test_bug674770-2.html rename : editor/libeditor/html/tests/test_bug674861.html => editor/libeditor/tests/test_bug674861.html rename : editor/libeditor/html/tests/test_bug676401.html => editor/libeditor/tests/test_bug676401.html rename : editor/libeditor/html/tests/test_bug677752.html => editor/libeditor/tests/test_bug677752.html rename : editor/libeditor/html/tests/test_bug686203.html => editor/libeditor/tests/test_bug686203.html rename : editor/libeditor/html/tests/test_bug697842.html => editor/libeditor/tests/test_bug697842.html rename : editor/libeditor/html/tests/test_bug725069.html => editor/libeditor/tests/test_bug725069.html rename : editor/libeditor/html/tests/test_bug735059.html => editor/libeditor/tests/test_bug735059.html rename : editor/libeditor/html/tests/test_bug738366.html => editor/libeditor/tests/test_bug738366.html rename : editor/libeditor/html/tests/test_bug757371.html => editor/libeditor/tests/test_bug757371.html rename : editor/libeditor/html/tests/test_bug767684.html => editor/libeditor/tests/test_bug767684.html rename : editor/libeditor/html/tests/test_bug780035.html => editor/libeditor/tests/test_bug780035.html rename : editor/libeditor/html/tests/test_bug780908.xul => editor/libeditor/tests/test_bug780908.xul rename : editor/libeditor/html/tests/test_bug787432.html => editor/libeditor/tests/test_bug787432.html rename : editor/libeditor/html/tests/test_bug790475.html => editor/libeditor/tests/test_bug790475.html rename : editor/libeditor/html/tests/test_bug796839.html => editor/libeditor/tests/test_bug796839.html rename : editor/libeditor/html/tests/test_bug832025.html => editor/libeditor/tests/test_bug832025.html rename : editor/libeditor/html/tests/test_bug857487.html => editor/libeditor/tests/test_bug857487.html rename : editor/libeditor/html/tests/test_bug966155.html => editor/libeditor/tests/test_bug966155.html rename : editor/libeditor/html/tests/test_bug966552.html => editor/libeditor/tests/test_bug966552.html rename : editor/libeditor/html/tests/test_bug998188.html => editor/libeditor/tests/test_bug998188.html rename : editor/libeditor/html/tests/test_contenteditable_focus.html => editor/libeditor/tests/test_contenteditable_focus.html rename : editor/libeditor/html/tests/test_contenteditable_text_input_handling.html => editor/libeditor/tests/test_contenteditable_text_input_handling.html rename : editor/libeditor/html/tests/test_dom_input_event_on_htmleditor.html => editor/libeditor/tests/test_dom_input_event_on_htmleditor.html rename : editor/libeditor/html/tests/test_htmleditor_keyevent_handling.html => editor/libeditor/tests/test_htmleditor_keyevent_handling.html rename : editor/libeditor/html/tests/test_keypress_untrusted_event.html => editor/libeditor/tests/test_keypress_untrusted_event.html rename : editor/libeditor/html/tests/test_root_element_replacement.html => editor/libeditor/tests/test_root_element_replacement.html rename : editor/libeditor/html/tests/test_select_all_without_body.html => editor/libeditor/tests/test_select_all_without_body.html rename : editor/libeditor/html/tests/test_spellcheck_pref.html => editor/libeditor/tests/test_spellcheck_pref.html
2014-08-18 14:28:17 -07:00
nsresult GetNodesFromPoint(::DOMPoint point,
EditAction operation,
nsCOMArray<nsIDOMNode>& arrayOfNodes,
bool dontTouchContent);
nsresult GetNodesFromSelection(mozilla::dom::Selection* selection,
EditAction operation,
nsCOMArray<nsIDOMNode>& arrayOfNodes,
bool aDontTouchContent=false);
nsresult GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes, bool aEntireList, bool aDontTouchContent=false);
void GetDefinitionListItemTypes(mozilla::dom::Element* aElement, bool* aDT, bool* aDD);
nsresult GetParagraphFormatNodes(nsCOMArray<nsIDOMNode>& outArrayOfNodes, bool aDontTouchContent=false);
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,
nsTArray<bool> &inTransitionArray);
nsresult RemoveBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes);
nsresult ApplyBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes, const nsAString *aBlockTag);
nsresult MakeBlockquote(nsCOMArray<nsIDOMNode>& arrayOfNodes);
nsresult SplitAsNeeded(nsIAtom& aTag, nsCOMPtr<nsINode>& inOutParent,
int32_t& inOutOffset);
nsresult AddTerminatingBR(nsIDOMNode *aBlock);
::DOMPoint JoinNodesSmart(nsIContent& aNodeLeft, nsIContent& aNodeRight);
mozilla::dom::Element* GetTopEnclosingMailCite(nsINode& aNode);
nsresult PopListItem(nsIDOMNode *aListItem, bool *aOutOfList);
nsresult RemoveListStructure(nsIDOMNode *aList);
nsresult CacheInlineStyles(nsIDOMNode *aNode);
nsresult ReapplyCachedStyles();
void ClearCachedStyles();
nsresult AdjustSpecialBreaks(bool aSafeToAskFrames = false);
nsresult AdjustWhitespace(mozilla::dom::Selection* aSelection);
nsresult PinSelectionToNewBlock(mozilla::dom::Selection* aSelection);
nsresult CheckInterlinePosition(mozilla::dom::Selection* aSelection);
nsresult AdjustSelection(mozilla::dom::Selection* aSelection,
nsIEditor::EDirection aAction);
nsresult FindNearSelectableNode(nsIDOMNode *aSelNode,
int32_t aSelOffset,
nsIEditor::EDirection &aDirection,
nsCOMPtr<nsIDOMNode> *outSelectableNode);
/**
* 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);
nsresult RemoveEmptyNodes();
nsresult SelectionEndpointInNode(nsINode *aNode, bool *aResult);
nsresult UpdateDocChangeRange(nsRange* aRange);
nsresult ConfirmSelectionInBody();
nsresult InsertMozBRIfNeeded(nsIDOMNode *aNode);
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);
nsresult RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, int8_t aRelativeChange);
void DocumentModifiedWorker();
// data members
protected:
nsHTMLEditor *mHTMLEditor;
nsRefPtr<nsRange> mDocChangeRange;
bool mListenerEnabled;
bool mReturnInEmptyLIKillsList;
bool mDidDeleteSelection;
bool mDidRangedDelete;
bool mRestoreContentEditableCount;
nsRefPtr<nsRange> mUtilRange;
uint32_t mJoinOffset; // need to remember an int across willJoin/didJoin...
nsCOMPtr<nsIDOMNode> mNewBlock;
nsRefPtr<nsRangeStore> mRangeItem;
StyleCache mCachedStyles[SIZE_STYLE_TABLE];
};
#endif //nsHTMLEditRules_h__