Fix for bug 340674 (Clean up some editor transactions code - unused code). r=glazman, sr=sicking.

This commit is contained in:
peterv%propagandism.org 2006-06-08 12:47:24 +00:00
Родитель f1889ede5d
Коммит 02314cbe01
6 изменённых файлов: 1 добавлений и 147 удалений

Просмотреть файл

@ -47,21 +47,6 @@
// #define DEBUG_IMETXN
nsIAtom *IMETextTxn::gIMETextTxnName = nsnull;
nsresult IMETextTxn::ClassInit()
{
if (!gIMETextTxnName)
gIMETextTxnName = NS_NewAtom("NS_IMETextTxn");
return NS_OK;
}
nsresult IMETextTxn::ClassShutdown()
{
NS_IF_RELEASE(gIMETextTxnName);
return NS_OK;
}
IMETextTxn::IMETextTxn()
: EditTxn()
{

Просмотреть файл

@ -65,11 +65,6 @@ public:
virtual ~IMETextTxn();
/** used to name aggregate transactions that consist only of a single IMETextTxn,
* or a DeleteSelection followed by an IMETextTxn.
*/
static nsIAtom *gIMETextTxnName;
/** initialize the transaction
* @param aElement the text content node
* @param aOffset the location in aElement to do the insertion
@ -108,12 +103,6 @@ public:
/** return the string data associated with this transaction */
NS_IMETHOD GetData(nsString& aResult, nsIPrivateTextRangeList** aTextRangeList);
/** must be called before any IMETextTxn is instantiated */
static nsresult ClassInit();
/** must be called once we are guaranteed all IMETextTxn have completed */
static nsresult ClassShutdown();
protected:
NS_IMETHOD CollapseTextSelection(void);

Просмотреть файл

@ -44,21 +44,6 @@
static PRBool gNoisy = PR_FALSE;
#endif
nsIAtom *InsertTextTxn::gInsertTextTxnName;
nsresult InsertTextTxn::ClassInit()
{
if (!gInsertTextTxnName)
gInsertTextTxnName = NS_NewAtom("NS_InsertTextTxn");
return NS_OK;
}
nsresult InsertTextTxn::ClassShutdown()
{
NS_IF_RELEASE(gInsertTextTxnName);
return NS_OK;
}
InsertTextTxn::InsertTextTxn()
: EditTxn()
{
@ -162,48 +147,6 @@ NS_IMETHODIMP InsertTextTxn::Merge(nsITransaction *aTransaction, PRBool *aDidMer
}
NS_RELEASE(otherInsTxn);
}
else
{ // the next InsertTextTxn might be inside an aggregate that we have special knowledge of
EditAggregateTxn *otherTxn = nsnull;
aTransaction->QueryInterface(EditAggregateTxn::GetCID(), (void **)&otherTxn);
if (otherTxn)
{
nsCOMPtr<nsIAtom> txnName;
otherTxn->GetName(getter_AddRefs(txnName));
if (txnName && txnName.get()==gInsertTextTxnName)
{ // yep, it's one of ours. By definition, it must contain only
// another aggregate with a single child,
// or a single InsertTextTxn
EditTxn * childTxn;
otherTxn->GetTxnAt(0, (&childTxn));
if (childTxn)
{
InsertTextTxn * otherInsertTxn = nsnull;
result = childTxn->QueryInterface(InsertTextTxn::GetCID(), (void**)&otherInsertTxn);
if (NS_SUCCEEDED(result))
{
if (otherInsertTxn)
{
if (IsSequentialInsert(otherInsertTxn))
{
nsAutoString otherData;
otherInsertTxn->GetData(otherData);
mStringToInsert += otherData;
*aDidMerge = PR_TRUE;
#ifdef NS_DEBUG
if (gNoisy) { printf("InsertTextTxn assimilated %p\n", aTransaction); }
#endif
}
NS_RELEASE(otherInsertTxn);
}
}
NS_RELEASE(childTxn);
}
}
NS_RELEASE(otherTxn);
}
}
}
return result;
}

Просмотреть файл

@ -61,11 +61,6 @@ public:
virtual ~InsertTextTxn();
/** used to name aggregate transactions that consist only of a single InsertTextTxn,
* or a DeleteSelection followed by an InsertTextTxn.
*/
static nsIAtom *gInsertTextTxnName;
/** initialize the transaction
* @param aElement the text content node
* @param aOffset the location in aElement to do the insertion
@ -99,12 +94,6 @@ public:
/** return the string data associated with this transaction */
NS_IMETHOD GetData(nsString& aResult);
/** must be called before any InsertTextTxn is instantiated */
static nsresult ClassInit();
/** must be called once we are guaranteed all InsertTextTxn have completed */
static nsresult ClassShutdown();
protected:
/** return PR_TRUE if aOtherTxn immediately follows this txn */

Просмотреть файл

@ -235,10 +235,6 @@ nsEditor::~nsEditor()
mActionListeners = 0;
}
/* shut down all classes that needed initialization */
InsertTextTxn::ClassShutdown();
IMETextTxn::ClassShutdown();
delete mPhonetic;
NS_IF_RELEASE(mViewManager);
@ -281,11 +277,9 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot
NS_ADDREF(mViewManager);
mUpdateCount=0;
InsertTextTxn::ClassInit();
/* initialize IME stuff */
IMETextTxn::ClassInit();
mIMETextNode = do_QueryInterface(nsnull);
mIMETextNode = nsnull;
mIMETextOffset = 0;
mIMEBufferLength = 0;
@ -4832,46 +4826,6 @@ NS_IMETHODIMP nsEditor::CreateTxnForDeleteElement(nsIDOMNode * aElement,
return result;
}
/*NS_IMETHODIMP nsEditor::CreateAggregateTxnForDeleteSelection(nsIAtom *aTxnName, EditAggregateTxn **aAggTxn)
{
nsresult result = NS_ERROR_NULL_POINTER;
if (aAggTxn)
{
*aAggTxn = nsnull;
result = TransactionFactory::GetNewTransaction(EditAggregateTxn::GetCID(), (EditTxn**)aAggTxn);
if (NS_FAILED(result) || !*aAggTxn) {
return NS_ERROR_OUT_OF_MEMORY;
}
// Set the name for the aggregate transaction
(*aAggTxn)->SetName(aTxnName);
// Get current selection and setup txn to delete it,
// but only if selection exists (is not a collapsed "caret" state)
if (!mPresShellWeak) return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsIPresShell> ps = do_QueryReferent(mPresShellWeak);
if (!ps) return NS_ERROR_NOT_INITIALIZED;
nsCOMPtr<nsISelection> selection;
result = ps->GetSelection(nsISelectionController::SELECTION_NORMAL, getter_AddRefs(selection));
if (NS_SUCCEEDED(result) && selection)
{
PRBool collapsed;
result = selection->GetIsCollapsed(&collapsed);
if (NS_SUCCEEDED(result) && !collapsed) {
EditAggregateTxn *delSelTxn;
result = CreateTxnForDeleteSelection(eNone, &delSelTxn);
if (NS_SUCCEEDED(result) && delSelTxn) {
(*aAggTxn)->AppendChild(delSelTxn);
NS_RELEASE(delSelTxn);
}
}
}
}
return result;
}
*/
NS_IMETHODIMP
nsEditor::CreateTxnForIMEText(const nsAString& aStringToInsert,
IMETextTxn ** aTxn)

Просмотреть файл

@ -190,12 +190,6 @@ public:
nsresult CreateHTMLContent(const nsAString& aTag, nsIContent** aContent);
protected:
/*
NS_IMETHOD SetProperties(nsVoidArray *aPropList);
NS_IMETHOD GetProperties(nsVoidArray *aPropList);
*/
nsCString mContentMIMEType; // MIME type of the doc we are editing.
/** create a transaction for setting aAttribute to aValue on aElement