This commit is contained in:
jfrancis%netscape.com 2000-07-11 19:51:36 +00:00
Родитель 2e3fb90a4d
Коммит 209a7ca3fa
8 изменённых файлов: 88 добавлений и 8 удалений

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

@ -192,6 +192,12 @@ NS_IMETHODIMP IMETextTxn::Write(nsIOutputStream *aOutputStream)
return NS_OK;
}
NS_IMETHODIMP IMETextTxn::MarkFixed(void)
{
mFixed = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP IMETextTxn::GetUndoString(nsString *aString)
{
NS_ASSERTION(aString, "illegal value- null ptr- aString");

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

@ -86,6 +86,8 @@ public:
NS_IMETHOD GetRedoString(nsString *aString);
NS_IMETHOD MarkFixed(void);
// nsISupports declarations
// override QueryInterface to handle IMETextTxn request

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

@ -2335,6 +2335,15 @@ nsEditor::ForceCompositionEnd()
return NS_OK;
}
NS_IMETHODIMP
nsEditor::Composing(PRBool *aInIMEMode)
{
if (!aInIMEMode) return NS_ERROR_NULL_POINTER;
*aInIMEMode = mInIMEMode;
return NS_OK;
}
#ifdef XP_MAC
#pragma mark -
#pragma mark public nsEditor methods
@ -2636,7 +2645,7 @@ NS_IMETHODIMP nsEditor::InsertTextIntoTextNodeImpl(const nsString& aStringToInse
{
result = CreateTxnForInsertText(aStringToInsert, aTextNode, aOffset, (InsertTextTxn**)&txn);
}
if (NS_FAILED(result)) return result;
if (NS_FAILED(result)) return result; // we potentially leak txn here?
// let listeners know whats up
PRInt32 i;
@ -2653,9 +2662,6 @@ NS_IMETHODIMP nsEditor::InsertTextIntoTextNodeImpl(const nsString& aStringToInse
BeginUpdateViewBatch();
result = Do(txn);
// The transaction system (if any) has taken ownwership of txns.
// aggTxn released at end of routine.
NS_IF_RELEASE(txn);
EndUpdateViewBatch();
// let listeners know what happened
@ -2669,6 +2675,31 @@ NS_IMETHODIMP nsEditor::InsertTextIntoTextNodeImpl(const nsString& aStringToInse
}
}
// Added some cruft here for bug 43366. Layout was crashing because we left an
// empty text node lying around in the document. So I delete empty text nodes
// caused by IME. I have to mark the IME transaction as "fixed", which means
// that furure ime txns won't merge with it. This is because we don't want
// future ime txns trying to put their text into a node that is no longer in
// the document. This does not break undo/redo, because all these txns are
// wrapped in a parent PlaceHolder txn, and placeholder txns are already
// savvy to having multiple ime txns inside them.
// delete empty ime text node if there is one
if (mInIMEMode && mIMETextNode)
{
PRUint32 len;
mIMETextNode->GetLength(&len);
if (!len)
{
DeleteNode(mIMETextNode);
mIMETextNode = nsnull;
((IMETextTxn*)txn)->MarkFixed(); // mark the ime txn "fixed"
}
}
// The transaction system (if any) has taken ownwership of txns.
// aggTxn released at end of routine.
NS_IF_RELEASE(txn);
return result;
}

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

@ -300,6 +300,7 @@ public:
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
NS_IMETHOD EndComposition(void);
NS_IMETHOD ForceCompositionEnd(void);
NS_IMETHOD Composing(PRBool *aInIMEMode);
public:

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

@ -192,6 +192,12 @@ NS_IMETHODIMP IMETextTxn::Write(nsIOutputStream *aOutputStream)
return NS_OK;
}
NS_IMETHODIMP IMETextTxn::MarkFixed(void)
{
mFixed = PR_TRUE;
return NS_OK;
}
NS_IMETHODIMP IMETextTxn::GetUndoString(nsString *aString)
{
NS_ASSERTION(aString, "illegal value- null ptr- aString");

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

@ -86,6 +86,8 @@ public:
NS_IMETHOD GetRedoString(nsString *aString);
NS_IMETHOD MarkFixed(void);
// nsISupports declarations
// override QueryInterface to handle IMETextTxn request

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

@ -2335,6 +2335,15 @@ nsEditor::ForceCompositionEnd()
return NS_OK;
}
NS_IMETHODIMP
nsEditor::Composing(PRBool *aInIMEMode)
{
if (!aInIMEMode) return NS_ERROR_NULL_POINTER;
*aInIMEMode = mInIMEMode;
return NS_OK;
}
#ifdef XP_MAC
#pragma mark -
#pragma mark public nsEditor methods
@ -2636,7 +2645,7 @@ NS_IMETHODIMP nsEditor::InsertTextIntoTextNodeImpl(const nsString& aStringToInse
{
result = CreateTxnForInsertText(aStringToInsert, aTextNode, aOffset, (InsertTextTxn**)&txn);
}
if (NS_FAILED(result)) return result;
if (NS_FAILED(result)) return result; // we potentially leak txn here?
// let listeners know whats up
PRInt32 i;
@ -2653,9 +2662,6 @@ NS_IMETHODIMP nsEditor::InsertTextIntoTextNodeImpl(const nsString& aStringToInse
BeginUpdateViewBatch();
result = Do(txn);
// The transaction system (if any) has taken ownwership of txns.
// aggTxn released at end of routine.
NS_IF_RELEASE(txn);
EndUpdateViewBatch();
// let listeners know what happened
@ -2669,6 +2675,31 @@ NS_IMETHODIMP nsEditor::InsertTextIntoTextNodeImpl(const nsString& aStringToInse
}
}
// Added some cruft here for bug 43366. Layout was crashing because we left an
// empty text node lying around in the document. So I delete empty text nodes
// caused by IME. I have to mark the IME transaction as "fixed", which means
// that furure ime txns won't merge with it. This is because we don't want
// future ime txns trying to put their text into a node that is no longer in
// the document. This does not break undo/redo, because all these txns are
// wrapped in a parent PlaceHolder txn, and placeholder txns are already
// savvy to having multiple ime txns inside them.
// delete empty ime text node if there is one
if (mInIMEMode && mIMETextNode)
{
PRUint32 len;
mIMETextNode->GetLength(&len);
if (!len)
{
DeleteNode(mIMETextNode);
mIMETextNode = nsnull;
((IMETextTxn*)txn)->MarkFixed(); // mark the ime txn "fixed"
}
}
// The transaction system (if any) has taken ownwership of txns.
// aggTxn released at end of routine.
NS_IF_RELEASE(txn);
return result;
}

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

@ -300,6 +300,7 @@ public:
NS_IMETHOD SetCompositionString(const nsString& aCompositionString, nsIPrivateTextRangeList* aTextRangeList,nsTextEventReply* aReply);
NS_IMETHOD EndComposition(void);
NS_IMETHOD ForceCompositionEnd(void);
NS_IMETHOD Composing(PRBool *aInIMEMode);
public: