Bug 414148: Avoid copy of some nsDependentC?Strings. sr=dbaron, a=mtschrep

This commit is contained in:
jag@tty.nl 2008-01-26 15:00:19 -08:00
parent 19ab494e6e
commit 419b39f375
3 changed files with 4 additions and 5 deletions

View File

@ -628,7 +628,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsPresContext* aPresContext,
return; // fits, done.
}
const nsDependentString kEllipsis = nsContentUtils::GetLocalizedEllipsis();
const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
// start with an ellipsis
mCroppedTitle.Assign(kEllipsis);
@ -819,7 +819,7 @@ nsTextBoxFrame::UpdateAccessTitle()
return;
}
const nsDependentString kEllipsis = nsContentUtils::GetLocalizedEllipsis();
const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
PRUint32 offset = mTitle.Length();
if (StringEndsWith(mTitle, kEllipsis)) {
offset -= kEllipsis.Length();

View File

@ -1350,7 +1350,7 @@ nsTreeBodyFrame::AdjustForCellText(nsAutoString& aText,
if (width > maxWidth) {
// See if the width is even smaller than the ellipsis
// If so, clear the text completely.
const nsDependentString kEllipsis = nsContentUtils::GetLocalizedEllipsis();
const nsDependentString& kEllipsis = nsContentUtils::GetLocalizedEllipsis();
nscoord ellipsisWidth;
aRenderingContext.SetTextRunRTL(PR_FALSE);
aRenderingContext.GetWidth(kEllipsis, ellipsisWidth);

View File

@ -741,8 +741,7 @@ void GetHTMLCharset(guchar * data, PRInt32 dataLength, nsCString& str)
return;
}
// no "FFFE" and "FEFF", assume ASCII first to find "charset" info
nsDependentCString htmlStr =
nsDependentCString((const char *)data, dataLength);
const nsDependentCString htmlStr((const char *)data, dataLength);
nsACString::const_iterator start, end;
htmlStr.BeginReading(start);
htmlStr.EndReading(end);