making string conversions explicit

This commit is contained in:
scc@netscape.com
2000-04-15 21:18:29 +00:00
parent 3315b3add0
commit dce90dfaff
57 changed files with 1153 additions and 1170 deletions

View File

@@ -1315,7 +1315,7 @@ nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, js
propName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID))); propName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID)));
if (propName.Length() > 2) if (propName.Length() > 2)
prefix.Assign(propName.GetUnicode(), 2); prefix.Assign(propName.GetUnicode(), 2);
if (prefix.Equals("on")) { if (prefix.EqualsWithConversion("on")) {
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(propName)); nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(propName));
nsIEventListenerManager *manager = nsnull; nsIEventListenerManager *manager = nsnull;
@@ -1932,7 +1932,7 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
} }
else { else {
absURLSpec = aURLSpec; absURLSpec.Assign(aURLSpec);
} }
// Now pass on absolute url to the click handler // Now pass on absolute url to the click handler
@@ -2373,8 +2373,8 @@ nsGenericContainerElement::ListAttributes(FILE* out) const
nsAutoString buffer; nsAutoString buffer;
if (kNameSpaceID_None != attr->mNameSpaceID) { // prefix namespace if (kNameSpaceID_None != attr->mNameSpaceID) { // prefix namespace
buffer.Append(attr->mNameSpaceID, 10); buffer.AppendInt(attr->mNameSpaceID, 10);
buffer.Append(':'); buffer.AppendWithConversion(':');
} }
// name // name
@@ -2383,7 +2383,7 @@ nsGenericContainerElement::ListAttributes(FILE* out) const
buffer.Append(name); buffer.Append(name);
// value // value
buffer.Append("="); buffer.AppendWithConversion("=");
buffer.Append(attr->mValue); buffer.Append(attr->mValue);
fputs(" ", out); fputs(" ", out);

View File

@@ -529,7 +529,7 @@ nsHTMLFormElement::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* a
// a different type of element (IMG, OBJECT, etc.) // a different type of element (IMG, OBJECT, etc.)
if ((nsnull == *aReturn) && (nsnull != mInner.mDocument) && (argc > 0)) { if ((nsnull == *aReturn) && (nsnull != mInner.mDocument) && (argc > 0)) {
char* str = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); char* str = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
nsAutoString name(str); nsAutoString name; name.AssignWithConversion(str);
nsCOMPtr<nsIScriptContext> scriptContext; nsCOMPtr<nsIScriptContext> scriptContext;
nsCOMPtr<nsIScriptGlobalObject> globalObject; nsCOMPtr<nsIScriptGlobalObject> globalObject;
mInner.mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject)); mInner.mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
@@ -614,7 +614,7 @@ nsHTMLFormElement::Resolve(JSContext *aContext, JSObject *aObj, jsval aID)
PRBool ret; PRBool ret;
JSObject* obj; JSObject* obj;
char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID)); char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID));
nsAutoString name(str); nsAutoString name; name.AssignWithConversion(str);
nsCOMPtr<nsIScriptContext> scriptContext; nsCOMPtr<nsIScriptContext> scriptContext;
nsresult result = NS_OK; nsresult result = NS_OK;
@@ -858,7 +858,7 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID, JSObject** aOb
nsCOMPtr<nsIScriptContext> scriptContext; nsCOMPtr<nsIScriptContext> scriptContext;
nsCOMPtr<nsIScriptObjectOwner> owner; nsCOMPtr<nsIScriptObjectOwner> owner;
char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID)); char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID));
nsAutoString name(str); nsAutoString name; name.AssignWithConversion(str);
nsCOMPtr<nsIDocument> document; nsCOMPtr<nsIDocument> document;
nsCOMPtr<nsIContent> form; nsCOMPtr<nsIContent> form;
@@ -905,7 +905,7 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID, JSObject** aOb
} }
// If it is, then get all radio buttons or checkboxes with the same name // If it is, then get all radio buttons or checkboxes with the same name
if (document && (type.Equals("Radio") || type.Equals("Checkbox"))) { if (document && (type.EqualsWithConversion("Radio") || type.EqualsWithConversion("Checkbox"))) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(document); nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(document);
if (htmlDoc) { if (htmlDoc) {
nsCOMPtr<nsIDOMNodeList> list; nsCOMPtr<nsIDOMNodeList> list;

View File

@@ -318,7 +318,7 @@ nsHTMLImageElement::GetHeight(nsString& aValue)
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
nsSize size; nsSize size;
imageFrame->GetIntrinsicImageSize(size); imageFrame->GetIntrinsicImageSize(size);
aValue.Append(size.height); aValue.AppendInt(size.height);
} }
} }
@@ -343,7 +343,7 @@ nsHTMLImageElement::GetWidth(nsString& aValue)
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
nsSize size; nsSize size;
imageFrame->GetIntrinsicImageSize(size); imageFrame->GetIntrinsicImageSize(size);
aValue.Append(size.width); aValue.AppendInt(size.width);
} }
} }
@@ -765,11 +765,11 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc)
if (nsnull != aBaseURL) { if (nsnull != aBaseURL) {
result = NS_MakeAbsoluteURI(url, aSrc, aBaseURL); result = NS_MakeAbsoluteURI(url, aSrc, aBaseURL);
if (NS_FAILED(result)) { if (NS_FAILED(result)) {
url = aSrc; url.Assign(aSrc);
} }
} }
else { else {
url = aSrc; url.Assign(aSrc);
} }
nsSize* specifiedSize = nsnull; nsSize* specifiedSize = nsnull;

View File

@@ -378,7 +378,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
nsAutoString value; nsAutoString value;
presState->GetStateProperty("value", aValue); presState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue);
} }
} }
@@ -429,7 +429,7 @@ nsHTMLInputElement::SetValue(const nsString& aValue)
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
presState->SetStateProperty("value", aValue); presState->SetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue);
} }
} }
return NS_OK; return NS_OK;
@@ -442,7 +442,7 @@ nsHTMLInputElement::SetValue(const nsString& aValue)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLInputElement::GetChecked(PRBool* aValue) nsHTMLInputElement::GetChecked(PRBool* aValue)
{ {
nsAutoString value("0"); nsAutoString value; value.AssignWithConversion("0");
nsIFormControlFrame* formControlFrame = nsnull; nsIFormControlFrame* formControlFrame = nsnull;
if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) { if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) {
if (nsnull != formControlFrame) { if (nsnull != formControlFrame) {
@@ -460,11 +460,11 @@ nsHTMLInputElement::GetChecked(PRBool* aValue)
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
presState->GetStateProperty("checked", value); presState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), value);
} }
} }
if (value.Equals("1")) if (value.EqualsWithConversion("1"))
*aValue = PR_TRUE; *aValue = PR_TRUE;
else else
*aValue = PR_FALSE; *aValue = PR_FALSE;
@@ -482,12 +482,8 @@ nsHTMLInputElement::SetPresStateChecked(nsIHTMLContent * aHTMLContent,
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
nsAutoString value; nsAutoString value; value.AssignWithConversion( aValue ? "1" : "0" );
if (PR_TRUE == aValue) presState->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), value);
value = "1";
else
value = "0";
presState->SetStateProperty("checked", value);
return NS_OK; return NS_OK;
} }
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -504,14 +500,14 @@ nsHTMLInputElement::SetChecked(PRBool aValue)
// if so, then return // if so, then return
nsAutoString checkedStr; nsAutoString checkedStr;
formControlFrame->GetProperty(nsHTMLAtoms::checked, checkedStr); formControlFrame->GetProperty(nsHTMLAtoms::checked, checkedStr);
if ((checkedStr.Equals("1") && aValue) || (checkedStr.Equals("0") && !aValue)) { if ((checkedStr.EqualsWithConversion("1") && aValue) || (checkedStr.EqualsWithConversion("0") && !aValue)) {
return NS_OK; return NS_OK;
} }
// the value is being toggled // the value is being toggled
nsIPresContext* presContext; nsIPresContext* presContext;
nsGenericHTMLElement::GetPresContext(this, &presContext); nsGenericHTMLElement::GetPresContext(this, &presContext);
formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, PR_TRUE == aValue?"1":"0"); formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2(PR_TRUE == aValue?"1":"0"));
NS_IF_RELEASE(presContext); NS_IF_RELEASE(presContext);
} }
else { else {
@@ -671,7 +667,7 @@ nsHTMLInputElement::Select()
{ {
nsCOMPtr<nsIPresContext> presContext; nsCOMPtr<nsIPresContext> presContext;
nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext)); nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext));
formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, nsAutoString());
return NS_OK; return NS_OK;
} }
} }

View File

@@ -69,26 +69,26 @@ public:
} }
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttribute(nsAutoString("for"), aReturn); return mInner.GetAttribute(NS_ConvertASCIItoUCS2("for"), aReturn);
} }
return mInner.GetAttribute(aName, aReturn); return mInner.GetAttribute(aName, aReturn);
} }
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.SetAttribute(nsAutoString("for"), aValue); return mInner.SetAttribute(NS_ConvertASCIItoUCS2("for"), aValue);
} }
return mInner.SetAttribute(aName, aValue); return mInner.SetAttribute(aName, aValue);
} }
NS_IMETHOD RemoveAttribute(const nsString& aName) { NS_IMETHOD RemoveAttribute(const nsString& aName) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.RemoveAttribute(nsAutoString("for")); return mInner.RemoveAttribute(NS_ConvertASCIItoUCS2("for"));
} }
return mInner.RemoveAttribute(aName); return mInner.RemoveAttribute(aName);
} }
NS_IMETHOD GetAttributeNode(const nsString& aName, NS_IMETHOD GetAttributeNode(const nsString& aName,
nsIDOMAttr** aReturn) { nsIDOMAttr** aReturn) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttributeNode(nsAutoString("for"), aReturn); return mInner.GetAttributeNode(NS_ConvertASCIItoUCS2("for"), aReturn);
} }
return mInner.GetAttributeNode(aName, aReturn); return mInner.GetAttributeNode(aName, aReturn);
} }

View File

@@ -258,12 +258,9 @@ nsHTMLOptionElement::GetSelected(PRBool* aValue)
PRInt32 indx; PRInt32 indx;
if (NS_OK == GetIndex(&indx)) { if (NS_OK == GetIndex(&indx)) {
nsString value; nsString value;
value.Append(indx, 10); // Save the index in base 10 value.AppendInt(indx, 10); // Save the index in base 10
formControlFrame->GetProperty(nsHTMLAtoms::selected, value); formControlFrame->GetProperty(nsHTMLAtoms::selected, value);
if (value.Equals("1")) *aValue = value.EqualsWithConversion("1");
*aValue = PR_TRUE;
else
*aValue = PR_FALSE;
} }
} }
return rv; return rv;

View File

@@ -177,7 +177,7 @@ MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Empty) { if (value.GetUnit() == eHTMLUnit_Empty) {
nsStyleFont* font = (nsStyleFont*) nsStyleFont* font = (nsStyleFont*)
aContext->GetMutableStyleData(eStyleStruct_Font); aContext->GetMutableStyleData(eStyleStruct_Font);
font->mFont.name = "serif"; font->mFont.name.AssignWithConversion("serif");
} }
} }
} }

View File

@@ -437,10 +437,10 @@ nsHTMLSelectElement::GetType(nsString& aType)
result = GetMultiple(&isMultiple); result = GetMultiple(&isMultiple);
if (NS_OK == result) { if (NS_OK == result) {
if (isMultiple) { if (isMultiple) {
aType.Assign("select-multiple"); aType.AssignWithConversion("select-multiple");
} }
else { else {
aType.Assign("select-one"); aType.AssignWithConversion("select-one");
} }
} }
@@ -509,7 +509,7 @@ nsHTMLSelectElement::GetSelectedIndex(PRInt32* aValue)
nsresult res = GetPresState(getter_AddRefs(presState), getter_AddRefs(value)); nsresult res = GetPresState(getter_AddRefs(presState), getter_AddRefs(value));
if (NS_SUCCEEDED(res) && presState) { if (NS_SUCCEEDED(res) && presState) {
nsCOMPtr<nsISupports> supp; nsCOMPtr<nsISupports> supp;
presState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp)); presState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp));
res = NS_ERROR_NULL_POINTER; res = NS_ERROR_NULL_POINTER;
if (supp) { if (supp) {
@@ -591,7 +591,7 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex)
nsIFormControlFrame* formControlFrame = nsnull; nsIFormControlFrame* formControlFrame = nsnull;
if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) {
nsString value; nsString value;
value.Append(aIndex, 10); value.AppendInt(aIndex, 10);
nsIPresContext* presContext; nsIPresContext* presContext;
nsGenericHTMLElement::GetPresContext(this, &presContext); nsGenericHTMLElement::GetPresContext(this, &presContext);
formControlFrame->SetProperty(presContext, nsHTMLAtoms::selectedindex, value); formControlFrame->SetProperty(presContext, nsHTMLAtoms::selectedindex, value);
@@ -659,7 +659,7 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex)
// If it is a new nsISupportsArray then // If it is a new nsISupportsArray then
// set it into the PresState // set it into the PresState
if (!doesExist) { if (!doesExist) {
presState->SetStatePropertyAsSupports("selecteditems", value); presState->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value);
} }
} // if } // if
} }
@@ -870,7 +870,7 @@ nsHTMLSelectElement::GetPresState(nsIPresState** aPresState, nsISupportsArray**
// check to see if there is already a supports // check to see if there is already a supports
nsISupports * supp; nsISupports * supp;
nsresult res = presState->GetStatePropertyAsSupports("selecteditems", &supp); nsresult res = presState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), &supp);
if (NS_SUCCEEDED(res) && supp != nsnull) { if (NS_SUCCEEDED(res) && supp != nsnull) {
if (NS_FAILED(supp->QueryInterface(NS_GET_IID(nsISupportsArray), (void**)aValueArray))) { if (NS_FAILED(supp->QueryInterface(NS_GET_IID(nsISupportsArray), (void**)aValueArray))) {
// Be paranoid - make sure it is zeroed out // Be paranoid - make sure it is zeroed out

View File

@@ -859,7 +859,7 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
/* attributes that are either empty, or pixels */ /* attributes that are either empty, or pixels */
else if (aAttribute == nsHTMLAtoms::border) { else if (aAttribute == nsHTMLAtoms::border) {
PRInt32 min = (aValue.Equals("")) ? 1 : 0; PRInt32 min = (aValue.IsEmpty()) ? 1 : 0;
if (nsGenericHTMLElement::ParseValue(aValue, min, aResult, eHTMLUnit_Pixel)) { if (nsGenericHTMLElement::ParseValue(aValue, min, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE; return NS_CONTENT_ATTR_HAS_VALUE;
} }

View File

@@ -340,7 +340,7 @@ nsHTMLTextAreaElement::Select()
{ {
nsCOMPtr<nsIPresContext> presContext; nsCOMPtr<nsIPresContext> presContext;
nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext)); nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext));
formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, nsAutoString());
return NS_OK; return NS_OK;
} }
} }
@@ -359,7 +359,7 @@ NS_IMPL_INT_ATTR(nsHTMLTextAreaElement, TabIndex, tabindex)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLTextAreaElement::GetType(nsString& aType) nsHTMLTextAreaElement::GetType(nsString& aType)
{ {
aType.Assign("textarea"); aType.AssignWithConversion("textarea");
return NS_OK; return NS_OK;
} }

View File

@@ -3458,7 +3458,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue)
case eCSSProperty_size: case eCSSProperty_size:
if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) {
AppendValueToString(eCSSProperty_size_width, aValue); AppendValueToString(eCSSProperty_size_width, aValue);
aValue.Append(' '); aValue.AppendWithConversion(' ');
AppendValueToString(eCSSProperty_size_height, aValue); AppendValueToString(eCSSProperty_size_height, aValue);
} }
break; break;

View File

@@ -3458,7 +3458,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue)
case eCSSProperty_size: case eCSSProperty_size:
if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) {
AppendValueToString(eCSSProperty_size_width, aValue); AppendValueToString(eCSSProperty_size_width, aValue);
aValue.Append(' '); aValue.AppendWithConversion(' ');
AppendValueToString(eCSSProperty_size_height, aValue); AppendValueToString(eCSSProperty_size_height, aValue);
} }
break; break;

View File

@@ -2372,12 +2372,12 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
if (start < end) { if (start < end) {
if (aCaseSensitive) { if (aCaseSensitive) {
if (aValue.Equals(value, start)) { if (nsCRT::strcmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
else { else {
if (aValue.EqualsIgnoreCase(value, start)) { if (nsCRT::strcasecmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
@@ -2413,12 +2413,12 @@ static PRBool ValueDashMatch(const nsString& aValueList, const nsString& aValue,
if (start < end) { if (start < end) {
if (aCaseSensitive) { if (aCaseSensitive) {
if (aValue.Equals(value, start)) { if (nsCRT::strcmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
else { else {
if (aValue.EqualsIgnoreCase(value, start)) { if (nsCRT::strcasecmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }

View File

@@ -283,93 +283,93 @@ void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const
} }
if (-1 < aPropID) { if (-1 < aPropID) {
aBuffer.Append(nsCSSProps::GetStringValue(aPropID)); aBuffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID));
aBuffer.Append(": "); aBuffer.AppendWithConversion(": ");
} }
if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) { if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) {
switch (mUnit) { switch (mUnit) {
case eCSSUnit_URL: aBuffer.Append("url("); break; case eCSSUnit_URL: aBuffer.AppendWithConversion("url("); break;
case eCSSUnit_Attr: aBuffer.Append("attr("); break; case eCSSUnit_Attr: aBuffer.AppendWithConversion("attr("); break;
case eCSSUnit_Counter: aBuffer.Append("counter("); break; case eCSSUnit_Counter: aBuffer.AppendWithConversion("counter("); break;
case eCSSUnit_Counters: aBuffer.Append("counters("); break; case eCSSUnit_Counters: aBuffer.AppendWithConversion("counters("); break;
default: break; default: break;
} }
if (nsnull != mValue.mString) { if (nsnull != mValue.mString) {
aBuffer.Append('"'); aBuffer.AppendWithConversion('"');
aBuffer.Append(*(mValue.mString)); aBuffer.Append(*(mValue.mString));
aBuffer.Append('"'); aBuffer.AppendWithConversion('"');
} }
else { else {
aBuffer.Append("null str"); aBuffer.AppendWithConversion("null str");
} }
} }
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) { else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
aBuffer.Append(mValue.mInt, 10); aBuffer.AppendInt(mValue.mInt, 10);
aBuffer.Append("[0x"); aBuffer.AppendWithConversion("[0x");
aBuffer.Append(mValue.mInt, 16); aBuffer.AppendInt(mValue.mInt, 16);
aBuffer.Append(']'); aBuffer.AppendWithConversion(']');
} }
else if (eCSSUnit_Color == mUnit){ else if (eCSSUnit_Color == mUnit){
aBuffer.Append("(0x"); aBuffer.AppendWithConversion("(0x");
aBuffer.Append(NS_GET_R(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_G(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_B(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_A(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16);
aBuffer.Append(')'); aBuffer.AppendWithConversion(')');
} }
else if (eCSSUnit_Percent == mUnit) { else if (eCSSUnit_Percent == mUnit) {
aBuffer.Append(mValue.mFloat * 100.0f); aBuffer.AppendFloat(mValue.mFloat * 100.0f);
} }
else if (eCSSUnit_Percent < mUnit) { else if (eCSSUnit_Percent < mUnit) {
aBuffer.Append(mValue.mFloat); aBuffer.AppendFloat(mValue.mFloat);
} }
switch (mUnit) { switch (mUnit) {
case eCSSUnit_Null: break; case eCSSUnit_Null: break;
case eCSSUnit_Auto: aBuffer.Append("auto"); break; case eCSSUnit_Auto: aBuffer.AppendWithConversion("auto"); break;
case eCSSUnit_Inherit: aBuffer.Append("inherit"); break; case eCSSUnit_Inherit: aBuffer.AppendWithConversion("inherit"); break;
case eCSSUnit_None: aBuffer.Append("none"); break; case eCSSUnit_None: aBuffer.AppendWithConversion("none"); break;
case eCSSUnit_Normal: aBuffer.Append("normal"); break; case eCSSUnit_Normal: aBuffer.AppendWithConversion("normal"); break;
case eCSSUnit_String: break; case eCSSUnit_String: break;
case eCSSUnit_URL: case eCSSUnit_URL:
case eCSSUnit_Attr: case eCSSUnit_Attr:
case eCSSUnit_Counter: case eCSSUnit_Counter:
case eCSSUnit_Counters: aBuffer.Append(')'); break; case eCSSUnit_Counters: aBuffer.AppendWithConversion(')'); break;
case eCSSUnit_Integer: aBuffer.Append("int"); break; case eCSSUnit_Integer: aBuffer.AppendWithConversion("int"); break;
case eCSSUnit_Enumerated: aBuffer.Append("enum"); break; case eCSSUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
case eCSSUnit_Color: aBuffer.Append("rbga"); break; case eCSSUnit_Color: aBuffer.AppendWithConversion("rbga"); break;
case eCSSUnit_Percent: aBuffer.Append("%"); break; case eCSSUnit_Percent: aBuffer.AppendWithConversion("%"); break;
case eCSSUnit_Number: aBuffer.Append("#"); break; case eCSSUnit_Number: aBuffer.AppendWithConversion("#"); break;
case eCSSUnit_Inch: aBuffer.Append("in"); break; case eCSSUnit_Inch: aBuffer.AppendWithConversion("in"); break;
case eCSSUnit_Foot: aBuffer.Append("ft"); break; case eCSSUnit_Foot: aBuffer.AppendWithConversion("ft"); break;
case eCSSUnit_Mile: aBuffer.Append("mi"); break; case eCSSUnit_Mile: aBuffer.AppendWithConversion("mi"); break;
case eCSSUnit_Millimeter: aBuffer.Append("mm"); break; case eCSSUnit_Millimeter: aBuffer.AppendWithConversion("mm"); break;
case eCSSUnit_Centimeter: aBuffer.Append("cm"); break; case eCSSUnit_Centimeter: aBuffer.AppendWithConversion("cm"); break;
case eCSSUnit_Meter: aBuffer.Append("m"); break; case eCSSUnit_Meter: aBuffer.AppendWithConversion("m"); break;
case eCSSUnit_Kilometer: aBuffer.Append("km"); break; case eCSSUnit_Kilometer: aBuffer.AppendWithConversion("km"); break;
case eCSSUnit_Point: aBuffer.Append("pt"); break; case eCSSUnit_Point: aBuffer.AppendWithConversion("pt"); break;
case eCSSUnit_Pica: aBuffer.Append("pc"); break; case eCSSUnit_Pica: aBuffer.AppendWithConversion("pc"); break;
case eCSSUnit_Didot: aBuffer.Append("dt"); break; case eCSSUnit_Didot: aBuffer.AppendWithConversion("dt"); break;
case eCSSUnit_Cicero: aBuffer.Append("cc"); break; case eCSSUnit_Cicero: aBuffer.AppendWithConversion("cc"); break;
case eCSSUnit_EM: aBuffer.Append("em"); break; case eCSSUnit_EM: aBuffer.AppendWithConversion("em"); break;
case eCSSUnit_EN: aBuffer.Append("en"); break; case eCSSUnit_EN: aBuffer.AppendWithConversion("en"); break;
case eCSSUnit_XHeight: aBuffer.Append("ex"); break; case eCSSUnit_XHeight: aBuffer.AppendWithConversion("ex"); break;
case eCSSUnit_CapHeight: aBuffer.Append("cap"); break; case eCSSUnit_CapHeight: aBuffer.AppendWithConversion("cap"); break;
case eCSSUnit_Char: aBuffer.Append("ch"); break; case eCSSUnit_Char: aBuffer.AppendWithConversion("ch"); break;
case eCSSUnit_Pixel: aBuffer.Append("px"); break; case eCSSUnit_Pixel: aBuffer.AppendWithConversion("px"); break;
case eCSSUnit_Degree: aBuffer.Append("deg"); break; case eCSSUnit_Degree: aBuffer.AppendWithConversion("deg"); break;
case eCSSUnit_Grad: aBuffer.Append("grad"); break; case eCSSUnit_Grad: aBuffer.AppendWithConversion("grad"); break;
case eCSSUnit_Radian: aBuffer.Append("rad"); break; case eCSSUnit_Radian: aBuffer.AppendWithConversion("rad"); break;
case eCSSUnit_Hertz: aBuffer.Append("Hz"); break; case eCSSUnit_Hertz: aBuffer.AppendWithConversion("Hz"); break;
case eCSSUnit_Kilohertz: aBuffer.Append("kHz"); break; case eCSSUnit_Kilohertz: aBuffer.AppendWithConversion("kHz"); break;
case eCSSUnit_Seconds: aBuffer.Append("s"); break; case eCSSUnit_Seconds: aBuffer.AppendWithConversion("s"); break;
case eCSSUnit_Milliseconds: aBuffer.Append("ms"); break; case eCSSUnit_Milliseconds: aBuffer.AppendWithConversion("ms"); break;
} }
aBuffer.Append(' '); aBuffer.AppendWithConversion(' ');
} }
void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const

File diff suppressed because it is too large Load Diff

View File

@@ -132,12 +132,12 @@ struct HTMLAttribute {
mAttribute->ToString(temp); mAttribute->ToString(temp);
aBuffer.Append(temp); aBuffer.Append(temp);
if (eHTMLUnit_Null != mValue.GetUnit()) { if (eHTMLUnit_Null != mValue.GetUnit()) {
aBuffer.Append(" = "); aBuffer.AppendWithConversion(" = ");
mValue.AppendToString(aBuffer); mValue.AppendToString(aBuffer);
} }
} }
else { else {
aBuffer.Append("null"); aBuffer.AppendWithConversion("null");
} }
} }
@@ -1514,7 +1514,7 @@ HTMLAttributesImpl::List(FILE* out, PRInt32 aIndent) const
nsAutoString buffer; nsAutoString buffer;
mAttrNames[index]->ToString(buffer); mAttrNames[index]->ToString(buffer);
if (eHTMLUnit_Null != value.GetUnit()) { if (eHTMLUnit_Null != value.GetUnit()) {
buffer.Append(" = "); buffer.AppendWithConversion(" = ");
value.AppendToString(buffer); value.AppendToString(buffer);
} }
fputs(buffer, out); fputs(buffer, out);

View File

@@ -155,7 +155,7 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI)
break; break;
if (!base.IsEmpty()) { if (!base.IsEmpty()) {
str = base.GetUnicode(); str.AssignWithConversion(base.GetUnicode());
rv = (*aURI)->SetRelativePath(str); rv = (*aURI)->SetRelativePath(str);
} }
break; break;
@@ -167,12 +167,12 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI)
} else { } else {
// We do not want to add double / delimiters (although the user is free to do so) // We do not want to add double / delimiters (although the user is free to do so)
if (value[value_len - 1] != '/') if (value[value_len - 1] != '/')
value += '/'; value.AppendWithConversion('/');
base = value + base; base.Insert(value, 0);
} }
} else { } else {
if (value[value_len - 1] != '/') if (value[value_len - 1] != '/')
value += '/'; // Add delimiter/make sure we treat this as dir value.AppendWithConversion'/'; // Add delimiter/make sure we treat this as dir
base = value; base = value;
} }
} }
@@ -212,7 +212,7 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
// to create an atom. // to create an atom.
if ((kNameSpaceID_XLink == aNameSpaceID) && if ((kNameSpaceID_XLink == aNameSpaceID) &&
(kTypeAtom == aName)) { (kTypeAtom == aName)) {
if (aValue.Equals(kSimpleAtom, PR_FALSE)) { if (aValue.EqualsWithConversion(kSimpleAtom, PR_FALSE)) {
// NOTE: This really is a link according to the XLink spec, // NOTE: This really is a link according to the XLink spec,
// we do not need to check other attributes. If there // we do not need to check other attributes. If there
// is no href attribute, then this link is simply // is no href attribute, then this link is simply
@@ -272,13 +272,13 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext,
} }
GetAttribute(kNameSpaceID_XLink, kShowAtom, show); GetAttribute(kNameSpaceID_XLink, kShowAtom, show);
// XXX Should probably do this using atoms // XXX Should probably do this using atoms
if (show.Equals("new")) { if (show.EqualsWithConversion("new")) {
verb = eLinkVerb_New; verb = eLinkVerb_New;
} }
else if (show.Equals("replace")) { else if (show.EqualsWithConversion("replace")) {
verb = eLinkVerb_Replace; verb = eLinkVerb_Replace;
} }
else if (show.Equals("embed")) { else if (show.EqualsWithConversion("embed")) {
verb = eLinkVerb_Embed; verb = eLinkVerb_Embed;
} }

View File

@@ -522,7 +522,7 @@ nsXMLContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
} }
*cp = '\0'; *cp = '\0';
PRInt32 ch; PRInt32 ch;
nsAutoString str(cbuf); nsAutoString str; str.AssignWithConversion(cbuf);
dtd->ConvertEntityToUnicode(str, &ch); dtd->ConvertEntityToUnicode(str, &ch);
if (ch < 0) { if (ch < 0) {
continue; continue;
@@ -567,7 +567,7 @@ nsXMLContentSink::AddAttributes(const nsIParserNode& aNode,
} }
if ((kNameSpaceID_XMLNS == nameSpaceID) && aIsHTML) { if ((kNameSpaceID_XMLNS == nameSpaceID) && aIsHTML) {
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);
name.Insert("xmlns:", 0); name.InsertWithConversion("xmlns:", 0);
nameAtom = NS_NewAtom(name); nameAtom = NS_NewAtom(name);
nameSpaceID = kNameSpaceID_HTML; // XXX this is wrong, but necessary until HTML can store other namespaces for attrs nameSpaceID = kNameSpaceID_HTML; // XXX this is wrong, but necessary until HTML can store other namespaces for attrs
} }
@@ -688,7 +688,7 @@ nsXMLContentSink::OpenContainer(const nsIParserNode& aNode)
mState = eXMLContentSinkState_InDocumentElement; mState = eXMLContentSinkState_InDocumentElement;
tag = aNode.GetText(); tag.Assign(aNode.GetText());
nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag)); nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag));
// We must register namespace declarations found in the attribute list // We must register namespace declarations found in the attribute list
@@ -784,7 +784,7 @@ nsXMLContentSink::CloseContainer(const nsIParserNode& aNode)
// no close tags for elements. // no close tags for elements.
PR_ASSERT(eXMLContentSinkState_InDocumentElement == mState); PR_ASSERT(eXMLContentSinkState_InDocumentElement == mState);
tag = aNode.GetText(); tag.Assign(aNode.GetText());
nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag)); nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag));
nameSpaceID = GetNameSpaceId(nameSpacePrefix); nameSpaceID = GetNameSpaceId(nameSpacePrefix);
isHTML = IsHTMLNameSpace(nameSpaceID); isHTML = IsHTMLNameSpace(nameSpaceID);
@@ -914,7 +914,7 @@ nsXMLContentSink::AddComment(const nsIParserNode& aNode)
nsIDOMComment *domComment; nsIDOMComment *domComment;
nsresult result = NS_OK; nsresult result = NS_OK;
text = aNode.GetText(); text.Assign(aNode.GetText());
result = NS_NewCommentNode(&comment); result = NS_NewCommentNode(&comment);
if (NS_OK == result) { if (NS_OK == result) {
result = comment->QueryInterface(kIDOMCommentIID, (void **)&domComment); result = comment->QueryInterface(kIDOMCommentIID, (void **)&domComment);
@@ -941,7 +941,7 @@ nsXMLContentSink::AddCDATASection(const nsIParserNode& aNode)
nsIDOMCDATASection *domCDATA; nsIDOMCDATASection *domCDATA;
nsresult result = NS_OK; nsresult result = NS_OK;
text = aNode.GetText(); text.Assign(aNode.GetText());
result = NS_NewXMLCDATASection(&cdata); result = NS_NewXMLCDATASection(&cdata);
if (NS_OK == result) { if (NS_OK == result) {
result = cdata->QueryInterface(kIDOMCDATASectionIID, (void **)&domCDATA); result = cdata->QueryInterface(kIDOMCDATASectionIID, (void **)&domCDATA);
@@ -1245,7 +1245,7 @@ nsXMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode)
FlushText(); FlushText();
text = aNode.GetText(); text.Assign(aNode.GetText());
ParseProcessingInstruction(text, target, data); ParseProcessingInstruction(text, target, data);
result = NS_NewXMLProcessingInstruction(&node, target, data); result = NS_NewXMLProcessingInstruction(&node, target, data);
if (NS_OK == result) { if (NS_OK == result) {
@@ -1257,28 +1257,28 @@ nsXMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode)
nsAutoString type, href, title, media, alternate; nsAutoString type, href, title, media, alternate;
// If it's a stylesheet PI... // If it's a stylesheet PI...
if (target.Equals(kStyleSheetPI)) { if (target.EqualsWithConversion(kStyleSheetPI)) {
result = GetQuotedAttributeValue(text, "href", href); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("href"), href);
// If there was an error or there's no href, we can't do // If there was an error or there's no href, we can't do
// anything with this PI // anything with this PI
if ((NS_OK != result) || (0 == href.Length())) { if ((NS_OK != result) || (0 == href.Length())) {
return result; return result;
} }
result = GetQuotedAttributeValue(text, "type", type); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("type"), type);
if (NS_FAILED(result)) { if (NS_FAILED(result)) {
type="text/css"; // Default the type attribute to the mime type for CSS type.AssignWithConversion("text/css"); // Default the type attribute to the mime type for CSS
} }
result = GetQuotedAttributeValue(text, "title", title); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("title"), title);
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
title.CompressWhitespace(); title.CompressWhitespace();
} }
result = GetQuotedAttributeValue(text, "media", media); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("media"), media);
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
media.ToLowerCase(); media.ToLowerCase();
} }
result = GetQuotedAttributeValue(text, "alternate", alternate); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("alternate"), alternate);
#ifndef XSL #ifndef XSL
result = ProcessCSSStyleLink(node, href, alternate.Equals("yes"), result = ProcessCSSStyleLink(node, href, alternate.EqualsWithConversion("yes"),
title, type, media); title, type, media);
#else #else
result = ProcessStyleLink(node, href, alternate.Equals("yes"), result = ProcessStyleLink(node, href, alternate.Equals("yes"),
@@ -1679,7 +1679,7 @@ nsXMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
const char* string) const char* string)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsString aData(string, stringLen); nsString aData; aData.AssignWithConversion(string, stringLen);
if (NS_OK == aStatus) { if (NS_OK == aStatus) {
rv = EvaluateScript(aData, 0, mScriptLanguageVersion); rv = EvaluateScript(aData, 0, mScriptLanguageVersion);
@@ -1890,7 +1890,7 @@ nsXMLContentSink::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aR
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace); gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX; nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
progID.Append(nameSpace); progID.AppendWithConversion(nameSpace);
// Retrieve the appropriate factory. // Retrieve the appropriate factory.
NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv); NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv);

View File

@@ -230,7 +230,7 @@ NS_IMETHODIMP
nsXMLDocument::GetContentType(nsString& aContentType) const nsXMLDocument::GetContentType(nsString& aContentType) const
{ {
// XXX Should get document type from incoming stream // XXX Should get document type from incoming stream
aContentType.Assign("text/xml"); aContentType.AssignWithConversion("text/xml");
return NS_OK; return NS_OK;
} }
@@ -249,7 +249,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
return rv; return rv;
} }
nsAutoString charset("UTF-8"); nsAutoString charset; charset.AssignWithConversion("UTF-8");
PRBool bIsHTML = PR_FALSE; PRBool bIsHTML = PR_FALSE;
char* aContentType; char* aContentType;
nsCharsetSource charsetSource = kCharsetFromDocTypeDefault; nsCharsetSource charsetSource = kCharsetFromDocTypeDefault;
@@ -276,7 +276,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(contentTypeKey); NS_RELEASE(contentTypeKey);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsAutoString contentType; nsAutoString contentType;
contentType.Assign(contenttypeheader); contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) );
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ; PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start) if(kNotFound != start)
{ {

View File

@@ -1315,7 +1315,7 @@ nsGenericElement::SetProperty(JSContext *aContext, JSObject *aObj, jsval aID, js
propName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID))); propName.Assign(JS_GetStringChars(JS_ValueToString(aContext, aID)));
if (propName.Length() > 2) if (propName.Length() > 2)
prefix.Assign(propName.GetUnicode(), 2); prefix.Assign(propName.GetUnicode(), 2);
if (prefix.Equals("on")) { if (prefix.EqualsWithConversion("on")) {
nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(propName)); nsCOMPtr<nsIAtom> atom = getter_AddRefs(NS_NewAtom(propName));
nsIEventListenerManager *manager = nsnull; nsIEventListenerManager *manager = nsnull;
@@ -1932,7 +1932,7 @@ nsGenericElement::TriggerLink(nsIPresContext* aPresContext,
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
} }
else { else {
absURLSpec = aURLSpec; absURLSpec.Assign(aURLSpec);
} }
// Now pass on absolute url to the click handler // Now pass on absolute url to the click handler
@@ -2373,8 +2373,8 @@ nsGenericContainerElement::ListAttributes(FILE* out) const
nsAutoString buffer; nsAutoString buffer;
if (kNameSpaceID_None != attr->mNameSpaceID) { // prefix namespace if (kNameSpaceID_None != attr->mNameSpaceID) { // prefix namespace
buffer.Append(attr->mNameSpaceID, 10); buffer.AppendInt(attr->mNameSpaceID, 10);
buffer.Append(':'); buffer.AppendWithConversion(':');
} }
// name // name
@@ -2383,7 +2383,7 @@ nsGenericContainerElement::ListAttributes(FILE* out) const
buffer.Append(name); buffer.Append(name);
// value // value
buffer.Append("="); buffer.AppendWithConversion("=");
buffer.Append(attr->mValue); buffer.Append(attr->mValue);
fputs(" ", out); fputs(" ", out);

View File

@@ -105,7 +105,7 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
// create text field // create text field
nsIAtom* tag = NS_NewAtom("input"); nsIAtom* tag = NS_NewAtom("input");
if (NS_OK == NS_NewHTMLInputElement(&mTextContent, tag)) { if (NS_OK == NS_NewHTMLInputElement(&mTextContent, tag)) {
mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("text"), PR_FALSE); mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE);
if (nsFormFrame::GetDisabled(this)) { if (nsFormFrame::GetDisabled(this)) {
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent); nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
if (textControl) { if (textControl) {
@@ -119,7 +119,7 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsIHTMLContent* browse = nsnull; nsIHTMLContent* browse = nsnull;
tag = NS_NewAtom("input"); tag = NS_NewAtom("input");
if (NS_OK == NS_NewHTMLInputElement(&browse, tag)) { if (NS_OK == NS_NewHTMLInputElement(&browse, tag)) {
browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE); browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
//browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, nsAutoString("browse..."), PR_FALSE); //browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, nsAutoString("browse..."), PR_FALSE);
aChildList.AppendElement(browse); aChildList.AppendElement(browse);
@@ -245,7 +245,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
nsIFileWidget *fileWidget = nsnull; nsIFileWidget *fileWidget = nsnull;
nsString title("File Upload"); nsString title; title.AssignWithConversion("File Upload");
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget); nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
if (fileWidget) { if (fileWidget) {
@@ -607,7 +607,7 @@ nsFileControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aStat
// This string will hold a single item, whether or not we're checked. // This string will hold a single item, whether or not we're checked.
nsAutoString stateString; nsAutoString stateString;
GetProperty(nsHTMLAtoms::value, stateString); GetProperty(nsHTMLAtoms::value, stateString);
(*aState)->SetStateProperty("checked", stateString); (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString);
return NS_OK; return NS_OK;
} }
@@ -616,7 +616,7 @@ NS_IMETHODIMP
nsFileControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState) nsFileControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState)
{ {
nsAutoString string; nsAutoString string;
aState->GetStateProperty("checked", string); aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string);
SetProperty(aPresContext, nsHTMLAtoms::value, string); SetProperty(aPresContext, nsHTMLAtoms::value, string);
return NS_OK; return NS_OK;

View File

@@ -169,13 +169,13 @@ nsHTMLButtonControlFrame::GetDefaultLabel(nsString& aString)
PRInt32 type; PRInt32 type;
GetType(&type); GetType(&type);
if (NS_FORM_BUTTON_BUTTON == type) { if (NS_FORM_BUTTON_BUTTON == type) {
aString = "Button"; aString.AssignWithConversion("Button");
} }
else if (NS_FORM_BUTTON_RESET == type) { else if (NS_FORM_BUTTON_RESET == type) {
aString = "Reset"; aString.AssignWithConversion("Reset");
} }
else if (NS_FORM_BUTTON_SUBMIT == type) { else if (NS_FORM_BUTTON_SUBMIT == type) {
aString = "Submit"; aString.AssignWithConversion("Submit");
} }
} }

View File

@@ -390,26 +390,24 @@ nsImageControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
char buf[20]; char buf[20];
aNumValues = 2; aNumValues = 2;
aValues[0].SetLength(0);
sprintf(&buf[0], "%d", mLastClickPoint.x); sprintf(&buf[0], "%d", mLastClickPoint.x);
aValues[0].Append(&buf[0]); aValues[0].AssignWithConversion(&buf[0]);
aValues[1].SetLength(0);
sprintf(&buf[0], "%d", mLastClickPoint.y); sprintf(&buf[0], "%d", mLastClickPoint.y);
aValues[1].Append(&buf[0]); aValues[1].AssignWithConversion(&buf[0]);
nsAutoString name; nsAutoString name;
nsresult result = GetName(&name); nsresult result = GetName(&name);
if (NS_CONTENT_ATTR_HAS_VALUE == result) { if (NS_CONTENT_ATTR_HAS_VALUE == result) {
aNames[0] = name; aNames[0] = name;
aNames[0].Append(".x"); aNames[0].AppendWithConversion(".x");
aNames[1] = name; aNames[1] = name;
aNames[1].Append(".y"); aNames[1].AppendWithConversion(".y");
} else { } else {
// If the Image Element has no name, simply return x and y // If the Image Element has no name, simply return x and y
// to Nav and IE compatability. // to Nav and IE compatability.
aNames[0] = "x"; aNames[0].AssignWithConversion("x");
aNames[1] = "y"; aNames[1].AssignWithConversion("y");
} }
return PR_TRUE; return PR_TRUE;

View File

@@ -267,7 +267,7 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
ordinal = 1; ordinal = 1;
} }
nsAutoString addOn, decStr; nsAutoString addOn, decStr;
decStr.AppendWithConversion(ordinal, 10); decStr.AppendInt(ordinal, 10);
PRIntn len = decStr.Length(); PRIntn len = decStr.Length();
const PRUnichar* dp = decStr.GetUnicode(); const PRUnichar* dp = decStr.GetUnicode();
const PRUnichar* end = dp + len; const PRUnichar* end = dp + len;
@@ -278,16 +278,16 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
romanPos--; romanPos--;
addOn.SetLength(0); addOn.SetLength(0);
switch(*dp) { switch(*dp) {
case '3': addOn.Append(achars[romanPos]); case '3': addOn.AppendWithConversion(achars[romanPos]);
case '2': addOn.Append(achars[romanPos]); case '2': addOn.AppendWithConversion(achars[romanPos]);
case '1': addOn.Append(achars[romanPos]); case '1': addOn.AppendWithConversion(achars[romanPos]);
break; break;
case '4': case '4':
addOn.Append(achars[romanPos]); addOn.AppendWithConversion(achars[romanPos]);
// FALLTHROUGH // FALLTHROUGH
case '5': case '6': case '5': case '6':
case '7': case '8': case '7': case '8':
addOn.Append(bchars[romanPos]); addOn.AppendWithConversion(bchars[romanPos]);
for(n=0;n<(*dp-'5');n++) { for(n=0;n<(*dp-'5');n++) {
addOn.Append(achars[romanPos]); addOn.Append(achars[romanPos]);
} }

View File

@@ -758,7 +758,7 @@ nsHTMLFrameInnerFrame::CreateDocShell(nsIPresContext* aPresContext,
value.Left(valuePiece, 7); value.Left(valuePiece, 7);
if (valuePiece.EqualsIgnoreCase("content") && if (valuePiece.EqualsIgnoreCase("content") &&
(value.Length() == 7 || (value.Length() == 7 ||
value.Mid(valuePiece, 7, 1) == 1 && valuePiece.Equals("-"))) value.Mid(valuePiece, 7, 1) == 1 && valuePiece.EqualsWithConversion("-")))
isContent = PR_TRUE; isContent = PR_TRUE;
} }
if (isContent) { if (isContent) {

View File

@@ -735,7 +735,7 @@ nsHTMLFramesetFrame::ParseRowColSpec(nsString& aSpec,
} }
// Translate value to an integer // Translate value to an integer
nsString token(""); nsString token;
aSpec.Mid(token, start, numberEnd - start); aSpec.Mid(token, start, numberEnd - start);
// Treat * as 1* // Treat * as 1*

View File

@@ -4460,7 +4460,7 @@ nsTextFrame::ToCString(nsString& aBuf, PRInt32* aTotalContentLength) const
aBuf.AppendWithConversion("\\t"); aBuf.AppendWithConversion("\\t");
} else if ((ch < ' ') || (ch >= 127)) { } else if ((ch < ' ') || (ch >= 127)) {
aBuf.AppendWithConversion("\\0"); aBuf.AppendWithConversion("\\0");
aBuf.AppendWithConversion((PRInt32)ch, 8); aBuf.AppendInt((PRInt32)ch, 8);
} else { } else {
aBuf.Append(ch); aBuf.Append(ch);
} }

View File

@@ -267,7 +267,7 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
ordinal = 1; ordinal = 1;
} }
nsAutoString addOn, decStr; nsAutoString addOn, decStr;
decStr.AppendWithConversion(ordinal, 10); decStr.AppendInt(ordinal, 10);
PRIntn len = decStr.Length(); PRIntn len = decStr.Length();
const PRUnichar* dp = decStr.GetUnicode(); const PRUnichar* dp = decStr.GetUnicode();
const PRUnichar* end = dp + len; const PRUnichar* end = dp + len;
@@ -278,16 +278,16 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
romanPos--; romanPos--;
addOn.SetLength(0); addOn.SetLength(0);
switch(*dp) { switch(*dp) {
case '3': addOn.Append(achars[romanPos]); case '3': addOn.AppendWithConversion(achars[romanPos]);
case '2': addOn.Append(achars[romanPos]); case '2': addOn.AppendWithConversion(achars[romanPos]);
case '1': addOn.Append(achars[romanPos]); case '1': addOn.AppendWithConversion(achars[romanPos]);
break; break;
case '4': case '4':
addOn.Append(achars[romanPos]); addOn.AppendWithConversion(achars[romanPos]);
// FALLTHROUGH // FALLTHROUGH
case '5': case '6': case '5': case '6':
case '7': case '8': case '7': case '8':
addOn.Append(bchars[romanPos]); addOn.AppendWithConversion(bchars[romanPos]);
for(n=0;n<(*dp-'5');n++) { for(n=0;n<(*dp-'5');n++) {
addOn.Append(achars[romanPos]); addOn.Append(achars[romanPos]);
} }

View File

@@ -4460,7 +4460,7 @@ nsTextFrame::ToCString(nsString& aBuf, PRInt32* aTotalContentLength) const
aBuf.AppendWithConversion("\\t"); aBuf.AppendWithConversion("\\t");
} else if ((ch < ' ') || (ch >= 127)) { } else if ((ch < ' ') || (ch >= 127)) {
aBuf.AppendWithConversion("\\0"); aBuf.AppendWithConversion("\\0");
aBuf.AppendWithConversion((PRInt32)ch, 8); aBuf.AppendInt((PRInt32)ch, 8);
} else { } else {
aBuf.Append(ch); aBuf.Append(ch);
} }

View File

@@ -529,7 +529,7 @@ nsHTMLFormElement::NamedItem(JSContext* cx, jsval* argv, PRUint32 argc, jsval* a
// a different type of element (IMG, OBJECT, etc.) // a different type of element (IMG, OBJECT, etc.)
if ((nsnull == *aReturn) && (nsnull != mInner.mDocument) && (argc > 0)) { if ((nsnull == *aReturn) && (nsnull != mInner.mDocument) && (argc > 0)) {
char* str = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); char* str = JS_GetStringBytes(JS_ValueToString(cx, argv[0]));
nsAutoString name(str); nsAutoString name; name.AssignWithConversion(str);
nsCOMPtr<nsIScriptContext> scriptContext; nsCOMPtr<nsIScriptContext> scriptContext;
nsCOMPtr<nsIScriptGlobalObject> globalObject; nsCOMPtr<nsIScriptGlobalObject> globalObject;
mInner.mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject)); mInner.mDocument->GetScriptGlobalObject(getter_AddRefs(globalObject));
@@ -614,7 +614,7 @@ nsHTMLFormElement::Resolve(JSContext *aContext, JSObject *aObj, jsval aID)
PRBool ret; PRBool ret;
JSObject* obj; JSObject* obj;
char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID)); char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID));
nsAutoString name(str); nsAutoString name; name.AssignWithConversion(str);
nsCOMPtr<nsIScriptContext> scriptContext; nsCOMPtr<nsIScriptContext> scriptContext;
nsresult result = NS_OK; nsresult result = NS_OK;
@@ -858,7 +858,7 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID, JSObject** aOb
nsCOMPtr<nsIScriptContext> scriptContext; nsCOMPtr<nsIScriptContext> scriptContext;
nsCOMPtr<nsIScriptObjectOwner> owner; nsCOMPtr<nsIScriptObjectOwner> owner;
char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID)); char* str = JS_GetStringBytes(JS_ValueToString(aContext, aID));
nsAutoString name(str); nsAutoString name; name.AssignWithConversion(str);
nsCOMPtr<nsIDocument> document; nsCOMPtr<nsIDocument> document;
nsCOMPtr<nsIContent> form; nsCOMPtr<nsIContent> form;
@@ -905,7 +905,7 @@ nsFormControlList::GetNamedObject(JSContext* aContext, jsval aID, JSObject** aOb
} }
// If it is, then get all radio buttons or checkboxes with the same name // If it is, then get all radio buttons or checkboxes with the same name
if (document && (type.Equals("Radio") || type.Equals("Checkbox"))) { if (document && (type.EqualsWithConversion("Radio") || type.EqualsWithConversion("Checkbox"))) {
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(document); nsCOMPtr<nsIDOMHTMLDocument> htmlDoc = do_QueryInterface(document);
if (htmlDoc) { if (htmlDoc) {
nsCOMPtr<nsIDOMNodeList> list; nsCOMPtr<nsIDOMNodeList> list;

View File

@@ -318,7 +318,7 @@ nsHTMLImageElement::GetHeight(nsString& aValue)
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
nsSize size; nsSize size;
imageFrame->GetIntrinsicImageSize(size); imageFrame->GetIntrinsicImageSize(size);
aValue.Append(size.height); aValue.AppendInt(size.height);
} }
} }
@@ -343,7 +343,7 @@ nsHTMLImageElement::GetWidth(nsString& aValue)
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
nsSize size; nsSize size;
imageFrame->GetIntrinsicImageSize(size); imageFrame->GetIntrinsicImageSize(size);
aValue.Append(size.width); aValue.AppendInt(size.width);
} }
} }
@@ -765,11 +765,11 @@ nsHTMLImageElement::SetSrcInner(nsIURI* aBaseURL, const nsString& aSrc)
if (nsnull != aBaseURL) { if (nsnull != aBaseURL) {
result = NS_MakeAbsoluteURI(url, aSrc, aBaseURL); result = NS_MakeAbsoluteURI(url, aSrc, aBaseURL);
if (NS_FAILED(result)) { if (NS_FAILED(result)) {
url = aSrc; url.Assign(aSrc);
} }
} }
else { else {
url = aSrc; url.Assign(aSrc);
} }
nsSize* specifiedSize = nsnull; nsSize* specifiedSize = nsnull;

View File

@@ -378,7 +378,7 @@ nsHTMLInputElement::GetValue(nsString& aValue)
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
nsAutoString value; nsAutoString value;
presState->GetStateProperty("value", aValue); presState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue);
} }
} }
@@ -429,7 +429,7 @@ nsHTMLInputElement::SetValue(const nsString& aValue)
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
presState->SetStateProperty("value", aValue); presState->SetStateProperty(NS_ConvertASCIItoUCS2("value"), aValue);
} }
} }
return NS_OK; return NS_OK;
@@ -442,7 +442,7 @@ nsHTMLInputElement::SetValue(const nsString& aValue)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLInputElement::GetChecked(PRBool* aValue) nsHTMLInputElement::GetChecked(PRBool* aValue)
{ {
nsAutoString value("0"); nsAutoString value; value.AssignWithConversion("0");
nsIFormControlFrame* formControlFrame = nsnull; nsIFormControlFrame* formControlFrame = nsnull;
if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) { if (NS_SUCCEEDED(nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame))) {
if (nsnull != formControlFrame) { if (nsnull != formControlFrame) {
@@ -460,11 +460,11 @@ nsHTMLInputElement::GetChecked(PRBool* aValue)
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
presState->GetStateProperty("checked", value); presState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), value);
} }
} }
if (value.Equals("1")) if (value.EqualsWithConversion("1"))
*aValue = PR_TRUE; *aValue = PR_TRUE;
else else
*aValue = PR_FALSE; *aValue = PR_FALSE;
@@ -482,12 +482,8 @@ nsHTMLInputElement::SetPresStateChecked(nsIHTMLContent * aHTMLContent,
// Obtain the value property from the presentation state. // Obtain the value property from the presentation state.
if (presState) { if (presState) {
nsAutoString value; nsAutoString value; value.AssignWithConversion( aValue ? "1" : "0" );
if (PR_TRUE == aValue) presState->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), value);
value = "1";
else
value = "0";
presState->SetStateProperty("checked", value);
return NS_OK; return NS_OK;
} }
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
@@ -504,14 +500,14 @@ nsHTMLInputElement::SetChecked(PRBool aValue)
// if so, then return // if so, then return
nsAutoString checkedStr; nsAutoString checkedStr;
formControlFrame->GetProperty(nsHTMLAtoms::checked, checkedStr); formControlFrame->GetProperty(nsHTMLAtoms::checked, checkedStr);
if ((checkedStr.Equals("1") && aValue) || (checkedStr.Equals("0") && !aValue)) { if ((checkedStr.EqualsWithConversion("1") && aValue) || (checkedStr.EqualsWithConversion("0") && !aValue)) {
return NS_OK; return NS_OK;
} }
// the value is being toggled // the value is being toggled
nsIPresContext* presContext; nsIPresContext* presContext;
nsGenericHTMLElement::GetPresContext(this, &presContext); nsGenericHTMLElement::GetPresContext(this, &presContext);
formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, PR_TRUE == aValue?"1":"0"); formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2(PR_TRUE == aValue?"1":"0"));
NS_IF_RELEASE(presContext); NS_IF_RELEASE(presContext);
} }
else { else {
@@ -671,7 +667,7 @@ nsHTMLInputElement::Select()
{ {
nsCOMPtr<nsIPresContext> presContext; nsCOMPtr<nsIPresContext> presContext;
nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext)); nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext));
formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, nsAutoString());
return NS_OK; return NS_OK;
} }
} }

View File

@@ -69,26 +69,26 @@ public:
} }
NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) { NS_IMETHOD GetAttribute(const nsString& aName, nsString& aReturn) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttribute(nsAutoString("for"), aReturn); return mInner.GetAttribute(NS_ConvertASCIItoUCS2("for"), aReturn);
} }
return mInner.GetAttribute(aName, aReturn); return mInner.GetAttribute(aName, aReturn);
} }
NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) { NS_IMETHOD SetAttribute(const nsString& aName, const nsString& aValue) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.SetAttribute(nsAutoString("for"), aValue); return mInner.SetAttribute(NS_ConvertASCIItoUCS2("for"), aValue);
} }
return mInner.SetAttribute(aName, aValue); return mInner.SetAttribute(aName, aValue);
} }
NS_IMETHOD RemoveAttribute(const nsString& aName) { NS_IMETHOD RemoveAttribute(const nsString& aName) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.RemoveAttribute(nsAutoString("for")); return mInner.RemoveAttribute(NS_ConvertASCIItoUCS2("for"));
} }
return mInner.RemoveAttribute(aName); return mInner.RemoveAttribute(aName);
} }
NS_IMETHOD GetAttributeNode(const nsString& aName, NS_IMETHOD GetAttributeNode(const nsString& aName,
nsIDOMAttr** aReturn) { nsIDOMAttr** aReturn) {
if (aName.EqualsIgnoreCase("htmlfor")) { if (aName.EqualsIgnoreCase("htmlfor")) {
return mInner.GetAttributeNode(nsAutoString("for"), aReturn); return mInner.GetAttributeNode(NS_ConvertASCIItoUCS2("for"), aReturn);
} }
return mInner.GetAttributeNode(aName, aReturn); return mInner.GetAttributeNode(aName, aReturn);
} }

View File

@@ -258,12 +258,9 @@ nsHTMLOptionElement::GetSelected(PRBool* aValue)
PRInt32 indx; PRInt32 indx;
if (NS_OK == GetIndex(&indx)) { if (NS_OK == GetIndex(&indx)) {
nsString value; nsString value;
value.Append(indx, 10); // Save the index in base 10 value.AppendInt(indx, 10); // Save the index in base 10
formControlFrame->GetProperty(nsHTMLAtoms::selected, value); formControlFrame->GetProperty(nsHTMLAtoms::selected, value);
if (value.Equals("1")) *aValue = value.EqualsWithConversion("1");
*aValue = PR_TRUE;
else
*aValue = PR_FALSE;
} }
} }
return rv; return rv;

View File

@@ -177,7 +177,7 @@ MapFontAttributesInto(const nsIHTMLMappedAttributes* aAttributes,
if (value.GetUnit() == eHTMLUnit_Empty) { if (value.GetUnit() == eHTMLUnit_Empty) {
nsStyleFont* font = (nsStyleFont*) nsStyleFont* font = (nsStyleFont*)
aContext->GetMutableStyleData(eStyleStruct_Font); aContext->GetMutableStyleData(eStyleStruct_Font);
font->mFont.name = "serif"; font->mFont.name.AssignWithConversion("serif");
} }
} }
} }

View File

@@ -437,10 +437,10 @@ nsHTMLSelectElement::GetType(nsString& aType)
result = GetMultiple(&isMultiple); result = GetMultiple(&isMultiple);
if (NS_OK == result) { if (NS_OK == result) {
if (isMultiple) { if (isMultiple) {
aType.Assign("select-multiple"); aType.AssignWithConversion("select-multiple");
} }
else { else {
aType.Assign("select-one"); aType.AssignWithConversion("select-one");
} }
} }
@@ -509,7 +509,7 @@ nsHTMLSelectElement::GetSelectedIndex(PRInt32* aValue)
nsresult res = GetPresState(getter_AddRefs(presState), getter_AddRefs(value)); nsresult res = GetPresState(getter_AddRefs(presState), getter_AddRefs(value));
if (NS_SUCCEEDED(res) && presState) { if (NS_SUCCEEDED(res) && presState) {
nsCOMPtr<nsISupports> supp; nsCOMPtr<nsISupports> supp;
presState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp)); presState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp));
res = NS_ERROR_NULL_POINTER; res = NS_ERROR_NULL_POINTER;
if (supp) { if (supp) {
@@ -591,7 +591,7 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex)
nsIFormControlFrame* formControlFrame = nsnull; nsIFormControlFrame* formControlFrame = nsnull;
if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) { if (NS_OK == nsGenericHTMLElement::GetPrimaryFrame(this, formControlFrame)) {
nsString value; nsString value;
value.Append(aIndex, 10); value.AppendInt(aIndex, 10);
nsIPresContext* presContext; nsIPresContext* presContext;
nsGenericHTMLElement::GetPresContext(this, &presContext); nsGenericHTMLElement::GetPresContext(this, &presContext);
formControlFrame->SetProperty(presContext, nsHTMLAtoms::selectedindex, value); formControlFrame->SetProperty(presContext, nsHTMLAtoms::selectedindex, value);
@@ -659,7 +659,7 @@ nsHTMLSelectElement::SetSelectedIndex(PRInt32 aIndex)
// If it is a new nsISupportsArray then // If it is a new nsISupportsArray then
// set it into the PresState // set it into the PresState
if (!doesExist) { if (!doesExist) {
presState->SetStatePropertyAsSupports("selecteditems", value); presState->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value);
} }
} // if } // if
} }
@@ -870,7 +870,7 @@ nsHTMLSelectElement::GetPresState(nsIPresState** aPresState, nsISupportsArray**
// check to see if there is already a supports // check to see if there is already a supports
nsISupports * supp; nsISupports * supp;
nsresult res = presState->GetStatePropertyAsSupports("selecteditems", &supp); nsresult res = presState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), &supp);
if (NS_SUCCEEDED(res) && supp != nsnull) { if (NS_SUCCEEDED(res) && supp != nsnull) {
if (NS_FAILED(supp->QueryInterface(NS_GET_IID(nsISupportsArray), (void**)aValueArray))) { if (NS_FAILED(supp->QueryInterface(NS_GET_IID(nsISupportsArray), (void**)aValueArray))) {
// Be paranoid - make sure it is zeroed out // Be paranoid - make sure it is zeroed out

View File

@@ -859,7 +859,7 @@ nsHTMLTableElement::StringToAttribute(nsIAtom* aAttribute,
/* attributes that are either empty, or pixels */ /* attributes that are either empty, or pixels */
else if (aAttribute == nsHTMLAtoms::border) { else if (aAttribute == nsHTMLAtoms::border) {
PRInt32 min = (aValue.Equals("")) ? 1 : 0; PRInt32 min = (aValue.IsEmpty()) ? 1 : 0;
if (nsGenericHTMLElement::ParseValue(aValue, min, aResult, eHTMLUnit_Pixel)) { if (nsGenericHTMLElement::ParseValue(aValue, min, aResult, eHTMLUnit_Pixel)) {
return NS_CONTENT_ATTR_HAS_VALUE; return NS_CONTENT_ATTR_HAS_VALUE;
} }

View File

@@ -340,7 +340,7 @@ nsHTMLTextAreaElement::Select()
{ {
nsCOMPtr<nsIPresContext> presContext; nsCOMPtr<nsIPresContext> presContext;
nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext)); nsGenericHTMLElement::GetPresContext(this, getter_AddRefs(presContext));
formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, ""); formControlFrame->SetProperty(presContext, nsHTMLAtoms::select, nsAutoString());
return NS_OK; return NS_OK;
} }
} }
@@ -359,7 +359,7 @@ NS_IMPL_INT_ATTR(nsHTMLTextAreaElement, TabIndex, tabindex)
NS_IMETHODIMP NS_IMETHODIMP
nsHTMLTextAreaElement::GetType(nsString& aType) nsHTMLTextAreaElement::GetType(nsString& aType)
{ {
aType.Assign("textarea"); aType.AssignWithConversion("textarea");
return NS_OK; return NS_OK;
} }

View File

@@ -758,7 +758,7 @@ nsHTMLFrameInnerFrame::CreateDocShell(nsIPresContext* aPresContext,
value.Left(valuePiece, 7); value.Left(valuePiece, 7);
if (valuePiece.EqualsIgnoreCase("content") && if (valuePiece.EqualsIgnoreCase("content") &&
(value.Length() == 7 || (value.Length() == 7 ||
value.Mid(valuePiece, 7, 1) == 1 && valuePiece.Equals("-"))) value.Mid(valuePiece, 7, 1) == 1 && valuePiece.EqualsWithConversion("-")))
isContent = PR_TRUE; isContent = PR_TRUE;
} }
if (isContent) { if (isContent) {

View File

@@ -735,7 +735,7 @@ nsHTMLFramesetFrame::ParseRowColSpec(nsString& aSpec,
} }
// Translate value to an integer // Translate value to an integer
nsString token(""); nsString token;
aSpec.Mid(token, start, numberEnd - start); aSpec.Mid(token, start, numberEnd - start);
// Treat * as 1* // Treat * as 1*

View File

@@ -105,7 +105,7 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
// create text field // create text field
nsIAtom* tag = NS_NewAtom("input"); nsIAtom* tag = NS_NewAtom("input");
if (NS_OK == NS_NewHTMLInputElement(&mTextContent, tag)) { if (NS_OK == NS_NewHTMLInputElement(&mTextContent, tag)) {
mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("text"), PR_FALSE); mTextContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE);
if (nsFormFrame::GetDisabled(this)) { if (nsFormFrame::GetDisabled(this)) {
nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent); nsCOMPtr<nsIDOMHTMLInputElement> textControl = do_QueryInterface(mTextContent);
if (textControl) { if (textControl) {
@@ -119,7 +119,7 @@ nsFileControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
nsIHTMLContent* browse = nsnull; nsIHTMLContent* browse = nsnull;
tag = NS_NewAtom("input"); tag = NS_NewAtom("input");
if (NS_OK == NS_NewHTMLInputElement(&browse, tag)) { if (NS_OK == NS_NewHTMLInputElement(&browse, tag)) {
browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE); browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE);
//browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, nsAutoString("browse..."), PR_FALSE); //browse->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, nsAutoString("browse..."), PR_FALSE);
aChildList.AppendElement(browse); aChildList.AppendElement(browse);
@@ -245,7 +245,7 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent)
nsIFileWidget *fileWidget = nsnull; nsIFileWidget *fileWidget = nsnull;
nsString title("File Upload"); nsString title; title.AssignWithConversion("File Upload");
nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget); nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget);
if (fileWidget) { if (fileWidget) {
@@ -607,7 +607,7 @@ nsFileControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aStat
// This string will hold a single item, whether or not we're checked. // This string will hold a single item, whether or not we're checked.
nsAutoString stateString; nsAutoString stateString;
GetProperty(nsHTMLAtoms::value, stateString); GetProperty(nsHTMLAtoms::value, stateString);
(*aState)->SetStateProperty("checked", stateString); (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString);
return NS_OK; return NS_OK;
} }
@@ -616,7 +616,7 @@ NS_IMETHODIMP
nsFileControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState) nsFileControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState)
{ {
nsAutoString string; nsAutoString string;
aState->GetStateProperty("checked", string); aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string);
SetProperty(aPresContext, nsHTMLAtoms::value, string); SetProperty(aPresContext, nsHTMLAtoms::value, string);
return NS_OK; return NS_OK;

View File

@@ -696,7 +696,7 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
NS_WITH_SERVICE(nsIObserverService, service, NS_OBSERVERSERVICE_PROGID, &result); NS_WITH_SERVICE(nsIObserverService, service, NS_OBSERVERSERVICE_PROGID, &result);
if (NS_FAILED(result)) return result; if (NS_FAILED(result)) return result;
nsString theTopic(NS_FORMSUBMIT_SUBJECT); nsString theTopic; theTopic.AssignWithConversion(NS_FORMSUBMIT_SUBJECT);
nsIEnumerator* theEnum; nsIEnumerator* theEnum;
result = service->EnumerateObserverList(theTopic.GetUnicode(), &theEnum); result = service->EnumerateObserverList(theTopic.GetUnicode(), &theEnum);
if (NS_SUCCEEDED(result) && theEnum){ if (NS_SUCCEEDED(result) && theEnum){
@@ -750,7 +750,7 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
// XUL, do nothing. This prevents undesirable reloading of // XUL, do nothing. This prevents undesirable reloading of
// a document inside XUL. // a document inside XUL.
if (href.Equals("")) { if (href.IsEmpty()) {
nsCOMPtr<nsIHTMLDocument> htmlDoc; nsCOMPtr<nsIHTMLDocument> htmlDoc;
if (PR_FALSE == NS_SUCCEEDED(doc->QueryInterface(kIHTMLDocumentIID, if (PR_FALSE == NS_SUCCEEDED(doc->QueryInterface(kIHTMLDocumentIID,
getter_AddRefs(htmlDoc)))) { getter_AddRefs(htmlDoc)))) {
@@ -765,7 +765,7 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
docURL->GetSpec(&relPath); docURL->GetSpec(&relPath);
NS_ASSERTION(relPath, "Rel path couldn't be formed in form submit!\n"); NS_ASSERTION(relPath, "Rel path couldn't be formed in form submit!\n");
if (relPath) { if (relPath) {
href.Append(relPath); href.AppendWithConversion(relPath);
nsCRT::free(relPath); nsCRT::free(relPath);
// If re-using the same URL, chop off old query string (bug 25330) // If re-using the same URL, chop off old query string (bug 25330)
@@ -816,15 +816,15 @@ nsFormFrame::OnSubmit(nsIPresContext* aPresContext, nsIFrame* aFrame)
if (NS_SUCCEEDED(result = NS_NewURI(getter_AddRefs(actionURL), href, docURL))) { if (NS_SUCCEEDED(result = NS_NewURI(getter_AddRefs(actionURL), href, docURL))) {
result = actionURL->GetScheme(getter_Copies(scheme)); result = actionURL->GetScheme(getter_Copies(scheme));
} }
nsAutoString theScheme(scheme); nsAutoString theScheme; theScheme.AssignWithConversion( NS_STATIC_CAST(const char*, scheme) );
// Append the URI encoded variable/value pairs for GET's // Append the URI encoded variable/value pairs for GET's
if (!theScheme.EqualsIgnoreCase("javascript")) { // Not for JS URIs, see bug 26917 if (!theScheme.EqualsIgnoreCase("javascript")) { // Not for JS URIs, see bug 26917
if (!isPost) { if (!isPost) {
if (href.FindChar('?', PR_FALSE, 0) == kNotFound) { // Add a ? if needed if (href.FindChar('?', PR_FALSE, 0) == kNotFound) { // Add a ? if needed
href.Append('?'); href.AppendWithConversion('?');
} else { // Adding to existing query string } else { // Adding to existing query string
if (href.Last() != '&' && href.Last() != '?') { // Add a & if needed if (href.Last() != '&' && href.Last() != '?') { // Add a & if needed
href.Append('&'); href.AppendWithConversion('&');
} }
} }
href.Append(data); href.Append(data);
@@ -937,7 +937,8 @@ nsFormFrame::URLEncode(const nsString& aString, nsIUnicodeEncoder* encoder)
delete [] inBuf; delete [] inBuf;
char* outBuf = nsEscape(convertedBuf, url_XPAlphas); char* outBuf = nsEscape(convertedBuf, url_XPAlphas);
nsString* result = new nsString(outBuf); nsString* result = new nsString;
result->AssignWithConversion(outBuf);
nsCRT::free(outBuf); nsCRT::free(outBuf);
nsAllocator::Free(convertedBuf); nsAllocator::Free(convertedBuf);
return result; return result;
@@ -945,7 +946,7 @@ nsFormFrame::URLEncode(const nsString& aString, nsIUnicodeEncoder* encoder)
void nsFormFrame::GetSubmitCharset(nsString& oCharset) void nsFormFrame::GetSubmitCharset(nsString& oCharset)
{ {
oCharset = "UTF-8"; // default to utf-8 oCharset.AssignWithConversion("UTF-8"); // default to utf-8
nsresult rv; nsresult rv;
// XXX // XXX
// We may want to get it from the HTML 4 Accept-Charset attribute first // We may want to get it from the HTML 4 Accept-Charset attribute first
@@ -1008,7 +1009,7 @@ NS_IMETHODIMP nsFormFrame::GetPlatformEncoder(nsIUnicodeEncoder** encoder)
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
NS_ASSERTION(0, "error getting locale charset, using ISO-8859-1"); NS_ASSERTION(0, "error getting locale charset, using ISO-8859-1");
localeCharset.SetString("ISO-8859-1"); localeCharset.AssignWithConversion("ISO-8859-1");
rv = NS_OK; rv = NS_OK;
} }
@@ -1058,14 +1059,14 @@ nsresult nsFormFrame::ProcessAsURLEncoded(nsIFormProcessor* aFormProcessor, PRBo
if (PR_TRUE == firstTime) { if (PR_TRUE == firstTime) {
firstTime = PR_FALSE; firstTime = PR_FALSE;
} else { } else {
buf += "&"; buf.AppendWithConversion("&");
} }
nsString* convName = URLEncode(names[valueX], encoder); nsString* convName = URLEncode(names[valueX], encoder);
buf += *convName; buf += *convName;
delete convName; delete convName;
buf += "="; buf.AppendWithConversion("=");
nsAutoString newValue; nsAutoString newValue;
newValue = values[valueX]; newValue.Append(values[valueX]);
if (aFormProcessor) { if (aFormProcessor) {
ProcessValue(*aFormProcessor, child, names[valueX], newValue); ProcessValue(*aFormProcessor, child, names[valueX], newValue);
} }
@@ -1084,23 +1085,23 @@ nsresult nsFormFrame::ProcessAsURLEncoded(nsIFormProcessor* aFormProcessor, PRBo
if (isPost) { if (isPost) {
char size[16]; char size[16];
sprintf(size, "%d", buf.Length()); sprintf(size, "%d", buf.Length());
aData = "Content-type: application/x-www-form-urlencoded"; aData.AssignWithConversion("Content-type: application/x-www-form-urlencoded");
#ifdef SPECIFY_CHARSET_IN_CONTENT_TYPE #ifdef SPECIFY_CHARSET_IN_CONTENT_TYPE
nsString charset; nsString charset;
GetSubmitCharset(charset); GetSubmitCharset(charset);
aData += "; charset="; aData += "; charset=";
aData += charset; aData += charset;
#endif #endif
aData += CRLF; aData.AppendWithConversion(CRLF);
aData += "Content-Length: "; aData.AppendWithConversion("Content-Length: ");
aData += size; aData.AppendWithConversion(size);
aData += CRLF; aData.AppendWithConversion(CRLF);
aData += CRLF; aData.AppendWithConversion(CRLF);
} }
aData += buf; aData += buf;
// Need to append CRLF to end of stream for compatability with Nav and IE // Need to append CRLF to end of stream for compatability with Nav and IE
if (isPost) { if (isPost) {
aData += CRLF; aData.AppendWithConversion(CRLF);
} }
NS_IF_RELEASE(encoder); NS_IF_RELEASE(encoder);
return rv; return rv;

View File

@@ -169,13 +169,13 @@ nsHTMLButtonControlFrame::GetDefaultLabel(nsString& aString)
PRInt32 type; PRInt32 type;
GetType(&type); GetType(&type);
if (NS_FORM_BUTTON_BUTTON == type) { if (NS_FORM_BUTTON_BUTTON == type) {
aString = "Button"; aString.AssignWithConversion("Button");
} }
else if (NS_FORM_BUTTON_RESET == type) { else if (NS_FORM_BUTTON_RESET == type) {
aString = "Reset"; aString.AssignWithConversion("Reset");
} }
else if (NS_FORM_BUTTON_SUBMIT == type) { else if (NS_FORM_BUTTON_SUBMIT == type) {
aString = "Submit"; aString.AssignWithConversion("Submit");
} }
} }

View File

@@ -390,26 +390,24 @@ nsImageControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValues,
char buf[20]; char buf[20];
aNumValues = 2; aNumValues = 2;
aValues[0].SetLength(0);
sprintf(&buf[0], "%d", mLastClickPoint.x); sprintf(&buf[0], "%d", mLastClickPoint.x);
aValues[0].Append(&buf[0]); aValues[0].AssignWithConversion(&buf[0]);
aValues[1].SetLength(0);
sprintf(&buf[0], "%d", mLastClickPoint.y); sprintf(&buf[0], "%d", mLastClickPoint.y);
aValues[1].Append(&buf[0]); aValues[1].AssignWithConversion(&buf[0]);
nsAutoString name; nsAutoString name;
nsresult result = GetName(&name); nsresult result = GetName(&name);
if (NS_CONTENT_ATTR_HAS_VALUE == result) { if (NS_CONTENT_ATTR_HAS_VALUE == result) {
aNames[0] = name; aNames[0] = name;
aNames[0].Append(".x"); aNames[0].AppendWithConversion(".x");
aNames[1] = name; aNames[1] = name;
aNames[1].Append(".y"); aNames[1].AppendWithConversion(".y");
} else { } else {
// If the Image Element has no name, simply return x and y // If the Image Element has no name, simply return x and y
// to Nav and IE compatability. // to Nav and IE compatability.
aNames[0] = "x"; aNames[0].AssignWithConversion("x");
aNames[1] = "y"; aNames[1].AssignWithConversion("y");
} }
return PR_TRUE; return PR_TRUE;

View File

@@ -3458,7 +3458,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue)
case eCSSProperty_size: case eCSSProperty_size:
if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) {
AppendValueToString(eCSSProperty_size_width, aValue); AppendValueToString(eCSSProperty_size_width, aValue);
aValue.Append(' '); aValue.AppendWithConversion(' ');
AppendValueToString(eCSSProperty_size_height, aValue); AppendValueToString(eCSSProperty_size_height, aValue);
} }
break; break;

View File

@@ -2372,12 +2372,12 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
if (start < end) { if (start < end) {
if (aCaseSensitive) { if (aCaseSensitive) {
if (aValue.Equals(value, start)) { if (nsCRT::strcmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
else { else {
if (aValue.EqualsIgnoreCase(value, start)) { if (nsCRT::strcasecmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
@@ -2413,12 +2413,12 @@ static PRBool ValueDashMatch(const nsString& aValueList, const nsString& aValue,
if (start < end) { if (start < end) {
if (aCaseSensitive) { if (aCaseSensitive) {
if (aValue.Equals(value, start)) { if (nsCRT::strcmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
else { else {
if (aValue.EqualsIgnoreCase(value, start)) { if (nsCRT::strcasecmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }

View File

@@ -283,93 +283,93 @@ void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const
} }
if (-1 < aPropID) { if (-1 < aPropID) {
aBuffer.Append(nsCSSProps::GetStringValue(aPropID)); aBuffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID));
aBuffer.Append(": "); aBuffer.AppendWithConversion(": ");
} }
if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) { if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) {
switch (mUnit) { switch (mUnit) {
case eCSSUnit_URL: aBuffer.Append("url("); break; case eCSSUnit_URL: aBuffer.AppendWithConversion("url("); break;
case eCSSUnit_Attr: aBuffer.Append("attr("); break; case eCSSUnit_Attr: aBuffer.AppendWithConversion("attr("); break;
case eCSSUnit_Counter: aBuffer.Append("counter("); break; case eCSSUnit_Counter: aBuffer.AppendWithConversion("counter("); break;
case eCSSUnit_Counters: aBuffer.Append("counters("); break; case eCSSUnit_Counters: aBuffer.AppendWithConversion("counters("); break;
default: break; default: break;
} }
if (nsnull != mValue.mString) { if (nsnull != mValue.mString) {
aBuffer.Append('"'); aBuffer.AppendWithConversion('"');
aBuffer.Append(*(mValue.mString)); aBuffer.Append(*(mValue.mString));
aBuffer.Append('"'); aBuffer.AppendWithConversion('"');
} }
else { else {
aBuffer.Append("null str"); aBuffer.AppendWithConversion("null str");
} }
} }
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) { else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
aBuffer.Append(mValue.mInt, 10); aBuffer.AppendInt(mValue.mInt, 10);
aBuffer.Append("[0x"); aBuffer.AppendWithConversion("[0x");
aBuffer.Append(mValue.mInt, 16); aBuffer.AppendInt(mValue.mInt, 16);
aBuffer.Append(']'); aBuffer.AppendWithConversion(']');
} }
else if (eCSSUnit_Color == mUnit){ else if (eCSSUnit_Color == mUnit){
aBuffer.Append("(0x"); aBuffer.AppendWithConversion("(0x");
aBuffer.Append(NS_GET_R(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_G(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_B(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_A(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16);
aBuffer.Append(')'); aBuffer.AppendWithConversion(')');
} }
else if (eCSSUnit_Percent == mUnit) { else if (eCSSUnit_Percent == mUnit) {
aBuffer.Append(mValue.mFloat * 100.0f); aBuffer.AppendFloat(mValue.mFloat * 100.0f);
} }
else if (eCSSUnit_Percent < mUnit) { else if (eCSSUnit_Percent < mUnit) {
aBuffer.Append(mValue.mFloat); aBuffer.AppendFloat(mValue.mFloat);
} }
switch (mUnit) { switch (mUnit) {
case eCSSUnit_Null: break; case eCSSUnit_Null: break;
case eCSSUnit_Auto: aBuffer.Append("auto"); break; case eCSSUnit_Auto: aBuffer.AppendWithConversion("auto"); break;
case eCSSUnit_Inherit: aBuffer.Append("inherit"); break; case eCSSUnit_Inherit: aBuffer.AppendWithConversion("inherit"); break;
case eCSSUnit_None: aBuffer.Append("none"); break; case eCSSUnit_None: aBuffer.AppendWithConversion("none"); break;
case eCSSUnit_Normal: aBuffer.Append("normal"); break; case eCSSUnit_Normal: aBuffer.AppendWithConversion("normal"); break;
case eCSSUnit_String: break; case eCSSUnit_String: break;
case eCSSUnit_URL: case eCSSUnit_URL:
case eCSSUnit_Attr: case eCSSUnit_Attr:
case eCSSUnit_Counter: case eCSSUnit_Counter:
case eCSSUnit_Counters: aBuffer.Append(')'); break; case eCSSUnit_Counters: aBuffer.AppendWithConversion(')'); break;
case eCSSUnit_Integer: aBuffer.Append("int"); break; case eCSSUnit_Integer: aBuffer.AppendWithConversion("int"); break;
case eCSSUnit_Enumerated: aBuffer.Append("enum"); break; case eCSSUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
case eCSSUnit_Color: aBuffer.Append("rbga"); break; case eCSSUnit_Color: aBuffer.AppendWithConversion("rbga"); break;
case eCSSUnit_Percent: aBuffer.Append("%"); break; case eCSSUnit_Percent: aBuffer.AppendWithConversion("%"); break;
case eCSSUnit_Number: aBuffer.Append("#"); break; case eCSSUnit_Number: aBuffer.AppendWithConversion("#"); break;
case eCSSUnit_Inch: aBuffer.Append("in"); break; case eCSSUnit_Inch: aBuffer.AppendWithConversion("in"); break;
case eCSSUnit_Foot: aBuffer.Append("ft"); break; case eCSSUnit_Foot: aBuffer.AppendWithConversion("ft"); break;
case eCSSUnit_Mile: aBuffer.Append("mi"); break; case eCSSUnit_Mile: aBuffer.AppendWithConversion("mi"); break;
case eCSSUnit_Millimeter: aBuffer.Append("mm"); break; case eCSSUnit_Millimeter: aBuffer.AppendWithConversion("mm"); break;
case eCSSUnit_Centimeter: aBuffer.Append("cm"); break; case eCSSUnit_Centimeter: aBuffer.AppendWithConversion("cm"); break;
case eCSSUnit_Meter: aBuffer.Append("m"); break; case eCSSUnit_Meter: aBuffer.AppendWithConversion("m"); break;
case eCSSUnit_Kilometer: aBuffer.Append("km"); break; case eCSSUnit_Kilometer: aBuffer.AppendWithConversion("km"); break;
case eCSSUnit_Point: aBuffer.Append("pt"); break; case eCSSUnit_Point: aBuffer.AppendWithConversion("pt"); break;
case eCSSUnit_Pica: aBuffer.Append("pc"); break; case eCSSUnit_Pica: aBuffer.AppendWithConversion("pc"); break;
case eCSSUnit_Didot: aBuffer.Append("dt"); break; case eCSSUnit_Didot: aBuffer.AppendWithConversion("dt"); break;
case eCSSUnit_Cicero: aBuffer.Append("cc"); break; case eCSSUnit_Cicero: aBuffer.AppendWithConversion("cc"); break;
case eCSSUnit_EM: aBuffer.Append("em"); break; case eCSSUnit_EM: aBuffer.AppendWithConversion("em"); break;
case eCSSUnit_EN: aBuffer.Append("en"); break; case eCSSUnit_EN: aBuffer.AppendWithConversion("en"); break;
case eCSSUnit_XHeight: aBuffer.Append("ex"); break; case eCSSUnit_XHeight: aBuffer.AppendWithConversion("ex"); break;
case eCSSUnit_CapHeight: aBuffer.Append("cap"); break; case eCSSUnit_CapHeight: aBuffer.AppendWithConversion("cap"); break;
case eCSSUnit_Char: aBuffer.Append("ch"); break; case eCSSUnit_Char: aBuffer.AppendWithConversion("ch"); break;
case eCSSUnit_Pixel: aBuffer.Append("px"); break; case eCSSUnit_Pixel: aBuffer.AppendWithConversion("px"); break;
case eCSSUnit_Degree: aBuffer.Append("deg"); break; case eCSSUnit_Degree: aBuffer.AppendWithConversion("deg"); break;
case eCSSUnit_Grad: aBuffer.Append("grad"); break; case eCSSUnit_Grad: aBuffer.AppendWithConversion("grad"); break;
case eCSSUnit_Radian: aBuffer.Append("rad"); break; case eCSSUnit_Radian: aBuffer.AppendWithConversion("rad"); break;
case eCSSUnit_Hertz: aBuffer.Append("Hz"); break; case eCSSUnit_Hertz: aBuffer.AppendWithConversion("Hz"); break;
case eCSSUnit_Kilohertz: aBuffer.Append("kHz"); break; case eCSSUnit_Kilohertz: aBuffer.AppendWithConversion("kHz"); break;
case eCSSUnit_Seconds: aBuffer.Append("s"); break; case eCSSUnit_Seconds: aBuffer.AppendWithConversion("s"); break;
case eCSSUnit_Milliseconds: aBuffer.Append("ms"); break; case eCSSUnit_Milliseconds: aBuffer.AppendWithConversion("ms"); break;
} }
aBuffer.Append(' '); aBuffer.AppendWithConversion(' ');
} }
void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const

File diff suppressed because it is too large Load Diff

View File

@@ -132,12 +132,12 @@ struct HTMLAttribute {
mAttribute->ToString(temp); mAttribute->ToString(temp);
aBuffer.Append(temp); aBuffer.Append(temp);
if (eHTMLUnit_Null != mValue.GetUnit()) { if (eHTMLUnit_Null != mValue.GetUnit()) {
aBuffer.Append(" = "); aBuffer.AppendWithConversion(" = ");
mValue.AppendToString(aBuffer); mValue.AppendToString(aBuffer);
} }
} }
else { else {
aBuffer.Append("null"); aBuffer.AppendWithConversion("null");
} }
} }
@@ -1514,7 +1514,7 @@ HTMLAttributesImpl::List(FILE* out, PRInt32 aIndent) const
nsAutoString buffer; nsAutoString buffer;
mAttrNames[index]->ToString(buffer); mAttrNames[index]->ToString(buffer);
if (eHTMLUnit_Null != value.GetUnit()) { if (eHTMLUnit_Null != value.GetUnit()) {
buffer.Append(" = "); buffer.AppendWithConversion(" = ");
value.AppendToString(buffer); value.AppendToString(buffer);
} }
fputs(buffer, out); fputs(buffer, out);

View File

@@ -3458,7 +3458,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue)
case eCSSProperty_size: case eCSSProperty_size:
if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) {
AppendValueToString(eCSSProperty_size_width, aValue); AppendValueToString(eCSSProperty_size_width, aValue);
aValue.Append(' '); aValue.AppendWithConversion(' ');
AppendValueToString(eCSSProperty_size_height, aValue); AppendValueToString(eCSSProperty_size_height, aValue);
} }
break; break;

View File

@@ -3458,7 +3458,7 @@ CSSDeclarationImpl::GetValue(nsCSSProperty aProperty, nsString& aValue)
case eCSSProperty_size: case eCSSProperty_size:
if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) { if (HAS_VALUE(mPage,mSizeWidth) && HAS_VALUE(mPage,mSizeHeight)) {
AppendValueToString(eCSSProperty_size_width, aValue); AppendValueToString(eCSSProperty_size_width, aValue);
aValue.Append(' '); aValue.AppendWithConversion(' ');
AppendValueToString(eCSSProperty_size_height, aValue); AppendValueToString(eCSSProperty_size_height, aValue);
} }
break; break;

View File

@@ -2372,12 +2372,12 @@ static PRBool ValueIncludes(const nsString& aValueList, const nsString& aValue,
if (start < end) { if (start < end) {
if (aCaseSensitive) { if (aCaseSensitive) {
if (aValue.Equals(value, start)) { if (nsCRT::strcmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
else { else {
if (aValue.EqualsIgnoreCase(value, start)) { if (nsCRT::strcasecmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
@@ -2413,12 +2413,12 @@ static PRBool ValueDashMatch(const nsString& aValueList, const nsString& aValue,
if (start < end) { if (start < end) {
if (aCaseSensitive) { if (aCaseSensitive) {
if (aValue.Equals(value, start)) { if (nsCRT::strcmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }
else { else {
if (aValue.EqualsIgnoreCase(value, start)) { if (nsCRT::strcasecmp(value, start)) {
return PR_TRUE; return PR_TRUE;
} }
} }

View File

@@ -283,93 +283,93 @@ void nsCSSValue::AppendToString(nsString& aBuffer, nsCSSProperty aPropID) const
} }
if (-1 < aPropID) { if (-1 < aPropID) {
aBuffer.Append(nsCSSProps::GetStringValue(aPropID)); aBuffer.AppendWithConversion(nsCSSProps::GetStringValue(aPropID));
aBuffer.Append(": "); aBuffer.AppendWithConversion(": ");
} }
if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) { if ((eCSSUnit_String <= mUnit) && (mUnit <= eCSSUnit_Counters)) {
switch (mUnit) { switch (mUnit) {
case eCSSUnit_URL: aBuffer.Append("url("); break; case eCSSUnit_URL: aBuffer.AppendWithConversion("url("); break;
case eCSSUnit_Attr: aBuffer.Append("attr("); break; case eCSSUnit_Attr: aBuffer.AppendWithConversion("attr("); break;
case eCSSUnit_Counter: aBuffer.Append("counter("); break; case eCSSUnit_Counter: aBuffer.AppendWithConversion("counter("); break;
case eCSSUnit_Counters: aBuffer.Append("counters("); break; case eCSSUnit_Counters: aBuffer.AppendWithConversion("counters("); break;
default: break; default: break;
} }
if (nsnull != mValue.mString) { if (nsnull != mValue.mString) {
aBuffer.Append('"'); aBuffer.AppendWithConversion('"');
aBuffer.Append(*(mValue.mString)); aBuffer.Append(*(mValue.mString));
aBuffer.Append('"'); aBuffer.AppendWithConversion('"');
} }
else { else {
aBuffer.Append("null str"); aBuffer.AppendWithConversion("null str");
} }
} }
else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) { else if ((eCSSUnit_Integer <= mUnit) && (mUnit <= eCSSUnit_Enumerated)) {
aBuffer.Append(mValue.mInt, 10); aBuffer.AppendInt(mValue.mInt, 10);
aBuffer.Append("[0x"); aBuffer.AppendWithConversion("[0x");
aBuffer.Append(mValue.mInt, 16); aBuffer.AppendInt(mValue.mInt, 16);
aBuffer.Append(']'); aBuffer.AppendWithConversion(']');
} }
else if (eCSSUnit_Color == mUnit){ else if (eCSSUnit_Color == mUnit){
aBuffer.Append("(0x"); aBuffer.AppendWithConversion("(0x");
aBuffer.Append(NS_GET_R(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_R(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_G(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_G(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_B(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_B(mValue.mColor), 16);
aBuffer.Append(" 0x"); aBuffer.AppendWithConversion(" 0x");
aBuffer.Append(NS_GET_A(mValue.mColor), 16); aBuffer.AppendInt(NS_GET_A(mValue.mColor), 16);
aBuffer.Append(')'); aBuffer.AppendWithConversion(')');
} }
else if (eCSSUnit_Percent == mUnit) { else if (eCSSUnit_Percent == mUnit) {
aBuffer.Append(mValue.mFloat * 100.0f); aBuffer.AppendFloat(mValue.mFloat * 100.0f);
} }
else if (eCSSUnit_Percent < mUnit) { else if (eCSSUnit_Percent < mUnit) {
aBuffer.Append(mValue.mFloat); aBuffer.AppendFloat(mValue.mFloat);
} }
switch (mUnit) { switch (mUnit) {
case eCSSUnit_Null: break; case eCSSUnit_Null: break;
case eCSSUnit_Auto: aBuffer.Append("auto"); break; case eCSSUnit_Auto: aBuffer.AppendWithConversion("auto"); break;
case eCSSUnit_Inherit: aBuffer.Append("inherit"); break; case eCSSUnit_Inherit: aBuffer.AppendWithConversion("inherit"); break;
case eCSSUnit_None: aBuffer.Append("none"); break; case eCSSUnit_None: aBuffer.AppendWithConversion("none"); break;
case eCSSUnit_Normal: aBuffer.Append("normal"); break; case eCSSUnit_Normal: aBuffer.AppendWithConversion("normal"); break;
case eCSSUnit_String: break; case eCSSUnit_String: break;
case eCSSUnit_URL: case eCSSUnit_URL:
case eCSSUnit_Attr: case eCSSUnit_Attr:
case eCSSUnit_Counter: case eCSSUnit_Counter:
case eCSSUnit_Counters: aBuffer.Append(')'); break; case eCSSUnit_Counters: aBuffer.AppendWithConversion(')'); break;
case eCSSUnit_Integer: aBuffer.Append("int"); break; case eCSSUnit_Integer: aBuffer.AppendWithConversion("int"); break;
case eCSSUnit_Enumerated: aBuffer.Append("enum"); break; case eCSSUnit_Enumerated: aBuffer.AppendWithConversion("enum"); break;
case eCSSUnit_Color: aBuffer.Append("rbga"); break; case eCSSUnit_Color: aBuffer.AppendWithConversion("rbga"); break;
case eCSSUnit_Percent: aBuffer.Append("%"); break; case eCSSUnit_Percent: aBuffer.AppendWithConversion("%"); break;
case eCSSUnit_Number: aBuffer.Append("#"); break; case eCSSUnit_Number: aBuffer.AppendWithConversion("#"); break;
case eCSSUnit_Inch: aBuffer.Append("in"); break; case eCSSUnit_Inch: aBuffer.AppendWithConversion("in"); break;
case eCSSUnit_Foot: aBuffer.Append("ft"); break; case eCSSUnit_Foot: aBuffer.AppendWithConversion("ft"); break;
case eCSSUnit_Mile: aBuffer.Append("mi"); break; case eCSSUnit_Mile: aBuffer.AppendWithConversion("mi"); break;
case eCSSUnit_Millimeter: aBuffer.Append("mm"); break; case eCSSUnit_Millimeter: aBuffer.AppendWithConversion("mm"); break;
case eCSSUnit_Centimeter: aBuffer.Append("cm"); break; case eCSSUnit_Centimeter: aBuffer.AppendWithConversion("cm"); break;
case eCSSUnit_Meter: aBuffer.Append("m"); break; case eCSSUnit_Meter: aBuffer.AppendWithConversion("m"); break;
case eCSSUnit_Kilometer: aBuffer.Append("km"); break; case eCSSUnit_Kilometer: aBuffer.AppendWithConversion("km"); break;
case eCSSUnit_Point: aBuffer.Append("pt"); break; case eCSSUnit_Point: aBuffer.AppendWithConversion("pt"); break;
case eCSSUnit_Pica: aBuffer.Append("pc"); break; case eCSSUnit_Pica: aBuffer.AppendWithConversion("pc"); break;
case eCSSUnit_Didot: aBuffer.Append("dt"); break; case eCSSUnit_Didot: aBuffer.AppendWithConversion("dt"); break;
case eCSSUnit_Cicero: aBuffer.Append("cc"); break; case eCSSUnit_Cicero: aBuffer.AppendWithConversion("cc"); break;
case eCSSUnit_EM: aBuffer.Append("em"); break; case eCSSUnit_EM: aBuffer.AppendWithConversion("em"); break;
case eCSSUnit_EN: aBuffer.Append("en"); break; case eCSSUnit_EN: aBuffer.AppendWithConversion("en"); break;
case eCSSUnit_XHeight: aBuffer.Append("ex"); break; case eCSSUnit_XHeight: aBuffer.AppendWithConversion("ex"); break;
case eCSSUnit_CapHeight: aBuffer.Append("cap"); break; case eCSSUnit_CapHeight: aBuffer.AppendWithConversion("cap"); break;
case eCSSUnit_Char: aBuffer.Append("ch"); break; case eCSSUnit_Char: aBuffer.AppendWithConversion("ch"); break;
case eCSSUnit_Pixel: aBuffer.Append("px"); break; case eCSSUnit_Pixel: aBuffer.AppendWithConversion("px"); break;
case eCSSUnit_Degree: aBuffer.Append("deg"); break; case eCSSUnit_Degree: aBuffer.AppendWithConversion("deg"); break;
case eCSSUnit_Grad: aBuffer.Append("grad"); break; case eCSSUnit_Grad: aBuffer.AppendWithConversion("grad"); break;
case eCSSUnit_Radian: aBuffer.Append("rad"); break; case eCSSUnit_Radian: aBuffer.AppendWithConversion("rad"); break;
case eCSSUnit_Hertz: aBuffer.Append("Hz"); break; case eCSSUnit_Hertz: aBuffer.AppendWithConversion("Hz"); break;
case eCSSUnit_Kilohertz: aBuffer.Append("kHz"); break; case eCSSUnit_Kilohertz: aBuffer.AppendWithConversion("kHz"); break;
case eCSSUnit_Seconds: aBuffer.Append("s"); break; case eCSSUnit_Seconds: aBuffer.AppendWithConversion("s"); break;
case eCSSUnit_Milliseconds: aBuffer.Append("ms"); break; case eCSSUnit_Milliseconds: aBuffer.AppendWithConversion("ms"); break;
} }
aBuffer.Append(' '); aBuffer.AppendWithConversion(' ');
} }
void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const void nsCSSValue::ToString(nsString& aBuffer, nsCSSProperty aPropID) const

File diff suppressed because it is too large Load Diff

View File

@@ -155,7 +155,7 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI)
break; break;
if (!base.IsEmpty()) { if (!base.IsEmpty()) {
str = base.GetUnicode(); str.AssignWithConversion(base.GetUnicode());
rv = (*aURI)->SetRelativePath(str); rv = (*aURI)->SetRelativePath(str);
} }
break; break;
@@ -167,12 +167,12 @@ nsXMLElement::GetXMLBaseURI(nsIURI **aURI)
} else { } else {
// We do not want to add double / delimiters (although the user is free to do so) // We do not want to add double / delimiters (although the user is free to do so)
if (value[value_len - 1] != '/') if (value[value_len - 1] != '/')
value += '/'; value.AppendWithConversion('/');
base = value + base; base.Insert(value, 0);
} }
} else { } else {
if (value[value_len - 1] != '/') if (value[value_len - 1] != '/')
value += '/'; // Add delimiter/make sure we treat this as dir value.AppendWithConversion'/'; // Add delimiter/make sure we treat this as dir
base = value; base = value;
} }
} }
@@ -212,7 +212,7 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName,
// to create an atom. // to create an atom.
if ((kNameSpaceID_XLink == aNameSpaceID) && if ((kNameSpaceID_XLink == aNameSpaceID) &&
(kTypeAtom == aName)) { (kTypeAtom == aName)) {
if (aValue.Equals(kSimpleAtom, PR_FALSE)) { if (aValue.EqualsWithConversion(kSimpleAtom, PR_FALSE)) {
// NOTE: This really is a link according to the XLink spec, // NOTE: This really is a link according to the XLink spec,
// we do not need to check other attributes. If there // we do not need to check other attributes. If there
// is no href attribute, then this link is simply // is no href attribute, then this link is simply
@@ -272,13 +272,13 @@ nsXMLElement::HandleDOMEvent(nsIPresContext* aPresContext,
} }
GetAttribute(kNameSpaceID_XLink, kShowAtom, show); GetAttribute(kNameSpaceID_XLink, kShowAtom, show);
// XXX Should probably do this using atoms // XXX Should probably do this using atoms
if (show.Equals("new")) { if (show.EqualsWithConversion("new")) {
verb = eLinkVerb_New; verb = eLinkVerb_New;
} }
else if (show.Equals("replace")) { else if (show.EqualsWithConversion("replace")) {
verb = eLinkVerb_Replace; verb = eLinkVerb_Replace;
} }
else if (show.Equals("embed")) { else if (show.EqualsWithConversion("embed")) {
verb = eLinkVerb_Embed; verb = eLinkVerb_Embed;
} }

View File

@@ -522,7 +522,7 @@ nsXMLContentSink::GetAttributeValueAt(const nsIParserNode& aNode,
} }
*cp = '\0'; *cp = '\0';
PRInt32 ch; PRInt32 ch;
nsAutoString str(cbuf); nsAutoString str; str.AssignWithConversion(cbuf);
dtd->ConvertEntityToUnicode(str, &ch); dtd->ConvertEntityToUnicode(str, &ch);
if (ch < 0) { if (ch < 0) {
continue; continue;
@@ -567,7 +567,7 @@ nsXMLContentSink::AddAttributes(const nsIParserNode& aNode,
} }
if ((kNameSpaceID_XMLNS == nameSpaceID) && aIsHTML) { if ((kNameSpaceID_XMLNS == nameSpaceID) && aIsHTML) {
NS_RELEASE(nameAtom); NS_RELEASE(nameAtom);
name.Insert("xmlns:", 0); name.InsertWithConversion("xmlns:", 0);
nameAtom = NS_NewAtom(name); nameAtom = NS_NewAtom(name);
nameSpaceID = kNameSpaceID_HTML; // XXX this is wrong, but necessary until HTML can store other namespaces for attrs nameSpaceID = kNameSpaceID_HTML; // XXX this is wrong, but necessary until HTML can store other namespaces for attrs
} }
@@ -688,7 +688,7 @@ nsXMLContentSink::OpenContainer(const nsIParserNode& aNode)
mState = eXMLContentSinkState_InDocumentElement; mState = eXMLContentSinkState_InDocumentElement;
tag = aNode.GetText(); tag.Assign(aNode.GetText());
nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag)); nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag));
// We must register namespace declarations found in the attribute list // We must register namespace declarations found in the attribute list
@@ -784,7 +784,7 @@ nsXMLContentSink::CloseContainer(const nsIParserNode& aNode)
// no close tags for elements. // no close tags for elements.
PR_ASSERT(eXMLContentSinkState_InDocumentElement == mState); PR_ASSERT(eXMLContentSinkState_InDocumentElement == mState);
tag = aNode.GetText(); tag.Assign(aNode.GetText());
nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag)); nameSpacePrefix = getter_AddRefs(CutNameSpacePrefix(tag));
nameSpaceID = GetNameSpaceId(nameSpacePrefix); nameSpaceID = GetNameSpaceId(nameSpacePrefix);
isHTML = IsHTMLNameSpace(nameSpaceID); isHTML = IsHTMLNameSpace(nameSpaceID);
@@ -914,7 +914,7 @@ nsXMLContentSink::AddComment(const nsIParserNode& aNode)
nsIDOMComment *domComment; nsIDOMComment *domComment;
nsresult result = NS_OK; nsresult result = NS_OK;
text = aNode.GetText(); text.Assign(aNode.GetText());
result = NS_NewCommentNode(&comment); result = NS_NewCommentNode(&comment);
if (NS_OK == result) { if (NS_OK == result) {
result = comment->QueryInterface(kIDOMCommentIID, (void **)&domComment); result = comment->QueryInterface(kIDOMCommentIID, (void **)&domComment);
@@ -941,7 +941,7 @@ nsXMLContentSink::AddCDATASection(const nsIParserNode& aNode)
nsIDOMCDATASection *domCDATA; nsIDOMCDATASection *domCDATA;
nsresult result = NS_OK; nsresult result = NS_OK;
text = aNode.GetText(); text.Assign(aNode.GetText());
result = NS_NewXMLCDATASection(&cdata); result = NS_NewXMLCDATASection(&cdata);
if (NS_OK == result) { if (NS_OK == result) {
result = cdata->QueryInterface(kIDOMCDATASectionIID, (void **)&domCDATA); result = cdata->QueryInterface(kIDOMCDATASectionIID, (void **)&domCDATA);
@@ -1245,7 +1245,7 @@ nsXMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode)
FlushText(); FlushText();
text = aNode.GetText(); text.Assign(aNode.GetText());
ParseProcessingInstruction(text, target, data); ParseProcessingInstruction(text, target, data);
result = NS_NewXMLProcessingInstruction(&node, target, data); result = NS_NewXMLProcessingInstruction(&node, target, data);
if (NS_OK == result) { if (NS_OK == result) {
@@ -1257,28 +1257,28 @@ nsXMLContentSink::AddProcessingInstruction(const nsIParserNode& aNode)
nsAutoString type, href, title, media, alternate; nsAutoString type, href, title, media, alternate;
// If it's a stylesheet PI... // If it's a stylesheet PI...
if (target.Equals(kStyleSheetPI)) { if (target.EqualsWithConversion(kStyleSheetPI)) {
result = GetQuotedAttributeValue(text, "href", href); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("href"), href);
// If there was an error or there's no href, we can't do // If there was an error or there's no href, we can't do
// anything with this PI // anything with this PI
if ((NS_OK != result) || (0 == href.Length())) { if ((NS_OK != result) || (0 == href.Length())) {
return result; return result;
} }
result = GetQuotedAttributeValue(text, "type", type); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("type"), type);
if (NS_FAILED(result)) { if (NS_FAILED(result)) {
type="text/css"; // Default the type attribute to the mime type for CSS type.AssignWithConversion("text/css"); // Default the type attribute to the mime type for CSS
} }
result = GetQuotedAttributeValue(text, "title", title); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("title"), title);
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
title.CompressWhitespace(); title.CompressWhitespace();
} }
result = GetQuotedAttributeValue(text, "media", media); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("media"), media);
if (NS_SUCCEEDED(result)) { if (NS_SUCCEEDED(result)) {
media.ToLowerCase(); media.ToLowerCase();
} }
result = GetQuotedAttributeValue(text, "alternate", alternate); result = GetQuotedAttributeValue(text, NS_ConvertASCIItoUCS2("alternate"), alternate);
#ifndef XSL #ifndef XSL
result = ProcessCSSStyleLink(node, href, alternate.Equals("yes"), result = ProcessCSSStyleLink(node, href, alternate.EqualsWithConversion("yes"),
title, type, media); title, type, media);
#else #else
result = ProcessStyleLink(node, href, alternate.Equals("yes"), result = ProcessStyleLink(node, href, alternate.Equals("yes"),
@@ -1679,7 +1679,7 @@ nsXMLContentSink::OnStreamComplete(nsIStreamLoader* aLoader,
const char* string) const char* string)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
nsString aData(string, stringLen); nsString aData; aData.AssignWithConversion(string, stringLen);
if (NS_OK == aStatus) { if (NS_OK == aStatus) {
rv = EvaluateScript(aData, 0, mScriptLanguageVersion); rv = EvaluateScript(aData, 0, mScriptLanguageVersion);
@@ -1890,7 +1890,7 @@ nsXMLContentSink::GetElementFactory(PRInt32 aNameSpaceID, nsIElementFactory** aR
gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace); gNameSpaceManager->GetNameSpaceURI(aNameSpaceID, nameSpace);
nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX; nsCAutoString progID = NS_ELEMENT_FACTORY_PROGID_PREFIX;
progID.Append(nameSpace); progID.AppendWithConversion(nameSpace);
// Retrieve the appropriate factory. // Retrieve the appropriate factory.
NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv); NS_WITH_SERVICE(nsIElementFactory, elementFactory, progID, &rv);

View File

@@ -230,7 +230,7 @@ NS_IMETHODIMP
nsXMLDocument::GetContentType(nsString& aContentType) const nsXMLDocument::GetContentType(nsString& aContentType) const
{ {
// XXX Should get document type from incoming stream // XXX Should get document type from incoming stream
aContentType.Assign("text/xml"); aContentType.AssignWithConversion("text/xml");
return NS_OK; return NS_OK;
} }
@@ -249,7 +249,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
return rv; return rv;
} }
nsAutoString charset("UTF-8"); nsAutoString charset; charset.AssignWithConversion("UTF-8");
PRBool bIsHTML = PR_FALSE; PRBool bIsHTML = PR_FALSE;
char* aContentType; char* aContentType;
nsCharsetSource charsetSource = kCharsetFromDocTypeDefault; nsCharsetSource charsetSource = kCharsetFromDocTypeDefault;
@@ -276,7 +276,7 @@ nsXMLDocument::StartDocumentLoad(const char* aCommand,
NS_RELEASE(contentTypeKey); NS_RELEASE(contentTypeKey);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
nsAutoString contentType; nsAutoString contentType;
contentType.Assign(contenttypeheader); contentType.AssignWithConversion( NS_STATIC_CAST(const char*, contenttypeheader) );
PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ; PRInt32 start = contentType.RFind("charset=", PR_TRUE ) ;
if(kNotFound != start) if(kNotFound != start)
{ {