mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
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
@ -91,9 +91,7 @@ DeleteRangeTransaction::DoTransaction()
|
||||
}
|
||||
|
||||
// only set selection to deletion point if editor gives permission
|
||||
bool bAdjustSelection;
|
||||
mEditorBase->ShouldTxnSetSelection(&bAdjustSelection);
|
||||
if (bAdjustSelection) {
|
||||
if (mEditorBase->GetShouldTxnSetSelection()) {
|
||||
RefPtr<Selection> selection = mEditorBase->GetSelection();
|
||||
if (NS_WARN_IF(!selection)) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -982,14 +982,6 @@ EditorBase::EndPlaceholderTransaction()
|
||||
mPlaceholderBatch--;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EditorBase::ShouldTxnSetSelection(bool* aResult)
|
||||
{
|
||||
NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
|
||||
*aResult = mShouldTxnSetSelection;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EditorBase::SetShouldTxnSetSelection(bool aShould)
|
||||
{
|
||||
|
@ -60,6 +60,7 @@ class CompositionTransaction;
|
||||
class CreateElementTransaction;
|
||||
class CSSEditUtils;
|
||||
class DeleteNodeTransaction;
|
||||
class DeleteRangeTransaction;
|
||||
class DeleteTextTransaction;
|
||||
class EditAggregateTransaction;
|
||||
class EditorEventListener;
|
||||
@ -1971,6 +1972,7 @@ protected:
|
||||
friend class CreateElementTransaction;
|
||||
friend class CSSEditUtils;
|
||||
friend class DeleteNodeTransaction;
|
||||
friend class DeleteRangeTransaction;
|
||||
friend class DeleteTextTransaction;
|
||||
friend class HTMLEditRules;
|
||||
friend class HTMLEditUtils;
|
||||
|
@ -216,16 +216,23 @@ interface nsIEditor : nsISupports
|
||||
*/
|
||||
void endTransaction();
|
||||
|
||||
boolean shouldTxnSetSelection();
|
||||
|
||||
/** Set the flag that prevents insertElementTxn from changing the selection
|
||||
* @param should Set false to suppress changing the selection;
|
||||
* i.e., before using InsertElement() to insert
|
||||
* under <head> element
|
||||
* WARNING: You must be very careful to reset back to PR_TRUE after
|
||||
* setting PR_FALSE, else selection/caret is trashed
|
||||
* for further editing.
|
||||
*/
|
||||
/**
|
||||
* While setting the flag with this method to false, CreateElementTransaction,
|
||||
* DeleteRangeTransaction, DeleteTextTransaction, InsertNodeTransaction,
|
||||
* InsertTextTransaction and SplitNodeTransaction won't change Selection
|
||||
* after modifying the DOM tree.
|
||||
* Note that calling this with false does not guarantee that Selection won't
|
||||
* be changed because other transaction may ignore this flag, editor itself
|
||||
* may change selection, and current selection may become invalid after
|
||||
* 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);
|
||||
|
||||
/* ------------ Inline Spell Checking methods -------------- */
|
||||
|
Loading…
Reference in New Issue
Block a user