--- a/editor/libeditor/EditorUtils.h
+++ b/editor/libeditor/EditorUtils.h
@@ -123,52 +123,50 @@ class MOZ_RAII nsAutoRules
}
protected:
nsEditor *mEd;
bool mDoNothing;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
+namespace mozilla {
/***************************************************************************
* stack based helper class for turning off active selection adjustment
* by low level transactions
*/
-class MOZ_RAII nsAutoTxnsConserveSelection
+class MOZ_RAII AutoTransactionsConserveSelection final
{
- public:
-
- explicit nsAutoTxnsConserveSelection(nsEditor *ed MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
- : mEd(ed), mOldState(true)
+public:
+ explicit AutoTransactionsConserveSelection(nsEditor* aEditor
+ MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
+ : mEditor(aEditor)
+ , mOldState(true)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
- if (mEd)
- {
- mOldState = mEd->GetShouldTxnSetSelection();
- mEd->SetShouldTxnSetSelection(false);
+ if (mEditor) {
+ mOldState = mEditor->GetShouldTxnSetSelection();
+ mEditor->SetShouldTxnSetSelection(false);
}
}
- ~nsAutoTxnsConserveSelection()
+ ~AutoTransactionsConserveSelection()
{
- if (mEd)
- {
- mEd->SetShouldTxnSetSelection(mOldState);
+ if (mEditor) {
+ mEditor->SetShouldTxnSetSelection(mOldState);
}
}
- protected:
- nsEditor *mEd;
+protected:
+ nsEditor* mEditor;
bool mOldState;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
};
-namespace mozilla {
-
/***************************************************************************
* stack based helper class for batching reflow and paint requests.
*/
class MOZ_RAII AutoUpdateViewBatch final
{
public:
explicit AutoUpdateViewBatch(nsEditor* aEditor
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
--- a/editor/libeditor/nsEditor.cpp
+++ b/editor/libeditor/nsEditor.cpp
@@ -1568,17 +1568,17 @@ nsEditor::ReplaceContainer(Element* aOld
}
// notify our internal selection state listener
// (Note: A nsAutoSelectionReset object must be created
// before calling this to initialize mRangeUpdater)
AutoReplaceContainerSelNotify selStateNotify(mRangeUpdater, aOldContainer,
ret);
{
- nsAutoTxnsConserveSelection conserveSelection(this);
+ AutoTransactionsConserveSelection conserveSelection(this);
while (aOldContainer->HasChildren()) {
nsCOMPtr<nsIContent> child = aOldContainer->GetFirstChild();
res = DeleteNode(child);
NS_ENSURE_SUCCESS(res, nullptr);
res = InsertNode(*child, *ret, -1);
NS_ENSURE_SUCCESS(res, nullptr);
@@ -1662,17 +1662,17 @@ nsEditor::InsertContainerAbove(nsIConten
// Notify our internal selection state listener
nsAutoInsertContainerSelNotify selNotify(mRangeUpdater);
// Put inNode in new parent, outNode
res = DeleteNode(aNode);
NS_ENSURE_SUCCESS(res, nullptr);
{
- nsAutoTxnsConserveSelection conserveSelection(this);
+ AutoTransactionsConserveSelection conserveSelection(this);
res = InsertNode(*aNode, *newContent, 0);
NS_ENSURE_SUCCESS(res, nullptr);
}
// Put new parent in doc
res = InsertNode(*newContent, *parent, offset);
NS_ENSURE_SUCCESS(res, nullptr);
@@ -2324,17 +2324,17 @@ nsEditor::FindBetterInsertionPoint(nsCOM
}
nsresult
nsEditor::InsertTextImpl(const nsAString& aStringToInsert,
nsCOMPtr<nsINode>* aInOutNode,
int32_t* aInOutOffset,
nsIDocument* aDoc)
{
- // NOTE: caller *must* have already used nsAutoTxnsConserveSelection
+ // NOTE: caller *must* have already used AutoTransactionsConserveSelection
// stack-based class to turn off txn selection updating. Caller also turned
// on rules sniffing if desired.
NS_ENSURE_TRUE(aInOutNode && *aInOutNode && aInOutOffset && aDoc,
NS_ERROR_NULL_POINTER);
if (!ShouldHandleIMEComposition() && aStringToInsert.IsEmpty()) {
return NS_OK;
--- a/editor/libeditor/nsEditor.h
+++ b/editor/libeditor/nsEditor.h
@@ -49,16 +49,17 @@ class nsIPresShell;
class nsISupports;
class nsITransaction;
class nsIWidget;
class nsRange;
class nsString;
class nsTransactionManager;
namespace mozilla {
+class AutoTransactionsConserveSelection;
class ErrorResult;
class TextComposition;
struct EditorDOMPoint;
namespace dom {
class ChangeAttributeTxn;
class CreateElementTxn;
class DataTransfer;
@@ -879,16 +880,16 @@ protected:
bool mShouldTxnSetSelection; // turn off for conservative selection adjustment by txns
bool mDidPreDestroy; // whether PreDestroy has been called
bool mDidPostCreate; // whether PostCreate has been called
bool mDispatchInputEvent;
bool mIsInEditAction; // true while the instance is handling an edit action
bool mHidingCaret; // whether caret is hidden forcibly.
friend bool NSCanUnload(nsISupports* serviceMgr);
- friend class nsAutoTxnsConserveSelection;
+ friend class mozilla::AutoTransactionsConserveSelection;
friend class nsAutoSelectionReset;
friend class nsAutoRules;
friend class nsRangeUpdater;
};
#endif
--- a/editor/libeditor/nsHTMLDataTransfer.cpp
+++ b/editor/libeditor/nsHTMLDataTransfer.cpp
@@ -1181,17 +1181,17 @@ nsHTMLEditor::InsertFromTransferable(nsI
bool aDoDeleteSelection)
{
nsresult rv = NS_OK;
nsXPIDLCString bestFlavor;
nsCOMPtr<nsISupports> genericDataObj;
uint32_t len = 0;
if (NS_SUCCEEDED(transferable->GetAnyTransferData(getter_Copies(bestFlavor), getter_AddRefs(genericDataObj), &len)))
{
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
nsAutoString flavor;
flavor.AssignWithConversion(bestFlavor);
nsAutoString stuffToPaste;
bool isSafe = IsSafeToInsertData(aSourceDoc);
if (0 == nsCRT::strcmp(bestFlavor, kFileMime) ||
0 == nsCRT::strcmp(bestFlavor, kJPEGImageMime) ||
0 == nsCRT::strcmp(bestFlavor, kJPGImageMime) ||
--- a/editor/libeditor/nsHTMLEditRules.cpp
+++ b/editor/libeditor/nsHTMLEditRules.cpp
@@ -462,17 +462,17 @@ nsHTMLEditRules::AfterEditInner(EditActi
}
nsresult res;
if (bDamagedRange && !((action == EditAction::undo) || (action == EditAction::redo)))
{
// don't let any txns in here move the selection around behind our back.
// Note that this won't prevent explicit selection setting from working.
NS_ENSURE_STATE(mHTMLEditor);
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
// expand the "changed doc range" as needed
PromoteRange(*mDocChangeRange, action);
// if we did a ranged deletion or handling backspace key, make sure we have
// a place to put caret.
// Note we only want to do this if the overall operation was deletion,
// not if deletion was done along the way for EditAction::loadHTML, EditAction::insertText, etc.
@@ -1348,17 +1348,17 @@ nsHTMLEditRules::WillInsertText(EditActi
// turn off the edit listener: we know how to
// build the "doc changed range" ourselves, and it's
// must faster to do it once here than to track all
// the changes one at a time.
nsAutoLockListener lockit(&mListenerEnabled);
// don't spaz my selection in subtransactions
NS_ENSURE_STATE(mHTMLEditor);
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
nsAutoString tString(*inString);
const char16_t *unicodeBuf = tString.get();
int32_t pos = 0;
NS_NAMED_LITERAL_STRING(newlineStr, LFSTR);
// for efficiency, break out the pre case separately. This is because
// its a lot cheaper to search the input string for only newlines than
// it is to search for both tabs and newlines.
@@ -2254,17 +2254,17 @@ nsHTMLEditRules::WillDeleteSelection(Sel
nsCOMPtr<nsINode> endNode = aSelection->GetRangeAt(0)->GetEndParent();
int32_t endOffset = aSelection->GetRangeAt(0)->EndOffset();
NS_ENSURE_TRUE(endNode, NS_ERROR_FAILURE);
// Figure out if the endpoints are in nodes that can be merged. Adjust
// surrounding whitespace in preparation to delete selection.
if (!IsPlaintextEditor()) {
NS_ENSURE_STATE(mHTMLEditor);
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
res = nsWSRunObject::PrepareToDeleteRange(mHTMLEditor,
address_of(startNode), &startOffset,
address_of(endNode), &endOffset);
NS_ENSURE_SUCCESS(res, res);
}
{
// Track location of where we are deleting
@@ -2618,17 +2618,17 @@ nsHTMLEditRules::JoinBlocks(nsIContent&
// sublists in our implementation.
leftBlock = leftList;
rightBlock = rightList;
mergeLists = true;
existingList = leftList->NodeInfo()->NameAtom();
}
}
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
nsresult res = NS_OK;
int32_t rightOffset = 0;
int32_t leftOffset = -1;
// offset below is where you find yourself in rightBlock when you traverse
// upwards from leftBlock
if (EditorUtils::IsDescendantOf(leftBlock, rightBlock, &rightOffset)) {
@@ -3352,17 +3352,17 @@ nsHTMLEditRules::WillMakeBasicBlock(Sele
WillInsert(aSelection, aCancel);
// We want to ignore result of WillInsert()
*aCancel = false;
*aHandled = false;
nsresult res = NormalizeSelection(&aSelection);
NS_ENSURE_SUCCESS(res, res);
nsAutoSelectionReset selectionResetter(&aSelection, mHTMLEditor);
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
*aHandled = true;
// Contruct a list of nodes to act on.
nsTArray<OwningNonNull<nsINode>> arrayOfNodes;
res = GetNodesFromSelection(aSelection, EditAction::makeBasicBlock,
arrayOfNodes);
NS_ENSURE_SUCCESS(res, res);
@@ -5745,17 +5745,17 @@ nsHTMLEditRules::GetListActionNodes(nsTA
// the selection spans multiple lists but with no common list parent.
if (aOutArrayOfNodes.Length()) {
return NS_OK;
}
}
{
// We don't like other people messing with our selection!
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
// contruct a list of nodes to act on.
nsresult res = GetNodesFromSelection(*selection, EditAction::makeList,
aOutArrayOfNodes, aTouchContent);
NS_ENSURE_SUCCESS(res, res);
}
// Pre-process our list of nodes
--- a/editor/libeditor/nsHTMLEditor.cpp
+++ b/editor/libeditor/nsHTMLEditor.cpp
@@ -825,17 +825,17 @@ nsHTMLEditor::SetDocumentTitle(const nsA
{
RefPtr<SetDocTitleTxn> txn = new SetDocTitleTxn();
NS_ENSURE_TRUE(txn, NS_ERROR_OUT_OF_MEMORY);
nsresult result = txn->Init(this, &aTitle);
NS_ENSURE_SUCCESS(result, result);
//Don't let Rules System change the selection
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
return nsEditor::DoTransaction(txn);
}
/* ------------ Block methods moved from nsEditor -------------- */
///////////////////////////////////////////////////////////////////////////
// GetBlockNodeParent: returns enclosing block level ancestor, if any
//
Element*
@@ -3708,17 +3708,17 @@ nsHTMLEditor::GetEnclosingTable(nsIDOMNo
* "adjacent" means literally adjacent siblings of the same parent.
* Uses nsEditor::JoinNodes so action is undoable.
* Should be called within the context of a batch transaction.
*/
nsresult
nsHTMLEditor::CollapseAdjacentTextNodes(nsRange* aInRange)
{
NS_ENSURE_TRUE(aInRange, NS_ERROR_NULL_POINTER);
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
nsTArray<nsCOMPtr<nsIDOMNode> > textNodes;
// we can't actually do anything during iteration, so store the text nodes in an array
// don't bother ref counting them because we know we can hold them for the
// lifetime of this method
// build a list of editable text nodes
nsresult result;
@@ -4527,17 +4527,17 @@ nsHTMLEditor::SetCSSBackgroundColor(cons
NS_ENSURE_STATE(selection);
bool isCollapsed = selection->Collapsed();
nsAutoEditBatch batchIt(this);
nsAutoRules beginRulesSniffing(this, EditAction::insertElement,
nsIEditor::eNext);
nsAutoSelectionReset selectionResetter(selection, this);
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
bool cancel, handled;
nsTextRulesInfo ruleInfo(EditAction::setTextProperty);
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
NS_ENSURE_SUCCESS(res, res);
if (!cancel && !handled) {
// Loop through the ranges in the selection
NS_NAMED_LITERAL_STRING(bgcolor, "bgcolor");
--- a/editor/libeditor/nsHTMLEditorStyle.cpp
+++ b/editor/libeditor/nsHTMLEditorStyle.cpp
@@ -122,17 +122,17 @@ nsHTMLEditor::SetInlineProperty(nsIAtom*
// for the next text insertion
mTypeInState->SetProp(aProperty, aAttribute, aValue);
return NS_OK;
}
nsAutoEditBatch batchIt(this);
nsAutoRules beginRulesSniffing(this, EditAction::insertElement, nsIEditor::eNext);
nsAutoSelectionReset selectionResetter(selection, this);
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
bool cancel, handled;
nsTextRulesInfo ruleInfo(EditAction::setTextProperty);
// Protect the edit rules object from dying
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
NS_ENSURE_SUCCESS(res, res);
if (!cancel && !handled) {
// Loop through the ranges in the selection
@@ -1208,17 +1208,17 @@ nsHTMLEditor::RemoveInlinePropertyImpl(n
}
return NS_OK;
}
nsAutoEditBatch batchIt(this);
nsAutoRules beginRulesSniffing(this, EditAction::removeTextProperty,
nsIEditor::eNext);
nsAutoSelectionReset selectionResetter(selection, this);
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
bool cancel, handled;
nsTextRulesInfo ruleInfo(EditAction::removeTextProperty);
// Protect the edit rules object from dying
nsCOMPtr<nsIEditRules> kungFuDeathGrip(mRules);
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
NS_ENSURE_SUCCESS(res, res);
if (!cancel && !handled) {
@@ -1357,17 +1357,17 @@ nsHTMLEditor::RelativeFontChange(FontSiz
return NS_OK;
}
// Wrap with txn batching, rules sniffing, and selection preservation code
nsAutoEditBatch batchIt(this);
nsAutoRules beginRulesSniffing(this, EditAction::setTextProperty,
nsIEditor::eNext);
nsAutoSelectionReset selectionResetter(selection, this);
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
// Loop through the ranges in the selection
uint32_t rangeCount = selection->RangeCount();
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
RefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
// Adjust range to include any ancestors with entirely selected children
nsresult res = PromoteInlineRange(*range);
--- a/editor/libeditor/nsPlaintextDataTransfer.cpp
+++ b/editor/libeditor/nsPlaintextDataTransfer.cpp
@@ -107,17 +107,17 @@ NS_IMETHODIMP nsPlaintextEditor::InsertT
nsresult rv = NS_OK;
char* bestFlavor = nullptr;
nsCOMPtr<nsISupports> genericDataObj;
uint32_t len = 0;
if (NS_SUCCEEDED(aTransferable->GetAnyTransferData(&bestFlavor, getter_AddRefs(genericDataObj), &len))
&& bestFlavor && (0 == nsCRT::strcmp(bestFlavor, kUnicodeMime) ||
0 == nsCRT::strcmp(bestFlavor, kMozTextInternal)))
{
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
nsCOMPtr<nsISupportsString> textDataObj ( do_QueryInterface(genericDataObj) );
if (textDataObj && len > 0)
{
nsAutoString stuffToPaste;
textDataObj->GetData(stuffToPaste);
NS_ASSERTION(stuffToPaste.Length() <= (len/2), "Invalid length!");
// Sanitize possible carriage returns in the string to be inserted
--- a/editor/libeditor/nsPlaintextEditor.cpp
+++ b/editor/libeditor/nsPlaintextEditor.cpp
@@ -779,17 +779,17 @@ NS_IMETHODIMP nsPlaintextEditor::InsertL
return NS_ERROR_FAILURE;
}
// we need to get the doc
nsCOMPtr<nsIDocument> doc = GetDocument();
NS_ENSURE_TRUE(doc, NS_ERROR_NOT_INITIALIZED);
// don't spaz my selection in subtransactions
- nsAutoTxnsConserveSelection dontSpazMySelection(this);
+ AutoTransactionsConserveSelection dontSpazMySelection(this);
// insert a linefeed character
res = InsertTextImpl(NS_LITERAL_STRING("\n"), address_of(selNode),
&selOffset, doc);
if (!selNode) res = NS_ERROR_NULL_POINTER; // don't return here, so DidDoAction is called
if (NS_SUCCEEDED(res))
{
// set the selection to the correct location
--- a/editor/libeditor/nsTableEditor.cpp
+++ b/editor/libeditor/nsTableEditor.cpp
@@ -120,17 +120,17 @@ nsHTMLEditor::InsertCell(nsIDOMElement *
// Note: Do NOT use editor transaction for this
nsAutoString newColSpan;
newColSpan.AppendInt(aColSpan, 10);
newCell->SetAttribute(NS_LITERAL_STRING("colspan"), newColSpan);
}
if(aAfter) cellOffset++;
//Don't let Rules System change the selection
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
return InsertNode(newCell, cellParent, cellOffset);
}
NS_IMETHODIMP nsHTMLEditor::SetColSpan(nsIDOMElement *aCell, int32_t aColSpan)
{
NS_ENSURE_TRUE(aCell, NS_ERROR_NULL_POINTER);
nsAutoString newSpan;
newSpan.AppendInt(aColSpan, 10);
@@ -173,17 +173,17 @@ nsHTMLEditor::InsertTableCell(int32_t aN
&curStartRowIndex, &curStartColIndex, &rowSpan, &colSpan,
&actualRowSpan, &actualColSpan, &isSelected);
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(curCell, NS_ERROR_FAILURE);
int32_t newCellIndex = aAfter ? (startColIndex+colSpan) : startColIndex;
//We control selection resetting after the insert...
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, newCellIndex, ePreviousColumn, false);
//...so suppress Rules System selection munging
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
int32_t i;
for (i = 0; i < aNumber; i++)
{
nsCOMPtr<nsIDOMElement> newCell;
res = CreateElementWithDefaults(NS_LITERAL_STRING("td"), getter_AddRefs(newCell));
if (NS_SUCCEEDED(res) && newCell)
{
@@ -416,17 +416,17 @@ nsHTMLEditor::InsertTableColumn(int32_t
int32_t rowCount, colCount, rowIndex;
res = GetTableSize(table, &rowCount, &colCount);
NS_ENSURE_SUCCESS(res, res);
//We reset caret in destructor...
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousRow, false);
//.. so suppress Rules System selection munging
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
// If we are inserting after all existing columns
// Make sure table is "well formed"
// before appending new column
if (startColIndex >= colCount)
NormalizeTable(table);
nsCOMPtr<nsIDOMNode> rowNode;
@@ -545,17 +545,17 @@ nsHTMLEditor::InsertTableRow(int32_t aNu
// rowspan to its true value
if (rowSpan == 0)
SetRowSpan(curCell, actualRowSpan);
}
//We control selection resetting after the insert...
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
//...so suppress Rules System selection munging
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
nsCOMPtr<nsIDOMElement> cellForRowParent;
int32_t cellsInRow = 0;
if (startRowIndex < rowCount)
{
// We are inserting above an existing row
// Get each cell in the insert row to adjust for COLSPAN effects while we
// count how many cells are needed
@@ -755,17 +755,17 @@ nsHTMLEditor::DeleteTableCell(int32_t aN
NS_ENSURE_SUCCESS(res, res);
// Get indexes -- may be different than original cell
res = GetCellIndexes(cell, &startRowIndex, &startColIndex);
NS_ENSURE_SUCCESS(res, res);
// The setCaret object will call SetSelectionAfterTableEdit in its destructor
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
bool checkToDeleteRow = true;
bool checkToDeleteColumn = true;
while (cell)
{
bool deleteRow = false;
bool deleteCol = false;
@@ -891,17 +891,17 @@ nsHTMLEditor::DeleteTableCell(int32_t aN
NS_ENSURE_SUCCESS(res, res);
}
else
{
// More than 1 cell in the row
// The setCaret object will call SetSelectionAfterTableEdit in its destructor
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
res = DeleteNode(cell);
// If we fail, don't try to delete any more cells???
NS_ENSURE_SUCCESS(res, res);
}
}
return NS_OK;
}
@@ -923,17 +923,17 @@ nsHTMLEditor::DeleteTableCellContents()
// Don't fail if no cell found
NS_ENSURE_TRUE(cell, NS_EDITOR_ELEMENT_NOT_FOUND);
nsAutoEditBatch beginBatching(this);
// Prevent rules testing until we're done
nsAutoRules beginRulesSniffing(this, EditAction::deleteNode, nsIEditor::eNext);
//Don't let Rules System change the selection
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
nsCOMPtr<nsIDOMElement> firstCell;
nsCOMPtr<nsIDOMRange> range;
res = GetFirstSelectedCell(getter_AddRefs(range), getter_AddRefs(firstCell));
NS_ENSURE_SUCCESS(res, res);
@@ -1201,17 +1201,17 @@ nsHTMLEditor::DeleteTableRow(int32_t aNu
// Fetch indexes again - may be different for selected cells
res = GetCellIndexes(firstCell, &startRowIndex, &startColIndex);
NS_ENSURE_SUCCESS(res, res);
}
//We control selection resetting after the insert...
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousRow, false);
// Don't change selection during deletions
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
if (firstCell && rangeCount > 1)
{
// Use selected cells to determine what rows to delete
cell = firstCell;
while (cell)
{
@@ -1701,17 +1701,17 @@ nsHTMLEditor::SplitTableCell()
nsAutoEditBatch beginBatching(this);
// Prevent auto insertion of BR in new cell until we're done
nsAutoRules beginRulesSniffing(this, EditAction::insertNode, nsIEditor::eNext);
// We reset selection
nsSetSelectionAfterTableEdit setCaret(this, table, startRowIndex, startColIndex, ePreviousColumn, false);
//...so suppress Rules System selection munging
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
nsCOMPtr<nsIDOMElement> newCell;
int32_t rowIndex = startRowIndex;
int32_t rowSpanBelow, colSpanAfter;
// Split up cell row-wise first into rowspan=1 above, and the rest below,
// whittling away at the cell below until no more extra span
for (rowSpanBelow = actualRowSpan-1; rowSpanBelow >= 0; rowSpanBelow--)
@@ -1967,17 +1967,17 @@ nsHTMLEditor::JoinTableCells(bool aMerge
getter_AddRefs(targetCell),
nullptr, nullptr,
&startRowIndex, &startColIndex);
NS_ENSURE_SUCCESS(res, res);
if(!table || !targetCell) return NS_EDITOR_ELEMENT_NOT_FOUND;
nsAutoEditBatch beginBatching(this);
//Don't let Rules System change the selection
- nsAutoTxnsConserveSelection dontChangeSelection(this);
+ AutoTransactionsConserveSelection dontChangeSelection(this);
// Note: We dont' use nsSetSelectionAfterTableEdit here so the selection
// is retained after joining. This leaves the target cell selected
// as well as the "non-contiguous" cells, so user can see what happened.
nsCOMPtr<nsIDOMElement> firstCell;
int32_t firstRowIndex, firstColIndex;
res = GetFirstSelectedCellInTable(&firstRowIndex, &firstColIndex, getter_AddRefs(firstCell));
--- a/editor/libeditor/nsTextEditRules.cpp
+++ b/editor/libeditor/nsTextEditRules.cpp
@@ -293,17 +293,17 @@ nsTextEditRules::WillDoAction(Selection*
NS_IMETHODIMP
nsTextEditRules::DidDoAction(Selection* aSelection,
nsRulesInfo *aInfo, nsresult aResult)
{
NS_ENSURE_STATE(mEditor);
// don't let any txns in here move the selection around behind our back.
// Note that this won't prevent explicit selection setting from working.
- nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mEditor);
NS_ENSURE_TRUE(aSelection && aInfo, NS_ERROR_NULL_POINTER);
// my kingdom for dynamic cast
nsTextRulesInfo *info = static_cast<nsTextRulesInfo*>(aInfo);
switch (info->action)
{
@@ -744,17 +744,17 @@ nsTextEditRules::WillInsertText(EditActi
NS_ENSURE_SUCCESS(res, res);
} else {
// aAction == EditAction::insertText; find where we are
nsCOMPtr<nsINode> curNode = selNode;
int32_t curOffset = selOffset;
// don't spaz my selection in subtransactions
NS_ENSURE_STATE(mEditor);
- nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mEditor);
res = mEditor->InsertTextImpl(*outString, address_of(curNode),
&curOffset, doc);
NS_ENSURE_SUCCESS(res, res);
if (curNode)
{
// Make the caret attach to the inserted text, unless this text ends with a LF,
@@ -1136,17 +1136,17 @@ nsTextEditRules::CreateTrailingBRIfNeede
dom::Element* body = mEditor->GetRoot();
NS_ENSURE_TRUE(body, NS_ERROR_NULL_POINTER);
nsIContent* lastChild = body->GetLastChild();
// assuming CreateBogusNodeIfNeeded() has been called first
NS_ENSURE_TRUE(lastChild, NS_ERROR_NULL_POINTER);
if (!lastChild->IsHTMLElement(nsGkAtoms::br)) {
- nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mEditor);
nsCOMPtr<nsIDOMNode> domBody = do_QueryInterface(body);
return CreateMozBR(domBody, body->Length());
}
// Check to see if the trailing BR is a former bogus node - this will have
// stuck around if we previously morphed a trailing node into a bogus node.
if (!mEditor->IsMozEditorBogusNode(lastChild)) {
return NS_OK;
--- a/editor/libeditor/nsWSRunObject.cpp
+++ b/editor/libeditor/nsWSRunObject.cpp
@@ -1477,17 +1477,17 @@ nsWSRunObject::ConvertToNBSP(WSPoint aPo
nsCOMPtr<nsIDOMNode> san =
mHTMLEditor->FindUserSelectAllNode(GetAsDOMNode(aPoint.mTextNode));
if (san) {
return NS_OK;
}
}
// First, insert an nbsp
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
nsAutoString nbspStr(nbsp);
nsresult res = mHTMLEditor->InsertTextIntoTextNodeImpl(nbspStr,
*aPoint.mTextNode, aPoint.mOffset, true);
NS_ENSURE_SUCCESS(res, res);
// Next, find range of ws it will replace
RefPtr<Text> startNode, endNode;
int32_t startOffset = 0, endOffset = 0;
@@ -1792,17 +1792,17 @@ nsWSRunObject::CheckTrailingNBSPOfRun(WS
// Refresh thePoint, prevPoint
thePoint = GetCharBefore(aRun->mEndNode, aRun->mEndOffset);
prevPoint = GetCharBefore(thePoint);
rightCheck = true;
}
}
if (leftCheck && rightCheck) {
// Now replace nbsp with space. First, insert a space
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
nsAutoString spaceStr(char16_t(32));
res = mHTMLEditor->InsertTextIntoTextNodeImpl(spaceStr,
*thePoint.mTextNode,
thePoint.mOffset, true);
NS_ENSURE_SUCCESS(res, res);
// Finally, delete that nbsp
res = DeleteChars(thePoint.mTextNode, thePoint.mOffset + 1,
@@ -1823,17 +1823,17 @@ nsWSRunObject::CheckTrailingNBSPOfRun(WS
getter_AddRefs(endNode), &endOffset);
// Delete that nbsp
res = DeleteChars(thePoint.mTextNode, thePoint.mOffset,
thePoint.mTextNode, thePoint.mOffset + 1);
NS_ENSURE_SUCCESS(res, res);
// Finally, insert that nbsp before the ASCII ws run
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
nsAutoString nbspStr(nbsp);
res = mHTMLEditor->InsertTextIntoTextNodeImpl(nbspStr, *startNode,
startOffset, true);
NS_ENSURE_SUCCESS(res, res);
}
}
return NS_OK;
}
@@ -1858,17 +1858,17 @@ nsWSRunObject::CheckTrailingNBSP(WSFragm
}
} else if (aRun->mLeftType == WSType::text ||
aRun->mLeftType == WSType::special) {
canConvert = true;
}
}
if (canConvert) {
// First, insert a space
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
nsAutoString spaceStr(char16_t(32));
nsresult res = mHTMLEditor->InsertTextIntoTextNodeImpl(spaceStr,
*thePoint.mTextNode, thePoint.mOffset, true);
NS_ENSURE_SUCCESS(res, res);
// Finally, delete that nbsp
res = DeleteChars(thePoint.mTextNode, thePoint.mOffset + 1,
thePoint.mTextNode, thePoint.mOffset + 2);
@@ -1899,17 +1899,17 @@ nsWSRunObject::CheckLeadingNBSP(WSFragme
} else if (aRun->mRightType == WSType::text ||
aRun->mRightType == WSType::special ||
aRun->mRightType == WSType::br) {
canConvert = true;
}
}
if (canConvert) {
// First, insert a space
- nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
+ AutoTransactionsConserveSelection dontSpazMySelection(mHTMLEditor);
nsAutoString spaceStr(char16_t(32));
nsresult res = mHTMLEditor->InsertTextIntoTextNodeImpl(spaceStr,
*thePoint.mTextNode, thePoint.mOffset, true);
NS_ENSURE_SUCCESS(res, res);
// Finally, delete that nbsp
res = DeleteChars(thePoint.mTextNode, thePoint.mOffset + 1,
thePoint.mTextNode, thePoint.mOffset + 2);