diff options
Diffstat (limited to 'dom/base/nsTextFragment.h')
-rw-r--r-- | dom/base/nsTextFragment.h | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/dom/base/nsTextFragment.h b/dom/base/nsTextFragment.h index 5330815683..91efa49254 100644 --- a/dom/base/nsTextFragment.h +++ b/dom/base/nsTextFragment.h @@ -113,8 +113,7 @@ class nsTextFragment final { } ReleaseText(); if (aForce2b && !aUpdateBidi) { - nsStringBuffer* buffer = nsStringBuffer::FromString(aString); - if (buffer) { + if (nsStringBuffer* buffer = aString.GetStringBuffer()) { NS_ADDREF(m2b = buffer); mState.mInHeap = true; mState.mIs2b = true; @@ -154,19 +153,13 @@ class nsTextFragment final { const mozilla::fallible_t& aFallible) const { if (mState.mIs2b) { if (aString.IsEmpty()) { - m2b->ToString(mState.mLength, aString); + aString.Assign(m2b, mState.mLength); return true; } - bool ok = aString.Append(Get2b(), mState.mLength, aFallible); - if (!ok) { - return false; - } - - return true; - } else { - return AppendASCIItoUTF16(Substring(m1b, mState.mLength), aString, - aFallible); + return aString.Append(Get2b(), mState.mLength, aFallible); } + return AppendASCIItoUTF16(Substring(m1b, mState.mLength), aString, + aFallible); } /** |