diff --git a/mozilla/content/base/src/nsHTMLValue.cpp b/mozilla/content/base/src/nsHTMLValue.cpp index 5b1e8d7aadd..a86f70b9253 100644 --- a/mozilla/content/base/src/nsHTMLValue.cpp +++ b/mozilla/content/base/src/nsHTMLValue.cpp @@ -266,37 +266,37 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); aBuffer.Append(*(mValue.mString)); - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); } else { - aBuffer.Append("null str"); + aBuffer.AppendWithConversion("null str"); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.Append("0x"); - aBuffer.Append((PRInt32)mValue.mISupports, 16); + aBuffer.AppendWithConversion("0x"); + aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.Append("(0x"); - aBuffer.Append(NS_GET_R(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_G(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_B(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_A(mValue.mColor), 16); - aBuffer.Append(')'); + aBuffer.AppendWithConversion("(0x"); + aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); + aBuffer.AppendWithConversion(')'); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.Append(mValue.mFloat * 100.0f); + aBuffer.AppendFloat(mValue.mFloat * 100.0f); } else { - aBuffer.Append(mValue.mInt, 10); - aBuffer.Append("[0x"); - aBuffer.Append(mValue.mInt, 16); - aBuffer.Append(']'); + aBuffer.AppendInt(mValue.mInt, 10); + aBuffer.AppendWithConversion("[0x"); + aBuffer.AppendInt(mValue.mInt, 16); + aBuffer.AppendWithConversion(']'); } switch (mUnit) { @@ -304,15 +304,15 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.Append("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.Append("enum"); break; - case eHTMLUnit_Proportional: aBuffer.Append("*"); break; - case eHTMLUnit_Color: aBuffer.Append("rbga"); break; - case eHTMLUnit_Percent: aBuffer.Append("%"); break; - case eHTMLUnit_Pixel: aBuffer.Append("px"); break; + case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; + case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; + case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; + case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; + case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; } - aBuffer.Append(' '); + aBuffer.AppendWithConversion(' '); } void nsHTMLValue::ToString(nsString& aBuffer) const diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp index d1e974f4c78..1f04a34d318 100644 --- a/mozilla/content/base/src/nsStyleContext.cpp +++ b/mozilla/content/base/src/nsStyleContext.cpp @@ -1526,7 +1526,7 @@ void StyleUserInterfaceImpl::ResetFrom(const nsStyleUserInterface* aParent, nsIP mUserSelect = NS_STYLE_USER_SELECT_AUTO; mKeyEquivalent = PRUnichar(0); // XXX what type should this be? mResizer = NS_STYLE_RESIZER_AUTO; - mBehavior = ""; + mBehavior.SetLength(0); } void StyleUserInterfaceImpl::SetFrom(const nsStyleUserInterface& aSource) diff --git a/mozilla/content/events/src/nsEventStateManager.cpp b/mozilla/content/events/src/nsEventStateManager.cpp index 6b64d7c9e37..eee45f695d3 100644 --- a/mozilla/content/events/src/nsEventStateManager.cpp +++ b/mozilla/content/events/src/nsEventStateManager.cpp @@ -1764,7 +1764,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent, nsIFrame* child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, value); nsAutoString tabStr; child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::tabindex, tabStr); - if (tabStr != "") { + if (!tabStr.IsEmpty()) { PRInt32 errorCode; tabIndex = tabStr.ToInteger(&errorCode); } diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 145495640f6..bb338503914 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -1274,26 +1274,25 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, case eHTMLUnit_Integer: aResult.Truncate(); - aResult.Append(value->GetIntValue(), 10); + aResult.AppendInt(value->GetIntValue(), 10); break; case eHTMLUnit_Pixel: aResult.Truncate(); - aResult.Append(value->GetPixelValue(), 10); + aResult.AppendInt(value->GetPixelValue(), 10); break; case eHTMLUnit_Percent: aResult.Truncate(); - aResult.Append(PRInt32(value->GetPercentValue() * 100.0f), 10); - aResult.Append('%'); + aResult.AppendInt(PRInt32(value->GetPercentValue() * 100.0f), 10); + aResult.AppendWithConversion('%'); break; case eHTMLUnit_Color: color = nscolor(value->GetColorValue()); PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", NS_GET_R(color), NS_GET_G(color), NS_GET_B(color)); - aResult.Truncate(); - aResult.Append(cbuf); + aResult.AssignWithConversion(cbuf); break; default: @@ -1492,7 +1491,7 @@ nsGenericHTMLElement::ListAttributes(FILE* out) const // value nsAutoString value; GetAttribute(nameSpaceID, attr, value); - buffer.Append("="); + buffer.AppendWithConversion("="); buffer.Append(value); fputs(" ", out); @@ -1580,41 +1579,39 @@ void NS_QuoteForHTML(const nsString& aValue, nsString& aResult); void NS_QuoteForHTML(const nsString& aValue, nsString& aResult) { - aResult.Truncate(); const PRUnichar* cp = aValue.GetUnicode(); const PRUnichar* end = aValue.GetUnicode() + aValue.Length(); - aResult.Append('"'); + aResult.AssignWithConversion('"'); while (cp < end) { PRUnichar ch = *cp++; if ((ch >= 0x20) && (ch <= 0x7f)) { if (ch == '\"') { - aResult.Append("""); + aResult.AppendWithConversion("""); } else { aResult.Append(ch); } } else { - aResult.Append("&#"); - aResult.Append((PRInt32) ch, 10); - aResult.Append(';'); + aResult.AppendWithConversion("&#"); + aResult.AppendInt((PRInt32) ch, 10); + aResult.AppendWithConversion(';'); } } - aResult.Append('"'); + aResult.AppendWithConversion('"'); } nsresult nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const { - aBuf.Truncate(0); - aBuf.Append('<'); + aBuf.AssignWithConversion('<'); if (nsnull != mTag) { nsAutoString tmp; mTag->ToString(tmp); aBuf.Append(tmp); } else { - aBuf.Append("?NULL"); + aBuf.AppendWithConversion("?NULL"); } if (nsnull != mAttributes) { @@ -1625,20 +1622,20 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const nsIAtom* atom = nsnull; mAttributes->GetAttributeNameAt(index, atom); atom->ToString(name); - aBuf.Append(' '); + aBuf.AppendWithConversion(' '); aBuf.Append(name); value.Truncate(); GetAttribute(kNameSpaceID_None, atom, value); NS_RELEASE(atom); if (value.Length() > 0) { - aBuf.Append('='); + aBuf.AppendWithConversion('='); NS_QuoteForHTML(value, quotedValue); aBuf.Append(quotedValue); } } } - aBuf.Append('>'); + aBuf.AppendWithConversion('>'); return NS_OK; } @@ -1664,7 +1661,7 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, NS_RELEASE(cssRule); } else { - aResult = "Unknown rule type"; + aResult.AssignWithConversion("Unknown rule type"); } NS_RELEASE(rule); } @@ -1705,7 +1702,7 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue, nsHTMLValue& aResult) { while (nsnull != aTable->tag) { - if (aValue.Equals(aTable->tag)) { + if (aValue.EqualsWithConversion(aTable->tag)) { aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated); return PR_TRUE; } @@ -1725,7 +1722,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, PRInt32 v = aValue.GetIntValue(); while (nsnull != aTable->tag) { if (aTable->value == v) { - aResult.Append(aTable->tag); + aResult.AppendWithConversion(aTable->tag); if (aFoldCase) { aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0); } @@ -1804,14 +1801,14 @@ nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue, aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.Append(aValue.GetPixelValue(), 10); + aResult.AppendInt(aValue.GetPixelValue(), 10); return PR_TRUE; case eHTMLUnit_Percent: - aResult.Append(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.Append('%'); + aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); + aResult.AppendWithConversion('%'); return PR_TRUE; default: break; @@ -1826,18 +1823,18 @@ nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aV aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.Append(aValue.GetPixelValue(), 10); + aResult.AppendInt(aValue.GetPixelValue(), 10); return PR_TRUE; case eHTMLUnit_Percent: - aResult.Append(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.Append('%'); + aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); + aResult.AppendWithConversion('%'); return PR_TRUE; case eHTMLUnit_Proportional: - aResult.Append(aValue.GetIntValue(), 10); - aResult.Append('*'); + aResult.AppendInt(aValue.GetIntValue(), 10); + aResult.AppendWithConversion('*'); return PR_TRUE; default: break; @@ -1928,8 +1925,7 @@ nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue, char buf[10]; PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x", NS_GET_R(v), NS_GET_G(v), NS_GET_B(v)); - aResult.Truncate(0); - aResult.Append(buf); + aResult.AssignWithConversion(buf); return PR_TRUE; } if ((aValue.GetUnit() == eHTMLUnit_ColorName) || diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index e542786be0b..b7e0797fd97 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -395,8 +395,8 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.SetString(protocol); - aProtocol.Append(":"); + aProtocol.AssignWithConversion(protocol); + aProtocol.AppendWithConversion(":"); nsCRT::free(protocol); } NS_RELEASE(url); @@ -420,13 +420,13 @@ nsHTMLAnchorElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.SetString(host); + aHost.AssignWithConversion(host); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.Append(":"); - aHost.Append(port, 10); + aHost.AppendWithConversion(":"); + aHost.AppendInt(port, 10); } } NS_RELEASE(url); @@ -450,7 +450,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.SetString(host); + aHostname.AssignWithConversion(host); nsCRT::free(host); } NS_RELEASE(url); @@ -491,7 +491,7 @@ nsHTMLAnchorElement::GetPathname(nsString& aPathname) return result; } - aPathname.SetString(file); + aPathname.AssignWithConversion(file); nsCRT::free(file); return result; @@ -516,8 +516,8 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.SetString("?"); - aSearch.Append(search); + aSearch.AssignWithConversion("?"); + aSearch.AppendWithConversion(search); nsCRT::free(search); } else { @@ -545,7 +545,7 @@ nsHTMLAnchorElement::GetPort(nsString& aPort) PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.Append(port, 10); + aPort.AppendInt(port, 10); } NS_RELEASE(url); } @@ -574,8 +574,8 @@ nsHTMLAnchorElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.SetString("#"); - aHash.Append(ref); + aHash.AssignWithConversion("#"); + aHash.AppendWithConversion(ref); nsCRT::free(ref); } else { diff --git a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp index f7b94ebd322..b60fef57032 100644 --- a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp @@ -277,8 +277,8 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.SetString(protocol); - aProtocol.Append(":"); + aProtocol.AssignWithConversion(protocol); + aProtocol.AppendWithConversion(":"); nsCRT::free(protocol); } NS_RELEASE(url); @@ -302,13 +302,13 @@ nsHTMLAreaElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.SetString(host); + aHost.AssignWithConversion(host); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.Append(":"); - aHost.Append(port, 10); + aHost.AppendWithConversion(":"); + aHost.AppendInt(port, 10); } } NS_RELEASE(url); @@ -332,7 +332,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.SetString(host); + aHostname.AssignWithConversion(host); nsCRT::free(host); } NS_RELEASE(url); @@ -356,7 +356,7 @@ nsHTMLAreaElement::GetPathname(nsString& aPathname) char* file; result = url->GetPath(&file); if (result == NS_OK) { - aPathname.SetString(file); + aPathname.AssignWithConversion(file); nsCRT::free(file); } NS_IF_RELEASE(url); @@ -385,8 +385,8 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.SetString("?"); - aSearch.Append(search); + aSearch.AssignWithConversion("?"); + aSearch.AppendWithConversion(search); nsCRT::free(search); } else { @@ -414,7 +414,7 @@ nsHTMLAreaElement::GetPort(nsString& aPort) PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.Append(port, 10); + aPort.AppendInt(port, 10); } NS_RELEASE(url); } @@ -443,8 +443,8 @@ nsHTMLAreaElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.SetString("#"); - aHash.Append(ref); + aHash.AssignWithConversion("#"); + aHash.AppendWithConversion(ref); nsCRT::free(ref); } else { diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index 333f2bc9a8a..050ad9e77b9 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -245,13 +245,13 @@ nsHTMLButtonElement::SetDisabled(PRBool aValue) nsHTMLValue empty(eHTMLUnit_Empty); if (aValue) { nsresult status = mInner.SetHTMLAttribute(nsHTMLAtoms::disabled, empty, PR_TRUE); - mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "DISABLED", PR_TRUE); + mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, NS_ConvertASCIItoUCS2("DISABLED"), PR_TRUE); return status; } else { mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::disabled, PR_TRUE); - mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "", PR_TRUE); + mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, nsAutoString(), PR_TRUE); return NS_OK; } } diff --git a/mozilla/content/html/content/src/nsHTMLFontElement.cpp b/mozilla/content/html/content/src/nsHTMLFontElement.cpp index 403fd9d8cd1..7e43af33329 100644 --- a/mozilla/content/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFontElement.cpp @@ -173,15 +173,15 @@ nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, (aAttribute == nsHTMLAtoms::fontWeight)) { aResult.Truncate(); if (aValue.GetUnit() == eHTMLUnit_Enumerated) { - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); return NS_CONTENT_ATTR_HAS_VALUE; } else if (aValue.GetUnit() == eHTMLUnit_Integer) { PRInt32 value = aValue.GetIntValue(); if (value >= 0) { - aResult.Append('+'); + aResult.AppendWithConversion('+'); } - aResult.Append(value, 10); + aResult.AppendInt(value, 10); return NS_CONTENT_ATTR_HAS_VALUE; } return NS_CONTENT_ATTR_NOT_THERE; diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index f6c025c4799..f9dae516296 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -589,7 +589,7 @@ HTMLContentSink::ReduceEntities(nsString& aString) } *cp = '\0'; PRInt32 ch; - nsAutoString str(cbuf); + nsAutoString str; str.AssignWithConversion(cbuf); dtd->ConvertEntityToUnicode(str, &ch); if (ch < 0) { @@ -983,7 +983,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode, // XXX why is textarea not a container? nsAutoString content; if (eHTMLTag_textarea == aNodeType) { - content = aNode.GetSkippedContent(); + content.Assign(aNode.GetSkippedContent()); } rv = MakeContentObject(aNodeType, atom, aForm, aWebShell, aResult, &content); @@ -1679,7 +1679,7 @@ SinkContext::AddLeaf(const nsIParserNode& aNode) else { // Map carriage returns to newlines if (tmp.CharAt(0) == '\r') { - tmp = "\n"; + tmp.AssignWithConversion("\n"); } rv = AddText(tmp); } @@ -2295,7 +2295,7 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel) } if (nsnull == mTitle) { - mHTMLDocument->SetTitle(""); + mHTMLDocument->SetTitle(nsAutoString()); } // XXX this is silly; who cares? RickG cares. It's part of the regression test. So don't bug me. @@ -2765,7 +2765,7 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode) mCurrentContext->IsCurrentContainer(eHTMLTag_tr) || mCurrentContext->IsCurrentContainer(eHTMLTag_col) || mCurrentContext->IsCurrentContainer(eHTMLTag_colgroup)) { - nsAutoString tmp("form"); + nsAutoString tmp; tmp.AssignWithConversion("form"); nsIAtom* atom = NS_NewAtom(tmp); result = NS_NewHTMLFormElement(&content, atom); if (NS_SUCCEEDED(result) && content) { @@ -3053,7 +3053,7 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) */ docTypeStr.Mid(name, 0, publicStart); - if (name.Equals("DOCTYPE", PR_TRUE, 7)) + if (name.EqualsWithConversion("DOCTYPE", PR_TRUE, 7)) name.Cut(0, 7); name.CompressWhitespace(); @@ -3099,9 +3099,9 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) /* * No 'PUBLIC' found, we assume we got a '' */ - name = docTypeStr; + name.Assign(docTypeStr); - if (name.Equals("DOCTYPE", PR_TRUE, 7)) + if (name.EqualsWithConversion("DOCTYPE", PR_TRUE, 7)) name.Cut(0, 7); name.CompressWhitespace(); @@ -3142,10 +3142,10 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) } if (!name.Length()) { - name.SetString("HTML"); + name.AssignWithConversion("HTML"); } - rv = domImpl->CreateDocumentType(name, publicId, nsAutoString(""), + rv = domImpl->CreateDocumentType(name, publicId, nsAutoString(), getter_AddRefs(docType)); if (NS_FAILED(rv) || !docType) { @@ -3242,7 +3242,8 @@ HTMLContentSink::StartLayout() NS_RELEASE(url); } if (rv == NS_OK) { - mRef = new nsString(ref); + mRef = new nsString; + mRef->AssignWithConversion(ref); nsCRT::free(ref); } @@ -3438,7 +3439,7 @@ HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode) if(parent!=nsnull) { // Create content object - nsAutoString tag("BASE"); + nsAutoString tag; tag.AssignWithConversion("BASE"); nsCOMPtr element; result = NS_CreateHTMLElement(getter_AddRefs(element), tag); if (NS_SUCCEEDED(result)) { @@ -3693,9 +3694,9 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement, ParseLinkTypes(aRel, linkTypes); PRBool isAlternate = PR_FALSE; - if (-1 != linkTypes.IndexOf("stylesheet")) { // is it a stylesheet link? + if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("stylesheet"))) { // is it a stylesheet link? - if (-1 != linkTypes.IndexOf("alternate")) { // if alternate, does it have title? + if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("alternate"))) { // if alternate, does it have title? if (0 == aTitle.Length()) { // alternates must have title return NS_OK; //return without error, for now } else { @@ -3719,7 +3720,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement, if (0 == mimeType.Length()) { nsString extension; aHref.Right(extension, 4); - if (extension.Equals(".css")) { + if (extension.EqualsWithConversion(".css")) { isStyleSheet = PR_TRUE; // strict mode + no mime type + '.css' extension } } @@ -3740,7 +3741,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement, return NS_OK; // The URL is bad, move along, don't propogate the error (for now) } - if (-1 == linkTypes.IndexOf("alternate")) { + if (-1 == linkTypes.IndexOf(NS_ConvertASCIItoUCS2("alternate"))) { if (0 < aTitle.Length()) { // possibly preferred sheet if (0 == mPreferredStyle.Length()) { mPreferredStyle = aTitle; @@ -3790,7 +3791,7 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode) if(parent!=nsnull) { // Create content object - nsAutoString tag("LINK"); + nsAutoString tag; tag.AssignWithConversion("LINK"); nsIHTMLContent* element = nsnull; result = NS_CreateHTMLElement(&element, tag); if (NS_SUCCEEDED(result)) { @@ -3905,7 +3906,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (nsnull != parent) { // Create content object - nsAutoString tmp("meta"); + nsAutoString tmp; tmp.AssignWithConversion("meta"); nsIAtom* atom = NS_NewAtom(tmp); if (nsnull == atom) { return NS_ERROR_OUT_OF_MEMORY; @@ -3942,7 +3943,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (NS_FAILED(rv)) return rv; // see if we have a refresh "header". - if (!header.Compare("refresh", PR_TRUE)) { + if (!header.CompareWithConversion("refresh", PR_TRUE)) { // Refresh headers are parsed with the following format in mind // // By the time we are here, the following is true: @@ -4062,7 +4063,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) } } } // END refresh - else if (!header.Compare("set-cookie", PR_TRUE)) { + else if (!header.CompareWithConversion("set-cookie", PR_TRUE)) { nsCOMPtr cookieServ = do_GetService(NS_COOKIESERVICE_PROGID, &rv); if (NS_FAILED(rv)) return rv; @@ -4363,7 +4364,7 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_SUCCEEDED(rv)) { - nsAutoString contentType(contenttypeheader); + nsAutoString contentType; contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) ); PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ; if(kNotFound != start) @@ -4388,7 +4389,7 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_FAILED(rv) || (characterSet.Length() == 0)) { //charset from script charset tag - characterSet = mScriptCharset; + characterSet.Assign(mScriptCharset); } if (NS_FAILED(rv) || (characterSet.Length() == 0) ) { @@ -4533,7 +4534,7 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) return NS_ERROR_FAILURE; } nsIHTMLContent* parent = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent; - nsAutoString tag("SCRIPT"); + nsAutoString tag; tag.AssignWithConversion("SCRIPT"); nsIHTMLContent* element = nsnull; rv = NS_CreateHTMLElement(&element, tag); if (NS_SUCCEEDED(rv)) { @@ -4565,7 +4566,7 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) // Create a text node holding the content // First, get the text content of the script tag nsAutoString script; - script = aNode.GetSkippedContent(); + script.Assign(aNode.GetSkippedContent()); if (script.Length() > 0) { nsIContent* text; @@ -4662,7 +4663,7 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode) if(parent!=nsnull) { // Create content object - nsAutoString tag("STYLE"); + nsAutoString tag; tag.AssignWithConversion("STYLE"); nsIHTMLContent* element = nsnull; rv = NS_CreateHTMLElement(&element, tag); if (NS_SUCCEEDED(rv)) { diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index a3b1921c95f..462f312e722 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -362,7 +362,7 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) NS_IMETHODIMP nsHTMLDocument::GetContentType(nsString& aContentType) const { - aContentType.Assign("text/html"); + aContentType.AssignWithConversion("text/html"); return NS_OK; } @@ -395,8 +395,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, PRBool needsParser=PR_TRUE; if (aCommand) { - nsAutoString command(aCommand); - nsAutoString delayedView("view delayedContentLoad"); + nsAutoString command; command.AssignWithConversion(aCommand); + nsAutoString delayedView; delayedView.AssignWithConversion("view delayedContentLoad"); if (command.Equals(delayedView)) { needsParser = PR_FALSE; } @@ -408,7 +408,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, aDocListener); if (NS_FAILED(rv)) { return rv; } - nsAutoString charset = "ISO-8859-1"; // fallback value in case webShell return error + nsAutoString charset; charset.AssignWithConversion("ISO-8859-1"); // fallback value in case webShell return error nsCharsetSource charsetSource = kCharsetFromWeakDocTypeDefault; nsCOMPtr aURL; @@ -427,7 +427,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, NS_RELEASE(lastModKey); if (NS_SUCCEEDED(rv)) { - lastModified.Assign(lastModHeader); + lastModified.AssignWithConversion( NS_STATIC_CAST(const char*, lastModHeader) ); SetLastModified(lastModified); } @@ -441,7 +441,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, NS_RELEASE(referrerKey); if (NS_SUCCEEDED(rv)) { - referrer.Assign(referrerHeader); + referrer.AssignWithConversion( NS_STATIC_CAST(const char*, referrerHeader) ); SetReferrer(referrer); } @@ -453,7 +453,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, NS_RELEASE(contentTypeKey); if (NS_SUCCEEDED(rv)) { nsAutoString contentType; - contentType.Assign(contenttypeheader); + contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) ); PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ; if(kNotFound != start) { @@ -517,7 +517,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, "%c", #endif &prtime); - lastModified.Assign(buf); + lastModified.AssignWithConversion(buf); SetLastModified(lastModified); } @@ -1061,7 +1061,7 @@ nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) // switch alternate style sheets based on default nsAutoString type; nsAutoString title; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); PRInt32 index; PRInt32 count = mStyleSheets.Count(); for (index = 0; index < count; index++) { @@ -1473,7 +1473,7 @@ nsHTMLDocument::GetDomain(nsString& aDomain) char *hostName; if (NS_FAILED(uri->GetHost(&hostName))) return NS_ERROR_FAILURE; - aDomain.Assign(hostName); + aDomain.AssignWithConversion(hostName); nsCRT::free(hostName); return NS_OK; @@ -1512,10 +1512,10 @@ nsHTMLDocument::SetDomain(const nsString& aDomain) nsXPIDLCString path; if (NS_FAILED(uri->GetPath(getter_Copies(path)))) return NS_ERROR_FAILURE; - nsAutoString newURIString = (const char *)scheme; - newURIString += "://"; + nsAutoString newURIString; newURIString.AssignWithConversion( NS_STATIC_CAST(const char*, scheme) ); + newURIString.AppendWithConversion("://"); newURIString += aDomain; - newURIString += path; + newURIString.AppendWithConversion(path); nsIURI *newURI; if (NS_FAILED(NS_NewURI(&newURI, newURIString))) return NS_ERROR_FAILURE; @@ -1543,7 +1543,7 @@ nsHTMLDocument::GetURL(nsString& aURL) if (nsnull != mDocumentURL) { char* str; mDocumentURL->GetSpec(&str); - aURL = str; + aURL.AssignWithConversion(str); nsCRT::free(str); } return NS_OK; @@ -1568,7 +1568,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody) return result; } - nsAutoString bodyStr("BODY"); + nsAutoString bodyStr; bodyStr.AssignWithConversion("BODY"); nsIDOMNode * child; root->GetFirstChild(&child); @@ -1880,10 +1880,10 @@ nsHTMLDocument::Close() nsresult result = NS_OK; if ((nsnull != mParser) && mIsWriting) { - nsAutoString emptyStr(""); + nsAutoString emptyStr; emptyStr.AssignWithConversion(""); mWriteLevel++; result = mParser->Parse(emptyStr, NS_GENERATE_PARSER_KEY(), - "text/html", PR_FALSE, PR_TRUE); + NS_ConvertASCIItoUCS2("text/html"), PR_FALSE, PR_TRUE); mWriteLevel--; mIsWriting = 0; } @@ -1907,12 +1907,12 @@ nsHTMLDocument::WriteCommon(const nsString& aText, nsAutoString str(aText); if (aNewlineTerminate) { - str.Append('\n'); + str.AppendWithConversion('\n'); } mWriteLevel++; result = mParser->Parse(str, NS_GENERATE_PARSER_KEY(), - "text/html", PR_FALSE, + NS_ConvertASCIItoUCS2("text/html"), PR_FALSE, (!mIsWriting || (mWriteLevel > 1))); mWriteLevel--; if (NS_OK != result) { @@ -2001,12 +2001,12 @@ nsHTMLDocument::ScriptWriteCommon(JSContext *cx, } if (aNewlineTerminate) { - str.Append('\n'); + str.AppendWithConversion('\n'); } mWriteLevel++; result = mParser->Parse(str, NS_GENERATE_PARSER_KEY(), - "text/html", PR_FALSE, + NS_ConvertASCIItoUCS2("text/html"), PR_FALSE, (!mIsWriting || (mWriteLevel > 1))); mWriteLevel--; if (NS_OK != result) { @@ -2377,7 +2377,7 @@ nsHTMLDocument::GetLastModified(nsString& aLastModified) aLastModified = *mLastModified; } else { - aLastModified.Assign("January 1, 1970 GMT"); + aLastModified.AssignWithConversion("January 1, 1970 GMT"); } return NS_OK; @@ -2635,10 +2635,10 @@ nsHTMLDocument::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, return NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR; char *str = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); - nsAutoString name(str); + nsAutoString name; name.AssignWithConversion(str); - if (!name.Equals("write") && !name.Equals("writeln") && - !name.Equals("close") && !name.Equals("open")) { + if (!name.EqualsWithConversion("write") && !name.EqualsWithConversion("writeln") && + !name.EqualsWithConversion("close") && !name.EqualsWithConversion("open")) { // XXX If we have a parser, it means that we're still loading the // document. Since there's still content coming in (and not all // may yet have been explicitly added to the document), we do @@ -2877,7 +2877,7 @@ void BlockText::AddSubText(nsIDOMNode * aNode, nsString & aStr, PRInt32 aDirecti mSubTexts[i]->mOffset += aStr.Length(); } mNumSubTexts++; - mText.Insert(aStr, 0, aStr.Length()); + mText.Insert(aStr, 0); mSubTexts[0] = subTxt; } } @@ -3690,7 +3690,7 @@ nsHTMLDocument::GetBodyContent() return PR_FALSE; } - nsAutoString bodyStr("BODY"); + nsAutoString bodyStr; bodyStr.AssignWithConversion("BODY"); nsIDOMNode * child; root->GetFirstChild(&child); diff --git a/mozilla/content/html/document/src/nsImageDocument.cpp b/mozilla/content/html/document/src/nsImageDocument.cpp index 4c8e7a6a7ea..fb92c9d5532 100644 --- a/mozilla/content/html/document/src/nsImageDocument.cpp +++ b/mozilla/content/html/document/src/nsImageDocument.cpp @@ -276,7 +276,7 @@ nsImageDocument::CreateSyntheticDocument() char* src; mDocumentURL->GetSpec(&src); - nsHTMLValue val(src); + nsHTMLValue val( NS_ConvertASCIItoUCS2(src) ); delete[] src; image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE); image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE); @@ -352,7 +352,7 @@ nsresult nsImageDocument::UpdateTitle( void ) char *pExtension=nsnull; pURL->GetFileExtension(&pExtension); if(pExtension){ - nsString strExt(pExtension); + nsString strExt; strExt.AssignWithConversion(pExtension); strExt.ToUpperCase(); titleStr.Append(strExt); nsCRT::free(pExtension); @@ -361,17 +361,17 @@ nsresult nsImageDocument::UpdateTitle( void ) NS_IF_RELEASE(pURL); } // append the image information... - titleStr.Append( " Image" ); + titleStr.AppendWithConversion( " Image" ); if (mImageRequest) { PRUint32 width, height; mImageRequest->GetNaturalDimensions(&width, &height); // if we got a valid size (sometimes we do not) then display it if (width != 0 && height != 0){ - titleStr.Append( " " ); - titleStr.Append((PRInt32)width); - titleStr.Append("x"); - titleStr.Append((PRInt32)height); - titleStr.Append(" pixels"); + titleStr.AppendWithConversion( " " ); + titleStr.AppendInt((PRInt32)width); + titleStr.AppendWithConversion("x"); + titleStr.AppendInt((PRInt32)height); + titleStr.AppendWithConversion(" pixels"); } } // set it on the document diff --git a/mozilla/content/html/document/src/nsMarkupDocument.cpp b/mozilla/content/html/document/src/nsMarkupDocument.cpp index db624ddab19..ddab3f9bd99 100644 --- a/mozilla/content/html/document/src/nsMarkupDocument.cpp +++ b/mozilla/content/html/document/src/nsMarkupDocument.cpp @@ -124,7 +124,7 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec decl.Truncate(); list.Mid(decl, start, semiColon - start); - if (0 == decl.Compare("/*", PR_FALSE, 2)) { + if (0 == decl.CompareWithConversion("/*", PR_FALSE, 2)) { // XXX need to append comment } else { diff --git a/mozilla/content/html/style/src/nsCSSDeclaration.cpp b/mozilla/content/html/style/src/nsCSSDeclaration.cpp index fa1f365a977..a1dfb4c7884 100644 --- a/mozilla/content/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/content/html/style/src/nsCSSDeclaration.cpp @@ -284,8 +284,8 @@ void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const nsAutoString buffer; if (eCSSProperty_UNKNOWN < aPropID) { - buffer.Append(nsCSSProps::GetStringValue(aPropID)); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); + buffer.AppendWithConversion(": "); } mTop.AppendToString(buffer); @@ -302,23 +302,23 @@ void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) co nsAutoString buffer; if (eCSSUnit_Null != mTop.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[0])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0])); + buffer.AppendWithConversion(": "); mTop.AppendToString(buffer); } if (eCSSUnit_Null != mRight.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[1])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1])); + buffer.AppendWithConversion(": "); mRight.AppendToString(buffer); } if (eCSSUnit_Null != mBottom.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[2])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2])); + buffer.AppendWithConversion(": "); mBottom.AppendToString(buffer); } if (eCSSUnit_Null != mLeft.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[3])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3])); + buffer.AppendWithConversion(": "); mLeft.AppendToString(buffer); } @@ -3179,10 +3179,10 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.Append("url("); break; - case eCSSUnit_Attr: aResult.Append("attr("); break; - case eCSSUnit_Counter: aResult.Append("counter("); break; - case eCSSUnit_Counters: aResult.Append("counters("); break; + case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; + case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; + case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; + case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; default: break; } nsAutoString buffer; @@ -3197,15 +3197,15 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns // get a string mapping the name nsCString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.Append(str); + aResult.AppendWithConversion(str); } else { - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } break; default: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } else if (eCSSUnit_Enumerated == unit) { @@ -3217,119 +3217,119 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); intValue &= ~mask; if (0 != intValue) { // more left - aResult.Append(' '); + aResult.AppendWithConversion(' '); } } } } else { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.Append(' '); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.AppendWithConversion(' '); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); } } else { - const nsString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.Append(name); + const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); + aResult.AppendWithConversion(name); } } else if (eCSSUnit_Color == unit){ nscolor color = aValue.GetColorValue(); - aResult.Append("rgb("); - aResult.Append(NS_GET_R(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_G(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_B(color), 10); - aResult.Append(')'); + aResult.AppendWithConversion("rgb("); + aResult.AppendInt(NS_GET_R(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_G(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_B(color), 10); + aResult.AppendWithConversion(')'); } else if (eCSSUnit_Percent == unit) { - aResult.Append(aValue.GetPercentValue() * 100.0f); + aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.Append(aValue.GetFloatValue()); + aResult.AppendFloat(aValue.GetFloatValue()); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.Append("auto"); break; - case eCSSUnit_Inherit: aResult.Append("inherit"); break; - case eCSSUnit_None: aResult.Append("none"); break; - case eCSSUnit_Normal: aResult.Append("normal"); break; + case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; + case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; + case eCSSUnit_None: aResult.AppendWithConversion("none"); break; + case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.Append(')'); break; + case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.Append("%"); break; + case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.Append("in"); break; - case eCSSUnit_Foot: aResult.Append("ft"); break; - case eCSSUnit_Mile: aResult.Append("mi"); break; - case eCSSUnit_Millimeter: aResult.Append("mm"); break; - case eCSSUnit_Centimeter: aResult.Append("cm"); break; - case eCSSUnit_Meter: aResult.Append("m"); break; - case eCSSUnit_Kilometer: aResult.Append("km"); break; - case eCSSUnit_Point: aResult.Append("pt"); break; - case eCSSUnit_Pica: aResult.Append("pc"); break; - case eCSSUnit_Didot: aResult.Append("dt"); break; - case eCSSUnit_Cicero: aResult.Append("cc"); break; + case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; + case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; + case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; + case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; + case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; + case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; + case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; + case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; + case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; + case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; + case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aResult.Append("em"); break; - case eCSSUnit_EN: aResult.Append("en"); break; - case eCSSUnit_XHeight: aResult.Append("ex"); break; - case eCSSUnit_CapHeight: aResult.Append("cap"); break; - case eCSSUnit_Char: aResult.Append("ch"); break; + case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; + case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; + case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; + case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; + case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aResult.Append("px"); break; + case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aResult.Append("deg"); break; - case eCSSUnit_Grad: aResult.Append("grad"); break; - case eCSSUnit_Radian: aResult.Append("rad"); break; + case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; + case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; + case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aResult.Append("Hz"); break; - case eCSSUnit_Kilohertz: aResult.Append("kHz"); break; + case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; + case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aResult.Append("s"); break; - case eCSSUnit_Milliseconds: aResult.Append("ms"); break; + case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; + case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; } return PR_TRUE; @@ -3358,41 +3358,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.Append("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(' '); + aValue.AppendWithConversion("rect("); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.Append(")"); + aValue.AppendWithConversion(")"); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -3403,55 +3403,55 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.Append('/'); + aValue.AppendWithConversion('/'); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_pause_before, aValue); } break; @@ -3467,13 +3467,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); shadow = shadow->mNext; } } @@ -3485,67 +3485,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -3556,7 +3556,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != content); } @@ -3567,13 +3567,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3584,13 +3584,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3599,7 +3599,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -3609,11 +3609,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != quotes); } @@ -3625,7 +3625,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != keyEquiv); } @@ -3689,21 +3689,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.Append(nsCSSProps::GetStringValue(property)); - aString.Append(": "); + aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aString.AppendWithConversion(": "); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.Append("; "); + aString.AppendWithConversion("; "); } } else { // is comment - aString.Append("/* "); + aString.AppendWithConversion("/* "); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.Append(" */ "); + aString.AppendWithConversion(" */ "); } } } @@ -3858,7 +3858,7 @@ CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.Append(nsCSSProps::GetStringValue(property)); + aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); } } diff --git a/mozilla/content/html/style/src/nsCSSParser.cpp b/mozilla/content/html/style/src/nsCSSParser.cpp index bb71eb02940..7134b5ed7be 100644 --- a/mozilla/content/html/style/src/nsCSSParser.cpp +++ b/mozilla/content/html/style/src/nsCSSParser.cpp @@ -770,7 +770,7 @@ PRBool CSSParserImpl::GatherMedia(PRInt32& aErrorCode, nsString& aMedia, else if (eCSSToken_Ident == mToken.mType) { if (expectIdent) { if (! first) { - aMedia.Append(','); + aMedia.AppendWithConversion(','); } mToken.mIdent.ToLowerCase(); // case insensitive from CSS - must be lower cased if (aMediaAtoms) { @@ -1570,7 +1570,7 @@ PRBool CSSParserImpl::ParseSelector(PRInt32& aErrorCode, } mToken.AppendToString(aSource); buffer.Truncate(); - buffer.Append(':'); + buffer.AppendWithConversion(':'); buffer.Append(mToken.mIdent); buffer.ToLowerCase(); nsIAtom* pseudo = NS_NewAtom(buffer); @@ -1887,7 +1887,7 @@ PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue) case eCSSToken_Number: if (tk->mIntegerValid) { sprintf(buffer, "%06d", tk->mInteger); - str.Assign(buffer); + str.AssignWithConversion(buffer); } break; @@ -1895,7 +1895,7 @@ PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue) if (tk->mIdent.Length() <= 6) { sprintf(buffer, "%06.0f", tk->mNumber); nsAutoString temp; - temp.Assign(buffer); + temp.AssignWithConversion(buffer); temp.Right(str, 6 - tk->mIdent.Length()); str.Append(tk->mIdent); } @@ -2390,7 +2390,7 @@ PRBool CSSParserImpl::ParseCounter(PRInt32& aErrorCode, nsCSSValue& aValue) return PR_FALSE; } if (GetToken(aErrorCode, PR_TRUE) && (eCSSToken_String == mToken.mType)) { - counter.Append(','); + counter.AppendWithConversion(','); counter.Append(mToken.mSymbol); // quote too counter.Append(mToken.mIdent); counter.Append(mToken.mSymbol); // quote too @@ -2406,7 +2406,7 @@ PRBool CSSParserImpl::ParseCounter(PRInt32& aErrorCode, nsCSSValue& aValue) nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(mToken.mIdent); if ((eCSSKeyword_UNKNOWN < keyword) && (0 < SearchKeywordTable(keyword, nsCSSProps::kListStyleKTable))) { - counter.Append(','); + counter.AppendWithConversion(','); counter.Append(mToken.mIdent); } else { @@ -2456,8 +2456,8 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue) if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it return PR_FALSE; } - attr.Append(nameSpaceID, 10); - attr.Append('|'); + attr.AppendInt(nameSpaceID, 10); + attr.AppendWithConversion('|'); if (! GetToken(aErrorCode, PR_FALSE)) { return PR_FALSE; } @@ -2475,8 +2475,8 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue) } else if (mToken.IsSymbol('*')) { // namespace wildcard if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { - attr.Append(kNameSpaceID_Unknown, 10); - attr.Append('|'); + attr.AppendInt(kNameSpaceID_Unknown, 10); + attr.AppendWithConversion('|'); if (! GetToken(aErrorCode, PR_FALSE)) { return PR_FALSE; } diff --git a/mozilla/content/html/style/src/nsCSSScanner.cpp b/mozilla/content/html/style/src/nsCSSScanner.cpp index 1363c686ee4..12199bf88ea 100644 --- a/mozilla/content/html/style/src/nsCSSScanner.cpp +++ b/mozilla/content/html/style/src/nsCSSScanner.cpp @@ -100,27 +100,27 @@ nsCSSToken::AppendToString(nsString& aBuffer) break; case eCSSToken_Number: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } break; case eCSSToken_Percentage: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } - aBuffer.Append(PRUnichar('%')); + aBuffer.Append(PRUnichar('%')); // STRING USE WARNING: technically, this should be |AppendWithConversion| break; case eCSSToken_Dimension: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } aBuffer.Append(mIdent); break; @@ -420,12 +420,12 @@ PRBool nsCSSScanner::Next(PRInt32& aErrorCode, nsCSSToken& aToken) aToken.mType = eCSSToken_HTMLComment; aToken.mIdent.SetLength(0); while (0 < dashCount--) { - aToken.mIdent.Append('-'); + aToken.mIdent.AppendWithConversion('-'); } if (white) { - aToken.mIdent.Append(' '); + aToken.mIdent.AppendWithConversion(' '); } - aToken.mIdent.Append('>'); + aToken.mIdent.AppendWithConversion('>'); return PR_TRUE; } else { // wasn't an end comment, push it all back @@ -751,8 +751,8 @@ PRBool nsCSSScanner::ParseCComment(PRInt32& aErrorCode, nsCSSToken& aToken) if (ch < 0) break; if (ch == '*') { if (LookAhead(aErrorCode, '/')) { - ident.Append(PRUnichar(ch)); - ident.Append('/'); + ident.Append(PRUnichar(ch)); // STRING USE WARNING: technically, this should be |AppendWithConversion| + ident.AppendWithConversion('/'); break; } } diff --git a/mozilla/content/html/style/src/nsCSSStruct.cpp b/mozilla/content/html/style/src/nsCSSStruct.cpp index fa1f365a977..a1dfb4c7884 100644 --- a/mozilla/content/html/style/src/nsCSSStruct.cpp +++ b/mozilla/content/html/style/src/nsCSSStruct.cpp @@ -284,8 +284,8 @@ void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const nsAutoString buffer; if (eCSSProperty_UNKNOWN < aPropID) { - buffer.Append(nsCSSProps::GetStringValue(aPropID)); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); + buffer.AppendWithConversion(": "); } mTop.AppendToString(buffer); @@ -302,23 +302,23 @@ void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) co nsAutoString buffer; if (eCSSUnit_Null != mTop.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[0])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0])); + buffer.AppendWithConversion(": "); mTop.AppendToString(buffer); } if (eCSSUnit_Null != mRight.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[1])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1])); + buffer.AppendWithConversion(": "); mRight.AppendToString(buffer); } if (eCSSUnit_Null != mBottom.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[2])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2])); + buffer.AppendWithConversion(": "); mBottom.AppendToString(buffer); } if (eCSSUnit_Null != mLeft.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[3])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3])); + buffer.AppendWithConversion(": "); mLeft.AppendToString(buffer); } @@ -3179,10 +3179,10 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.Append("url("); break; - case eCSSUnit_Attr: aResult.Append("attr("); break; - case eCSSUnit_Counter: aResult.Append("counter("); break; - case eCSSUnit_Counters: aResult.Append("counters("); break; + case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; + case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; + case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; + case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; default: break; } nsAutoString buffer; @@ -3197,15 +3197,15 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns // get a string mapping the name nsCString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.Append(str); + aResult.AppendWithConversion(str); } else { - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } break; default: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } else if (eCSSUnit_Enumerated == unit) { @@ -3217,119 +3217,119 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); intValue &= ~mask; if (0 != intValue) { // more left - aResult.Append(' '); + aResult.AppendWithConversion(' '); } } } } else { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.Append(' '); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.AppendWithConversion(' '); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); } } else { - const nsString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.Append(name); + const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); + aResult.AppendWithConversion(name); } } else if (eCSSUnit_Color == unit){ nscolor color = aValue.GetColorValue(); - aResult.Append("rgb("); - aResult.Append(NS_GET_R(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_G(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_B(color), 10); - aResult.Append(')'); + aResult.AppendWithConversion("rgb("); + aResult.AppendInt(NS_GET_R(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_G(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_B(color), 10); + aResult.AppendWithConversion(')'); } else if (eCSSUnit_Percent == unit) { - aResult.Append(aValue.GetPercentValue() * 100.0f); + aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.Append(aValue.GetFloatValue()); + aResult.AppendFloat(aValue.GetFloatValue()); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.Append("auto"); break; - case eCSSUnit_Inherit: aResult.Append("inherit"); break; - case eCSSUnit_None: aResult.Append("none"); break; - case eCSSUnit_Normal: aResult.Append("normal"); break; + case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; + case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; + case eCSSUnit_None: aResult.AppendWithConversion("none"); break; + case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.Append(')'); break; + case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.Append("%"); break; + case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.Append("in"); break; - case eCSSUnit_Foot: aResult.Append("ft"); break; - case eCSSUnit_Mile: aResult.Append("mi"); break; - case eCSSUnit_Millimeter: aResult.Append("mm"); break; - case eCSSUnit_Centimeter: aResult.Append("cm"); break; - case eCSSUnit_Meter: aResult.Append("m"); break; - case eCSSUnit_Kilometer: aResult.Append("km"); break; - case eCSSUnit_Point: aResult.Append("pt"); break; - case eCSSUnit_Pica: aResult.Append("pc"); break; - case eCSSUnit_Didot: aResult.Append("dt"); break; - case eCSSUnit_Cicero: aResult.Append("cc"); break; + case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; + case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; + case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; + case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; + case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; + case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; + case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; + case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; + case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; + case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; + case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aResult.Append("em"); break; - case eCSSUnit_EN: aResult.Append("en"); break; - case eCSSUnit_XHeight: aResult.Append("ex"); break; - case eCSSUnit_CapHeight: aResult.Append("cap"); break; - case eCSSUnit_Char: aResult.Append("ch"); break; + case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; + case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; + case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; + case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; + case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aResult.Append("px"); break; + case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aResult.Append("deg"); break; - case eCSSUnit_Grad: aResult.Append("grad"); break; - case eCSSUnit_Radian: aResult.Append("rad"); break; + case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; + case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; + case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aResult.Append("Hz"); break; - case eCSSUnit_Kilohertz: aResult.Append("kHz"); break; + case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; + case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aResult.Append("s"); break; - case eCSSUnit_Milliseconds: aResult.Append("ms"); break; + case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; + case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; } return PR_TRUE; @@ -3358,41 +3358,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.Append("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(' '); + aValue.AppendWithConversion("rect("); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.Append(")"); + aValue.AppendWithConversion(")"); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -3403,55 +3403,55 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.Append('/'); + aValue.AppendWithConversion('/'); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_pause_before, aValue); } break; @@ -3467,13 +3467,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); shadow = shadow->mNext; } } @@ -3485,67 +3485,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -3556,7 +3556,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != content); } @@ -3567,13 +3567,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3584,13 +3584,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3599,7 +3599,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -3609,11 +3609,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != quotes); } @@ -3625,7 +3625,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != keyEquiv); } @@ -3689,21 +3689,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.Append(nsCSSProps::GetStringValue(property)); - aString.Append(": "); + aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aString.AppendWithConversion(": "); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.Append("; "); + aString.AppendWithConversion("; "); } } else { // is comment - aString.Append("/* "); + aString.AppendWithConversion("/* "); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.Append(" */ "); + aString.AppendWithConversion(" */ "); } } } @@ -3858,7 +3858,7 @@ CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.Append(nsCSSProps::GetStringValue(property)); + aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); } } diff --git a/mozilla/content/html/style/src/nsCSSStyleRule.cpp b/mozilla/content/html/style/src/nsCSSStyleRule.cpp index c143e993f26..d6e4d6a0fa4 100644 --- a/mozilla/content/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleRule.cpp @@ -3015,9 +3015,9 @@ static void ListNameSpace(FILE* out, nsINameSpaceManager*& aManager, PRInt32 aNa aManager->GetNameSpaceURI(aNameSpaceID, buffer); } else { - buffer = "{namespace ID: "; - buffer.Append(aNameSpaceID, 10); - buffer.Append("}"); + buffer.AssignWithConversion("{namespace ID: "); + buffer.AppendInt(aNameSpaceID, 10); + buffer.AppendWithConversion("}"); } fputs(buffer, out); fputs("|", out); @@ -3032,7 +3032,7 @@ static void ListSelector(FILE* out, const nsCSSSelector* aSelector) if (0 != aSelector->mOperator) { buffer.Truncate(); buffer.Append(aSelector->mOperator); - buffer.Append(" "); + buffer.AppendWithConversion(" "); fputs(buffer, out); } ListNameSpace(out, nameSpaceMgr, aSelector->mNameSpace); @@ -3097,9 +3097,9 @@ CSSStyleRuleImpl::List(FILE* out, PRInt32 aIndent) const nsAutoString buffer; - buffer.Append("weight: "); - buffer.Append(mWeight, 10); - buffer.Append(" "); + buffer.AppendWithConversion("weight: "); + buffer.AppendInt(mWeight, 10); + buffer.AppendWithConversion(" "); fputs(buffer, out); if (nsnull != mDeclaration) { mDeclaration->List(out); diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index 989da4b65ee..464cf03d786 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -1430,8 +1430,7 @@ CSSStyleSheetImpl::SetTitle(const nsString& aTitle) NS_IMETHODIMP CSSStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/css"); + aType.AssignWithConversion("text/css"); return NS_OK; } @@ -2025,8 +2024,7 @@ CSSStyleSheetImpl::SetModified(PRBool aModified) NS_IMETHODIMP CSSStyleSheetImpl::GetType(nsString& aType) { - aType.Truncate(); - aType.Append("text/css"); + aType.AssignWithConversion("text/css"); return NS_OK; } @@ -2084,7 +2082,7 @@ CSSStyleSheetImpl::GetHref(nsString& aHref) if (mInner && mInner->mURL) { char* str = nsnull; mInner->mURL->GetSpec(&str); - aHref = str; + aHref.AssignWithConversion(str); if (str) { nsCRT::free(str); } @@ -2119,7 +2117,7 @@ CSSStyleSheetImpl::GetMedia(nsString& aMedia) medium->ToString(buffer); aMedia.Append(buffer); if (index < count) { - aMedia.Append(", "); + aMedia.AppendWithConversion(", "); } } } diff --git a/mozilla/content/html/style/src/nsHTMLAttributes.cpp b/mozilla/content/html/style/src/nsHTMLAttributes.cpp index fa2321da0ae..9cc04451b47 100644 --- a/mozilla/content/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/content/html/style/src/nsHTMLAttributes.cpp @@ -146,13 +146,12 @@ struct HTMLAttribute { if (nsnull != mAttribute) { mAttribute->ToString(aBuffer); if (eHTMLUnit_Null != mValue.GetUnit()) { - aBuffer.Append(" = "); + aBuffer.AppendWithConversion(" = "); mValue.AppendToString(aBuffer); } } else { - aBuffer.Truncate(); - aBuffer.Append("null"); + aBuffer.AssignWithConversion("null"); } } diff --git a/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp index c635932d139..c3debf647ef 100644 --- a/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp @@ -628,16 +628,14 @@ HTMLCSSStyleSheetImpl::GetURL(nsIURI*& aURL) const NS_IMETHODIMP HTMLCSSStyleSheetImpl::GetTitle(nsString& aTitle) const { - aTitle.Truncate(); - aTitle.Append("Internal HTML/CSS Style Sheet"); + aTitle.AssignWithConversion("Internal HTML/CSS Style Sheet"); return NS_OK; } NS_IMETHODIMP HTMLCSSStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/html"); + aType.AssignWithConversion("text/html"); return NS_OK; } diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp index 8d2532dbfdc..d2a0b87974b 100644 --- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp @@ -1010,8 +1010,7 @@ HTMLStyleSheetImpl::GetTitle(nsString& aTitle) const NS_IMETHODIMP HTMLStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/html"); + aType.AssignWithConversion("text/html"); return NS_OK; } diff --git a/mozilla/content/html/style/src/nsHTMLValue.cpp b/mozilla/content/html/style/src/nsHTMLValue.cpp index 5b1e8d7aadd..a86f70b9253 100644 --- a/mozilla/content/html/style/src/nsHTMLValue.cpp +++ b/mozilla/content/html/style/src/nsHTMLValue.cpp @@ -266,37 +266,37 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); aBuffer.Append(*(mValue.mString)); - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); } else { - aBuffer.Append("null str"); + aBuffer.AppendWithConversion("null str"); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.Append("0x"); - aBuffer.Append((PRInt32)mValue.mISupports, 16); + aBuffer.AppendWithConversion("0x"); + aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.Append("(0x"); - aBuffer.Append(NS_GET_R(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_G(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_B(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_A(mValue.mColor), 16); - aBuffer.Append(')'); + aBuffer.AppendWithConversion("(0x"); + aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); + aBuffer.AppendWithConversion(')'); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.Append(mValue.mFloat * 100.0f); + aBuffer.AppendFloat(mValue.mFloat * 100.0f); } else { - aBuffer.Append(mValue.mInt, 10); - aBuffer.Append("[0x"); - aBuffer.Append(mValue.mInt, 16); - aBuffer.Append(']'); + aBuffer.AppendInt(mValue.mInt, 10); + aBuffer.AppendWithConversion("[0x"); + aBuffer.AppendInt(mValue.mInt, 16); + aBuffer.AppendWithConversion(']'); } switch (mUnit) { @@ -304,15 +304,15 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.Append("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.Append("enum"); break; - case eHTMLUnit_Proportional: aBuffer.Append("*"); break; - case eHTMLUnit_Color: aBuffer.Append("rbga"); break; - case eHTMLUnit_Percent: aBuffer.Append("%"); break; - case eHTMLUnit_Pixel: aBuffer.Append("px"); break; + case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; + case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; + case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; + case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; + case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; } - aBuffer.Append(' '); + aBuffer.AppendWithConversion(' '); } void nsHTMLValue::ToString(nsString& aBuffer) const diff --git a/mozilla/content/shared/src/nsHTMLValue.cpp b/mozilla/content/shared/src/nsHTMLValue.cpp index 5b1e8d7aadd..a86f70b9253 100644 --- a/mozilla/content/shared/src/nsHTMLValue.cpp +++ b/mozilla/content/shared/src/nsHTMLValue.cpp @@ -266,37 +266,37 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); aBuffer.Append(*(mValue.mString)); - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); } else { - aBuffer.Append("null str"); + aBuffer.AppendWithConversion("null str"); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.Append("0x"); - aBuffer.Append((PRInt32)mValue.mISupports, 16); + aBuffer.AppendWithConversion("0x"); + aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.Append("(0x"); - aBuffer.Append(NS_GET_R(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_G(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_B(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_A(mValue.mColor), 16); - aBuffer.Append(')'); + aBuffer.AppendWithConversion("(0x"); + aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); + aBuffer.AppendWithConversion(')'); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.Append(mValue.mFloat * 100.0f); + aBuffer.AppendFloat(mValue.mFloat * 100.0f); } else { - aBuffer.Append(mValue.mInt, 10); - aBuffer.Append("[0x"); - aBuffer.Append(mValue.mInt, 16); - aBuffer.Append(']'); + aBuffer.AppendInt(mValue.mInt, 10); + aBuffer.AppendWithConversion("[0x"); + aBuffer.AppendInt(mValue.mInt, 16); + aBuffer.AppendWithConversion(']'); } switch (mUnit) { @@ -304,15 +304,15 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.Append("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.Append("enum"); break; - case eHTMLUnit_Proportional: aBuffer.Append("*"); break; - case eHTMLUnit_Color: aBuffer.Append("rbga"); break; - case eHTMLUnit_Percent: aBuffer.Append("%"); break; - case eHTMLUnit_Pixel: aBuffer.Append("px"); break; + case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; + case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; + case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; + case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; + case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; } - aBuffer.Append(' '); + aBuffer.AppendWithConversion(' '); } void nsHTMLValue::ToString(nsString& aBuffer) const diff --git a/mozilla/layout/base/src/nsStyleContext.cpp b/mozilla/layout/base/src/nsStyleContext.cpp index d1e974f4c78..1f04a34d318 100644 --- a/mozilla/layout/base/src/nsStyleContext.cpp +++ b/mozilla/layout/base/src/nsStyleContext.cpp @@ -1526,7 +1526,7 @@ void StyleUserInterfaceImpl::ResetFrom(const nsStyleUserInterface* aParent, nsIP mUserSelect = NS_STYLE_USER_SELECT_AUTO; mKeyEquivalent = PRUnichar(0); // XXX what type should this be? mResizer = NS_STYLE_RESIZER_AUTO; - mBehavior = ""; + mBehavior.SetLength(0); } void StyleUserInterfaceImpl::SetFrom(const nsStyleUserInterface& aSource) diff --git a/mozilla/layout/base/src/nsStyleCoord.cpp b/mozilla/layout/base/src/nsStyleCoord.cpp index 65d7dcd5ab8..7d5263e5ab5 100644 --- a/mozilla/layout/base/src/nsStyleCoord.cpp +++ b/mozilla/layout/base/src/nsStyleCoord.cpp @@ -183,15 +183,15 @@ void nsStyleCoord::SetUnionValue(const nsStyleUnion& aValue, nsStyleUnit aUnit) void nsStyleCoord::AppendToString(nsString& aBuffer) const { if ((eStyleUnit_Percent <= mUnit) && (mUnit < eStyleUnit_Coord)) { - aBuffer.Append(mValue.mFloat); + aBuffer.AppendFloat(mValue.mFloat); } else if ((eStyleUnit_Coord == mUnit) || (eStyleUnit_Proportional == mUnit) || (eStyleUnit_Enumerated == mUnit) || (eStyleUnit_Integer == mUnit)) { - aBuffer.AppendWithConversion(mValue.mInt, 10); + aBuffer.AppendInt(mValue.mInt, 10); aBuffer.AppendWithConversion("[0x"); - aBuffer.AppendWithConversion(mValue.mInt, 16); + aBuffer.AppendInt(mValue.mInt, 16); aBuffer.AppendWithConversion(']'); } @@ -208,7 +208,7 @@ void nsStyleCoord::AppendToString(nsString& aBuffer) const case eStyleUnit_Integer: aBuffer.AppendWithConversion("int"); break; case eStyleUnit_Chars: aBuffer.AppendWithConversion("chars"); break; } - aBuffer.Append(' '); + aBuffer.AppendWithConversion(' '); } void nsStyleCoord::ToString(nsString& aBuffer) const diff --git a/mozilla/layout/events/src/nsEventStateManager.cpp b/mozilla/layout/events/src/nsEventStateManager.cpp index 6b64d7c9e37..eee45f695d3 100644 --- a/mozilla/layout/events/src/nsEventStateManager.cpp +++ b/mozilla/layout/events/src/nsEventStateManager.cpp @@ -1764,7 +1764,7 @@ nsEventStateManager::GetNextTabbableContent(nsIContent* aRootContent, nsIFrame* child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, value); nsAutoString tabStr; child->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::tabindex, tabStr); - if (tabStr != "") { + if (!tabStr.IsEmpty()) { PRInt32 errorCode; tabIndex = tabStr.ToInteger(&errorCode); } diff --git a/mozilla/layout/generic/nsImageMap.cpp b/mozilla/layout/generic/nsImageMap.cpp index 422041a4da8..83e2fbe07c6 100644 --- a/mozilla/layout/generic/nsImageMap.cpp +++ b/mozilla/layout/generic/nsImageMap.cpp @@ -335,7 +335,7 @@ void Area::ToHTML(nsString& aResult) if (nsnull != mCoords) { PRInt32 i, n = mNumCoords; for (i = 0; i < n; i++) { - aResult.AppendWithConversion(mCoords[i], 10); + aResult.AppendInt(mCoords[i], 10); if (i < n - 1) { aResult.AppendWithConversion(','); } @@ -390,9 +390,9 @@ void Area::BeginConvertToXIF(nsXIFConverter& aConverter) const if (nsnull != mCoords) { PRInt32 i, n = mNumCoords; for (i = 0; i < n; i++) { - coords.AppendWithConversion(mCoords[i], 10); + coords.AppendInt(mCoords[i], 10); if (i < n - 1) { - coords.Append(','); + coords.AppendWithConversion(','); } } } diff --git a/mozilla/layout/html/base/src/nsImageMap.cpp b/mozilla/layout/html/base/src/nsImageMap.cpp index 422041a4da8..83e2fbe07c6 100644 --- a/mozilla/layout/html/base/src/nsImageMap.cpp +++ b/mozilla/layout/html/base/src/nsImageMap.cpp @@ -335,7 +335,7 @@ void Area::ToHTML(nsString& aResult) if (nsnull != mCoords) { PRInt32 i, n = mNumCoords; for (i = 0; i < n; i++) { - aResult.AppendWithConversion(mCoords[i], 10); + aResult.AppendInt(mCoords[i], 10); if (i < n - 1) { aResult.AppendWithConversion(','); } @@ -390,9 +390,9 @@ void Area::BeginConvertToXIF(nsXIFConverter& aConverter) const if (nsnull != mCoords) { PRInt32 i, n = mNumCoords; for (i = 0; i < n; i++) { - coords.AppendWithConversion(mCoords[i], 10); + coords.AppendInt(mCoords[i], 10); if (i < n - 1) { - coords.Append(','); + coords.AppendWithConversion(','); } } } diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index 145495640f6..bb338503914 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -1274,26 +1274,25 @@ nsGenericHTMLElement::GetAttribute(PRInt32 aNameSpaceID, nsIAtom *aAttribute, case eHTMLUnit_Integer: aResult.Truncate(); - aResult.Append(value->GetIntValue(), 10); + aResult.AppendInt(value->GetIntValue(), 10); break; case eHTMLUnit_Pixel: aResult.Truncate(); - aResult.Append(value->GetPixelValue(), 10); + aResult.AppendInt(value->GetPixelValue(), 10); break; case eHTMLUnit_Percent: aResult.Truncate(); - aResult.Append(PRInt32(value->GetPercentValue() * 100.0f), 10); - aResult.Append('%'); + aResult.AppendInt(PRInt32(value->GetPercentValue() * 100.0f), 10); + aResult.AppendWithConversion('%'); break; case eHTMLUnit_Color: color = nscolor(value->GetColorValue()); PR_snprintf(cbuf, sizeof(cbuf), "#%02x%02x%02x", NS_GET_R(color), NS_GET_G(color), NS_GET_B(color)); - aResult.Truncate(); - aResult.Append(cbuf); + aResult.AssignWithConversion(cbuf); break; default: @@ -1492,7 +1491,7 @@ nsGenericHTMLElement::ListAttributes(FILE* out) const // value nsAutoString value; GetAttribute(nameSpaceID, attr, value); - buffer.Append("="); + buffer.AppendWithConversion("="); buffer.Append(value); fputs(" ", out); @@ -1580,41 +1579,39 @@ void NS_QuoteForHTML(const nsString& aValue, nsString& aResult); void NS_QuoteForHTML(const nsString& aValue, nsString& aResult) { - aResult.Truncate(); const PRUnichar* cp = aValue.GetUnicode(); const PRUnichar* end = aValue.GetUnicode() + aValue.Length(); - aResult.Append('"'); + aResult.AssignWithConversion('"'); while (cp < end) { PRUnichar ch = *cp++; if ((ch >= 0x20) && (ch <= 0x7f)) { if (ch == '\"') { - aResult.Append("""); + aResult.AppendWithConversion("""); } else { aResult.Append(ch); } } else { - aResult.Append("&#"); - aResult.Append((PRInt32) ch, 10); - aResult.Append(';'); + aResult.AppendWithConversion("&#"); + aResult.AppendInt((PRInt32) ch, 10); + aResult.AppendWithConversion(';'); } } - aResult.Append('"'); + aResult.AppendWithConversion('"'); } nsresult nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const { - aBuf.Truncate(0); - aBuf.Append('<'); + aBuf.AssignWithConversion('<'); if (nsnull != mTag) { nsAutoString tmp; mTag->ToString(tmp); aBuf.Append(tmp); } else { - aBuf.Append("?NULL"); + aBuf.AppendWithConversion("?NULL"); } if (nsnull != mAttributes) { @@ -1625,20 +1622,20 @@ nsGenericHTMLElement::ToHTMLString(nsString& aBuf) const nsIAtom* atom = nsnull; mAttributes->GetAttributeNameAt(index, atom); atom->ToString(name); - aBuf.Append(' '); + aBuf.AppendWithConversion(' '); aBuf.Append(name); value.Truncate(); GetAttribute(kNameSpaceID_None, atom, value); NS_RELEASE(atom); if (value.Length() > 0) { - aBuf.Append('='); + aBuf.AppendWithConversion('='); NS_QuoteForHTML(value, quotedValue); aBuf.Append(quotedValue); } } } - aBuf.Append('>'); + aBuf.AppendWithConversion('>'); return NS_OK; } @@ -1664,7 +1661,7 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, NS_RELEASE(cssRule); } else { - aResult = "Unknown rule type"; + aResult.AssignWithConversion("Unknown rule type"); } NS_RELEASE(rule); } @@ -1705,7 +1702,7 @@ nsGenericHTMLElement::ParseCaseSensitiveEnumValue(const nsString& aValue, nsHTMLValue& aResult) { while (nsnull != aTable->tag) { - if (aValue.Equals(aTable->tag)) { + if (aValue.EqualsWithConversion(aTable->tag)) { aResult.SetIntValue(aTable->value, eHTMLUnit_Enumerated); return PR_TRUE; } @@ -1725,7 +1722,7 @@ nsGenericHTMLElement::EnumValueToString(const nsHTMLValue& aValue, PRInt32 v = aValue.GetIntValue(); while (nsnull != aTable->tag) { if (aTable->value == v) { - aResult.Append(aTable->tag); + aResult.AppendWithConversion(aTable->tag); if (aFoldCase) { aResult.SetCharAt(nsCRT::ToUpper(aResult[0]), 0); } @@ -1804,14 +1801,14 @@ nsGenericHTMLElement::ValueOrPercentToString(const nsHTMLValue& aValue, aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.Append(aValue.GetPixelValue(), 10); + aResult.AppendInt(aValue.GetPixelValue(), 10); return PR_TRUE; case eHTMLUnit_Percent: - aResult.Append(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.Append('%'); + aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); + aResult.AppendWithConversion('%'); return PR_TRUE; default: break; @@ -1826,18 +1823,18 @@ nsGenericHTMLElement::ValueOrPercentOrProportionalToString(const nsHTMLValue& aV aResult.Truncate(0); switch (aValue.GetUnit()) { case eHTMLUnit_Integer: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); return PR_TRUE; case eHTMLUnit_Pixel: - aResult.Append(aValue.GetPixelValue(), 10); + aResult.AppendInt(aValue.GetPixelValue(), 10); return PR_TRUE; case eHTMLUnit_Percent: - aResult.Append(PRInt32(aValue.GetPercentValue() * 100.0f), 10); - aResult.Append('%'); + aResult.AppendInt(PRInt32(aValue.GetPercentValue() * 100.0f), 10); + aResult.AppendWithConversion('%'); return PR_TRUE; case eHTMLUnit_Proportional: - aResult.Append(aValue.GetIntValue(), 10); - aResult.Append('*'); + aResult.AppendInt(aValue.GetIntValue(), 10); + aResult.AppendWithConversion('*'); return PR_TRUE; default: break; @@ -1928,8 +1925,7 @@ nsGenericHTMLElement::ColorToString(const nsHTMLValue& aValue, char buf[10]; PR_snprintf(buf, sizeof(buf), "#%02x%02x%02x", NS_GET_R(v), NS_GET_G(v), NS_GET_B(v)); - aResult.Truncate(0); - aResult.Append(buf); + aResult.AssignWithConversion(buf); return PR_TRUE; } if ((aValue.GetUnit() == eHTMLUnit_ColorName) || diff --git a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp index e542786be0b..b7e0797fd97 100644 --- a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp @@ -395,8 +395,8 @@ nsHTMLAnchorElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.SetString(protocol); - aProtocol.Append(":"); + aProtocol.AssignWithConversion(protocol); + aProtocol.AppendWithConversion(":"); nsCRT::free(protocol); } NS_RELEASE(url); @@ -420,13 +420,13 @@ nsHTMLAnchorElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.SetString(host); + aHost.AssignWithConversion(host); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.Append(":"); - aHost.Append(port, 10); + aHost.AppendWithConversion(":"); + aHost.AppendInt(port, 10); } } NS_RELEASE(url); @@ -450,7 +450,7 @@ nsHTMLAnchorElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.SetString(host); + aHostname.AssignWithConversion(host); nsCRT::free(host); } NS_RELEASE(url); @@ -491,7 +491,7 @@ nsHTMLAnchorElement::GetPathname(nsString& aPathname) return result; } - aPathname.SetString(file); + aPathname.AssignWithConversion(file); nsCRT::free(file); return result; @@ -516,8 +516,8 @@ nsHTMLAnchorElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.SetString("?"); - aSearch.Append(search); + aSearch.AssignWithConversion("?"); + aSearch.AppendWithConversion(search); nsCRT::free(search); } else { @@ -545,7 +545,7 @@ nsHTMLAnchorElement::GetPort(nsString& aPort) PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.Append(port, 10); + aPort.AppendInt(port, 10); } NS_RELEASE(url); } @@ -574,8 +574,8 @@ nsHTMLAnchorElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.SetString("#"); - aHash.Append(ref); + aHash.AssignWithConversion("#"); + aHash.AppendWithConversion(ref); nsCRT::free(ref); } else { diff --git a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp index f7b94ebd322..b60fef57032 100644 --- a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp @@ -277,8 +277,8 @@ nsHTMLAreaElement::GetProtocol(nsString& aProtocol) char* protocol; result = url->GetScheme(&protocol); if (result == NS_OK) { - aProtocol.SetString(protocol); - aProtocol.Append(":"); + aProtocol.AssignWithConversion(protocol); + aProtocol.AppendWithConversion(":"); nsCRT::free(protocol); } NS_RELEASE(url); @@ -302,13 +302,13 @@ nsHTMLAreaElement::GetHost(nsString& aHost) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHost.SetString(host); + aHost.AssignWithConversion(host); nsCRT::free(host); PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aHost.Append(":"); - aHost.Append(port, 10); + aHost.AppendWithConversion(":"); + aHost.AppendInt(port, 10); } } NS_RELEASE(url); @@ -332,7 +332,7 @@ nsHTMLAreaElement::GetHostname(nsString& aHostname) char* host; result = url->GetHost(&host); if (result == NS_OK) { - aHostname.SetString(host); + aHostname.AssignWithConversion(host); nsCRT::free(host); } NS_RELEASE(url); @@ -356,7 +356,7 @@ nsHTMLAreaElement::GetPathname(nsString& aPathname) char* file; result = url->GetPath(&file); if (result == NS_OK) { - aPathname.SetString(file); + aPathname.AssignWithConversion(file); nsCRT::free(file); } NS_IF_RELEASE(url); @@ -385,8 +385,8 @@ nsHTMLAreaElement::GetSearch(nsString& aSearch) NS_RELEASE(url); } if (result == NS_OK && (nsnull != search) && ('\0' != *search)) { - aSearch.SetString("?"); - aSearch.Append(search); + aSearch.AssignWithConversion("?"); + aSearch.AppendWithConversion(search); nsCRT::free(search); } else { @@ -414,7 +414,7 @@ nsHTMLAreaElement::GetPort(nsString& aPort) PRInt32 port; (void)url->GetPort(&port); if (-1 != port) { - aPort.Append(port, 10); + aPort.AppendInt(port, 10); } NS_RELEASE(url); } @@ -443,8 +443,8 @@ nsHTMLAreaElement::GetHash(nsString& aHash) NS_RELEASE(url); } if (result == NS_OK && (nsnull != ref) && ('\0' != *ref)) { - aHash.SetString("#"); - aHash.Append(ref); + aHash.AssignWithConversion("#"); + aHash.AppendWithConversion(ref); nsCRT::free(ref); } else { diff --git a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp index 333f2bc9a8a..050ad9e77b9 100644 --- a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp @@ -245,13 +245,13 @@ nsHTMLButtonElement::SetDisabled(PRBool aValue) nsHTMLValue empty(eHTMLUnit_Empty); if (aValue) { nsresult status = mInner.SetHTMLAttribute(nsHTMLAtoms::disabled, empty, PR_TRUE); - mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "DISABLED", PR_TRUE); + mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, NS_ConvertASCIItoUCS2("DISABLED"), PR_TRUE); return status; } else { mInner.UnsetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::disabled, PR_TRUE); - mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, "", PR_TRUE); + mInner.SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::kClass, nsAutoString(), PR_TRUE); return NS_OK; } } diff --git a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp index 403fd9d8cd1..7e43af33329 100644 --- a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp @@ -173,15 +173,15 @@ nsHTMLFontElement::AttributeToString(nsIAtom* aAttribute, (aAttribute == nsHTMLAtoms::fontWeight)) { aResult.Truncate(); if (aValue.GetUnit() == eHTMLUnit_Enumerated) { - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); return NS_CONTENT_ATTR_HAS_VALUE; } else if (aValue.GetUnit() == eHTMLUnit_Integer) { PRInt32 value = aValue.GetIntValue(); if (value >= 0) { - aResult.Append('+'); + aResult.AppendWithConversion('+'); } - aResult.Append(value, 10); + aResult.AppendInt(value, 10); return NS_CONTENT_ATTR_HAS_VALUE; } return NS_CONTENT_ATTR_NOT_THERE; diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index f6c025c4799..f9dae516296 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -589,7 +589,7 @@ HTMLContentSink::ReduceEntities(nsString& aString) } *cp = '\0'; PRInt32 ch; - nsAutoString str(cbuf); + nsAutoString str; str.AssignWithConversion(cbuf); dtd->ConvertEntityToUnicode(str, &ch); if (ch < 0) { @@ -983,7 +983,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode, // XXX why is textarea not a container? nsAutoString content; if (eHTMLTag_textarea == aNodeType) { - content = aNode.GetSkippedContent(); + content.Assign(aNode.GetSkippedContent()); } rv = MakeContentObject(aNodeType, atom, aForm, aWebShell, aResult, &content); @@ -1679,7 +1679,7 @@ SinkContext::AddLeaf(const nsIParserNode& aNode) else { // Map carriage returns to newlines if (tmp.CharAt(0) == '\r') { - tmp = "\n"; + tmp.AssignWithConversion("\n"); } rv = AddText(tmp); } @@ -2295,7 +2295,7 @@ HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel) } if (nsnull == mTitle) { - mHTMLDocument->SetTitle(""); + mHTMLDocument->SetTitle(nsAutoString()); } // XXX this is silly; who cares? RickG cares. It's part of the regression test. So don't bug me. @@ -2765,7 +2765,7 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode) mCurrentContext->IsCurrentContainer(eHTMLTag_tr) || mCurrentContext->IsCurrentContainer(eHTMLTag_col) || mCurrentContext->IsCurrentContainer(eHTMLTag_colgroup)) { - nsAutoString tmp("form"); + nsAutoString tmp; tmp.AssignWithConversion("form"); nsIAtom* atom = NS_NewAtom(tmp); result = NS_NewHTMLFormElement(&content, atom); if (NS_SUCCEEDED(result) && content) { @@ -3053,7 +3053,7 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) */ docTypeStr.Mid(name, 0, publicStart); - if (name.Equals("DOCTYPE", PR_TRUE, 7)) + if (name.EqualsWithConversion("DOCTYPE", PR_TRUE, 7)) name.Cut(0, 7); name.CompressWhitespace(); @@ -3099,9 +3099,9 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) /* * No 'PUBLIC' found, we assume we got a '' */ - name = docTypeStr; + name.Assign(docTypeStr); - if (name.Equals("DOCTYPE", PR_TRUE, 7)) + if (name.EqualsWithConversion("DOCTYPE", PR_TRUE, 7)) name.Cut(0, 7); name.CompressWhitespace(); @@ -3142,10 +3142,10 @@ HTMLContentSink::AddDocTypeDecl(const nsIParserNode& aNode, PRInt32 aMode) } if (!name.Length()) { - name.SetString("HTML"); + name.AssignWithConversion("HTML"); } - rv = domImpl->CreateDocumentType(name, publicId, nsAutoString(""), + rv = domImpl->CreateDocumentType(name, publicId, nsAutoString(), getter_AddRefs(docType)); if (NS_FAILED(rv) || !docType) { @@ -3242,7 +3242,8 @@ HTMLContentSink::StartLayout() NS_RELEASE(url); } if (rv == NS_OK) { - mRef = new nsString(ref); + mRef = new nsString; + mRef->AssignWithConversion(ref); nsCRT::free(ref); } @@ -3438,7 +3439,7 @@ HTMLContentSink::ProcessBASETag(const nsIParserNode& aNode) if(parent!=nsnull) { // Create content object - nsAutoString tag("BASE"); + nsAutoString tag; tag.AssignWithConversion("BASE"); nsCOMPtr element; result = NS_CreateHTMLElement(getter_AddRefs(element), tag); if (NS_SUCCEEDED(result)) { @@ -3693,9 +3694,9 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement, ParseLinkTypes(aRel, linkTypes); PRBool isAlternate = PR_FALSE; - if (-1 != linkTypes.IndexOf("stylesheet")) { // is it a stylesheet link? + if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("stylesheet"))) { // is it a stylesheet link? - if (-1 != linkTypes.IndexOf("alternate")) { // if alternate, does it have title? + if (-1 != linkTypes.IndexOf(NS_ConvertASCIItoUCS2("alternate"))) { // if alternate, does it have title? if (0 == aTitle.Length()) { // alternates must have title return NS_OK; //return without error, for now } else { @@ -3719,7 +3720,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement, if (0 == mimeType.Length()) { nsString extension; aHref.Right(extension, 4); - if (extension.Equals(".css")) { + if (extension.EqualsWithConversion(".css")) { isStyleSheet = PR_TRUE; // strict mode + no mime type + '.css' extension } } @@ -3740,7 +3741,7 @@ HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement, return NS_OK; // The URL is bad, move along, don't propogate the error (for now) } - if (-1 == linkTypes.IndexOf("alternate")) { + if (-1 == linkTypes.IndexOf(NS_ConvertASCIItoUCS2("alternate"))) { if (0 < aTitle.Length()) { // possibly preferred sheet if (0 == mPreferredStyle.Length()) { mPreferredStyle = aTitle; @@ -3790,7 +3791,7 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode) if(parent!=nsnull) { // Create content object - nsAutoString tag("LINK"); + nsAutoString tag; tag.AssignWithConversion("LINK"); nsIHTMLContent* element = nsnull; result = NS_CreateHTMLElement(&element, tag); if (NS_SUCCEEDED(result)) { @@ -3905,7 +3906,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (nsnull != parent) { // Create content object - nsAutoString tmp("meta"); + nsAutoString tmp; tmp.AssignWithConversion("meta"); nsIAtom* atom = NS_NewAtom(tmp); if (nsnull == atom) { return NS_ERROR_OUT_OF_MEMORY; @@ -3942,7 +3943,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) if (NS_FAILED(rv)) return rv; // see if we have a refresh "header". - if (!header.Compare("refresh", PR_TRUE)) { + if (!header.CompareWithConversion("refresh", PR_TRUE)) { // Refresh headers are parsed with the following format in mind // // By the time we are here, the following is true: @@ -4062,7 +4063,7 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode) } } } // END refresh - else if (!header.Compare("set-cookie", PR_TRUE)) { + else if (!header.CompareWithConversion("set-cookie", PR_TRUE)) { nsCOMPtr cookieServ = do_GetService(NS_COOKIESERVICE_PROGID, &rv); if (NS_FAILED(rv)) return rv; @@ -4363,7 +4364,7 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_SUCCEEDED(rv)) { - nsAutoString contentType(contenttypeheader); + nsAutoString contentType; contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) ); PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ; if(kNotFound != start) @@ -4388,7 +4389,7 @@ HTMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_FAILED(rv) || (characterSet.Length() == 0)) { //charset from script charset tag - characterSet = mScriptCharset; + characterSet.Assign(mScriptCharset); } if (NS_FAILED(rv) || (characterSet.Length() == 0) ) { @@ -4533,7 +4534,7 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) return NS_ERROR_FAILURE; } nsIHTMLContent* parent = mCurrentContext->mStack[mCurrentContext->mStackPos-1].mContent; - nsAutoString tag("SCRIPT"); + nsAutoString tag; tag.AssignWithConversion("SCRIPT"); nsIHTMLContent* element = nsnull; rv = NS_CreateHTMLElement(&element, tag); if (NS_SUCCEEDED(rv)) { @@ -4565,7 +4566,7 @@ HTMLContentSink::ProcessSCRIPTTag(const nsIParserNode& aNode) // Create a text node holding the content // First, get the text content of the script tag nsAutoString script; - script = aNode.GetSkippedContent(); + script.Assign(aNode.GetSkippedContent()); if (script.Length() > 0) { nsIContent* text; @@ -4662,7 +4663,7 @@ HTMLContentSink::ProcessSTYLETag(const nsIParserNode& aNode) if(parent!=nsnull) { // Create content object - nsAutoString tag("STYLE"); + nsAutoString tag; tag.AssignWithConversion("STYLE"); nsIHTMLContent* element = nsnull; rv = NS_CreateHTMLElement(&element, tag); if (NS_SUCCEEDED(rv)) { diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index a3b1921c95f..462f312e722 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -362,7 +362,7 @@ nsHTMLDocument::Reset(nsIChannel* aChannel, nsILoadGroup* aLoadGroup) NS_IMETHODIMP nsHTMLDocument::GetContentType(nsString& aContentType) const { - aContentType.Assign("text/html"); + aContentType.AssignWithConversion("text/html"); return NS_OK; } @@ -395,8 +395,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, PRBool needsParser=PR_TRUE; if (aCommand) { - nsAutoString command(aCommand); - nsAutoString delayedView("view delayedContentLoad"); + nsAutoString command; command.AssignWithConversion(aCommand); + nsAutoString delayedView; delayedView.AssignWithConversion("view delayedContentLoad"); if (command.Equals(delayedView)) { needsParser = PR_FALSE; } @@ -408,7 +408,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, aDocListener); if (NS_FAILED(rv)) { return rv; } - nsAutoString charset = "ISO-8859-1"; // fallback value in case webShell return error + nsAutoString charset; charset.AssignWithConversion("ISO-8859-1"); // fallback value in case webShell return error nsCharsetSource charsetSource = kCharsetFromWeakDocTypeDefault; nsCOMPtr aURL; @@ -427,7 +427,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, NS_RELEASE(lastModKey); if (NS_SUCCEEDED(rv)) { - lastModified.Assign(lastModHeader); + lastModified.AssignWithConversion( NS_STATIC_CAST(const char*, lastModHeader) ); SetLastModified(lastModified); } @@ -441,7 +441,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, NS_RELEASE(referrerKey); if (NS_SUCCEEDED(rv)) { - referrer.Assign(referrerHeader); + referrer.AssignWithConversion( NS_STATIC_CAST(const char*, referrerHeader) ); SetReferrer(referrer); } @@ -453,7 +453,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, NS_RELEASE(contentTypeKey); if (NS_SUCCEEDED(rv)) { nsAutoString contentType; - contentType.Assign(contenttypeheader); + contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) ); PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ; if(kNotFound != start) { @@ -517,7 +517,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand, "%c", #endif &prtime); - lastModified.Assign(buf); + lastModified.AssignWithConversion(buf); SetLastModified(lastModified); } @@ -1061,7 +1061,7 @@ nsHTMLDocument::SetHeaderData(nsIAtom* aHeaderField, const nsString& aData) // switch alternate style sheets based on default nsAutoString type; nsAutoString title; - nsAutoString textHtml("text/html"); + nsAutoString textHtml; textHtml.AssignWithConversion("text/html"); PRInt32 index; PRInt32 count = mStyleSheets.Count(); for (index = 0; index < count; index++) { @@ -1473,7 +1473,7 @@ nsHTMLDocument::GetDomain(nsString& aDomain) char *hostName; if (NS_FAILED(uri->GetHost(&hostName))) return NS_ERROR_FAILURE; - aDomain.Assign(hostName); + aDomain.AssignWithConversion(hostName); nsCRT::free(hostName); return NS_OK; @@ -1512,10 +1512,10 @@ nsHTMLDocument::SetDomain(const nsString& aDomain) nsXPIDLCString path; if (NS_FAILED(uri->GetPath(getter_Copies(path)))) return NS_ERROR_FAILURE; - nsAutoString newURIString = (const char *)scheme; - newURIString += "://"; + nsAutoString newURIString; newURIString.AssignWithConversion( NS_STATIC_CAST(const char*, scheme) ); + newURIString.AppendWithConversion("://"); newURIString += aDomain; - newURIString += path; + newURIString.AppendWithConversion(path); nsIURI *newURI; if (NS_FAILED(NS_NewURI(&newURI, newURIString))) return NS_ERROR_FAILURE; @@ -1543,7 +1543,7 @@ nsHTMLDocument::GetURL(nsString& aURL) if (nsnull != mDocumentURL) { char* str; mDocumentURL->GetSpec(&str); - aURL = str; + aURL.AssignWithConversion(str); nsCRT::free(str); } return NS_OK; @@ -1568,7 +1568,7 @@ nsHTMLDocument::SetBody(nsIDOMHTMLElement* aBody) return result; } - nsAutoString bodyStr("BODY"); + nsAutoString bodyStr; bodyStr.AssignWithConversion("BODY"); nsIDOMNode * child; root->GetFirstChild(&child); @@ -1880,10 +1880,10 @@ nsHTMLDocument::Close() nsresult result = NS_OK; if ((nsnull != mParser) && mIsWriting) { - nsAutoString emptyStr(""); + nsAutoString emptyStr; emptyStr.AssignWithConversion(""); mWriteLevel++; result = mParser->Parse(emptyStr, NS_GENERATE_PARSER_KEY(), - "text/html", PR_FALSE, PR_TRUE); + NS_ConvertASCIItoUCS2("text/html"), PR_FALSE, PR_TRUE); mWriteLevel--; mIsWriting = 0; } @@ -1907,12 +1907,12 @@ nsHTMLDocument::WriteCommon(const nsString& aText, nsAutoString str(aText); if (aNewlineTerminate) { - str.Append('\n'); + str.AppendWithConversion('\n'); } mWriteLevel++; result = mParser->Parse(str, NS_GENERATE_PARSER_KEY(), - "text/html", PR_FALSE, + NS_ConvertASCIItoUCS2("text/html"), PR_FALSE, (!mIsWriting || (mWriteLevel > 1))); mWriteLevel--; if (NS_OK != result) { @@ -2001,12 +2001,12 @@ nsHTMLDocument::ScriptWriteCommon(JSContext *cx, } if (aNewlineTerminate) { - str.Append('\n'); + str.AppendWithConversion('\n'); } mWriteLevel++; result = mParser->Parse(str, NS_GENERATE_PARSER_KEY(), - "text/html", PR_FALSE, + NS_ConvertASCIItoUCS2("text/html"), PR_FALSE, (!mIsWriting || (mWriteLevel > 1))); mWriteLevel--; if (NS_OK != result) { @@ -2377,7 +2377,7 @@ nsHTMLDocument::GetLastModified(nsString& aLastModified) aLastModified = *mLastModified; } else { - aLastModified.Assign("January 1, 1970 GMT"); + aLastModified.AssignWithConversion("January 1, 1970 GMT"); } return NS_OK; @@ -2635,10 +2635,10 @@ nsHTMLDocument::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, return NS_ERROR_DOM_TOO_FEW_PARAMETERS_ERR; char *str = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); - nsAutoString name(str); + nsAutoString name; name.AssignWithConversion(str); - if (!name.Equals("write") && !name.Equals("writeln") && - !name.Equals("close") && !name.Equals("open")) { + if (!name.EqualsWithConversion("write") && !name.EqualsWithConversion("writeln") && + !name.EqualsWithConversion("close") && !name.EqualsWithConversion("open")) { // XXX If we have a parser, it means that we're still loading the // document. Since there's still content coming in (and not all // may yet have been explicitly added to the document), we do @@ -2877,7 +2877,7 @@ void BlockText::AddSubText(nsIDOMNode * aNode, nsString & aStr, PRInt32 aDirecti mSubTexts[i]->mOffset += aStr.Length(); } mNumSubTexts++; - mText.Insert(aStr, 0, aStr.Length()); + mText.Insert(aStr, 0); mSubTexts[0] = subTxt; } } @@ -3690,7 +3690,7 @@ nsHTMLDocument::GetBodyContent() return PR_FALSE; } - nsAutoString bodyStr("BODY"); + nsAutoString bodyStr; bodyStr.AssignWithConversion("BODY"); nsIDOMNode * child; root->GetFirstChild(&child); diff --git a/mozilla/layout/html/document/src/nsImageDocument.cpp b/mozilla/layout/html/document/src/nsImageDocument.cpp index 4c8e7a6a7ea..fb92c9d5532 100644 --- a/mozilla/layout/html/document/src/nsImageDocument.cpp +++ b/mozilla/layout/html/document/src/nsImageDocument.cpp @@ -276,7 +276,7 @@ nsImageDocument::CreateSyntheticDocument() char* src; mDocumentURL->GetSpec(&src); - nsHTMLValue val(src); + nsHTMLValue val( NS_ConvertASCIItoUCS2(src) ); delete[] src; image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE); image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE); @@ -352,7 +352,7 @@ nsresult nsImageDocument::UpdateTitle( void ) char *pExtension=nsnull; pURL->GetFileExtension(&pExtension); if(pExtension){ - nsString strExt(pExtension); + nsString strExt; strExt.AssignWithConversion(pExtension); strExt.ToUpperCase(); titleStr.Append(strExt); nsCRT::free(pExtension); @@ -361,17 +361,17 @@ nsresult nsImageDocument::UpdateTitle( void ) NS_IF_RELEASE(pURL); } // append the image information... - titleStr.Append( " Image" ); + titleStr.AppendWithConversion( " Image" ); if (mImageRequest) { PRUint32 width, height; mImageRequest->GetNaturalDimensions(&width, &height); // if we got a valid size (sometimes we do not) then display it if (width != 0 && height != 0){ - titleStr.Append( " " ); - titleStr.Append((PRInt32)width); - titleStr.Append("x"); - titleStr.Append((PRInt32)height); - titleStr.Append(" pixels"); + titleStr.AppendWithConversion( " " ); + titleStr.AppendInt((PRInt32)width); + titleStr.AppendWithConversion("x"); + titleStr.AppendInt((PRInt32)height); + titleStr.AppendWithConversion(" pixels"); } } // set it on the document diff --git a/mozilla/layout/html/document/src/nsMarkupDocument.cpp b/mozilla/layout/html/document/src/nsMarkupDocument.cpp index db624ddab19..ddab3f9bd99 100644 --- a/mozilla/layout/html/document/src/nsMarkupDocument.cpp +++ b/mozilla/layout/html/document/src/nsMarkupDocument.cpp @@ -124,7 +124,7 @@ void nsMarkupDocument::CSSDeclarationToXIF(nsXIFConverter& aConverter, nsICSSDec decl.Truncate(); list.Mid(decl, start, semiColon - start); - if (0 == decl.Compare("/*", PR_FALSE, 2)) { + if (0 == decl.CompareWithConversion("/*", PR_FALSE, 2)) { // XXX need to append comment } else { diff --git a/mozilla/layout/html/style/src/nsCSSDeclaration.cpp b/mozilla/layout/html/style/src/nsCSSDeclaration.cpp index fa1f365a977..a1dfb4c7884 100644 --- a/mozilla/layout/html/style/src/nsCSSDeclaration.cpp +++ b/mozilla/layout/html/style/src/nsCSSDeclaration.cpp @@ -284,8 +284,8 @@ void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const nsAutoString buffer; if (eCSSProperty_UNKNOWN < aPropID) { - buffer.Append(nsCSSProps::GetStringValue(aPropID)); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); + buffer.AppendWithConversion(": "); } mTop.AppendToString(buffer); @@ -302,23 +302,23 @@ void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) co nsAutoString buffer; if (eCSSUnit_Null != mTop.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[0])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0])); + buffer.AppendWithConversion(": "); mTop.AppendToString(buffer); } if (eCSSUnit_Null != mRight.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[1])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1])); + buffer.AppendWithConversion(": "); mRight.AppendToString(buffer); } if (eCSSUnit_Null != mBottom.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[2])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2])); + buffer.AppendWithConversion(": "); mBottom.AppendToString(buffer); } if (eCSSUnit_Null != mLeft.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[3])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3])); + buffer.AppendWithConversion(": "); mLeft.AppendToString(buffer); } @@ -3179,10 +3179,10 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.Append("url("); break; - case eCSSUnit_Attr: aResult.Append("attr("); break; - case eCSSUnit_Counter: aResult.Append("counter("); break; - case eCSSUnit_Counters: aResult.Append("counters("); break; + case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; + case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; + case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; + case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; default: break; } nsAutoString buffer; @@ -3197,15 +3197,15 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns // get a string mapping the name nsCString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.Append(str); + aResult.AppendWithConversion(str); } else { - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } break; default: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } else if (eCSSUnit_Enumerated == unit) { @@ -3217,119 +3217,119 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); intValue &= ~mask; if (0 != intValue) { // more left - aResult.Append(' '); + aResult.AppendWithConversion(' '); } } } } else { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.Append(' '); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.AppendWithConversion(' '); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); } } else { - const nsString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.Append(name); + const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); + aResult.AppendWithConversion(name); } } else if (eCSSUnit_Color == unit){ nscolor color = aValue.GetColorValue(); - aResult.Append("rgb("); - aResult.Append(NS_GET_R(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_G(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_B(color), 10); - aResult.Append(')'); + aResult.AppendWithConversion("rgb("); + aResult.AppendInt(NS_GET_R(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_G(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_B(color), 10); + aResult.AppendWithConversion(')'); } else if (eCSSUnit_Percent == unit) { - aResult.Append(aValue.GetPercentValue() * 100.0f); + aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.Append(aValue.GetFloatValue()); + aResult.AppendFloat(aValue.GetFloatValue()); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.Append("auto"); break; - case eCSSUnit_Inherit: aResult.Append("inherit"); break; - case eCSSUnit_None: aResult.Append("none"); break; - case eCSSUnit_Normal: aResult.Append("normal"); break; + case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; + case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; + case eCSSUnit_None: aResult.AppendWithConversion("none"); break; + case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.Append(')'); break; + case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.Append("%"); break; + case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.Append("in"); break; - case eCSSUnit_Foot: aResult.Append("ft"); break; - case eCSSUnit_Mile: aResult.Append("mi"); break; - case eCSSUnit_Millimeter: aResult.Append("mm"); break; - case eCSSUnit_Centimeter: aResult.Append("cm"); break; - case eCSSUnit_Meter: aResult.Append("m"); break; - case eCSSUnit_Kilometer: aResult.Append("km"); break; - case eCSSUnit_Point: aResult.Append("pt"); break; - case eCSSUnit_Pica: aResult.Append("pc"); break; - case eCSSUnit_Didot: aResult.Append("dt"); break; - case eCSSUnit_Cicero: aResult.Append("cc"); break; + case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; + case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; + case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; + case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; + case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; + case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; + case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; + case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; + case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; + case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; + case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aResult.Append("em"); break; - case eCSSUnit_EN: aResult.Append("en"); break; - case eCSSUnit_XHeight: aResult.Append("ex"); break; - case eCSSUnit_CapHeight: aResult.Append("cap"); break; - case eCSSUnit_Char: aResult.Append("ch"); break; + case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; + case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; + case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; + case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; + case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aResult.Append("px"); break; + case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aResult.Append("deg"); break; - case eCSSUnit_Grad: aResult.Append("grad"); break; - case eCSSUnit_Radian: aResult.Append("rad"); break; + case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; + case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; + case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aResult.Append("Hz"); break; - case eCSSUnit_Kilohertz: aResult.Append("kHz"); break; + case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; + case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aResult.Append("s"); break; - case eCSSUnit_Milliseconds: aResult.Append("ms"); break; + case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; + case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; } return PR_TRUE; @@ -3358,41 +3358,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.Append("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(' '); + aValue.AppendWithConversion("rect("); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.Append(")"); + aValue.AppendWithConversion(")"); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -3403,55 +3403,55 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.Append('/'); + aValue.AppendWithConversion('/'); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_pause_before, aValue); } break; @@ -3467,13 +3467,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); shadow = shadow->mNext; } } @@ -3485,67 +3485,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -3556,7 +3556,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != content); } @@ -3567,13 +3567,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3584,13 +3584,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3599,7 +3599,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -3609,11 +3609,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != quotes); } @@ -3625,7 +3625,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != keyEquiv); } @@ -3689,21 +3689,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.Append(nsCSSProps::GetStringValue(property)); - aString.Append(": "); + aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aString.AppendWithConversion(": "); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.Append("; "); + aString.AppendWithConversion("; "); } } else { // is comment - aString.Append("/* "); + aString.AppendWithConversion("/* "); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.Append(" */ "); + aString.AppendWithConversion(" */ "); } } } @@ -3858,7 +3858,7 @@ CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.Append(nsCSSProps::GetStringValue(property)); + aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); } } diff --git a/mozilla/layout/html/style/src/nsCSSParser.cpp b/mozilla/layout/html/style/src/nsCSSParser.cpp index bb71eb02940..7134b5ed7be 100644 --- a/mozilla/layout/html/style/src/nsCSSParser.cpp +++ b/mozilla/layout/html/style/src/nsCSSParser.cpp @@ -770,7 +770,7 @@ PRBool CSSParserImpl::GatherMedia(PRInt32& aErrorCode, nsString& aMedia, else if (eCSSToken_Ident == mToken.mType) { if (expectIdent) { if (! first) { - aMedia.Append(','); + aMedia.AppendWithConversion(','); } mToken.mIdent.ToLowerCase(); // case insensitive from CSS - must be lower cased if (aMediaAtoms) { @@ -1570,7 +1570,7 @@ PRBool CSSParserImpl::ParseSelector(PRInt32& aErrorCode, } mToken.AppendToString(aSource); buffer.Truncate(); - buffer.Append(':'); + buffer.AppendWithConversion(':'); buffer.Append(mToken.mIdent); buffer.ToLowerCase(); nsIAtom* pseudo = NS_NewAtom(buffer); @@ -1887,7 +1887,7 @@ PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue) case eCSSToken_Number: if (tk->mIntegerValid) { sprintf(buffer, "%06d", tk->mInteger); - str.Assign(buffer); + str.AssignWithConversion(buffer); } break; @@ -1895,7 +1895,7 @@ PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue) if (tk->mIdent.Length() <= 6) { sprintf(buffer, "%06.0f", tk->mNumber); nsAutoString temp; - temp.Assign(buffer); + temp.AssignWithConversion(buffer); temp.Right(str, 6 - tk->mIdent.Length()); str.Append(tk->mIdent); } @@ -2390,7 +2390,7 @@ PRBool CSSParserImpl::ParseCounter(PRInt32& aErrorCode, nsCSSValue& aValue) return PR_FALSE; } if (GetToken(aErrorCode, PR_TRUE) && (eCSSToken_String == mToken.mType)) { - counter.Append(','); + counter.AppendWithConversion(','); counter.Append(mToken.mSymbol); // quote too counter.Append(mToken.mIdent); counter.Append(mToken.mSymbol); // quote too @@ -2406,7 +2406,7 @@ PRBool CSSParserImpl::ParseCounter(PRInt32& aErrorCode, nsCSSValue& aValue) nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(mToken.mIdent); if ((eCSSKeyword_UNKNOWN < keyword) && (0 < SearchKeywordTable(keyword, nsCSSProps::kListStyleKTable))) { - counter.Append(','); + counter.AppendWithConversion(','); counter.Append(mToken.mIdent); } else { @@ -2456,8 +2456,8 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue) if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it return PR_FALSE; } - attr.Append(nameSpaceID, 10); - attr.Append('|'); + attr.AppendInt(nameSpaceID, 10); + attr.AppendWithConversion('|'); if (! GetToken(aErrorCode, PR_FALSE)) { return PR_FALSE; } @@ -2475,8 +2475,8 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue) } else if (mToken.IsSymbol('*')) { // namespace wildcard if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { - attr.Append(kNameSpaceID_Unknown, 10); - attr.Append('|'); + attr.AppendInt(kNameSpaceID_Unknown, 10); + attr.AppendWithConversion('|'); if (! GetToken(aErrorCode, PR_FALSE)) { return PR_FALSE; } diff --git a/mozilla/layout/html/style/src/nsCSSScanner.cpp b/mozilla/layout/html/style/src/nsCSSScanner.cpp index 1363c686ee4..12199bf88ea 100644 --- a/mozilla/layout/html/style/src/nsCSSScanner.cpp +++ b/mozilla/layout/html/style/src/nsCSSScanner.cpp @@ -100,27 +100,27 @@ nsCSSToken::AppendToString(nsString& aBuffer) break; case eCSSToken_Number: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } break; case eCSSToken_Percentage: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } - aBuffer.Append(PRUnichar('%')); + aBuffer.Append(PRUnichar('%')); // STRING USE WARNING: technically, this should be |AppendWithConversion| break; case eCSSToken_Dimension: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } aBuffer.Append(mIdent); break; @@ -420,12 +420,12 @@ PRBool nsCSSScanner::Next(PRInt32& aErrorCode, nsCSSToken& aToken) aToken.mType = eCSSToken_HTMLComment; aToken.mIdent.SetLength(0); while (0 < dashCount--) { - aToken.mIdent.Append('-'); + aToken.mIdent.AppendWithConversion('-'); } if (white) { - aToken.mIdent.Append(' '); + aToken.mIdent.AppendWithConversion(' '); } - aToken.mIdent.Append('>'); + aToken.mIdent.AppendWithConversion('>'); return PR_TRUE; } else { // wasn't an end comment, push it all back @@ -751,8 +751,8 @@ PRBool nsCSSScanner::ParseCComment(PRInt32& aErrorCode, nsCSSToken& aToken) if (ch < 0) break; if (ch == '*') { if (LookAhead(aErrorCode, '/')) { - ident.Append(PRUnichar(ch)); - ident.Append('/'); + ident.Append(PRUnichar(ch)); // STRING USE WARNING: technically, this should be |AppendWithConversion| + ident.AppendWithConversion('/'); break; } } diff --git a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp index c143e993f26..d6e4d6a0fa4 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp @@ -3015,9 +3015,9 @@ static void ListNameSpace(FILE* out, nsINameSpaceManager*& aManager, PRInt32 aNa aManager->GetNameSpaceURI(aNameSpaceID, buffer); } else { - buffer = "{namespace ID: "; - buffer.Append(aNameSpaceID, 10); - buffer.Append("}"); + buffer.AssignWithConversion("{namespace ID: "); + buffer.AppendInt(aNameSpaceID, 10); + buffer.AppendWithConversion("}"); } fputs(buffer, out); fputs("|", out); @@ -3032,7 +3032,7 @@ static void ListSelector(FILE* out, const nsCSSSelector* aSelector) if (0 != aSelector->mOperator) { buffer.Truncate(); buffer.Append(aSelector->mOperator); - buffer.Append(" "); + buffer.AppendWithConversion(" "); fputs(buffer, out); } ListNameSpace(out, nameSpaceMgr, aSelector->mNameSpace); @@ -3097,9 +3097,9 @@ CSSStyleRuleImpl::List(FILE* out, PRInt32 aIndent) const nsAutoString buffer; - buffer.Append("weight: "); - buffer.Append(mWeight, 10); - buffer.Append(" "); + buffer.AppendWithConversion("weight: "); + buffer.AppendInt(mWeight, 10); + buffer.AppendWithConversion(" "); fputs(buffer, out); if (nsnull != mDeclaration) { mDeclaration->List(out); diff --git a/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp b/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp index 989da4b65ee..464cf03d786 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp @@ -1430,8 +1430,7 @@ CSSStyleSheetImpl::SetTitle(const nsString& aTitle) NS_IMETHODIMP CSSStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/css"); + aType.AssignWithConversion("text/css"); return NS_OK; } @@ -2025,8 +2024,7 @@ CSSStyleSheetImpl::SetModified(PRBool aModified) NS_IMETHODIMP CSSStyleSheetImpl::GetType(nsString& aType) { - aType.Truncate(); - aType.Append("text/css"); + aType.AssignWithConversion("text/css"); return NS_OK; } @@ -2084,7 +2082,7 @@ CSSStyleSheetImpl::GetHref(nsString& aHref) if (mInner && mInner->mURL) { char* str = nsnull; mInner->mURL->GetSpec(&str); - aHref = str; + aHref.AssignWithConversion(str); if (str) { nsCRT::free(str); } @@ -2119,7 +2117,7 @@ CSSStyleSheetImpl::GetMedia(nsString& aMedia) medium->ToString(buffer); aMedia.Append(buffer); if (index < count) { - aMedia.Append(", "); + aMedia.AppendWithConversion(", "); } } } diff --git a/mozilla/layout/html/style/src/nsHTMLAttributes.cpp b/mozilla/layout/html/style/src/nsHTMLAttributes.cpp index fa2321da0ae..9cc04451b47 100644 --- a/mozilla/layout/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/layout/html/style/src/nsHTMLAttributes.cpp @@ -146,13 +146,12 @@ struct HTMLAttribute { if (nsnull != mAttribute) { mAttribute->ToString(aBuffer); if (eHTMLUnit_Null != mValue.GetUnit()) { - aBuffer.Append(" = "); + aBuffer.AppendWithConversion(" = "); mValue.AppendToString(aBuffer); } } else { - aBuffer.Truncate(); - aBuffer.Append("null"); + aBuffer.AssignWithConversion("null"); } } diff --git a/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp index c635932d139..c3debf647ef 100644 --- a/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp @@ -628,16 +628,14 @@ HTMLCSSStyleSheetImpl::GetURL(nsIURI*& aURL) const NS_IMETHODIMP HTMLCSSStyleSheetImpl::GetTitle(nsString& aTitle) const { - aTitle.Truncate(); - aTitle.Append("Internal HTML/CSS Style Sheet"); + aTitle.AssignWithConversion("Internal HTML/CSS Style Sheet"); return NS_OK; } NS_IMETHODIMP HTMLCSSStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/html"); + aType.AssignWithConversion("text/html"); return NS_OK; } diff --git a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp index 8d2532dbfdc..d2a0b87974b 100644 --- a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -1010,8 +1010,7 @@ HTMLStyleSheetImpl::GetTitle(nsString& aTitle) const NS_IMETHODIMP HTMLStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/html"); + aType.AssignWithConversion("text/html"); return NS_OK; } diff --git a/mozilla/layout/html/style/src/nsHTMLValue.cpp b/mozilla/layout/html/style/src/nsHTMLValue.cpp index 5b1e8d7aadd..a86f70b9253 100644 --- a/mozilla/layout/html/style/src/nsHTMLValue.cpp +++ b/mozilla/layout/html/style/src/nsHTMLValue.cpp @@ -266,37 +266,37 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const } else if ((eHTMLUnit_String == mUnit) || (eHTMLUnit_ColorName == mUnit)) { if (nsnull != mValue.mString) { - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); aBuffer.Append(*(mValue.mString)); - aBuffer.Append('"'); + aBuffer.AppendWithConversion('"'); } else { - aBuffer.Append("null str"); + aBuffer.AppendWithConversion("null str"); } } else if (eHTMLUnit_ISupports == mUnit) { - aBuffer.Append("0x"); - aBuffer.Append((PRInt32)mValue.mISupports, 16); + aBuffer.AppendWithConversion("0x"); + aBuffer.AppendInt((PRInt32)mValue.mISupports, 16); } else if (eHTMLUnit_Color == mUnit){ - aBuffer.Append("(0x"); - aBuffer.Append(NS_GET_R(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_G(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_B(mValue.mColor), 16); - aBuffer.Append(" 0x"); - aBuffer.Append(NS_GET_A(mValue.mColor), 16); - aBuffer.Append(')'); + aBuffer.AppendWithConversion("(0x"); + aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16); + aBuffer.AppendWithConversion(" 0x"); + aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16); + aBuffer.AppendWithConversion(')'); } else if (eHTMLUnit_Percent == mUnit) { - aBuffer.Append(mValue.mFloat * 100.0f); + aBuffer.AppendFloat(mValue.mFloat * 100.0f); } else { - aBuffer.Append(mValue.mInt, 10); - aBuffer.Append("[0x"); - aBuffer.Append(mValue.mInt, 16); - aBuffer.Append(']'); + aBuffer.AppendInt(mValue.mInt, 10); + aBuffer.AppendWithConversion("[0x"); + aBuffer.AppendInt(mValue.mInt, 16); + aBuffer.AppendWithConversion(']'); } switch (mUnit) { @@ -304,15 +304,15 @@ void nsHTMLValue::AppendToString(nsString& aBuffer) const case eHTMLUnit_Empty: break; case eHTMLUnit_String: break; case eHTMLUnit_ColorName: break; - case eHTMLUnit_ISupports: aBuffer.Append("ptr"); break; + case eHTMLUnit_ISupports: aBuffer.AppendWithConversion("ptr"); break; case eHTMLUnit_Integer: break; - case eHTMLUnit_Enumerated: aBuffer.Append("enum"); break; - case eHTMLUnit_Proportional: aBuffer.Append("*"); break; - case eHTMLUnit_Color: aBuffer.Append("rbga"); break; - case eHTMLUnit_Percent: aBuffer.Append("%"); break; - case eHTMLUnit_Pixel: aBuffer.Append("px"); break; + case eHTMLUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break; + case eHTMLUnit_Proportional: aBuffer.AppendWithConversion("*"); break; + case eHTMLUnit_Color: aBuffer.AppendWithConversion("rbga"); break; + case eHTMLUnit_Percent: aBuffer.AppendWithConversion("%"); break; + case eHTMLUnit_Pixel: aBuffer.AppendWithConversion("px"); break; } - aBuffer.Append(' '); + aBuffer.AppendWithConversion(' '); } void nsHTMLValue::ToString(nsString& aBuffer) const diff --git a/mozilla/layout/style/nsCSSDeclaration.cpp b/mozilla/layout/style/nsCSSDeclaration.cpp index fa1f365a977..a1dfb4c7884 100644 --- a/mozilla/layout/style/nsCSSDeclaration.cpp +++ b/mozilla/layout/style/nsCSSDeclaration.cpp @@ -284,8 +284,8 @@ void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const nsAutoString buffer; if (eCSSProperty_UNKNOWN < aPropID) { - buffer.Append(nsCSSProps::GetStringValue(aPropID)); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); + buffer.AppendWithConversion(": "); } mTop.AppendToString(buffer); @@ -302,23 +302,23 @@ void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) co nsAutoString buffer; if (eCSSUnit_Null != mTop.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[0])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0])); + buffer.AppendWithConversion(": "); mTop.AppendToString(buffer); } if (eCSSUnit_Null != mRight.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[1])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1])); + buffer.AppendWithConversion(": "); mRight.AppendToString(buffer); } if (eCSSUnit_Null != mBottom.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[2])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2])); + buffer.AppendWithConversion(": "); mBottom.AppendToString(buffer); } if (eCSSUnit_Null != mLeft.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[3])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3])); + buffer.AppendWithConversion(": "); mLeft.AppendToString(buffer); } @@ -3179,10 +3179,10 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.Append("url("); break; - case eCSSUnit_Attr: aResult.Append("attr("); break; - case eCSSUnit_Counter: aResult.Append("counter("); break; - case eCSSUnit_Counters: aResult.Append("counters("); break; + case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; + case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; + case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; + case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; default: break; } nsAutoString buffer; @@ -3197,15 +3197,15 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns // get a string mapping the name nsCString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.Append(str); + aResult.AppendWithConversion(str); } else { - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } break; default: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } else if (eCSSUnit_Enumerated == unit) { @@ -3217,119 +3217,119 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); intValue &= ~mask; if (0 != intValue) { // more left - aResult.Append(' '); + aResult.AppendWithConversion(' '); } } } } else { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.Append(' '); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.AppendWithConversion(' '); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); } } else { - const nsString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.Append(name); + const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); + aResult.AppendWithConversion(name); } } else if (eCSSUnit_Color == unit){ nscolor color = aValue.GetColorValue(); - aResult.Append("rgb("); - aResult.Append(NS_GET_R(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_G(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_B(color), 10); - aResult.Append(')'); + aResult.AppendWithConversion("rgb("); + aResult.AppendInt(NS_GET_R(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_G(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_B(color), 10); + aResult.AppendWithConversion(')'); } else if (eCSSUnit_Percent == unit) { - aResult.Append(aValue.GetPercentValue() * 100.0f); + aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.Append(aValue.GetFloatValue()); + aResult.AppendFloat(aValue.GetFloatValue()); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.Append("auto"); break; - case eCSSUnit_Inherit: aResult.Append("inherit"); break; - case eCSSUnit_None: aResult.Append("none"); break; - case eCSSUnit_Normal: aResult.Append("normal"); break; + case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; + case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; + case eCSSUnit_None: aResult.AppendWithConversion("none"); break; + case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.Append(')'); break; + case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.Append("%"); break; + case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.Append("in"); break; - case eCSSUnit_Foot: aResult.Append("ft"); break; - case eCSSUnit_Mile: aResult.Append("mi"); break; - case eCSSUnit_Millimeter: aResult.Append("mm"); break; - case eCSSUnit_Centimeter: aResult.Append("cm"); break; - case eCSSUnit_Meter: aResult.Append("m"); break; - case eCSSUnit_Kilometer: aResult.Append("km"); break; - case eCSSUnit_Point: aResult.Append("pt"); break; - case eCSSUnit_Pica: aResult.Append("pc"); break; - case eCSSUnit_Didot: aResult.Append("dt"); break; - case eCSSUnit_Cicero: aResult.Append("cc"); break; + case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; + case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; + case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; + case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; + case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; + case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; + case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; + case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; + case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; + case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; + case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aResult.Append("em"); break; - case eCSSUnit_EN: aResult.Append("en"); break; - case eCSSUnit_XHeight: aResult.Append("ex"); break; - case eCSSUnit_CapHeight: aResult.Append("cap"); break; - case eCSSUnit_Char: aResult.Append("ch"); break; + case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; + case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; + case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; + case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; + case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aResult.Append("px"); break; + case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aResult.Append("deg"); break; - case eCSSUnit_Grad: aResult.Append("grad"); break; - case eCSSUnit_Radian: aResult.Append("rad"); break; + case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; + case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; + case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aResult.Append("Hz"); break; - case eCSSUnit_Kilohertz: aResult.Append("kHz"); break; + case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; + case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aResult.Append("s"); break; - case eCSSUnit_Milliseconds: aResult.Append("ms"); break; + case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; + case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; } return PR_TRUE; @@ -3358,41 +3358,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.Append("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(' '); + aValue.AppendWithConversion("rect("); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.Append(")"); + aValue.AppendWithConversion(")"); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -3403,55 +3403,55 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.Append('/'); + aValue.AppendWithConversion('/'); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_pause_before, aValue); } break; @@ -3467,13 +3467,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); shadow = shadow->mNext; } } @@ -3485,67 +3485,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -3556,7 +3556,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != content); } @@ -3567,13 +3567,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3584,13 +3584,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3599,7 +3599,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -3609,11 +3609,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != quotes); } @@ -3625,7 +3625,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != keyEquiv); } @@ -3689,21 +3689,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.Append(nsCSSProps::GetStringValue(property)); - aString.Append(": "); + aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aString.AppendWithConversion(": "); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.Append("; "); + aString.AppendWithConversion("; "); } } else { // is comment - aString.Append("/* "); + aString.AppendWithConversion("/* "); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.Append(" */ "); + aString.AppendWithConversion(" */ "); } } } @@ -3858,7 +3858,7 @@ CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.Append(nsCSSProps::GetStringValue(property)); + aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); } } diff --git a/mozilla/layout/style/nsCSSParser.cpp b/mozilla/layout/style/nsCSSParser.cpp index bb71eb02940..7134b5ed7be 100644 --- a/mozilla/layout/style/nsCSSParser.cpp +++ b/mozilla/layout/style/nsCSSParser.cpp @@ -770,7 +770,7 @@ PRBool CSSParserImpl::GatherMedia(PRInt32& aErrorCode, nsString& aMedia, else if (eCSSToken_Ident == mToken.mType) { if (expectIdent) { if (! first) { - aMedia.Append(','); + aMedia.AppendWithConversion(','); } mToken.mIdent.ToLowerCase(); // case insensitive from CSS - must be lower cased if (aMediaAtoms) { @@ -1570,7 +1570,7 @@ PRBool CSSParserImpl::ParseSelector(PRInt32& aErrorCode, } mToken.AppendToString(aSource); buffer.Truncate(); - buffer.Append(':'); + buffer.AppendWithConversion(':'); buffer.Append(mToken.mIdent); buffer.ToLowerCase(); nsIAtom* pseudo = NS_NewAtom(buffer); @@ -1887,7 +1887,7 @@ PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue) case eCSSToken_Number: if (tk->mIntegerValid) { sprintf(buffer, "%06d", tk->mInteger); - str.Assign(buffer); + str.AssignWithConversion(buffer); } break; @@ -1895,7 +1895,7 @@ PRBool CSSParserImpl::ParseColor(PRInt32& aErrorCode, nsCSSValue& aValue) if (tk->mIdent.Length() <= 6) { sprintf(buffer, "%06.0f", tk->mNumber); nsAutoString temp; - temp.Assign(buffer); + temp.AssignWithConversion(buffer); temp.Right(str, 6 - tk->mIdent.Length()); str.Append(tk->mIdent); } @@ -2390,7 +2390,7 @@ PRBool CSSParserImpl::ParseCounter(PRInt32& aErrorCode, nsCSSValue& aValue) return PR_FALSE; } if (GetToken(aErrorCode, PR_TRUE) && (eCSSToken_String == mToken.mType)) { - counter.Append(','); + counter.AppendWithConversion(','); counter.Append(mToken.mSymbol); // quote too counter.Append(mToken.mIdent); counter.Append(mToken.mSymbol); // quote too @@ -2406,7 +2406,7 @@ PRBool CSSParserImpl::ParseCounter(PRInt32& aErrorCode, nsCSSValue& aValue) nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(mToken.mIdent); if ((eCSSKeyword_UNKNOWN < keyword) && (0 < SearchKeywordTable(keyword, nsCSSProps::kListStyleKTable))) { - counter.Append(','); + counter.AppendWithConversion(','); counter.Append(mToken.mIdent); } else { @@ -2456,8 +2456,8 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue) if (kNameSpaceID_Unknown == nameSpaceID) { // unknown prefix, dump it return PR_FALSE; } - attr.Append(nameSpaceID, 10); - attr.Append('|'); + attr.AppendInt(nameSpaceID, 10); + attr.AppendWithConversion('|'); if (! GetToken(aErrorCode, PR_FALSE)) { return PR_FALSE; } @@ -2475,8 +2475,8 @@ PRBool CSSParserImpl::ParseAttr(PRInt32& aErrorCode, nsCSSValue& aValue) } else if (mToken.IsSymbol('*')) { // namespace wildcard if (ExpectSymbol(aErrorCode, '|', PR_FALSE)) { - attr.Append(kNameSpaceID_Unknown, 10); - attr.Append('|'); + attr.AppendInt(kNameSpaceID_Unknown, 10); + attr.AppendWithConversion('|'); if (! GetToken(aErrorCode, PR_FALSE)) { return PR_FALSE; } diff --git a/mozilla/layout/style/nsCSSScanner.cpp b/mozilla/layout/style/nsCSSScanner.cpp index 1363c686ee4..12199bf88ea 100644 --- a/mozilla/layout/style/nsCSSScanner.cpp +++ b/mozilla/layout/style/nsCSSScanner.cpp @@ -100,27 +100,27 @@ nsCSSToken::AppendToString(nsString& aBuffer) break; case eCSSToken_Number: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } break; case eCSSToken_Percentage: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } - aBuffer.Append(PRUnichar('%')); + aBuffer.Append(PRUnichar('%')); // STRING USE WARNING: technically, this should be |AppendWithConversion| break; case eCSSToken_Dimension: if (mIntegerValid) { - aBuffer.Append(mInteger, 10); + aBuffer.AppendInt(mInteger, 10); } else { - aBuffer.Append(mNumber); + aBuffer.AppendFloat(mNumber); } aBuffer.Append(mIdent); break; @@ -420,12 +420,12 @@ PRBool nsCSSScanner::Next(PRInt32& aErrorCode, nsCSSToken& aToken) aToken.mType = eCSSToken_HTMLComment; aToken.mIdent.SetLength(0); while (0 < dashCount--) { - aToken.mIdent.Append('-'); + aToken.mIdent.AppendWithConversion('-'); } if (white) { - aToken.mIdent.Append(' '); + aToken.mIdent.AppendWithConversion(' '); } - aToken.mIdent.Append('>'); + aToken.mIdent.AppendWithConversion('>'); return PR_TRUE; } else { // wasn't an end comment, push it all back @@ -751,8 +751,8 @@ PRBool nsCSSScanner::ParseCComment(PRInt32& aErrorCode, nsCSSToken& aToken) if (ch < 0) break; if (ch == '*') { if (LookAhead(aErrorCode, '/')) { - ident.Append(PRUnichar(ch)); - ident.Append('/'); + ident.Append(PRUnichar(ch)); // STRING USE WARNING: technically, this should be |AppendWithConversion| + ident.AppendWithConversion('/'); break; } } diff --git a/mozilla/layout/style/nsCSSStruct.cpp b/mozilla/layout/style/nsCSSStruct.cpp index fa1f365a977..a1dfb4c7884 100644 --- a/mozilla/layout/style/nsCSSStruct.cpp +++ b/mozilla/layout/style/nsCSSStruct.cpp @@ -284,8 +284,8 @@ void nsCSSRect::List(FILE* out, nsCSSProperty aPropID, PRInt32 aIndent) const nsAutoString buffer; if (eCSSProperty_UNKNOWN < aPropID) { - buffer.Append(nsCSSProps::GetStringValue(aPropID)); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID)); + buffer.AppendWithConversion(": "); } mTop.AppendToString(buffer); @@ -302,23 +302,23 @@ void nsCSSRect::List(FILE* out, PRInt32 aIndent, const nsCSSProperty aTRBL[]) co nsAutoString buffer; if (eCSSUnit_Null != mTop.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[0])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[0])); + buffer.AppendWithConversion(": "); mTop.AppendToString(buffer); } if (eCSSUnit_Null != mRight.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[1])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[1])); + buffer.AppendWithConversion(": "); mRight.AppendToString(buffer); } if (eCSSUnit_Null != mBottom.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[2])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[2])); + buffer.AppendWithConversion(": "); mBottom.AppendToString(buffer); } if (eCSSUnit_Null != mLeft.GetUnit()) { - buffer.Append(nsCSSProps::GetStringValue(aTRBL[3])); - buffer.Append(": "); + buffer.AppendWithConversion(nsCSSProps::GetStringValue(aTRBL[3])); + buffer.AppendWithConversion(": "); mLeft.AppendToString(buffer); } @@ -3179,10 +3179,10 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns if ((eCSSUnit_String <= unit) && (unit <= eCSSUnit_Counters)) { switch (unit) { - case eCSSUnit_URL: aResult.Append("url("); break; - case eCSSUnit_Attr: aResult.Append("attr("); break; - case eCSSUnit_Counter: aResult.Append("counter("); break; - case eCSSUnit_Counters: aResult.Append("counters("); break; + case eCSSUnit_URL: aResult.AppendWithConversion("url("); break; + case eCSSUnit_Attr: aResult.AppendWithConversion("attr("); break; + case eCSSUnit_Counter: aResult.AppendWithConversion("counter("); break; + case eCSSUnit_Counters: aResult.AppendWithConversion("counters("); break; default: break; } nsAutoString buffer; @@ -3197,15 +3197,15 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns // get a string mapping the name nsCString str; if (nsCSSProps::GetColorName(aValue.GetIntValue(), str)){ - aResult.Append(str); + aResult.AppendWithConversion(str); } else { - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } break; default: - aResult.Append(aValue.GetIntValue(), 10); + aResult.AppendInt(aValue.GetIntValue(), 10); } } else if (eCSSUnit_Enumerated == unit) { @@ -3217,119 +3217,119 @@ PRBool CSSDeclarationImpl::AppendValueToString(nsCSSProperty aProperty, const ns mask <= NS_STYLE_TEXT_DECORATION_BLINK; mask <<= 1) { if ((mask & intValue) == mask) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, mask)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, mask)); intValue &= ~mask; if (0 != intValue) { // more left - aResult.Append(' '); + aResult.AppendWithConversion(' '); } } } } else { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_TEXT_DECORATION_NONE)); } } else if (eCSSProperty_azimuth == aProperty) { PRInt32 intValue = aValue.GetIntValue(); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, (intValue & ~NS_STYLE_AZIMUTH_BEHIND))); if ((NS_STYLE_AZIMUTH_BEHIND & intValue) != 0) { - aResult.Append(' '); - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); + aResult.AppendWithConversion(' '); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_AZIMUTH_BEHIND)); } } else if (eCSSProperty_play_during_flags == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PLAY_DURING_MIX & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_MIX)); } if ((NS_STYLE_PLAY_DURING_REPEAT & intValue) != 0) { if (NS_STYLE_PLAY_DURING_REPEAT != intValue) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PLAY_DURING_REPEAT)); } } else if (eCSSProperty_marks == aProperty) { PRInt32 intValue = aValue.GetIntValue(); if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_CROP)); } if ((NS_STYLE_PAGE_MARKS_REGISTER & intValue) != 0) { if ((NS_STYLE_PAGE_MARKS_CROP & intValue) != 0) { - aResult.Append(' '); + aResult.AppendWithConversion(' '); } - aResult.Append(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); + aResult.AppendWithConversion(nsCSSProps::LookupPropertyValue(aProperty, NS_STYLE_PAGE_MARKS_REGISTER)); } } else { - const nsString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); - aResult.Append(name); + const nsCString& name = nsCSSProps::LookupPropertyValue(aProperty, aValue.GetIntValue()); + aResult.AppendWithConversion(name); } } else if (eCSSUnit_Color == unit){ nscolor color = aValue.GetColorValue(); - aResult.Append("rgb("); - aResult.Append(NS_GET_R(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_G(color), 10); - aResult.Append(","); - aResult.Append(NS_GET_B(color), 10); - aResult.Append(')'); + aResult.AppendWithConversion("rgb("); + aResult.AppendInt(NS_GET_R(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_G(color), 10); + aResult.AppendWithConversion(","); + aResult.AppendInt(NS_GET_B(color), 10); + aResult.AppendWithConversion(')'); } else if (eCSSUnit_Percent == unit) { - aResult.Append(aValue.GetPercentValue() * 100.0f); + aResult.AppendFloat(aValue.GetPercentValue() * 100.0f); } else if (eCSSUnit_Percent < unit) { // length unit - aResult.Append(aValue.GetFloatValue()); + aResult.AppendFloat(aValue.GetFloatValue()); } switch (unit) { case eCSSUnit_Null: break; - case eCSSUnit_Auto: aResult.Append("auto"); break; - case eCSSUnit_Inherit: aResult.Append("inherit"); break; - case eCSSUnit_None: aResult.Append("none"); break; - case eCSSUnit_Normal: aResult.Append("normal"); break; + case eCSSUnit_Auto: aResult.AppendWithConversion("auto"); break; + case eCSSUnit_Inherit: aResult.AppendWithConversion("inherit"); break; + case eCSSUnit_None: aResult.AppendWithConversion("none"); break; + case eCSSUnit_Normal: aResult.AppendWithConversion("normal"); break; case eCSSUnit_String: break; case eCSSUnit_URL: case eCSSUnit_Attr: case eCSSUnit_Counter: - case eCSSUnit_Counters: aResult.Append(')'); break; + case eCSSUnit_Counters: aResult.AppendWithConversion(')'); break; case eCSSUnit_Integer: break; case eCSSUnit_Enumerated: break; case eCSSUnit_Color: break; - case eCSSUnit_Percent: aResult.Append("%"); break; + case eCSSUnit_Percent: aResult.AppendWithConversion("%"); break; case eCSSUnit_Number: break; - case eCSSUnit_Inch: aResult.Append("in"); break; - case eCSSUnit_Foot: aResult.Append("ft"); break; - case eCSSUnit_Mile: aResult.Append("mi"); break; - case eCSSUnit_Millimeter: aResult.Append("mm"); break; - case eCSSUnit_Centimeter: aResult.Append("cm"); break; - case eCSSUnit_Meter: aResult.Append("m"); break; - case eCSSUnit_Kilometer: aResult.Append("km"); break; - case eCSSUnit_Point: aResult.Append("pt"); break; - case eCSSUnit_Pica: aResult.Append("pc"); break; - case eCSSUnit_Didot: aResult.Append("dt"); break; - case eCSSUnit_Cicero: aResult.Append("cc"); break; + case eCSSUnit_Inch: aResult.AppendWithConversion("in"); break; + case eCSSUnit_Foot: aResult.AppendWithConversion("ft"); break; + case eCSSUnit_Mile: aResult.AppendWithConversion("mi"); break; + case eCSSUnit_Millimeter: aResult.AppendWithConversion("mm"); break; + case eCSSUnit_Centimeter: aResult.AppendWithConversion("cm"); break; + case eCSSUnit_Meter: aResult.AppendWithConversion("m"); break; + case eCSSUnit_Kilometer: aResult.AppendWithConversion("km"); break; + case eCSSUnit_Point: aResult.AppendWithConversion("pt"); break; + case eCSSUnit_Pica: aResult.AppendWithConversion("pc"); break; + case eCSSUnit_Didot: aResult.AppendWithConversion("dt"); break; + case eCSSUnit_Cicero: aResult.AppendWithConversion("cc"); break; - case eCSSUnit_EM: aResult.Append("em"); break; - case eCSSUnit_EN: aResult.Append("en"); break; - case eCSSUnit_XHeight: aResult.Append("ex"); break; - case eCSSUnit_CapHeight: aResult.Append("cap"); break; - case eCSSUnit_Char: aResult.Append("ch"); break; + case eCSSUnit_EM: aResult.AppendWithConversion("em"); break; + case eCSSUnit_EN: aResult.AppendWithConversion("en"); break; + case eCSSUnit_XHeight: aResult.AppendWithConversion("ex"); break; + case eCSSUnit_CapHeight: aResult.AppendWithConversion("cap"); break; + case eCSSUnit_Char: aResult.AppendWithConversion("ch"); break; - case eCSSUnit_Pixel: aResult.Append("px"); break; + case eCSSUnit_Pixel: aResult.AppendWithConversion("px"); break; - case eCSSUnit_Degree: aResult.Append("deg"); break; - case eCSSUnit_Grad: aResult.Append("grad"); break; - case eCSSUnit_Radian: aResult.Append("rad"); break; + case eCSSUnit_Degree: aResult.AppendWithConversion("deg"); break; + case eCSSUnit_Grad: aResult.AppendWithConversion("grad"); break; + case eCSSUnit_Radian: aResult.AppendWithConversion("rad"); break; - case eCSSUnit_Hertz: aResult.Append("Hz"); break; - case eCSSUnit_Kilohertz: aResult.Append("kHz"); break; + case eCSSUnit_Hertz: aResult.AppendWithConversion("Hz"); break; + case eCSSUnit_Kilohertz: aResult.AppendWithConversion("kHz"); break; - case eCSSUnit_Seconds: aResult.Append("s"); break; - case eCSSUnit_Milliseconds: aResult.Append("ms"); break; + case eCSSUnit_Seconds: aResult.AppendWithConversion("s"); break; + case eCSSUnit_Milliseconds: aResult.AppendWithConversion("ms"); break; } return PR_TRUE; @@ -3358,41 +3358,41 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) // shorthands switch (aProperty) { case eCSSProperty_background: - if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_background_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_image, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_repeat, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_background_attachment, aValue)) aValue.AppendWithConversion(' '); if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_spacing: if (AppendValueToString(eCSSProperty_border_x_spacing, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_y_spacing, aValue); } break; case eCSSProperty_clip: if (HAS_RECT(mDisplay,mClip)) { - aValue.Append("rect("); - AppendValueToString(eCSSProperty_clip_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.Append(' '); + aValue.AppendWithConversion("rect("); + AppendValueToString(eCSSProperty_clip_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_clip_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_clip_left, aValue); - aValue.Append(")"); + aValue.AppendWithConversion(")"); } break; case eCSSProperty_cue: if (HAS_VALUE(mAural,mCueAfter) && HAS_VALUE(mAural,mCueBefore)) { AppendValueToString(eCSSProperty_cue_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_cue_before, aValue); } break; @@ -3403,55 +3403,55 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_cursor, cursor->mValue, aValue); cursor = cursor->mNext; if (nsnull != cursor) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != cursor); } break; case eCSSProperty_font: if (HAS_VALUE(mFont,mSize)) { - if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_font_style, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_variant, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_font_weight, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_size, aValue); if (HAS_VALUE(mText,mLineHeight)) { - aValue.Append('/'); + aValue.AppendWithConversion('/'); AppendValueToString(eCSSProperty_line_height, aValue); } - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_font_family, aValue); } break; case eCSSProperty_list_style: - if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_list_style_type, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_list_style_position, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_list_style_image, aValue); break; case eCSSProperty_margin: if (HAS_RECT(mMargin,mMargin)) { - AppendValueToString(eCSSProperty_margin_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_margin_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_margin_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_margin_left, aValue); } break; case eCSSProperty_outline: - if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_outline_color, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_outline_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_outline_width, aValue); break; case eCSSProperty_padding: if (HAS_RECT(mMargin,mPadding)) { - AppendValueToString(eCSSProperty_padding_top, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_right, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_padding_top, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_right, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_padding_bottom, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_padding_left, aValue); } break; case eCSSProperty_pause: if (HAS_VALUE(mAural,mPauseAfter) && HAS_VALUE(mAural,mPauseBefore)) { AppendValueToString(eCSSProperty_pause_after, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_pause_before, aValue); } break; @@ -3467,13 +3467,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (mText->mTextShadow->mXOffset.IsLengthUnit()) { nsCSSShadow* shadow = mText->mTextShadow; while (nsnull != shadow) { - if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_color, shadow->mColor, aValue)) aValue.AppendWithConversion(' '); if (AppendValueToString(eCSSProperty_text_shadow_x, shadow->mXOffset, aValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_text_shadow_y, shadow->mYOffset, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); } - if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_text_shadow_radius, shadow->mRadius, aValue)) aValue.AppendWithConversion(' '); shadow = shadow->mNext; } } @@ -3485,67 +3485,67 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) case eCSSProperty_background_position: if (HAS_VALUE(mColor,mBackPositionX) && HAS_VALUE(mColor,mBackPositionY)) { AppendValueToString(eCSSProperty_background_x_position, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_background_y_position, aValue); } break; case eCSSProperty_border_top: - if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_top_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_top_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_top_color, aValue); break; case eCSSProperty_border_right: - if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_right_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_right_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_right_color, aValue); break; case eCSSProperty_border_bottom: - if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_bottom_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_bottom_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_bottom_color, aValue); break; case eCSSProperty_border_left: - if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.Append(' '); - if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.Append(' '); + if (AppendValueToString(eCSSProperty_border_left_width, aValue)) aValue.AppendWithConversion(' '); + if (AppendValueToString(eCSSProperty_border_left_style, aValue)) aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); break; case eCSSProperty_border_color: if (HAS_RECT(mMargin,mBorderColor)) { - AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_color, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_color, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_color, aValue); } break; case eCSSProperty_border_style: if (HAS_RECT(mMargin,mBorderStyle)) { - AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_style, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_style, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_style, aValue); } break; case eCSSProperty__moz_border_radius: if (HAS_RECT(mMargin,mBorderRadius)) { - AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_border_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_border_radius_bottomLeft, aValue); } break; case eCSSProperty__moz_outline_radius: if (HAS_RECT(mMargin,mOutlineRadius)) { - AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topLeft, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_topRight, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty__moz_outline_radius_bottomRight, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty__moz_outline_radius_bottomLeft, aValue); } break; case eCSSProperty_border_width: if (HAS_RECT(mMargin,mBorderWidth)) { - AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.Append(' '); - AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.Append(' '); + AppendValueToString(eCSSProperty_border_top_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_right_width, aValue); aValue.AppendWithConversion(' '); + AppendValueToString(eCSSProperty_border_bottom_width, aValue); aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_border_left_width, aValue); } break; @@ -3556,7 +3556,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_content, content->mValue, aValue); content = content->mNext; if (nsnull != content) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != content); } @@ -3567,13 +3567,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_increment, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_increment, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3584,13 +3584,13 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) do { if (AppendValueToString(eCSSProperty_counter_reset, data->mCounter, aValue)) { if (HAS_VALUE(data, mValue)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_counter_reset, data->mValue, aValue); } } data = data->mNext; if (nsnull != data) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != data); } @@ -3599,7 +3599,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) if (HAS_VALUE(mAural, mPlayDuring)) { AppendValueToString(eCSSProperty_play_during, aValue); if (HAS_VALUE(mAural, mPlayDuringFlags)) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_play_during_flags, aValue); } } @@ -3609,11 +3609,11 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) nsCSSQuotes* quotes = mContent->mQuotes; do { AppendValueToString(eCSSProperty_quotes_open, quotes->mOpen, aValue); - aValue.Append(' '); + aValue.AppendWithConversion(' '); AppendValueToString(eCSSProperty_quotes_close, quotes->mClose, aValue); quotes = quotes->mNext; if (nsnull != quotes) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != quotes); } @@ -3625,7 +3625,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue) AppendValueToString(eCSSProperty_key_equivalent, keyEquiv->mValue, aValue); keyEquiv = keyEquiv->mNext; if (nsnull != keyEquiv) { - aValue.Append(' '); + aValue.AppendWithConversion(' '); } } while (nsnull != keyEquiv); } @@ -3689,21 +3689,21 @@ CSSDeclarationImpl::ToString(nsString& aString) for (index = 0; index < count; index++) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(index); if (0 <= property) { - aString.Append(nsCSSProps::GetStringValue(property)); - aString.Append(": "); + aString.AppendWithConversion(nsCSSProps::GetStringValue(property)); + aString.AppendWithConversion(": "); nsAutoString value; GetValue(property, value); aString.Append(value); if (index < count) { - aString.Append("; "); + aString.AppendWithConversion("; "); } } else { // is comment - aString.Append("/* "); + aString.AppendWithConversion("/* "); nsString* comment = mComments->StringAt((-1) - property); aString.Append(*comment); - aString.Append(" */ "); + aString.AppendWithConversion(" */ "); } } } @@ -3858,7 +3858,7 @@ CSSDeclarationImpl::GetNthProperty(PRUint32 aIndex, nsString& aReturn) if (nsnull != mOrder) { nsCSSProperty property = (nsCSSProperty)(PRInt32)mOrder->ElementAt(aIndex); if (0 <= property) { - aReturn.Append(nsCSSProps::GetStringValue(property)); + aReturn.AppendWithConversion(nsCSSProps::GetStringValue(property)); } } diff --git a/mozilla/layout/style/nsCSSStyleRule.cpp b/mozilla/layout/style/nsCSSStyleRule.cpp index c143e993f26..d6e4d6a0fa4 100644 --- a/mozilla/layout/style/nsCSSStyleRule.cpp +++ b/mozilla/layout/style/nsCSSStyleRule.cpp @@ -3015,9 +3015,9 @@ static void ListNameSpace(FILE* out, nsINameSpaceManager*& aManager, PRInt32 aNa aManager->GetNameSpaceURI(aNameSpaceID, buffer); } else { - buffer = "{namespace ID: "; - buffer.Append(aNameSpaceID, 10); - buffer.Append("}"); + buffer.AssignWithConversion("{namespace ID: "); + buffer.AppendInt(aNameSpaceID, 10); + buffer.AppendWithConversion("}"); } fputs(buffer, out); fputs("|", out); @@ -3032,7 +3032,7 @@ static void ListSelector(FILE* out, const nsCSSSelector* aSelector) if (0 != aSelector->mOperator) { buffer.Truncate(); buffer.Append(aSelector->mOperator); - buffer.Append(" "); + buffer.AppendWithConversion(" "); fputs(buffer, out); } ListNameSpace(out, nameSpaceMgr, aSelector->mNameSpace); @@ -3097,9 +3097,9 @@ CSSStyleRuleImpl::List(FILE* out, PRInt32 aIndent) const nsAutoString buffer; - buffer.Append("weight: "); - buffer.Append(mWeight, 10); - buffer.Append(" "); + buffer.AppendWithConversion("weight: "); + buffer.AppendInt(mWeight, 10); + buffer.AppendWithConversion(" "); fputs(buffer, out); if (nsnull != mDeclaration) { mDeclaration->List(out); diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index 989da4b65ee..464cf03d786 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -1430,8 +1430,7 @@ CSSStyleSheetImpl::SetTitle(const nsString& aTitle) NS_IMETHODIMP CSSStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/css"); + aType.AssignWithConversion("text/css"); return NS_OK; } @@ -2025,8 +2024,7 @@ CSSStyleSheetImpl::SetModified(PRBool aModified) NS_IMETHODIMP CSSStyleSheetImpl::GetType(nsString& aType) { - aType.Truncate(); - aType.Append("text/css"); + aType.AssignWithConversion("text/css"); return NS_OK; } @@ -2084,7 +2082,7 @@ CSSStyleSheetImpl::GetHref(nsString& aHref) if (mInner && mInner->mURL) { char* str = nsnull; mInner->mURL->GetSpec(&str); - aHref = str; + aHref.AssignWithConversion(str); if (str) { nsCRT::free(str); } @@ -2119,7 +2117,7 @@ CSSStyleSheetImpl::GetMedia(nsString& aMedia) medium->ToString(buffer); aMedia.Append(buffer); if (index < count) { - aMedia.Append(", "); + aMedia.AppendWithConversion(", "); } } } diff --git a/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp b/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp index c635932d139..c3debf647ef 100644 --- a/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp @@ -628,16 +628,14 @@ HTMLCSSStyleSheetImpl::GetURL(nsIURI*& aURL) const NS_IMETHODIMP HTMLCSSStyleSheetImpl::GetTitle(nsString& aTitle) const { - aTitle.Truncate(); - aTitle.Append("Internal HTML/CSS Style Sheet"); + aTitle.AssignWithConversion("Internal HTML/CSS Style Sheet"); return NS_OK; } NS_IMETHODIMP HTMLCSSStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/html"); + aType.AssignWithConversion("text/html"); return NS_OK; } diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index 8d2532dbfdc..d2a0b87974b 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -1010,8 +1010,7 @@ HTMLStyleSheetImpl::GetTitle(nsString& aTitle) const NS_IMETHODIMP HTMLStyleSheetImpl::GetType(nsString& aType) const { - aType.Truncate(); - aType.Append("text/html"); + aType.AssignWithConversion("text/html"); return NS_OK; } diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp index d1e974f4c78..1f04a34d318 100644 --- a/mozilla/layout/style/nsStyleContext.cpp +++ b/mozilla/layout/style/nsStyleContext.cpp @@ -1526,7 +1526,7 @@ void StyleUserInterfaceImpl::ResetFrom(const nsStyleUserInterface* aParent, nsIP mUserSelect = NS_STYLE_USER_SELECT_AUTO; mKeyEquivalent = PRUnichar(0); // XXX what type should this be? mResizer = NS_STYLE_RESIZER_AUTO; - mBehavior = ""; + mBehavior.SetLength(0); } void StyleUserInterfaceImpl::SetFrom(const nsStyleUserInterface& aSource)