mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 13:51:41 +00:00
Bug 1446533
part 7. Remove nsIDOMCharacterData::InsertData. r=mystor
MozReview-Commit-ID: 48XZ2J9ewHP
This commit is contained in:
parent
c441152ca4
commit
5475554b91
@ -217,21 +217,21 @@ CharacterData::SubstringData(uint32_t aStart, uint32_t aCount,
|
||||
void
|
||||
CharacterData::AppendData(const nsAString& aData, ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = SetTextInternal(mText.GetLength(), 0, aData.BeginReading(),
|
||||
InsertData(mText.Length(), aData, aRv);
|
||||
}
|
||||
|
||||
void
|
||||
CharacterData::InsertData(uint32_t aOffset,
|
||||
const nsAString& aData,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsresult rv = SetTextInternal(aOffset, 0, aData.BeginReading(),
|
||||
aData.Length(), true);
|
||||
if (NS_FAILED(rv)) {
|
||||
aRv.Throw(rv);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult
|
||||
CharacterData::InsertData(uint32_t aOffset,
|
||||
const nsAString& aData)
|
||||
{
|
||||
return SetTextInternal(aOffset, 0, aData.BeginReading(),
|
||||
aData.Length(), true);
|
||||
}
|
||||
|
||||
nsresult
|
||||
CharacterData::DeleteData(uint32_t aOffset, uint32_t aCount)
|
||||
{
|
||||
|
@ -96,7 +96,6 @@ public:
|
||||
ErrorResult& aError) override;
|
||||
|
||||
// Implementation for nsIDOMCharacterData
|
||||
nsresult InsertData(uint32_t aOffset, const nsAString& aArg);
|
||||
nsresult DeleteData(uint32_t aOffset, uint32_t aCount);
|
||||
nsresult ReplaceData(uint32_t aOffset, uint32_t aCount,
|
||||
const nsAString& aArg);
|
||||
@ -183,10 +182,7 @@ public:
|
||||
void SubstringData(uint32_t aStart, uint32_t aCount, nsAString& aReturn,
|
||||
ErrorResult& rv);
|
||||
void AppendData(const nsAString& aData, ErrorResult& rv);
|
||||
void InsertData(uint32_t aOffset, const nsAString& aData, ErrorResult& rv)
|
||||
{
|
||||
rv = InsertData(aOffset, aData);
|
||||
}
|
||||
void InsertData(uint32_t aOffset, const nsAString& aData, ErrorResult& rv);
|
||||
void DeleteData(uint32_t aOffset, uint32_t aCount, ErrorResult& rv)
|
||||
{
|
||||
rv = DeleteData(aOffset, aCount);
|
||||
|
@ -16,9 +16,6 @@
|
||||
[uuid(4109a2d2-e7af-445d-bb72-c7c9b875f35e)]
|
||||
interface nsIDOMCharacterData : nsIDOMNode
|
||||
{
|
||||
void insertData(in unsigned long offset,
|
||||
in DOMString arg)
|
||||
raises(DOMException);
|
||||
void deleteData(in unsigned long offset,
|
||||
in unsigned long count)
|
||||
raises(DOMException);
|
||||
|
@ -104,9 +104,10 @@ CompositionTransaction::DoTransaction()
|
||||
|
||||
// Advance caret: This requires the presentation shell to get the selection.
|
||||
if (mReplaceLength == 0) {
|
||||
nsresult rv = mTextNode->InsertData(mOffset, mStringToInsert);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
ErrorResult rv;
|
||||
mTextNode->InsertData(mOffset, mStringToInsert, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
mEditorBase->RangeUpdaterRef().
|
||||
SelAdjInsertText(*mTextNode, mOffset, mStringToInsert);
|
||||
|
@ -161,7 +161,9 @@ DeleteTextTransaction::UndoTransaction()
|
||||
if (NS_WARN_IF(!mCharData)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
return mCharData->InsertData(mOffset, mDeletedText);
|
||||
ErrorResult rv;
|
||||
mCharData->InsertData(mOffset, mDeletedText, rv);
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -65,9 +65,10 @@ InsertTextTransaction::DoTransaction()
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsresult rv = mTextNode->InsertData(mOffset, mStringToInsert);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
ErrorResult rv;
|
||||
mTextNode->InsertData(mOffset, mStringToInsert, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
// Only set selection to insertion point if editor gives permission
|
||||
|
@ -2595,7 +2595,7 @@ DeleteUnselectedNodes(nsIDocument* aOrigDoc, nsIDocument* aDoc)
|
||||
// text node then add ellipsis.
|
||||
Text* text = endNode->GetAsText();
|
||||
if (!ellipsisOffset && text && endOffset && endOffset < text->Length()) {
|
||||
text->InsertData(endOffset, kEllipsis);
|
||||
text->InsertData(endOffset, kEllipsis, IgnoreErrors());
|
||||
ellipsisOffset += kEllipsis.Length();
|
||||
}
|
||||
}
|
||||
@ -2613,7 +2613,7 @@ DeleteUnselectedNodes(nsIDocument* aOrigDoc, nsIDocument* aDoc)
|
||||
// If the next node will start mid text node then add ellipsis.
|
||||
Text* text = startNode ? startNode->GetAsText() : nullptr;
|
||||
if (text && startOffset && startOffset < text->Length()) {
|
||||
text->InsertData(startOffset, kEllipsis);
|
||||
text->InsertData(startOffset, kEllipsis, IgnoreErrors());
|
||||
startOffset += kEllipsis.Length();
|
||||
ellipsisOffset += kEllipsis.Length();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user