2001-09-26 02:53:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
1999-03-29 10:21:01 +04:00
|
|
|
|
2016-07-07 13:05:51 +03:00
|
|
|
#ifndef HTMLEditRules_h
|
|
|
|
#define HTMLEditRules_h
|
1999-03-29 10:21:01 +04:00
|
|
|
|
2003-06-03 02:21:06 +04:00
|
|
|
#include "TypeInState.h"
|
2016-07-09 05:34:41 +03:00
|
|
|
#include "mozilla/SelectionState.h"
|
|
|
|
#include "mozilla/TextEditRules.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIEditActionListener.h"
|
|
|
|
#include "nsIEditor.h"
|
|
|
|
#include "nsIHTMLEditor.h"
|
|
|
|
#include "nsISupportsImpl.h"
|
2009-04-22 12:43:15 +04:00
|
|
|
#include "nsTArray.h"
|
2012-07-13 10:33:42 +04:00
|
|
|
#include "nscore.h"
|
1999-03-29 10:21:01 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
class nsAtom;
|
2012-07-13 10:33:42 +04:00
|
|
|
class nsIDOMCharacterData;
|
|
|
|
class nsIDOMDocument;
|
1999-11-25 03:19:45 +03:00
|
|
|
class nsIDOMElement;
|
2012-07-13 10:33:42 +04:00
|
|
|
class nsIDOMNode;
|
2000-05-04 12:33:48 +04:00
|
|
|
class nsIEditor;
|
2012-07-13 10:33:42 +04:00
|
|
|
class nsINode;
|
|
|
|
class nsRange;
|
2016-07-07 13:05:51 +03:00
|
|
|
|
2012-07-13 10:33:42 +04:00
|
|
|
namespace mozilla {
|
2016-07-07 13:05:51 +03:00
|
|
|
|
2016-11-18 11:59:23 +03:00
|
|
|
class EditActionResult;
|
2016-07-09 05:42:33 +03:00
|
|
|
class HTMLEditor;
|
2016-07-07 13:33:32 +03:00
|
|
|
class RulesInfo;
|
2016-07-09 05:54:50 +03:00
|
|
|
class TextEditor;
|
2016-06-23 11:13:03 +03:00
|
|
|
struct EditorDOMPoint;
|
2012-07-13 10:33:42 +04:00
|
|
|
namespace dom {
|
|
|
|
class Element;
|
2014-04-10 20:09:40 +04:00
|
|
|
class Selection;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
1999-06-16 09:02:43 +04:00
|
|
|
|
2016-07-07 13:05:51 +03:00
|
|
|
struct StyleCache final : public PropItem
|
2003-06-03 02:21:06 +04:00
|
|
|
{
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPresent;
|
2015-05-28 18:58:42 +03:00
|
|
|
|
2016-07-07 13:05:51 +03:00
|
|
|
StyleCache()
|
|
|
|
: PropItem()
|
|
|
|
, mPresent(false)
|
|
|
|
{
|
2007-12-12 06:23:34 +03:00
|
|
|
MOZ_COUNT_CTOR(StyleCache);
|
|
|
|
}
|
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
StyleCache(nsAtom* aTag,
|
2016-07-07 13:05:51 +03:00
|
|
|
const nsAString& aAttr,
|
|
|
|
const nsAString& aValue)
|
|
|
|
: PropItem(aTag, aAttr, aValue)
|
|
|
|
, mPresent(false)
|
|
|
|
{
|
2007-12-12 06:23:34 +03:00
|
|
|
MOZ_COUNT_CTOR(StyleCache);
|
|
|
|
}
|
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
StyleCache(nsAtom* aTag,
|
2017-01-06 16:35:48 +03:00
|
|
|
const nsAString& aAttr)
|
|
|
|
: PropItem(aTag, aAttr, EmptyString())
|
|
|
|
, mPresent(false)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(StyleCache);
|
|
|
|
}
|
|
|
|
|
2016-07-07 13:05:51 +03:00
|
|
|
~StyleCache()
|
|
|
|
{
|
2007-12-12 06:23:34 +03:00
|
|
|
MOZ_COUNT_DTOR(StyleCache);
|
|
|
|
}
|
2003-06-03 02:21:06 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define SIZE_STYLE_TABLE 19
|
|
|
|
|
2016-07-09 05:34:41 +03:00
|
|
|
class HTMLEditRules : public TextEditRules
|
2016-07-07 13:05:51 +03:00
|
|
|
, public nsIEditActionListener
|
1999-03-29 10:21:01 +04:00
|
|
|
{
|
|
|
|
public:
|
2000-03-24 03:26:47 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2016-07-09 05:34:41 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(HTMLEditRules, TextEditRules)
|
1999-03-29 10:21:01 +04:00
|
|
|
|
2016-07-07 13:05:51 +03:00
|
|
|
HTMLEditRules();
|
2000-03-24 03:26:47 +03:00
|
|
|
|
|
|
|
// nsIEditRules methods
|
2016-07-09 05:54:50 +03:00
|
|
|
NS_IMETHOD Init(TextEditor* aTextEditor) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD DetachEditor() override;
|
2012-08-12 22:28:26 +04:00
|
|
|
NS_IMETHOD BeforeEdit(EditAction action,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIEditor::EDirection aDirection) override;
|
2012-08-12 22:28:26 +04:00
|
|
|
NS_IMETHOD AfterEdit(EditAction action,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIEditor::EDirection aDirection) override;
|
2016-07-07 13:33:32 +03:00
|
|
|
NS_IMETHOD WillDoAction(Selection* aSelection, RulesInfo* aInfo,
|
2015-03-21 19:28:04 +03:00
|
|
|
bool* aCancel, bool* aHandled) override;
|
2016-07-07 13:33:32 +03:00
|
|
|
NS_IMETHOD DidDoAction(Selection* aSelection, RulesInfo* aInfo,
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult aResult) override;
|
2017-06-28 01:42:09 +03:00
|
|
|
NS_IMETHOD_(bool) DocumentIsEmpty() override;
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD DocumentModified() override;
|
1999-04-05 21:21:59 +04:00
|
|
|
|
2016-07-07 13:05:51 +03: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);
|
2017-03-03 07:13:21 +03:00
|
|
|
nsresult MakeSureElemStartsOrEndsOnCR(nsINode& aNode);
|
2000-05-03 04:14:28 +04:00
|
|
|
|
2000-03-24 03:26:47 +03:00
|
|
|
// nsIEditActionListener methods
|
2015-05-28 18:58:42 +03:00
|
|
|
|
2016-07-07 13:05:51 +03: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;
|
2016-04-20 21:19:20 +03:00
|
|
|
void DeleteNodeIfCollapsedText(nsINode& aNode);
|
2000-03-24 03:26:47 +03:00
|
|
|
|
1999-04-05 21:21:59 +04:00
|
|
|
protected:
|
2016-07-07 13:05:51 +03:00
|
|
|
virtual ~HTMLEditRules();
|
1999-04-05 21:21:59 +04:00
|
|
|
|
1999-06-16 09:02:43 +04:00
|
|
|
enum RulesEndpoint
|
|
|
|
{
|
|
|
|
kStart,
|
|
|
|
kEnd
|
|
|
|
};
|
|
|
|
|
2014-05-10 01:02:29 +04:00
|
|
|
void InitFields();
|
|
|
|
|
2016-05-01 16:15:14 +03:00
|
|
|
void WillInsert(Selection& aSelection, bool* aCancel);
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult WillInsertText(EditAction aAction,
|
|
|
|
Selection* aSelection,
|
|
|
|
bool* aCancel,
|
|
|
|
bool* aHandled,
|
|
|
|
const nsAString* inString,
|
|
|
|
nsAString* outString,
|
|
|
|
int32_t aMaxLength);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult WillLoadHTML(Selection* aSelection, bool* aCancel);
|
|
|
|
nsresult WillInsertBreak(Selection& aSelection, bool* aCancel,
|
|
|
|
bool* aHandled);
|
2016-04-23 12:32:13 +03:00
|
|
|
nsresult StandardBreakImpl(nsINode& aNode, int32_t aOffset,
|
2016-05-01 16:15:14 +03:00
|
|
|
Selection& aSelection);
|
|
|
|
nsresult DidInsertBreak(Selection* aSelection, nsresult aResult);
|
|
|
|
nsresult SplitMailCites(Selection* aSelection, bool* aHandled);
|
|
|
|
nsresult WillDeleteSelection(Selection* aSelection,
|
2012-05-10 18:54:33 +04:00
|
|
|
nsIEditor::EDirection aAction,
|
|
|
|
nsIEditor::EStripWrappers aStripWrappers,
|
|
|
|
bool* aCancel, bool* aHandled);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult DidDeleteSelection(Selection* aSelection,
|
2015-05-28 18:58:42 +03:00
|
|
|
nsIEditor::EDirection aDir,
|
2003-03-23 22:51:03 +03:00
|
|
|
nsresult aResult);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult InsertBRIfNeeded(Selection* aSelection);
|
2017-08-01 16:38:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert a normal <br> element or a moz-<br> element to aNode when
|
|
|
|
* aNode is a block and it has no children.
|
|
|
|
*
|
|
|
|
* @param aNode Reference to a block parent.
|
|
|
|
* @param aInsertMozBR true if this should insert a moz-<br> element.
|
|
|
|
* Otherwise, i.e., this should insert a normal <br>
|
|
|
|
* element, false.
|
|
|
|
*/
|
|
|
|
nsresult InsertBRIfNeededInternal(nsINode& aNode, bool aInsertMozBR);
|
|
|
|
|
2016-06-23 11:13:03 +03:00
|
|
|
mozilla::EditorDOMPoint GetGoodSelPointForNode(nsINode& aNode,
|
|
|
|
nsIEditor::EDirection aAction);
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TryToJoinBlocks() tries to join two block elements. The right element is
|
|
|
|
* always joined to the left element. If the elements are the same type and
|
|
|
|
* not nested within each other, JoinNodesSmart() is called (example, joining
|
|
|
|
* two list items together into one). If the elements are not the same type,
|
|
|
|
* or one is a descendant of the other, we instead destroy the right block
|
|
|
|
* placing its children into leftblock. DTD containment rules are followed
|
|
|
|
* throughout.
|
|
|
|
*
|
2016-11-18 11:59:23 +03:00
|
|
|
* @return Sets canceled to true if the operation should do
|
|
|
|
* nothing anymore even if this doesn't join the blocks.
|
|
|
|
* Sets handled to true if this actually handles the
|
|
|
|
* request. Note that this may set it to true even if this
|
|
|
|
* does not join the block. E.g., if the blocks shouldn't
|
|
|
|
* be joined or it's impossible to join them but it's not
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
* unexpected case, this returns true with this.
|
|
|
|
*/
|
2016-11-18 11:59:23 +03:00
|
|
|
EditActionResult TryToJoinBlocks(nsIContent& aLeftNode,
|
|
|
|
nsIContent& aRightNode);
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MoveBlock() moves the content from aRightBlock starting from aRightOffset
|
|
|
|
* into aLeftBlock at aLeftOffset. Note that the "block" can be inline nodes
|
|
|
|
* between <br>s, or between blocks, etc. DTD containment rules are followed
|
|
|
|
* throughout.
|
|
|
|
*
|
2016-11-18 11:59:23 +03:00
|
|
|
* @return Sets handled to true if this actually joins the nodes.
|
|
|
|
* canceled is always false.
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
*/
|
2016-11-18 11:59:23 +03:00
|
|
|
EditActionResult MoveBlock(Element& aLeftBlock, Element& aRightBlock,
|
|
|
|
int32_t aLeftOffset, int32_t aRightOffset);
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MoveNodeSmart() moves aNode to (aDestElement, aInOutDestOffset).
|
|
|
|
* DTD containment rules are followed throughout.
|
|
|
|
*
|
|
|
|
* @param aOffset returns the point after inserted content.
|
2016-11-18 11:59:23 +03:00
|
|
|
* @return Sets true to handled if this actually moves
|
|
|
|
* the nodes.
|
|
|
|
* canceled is always false.
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
*/
|
2016-11-18 11:59:23 +03:00
|
|
|
EditActionResult MoveNodeSmart(nsIContent& aNode, Element& aDestElement,
|
|
|
|
int32_t* aInOutDestOffset);
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* MoveContents() moves the contents of aElement to (aDestElement,
|
|
|
|
* aInOutDestOffset). DTD containment rules are followed throughout.
|
|
|
|
*
|
|
|
|
* @param aInOutDestOffset updated to point after inserted content.
|
2016-11-18 11:59:23 +03:00
|
|
|
* @return Sets true to handled if this actually moves
|
|
|
|
* the nodes.
|
|
|
|
* canceled is always false.
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
*/
|
2016-11-18 11:59:23 +03:00
|
|
|
EditActionResult MoveContents(Element& aElement, Element& aDestElement,
|
|
|
|
int32_t* aInOutDestOffset);
|
Bug 1316302 part.1 Helper methods for HTMLEditRules::WillDeleteSelection() should have an out argument to indicates if it actually handles the action r=smaug
When HTMLEditRules::WillDeleteSelection() tries to remove something from the end/start of a block to its last/first text node but it's contained by block elements, it tries to join the container and the block. However, JoinBlocks() always fails to join them since it's impossible operation. In this case, HTMLEditRules::WillDeleteSelection() should retry to remove something in the leaf, however, it's impossible for now because JoinBlocks() and its helper methods don't return if it handles the action actually.
This patch renames |JoinBlocks()| to |TryToJoinBlocks()| for representing what it is. And this patch adds |bool* aHandled| to the helper methods. Then, *aHandled and *aCancel are now always returns the result of each method. Therefore, for merging the result of multiple helper methods, callers need to receive the result with temporary variables and merge them by themselves.
Note that when they modify DOM node actually or the action should do nothing (for example, selection is across tables), aHandled is set to true.
MozReview-Commit-ID: 7ApUOgtLUog
--HG--
extra : rebase_source : 4abc1ec208107b782a719df058623fd7f92d180c
2016-11-18 11:54:31 +03:00
|
|
|
|
2012-05-18 12:29:39 +04:00
|
|
|
nsresult DeleteNonTableElements(nsINode* aNode);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult WillMakeList(Selection* aSelection,
|
2012-07-23 14:27:22 +04:00
|
|
|
const nsAString* aListType,
|
|
|
|
bool aEntireList,
|
|
|
|
const nsAString* aBulletType,
|
|
|
|
bool* aCancel, bool* aHandled,
|
2012-07-30 18:20:58 +04:00
|
|
|
const nsAString* aItemType = nullptr);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult WillRemoveList(Selection* aSelection, bool aOrdered, bool* aCancel,
|
|
|
|
bool* aHandled);
|
|
|
|
nsresult WillIndent(Selection* aSelection, bool* aCancel, bool* aHandled);
|
|
|
|
nsresult WillCSSIndent(Selection* aSelection, bool* aCancel, bool* aHandled);
|
|
|
|
nsresult WillHTMLIndent(Selection* aSelection, bool* aCancel,
|
|
|
|
bool* aHandled);
|
2016-05-01 16:15:51 +03:00
|
|
|
nsresult WillOutdent(Selection& aSelection, bool* aCancel, bool* aHandled);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult WillAlign(Selection& aSelection, const nsAString& aAlignType,
|
2012-07-23 14:27:22 +04:00
|
|
|
bool* aCancel, bool* aHandled);
|
2016-05-01 17:58:41 +03:00
|
|
|
nsresult WillAbsolutePosition(Selection& aSelection, bool* aCancel,
|
2016-05-01 16:15:14 +03:00
|
|
|
bool* aHandled);
|
|
|
|
nsresult WillRemoveAbsolutePosition(Selection* aSelection, bool* aCancel,
|
|
|
|
bool* aHandled);
|
|
|
|
nsresult WillRelativeChangeZIndex(Selection* aSelection, int32_t aChange,
|
2012-07-23 14:27:22 +04:00
|
|
|
bool* aCancel, bool* aHandled);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult WillMakeDefListItem(Selection* aSelection,
|
2012-07-23 14:27:22 +04:00
|
|
|
const nsAString* aBlockType, bool aEntireList,
|
|
|
|
bool* aCancel, bool* aHandled);
|
2016-05-01 17:58:17 +03:00
|
|
|
nsresult WillMakeBasicBlock(Selection& aSelection,
|
|
|
|
const nsAString& aBlockType,
|
2012-07-23 14:27:22 +04:00
|
|
|
bool* aCancel, bool* aHandled);
|
2017-10-03 01:05:19 +03:00
|
|
|
nsresult MakeBasicBlock(Selection& aSelection, nsAtom& aBlockType);
|
2016-07-07 13:33:32 +03:00
|
|
|
nsresult DidMakeBasicBlock(Selection* aSelection, RulesInfo* aInfo,
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult aResult);
|
2003-06-25 12:50:48 +04:00
|
|
|
nsresult DidAbsolutePosition();
|
2015-04-24 14:27:35 +03:00
|
|
|
nsresult AlignInnerBlocks(nsINode& aNode, const nsAString* alignType);
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult AlignBlockContents(nsIDOMNode* aNode, const nsAString* alignType);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult AppendInnerFormatNodes(nsTArray<OwningNonNull<nsINode>>& aArray,
|
2012-05-18 12:29:39 +04:00
|
|
|
nsINode* aNode);
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult GetFormatString(nsIDOMNode* aNode, nsAString &outFormat);
|
2015-04-24 14:27:34 +03:00
|
|
|
enum class Lists { no, yes };
|
|
|
|
enum class Tables { no, yes };
|
|
|
|
void GetInnerContent(nsINode& aNode,
|
2016-05-01 16:15:14 +03:00
|
|
|
nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
|
2015-04-24 14:27:34 +03:00
|
|
|
int32_t* aIndex, Lists aLists = Lists::yes,
|
|
|
|
Tables aTables = Tables::yes);
|
2016-05-01 16:15:14 +03:00
|
|
|
Element* IsInListItem(nsINode* aNode);
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom& DefaultParagraphSeparator();
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult ReturnInHeader(Selection& aSelection, Element& aHeader,
|
|
|
|
nsINode& aNode, int32_t aOffset);
|
2017-10-08 00:30:38 +03:00
|
|
|
nsresult ReturnInParagraph(Selection* aSelection, nsINode* aHeader,
|
|
|
|
nsINode* aTextNode, int32_t aOffset,
|
|
|
|
nsIContent* aChildAtOffset, bool* aCancel,
|
|
|
|
bool* aHandled);
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult SplitParagraph(nsIDOMNode* aPara,
|
2016-05-01 17:59:17 +03:00
|
|
|
nsIContent* aBRNode,
|
2016-05-01 16:15:14 +03:00
|
|
|
Selection* aSelection,
|
2016-07-07 13:05:51 +03:00
|
|
|
nsCOMPtr<nsIDOMNode>* aSelNode,
|
|
|
|
int32_t* aOffset);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult ReturnInListItem(Selection& aSelection, Element& aHeader,
|
|
|
|
nsINode& aNode, int32_t aOffset);
|
2012-08-12 22:28:26 +04:00
|
|
|
nsresult AfterEditInner(EditAction action,
|
2012-05-05 22:52:29 +04:00
|
|
|
nsIEditor::EDirection aDirection);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult RemovePartOfBlock(Element& aBlock, nsIContent& aStartChild,
|
2015-04-24 14:27:35 +03:00
|
|
|
nsIContent& aEndChild);
|
2016-07-07 13:05:51 +03:00
|
|
|
void SplitBlock(Element& aBlock,
|
|
|
|
nsIContent& aStartChild,
|
|
|
|
nsIContent& aEndChild,
|
|
|
|
nsIContent** aOutLeftNode = nullptr,
|
|
|
|
nsIContent** aOutRightNode = nullptr,
|
|
|
|
nsIContent** aOutMiddleNode = nullptr);
|
2016-05-01 16:16:03 +03:00
|
|
|
nsresult OutdentPartOfBlock(Element& aBlock,
|
|
|
|
nsIContent& aStartChild,
|
|
|
|
nsIContent& aEndChild,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aIsBlockIndentedWithCSS,
|
2016-05-01 16:16:03 +03:00
|
|
|
nsIContent** aOutLeftNode,
|
|
|
|
nsIContent** aOutRightNode);
|
2012-06-06 11:36:46 +04:00
|
|
|
|
2017-10-03 01:05:19 +03:00
|
|
|
already_AddRefed<Element> ConvertListType(Element* aList, nsAtom* aListType,
|
|
|
|
nsAtom* aItemType);
|
2012-06-06 11:36:46 +04:00
|
|
|
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult CreateStyleForInsertText(Selection& aSelection, nsIDocument& aDoc);
|
2016-05-01 16:13:27 +03:00
|
|
|
enum class MozBRCounts { yes, no };
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult IsEmptyBlock(Element& aNode, bool* aOutIsEmptyBlock,
|
2016-05-01 16:13:27 +03:00
|
|
|
MozBRCounts aMozBRCounts = MozBRCounts::yes);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult CheckForEmptyBlock(nsINode* aStartNode, Element* aBodyNode,
|
|
|
|
Selection* aSelection,
|
|
|
|
nsIEditor::EDirection aAction, bool* aHandled);
|
2016-05-01 16:15:02 +03:00
|
|
|
enum class BRLocation { beforeBlock, blockEnd };
|
2016-05-01 16:15:14 +03:00
|
|
|
Element* CheckForInvisibleBR(Element& aBlock, BRLocation aWhere,
|
|
|
|
int32_t aOffset = 0);
|
|
|
|
nsresult ExpandSelectionForDeletion(Selection& aSelection);
|
2016-07-07 13:05:51 +03:00
|
|
|
bool IsFirstNode(nsIDOMNode* aNode);
|
|
|
|
bool IsLastNode(nsIDOMNode* aNode);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult NormalizeSelection(Selection* aSelection);
|
2017-07-10 11:35:26 +03:00
|
|
|
EditorDOMPoint GetPromotedPoint(RulesEndpoint aWhere, nsINode& aNode,
|
|
|
|
int32_t aOffset, EditAction actionID);
|
2016-05-01 16:15:14 +03:00
|
|
|
void GetPromotedRanges(Selection& aSelection,
|
2015-10-18 08:24:48 +03:00
|
|
|
nsTArray<RefPtr<nsRange>>& outArrayOfRanges,
|
2015-04-24 14:27:34 +03:00
|
|
|
EditAction inOperationType);
|
2015-04-24 14:27:34 +03:00
|
|
|
void PromoteRange(nsRange& aRange, EditAction inOperationType);
|
2015-04-24 14:27:34 +03:00
|
|
|
enum class TouchContent { no, yes };
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult GetNodesForOperation(
|
|
|
|
nsTArray<RefPtr<nsRange>>& aArrayOfRanges,
|
|
|
|
nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
|
|
|
|
EditAction aOperationType,
|
|
|
|
TouchContent aTouchContent = TouchContent::yes);
|
|
|
|
void GetChildNodesForOperation(
|
|
|
|
nsINode& aNode,
|
|
|
|
nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes);
|
|
|
|
nsresult GetNodesFromPoint(EditorDOMPoint aPoint,
|
2015-04-24 14:27:35 +03:00
|
|
|
EditAction aOperation,
|
2016-05-01 16:15:14 +03:00
|
|
|
nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
|
2015-04-24 14:27:35 +03:00
|
|
|
TouchContent aTouchContent);
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult GetNodesFromSelection(
|
|
|
|
Selection& aSelection,
|
|
|
|
EditAction aOperation,
|
|
|
|
nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
|
|
|
|
TouchContent aTouchContent = TouchContent::yes);
|
2015-04-24 14:27:34 +03:00
|
|
|
enum class EntireList { no, yes };
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult GetListActionNodes(
|
|
|
|
nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes,
|
|
|
|
EntireList aEntireList,
|
|
|
|
TouchContent aTouchContent = TouchContent::yes);
|
2016-05-01 16:15:14 +03:00
|
|
|
void GetDefinitionListItemTypes(Element* aElement, bool* aDT, bool* aDD);
|
2015-04-24 14:27:34 +03:00
|
|
|
nsresult GetParagraphFormatNodes(
|
2016-07-07 13:05:51 +03:00
|
|
|
nsTArray<OwningNonNull<nsINode>>& outArrayOfNodes,
|
|
|
|
TouchContent aTouchContent = TouchContent::yes);
|
2016-05-01 16:15:14 +03:00
|
|
|
void LookInsideDivBQandList(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult BustUpInlinesAtRangeEndpoints(RangeItem& inRange);
|
|
|
|
nsresult BustUpInlinesAtBRs(
|
|
|
|
nsIContent& aNode,
|
|
|
|
nsTArray<OwningNonNull<nsINode>>& aOutArrayOfNodes);
|
2016-05-01 16:13:51 +03:00
|
|
|
nsIContent* GetHighestInlineParent(nsINode& aNode);
|
2016-05-01 16:15:14 +03:00
|
|
|
void MakeTransitionList(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
|
2015-04-24 14:27:35 +03:00
|
|
|
nsTArray<bool>& aTransitionArray);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult RemoveBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
|
|
|
|
nsresult ApplyBlockStyle(nsTArray<OwningNonNull<nsINode>>& aNodeArray,
|
2017-10-03 01:05:19 +03:00
|
|
|
nsAtom& aBlockTag);
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult MakeBlockquote(nsTArray<OwningNonNull<nsINode>>& aNodeArray);
|
2017-10-03 01:05:19 +03:00
|
|
|
nsresult SplitAsNeeded(nsAtom& aTag, OwningNonNull<nsINode>& inOutParent,
|
2017-10-12 06:16:00 +03:00
|
|
|
int32_t& inOutOffset,
|
|
|
|
nsCOMPtr<nsIContent>* inOutChildAtOffset = nullptr);
|
2017-10-03 01:05:19 +03:00
|
|
|
nsresult SplitAsNeeded(nsAtom& aTag, nsCOMPtr<nsINode>& inOutParent,
|
2017-10-12 06:16:00 +03:00
|
|
|
int32_t& inOutOffset,
|
|
|
|
nsCOMPtr<nsIContent>* inOutChildAtOffset = nullptr);
|
2000-04-24 15:51:12 +04:00
|
|
|
nsresult AddTerminatingBR(nsIDOMNode *aBlock);
|
2016-07-07 13:05:51 +03:00
|
|
|
EditorDOMPoint JoinNodesSmart(nsIContent& aNodeLeft,
|
|
|
|
nsIContent& aNodeRight);
|
2016-05-01 16:15:14 +03:00
|
|
|
Element* GetTopEnclosingMailCite(nsINode& aNode);
|
2017-01-11 13:07:33 +03:00
|
|
|
nsresult PopListItem(nsIContent& aListItem, bool* aOutOfList = nullptr);
|
2016-05-01 16:16:26 +03:00
|
|
|
nsresult RemoveListStructure(Element& aList);
|
2017-10-12 10:28:28 +03:00
|
|
|
nsresult CacheInlineStyles(nsINode* aNode);
|
2012-05-22 14:15:09 +04:00
|
|
|
nsresult ReapplyCachedStyles();
|
2013-02-07 12:08:57 +04:00
|
|
|
void ClearCachedStyles();
|
2015-04-24 14:27:35 +03:00
|
|
|
void AdjustSpecialBreaks();
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult AdjustWhitespace(Selection* aSelection);
|
|
|
|
nsresult PinSelectionToNewBlock(Selection* aSelection);
|
|
|
|
void CheckInterlinePosition(Selection& aSelection);
|
|
|
|
nsresult AdjustSelection(Selection* aSelection,
|
2014-11-02 15:04:13 +03:00
|
|
|
nsIEditor::EDirection aAction);
|
2017-10-07 02:32:59 +03:00
|
|
|
nsresult FindNearSelectableNode(nsINode* aSelNode,
|
2015-05-28 18:58:42 +03:00
|
|
|
int32_t aSelOffset,
|
2017-10-08 00:36:21 +03:00
|
|
|
nsINode* aChildAtOffset,
|
2016-07-07 13:05:51 +03:00
|
|
|
nsIEditor::EDirection& aDirection,
|
2017-10-07 02:32:59 +03:00
|
|
|
nsCOMPtr<nsIContent>* outSelectableNode);
|
2012-07-27 18:03:28 +04: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.
|
|
|
|
*/
|
2016-07-07 13:05:51 +03:00
|
|
|
bool InDifferentTableElements(nsIDOMNode* aNode1, nsIDOMNode* aNode2);
|
|
|
|
bool InDifferentTableElements(nsINode* aNode1, nsINode* aNode2);
|
1999-11-25 03:19:45 +03:00
|
|
|
nsresult RemoveEmptyNodes();
|
2016-07-07 13:05:51 +03:00
|
|
|
nsresult SelectionEndpointInNode(nsINode* aNode, bool* aResult);
|
2014-11-02 15:04:13 +03:00
|
|
|
nsresult UpdateDocChangeRange(nsRange* aRange);
|
2000-01-10 13:13:58 +03:00
|
|
|
nsresult ConfirmSelectionInBody();
|
2017-08-01 16:38:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert normal <br> element into aNode when aNode is a block and it has
|
|
|
|
* no children.
|
|
|
|
*/
|
|
|
|
nsresult InsertBRIfNeeded(nsINode& aNode)
|
|
|
|
{
|
|
|
|
return InsertBRIfNeededInternal(aNode, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Insert moz-<br> element (<br type="_moz">) into aNode when aNode is a
|
|
|
|
* block and it has no children.
|
|
|
|
*/
|
|
|
|
nsresult InsertMozBRIfNeeded(nsINode& aNode)
|
|
|
|
{
|
|
|
|
return InsertBRIfNeededInternal(aNode, true);
|
|
|
|
}
|
|
|
|
|
2016-07-07 13:05:51 +03:00
|
|
|
bool IsEmptyInline(nsINode& aNode);
|
|
|
|
bool ListIsEmptyLine(nsTArray<OwningNonNull<nsINode>>& arrayOfNodes);
|
2017-03-03 07:13:21 +03:00
|
|
|
nsresult RemoveAlignment(nsINode& aNode, const nsAString& aAlignType,
|
2016-07-07 13:05:51 +03:00
|
|
|
bool aChildrenOnly);
|
2017-03-03 07:13:21 +03:00
|
|
|
nsresult MakeSureElemStartsOrEndsOnCR(nsINode& aNode, bool aStarts);
|
2016-05-01 16:14:27 +03:00
|
|
|
enum class ContentsOnly { no, yes };
|
2016-05-01 16:15:14 +03:00
|
|
|
nsresult AlignBlock(Element& aElement,
|
2016-05-01 16:14:27 +03:00
|
|
|
const nsAString& aAlignType, ContentsOnly aContentsOnly);
|
2016-05-01 16:17:15 +03:00
|
|
|
enum class Change { minus, plus };
|
|
|
|
nsresult ChangeIndentation(Element& aElement, Change aChange);
|
2010-11-12 00:40:52 +03:00
|
|
|
void DocumentModifiedWorker();
|
1999-11-25 03:19:45 +03:00
|
|
|
|
2017-01-06 16:35:48 +03:00
|
|
|
/**
|
|
|
|
* InitStyleCacheArray() initializes aStyleCache for usable with
|
|
|
|
* GetInlineStyles().
|
|
|
|
*/
|
|
|
|
void InitStyleCacheArray(StyleCache aStyleCache[SIZE_STYLE_TABLE]);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GetInlineStyles() retrieves the style of aNode and modifies each item of
|
|
|
|
* aStyleCache.
|
|
|
|
*/
|
2017-10-12 10:28:28 +03:00
|
|
|
nsresult GetInlineStyles(nsINode* aNode,
|
2017-01-06 16:35:48 +03:00
|
|
|
StyleCache aStyleCache[SIZE_STYLE_TABLE]);
|
|
|
|
|
1999-11-25 03:19:45 +03:00
|
|
|
protected:
|
2016-07-09 05:42:33 +03:00
|
|
|
HTMLEditor* mHTMLEditor;
|
2016-07-07 13:05:51 +03:00
|
|
|
RefPtr<nsRange> mDocChangeRange;
|
|
|
|
bool mListenerEnabled;
|
|
|
|
bool mReturnInEmptyLIKillsList;
|
|
|
|
bool mDidDeleteSelection;
|
|
|
|
bool mDidRangedDelete;
|
|
|
|
bool mRestoreContentEditableCount;
|
|
|
|
RefPtr<nsRange> mUtilRange;
|
|
|
|
// Need to remember an int across willJoin/didJoin...
|
|
|
|
uint32_t mJoinOffset;
|
|
|
|
nsCOMPtr<Element> mNewBlock;
|
|
|
|
RefPtr<RangeItem> mRangeItem;
|
2017-01-06 16:35:48 +03:00
|
|
|
|
|
|
|
// XXX In strict speaking, mCachedStyles isn't enough to cache inline styles
|
|
|
|
// because inline style can be specified with "style" attribute and/or
|
|
|
|
// CSS in <style> elements or CSS files. So, we need to look for better
|
|
|
|
// implementation about this.
|
2016-07-07 13:05:51 +03:00
|
|
|
StyleCache mCachedStyles[SIZE_STYLE_TABLE];
|
1999-11-25 03:19:45 +03:00
|
|
|
};
|
|
|
|
|
2016-07-07 13:05:51 +03:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // #ifndef HTMLEditRules_h
|
1999-03-29 10:21:01 +04:00
|
|
|
|