зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572685
- part 11: Move `HTMLEditRules::JoinOffset` to `EditorBase::EditSubActionData` r=m_kato
The members of `HTMLEditRules` which are used only while `WillDoAction()` and `DidDoAction()` are called should be moved to specific stack only struct `EditorBase::EditSubActionData`. Differential Revision: https://phabricator.services.mozilla.com/D42106 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
f3a6c9590b
Коммит
d741d7dbe7
|
@ -1354,7 +1354,7 @@ already_AddRefed<Element> EditorBase::CreateNodeWithTransaction(
|
||||||
// we need to redesign RangeUpdaterRef() as avoiding using indices.
|
// we need to redesign RangeUpdaterRef() as avoiding using indices.
|
||||||
Unused << aPointToInsert.Offset();
|
Unused << aPointToInsert.Offset();
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eCreateNode, nsIEditor::eNext);
|
*this, EditSubAction::eCreateNode, nsIEditor::eNext);
|
||||||
|
|
||||||
RefPtr<Element> newElement;
|
RefPtr<Element> newElement;
|
||||||
|
@ -1431,7 +1431,7 @@ nsresult EditorBase::InsertNodeWithTransaction(
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(aPointToInsert.IsSetAndValid());
|
MOZ_ASSERT(aPointToInsert.IsSetAndValid());
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
||||||
|
|
||||||
RefPtr<InsertNodeTransaction> transaction =
|
RefPtr<InsertNodeTransaction> transaction =
|
||||||
|
@ -1566,7 +1566,7 @@ already_AddRefed<nsIContent> EditorBase::SplitNodeWithTransaction(
|
||||||
}
|
}
|
||||||
MOZ_ASSERT(aStartOfRightNode.IsSetAndValid());
|
MOZ_ASSERT(aStartOfRightNode.IsSetAndValid());
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eSplitNode, nsIEditor::eNext);
|
*this, EditSubAction::eSplitNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// XXX Unfortunately, storing offset of the split point in
|
// XXX Unfortunately, storing offset of the split point in
|
||||||
|
@ -1636,7 +1636,7 @@ nsresult EditorBase::JoinNodesWithTransaction(nsINode& aLeftNode,
|
||||||
nsCOMPtr<nsINode> parent = aLeftNode.GetParentNode();
|
nsCOMPtr<nsINode> parent = aLeftNode.GetParentNode();
|
||||||
MOZ_ASSERT(parent);
|
MOZ_ASSERT(parent);
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eJoinNodes, nsIEditor::ePrevious);
|
*this, EditSubAction::eJoinNodes, nsIEditor::ePrevious);
|
||||||
|
|
||||||
// Remember some values; later used for saved selection updating.
|
// Remember some values; later used for saved selection updating.
|
||||||
|
@ -1708,7 +1708,7 @@ EditorBase::DeleteNode(nsINode* aNode) {
|
||||||
nsresult EditorBase::DeleteNodeWithTransaction(nsINode& aNode) {
|
nsresult EditorBase::DeleteNodeWithTransaction(nsINode& aNode) {
|
||||||
MOZ_ASSERT(IsEditActionDataAvailable());
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::ePrevious);
|
*this, EditSubAction::eDeleteNode, nsIEditor::ePrevious);
|
||||||
|
|
||||||
if (mRules && mRules->AsHTMLEditRules()) {
|
if (mRules && mRules->AsHTMLEditRules()) {
|
||||||
|
@ -2908,7 +2908,7 @@ nsresult EditorBase::SetTextImpl(const nsAString& aString, Text& aTextNode) {
|
||||||
|
|
||||||
const uint32_t length = aTextNode.Length();
|
const uint32_t length = aTextNode.Length();
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eSetText, nsIEditor::eNext);
|
*this, EditSubAction::eSetText, nsIEditor::eNext);
|
||||||
|
|
||||||
// Let listeners know what's up
|
// Let listeners know what's up
|
||||||
|
@ -2977,7 +2977,7 @@ nsresult EditorBase::DeleteTextWithTransaction(Text& aTextNode,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteText, nsIEditor::ePrevious);
|
*this, EditSubAction::eDeleteText, nsIEditor::ePrevious);
|
||||||
|
|
||||||
// Let listeners know what's up
|
// Let listeners know what's up
|
||||||
|
@ -4060,7 +4060,7 @@ nsresult EditorBase::MaybeCreatePaddingBRElementForEmptyEditor() {
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eCreatePaddingBRElementForEmptyEditor,
|
*this, EditSubAction::eCreatePaddingBRElementForEmptyEditor,
|
||||||
nsIEditor::eNone);
|
nsIEditor::eNone);
|
||||||
|
|
||||||
|
|
|
@ -697,6 +697,15 @@ class EditorBase : public nsIEditor,
|
||||||
TopLevelEditSubActionData(const TopLevelEditSubActionData& aOther) = delete;
|
TopLevelEditSubActionData(const TopLevelEditSubActionData& aOther) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct MOZ_STACK_CLASS EditSubActionData final {
|
||||||
|
uint32_t mJoinedLeftNodeLength;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void Clear() { mJoinedLeftNodeLength = 0; }
|
||||||
|
|
||||||
|
friend EditorBase;
|
||||||
|
};
|
||||||
|
|
||||||
protected: // AutoEditActionDataSetter, this shouldn't be accessed by friends.
|
protected: // AutoEditActionDataSetter, this shouldn't be accessed by friends.
|
||||||
/**
|
/**
|
||||||
* SettingDataTransfer enum class is used to specify whether DataTransfer
|
* SettingDataTransfer enum class is used to specify whether DataTransfer
|
||||||
|
@ -859,6 +868,11 @@ class EditorBase : public nsIEditor,
|
||||||
: mTopLevelEditSubActionData;
|
: mTopLevelEditSubActionData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const EditSubActionData& EditSubActionDataRef() const {
|
||||||
|
return mEditSubActionData;
|
||||||
|
}
|
||||||
|
EditSubActionData& EditSubActionDataRef() { return mEditSubActionData; }
|
||||||
|
|
||||||
SelectionState& SavedSelectionRef() {
|
SelectionState& SavedSelectionRef() {
|
||||||
return mParentData ? mParentData->SavedSelectionRef() : mSavedSelection;
|
return mParentData ? mParentData->SavedSelectionRef() : mSavedSelection;
|
||||||
}
|
}
|
||||||
|
@ -912,6 +926,10 @@ class EditorBase : public nsIEditor,
|
||||||
// want to pay the copying cost and sync cost.
|
// want to pay the copying cost and sync cost.
|
||||||
TopLevelEditSubActionData mTopLevelEditSubActionData;
|
TopLevelEditSubActionData mTopLevelEditSubActionData;
|
||||||
|
|
||||||
|
// Different from mTopLevelEditSubActionData, this stores temporaly data
|
||||||
|
// for current edit sub action.
|
||||||
|
EditSubActionData mEditSubActionData;
|
||||||
|
|
||||||
EditAction mEditAction;
|
EditAction mEditAction;
|
||||||
|
|
||||||
// Different from its data, you can refer "current" AutoEditActionDataSetter
|
// Different from its data, you can refer "current" AutoEditActionDataSetter
|
||||||
|
@ -1056,6 +1074,15 @@ class EditorBase : public nsIEditor,
|
||||||
return mEditActionData->TopLevelEditSubActionDataRef();
|
return mEditActionData->TopLevelEditSubActionDataRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const EditSubActionData& EditSubActionDataRef() const {
|
||||||
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
|
return mEditActionData->EditSubActionDataRef();
|
||||||
|
}
|
||||||
|
EditSubActionData& EditSubActionDataRef() {
|
||||||
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
|
return mEditActionData->EditSubActionDataRef();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetCompositionStartPoint() and GetCompositionEndPoint() returns start and
|
* GetCompositionStartPoint() and GetCompositionEndPoint() returns start and
|
||||||
* end point of composition string if there is. Otherwise, returns non-set
|
* end point of composition string if there is. Otherwise, returns non-set
|
||||||
|
@ -2014,6 +2041,14 @@ class EditorBase : public nsIEditor,
|
||||||
MOZ_CAN_RUN_SCRIPT
|
MOZ_CAN_RUN_SCRIPT
|
||||||
virtual void OnEndHandlingTopLevelEditSubAction();
|
virtual void OnEndHandlingTopLevelEditSubAction();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OnStartToHandleEditSubAction() and OnEndHandlingEditSubAction() are called
|
||||||
|
* when starting to handle an edit sub action and ending handling an edit
|
||||||
|
* sub action.
|
||||||
|
*/
|
||||||
|
void OnStartToHandleEditSubAction() { EditSubActionDataRef().Clear(); }
|
||||||
|
void OnEndHandlingEditSubAction() { EditSubActionDataRef().Clear(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routines for managing the preservation of selection across
|
* Routines for managing the preservation of selection across
|
||||||
* various editor actions.
|
* various editor actions.
|
||||||
|
@ -2389,15 +2424,15 @@ class EditorBase : public nsIEditor,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AutoTopLevelEditSubActionNotifier notifies editor of start to handle
|
* AutoEditSubActionNotifier notifies editor of start to handle
|
||||||
* top level edit sub-action and end handling top level edit sub-action.
|
* top level edit sub-action and end handling top level edit sub-action.
|
||||||
*/
|
*/
|
||||||
class MOZ_RAII AutoTopLevelEditSubActionNotifier final {
|
class MOZ_RAII AutoEditSubActionNotifier final {
|
||||||
public:
|
public:
|
||||||
AutoTopLevelEditSubActionNotifier(
|
AutoEditSubActionNotifier(
|
||||||
EditorBase& aEditorBase, EditSubAction aEditSubAction,
|
EditorBase& aEditorBase, EditSubAction aEditSubAction,
|
||||||
nsIEditor::EDirection aDirection MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
nsIEditor::EDirection aDirection MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||||
: mEditorBase(aEditorBase), mDoNothing(false) {
|
: mEditorBase(aEditorBase), mIsTopLevel(true) {
|
||||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||||
// The top level edit sub action has already be set if this is nested call
|
// The top level edit sub action has already be set if this is nested call
|
||||||
// XXX Looks like that this is not aware of unexpected nested edit action
|
// XXX Looks like that this is not aware of unexpected nested edit action
|
||||||
|
@ -2407,20 +2442,22 @@ class EditorBase : public nsIEditor,
|
||||||
mEditorBase.OnStartToHandleTopLevelEditSubAction(aEditSubAction,
|
mEditorBase.OnStartToHandleTopLevelEditSubAction(aEditSubAction,
|
||||||
aDirection);
|
aDirection);
|
||||||
} else {
|
} else {
|
||||||
mDoNothing = true; // nested calls will end up here
|
mIsTopLevel = false;
|
||||||
}
|
}
|
||||||
|
mEditorBase.OnStartToHandleEditSubAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
MOZ_CAN_RUN_SCRIPT_BOUNDARY
|
||||||
~AutoTopLevelEditSubActionNotifier() {
|
~AutoEditSubActionNotifier() {
|
||||||
if (!mDoNothing) {
|
mEditorBase.OnEndHandlingEditSubAction();
|
||||||
|
if (mIsTopLevel) {
|
||||||
MOZ_KnownLive(mEditorBase).OnEndHandlingTopLevelEditSubAction();
|
MOZ_KnownLive(mEditorBase).OnEndHandlingTopLevelEditSubAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EditorBase& mEditorBase;
|
EditorBase& mEditorBase;
|
||||||
bool mDoNothing;
|
bool mIsTopLevel;
|
||||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ nsresult HTMLEditor::SetSelectionToAbsoluteOrStaticAsAction(
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this,
|
*this,
|
||||||
aEnabled ? EditSubAction::eSetPositionToAbsolute
|
aEnabled ? EditSubAction::eSetPositionToAbsolute
|
||||||
: EditSubAction::eSetPositionToStatic,
|
: EditSubAction::eSetPositionToStatic,
|
||||||
|
@ -155,7 +155,7 @@ nsresult HTMLEditor::AddZIndexAsAction(int32_t aChange,
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this,
|
*this,
|
||||||
aChange < 0 ? EditSubAction::eDecreaseZIndex
|
aChange < 0 ? EditSubAction::eDecreaseZIndex
|
||||||
: EditSubAction::eIncreaseZIndex,
|
: EditSubAction::eIncreaseZIndex,
|
||||||
|
|
|
@ -191,8 +191,7 @@ HTMLEditRules::HTMLEditRules()
|
||||||
: mHTMLEditor(nullptr),
|
: mHTMLEditor(nullptr),
|
||||||
mInitialized(false),
|
mInitialized(false),
|
||||||
mListenerEnabled(false),
|
mListenerEnabled(false),
|
||||||
mReturnInEmptyLIKillsList(false),
|
mReturnInEmptyLIKillsList(false) {
|
||||||
mJoinOffset(0) {
|
|
||||||
mIsHTMLEditRules = true;
|
mIsHTMLEditRules = true;
|
||||||
InitFields();
|
InitFields();
|
||||||
}
|
}
|
||||||
|
@ -200,7 +199,6 @@ HTMLEditRules::HTMLEditRules()
|
||||||
void HTMLEditRules::InitFields() {
|
void HTMLEditRules::InitFields() {
|
||||||
mHTMLEditor = nullptr;
|
mHTMLEditor = nullptr;
|
||||||
mReturnInEmptyLIKillsList = true;
|
mReturnInEmptyLIKillsList = true;
|
||||||
mJoinOffset = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult HTMLEditRules::Init(TextEditor* aTextEditor) {
|
nsresult HTMLEditRules::Init(TextEditor* aTextEditor) {
|
||||||
|
@ -10248,8 +10246,11 @@ void HTMLEditRules::WillJoinNodes(nsINode& aLeftNode, nsINode& aRightNode) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AutoSafeEditorData setData(*this, *mHTMLEditor);
|
||||||
|
|
||||||
// remember split point
|
// remember split point
|
||||||
mJoinOffset = aLeftNode.Length();
|
HTMLEditorRef().EditSubActionDataRef().mJoinedLeftNodeLength =
|
||||||
|
aLeftNode.Length();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HTMLEditRules::DidJoinNodes(nsINode& aLeftNode, nsINode& aRightNode) {
|
void HTMLEditRules::DidJoinNodes(nsINode& aLeftNode, nsINode& aRightNode) {
|
||||||
|
@ -10265,7 +10266,10 @@ void HTMLEditRules::DidJoinNodes(nsINode& aLeftNode, nsINode& aRightNode) {
|
||||||
|
|
||||||
DebugOnly<nsresult> rv =
|
DebugOnly<nsresult> rv =
|
||||||
HTMLEditorRef().TopLevelEditSubActionDataRef().AddPointToChangedRange(
|
HTMLEditorRef().TopLevelEditSubActionDataRef().AddPointToChangedRange(
|
||||||
HTMLEditorRef(), EditorRawDOMPoint(&aRightNode, mJoinOffset));
|
HTMLEditorRef(),
|
||||||
|
EditorRawDOMPoint(
|
||||||
|
&aRightNode,
|
||||||
|
HTMLEditorRef().EditSubActionDataRef().mJoinedLeftNodeLength));
|
||||||
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "AddPointToChangedRange() failed");
|
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "AddPointToChangedRange() failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1326,8 +1326,6 @@ class HTMLEditRules : public TextEditRules {
|
||||||
bool mInitialized;
|
bool mInitialized;
|
||||||
bool mListenerEnabled;
|
bool mListenerEnabled;
|
||||||
bool mReturnInEmptyLIKillsList;
|
bool mReturnInEmptyLIKillsList;
|
||||||
// Need to remember an int across willJoin/didJoin...
|
|
||||||
uint32_t mJoinOffset;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
|
@ -1012,7 +1012,7 @@ nsresult HTMLEditor::InsertParagraphSeparatorAsSubAction() {
|
||||||
// Protect the edit rules object from dying
|
// Protect the edit rules object from dying
|
||||||
RefPtr<TextEditRules> rules(mRules);
|
RefPtr<TextEditRules> rules(mRules);
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertParagraphSeparator, nsIEditor::eNext);
|
*this, EditSubAction::eInsertParagraphSeparator, nsIEditor::eNext);
|
||||||
|
|
||||||
EditSubActionInfo subActionInfo(EditSubAction::eInsertParagraphSeparator);
|
EditSubActionInfo subActionInfo(EditSubAction::eInsertParagraphSeparator);
|
||||||
|
@ -1134,7 +1134,7 @@ nsresult HTMLEditor::InsertBrElementAtSelectionWithTransaction() {
|
||||||
// XXX Why do we use EditSubAction::eInsertText here? Looks like
|
// XXX Why do we use EditSubAction::eInsertText here? Looks like
|
||||||
// EditSubAction::eInsertLineBreak or EditSubAction::eInsertNode
|
// EditSubAction::eInsertLineBreak or EditSubAction::eInsertNode
|
||||||
// is better.
|
// is better.
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertText, nsIEditor::eNext);
|
*this, EditSubAction::eInsertText, nsIEditor::eNext);
|
||||||
|
|
||||||
if (!SelectionRefPtr()->IsCollapsed()) {
|
if (!SelectionRefPtr()->IsCollapsed()) {
|
||||||
|
@ -1184,7 +1184,7 @@ nsresult HTMLEditor::ReplaceHeadContentsWithSourceWithTransaction(
|
||||||
MOZ_ASSERT(IsEditActionDataAvailable());
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
|
|
||||||
// don't do any post processing, rules get confused
|
// don't do any post processing, rules get confused
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eReplaceHeadWithHTMLSource, nsIEditor::eNone);
|
*this, EditSubAction::eReplaceHeadWithHTMLSource, nsIEditor::eNone);
|
||||||
|
|
||||||
CommitComposition();
|
CommitComposition();
|
||||||
|
@ -1535,7 +1535,7 @@ nsresult HTMLEditor::InsertElementAtSelectionAsAction(
|
||||||
|
|
||||||
CommitComposition();
|
CommitComposition();
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertElement, nsIEditor::eNext);
|
*this, EditSubAction::eInsertElement, nsIEditor::eNext);
|
||||||
|
|
||||||
// hand off to the rules system, see if it has anything to say about this
|
// hand off to the rules system, see if it has anything to say about this
|
||||||
|
@ -2091,7 +2091,7 @@ nsresult HTMLEditor::MakeOrChangeListAsAction(const nsAString& aListType,
|
||||||
bool cancel, handled;
|
bool cancel, handled;
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eCreateOrChangeList, nsIEditor::eNext);
|
*this, EditSubAction::eCreateOrChangeList, nsIEditor::eNext);
|
||||||
|
|
||||||
EditSubActionInfo subActionInfo(EditSubAction::eCreateOrChangeList);
|
EditSubActionInfo subActionInfo(EditSubAction::eCreateOrChangeList);
|
||||||
|
@ -2203,7 +2203,7 @@ nsresult HTMLEditor::RemoveListAsAction(const nsAString& aListType,
|
||||||
RefPtr<TextEditRules> rules(mRules);
|
RefPtr<TextEditRules> rules(mRules);
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eRemoveList, nsIEditor::eNext);
|
*this, EditSubAction::eRemoveList, nsIEditor::eNext);
|
||||||
|
|
||||||
EditSubActionInfo subActionInfo(EditSubAction::eRemoveList);
|
EditSubActionInfo subActionInfo(EditSubAction::eRemoveList);
|
||||||
|
@ -2237,7 +2237,7 @@ nsresult HTMLEditor::MakeDefinitionListItemWithTransaction(nsAtom& aTagName) {
|
||||||
bool cancel, handled;
|
bool cancel, handled;
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eCreateOrChangeDefinitionList, nsIEditor::eNext);
|
*this, EditSubAction::eCreateOrChangeDefinitionList, nsIEditor::eNext);
|
||||||
|
|
||||||
nsDependentAtomString tagName(&aTagName);
|
nsDependentAtomString tagName(&aTagName);
|
||||||
|
@ -2274,7 +2274,7 @@ nsresult HTMLEditor::InsertBasicBlockWithTransaction(nsAtom& aTagName) {
|
||||||
bool cancel, handled;
|
bool cancel, handled;
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eCreateOrRemoveBlock, nsIEditor::eNext);
|
*this, EditSubAction::eCreateOrRemoveBlock, nsIEditor::eNext);
|
||||||
|
|
||||||
nsDependentAtomString tagName(&aTagName);
|
nsDependentAtomString tagName(&aTagName);
|
||||||
|
@ -2413,8 +2413,8 @@ nsresult HTMLEditor::IndentOrOutdentAsSubAction(
|
||||||
RefPtr<TextEditRules> rules(mRules);
|
RefPtr<TextEditRules> rules(mRules);
|
||||||
|
|
||||||
bool cancel, handled;
|
bool cancel, handled;
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(*this, aIndentOrOutdent,
|
||||||
*this, aIndentOrOutdent, nsIEditor::eNext);
|
nsIEditor::eNext);
|
||||||
|
|
||||||
EditSubActionInfo subActionInfo(aIndentOrOutdent);
|
EditSubActionInfo subActionInfo(aIndentOrOutdent);
|
||||||
nsresult rv = rules->WillDoAction(subActionInfo, &cancel, &handled);
|
nsresult rv = rules->WillDoAction(subActionInfo, &cancel, &handled);
|
||||||
|
@ -2519,7 +2519,7 @@ nsresult HTMLEditor::AlignAsAction(const nsAString& aAlignType,
|
||||||
RefPtr<TextEditRules> rules(mRules);
|
RefPtr<TextEditRules> rules(mRules);
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eSetOrClearAlignment, nsIEditor::eNext);
|
*this, EditSubAction::eSetOrClearAlignment, nsIEditor::eNext);
|
||||||
|
|
||||||
bool cancel, handled;
|
bool cancel, handled;
|
||||||
|
@ -3379,7 +3379,7 @@ nsresult HTMLEditor::DeleteAllChildrenWithTransaction(Element& aElement) {
|
||||||
MOZ_ASSERT(IsEditActionDataAvailable());
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
|
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
|
|
||||||
while (nsCOMPtr<nsINode> child = aElement.GetLastChild()) {
|
while (nsCOMPtr<nsINode> child = aElement.GetLastChild()) {
|
||||||
|
@ -4518,7 +4518,7 @@ nsresult HTMLEditor::SetCSSBackgroundColorWithTransaction(
|
||||||
bool isCollapsed = SelectionRefPtr()->IsCollapsed();
|
bool isCollapsed = SelectionRefPtr()->IsCollapsed();
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertElement, nsIEditor::eNext);
|
*this, EditSubAction::eInsertElement, nsIEditor::eNext);
|
||||||
AutoSelectionRestorer restoreSelectionLater(*this);
|
AutoSelectionRestorer restoreSelectionLater(*this);
|
||||||
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
||||||
|
|
|
@ -103,7 +103,7 @@ nsresult HTMLEditor::LoadHTML(const nsAString& aInputString) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertHTMLSource, nsIEditor::eNext);
|
*this, EditSubAction::eInsertHTMLSource, nsIEditor::eNext);
|
||||||
|
|
||||||
nsresult rv = EnsureNoPaddingBRElementForEmptyEditor();
|
nsresult rv = EnsureNoPaddingBRElementForEmptyEditor();
|
||||||
|
@ -202,7 +202,7 @@ nsresult HTMLEditor::DoInsertHTMLWithContext(
|
||||||
// force IME commit; set up rules sniffing and batching
|
// force IME commit; set up rules sniffing and batching
|
||||||
CommitComposition();
|
CommitComposition();
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::ePasteHTMLContent, nsIEditor::eNext);
|
*this, EditSubAction::ePasteHTMLContent, nsIEditor::eNext);
|
||||||
|
|
||||||
// create a dom document fragment that represents the structure to paste
|
// create a dom document fragment that represents the structure to paste
|
||||||
|
@ -1739,7 +1739,7 @@ nsresult HTMLEditor::PasteAsQuotationAsAction(int32_t aClipboardType,
|
||||||
// <blockquote type="cite"> element after removing selection.
|
// <blockquote type="cite"> element after removing selection.
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertQuotation, nsIEditor::eNext);
|
*this, EditSubAction::eInsertQuotation, nsIEditor::eNext);
|
||||||
|
|
||||||
// Adjust Selection and clear cached style before inserting <blockquote>.
|
// Adjust Selection and clear cached style before inserting <blockquote>.
|
||||||
|
@ -1985,7 +1985,7 @@ nsresult HTMLEditor::InsertAsPlaintextQuotation(const nsAString& aQuotedText,
|
||||||
*aNodeInserted = nullptr;
|
*aNodeInserted = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertQuotation, nsIEditor::eNext);
|
*this, EditSubAction::eInsertQuotation, nsIEditor::eNext);
|
||||||
|
|
||||||
// give rules a chance to handle or cancel
|
// give rules a chance to handle or cancel
|
||||||
|
@ -2168,7 +2168,7 @@ nsresult HTMLEditor::InsertAsCitedQuotationInternal(
|
||||||
MOZ_ASSERT(IsEditActionDataAvailable());
|
MOZ_ASSERT(IsEditActionDataAvailable());
|
||||||
MOZ_ASSERT(!IsPlaintextEditor());
|
MOZ_ASSERT(!IsPlaintextEditor());
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertQuotation, nsIEditor::eNext);
|
*this, EditSubAction::eInsertQuotation, nsIEditor::eNext);
|
||||||
|
|
||||||
// give rules a chance to handle or cancel
|
// give rules a chance to handle or cancel
|
||||||
|
|
|
@ -161,7 +161,7 @@ nsresult HTMLEditor::SetInlinePropertyInternal(nsAtom& aProperty,
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertElement, nsIEditor::eNext);
|
*this, EditSubAction::eInsertElement, nsIEditor::eNext);
|
||||||
AutoSelectionRestorer restoreSelectionLater(*this);
|
AutoSelectionRestorer restoreSelectionLater(*this);
|
||||||
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
||||||
|
@ -1255,7 +1255,7 @@ nsresult HTMLEditor::RemoveAllInlinePropertiesAsAction(
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eRemoveAllTextProperties, nsIEditor::eNext);
|
*this, EditSubAction::eRemoveAllTextProperties, nsIEditor::eNext);
|
||||||
|
|
||||||
nsresult rv = RemoveInlinePropertyInternal(nullptr, nullptr);
|
nsresult rv = RemoveInlinePropertyInternal(nullptr, nullptr);
|
||||||
|
@ -1354,7 +1354,7 @@ nsresult HTMLEditor::RemoveInlinePropertyInternal(nsAtom* aProperty,
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eRemoveTextProperty, nsIEditor::eNext);
|
*this, EditSubAction::eRemoveTextProperty, nsIEditor::eNext);
|
||||||
AutoSelectionRestorer restoreSelectionLater(*this);
|
AutoSelectionRestorer restoreSelectionLater(*this);
|
||||||
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
||||||
|
@ -1556,7 +1556,7 @@ nsresult HTMLEditor::RelativeFontChange(FontSize aDir) {
|
||||||
|
|
||||||
// Wrap with txn batching, rules sniffing, and selection preservation code
|
// Wrap with txn batching, rules sniffing, and selection preservation code
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eSetTextProperty, nsIEditor::eNext);
|
*this, EditSubAction::eSetTextProperty, nsIEditor::eNext);
|
||||||
AutoSelectionRestorer restoreSelectionLater(*this);
|
AutoSelectionRestorer restoreSelectionLater(*this);
|
||||||
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
AutoTransactionsConserveSelection dontChangeMySelection(*this);
|
||||||
|
|
|
@ -212,7 +212,7 @@ nsresult HTMLEditor::InsertTableCellsWithTransaction(
|
||||||
|
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
// Prevent auto insertion of BR in new cell until we're done
|
// Prevent auto insertion of BR in new cell until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// We control selection resetting after the insert.
|
// We control selection resetting after the insert.
|
||||||
|
@ -437,7 +437,7 @@ nsresult HTMLEditor::InsertTableColumnsWithTransaction(
|
||||||
|
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
// Prevent auto insertion of <br> element in new cell until we're done.
|
// Prevent auto insertion of <br> element in new cell until we're done.
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
||||||
|
|
||||||
switch (aInsertPosition) {
|
switch (aInsertPosition) {
|
||||||
|
@ -626,7 +626,7 @@ nsresult HTMLEditor::InsertTableRowsWithTransaction(
|
||||||
|
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
// Prevent auto insertion of BR in new cell until we're done
|
// Prevent auto insertion of BR in new cell until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
||||||
|
|
||||||
switch (aInsertPosition) {
|
switch (aInsertPosition) {
|
||||||
|
@ -893,7 +893,7 @@ nsresult HTMLEditor::DeleteTableCellWithTransaction(
|
||||||
|
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
|
|
||||||
ErrorResult error;
|
ErrorResult error;
|
||||||
|
@ -1162,7 +1162,7 @@ nsresult HTMLEditor::DeleteTableCellContentsWithTransaction() {
|
||||||
|
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
// Don't let Rules System change the selection
|
// Don't let Rules System change the selection
|
||||||
AutoTransactionsConserveSelection dontChangeSelection(*this);
|
AutoTransactionsConserveSelection dontChangeSelection(*this);
|
||||||
|
@ -1249,7 +1249,7 @@ nsresult HTMLEditor::DeleteSelectedTableColumnsWithTransaction(
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
|
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// Shortcut the case of deleting all columns in table
|
// Shortcut the case of deleting all columns in table
|
||||||
|
@ -1474,7 +1474,7 @@ nsresult HTMLEditor::DeleteSelectedTableRowsWithTransaction(
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
|
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// Shortcut the case of deleting all rows in table
|
// Shortcut the case of deleting all rows in table
|
||||||
|
@ -1584,7 +1584,7 @@ nsresult HTMLEditor::DeleteTableRowWithTransaction(Element& aTableElement,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// Scan through cells in row to do rowspan adjustments
|
// Scan through cells in row to do rowspan adjustments
|
||||||
|
@ -2118,7 +2118,7 @@ HTMLEditor::SplitTableCell() {
|
||||||
|
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
// Prevent auto insertion of BR in new cell until we're done
|
// Prevent auto insertion of BR in new cell until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// We reset selection
|
// We reset selection
|
||||||
|
@ -2370,7 +2370,7 @@ HTMLEditor::SwitchTableCellHeaderType(Element* aSourceCell,
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
// Prevent auto insertion of BR in new cell created by
|
// Prevent auto insertion of BR in new cell created by
|
||||||
// ReplaceContainerAndCloneAttributesWithTransaction().
|
// ReplaceContainerAndCloneAttributesWithTransaction().
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// Save current selection to restore when done.
|
// Save current selection to restore when done.
|
||||||
|
@ -2633,7 +2633,7 @@ HTMLEditor::JoinTableCells(bool aMergeNonContiguousContents) {
|
||||||
|
|
||||||
// All cell contents are merged. Delete the empty cells we accumulated
|
// All cell contents are merged. Delete the empty cells we accumulated
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
|
|
||||||
for (uint32_t i = 0, n = deleteList.Length(); i < n; i++) {
|
for (uint32_t i = 0, n = deleteList.Length(); i < n; i++) {
|
||||||
|
@ -2776,7 +2776,7 @@ nsresult HTMLEditor::MergeCells(RefPtr<Element> aTargetCell,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent rules testing until we're done
|
// Prevent rules testing until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
*this, EditSubAction::eDeleteNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// Don't need to merge if cell is empty
|
// Don't need to merge if cell is empty
|
||||||
|
@ -3026,7 +3026,7 @@ nsresult HTMLEditor::NormalizeTableInternal(Element& aTableOrElementInTable) {
|
||||||
|
|
||||||
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
AutoPlaceholderBatch treateAsOneTransaction(*this);
|
||||||
// Prevent auto insertion of BR in new cell until we're done
|
// Prevent auto insertion of BR in new cell until we're done
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
*this, EditSubAction::eInsertNode, nsIEditor::eNext);
|
||||||
|
|
||||||
// XXX If there is a cell which has bigger or smaller "rowspan" or "colspan"
|
// XXX If there is a cell which has bigger or smaller "rowspan" or "colspan"
|
||||||
|
|
|
@ -56,8 +56,7 @@ class Selection;
|
||||||
class TextEditRules {
|
class TextEditRules {
|
||||||
protected:
|
protected:
|
||||||
typedef EditorBase::AutoSelectionRestorer AutoSelectionRestorer;
|
typedef EditorBase::AutoSelectionRestorer AutoSelectionRestorer;
|
||||||
typedef EditorBase::AutoTopLevelEditSubActionNotifier
|
typedef EditorBase::AutoEditSubActionNotifier AutoEditSubActionNotifier;
|
||||||
AutoTopLevelEditSubActionNotifier;
|
|
||||||
typedef EditorBase::AutoTransactionsConserveSelection
|
typedef EditorBase::AutoTransactionsConserveSelection
|
||||||
AutoTransactionsConserveSelection;
|
AutoTransactionsConserveSelection;
|
||||||
|
|
||||||
|
|
|
@ -654,7 +654,7 @@ nsresult TextEditor::DeleteSelectionAsSubAction(EDirection aDirection,
|
||||||
// Protect the edit rules object from dying
|
// Protect the edit rules object from dying
|
||||||
RefPtr<TextEditRules> rules(mRules);
|
RefPtr<TextEditRules> rules(mRules);
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteSelectedContent, aDirection);
|
*this, EditSubAction::eDeleteSelectedContent, aDirection);
|
||||||
EditSubActionInfo subActionInfo(EditSubAction::eDeleteSelectedContent);
|
EditSubActionInfo subActionInfo(EditSubAction::eDeleteSelectedContent);
|
||||||
subActionInfo.collapsedAction = aDirection;
|
subActionInfo.collapsedAction = aDirection;
|
||||||
|
@ -696,7 +696,7 @@ nsresult TextEditor::DeleteSelectionWithTransaction(
|
||||||
|
|
||||||
RefPtr<CharacterData> deleteCharData =
|
RefPtr<CharacterData> deleteCharData =
|
||||||
CharacterData::FromNodeOrNull(deleteNode);
|
CharacterData::FromNodeOrNull(deleteNode);
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eDeleteSelectedContent, aDirection);
|
*this, EditSubAction::eDeleteSelectedContent, aDirection);
|
||||||
|
|
||||||
if (mRules && mRules->AsHTMLEditRules()) {
|
if (mRules && mRules->AsHTMLEditRules()) {
|
||||||
|
@ -915,8 +915,8 @@ nsresult TextEditor::InsertTextAsSubAction(const nsAString& aStringToInsert) {
|
||||||
? EditSubAction::eInsertTextComingFromIME
|
? EditSubAction::eInsertTextComingFromIME
|
||||||
: EditSubAction::eInsertText;
|
: EditSubAction::eInsertText;
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(*this, editSubAction,
|
||||||
*this, editSubAction, nsIEditor::eNext);
|
nsIEditor::eNext);
|
||||||
|
|
||||||
nsAutoString resultString;
|
nsAutoString resultString;
|
||||||
// XXX can we trust instring to outlive subActionInfo,
|
// XXX can we trust instring to outlive subActionInfo,
|
||||||
|
@ -975,7 +975,7 @@ nsresult TextEditor::InsertLineBreakAsSubAction() {
|
||||||
// Protect the edit rules object from dying
|
// Protect the edit rules object from dying
|
||||||
RefPtr<TextEditRules> rules(mRules);
|
RefPtr<TextEditRules> rules(mRules);
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertLineBreak, nsIEditor::eNext);
|
*this, EditSubAction::eInsertLineBreak, nsIEditor::eNext);
|
||||||
|
|
||||||
EditSubActionInfo subActionInfo(EditSubAction::eInsertLineBreak);
|
EditSubActionInfo subActionInfo(EditSubAction::eInsertLineBreak);
|
||||||
|
@ -1031,7 +1031,7 @@ nsresult TextEditor::ReplaceTextAsAction(const nsAString& aString,
|
||||||
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
AutoPlaceholderBatch treatAsOneTransaction(*this);
|
||||||
|
|
||||||
// This should emulates inserting text for better undo/redo behavior.
|
// This should emulates inserting text for better undo/redo behavior.
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertText, nsIEditor::eNext);
|
*this, EditSubAction::eInsertText, nsIEditor::eNext);
|
||||||
|
|
||||||
if (!aReplaceRange) {
|
if (!aReplaceRange) {
|
||||||
|
@ -1082,7 +1082,7 @@ nsresult TextEditor::SetTextAsSubAction(const nsAString& aString) {
|
||||||
// Protect the edit rules object from dying
|
// Protect the edit rules object from dying
|
||||||
RefPtr<TextEditRules> rules(mRules);
|
RefPtr<TextEditRules> rules(mRules);
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eSetText, nsIEditor::eNext);
|
*this, EditSubAction::eSetText, nsIEditor::eNext);
|
||||||
|
|
||||||
EditSubActionInfo subActionInfo(EditSubAction::eSetText);
|
EditSubActionInfo subActionInfo(EditSubAction::eSetText);
|
||||||
|
@ -1545,7 +1545,7 @@ nsresult TextEditor::UndoAsAction(uint32_t aCount, nsIPrincipal* aPrincipal) {
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
{
|
{
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eUndo, nsIEditor::eNone);
|
*this, EditSubAction::eUndo, nsIEditor::eNone);
|
||||||
|
|
||||||
RefPtr<TransactionManager> transactionManager(mTransactionManager);
|
RefPtr<TransactionManager> transactionManager(mTransactionManager);
|
||||||
|
@ -1617,7 +1617,7 @@ nsresult TextEditor::RedoAsAction(uint32_t aCount, nsIPrincipal* aPrincipal) {
|
||||||
|
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
{
|
{
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eRedo, nsIEditor::eNone);
|
*this, EditSubAction::eRedo, nsIEditor::eNone);
|
||||||
|
|
||||||
RefPtr<TransactionManager> transactionManager(mTransactionManager);
|
RefPtr<TransactionManager> transactionManager(mTransactionManager);
|
||||||
|
@ -1999,7 +1999,7 @@ nsresult TextEditor::InsertWithQuotationsAsSubAction(
|
||||||
quotedStuff.Append(char16_t('\n'));
|
quotedStuff.Append(char16_t('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
AutoTopLevelEditSubActionNotifier maybeTopLevelEditSubAction(
|
AutoEditSubActionNotifier startToHandleEditSubAction(
|
||||||
*this, EditSubAction::eInsertText, nsIEditor::eNext);
|
*this, EditSubAction::eInsertText, nsIEditor::eNext);
|
||||||
|
|
||||||
EditSubActionInfo subActionInfo(EditSubAction::eInsertQuotedText);
|
EditSubActionInfo subActionInfo(EditSubAction::eInsertQuotedText);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче