forked from mirrors/gecko-dev
Bug 1480055 - part 1: Remove nsIEditor::shouldTxnSetSelection() r=m_kato
nsIEditor::ShouldTxnSetSelection() is used only by DeleteRangeTransaction (even if including comm-central and BlueGriffon) and there is a non-virtual method EditorBase::GetShouldTxnSetSelection(). So, we can remove this. MozReview-Commit-ID: JWSCw9k6lI0 --HG-- extra : rebase_source : 2509274216a1493134757a7d106464f06ea0ba57
This commit is contained in:
parent
9121cf9b3c
commit
470feacd31
4 changed files with 20 additions and 21 deletions
|
|
@ -91,9 +91,7 @@ DeleteRangeTransaction::DoTransaction()
|
||||||
}
|
}
|
||||||
|
|
||||||
// only set selection to deletion point if editor gives permission
|
// only set selection to deletion point if editor gives permission
|
||||||
bool bAdjustSelection;
|
if (mEditorBase->GetShouldTxnSetSelection()) {
|
||||||
mEditorBase->ShouldTxnSetSelection(&bAdjustSelection);
|
|
||||||
if (bAdjustSelection) {
|
|
||||||
RefPtr<Selection> selection = mEditorBase->GetSelection();
|
RefPtr<Selection> selection = mEditorBase->GetSelection();
|
||||||
if (NS_WARN_IF(!selection)) {
|
if (NS_WARN_IF(!selection)) {
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
|
||||||
|
|
@ -982,14 +982,6 @@ EditorBase::EndPlaceholderTransaction()
|
||||||
mPlaceholderBatch--;
|
mPlaceholderBatch--;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
EditorBase::ShouldTxnSetSelection(bool* aResult)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
|
|
||||||
*aResult = mShouldTxnSetSelection;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
EditorBase::SetShouldTxnSetSelection(bool aShould)
|
EditorBase::SetShouldTxnSetSelection(bool aShould)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ class CompositionTransaction;
|
||||||
class CreateElementTransaction;
|
class CreateElementTransaction;
|
||||||
class CSSEditUtils;
|
class CSSEditUtils;
|
||||||
class DeleteNodeTransaction;
|
class DeleteNodeTransaction;
|
||||||
|
class DeleteRangeTransaction;
|
||||||
class DeleteTextTransaction;
|
class DeleteTextTransaction;
|
||||||
class EditAggregateTransaction;
|
class EditAggregateTransaction;
|
||||||
class EditorEventListener;
|
class EditorEventListener;
|
||||||
|
|
@ -1971,6 +1972,7 @@ protected:
|
||||||
friend class CreateElementTransaction;
|
friend class CreateElementTransaction;
|
||||||
friend class CSSEditUtils;
|
friend class CSSEditUtils;
|
||||||
friend class DeleteNodeTransaction;
|
friend class DeleteNodeTransaction;
|
||||||
|
friend class DeleteRangeTransaction;
|
||||||
friend class DeleteTextTransaction;
|
friend class DeleteTextTransaction;
|
||||||
friend class HTMLEditRules;
|
friend class HTMLEditRules;
|
||||||
friend class HTMLEditUtils;
|
friend class HTMLEditUtils;
|
||||||
|
|
|
||||||
|
|
@ -216,16 +216,23 @@ interface nsIEditor : nsISupports
|
||||||
*/
|
*/
|
||||||
void endTransaction();
|
void endTransaction();
|
||||||
|
|
||||||
boolean shouldTxnSetSelection();
|
/**
|
||||||
|
* While setting the flag with this method to false, CreateElementTransaction,
|
||||||
/** Set the flag that prevents insertElementTxn from changing the selection
|
* DeleteRangeTransaction, DeleteTextTransaction, InsertNodeTransaction,
|
||||||
* @param should Set false to suppress changing the selection;
|
* InsertTextTransaction and SplitNodeTransaction won't change Selection
|
||||||
* i.e., before using InsertElement() to insert
|
* after modifying the DOM tree.
|
||||||
* under <head> element
|
* Note that calling this with false does not guarantee that Selection won't
|
||||||
* WARNING: You must be very careful to reset back to PR_TRUE after
|
* be changed because other transaction may ignore this flag, editor itself
|
||||||
* setting PR_FALSE, else selection/caret is trashed
|
* may change selection, and current selection may become invalid after
|
||||||
* for further editing.
|
* changing the DOM tree, etc.
|
||||||
*/
|
* After calling this method with true, the caller should guarantee that
|
||||||
|
* Selection should be positioned where user expects.
|
||||||
|
*
|
||||||
|
* @param should false if you don't want above transactions to modify
|
||||||
|
* Selection automatically after modifying the DOM tree.
|
||||||
|
* Note that calling this with false does not guarantee
|
||||||
|
* that Selection is never changed.
|
||||||
|
*/
|
||||||
void setShouldTxnSetSelection(in boolean should);
|
void setShouldTxnSetSelection(in boolean should);
|
||||||
|
|
||||||
/* ------------ Inline Spell Checking methods -------------- */
|
/* ------------ Inline Spell Checking methods -------------- */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue