зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1768317 - Make `InsertTextTransaction::GetData()` returns reference of its `mStringToInsert` r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D179521
This commit is contained in:
Родитель
a062f85860
Коммит
9f3eb23029
|
@ -157,9 +157,7 @@ NS_IMETHODIMP InsertTextTransaction::Merge(nsITransaction* aOtherTransaction,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsAutoString otherData;
|
||||
otherInsertTextTransaction->GetData(otherData);
|
||||
mStringToInsert += otherData;
|
||||
mStringToInsert += otherInsertTextTransaction->GetData();
|
||||
*aDidMerge = true;
|
||||
MOZ_LOG(GetLogModule(), LogLevel::Debug,
|
||||
("%p InsertTextTransaction::%s(aOtherTransaction=%p) returned true",
|
||||
|
@ -169,12 +167,8 @@ NS_IMETHODIMP InsertTextTransaction::Merge(nsITransaction* aOtherTransaction,
|
|||
|
||||
/* ============ private methods ================== */
|
||||
|
||||
void InsertTextTransaction::GetData(nsString& aResult) {
|
||||
aResult = mStringToInsert;
|
||||
}
|
||||
|
||||
bool InsertTextTransaction::IsSequentialInsert(
|
||||
InsertTextTransaction& aOtherTransaction) {
|
||||
InsertTextTransaction& aOtherTransaction) const {
|
||||
return aOtherTransaction.mTextNode == mTextNode &&
|
||||
aOtherTransaction.mOffset == mOffset + mStringToInsert.Length();
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ class InsertTextTransaction final : public EditTransactionBase {
|
|||
/**
|
||||
* Return the string data associated with this transaction.
|
||||
*/
|
||||
void GetData(nsString& aResult);
|
||||
const nsString& GetData() const { return mStringToInsert; }
|
||||
|
||||
template <typename EditorDOMPointType>
|
||||
EditorDOMPointType SuggestPointToPutCaret() const {
|
||||
|
@ -73,7 +73,7 @@ class InsertTextTransaction final : public EditTransactionBase {
|
|||
virtual ~InsertTextTransaction() = default;
|
||||
|
||||
// Return true if aOtherTransaction immediately follows this transaction.
|
||||
bool IsSequentialInsert(InsertTextTransaction& aOtherTrasaction);
|
||||
bool IsSequentialInsert(InsertTextTransaction& aOtherTransaction) const;
|
||||
|
||||
// The Text node to operate upon.
|
||||
RefPtr<dom::Text> mTextNode;
|
||||
|
|
Загрузка…
Ссылка в новой задаче