diff --git a/content/base/src/nsSelection.cpp b/content/base/src/nsSelection.cpp index 017047b67b36..f757840e29f2 100644 --- a/content/base/src/nsSelection.cpp +++ b/content/base/src/nsSelection.cpp @@ -1453,7 +1453,7 @@ nsDOMSelection::ToString(nsString& aReturn) PRInt32 cnt; GetRangeCount(&cnt); aReturn.AssignWithConversion("nsSelection: "); - aReturn += cnt; + aReturn.AppendInt(cnt); aReturn.AppendWithConversion(" items\n"); // Get an iterator @@ -1484,11 +1484,11 @@ nsDOMSelection::ToString(nsString& aReturn) PRInt32 theInt = (PRInt32)(nsIDOMNode*)FetchAnchorNode(); aReturn.AppendWithConversion(theInt); aReturn.AppendWithConversion(", "); - aReturn += FetchAnchorOffset(); + aReturn.AppendInt(FetchAnchorOffset()); aReturn.AppendWithConversion("Focus is"); - aReturn.AppendWithConversion((long)(nsIDOMNode*)FetchFocusNode(), 16); + aReturn.AppendInt((long)(nsIDOMNode*)FetchFocusNode(), 16); aReturn.AppendWithConversion(", "); - aReturn += FetchFocusOffset(); + aReturn.AppendInt(FetchFocusOffset()); aReturn.AppendWithConversion("\n ... end of selection\n"); return NS_OK; diff --git a/content/html/content/src/nsAttributeContent.cpp b/content/html/content/src/nsAttributeContent.cpp index 6dde6287b295..961eee0ff679 100644 --- a/content/html/content/src/nsAttributeContent.cpp +++ b/content/html/content/src/nsAttributeContent.cpp @@ -460,7 +460,7 @@ nsAttributeContent::CopyText(nsString& aResult) aResult.Assign(mText.Get2b(), mText.GetLength()); } else { - aResult.Assign(mText.Get1b(), mText.GetLength()); + aResult.AssignWithConversion(mText.Get1b(), mText.GetLength()); } return NS_OK; } diff --git a/content/html/document/src/nsHTMLFragmentContentSink.cpp b/content/html/document/src/nsHTMLFragmentContentSink.cpp index f76a26478784..3b02170d7bae 100644 --- a/content/html/document/src/nsHTMLFragmentContentSink.cpp +++ b/content/html/document/src/nsHTMLFragmentContentSink.cpp @@ -401,7 +401,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode) nsAutoString tag; nsresult result = NS_OK; - tag = aNode.GetText(); + tag.Assign(aNode.GetText()); if (tag.EqualsIgnoreCase(kSentinelStr)) { mHitSentinel = PR_TRUE; } @@ -806,7 +806,7 @@ nsHTMLFragmentContentSink::GetAttributeValueAt(const nsIParserNode& aNode, } *cp = '\0'; PRInt32 ch; - nsAutoString str(cbuf); + nsAutoString str; str.AssignWithConversion(cbuf); dtd->ConvertEntityToUnicode(str, &ch); if (ch < 0) { diff --git a/content/html/document/src/nsImageDocument.cpp b/content/html/document/src/nsImageDocument.cpp index 41f9299d64b8..ae9a057f7beb 100644 --- a/content/html/document/src/nsImageDocument.cpp +++ b/content/html/document/src/nsImageDocument.cpp @@ -276,7 +276,9 @@ nsImageDocument::CreateSyntheticDocument() char* src; mDocumentURL->GetSpec(&src); - nsHTMLValue val(src); + + nsString src_string; src_string.AssignWithConversion(src); + nsHTMLValue val(src_string); delete[] src; image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE); image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE); diff --git a/content/shared/src/nsXULAtoms.cpp b/content/shared/src/nsXULAtoms.cpp index 9eed84f46e4f..653e4f1f20c0 100644 --- a/content/shared/src/nsXULAtoms.cpp +++ b/content/shared/src/nsXULAtoms.cpp @@ -47,7 +47,7 @@ void nsXULAtoms::AddRefAtoms() { */ if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) { // gNameSpaceManager->CreateRootNameSpace(namespace); - nsAutoString nameSpace(kXULNameSpace); + nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace); gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID); } else { NS_ASSERTION(0, "failed to create xul atoms namespace manager"); diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 96bb42dcfa48..4125155b9d52 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -495,7 +495,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement) // in the excludes list. nsAutoString excludes; content->GetAttribute(kNameSpaceID_None, kExcludesAtom, excludes); - if (!excludes.Equals("*")) { + if (!excludes.EqualsWithConversion("*")) { if (!excludes.IsEmpty()) { // Walk the children and ensure that all of them // are in the excludes array. @@ -540,7 +540,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement) nsCOMPtr attr(do_QueryInterface(attribute)); nsAutoString name; attr->GetName(name); - if (!name.Equals("excludes")) { + if (!name.EqualsWithConversion("excludes")) { nsAutoString value; nsCOMPtr element(do_QueryInterface(mBoundElement)); element->GetAttribute(name, value); @@ -616,7 +616,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement) PRBool useCapture = PR_FALSE; nsAutoString capturer; child->GetAttribute(kNameSpaceID_None, kCapturerAtom, capturer); - if (capturer.Equals("true")) + if (capturer.EqualsWithConversion("true")) useCapture = PR_TRUE; // Add the event listener. @@ -742,8 +742,9 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) // and then define it as a property. if (!body.IsEmpty()) { void* myFunc; + nsCAutoString cname; cname.AssignWithConversion(name.GetUnicode()); rv = context->CompileFunction(mScriptObject, - name, + cname, argCount, (const char**)args, body, @@ -769,7 +770,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) void* setFunc = nsnull; uintN attrs = 0; - if (readOnly.Equals("true")) + if (readOnly.EqualsWithConversion("true")) attrs |= JSPROP_READONLY; if (!getter.IsEmpty()) { @@ -1139,7 +1140,7 @@ nsXBLBinding::IsInExcludesList(nsIAtom* aTag, const nsString& aList) nsAutoString element; aTag->ToString(element); - if (aList.Equals("*")) + if (aList.EqualsWithConversion("*")) return PR_TRUE; // match _everything_! PRInt32 indx = aList.Find(element); @@ -1185,7 +1186,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement) nsCOMPtr attribute; // Figure out if this token contains a :. - nsAutoString attr(token); + nsAutoString attr; attr.AssignWithConversion(token); PRInt32 index = attr.Find(":", PR_TRUE); if (index != -1) { // This attribute maps to something different. @@ -1281,21 +1282,21 @@ nsXBLBinding::GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound) PRBool nsXBLBinding::IsMouseHandler(const nsString& aName) { - return ((aName.Equals("click")) || (aName.Equals("dblclick")) || (aName.Equals("mousedown")) || - (aName.Equals("mouseover")) || (aName.Equals("mouseout")) || (aName.Equals("mouseup"))); + return ((aName.EqualsWithConversion("click")) || (aName.EqualsWithConversion("dblclick")) || (aName.EqualsWithConversion("mousedown")) || + (aName.EqualsWithConversion("mouseover")) || (aName.EqualsWithConversion("mouseout")) || (aName.EqualsWithConversion("mouseup"))); } PRBool nsXBLBinding::IsKeyHandler(const nsString& aName) { - return ((aName.Equals("keypress")) || (aName.Equals("keydown")) || (aName.Equals("keyup"))); + return ((aName.EqualsWithConversion("keypress")) || (aName.EqualsWithConversion("keydown")) || (aName.EqualsWithConversion("keyup"))); } PRBool nsXBLBinding::IsXULHandler(const nsString& aName) { - return ((aName.Equals("create")) || (aName.Equals("destroy")) || (aName.Equals("broadcast")) || - (aName.Equals("command")) || (aName.Equals("commandupdate")) || (aName.Equals("close"))); + return ((aName.EqualsWithConversion("create")) || (aName.EqualsWithConversion("destroy")) || (aName.EqualsWithConversion("broadcast")) || + (aName.EqualsWithConversion("command")) || (aName.EqualsWithConversion("commandupdate")) || (aName.EqualsWithConversion("close"))); } NS_IMETHODIMP @@ -1304,7 +1305,7 @@ nsXBLBinding::AddScriptEventListener(nsIContent* aElement, nsIAtom* aName, const nsAutoString val; aName->ToString(val); - nsAutoString eventStr("on"); + nsAutoString eventStr; eventStr.AssignWithConversion("on"); eventStr += val; nsCOMPtr eventName = getter_AddRefs(NS_NewAtom(eventStr)); diff --git a/content/xbl/src/nsXBLEventHandler.cpp b/content/xbl/src/nsXBLEventHandler.cpp index 18224baab385..711ea222972f 100644 --- a/content/xbl/src/nsXBLEventHandler.cpp +++ b/content/xbl/src/nsXBLEventHandler.cpp @@ -58,7 +58,7 @@ nsXBLEventHandler::nsXBLEventHandler(nsIContent* aBoundElement, nsIContent* aHan NS_INIT_REFCNT(); mBoundElement = aBoundElement; mHandlerElement = aHandlerElement; - mEventName = aEventName; + mEventName.Assign(aEventName); gRefCnt++; if (gRefCnt == 1) { kKeyCodeAtom = NS_NewAtom("keycode"); @@ -101,154 +101,154 @@ nsresult nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent) nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent) { - if (!mEventName.Equals("keyup")) + if (!mEventName.EqualsWithConversion("keyup")) return NS_OK; nsCOMPtr keyEvent = do_QueryInterface(aKeyEvent); if (KeyEventMatched(keyEvent)) - ExecuteHandler(nsAutoString("keyup"), aKeyEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("keyup"), aKeyEvent); return NS_OK; } nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent) { - if (!mEventName.Equals("keydown")) + if (!mEventName.EqualsWithConversion("keydown")) return NS_OK; nsCOMPtr keyEvent = do_QueryInterface(aKeyEvent); if (KeyEventMatched(keyEvent)) - ExecuteHandler(nsAutoString("keydown"), aKeyEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("keydown"), aKeyEvent); return NS_OK; } nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent) { - if (!mEventName.Equals("keypress")) + if (!mEventName.EqualsWithConversion("keypress")) return NS_OK; nsCOMPtr keyEvent = do_QueryInterface(aKeyEvent); if (KeyEventMatched(keyEvent)) - ExecuteHandler(nsAutoString("keypress"), aKeyEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("keypress"), aKeyEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mousedown")) + if (!mEventName.EqualsWithConversion("mousedown")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mousedown"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mousedown"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mouseup")) + if (!mEventName.EqualsWithConversion("mouseup")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mouseup"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mouseup"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("click")) + if (!mEventName.EqualsWithConversion("click")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("click"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("click"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("dblclick")) + if (!mEventName.EqualsWithConversion("dblclick")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("dblclick"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("dblclick"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mouseover")) + if (!mEventName.EqualsWithConversion("mouseover")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mouseover"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mouseover"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mouseout")) + if (!mEventName.EqualsWithConversion("mouseout")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mouseout"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mouseout"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("command")) + if (!mEventName.EqualsWithConversion("command")) return NS_OK; - ExecuteHandler(nsAutoString("command"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("command"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("create")) + if (!mEventName.EqualsWithConversion("create")) return NS_OK; - ExecuteHandler(nsAutoString("create"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("create"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("close")) + if (!mEventName.EqualsWithConversion("close")) return NS_OK; - ExecuteHandler(nsAutoString("close"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("close"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("broadcast")) + if (!mEventName.EqualsWithConversion("broadcast")) return NS_OK; - ExecuteHandler(nsAutoString("broadcast"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("broadcast"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("commandupdate")) + if (!mEventName.EqualsWithConversion("commandupdate")) return NS_OK; - ExecuteHandler(nsAutoString("commandupdate"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("commandupdate"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("destroy")) + if (!mEventName.EqualsWithConversion("destroy")) return NS_OK; - ExecuteHandler(nsAutoString("destroy"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("destroy"), aEvent); return NS_OK; } @@ -257,8 +257,8 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent) PRBool nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent) { - nsAutoString trueString = "true"; - nsAutoString falseString = "false"; + nsAutoString trueString; trueString.AssignWithConversion("true"); + nsAutoString falseString; falseString.AssignWithConversion("false"); // Get the keycode and charcode of the key event. PRUint32 keyCode, charCode; @@ -272,12 +272,12 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent) if (!key.IsEmpty()) keyMatched = IsMatchingCharCode(charCode, key); - key = ""; + key.SetLength(0); mHandlerElement->GetAttribute(kNameSpaceID_None, kKeyCodeAtom, key); if (!key.IsEmpty()) keyMatched = IsMatchingKeyCode(keyCode, key); - key = ""; + key.SetLength(0); mHandlerElement->GetAttribute(kNameSpaceID_None, kCharCodeAtom, key); if (!key.IsEmpty()) keyMatched = IsMatchingCharCode(charCode, key); @@ -374,8 +374,8 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent) PRBool nsXBLEventHandler::MouseEventMatched(nsIDOMUIEvent* aMouseEvent) { - nsAutoString trueString = "true"; - nsAutoString falseString = "false"; + nsAutoString trueString; trueString.AssignWithConversion("true"); + nsAutoString falseString; falseString.AssignWithConversion("false"); // XXX Check for button and modifier keys. @@ -408,7 +408,7 @@ nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEven // Look for a compiled handler on the element. // Should be compiled and bound with "on" in front of the name. - nsAutoString onEvent = "onxbl"; + nsAutoString onEvent; onEvent.AssignWithConversion("onxbl"); onEvent += aEventName; nsCOMPtr onEventAtom = getter_AddRefs(NS_NewAtom(onEvent)); @@ -1066,7 +1066,7 @@ nsXBLEventHandler::IsMatchingCharCode(const PRUint32 aChar, const nsString& aKey char tempChar[2]; tempChar[0] = aChar; tempChar[1] = 0; - nsAutoString tempChar2 = tempChar; + nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar); return tempChar2.EqualsIgnoreCase(aKeyName); } diff --git a/content/xbl/src/nsXBLService.cpp b/content/xbl/src/nsXBLService.cpp index c9d674c3faa9..2e3a0b7a3762 100644 --- a/content/xbl/src/nsXBLService.cpp +++ b/content/xbl/src/nsXBLService.cpp @@ -225,7 +225,7 @@ nsXBLService::nsXBLService(void) static const char kXBLNameSpaceURI[] = "http://www.mozilla.org/xbl"; - rv = gNameSpaceManager->RegisterNameSpace(kXBLNameSpaceURI, kNameSpaceID_XBL); + rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXBLNameSpaceURI), kNameSpaceID_XBL); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XBL namespace"); if (NS_FAILED(rv)) return; @@ -272,7 +272,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL) if (!binding) { nsCAutoString str = "Failed to locate XBL binding. The invalid binding name is: "; - str += aURL; + str.AppendWithConversion(aURL); NS_ERROR(str); return NS_ERROR_FAILURE; } @@ -403,7 +403,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a if (!root) return NS_ERROR_FAILURE; - nsAutoString bindingName(ref); + nsAutoString bindingName; bindingName.AssignWithConversion( NS_STATIC_CAST(const char*, ref) ); PRInt32 count; root->ChildCount(count); diff --git a/content/xml/content/src/nsXMLCDATASection.cpp b/content/xml/content/src/nsXMLCDATASection.cpp index 7cf0436274cb..b70b0edb103c 100644 --- a/content/xml/content/src/nsXMLCDATASection.cpp +++ b/content/xml/content/src/nsXMLCDATASection.cpp @@ -137,7 +137,7 @@ nsXMLCDATASection::GetTag(nsIAtom*& aResult) const NS_IMETHODIMP nsXMLCDATASection::GetNodeName(nsString& aNodeName) { - aNodeName.Assign("#cdata-section"); + aNodeName.AssignWithConversion("#cdata-section"); return NS_OK; } diff --git a/content/xml/content/src/nsXMLElement.cpp b/content/xml/content/src/nsXMLElement.cpp index 3e7eee011a46..ccad01016723 100644 --- a/content/xml/content/src/nsXMLElement.cpp +++ b/content/xml/content/src/nsXMLElement.cpp @@ -212,7 +212,7 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, // to create an atom. if ((kNameSpaceID_XLink == aNameSpaceID) && (kTypeAtom == aName)) { - if (aValue.Equals(kSimpleAtom, PR_FALSE)) { + if (aValue.EqualsAtom(kSimpleAtom, PR_FALSE)) { // NOTE: This really is a link according to the XLink spec, // we do not need to check other attributes. If there // is no href attribute, then this link is simply diff --git a/content/xml/content/src/nsXMLEntity.cpp b/content/xml/content/src/nsXMLEntity.cpp index 25f0c548df55..66f2101893fd 100644 --- a/content/xml/content/src/nsXMLEntity.cpp +++ b/content/xml/content/src/nsXMLEntity.cpp @@ -266,19 +266,19 @@ nsXMLEntity::List(FILE* out, PRInt32 aIndent) const nsAutoString tmp(mName); if (mPublicId.Length()) { - tmp.Append(" PUBLIC \""); + tmp.AppendWithConversion(" PUBLIC \""); tmp.Append(mPublicId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } if (mSystemId.Length()) { - tmp.Append(" SYSTEM \""); + tmp.AppendWithConversion(" SYSTEM \""); tmp.Append(mSystemId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } if (mNotationName.Length()) { - tmp.Append(" NDATA "); + tmp.AppendWithConversion(" NDATA "); tmp.Append(mNotationName); } diff --git a/content/xml/content/src/nsXMLNotation.cpp b/content/xml/content/src/nsXMLNotation.cpp index 3edd362596ec..c9548d45a4dc 100644 --- a/content/xml/content/src/nsXMLNotation.cpp +++ b/content/xml/content/src/nsXMLNotation.cpp @@ -254,15 +254,15 @@ nsXMLNotation::List(FILE* out, PRInt32 aIndent) const nsAutoString tmp(mName); if (mPublicId.Length()) { - tmp.Append(" PUBLIC \""); + tmp.AppendWithConversion(" PUBLIC \""); tmp.Append(mPublicId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } if (mSystemId.Length()) { - tmp.Append(" SYSTEM \""); + tmp.AppendWithConversion(" SYSTEM \""); tmp.Append(mSystemId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } fputs(tmp, out); diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index 91c478d384b0..7cd8ab661154 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -1342,7 +1342,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe nsCOMPtr domdoc(do_QueryInterface(document)); nsresult result; - result = domdoc->CreateElement("SPAN",getter_AddRefs(containerElement));//is the literal the correct way? + result = domdoc->CreateElement(NS_ConvertASCIItoUCS2("SPAN"),getter_AddRefs(containerElement));//is the literal the correct way? if (NS_SUCCEEDED(result) && containerElement) { containerContent = do_QueryInterface(containerElement); diff --git a/layout/base/src/nsSelection.cpp b/layout/base/src/nsSelection.cpp index 017047b67b36..f757840e29f2 100644 --- a/layout/base/src/nsSelection.cpp +++ b/layout/base/src/nsSelection.cpp @@ -1453,7 +1453,7 @@ nsDOMSelection::ToString(nsString& aReturn) PRInt32 cnt; GetRangeCount(&cnt); aReturn.AssignWithConversion("nsSelection: "); - aReturn += cnt; + aReturn.AppendInt(cnt); aReturn.AppendWithConversion(" items\n"); // Get an iterator @@ -1484,11 +1484,11 @@ nsDOMSelection::ToString(nsString& aReturn) PRInt32 theInt = (PRInt32)(nsIDOMNode*)FetchAnchorNode(); aReturn.AppendWithConversion(theInt); aReturn.AppendWithConversion(", "); - aReturn += FetchAnchorOffset(); + aReturn.AppendInt(FetchAnchorOffset()); aReturn.AppendWithConversion("Focus is"); - aReturn.AppendWithConversion((long)(nsIDOMNode*)FetchFocusNode(), 16); + aReturn.AppendInt((long)(nsIDOMNode*)FetchFocusNode(), 16); aReturn.AppendWithConversion(", "); - aReturn += FetchFocusOffset(); + aReturn.AppendInt(FetchFocusOffset()); aReturn.AppendWithConversion("\n ... end of selection\n"); return NS_OK; diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 27321f94d7ec..c67e66ace329 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -424,7 +424,8 @@ nsLayoutModule::CanUnload(nsIComponentManager *aCompMgr, PRBool *okToUnload) void nsLayoutModule::SetUserAgent( void ) { - nsString productName(PRODUCT_NAME), productVersion(PRODUCT_VERSION); + nsString productName; productName.AssignWithConversion(PRODUCT_NAME); + nsString productVersion; productVersion.AssignWithConversion(PRODUCT_VERSION); nsresult rv = nsnull; nsCOMPtr theService(do_GetService(kHTTPHandlerCID, diff --git a/layout/forms/nsButtonFrameRenderer.cpp b/layout/forms/nsButtonFrameRenderer.cpp index cbef2938c017..d90e7a13c82b 100644 --- a/layout/forms/nsButtonFrameRenderer.cpp +++ b/layout/forms/nsButtonFrameRenderer.cpp @@ -78,7 +78,7 @@ nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify) mFrame->GetContent(getter_AddRefs(content)); if (aDisabled) - content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify); + content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, nsAutoString(), notify); else content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify); diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 71ba1e681127..eeec58df6326 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -223,7 +223,6 @@ nsComboboxControlFrame::nsComboboxControlFrame() mPresContext = nsnull; mFormFrame = nsnull; mListControlFrame = nsnull; - mTextStr = ""; mButtonContent = nsnull; mDroppedDown = PR_FALSE; mDisplayFrame = nsnull; @@ -337,7 +336,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext mListControlFrame->GetNumberOfOptions(&length); if (length > 0) { // Set listbox selection to first item in the list box - rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0"); + rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, NS_ConvertASCIItoUCS2("0")); mSelectedIndex = 0; } else { UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option @@ -494,7 +493,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup) nsCOMPtr activeAtom ( dont_QueryInterface(NS_NewAtom(kMozDropdownActive))); if (PR_TRUE == aShowPopup) { - mContent->SetAttribute(kNameSpaceID_None, activeAtom, "", PR_TRUE); + mContent->SetAttribute(kNameSpaceID_None, activeAtom, nsAutoString(), PR_TRUE); } else { mContent->UnsetAttribute(kNameSpaceID_None, activeAtom, PR_TRUE); } @@ -2085,7 +2084,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // Add a child text content node for the label nsCOMPtr labelContent; nsresult result = NS_NewTextNode(getter_AddRefs(labelContent)); - nsAutoString value="X"; + nsAutoString value; value.AssignWithConversion("X"); if (NS_SUCCEEDED(result) && labelContent) { // set the value of the text node mDisplayContent = do_QueryInterface(labelContent); @@ -2101,7 +2100,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, result = NS_NewHTMLInputElement(&mButtonContent, nsHTMLAtoms::input); //NS_ADDREF(mButtonContent); if (NS_SUCCEEDED(result) && mButtonContent) { - mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE); + mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE); aChildList.AppendElement(mButtonContent); } } diff --git a/layout/forms/nsFileControlFrame.cpp b/layout/forms/nsFileControlFrame.cpp index 74319b46ba77..d2882faf5644 100644 --- a/layout/forms/nsFileControlFrame.cpp +++ b/layout/forms/nsFileControlFrame.cpp @@ -249,8 +249,8 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget); if (fileWidget) { - nsString titles[] = {"all files"}; - nsString filters[] = {"*.*"}; + nsString titles[1]; titles[0].AssignWithConversion("all files"); + nsString filters[1]; filters[0].AssignWithConversion("*.*"); fileWidget->SetFilterList(1, titles, filters); fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull); diff --git a/layout/forms/nsFormControlHelper.cpp b/layout/forms/nsFormControlHelper.cpp index b28357ec572d..20e07a32a864 100644 --- a/layout/forms/nsFormControlHelper.cpp +++ b/layout/forms/nsFormControlHelper.cpp @@ -112,26 +112,20 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString) { // Windows linebreaks: Map CRLF to LF: - aString.ReplaceSubstring("\r\n", "\n"); + aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\n")); // Mac linebreaks: Map any remaining CR to LF: - aString.ReplaceSubstring("\r", "\n"); + aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n")); } PRBool nsFormControlHelper::GetBool(const nsString& aValue) { - if (aValue.Equals(NS_STRING_TRUE)) - return(PR_TRUE); - else - return (PR_FALSE); + return aValue.EqualsWithConversion(NS_STRING_TRUE); } void nsFormControlHelper::GetBoolString(const PRBool aValue, nsString& aResult) { - if (PR_TRUE == aValue) - aResult = NS_STRING_TRUE; - else - aResult = NS_STRING_FALSE; + aResult.AssignWithConversion( aValue ? NS_STRING_TRUE : NS_STRING_FALSE ); } @@ -172,7 +166,7 @@ nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext, nsresult nsFormControlHelper::GetWrapProperty(nsIContent * aContent, nsString &aOutValue) { - aOutValue = ""; + aOutValue.SetLength(0); nsresult result = NS_CONTENT_ATTR_NOT_THERE; nsIHTMLContent* content = nsnull; aContent->QueryInterface(kIHTMLContentIID, (void**) &content); @@ -198,16 +192,16 @@ nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap& if (NS_CONTENT_ATTR_NOT_THERE != result) { - nsAutoString wrapHard(kTextControl_Wrap_Hard); - nsAutoString wrapPhysical(kTextControl_Wrap_Physical); + nsAutoString wrapHard; wrapHard.AssignWithConversion(kTextControl_Wrap_Hard); + nsAutoString wrapPhysical; wrapPhysical.AssignWithConversion(kTextControl_Wrap_Physical); if (wrap.EqualsIgnoreCase(wrapHard) || wrap.EqualsIgnoreCase(wrapPhysical)) { aWrapProp = eHTMLTextWrap_Hard; return result; } - nsAutoString wrapSoft(kTextControl_Wrap_Soft); - nsAutoString wrapVirtual(kTextControl_Wrap_Virtual); + nsAutoString wrapSoft; wrapSoft.AssignWithConversion(kTextControl_Wrap_Soft); + nsAutoString wrapVirtual; wrapVirtual.AssignWithConversion(kTextControl_Wrap_Virtual); if (wrap.EqualsIgnoreCase(wrapSoft) || wrap.EqualsIgnoreCase(wrapVirtual)) { aWrapProp = eHTMLTextWrap_Soft; @@ -384,10 +378,10 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra GetRepChars(aPresContext, char1, char2); int i; for (i = 0; i < aNumChars; i+=2) { - val += char1; + val.AppendWithConversion(char1); } for (i = 1; i < aNumChars; i+=2) { - val += char2; + val.AppendWithConversion(char2); } return GetTextSize(aPresContext, aFrame, val, aSize, aRendContext); } diff --git a/layout/forms/nsGfxButtonControlFrame.cpp b/layout/forms/nsGfxButtonControlFrame.cpp index 2c7f3aecf6c9..c760f8073d93 100644 --- a/layout/forms/nsGfxButtonControlFrame.cpp +++ b/layout/forms/nsGfxButtonControlFrame.cpp @@ -250,7 +250,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext if (!textStyle->WhiteSpaceIsSignificant()) { value.CompressWhitespace(); if (value.Length() == 0) { - value = " "; + value.AssignWithConversion(" "); } } @@ -384,7 +384,7 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, if (!textStyle->WhiteSpaceIsSignificant()) { value.CompressWhitespace(); if (value.Length() == 0) { - value = " "; + value.AssignWithConversion(" "); } } @@ -438,7 +438,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString) rv = ButtonLocalize("Browse", aString); } else { - aString = " "; + aString.AssignWithConversion(" "); rv = NS_OK; } return rv; @@ -478,7 +478,7 @@ nsGfxButtonControlFrame::ButtonLocalize(char* aKey, nsString& oVal) // Determine default label from string bundle if (NS_SUCCEEDED(rv) && bundle && aKey) { nsXPIDLString valUni; - nsAutoString key(aKey); + nsAutoString key; key.AssignWithConversion(aKey); rv = bundle->GetStringFromName(key.GetUnicode(), getter_Copies(valUni)); if (NS_SUCCEEDED(rv) && valUni) { oVal.Assign(valUni); @@ -503,7 +503,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsAutoString value; if (mTextContent && mContent) { if (NS_CONTENT_ATTR_HAS_VALUE != mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, value)) { - value = ""; + value.SetLength(0); } rv = mTextContent->SetText(value.GetUnicode(), value.Length(), PR_TRUE); } else { diff --git a/layout/forms/nsGfxCheckboxControlFrame.cpp b/layout/forms/nsGfxCheckboxControlFrame.cpp index b1f766add59b..ba60057b8451 100644 --- a/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -119,7 +119,7 @@ nsGfxCheckboxControlFrame::Init(nsIPresContext* aPresContext, // give the attribute a default value so it's always present, if we're a tristate if ( IsTristateCheckbox() ) - mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), "0", PR_FALSE ); + mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), NS_ConvertASCIItoUCS2("0"), PR_FALSE ); return NS_OK; } @@ -494,7 +494,7 @@ nsGfxCheckboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumVa result = PR_FALSE; } else { if (NS_CONTENT_ATTR_HAS_VALUE != valueResult) { - aValues[0] = "on"; + aValues[0].AssignWithConversion("on"); } else { aValues[0] = value; } @@ -526,15 +526,15 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou { switch ( inState ) { case eOn: - outStateAsString = NS_STRING_TRUE; + outStateAsString.AssignWithConversion(NS_STRING_TRUE); break; case eOff: - outStateAsString = NS_STRING_FALSE; + outStateAsString.AssignWithConversion(NS_STRING_FALSE); break; case eMixed: - outStateAsString = "2"; + outStateAsString.AssignWithConversion("2"); break; } } // CheckStateToString @@ -549,9 +549,9 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou nsGfxCheckboxControlFrame::CheckState nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString ) { - if ( aStateAsString.Equals(NS_STRING_TRUE) ) + if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) ) return eOn; - else if ( aStateAsString.Equals(NS_STRING_FALSE) ) + else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) ) return eOff; // not true and not false means mixed @@ -614,7 +614,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::SaveState(nsIPresContext* aPresContext, // This string will hold a single item, whether or not we're checked. nsAutoString stateString; GetCheckboxControlFrameState(stateString); - (*aState)->SetStateProperty("checked", stateString); + (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString); return NS_OK; } @@ -628,7 +628,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::RestoreState(nsIPresContext* aPresConte mDidInit = PR_TRUE; } nsAutoString string; - aState->GetStateProperty("checked", string); + aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string); SetCheckboxControlFrameState(aPresContext, string); return NS_OK; } diff --git a/layout/forms/nsGfxRadioControlFrame.cpp b/layout/forms/nsGfxRadioControlFrame.cpp index 3421411658c0..f121b4d4c4db 100644 --- a/layout/forms/nsGfxRadioControlFrame.cpp +++ b/layout/forms/nsGfxRadioControlFrame.cpp @@ -125,7 +125,7 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { if (nsHTMLAtoms::checked == aName) { - PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; + PRBool state = (aValue.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; // if there is no form than the radiobtn is an orphan @@ -185,9 +185,9 @@ nsGfxRadioControlFrame::SetChecked(nsIPresContext* aPresContext, PRBool aValue, { if (aSetInitialValue) { if (aValue) { - mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("1"), PR_FALSE); // XXX should be "empty" value + mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("1"), PR_FALSE); // XXX should be "empty" value } else { - mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("0"), PR_FALSE); + mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("0"), PR_FALSE); } } @@ -226,7 +226,7 @@ nsGfxRadioControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValue if (NS_CONTENT_ATTR_HAS_VALUE == result) { aValues[0] = value; } else { - aValues[0] = "on"; + aValues[0].AssignWithConversion("on"); } aNames[0] = name; aNumValues = 1; @@ -345,7 +345,7 @@ nsGfxRadioControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** a // This string will hold a single item, whether or not we're checked. nsAutoString stateString; nsFormControlHelper::GetBoolString(GetRadioState(), stateString); - (*aState)->SetStateProperty("checked", stateString); + (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString); return NS_OK; } @@ -364,8 +364,8 @@ nsGfxRadioControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* mIsRestored = PR_TRUE; nsAutoString string; - aState->GetStateProperty("checked", string); - PRBool state = (string.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; + aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string); + PRBool state = (string.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; SetRadioState(aPresContext, state); // sets mChecked mRestoredChecked = mChecked; diff --git a/layout/forms/nsListControlFrame.cpp b/layout/forms/nsListControlFrame.cpp index 1887624496a2..785e4b447af4 100644 --- a/layout/forms/nsListControlFrame.cpp +++ b/layout/forms/nsListControlFrame.cpp @@ -910,10 +910,10 @@ nsListControlFrame::DisplaySelected(nsIContent* aContent) // The event state manager supports selected states. KMM if (PR_TRUE == mIsAllFramesHere) { - aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_TRUE); + aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_TRUE); //ForceRedraw(); } else { - aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_FALSE); + aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_FALSE); } } @@ -1770,7 +1770,7 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext) // Ok, so we were restored, now set the last known selections from the restore state. if (hasBeenRestored) { nsCOMPtr supp; - mPresState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp)); + mPresState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp)); nsresult res = NS_ERROR_NULL_POINTER; if (!supp) @@ -1949,7 +1949,7 @@ nsListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame) NS_IMETHODIMP nsListControlFrame::GetSelectedItem(nsString & aStr) { - aStr = ""; + aStr.SetLength(0); nsresult rv = NS_ERROR_FAILURE; nsCOMPtr options = getter_AddRefs(GetOptions(mContent)); @@ -2429,7 +2429,7 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) { selectedIndex = 0; } - aValue.Append(selectedIndex, 10); + aValue.AppendInt(selectedIndex, 10); } return NS_OK; @@ -3364,7 +3364,7 @@ nsListControlFrame::SaveStateInternal(nsIPresContext* aPresContext, nsIPresState } NS_NewPresState(aState); - (*aState)->SetStatePropertyAsSupports("selecteditems", value); + (*aState)->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value); return res; } diff --git a/layout/generic/nsBulletFrame.cpp b/layout/generic/nsBulletFrame.cpp index e97c4043a551..f8401e537825 100644 --- a/layout/generic/nsBulletFrame.cpp +++ b/layout/generic/nsBulletFrame.cpp @@ -289,12 +289,12 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c case '7': case '8': addOn.AppendWithConversion(bchars[romanPos]); for(n=0;n<(*dp-'5');n++) { - addOn.Append(achars[romanPos]); + addOn.AppendWithConversion(achars[romanPos]); } break; case '9': - addOn.Append(achars[romanPos]); - addOn.Append(achars[romanPos+1]); + addOn.AppendWithConversion(achars[romanPos]); + addOn.AppendWithConversion(achars[romanPos+1]); break; default: break; diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp index 017047b67b36..f757840e29f2 100644 --- a/layout/generic/nsSelection.cpp +++ b/layout/generic/nsSelection.cpp @@ -1453,7 +1453,7 @@ nsDOMSelection::ToString(nsString& aReturn) PRInt32 cnt; GetRangeCount(&cnt); aReturn.AssignWithConversion("nsSelection: "); - aReturn += cnt; + aReturn.AppendInt(cnt); aReturn.AppendWithConversion(" items\n"); // Get an iterator @@ -1484,11 +1484,11 @@ nsDOMSelection::ToString(nsString& aReturn) PRInt32 theInt = (PRInt32)(nsIDOMNode*)FetchAnchorNode(); aReturn.AppendWithConversion(theInt); aReturn.AppendWithConversion(", "); - aReturn += FetchAnchorOffset(); + aReturn.AppendInt(FetchAnchorOffset()); aReturn.AppendWithConversion("Focus is"); - aReturn.AppendWithConversion((long)(nsIDOMNode*)FetchFocusNode(), 16); + aReturn.AppendInt((long)(nsIDOMNode*)FetchFocusNode(), 16); aReturn.AppendWithConversion(", "); - aReturn += FetchFocusOffset(); + aReturn.AppendInt(FetchFocusOffset()); aReturn.AppendWithConversion("\n ... end of selection\n"); return NS_OK; diff --git a/layout/html/base/src/nsBulletFrame.cpp b/layout/html/base/src/nsBulletFrame.cpp index e97c4043a551..f8401e537825 100644 --- a/layout/html/base/src/nsBulletFrame.cpp +++ b/layout/html/base/src/nsBulletFrame.cpp @@ -289,12 +289,12 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c case '7': case '8': addOn.AppendWithConversion(bchars[romanPos]); for(n=0;n<(*dp-'5');n++) { - addOn.Append(achars[romanPos]); + addOn.AppendWithConversion(achars[romanPos]); } break; case '9': - addOn.Append(achars[romanPos]); - addOn.Append(achars[romanPos+1]); + addOn.AppendWithConversion(achars[romanPos]); + addOn.AppendWithConversion(achars[romanPos+1]); break; default: break; diff --git a/layout/html/content/src/nsAttributeContent.cpp b/layout/html/content/src/nsAttributeContent.cpp index 6dde6287b295..961eee0ff679 100644 --- a/layout/html/content/src/nsAttributeContent.cpp +++ b/layout/html/content/src/nsAttributeContent.cpp @@ -460,7 +460,7 @@ nsAttributeContent::CopyText(nsString& aResult) aResult.Assign(mText.Get2b(), mText.GetLength()); } else { - aResult.Assign(mText.Get1b(), mText.GetLength()); + aResult.AssignWithConversion(mText.Get1b(), mText.GetLength()); } return NS_OK; } diff --git a/layout/html/document/src/nsHTMLFragmentContentSink.cpp b/layout/html/document/src/nsHTMLFragmentContentSink.cpp index f76a26478784..3b02170d7bae 100644 --- a/layout/html/document/src/nsHTMLFragmentContentSink.cpp +++ b/layout/html/document/src/nsHTMLFragmentContentSink.cpp @@ -401,7 +401,7 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode) nsAutoString tag; nsresult result = NS_OK; - tag = aNode.GetText(); + tag.Assign(aNode.GetText()); if (tag.EqualsIgnoreCase(kSentinelStr)) { mHitSentinel = PR_TRUE; } @@ -806,7 +806,7 @@ nsHTMLFragmentContentSink::GetAttributeValueAt(const nsIParserNode& aNode, } *cp = '\0'; PRInt32 ch; - nsAutoString str(cbuf); + nsAutoString str; str.AssignWithConversion(cbuf); dtd->ConvertEntityToUnicode(str, &ch); if (ch < 0) { diff --git a/layout/html/document/src/nsImageDocument.cpp b/layout/html/document/src/nsImageDocument.cpp index 41f9299d64b8..ae9a057f7beb 100644 --- a/layout/html/document/src/nsImageDocument.cpp +++ b/layout/html/document/src/nsImageDocument.cpp @@ -276,7 +276,9 @@ nsImageDocument::CreateSyntheticDocument() char* src; mDocumentURL->GetSpec(&src); - nsHTMLValue val(src); + + nsString src_string; src_string.AssignWithConversion(src); + nsHTMLValue val(src_string); delete[] src; image->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE); image->SetHTMLAttribute(nsHTMLAtoms::alt, val, PR_FALSE); diff --git a/layout/html/forms/src/nsButtonFrameRenderer.cpp b/layout/html/forms/src/nsButtonFrameRenderer.cpp index cbef2938c017..d90e7a13c82b 100644 --- a/layout/html/forms/src/nsButtonFrameRenderer.cpp +++ b/layout/html/forms/src/nsButtonFrameRenderer.cpp @@ -78,7 +78,7 @@ nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify) mFrame->GetContent(getter_AddRefs(content)); if (aDisabled) - content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify); + content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, nsAutoString(), notify); else content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify); diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index 71ba1e681127..eeec58df6326 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -223,7 +223,6 @@ nsComboboxControlFrame::nsComboboxControlFrame() mPresContext = nsnull; mFormFrame = nsnull; mListControlFrame = nsnull; - mTextStr = ""; mButtonContent = nsnull; mDroppedDown = PR_FALSE; mDisplayFrame = nsnull; @@ -337,7 +336,7 @@ nsComboboxControlFrame::MakeSureSomethingIsSelected(nsIPresContext* aPresContext mListControlFrame->GetNumberOfOptions(&length); if (length > 0) { // Set listbox selection to first item in the list box - rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, "0"); + rv = fcFrame->SetProperty(aPresContext, nsHTMLAtoms::selectedindex, NS_ConvertASCIItoUCS2("0")); mSelectedIndex = 0; } else { UpdateSelection(PR_FALSE, PR_TRUE, mSelectedIndex); // Needed to reflow when removing last option @@ -494,7 +493,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup) nsCOMPtr activeAtom ( dont_QueryInterface(NS_NewAtom(kMozDropdownActive))); if (PR_TRUE == aShowPopup) { - mContent->SetAttribute(kNameSpaceID_None, activeAtom, "", PR_TRUE); + mContent->SetAttribute(kNameSpaceID_None, activeAtom, nsAutoString(), PR_TRUE); } else { mContent->UnsetAttribute(kNameSpaceID_None, activeAtom, PR_TRUE); } @@ -2085,7 +2084,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // Add a child text content node for the label nsCOMPtr labelContent; nsresult result = NS_NewTextNode(getter_AddRefs(labelContent)); - nsAutoString value="X"; + nsAutoString value; value.AssignWithConversion("X"); if (NS_SUCCEEDED(result) && labelContent) { // set the value of the text node mDisplayContent = do_QueryInterface(labelContent); @@ -2101,7 +2100,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, result = NS_NewHTMLInputElement(&mButtonContent, nsHTMLAtoms::input); //NS_ADDREF(mButtonContent); if (NS_SUCCEEDED(result) && mButtonContent) { - mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, nsAutoString("button"), PR_FALSE); + mButtonContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE); aChildList.AppendElement(mButtonContent); } } diff --git a/layout/html/forms/src/nsFileControlFrame.cpp b/layout/html/forms/src/nsFileControlFrame.cpp index 74319b46ba77..d2882faf5644 100644 --- a/layout/html/forms/src/nsFileControlFrame.cpp +++ b/layout/html/forms/src/nsFileControlFrame.cpp @@ -249,8 +249,8 @@ nsFileControlFrame::MouseClick(nsIDOMEvent* aMouseEvent) nsComponentManager::CreateInstance(kCFileWidgetCID, nsnull, kIFileWidgetIID, (void**)&fileWidget); if (fileWidget) { - nsString titles[] = {"all files"}; - nsString filters[] = {"*.*"}; + nsString titles[1]; titles[0].AssignWithConversion("all files"); + nsString filters[1]; filters[0].AssignWithConversion("*.*"); fileWidget->SetFilterList(1, titles, filters); fileWidget->Create(parentWidget, title, eMode_load, nsnull, nsnull); diff --git a/layout/html/forms/src/nsFormControlHelper.cpp b/layout/html/forms/src/nsFormControlHelper.cpp index b28357ec572d..20e07a32a864 100644 --- a/layout/html/forms/src/nsFormControlHelper.cpp +++ b/layout/html/forms/src/nsFormControlHelper.cpp @@ -112,26 +112,20 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString) { // Windows linebreaks: Map CRLF to LF: - aString.ReplaceSubstring("\r\n", "\n"); + aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\n")); // Mac linebreaks: Map any remaining CR to LF: - aString.ReplaceSubstring("\r", "\n"); + aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n")); } PRBool nsFormControlHelper::GetBool(const nsString& aValue) { - if (aValue.Equals(NS_STRING_TRUE)) - return(PR_TRUE); - else - return (PR_FALSE); + return aValue.EqualsWithConversion(NS_STRING_TRUE); } void nsFormControlHelper::GetBoolString(const PRBool aValue, nsString& aResult) { - if (PR_TRUE == aValue) - aResult = NS_STRING_TRUE; - else - aResult = NS_STRING_FALSE; + aResult.AssignWithConversion( aValue ? NS_STRING_TRUE : NS_STRING_FALSE ); } @@ -172,7 +166,7 @@ nsresult nsFormControlHelper::GetFrameFontFM(nsIPresContext* aPresContext, nsresult nsFormControlHelper::GetWrapProperty(nsIContent * aContent, nsString &aOutValue) { - aOutValue = ""; + aOutValue.SetLength(0); nsresult result = NS_CONTENT_ATTR_NOT_THERE; nsIHTMLContent* content = nsnull; aContent->QueryInterface(kIHTMLContentIID, (void**) &content); @@ -198,16 +192,16 @@ nsFormControlHelper::GetWrapPropertyEnum(nsIContent * aContent, nsHTMLTextWrap& if (NS_CONTENT_ATTR_NOT_THERE != result) { - nsAutoString wrapHard(kTextControl_Wrap_Hard); - nsAutoString wrapPhysical(kTextControl_Wrap_Physical); + nsAutoString wrapHard; wrapHard.AssignWithConversion(kTextControl_Wrap_Hard); + nsAutoString wrapPhysical; wrapPhysical.AssignWithConversion(kTextControl_Wrap_Physical); if (wrap.EqualsIgnoreCase(wrapHard) || wrap.EqualsIgnoreCase(wrapPhysical)) { aWrapProp = eHTMLTextWrap_Hard; return result; } - nsAutoString wrapSoft(kTextControl_Wrap_Soft); - nsAutoString wrapVirtual(kTextControl_Wrap_Virtual); + nsAutoString wrapSoft; wrapSoft.AssignWithConversion(kTextControl_Wrap_Soft); + nsAutoString wrapVirtual; wrapVirtual.AssignWithConversion(kTextControl_Wrap_Virtual); if (wrap.EqualsIgnoreCase(wrapSoft) || wrap.EqualsIgnoreCase(wrapVirtual)) { aWrapProp = eHTMLTextWrap_Soft; @@ -384,10 +378,10 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra GetRepChars(aPresContext, char1, char2); int i; for (i = 0; i < aNumChars; i+=2) { - val += char1; + val.AppendWithConversion(char1); } for (i = 1; i < aNumChars; i+=2) { - val += char2; + val.AppendWithConversion(char2); } return GetTextSize(aPresContext, aFrame, val, aSize, aRendContext); } diff --git a/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/layout/html/forms/src/nsGfxButtonControlFrame.cpp index 2c7f3aecf6c9..c760f8073d93 100644 --- a/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -250,7 +250,7 @@ nsGfxButtonControlFrame::DoNavQuirksReflow(nsIPresContext* aPresContext if (!textStyle->WhiteSpaceIsSignificant()) { value.CompressWhitespace(); if (value.Length() == 0) { - value = " "; + value.AssignWithConversion(" "); } } @@ -384,7 +384,7 @@ nsGfxButtonControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, if (!textStyle->WhiteSpaceIsSignificant()) { value.CompressWhitespace(); if (value.Length() == 0) { - value = " "; + value.AssignWithConversion(" "); } } @@ -438,7 +438,7 @@ nsGfxButtonControlFrame::GetDefaultLabel(nsString& aString) rv = ButtonLocalize("Browse", aString); } else { - aString = " "; + aString.AssignWithConversion(" "); rv = NS_OK; } return rv; @@ -478,7 +478,7 @@ nsGfxButtonControlFrame::ButtonLocalize(char* aKey, nsString& oVal) // Determine default label from string bundle if (NS_SUCCEEDED(rv) && bundle && aKey) { nsXPIDLString valUni; - nsAutoString key(aKey); + nsAutoString key; key.AssignWithConversion(aKey); rv = bundle->GetStringFromName(key.GetUnicode(), getter_Copies(valUni)); if (NS_SUCCEEDED(rv) && valUni) { oVal.Assign(valUni); @@ -503,7 +503,7 @@ nsGfxButtonControlFrame::AttributeChanged(nsIPresContext* aPresContext, nsAutoString value; if (mTextContent && mContent) { if (NS_CONTENT_ATTR_HAS_VALUE != mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::value, value)) { - value = ""; + value.SetLength(0); } rv = mTextContent->SetText(value.GetUnicode(), value.Length(), PR_TRUE); } else { diff --git a/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index b1f766add59b..ba60057b8451 100644 --- a/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -119,7 +119,7 @@ nsGfxCheckboxControlFrame::Init(nsIPresContext* aPresContext, // give the attribute a default value so it's always present, if we're a tristate if ( IsTristateCheckbox() ) - mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), "0", PR_FALSE ); + mContent->SetAttribute ( kNameSpaceID_None, GetTristateValueAtom(), NS_ConvertASCIItoUCS2("0"), PR_FALSE ); return NS_OK; } @@ -494,7 +494,7 @@ nsGfxCheckboxControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumVa result = PR_FALSE; } else { if (NS_CONTENT_ATTR_HAS_VALUE != valueResult) { - aValues[0] = "on"; + aValues[0].AssignWithConversion("on"); } else { aValues[0] = value; } @@ -526,15 +526,15 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou { switch ( inState ) { case eOn: - outStateAsString = NS_STRING_TRUE; + outStateAsString.AssignWithConversion(NS_STRING_TRUE); break; case eOff: - outStateAsString = NS_STRING_FALSE; + outStateAsString.AssignWithConversion(NS_STRING_FALSE); break; case eMixed: - outStateAsString = "2"; + outStateAsString.AssignWithConversion("2"); break; } } // CheckStateToString @@ -549,9 +549,9 @@ nsGfxCheckboxControlFrame::CheckStateToString ( CheckState inState, nsString& ou nsGfxCheckboxControlFrame::CheckState nsGfxCheckboxControlFrame::StringToCheckState ( const nsString & aStateAsString ) { - if ( aStateAsString.Equals(NS_STRING_TRUE) ) + if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) ) return eOn; - else if ( aStateAsString.Equals(NS_STRING_FALSE) ) + else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) ) return eOff; // not true and not false means mixed @@ -614,7 +614,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::SaveState(nsIPresContext* aPresContext, // This string will hold a single item, whether or not we're checked. nsAutoString stateString; GetCheckboxControlFrameState(stateString); - (*aState)->SetStateProperty("checked", stateString); + (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString); return NS_OK; } @@ -628,7 +628,7 @@ NS_IMETHODIMP nsGfxCheckboxControlFrame::RestoreState(nsIPresContext* aPresConte mDidInit = PR_TRUE; } nsAutoString string; - aState->GetStateProperty("checked", string); + aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string); SetCheckboxControlFrameState(aPresContext, string); return NS_OK; } diff --git a/layout/html/forms/src/nsGfxListControlFrame.cpp b/layout/html/forms/src/nsGfxListControlFrame.cpp index 1764ec0efc50..0cad9cac7a3f 100644 --- a/layout/html/forms/src/nsGfxListControlFrame.cpp +++ b/layout/html/forms/src/nsGfxListControlFrame.cpp @@ -1343,10 +1343,10 @@ nsGfxListControlFrame::DisplaySelected(nsIContent* aContent) // The event state manager supports selected states. KMM if (PR_TRUE == mIsAllFramesHere) { - aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_TRUE); + aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_TRUE); //ForceRedraw(); } else { - aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_FALSE); + aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_FALSE); } } @@ -2229,7 +2229,7 @@ nsGfxListControlFrame::Reset(nsIPresContext* aPresContext) // Ok, so we were restored, now set the last known selections from the restore state. if (hasBeenRestored) { nsCOMPtr supp; - mPresState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp)); + mPresState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp)); nsresult res = NS_ERROR_NULL_POINTER; if (!supp) @@ -2408,7 +2408,7 @@ nsGfxListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame) NS_IMETHODIMP nsGfxListControlFrame::GetSelectedItem(nsString & aStr) { - aStr = ""; + aStr.SetLength(0); nsresult rv = NS_ERROR_FAILURE; nsCOMPtr options = getter_AddRefs(GetOptions(mContent)); @@ -2898,7 +2898,7 @@ nsGfxListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) { selectedIndex = 0; } - aValue.Append(selectedIndex, 10); + aValue.AppendInt(selectedIndex, 10); } return NS_OK; @@ -3855,7 +3855,7 @@ nsGfxListControlFrame::SaveStateInternal(nsIPresContext* aPresContext, nsIPresSt } NS_NewPresState(aState); - (*aState)->SetStatePropertyAsSupports("selecteditems", value); + (*aState)->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value); return res; } diff --git a/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/layout/html/forms/src/nsGfxRadioControlFrame.cpp index 3421411658c0..f121b4d4c4db 100644 --- a/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -125,7 +125,7 @@ nsGfxRadioControlFrame::SetAdditionalStyleContext(PRInt32 aIndex, NS_IMETHODIMP nsGfxRadioControlFrame::SetProperty(nsIPresContext* aPresContext, nsIAtom* aName, const nsString& aValue) { if (nsHTMLAtoms::checked == aName) { - PRBool state = (aValue.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; + PRBool state = (aValue.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; // if there is no form than the radiobtn is an orphan @@ -185,9 +185,9 @@ nsGfxRadioControlFrame::SetChecked(nsIPresContext* aPresContext, PRBool aValue, { if (aSetInitialValue) { if (aValue) { - mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("1"), PR_FALSE); // XXX should be "empty" value + mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("1"), PR_FALSE); // XXX should be "empty" value } else { - mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, nsAutoString("0"), PR_FALSE); + mContent->SetAttribute(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("0"), PR_FALSE); } } @@ -226,7 +226,7 @@ nsGfxRadioControlFrame::GetNamesValues(PRInt32 aMaxNumValues, PRInt32& aNumValue if (NS_CONTENT_ATTR_HAS_VALUE == result) { aValues[0] = value; } else { - aValues[0] = "on"; + aValues[0].AssignWithConversion("on"); } aNames[0] = name; aNumValues = 1; @@ -345,7 +345,7 @@ nsGfxRadioControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** a // This string will hold a single item, whether or not we're checked. nsAutoString stateString; nsFormControlHelper::GetBoolString(GetRadioState(), stateString); - (*aState)->SetStateProperty("checked", stateString); + (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("checked"), stateString); return NS_OK; } @@ -364,8 +364,8 @@ nsGfxRadioControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* mIsRestored = PR_TRUE; nsAutoString string; - aState->GetStateProperty("checked", string); - PRBool state = (string.Equals(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; + aState->GetStateProperty(NS_ConvertASCIItoUCS2("checked"), string); + PRBool state = (string.EqualsWithConversion(NS_STRING_TRUE)) ? PR_TRUE : PR_FALSE; SetRadioState(aPresContext, state); // sets mChecked mRestoredChecked = mChecked; diff --git a/layout/html/forms/src/nsGfxTextControlFrame.cpp b/layout/html/forms/src/nsGfxTextControlFrame.cpp index 5bbe24dbd26c..87d434e1a347 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -955,7 +955,7 @@ NS_METHOD nsGfxTextControlFrame::HandleEvent(nsIPresContext* aPresContext, break; case NS_FORM_SELECTED: - return UpdateTextControlCommands(nsAutoString("select")); + return UpdateTextControlCommands(NS_ConvertASCIItoUCS2("select")); break; } return NS_OK; @@ -1106,7 +1106,7 @@ nsGfxTextControlFrame::GetText(nsString* aText, PRBool aInitialValue) nsCOMPtr imeSupport = do_QueryInterface(mEditor); if(imeSupport) imeSupport->ForceCompositionEnd(); - nsString format ("text/plain"); + nsString format; format.AssignWithConversion("text/plain"); mEditor->OutputToString(*aText, format, 0); } // we've never built our editor, so the content attribute is the value @@ -1494,7 +1494,7 @@ nsGfxTextControlFrame::Paint(nsIPresContext* aPresContext, #endif if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { - nsAutoString text(" "); + nsAutoString text; text.AssignWithConversion(" "); nsRect rect(0, 0, mRect.width, mRect.height); PaintTextControl(aPresContext, aRenderingContext, aDirtyRect, text, mStyleContext, rect); @@ -1511,7 +1511,7 @@ nsGfxTextControlFrame::PaintTextControlBackground(nsIPresContext* aPresContext, // we paint our own border, but everything else is painted by the mDocshell if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { - nsAutoString text(" "); + nsAutoString text; text.AssignWithConversion(" "); nsRect rect(0, 0, mRect.width, mRect.height); PaintTextControl(aPresContext, aRenderingContext, aDirtyRect, text, mStyleContext, rect); @@ -1629,11 +1629,11 @@ nsGfxTextControlFrame::PaintTextControl(nsIPresContext* aPresContext, //XXX: this needs to be fixed for HTML output void nsGfxTextControlFrame::GetTextControlFrameState(nsString& aValue) { - aValue = ""; // initialize out param + aValue.SetLength(0); // initialize out param if (mEditor && PR_TRUE==IsInitialized()) { - nsString format ("text/plain"); + nsString format; format.AssignWithConversion("text/plain"); PRUint32 flags = 0; if (PR_TRUE==IsPlainTextControl()) { @@ -1667,7 +1667,7 @@ void nsGfxTextControlFrame::SetTextControlFrameState(const nsString& aValue) if (mEditor && PR_TRUE==IsInitialized()) { nsAutoString currentValue; - nsAutoString format ("text/plain"); + nsAutoString format; format.AssignWithConversion("text/plain"); nsresult result = mEditor->OutputToString(currentValue, format, 0); if (PR_TRUE==IsSingleLineTextControl()) { RemoveNewlines(currentValue); @@ -1678,7 +1678,7 @@ void nsGfxTextControlFrame::SetTextControlFrameState(const nsString& aValue) // so convert windows and mac platform linebreaks to \n: // Unfortunately aValue is declared const, so we have to copy // in order to do this substitution. - currentValue = aValue; + currentValue.Assign(aValue); nsFormControlHelper::PlatformToDOMLineBreaks(currentValue); nsCOMPtrdomDoc; @@ -2552,7 +2552,7 @@ nsGfxTextControlFrame::Reflow(nsIPresContext* aPresContext, // get the text value, either from input element attribute or cached state nsAutoString value; if (mCachedState) { - value = *mCachedState; + value.Assign(*mCachedState); } else { @@ -3301,7 +3301,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc // now that the style context is initialized, initialize the content nsAutoString value; if (mCachedState) { - value = *mCachedState; + value.Assign(*mCachedState); delete mCachedState; mCachedState = nsnull; } else { @@ -3363,7 +3363,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc if (NS_FAILED(result)) { return result; } if (!selection) { return NS_ERROR_NULL_POINTER; } nsCOMPtrbodyNode; - nsAutoString bodyTag = "body"; + nsAutoString bodyTag; bodyTag.AssignWithConversion("body"); result = GetFirstNodeOfType(bodyTag, aDoc, getter_AddRefs(bodyNode)); if (NS_SUCCEEDED(result) && bodyNode) { @@ -3463,7 +3463,7 @@ nsresult nsGfxTextControlFrame::UpdateTextControlCommands(const nsString& aComma if (mEditor) { - if (aCommand == nsAutoString("select")) // optimize select updates + if (aCommand == NS_ConvertASCIItoUCS2("select")) // optimize select updates { nsCOMPtr domSelection; rv = mEditor->GetSelection(getter_AddRefs(domSelection)); @@ -3573,7 +3573,7 @@ nsGfxTextControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aS nsLinebreakConverter::eLinebreakPlatform, nsLinebreakConverter::eLinebreakContent); NS_ASSERTION(NS_SUCCEEDED(res), "Converting linebreaks failed!"); - (*aState)->SetStateProperty("value", theString); + (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("value"), theString); return res; } @@ -3581,7 +3581,7 @@ NS_IMETHODIMP nsGfxTextControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState) { nsAutoString stateString; - aState->GetStateProperty("value", stateString); + aState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), stateString); nsresult res = SetProperty(aPresContext, nsHTMLAtoms::value, stateString); return res; } @@ -4419,7 +4419,7 @@ nsEnderEventListener::Focus(nsIDOMEvent* aEvent) nsGfxTextControlFrame *gfxFrame = mFrame.Reference(); if (gfxFrame && mContent && mView) { - mTextValue = ""; + mTextValue.SetLength(0); gfxFrame->GetText(&mTextValue, PR_FALSE); } @@ -4594,7 +4594,7 @@ NS_IMETHODIMP nsEnderEventListener::DidDo(nsITransactionManager *aManager, if (undoCount == 1) { if (mFirstDoOfFirstUndo) - gfxFrame->UpdateTextControlCommands(nsAutoString("undo")); + gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo")); mFirstDoOfFirstUndo = PR_FALSE; } @@ -4621,7 +4621,7 @@ NS_IMETHODIMP nsEnderEventListener::DidUndo(nsITransactionManager *aManager, if (undoCount == 0) mFirstDoOfFirstUndo = PR_TRUE; // reset the state for the next do - gfxFrame->UpdateTextControlCommands(nsAutoString("undo")); + gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo")); } return NS_OK; @@ -4640,7 +4640,7 @@ NS_IMETHODIMP nsEnderEventListener::DidRedo(nsITransactionManager *aManager, nsGfxTextControlFrame *gfxFrame = mFrame.Reference(); if (gfxFrame) { - gfxFrame->UpdateTextControlCommands(nsAutoString("undo")); + gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo")); } return NS_OK; diff --git a/layout/html/forms/src/nsListControlFrame.cpp b/layout/html/forms/src/nsListControlFrame.cpp index 1887624496a2..785e4b447af4 100644 --- a/layout/html/forms/src/nsListControlFrame.cpp +++ b/layout/html/forms/src/nsListControlFrame.cpp @@ -910,10 +910,10 @@ nsListControlFrame::DisplaySelected(nsIContent* aContent) // The event state manager supports selected states. KMM if (PR_TRUE == mIsAllFramesHere) { - aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_TRUE); + aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_TRUE); //ForceRedraw(); } else { - aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, "", PR_FALSE); + aContent->SetAttribute(kNameSpaceID_None, nsLayoutAtoms::optionSelectedPseudo, nsAutoString(), PR_FALSE); } } @@ -1770,7 +1770,7 @@ nsListControlFrame::Reset(nsIPresContext* aPresContext) // Ok, so we were restored, now set the last known selections from the restore state. if (hasBeenRestored) { nsCOMPtr supp; - mPresState->GetStatePropertyAsSupports("selecteditems", getter_AddRefs(supp)); + mPresState->GetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), getter_AddRefs(supp)); nsresult res = NS_ERROR_NULL_POINTER; if (!supp) @@ -1949,7 +1949,7 @@ nsListControlFrame::SetComboboxFrame(nsIFrame* aComboboxFrame) NS_IMETHODIMP nsListControlFrame::GetSelectedItem(nsString & aStr) { - aStr = ""; + aStr.SetLength(0); nsresult rv = NS_ERROR_FAILURE; nsCOMPtr options = getter_AddRefs(GetOptions(mContent)); @@ -2429,7 +2429,7 @@ nsListControlFrame::GetProperty(nsIAtom* aName, nsString& aValue) if ((kNothingSelected == selectedIndex) && (mComboboxFrame)) { selectedIndex = 0; } - aValue.Append(selectedIndex, 10); + aValue.AppendInt(selectedIndex, 10); } return NS_OK; @@ -3364,7 +3364,7 @@ nsListControlFrame::SaveStateInternal(nsIPresContext* aPresContext, nsIPresState } NS_NewPresState(aState); - (*aState)->SetStatePropertyAsSupports("selecteditems", value); + (*aState)->SetStatePropertyAsSupports(NS_ConvertASCIItoUCS2("selecteditems"), value); return res; } diff --git a/layout/html/style/src/nsCSSFrameConstructor.cpp b/layout/html/style/src/nsCSSFrameConstructor.cpp index 91c478d384b0..7cd8ab661154 100644 --- a/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -1342,7 +1342,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe nsCOMPtr domdoc(do_QueryInterface(document)); nsresult result; - result = domdoc->CreateElement("SPAN",getter_AddRefs(containerElement));//is the literal the correct way? + result = domdoc->CreateElement(NS_ConvertASCIItoUCS2("SPAN"),getter_AddRefs(containerElement));//is the literal the correct way? if (NS_SUCCEEDED(result) && containerElement) { containerContent = do_QueryInterface(containerElement); diff --git a/layout/xbl/src/nsXBLBinding.cpp b/layout/xbl/src/nsXBLBinding.cpp index 96bb42dcfa48..4125155b9d52 100644 --- a/layout/xbl/src/nsXBLBinding.cpp +++ b/layout/xbl/src/nsXBLBinding.cpp @@ -495,7 +495,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement) // in the excludes list. nsAutoString excludes; content->GetAttribute(kNameSpaceID_None, kExcludesAtom, excludes); - if (!excludes.Equals("*")) { + if (!excludes.EqualsWithConversion("*")) { if (!excludes.IsEmpty()) { // Walk the children and ensure that all of them // are in the excludes array. @@ -540,7 +540,7 @@ nsXBLBinding::GenerateAnonymousContent(nsIContent* aBoundElement) nsCOMPtr attr(do_QueryInterface(attribute)); nsAutoString name; attr->GetName(name); - if (!name.Equals("excludes")) { + if (!name.EqualsWithConversion("excludes")) { nsAutoString value; nsCOMPtr element(do_QueryInterface(mBoundElement)); element->GetAttribute(name, value); @@ -616,7 +616,7 @@ nsXBLBinding::InstallEventHandlers(nsIContent* aBoundElement) PRBool useCapture = PR_FALSE; nsAutoString capturer; child->GetAttribute(kNameSpaceID_None, kCapturerAtom, capturer); - if (capturer.Equals("true")) + if (capturer.EqualsWithConversion("true")) useCapture = PR_TRUE; // Add the event listener. @@ -742,8 +742,9 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) // and then define it as a property. if (!body.IsEmpty()) { void* myFunc; + nsCAutoString cname; cname.AssignWithConversion(name.GetUnicode()); rv = context->CompileFunction(mScriptObject, - name, + cname, argCount, (const char**)args, body, @@ -769,7 +770,7 @@ nsXBLBinding::InstallProperties(nsIContent* aBoundElement) void* setFunc = nsnull; uintN attrs = 0; - if (readOnly.Equals("true")) + if (readOnly.EqualsWithConversion("true")) attrs |= JSPROP_READONLY; if (!getter.IsEmpty()) { @@ -1139,7 +1140,7 @@ nsXBLBinding::IsInExcludesList(nsIAtom* aTag, const nsString& aList) nsAutoString element; aTag->ToString(element); - if (aList.Equals("*")) + if (aList.EqualsWithConversion("*")) return PR_TRUE; // match _everything_! PRInt32 indx = aList.Find(element); @@ -1185,7 +1186,7 @@ nsXBLBinding::ConstructAttributeTable(nsIContent* aElement) nsCOMPtr attribute; // Figure out if this token contains a :. - nsAutoString attr(token); + nsAutoString attr; attr.AssignWithConversion(token); PRInt32 index = attr.Find(":", PR_TRUE); if (index != -1) { // This attribute maps to something different. @@ -1281,21 +1282,21 @@ nsXBLBinding::GetEventHandlerIID(nsIAtom* aName, nsIID* aIID, PRBool* aFound) PRBool nsXBLBinding::IsMouseHandler(const nsString& aName) { - return ((aName.Equals("click")) || (aName.Equals("dblclick")) || (aName.Equals("mousedown")) || - (aName.Equals("mouseover")) || (aName.Equals("mouseout")) || (aName.Equals("mouseup"))); + return ((aName.EqualsWithConversion("click")) || (aName.EqualsWithConversion("dblclick")) || (aName.EqualsWithConversion("mousedown")) || + (aName.EqualsWithConversion("mouseover")) || (aName.EqualsWithConversion("mouseout")) || (aName.EqualsWithConversion("mouseup"))); } PRBool nsXBLBinding::IsKeyHandler(const nsString& aName) { - return ((aName.Equals("keypress")) || (aName.Equals("keydown")) || (aName.Equals("keyup"))); + return ((aName.EqualsWithConversion("keypress")) || (aName.EqualsWithConversion("keydown")) || (aName.EqualsWithConversion("keyup"))); } PRBool nsXBLBinding::IsXULHandler(const nsString& aName) { - return ((aName.Equals("create")) || (aName.Equals("destroy")) || (aName.Equals("broadcast")) || - (aName.Equals("command")) || (aName.Equals("commandupdate")) || (aName.Equals("close"))); + return ((aName.EqualsWithConversion("create")) || (aName.EqualsWithConversion("destroy")) || (aName.EqualsWithConversion("broadcast")) || + (aName.EqualsWithConversion("command")) || (aName.EqualsWithConversion("commandupdate")) || (aName.EqualsWithConversion("close"))); } NS_IMETHODIMP @@ -1304,7 +1305,7 @@ nsXBLBinding::AddScriptEventListener(nsIContent* aElement, nsIAtom* aName, const nsAutoString val; aName->ToString(val); - nsAutoString eventStr("on"); + nsAutoString eventStr; eventStr.AssignWithConversion("on"); eventStr += val; nsCOMPtr eventName = getter_AddRefs(NS_NewAtom(eventStr)); diff --git a/layout/xbl/src/nsXBLEventHandler.cpp b/layout/xbl/src/nsXBLEventHandler.cpp index 18224baab385..711ea222972f 100644 --- a/layout/xbl/src/nsXBLEventHandler.cpp +++ b/layout/xbl/src/nsXBLEventHandler.cpp @@ -58,7 +58,7 @@ nsXBLEventHandler::nsXBLEventHandler(nsIContent* aBoundElement, nsIContent* aHan NS_INIT_REFCNT(); mBoundElement = aBoundElement; mHandlerElement = aHandlerElement; - mEventName = aEventName; + mEventName.Assign(aEventName); gRefCnt++; if (gRefCnt == 1) { kKeyCodeAtom = NS_NewAtom("keycode"); @@ -101,154 +101,154 @@ nsresult nsXBLEventHandler::HandleEvent(nsIDOMEvent* aEvent) nsresult nsXBLEventHandler::KeyUp(nsIDOMEvent* aKeyEvent) { - if (!mEventName.Equals("keyup")) + if (!mEventName.EqualsWithConversion("keyup")) return NS_OK; nsCOMPtr keyEvent = do_QueryInterface(aKeyEvent); if (KeyEventMatched(keyEvent)) - ExecuteHandler(nsAutoString("keyup"), aKeyEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("keyup"), aKeyEvent); return NS_OK; } nsresult nsXBLEventHandler::KeyDown(nsIDOMEvent* aKeyEvent) { - if (!mEventName.Equals("keydown")) + if (!mEventName.EqualsWithConversion("keydown")) return NS_OK; nsCOMPtr keyEvent = do_QueryInterface(aKeyEvent); if (KeyEventMatched(keyEvent)) - ExecuteHandler(nsAutoString("keydown"), aKeyEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("keydown"), aKeyEvent); return NS_OK; } nsresult nsXBLEventHandler::KeyPress(nsIDOMEvent* aKeyEvent) { - if (!mEventName.Equals("keypress")) + if (!mEventName.EqualsWithConversion("keypress")) return NS_OK; nsCOMPtr keyEvent = do_QueryInterface(aKeyEvent); if (KeyEventMatched(keyEvent)) - ExecuteHandler(nsAutoString("keypress"), aKeyEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("keypress"), aKeyEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseDown(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mousedown")) + if (!mEventName.EqualsWithConversion("mousedown")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mousedown"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mousedown"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseUp(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mouseup")) + if (!mEventName.EqualsWithConversion("mouseup")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mouseup"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mouseup"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseClick(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("click")) + if (!mEventName.EqualsWithConversion("click")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("click"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("click"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseDblClick(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("dblclick")) + if (!mEventName.EqualsWithConversion("dblclick")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("dblclick"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("dblclick"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseOver(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mouseover")) + if (!mEventName.EqualsWithConversion("mouseover")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mouseover"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mouseover"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::MouseOut(nsIDOMEvent* aMouseEvent) { - if (!mEventName.Equals("mouseout")) + if (!mEventName.EqualsWithConversion("mouseout")) return NS_OK; nsCOMPtr mouseEvent = do_QueryInterface(aMouseEvent); if (MouseEventMatched(mouseEvent)) - ExecuteHandler(nsAutoString("mouseout"), aMouseEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("mouseout"), aMouseEvent); return NS_OK; } nsresult nsXBLEventHandler::Action(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("command")) + if (!mEventName.EqualsWithConversion("command")) return NS_OK; - ExecuteHandler(nsAutoString("command"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("command"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Create(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("create")) + if (!mEventName.EqualsWithConversion("create")) return NS_OK; - ExecuteHandler(nsAutoString("create"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("create"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Close(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("close")) + if (!mEventName.EqualsWithConversion("close")) return NS_OK; - ExecuteHandler(nsAutoString("close"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("close"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Broadcast(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("broadcast")) + if (!mEventName.EqualsWithConversion("broadcast")) return NS_OK; - ExecuteHandler(nsAutoString("broadcast"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("broadcast"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::CommandUpdate(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("commandupdate")) + if (!mEventName.EqualsWithConversion("commandupdate")) return NS_OK; - ExecuteHandler(nsAutoString("commandupdate"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("commandupdate"), aEvent); return NS_OK; } nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent) { - if (!mEventName.Equals("destroy")) + if (!mEventName.EqualsWithConversion("destroy")) return NS_OK; - ExecuteHandler(nsAutoString("destroy"), aEvent); + ExecuteHandler(NS_ConvertASCIItoUCS2("destroy"), aEvent); return NS_OK; } @@ -257,8 +257,8 @@ nsresult nsXBLEventHandler::Destroy(nsIDOMEvent* aEvent) PRBool nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent) { - nsAutoString trueString = "true"; - nsAutoString falseString = "false"; + nsAutoString trueString; trueString.AssignWithConversion("true"); + nsAutoString falseString; falseString.AssignWithConversion("false"); // Get the keycode and charcode of the key event. PRUint32 keyCode, charCode; @@ -272,12 +272,12 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent) if (!key.IsEmpty()) keyMatched = IsMatchingCharCode(charCode, key); - key = ""; + key.SetLength(0); mHandlerElement->GetAttribute(kNameSpaceID_None, kKeyCodeAtom, key); if (!key.IsEmpty()) keyMatched = IsMatchingKeyCode(keyCode, key); - key = ""; + key.SetLength(0); mHandlerElement->GetAttribute(kNameSpaceID_None, kCharCodeAtom, key); if (!key.IsEmpty()) keyMatched = IsMatchingCharCode(charCode, key); @@ -374,8 +374,8 @@ nsXBLEventHandler::KeyEventMatched(nsIDOMKeyEvent* aKeyEvent) PRBool nsXBLEventHandler::MouseEventMatched(nsIDOMUIEvent* aMouseEvent) { - nsAutoString trueString = "true"; - nsAutoString falseString = "false"; + nsAutoString trueString; trueString.AssignWithConversion("true"); + nsAutoString falseString; falseString.AssignWithConversion("false"); // XXX Check for button and modifier keys. @@ -408,7 +408,7 @@ nsXBLEventHandler::ExecuteHandler(const nsString& aEventName, nsIDOMEvent* aEven // Look for a compiled handler on the element. // Should be compiled and bound with "on" in front of the name. - nsAutoString onEvent = "onxbl"; + nsAutoString onEvent; onEvent.AssignWithConversion("onxbl"); onEvent += aEventName; nsCOMPtr onEventAtom = getter_AddRefs(NS_NewAtom(onEvent)); @@ -1066,7 +1066,7 @@ nsXBLEventHandler::IsMatchingCharCode(const PRUint32 aChar, const nsString& aKey char tempChar[2]; tempChar[0] = aChar; tempChar[1] = 0; - nsAutoString tempChar2 = tempChar; + nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar); return tempChar2.EqualsIgnoreCase(aKeyName); } diff --git a/layout/xbl/src/nsXBLService.cpp b/layout/xbl/src/nsXBLService.cpp index c9d674c3faa9..2e3a0b7a3762 100644 --- a/layout/xbl/src/nsXBLService.cpp +++ b/layout/xbl/src/nsXBLService.cpp @@ -225,7 +225,7 @@ nsXBLService::nsXBLService(void) static const char kXBLNameSpaceURI[] = "http://www.mozilla.org/xbl"; - rv = gNameSpaceManager->RegisterNameSpace(kXBLNameSpaceURI, kNameSpaceID_XBL); + rv = gNameSpaceManager->RegisterNameSpace(NS_ConvertASCIItoUCS2(kXBLNameSpaceURI), kNameSpaceID_XBL); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to register XBL namespace"); if (NS_FAILED(rv)) return; @@ -272,7 +272,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsString& aURL) if (!binding) { nsCAutoString str = "Failed to locate XBL binding. The invalid binding name is: "; - str += aURL; + str.AppendWithConversion(aURL); NS_ERROR(str); return NS_ERROR_FAILURE; } @@ -403,7 +403,7 @@ NS_IMETHODIMP nsXBLService::GetBinding(nsCAutoString& aURLStr, nsIXBLBinding** a if (!root) return NS_ERROR_FAILURE; - nsAutoString bindingName(ref); + nsAutoString bindingName; bindingName.AssignWithConversion( NS_STATIC_CAST(const char*, ref) ); PRInt32 count; root->ChildCount(count); diff --git a/layout/xml/content/src/nsXMLCDATASection.cpp b/layout/xml/content/src/nsXMLCDATASection.cpp index 7cf0436274cb..b70b0edb103c 100644 --- a/layout/xml/content/src/nsXMLCDATASection.cpp +++ b/layout/xml/content/src/nsXMLCDATASection.cpp @@ -137,7 +137,7 @@ nsXMLCDATASection::GetTag(nsIAtom*& aResult) const NS_IMETHODIMP nsXMLCDATASection::GetNodeName(nsString& aNodeName) { - aNodeName.Assign("#cdata-section"); + aNodeName.AssignWithConversion("#cdata-section"); return NS_OK; } diff --git a/layout/xml/content/src/nsXMLElement.cpp b/layout/xml/content/src/nsXMLElement.cpp index 3e7eee011a46..ccad01016723 100644 --- a/layout/xml/content/src/nsXMLElement.cpp +++ b/layout/xml/content/src/nsXMLElement.cpp @@ -212,7 +212,7 @@ nsXMLElement::SetAttribute(PRInt32 aNameSpaceID, nsIAtom* aName, // to create an atom. if ((kNameSpaceID_XLink == aNameSpaceID) && (kTypeAtom == aName)) { - if (aValue.Equals(kSimpleAtom, PR_FALSE)) { + if (aValue.EqualsAtom(kSimpleAtom, PR_FALSE)) { // NOTE: This really is a link according to the XLink spec, // we do not need to check other attributes. If there // is no href attribute, then this link is simply diff --git a/layout/xml/content/src/nsXMLEntity.cpp b/layout/xml/content/src/nsXMLEntity.cpp index 25f0c548df55..66f2101893fd 100644 --- a/layout/xml/content/src/nsXMLEntity.cpp +++ b/layout/xml/content/src/nsXMLEntity.cpp @@ -266,19 +266,19 @@ nsXMLEntity::List(FILE* out, PRInt32 aIndent) const nsAutoString tmp(mName); if (mPublicId.Length()) { - tmp.Append(" PUBLIC \""); + tmp.AppendWithConversion(" PUBLIC \""); tmp.Append(mPublicId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } if (mSystemId.Length()) { - tmp.Append(" SYSTEM \""); + tmp.AppendWithConversion(" SYSTEM \""); tmp.Append(mSystemId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } if (mNotationName.Length()) { - tmp.Append(" NDATA "); + tmp.AppendWithConversion(" NDATA "); tmp.Append(mNotationName); } diff --git a/layout/xml/content/src/nsXMLNotation.cpp b/layout/xml/content/src/nsXMLNotation.cpp index 3edd362596ec..c9548d45a4dc 100644 --- a/layout/xml/content/src/nsXMLNotation.cpp +++ b/layout/xml/content/src/nsXMLNotation.cpp @@ -254,15 +254,15 @@ nsXMLNotation::List(FILE* out, PRInt32 aIndent) const nsAutoString tmp(mName); if (mPublicId.Length()) { - tmp.Append(" PUBLIC \""); + tmp.AppendWithConversion(" PUBLIC \""); tmp.Append(mPublicId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } if (mSystemId.Length()) { - tmp.Append(" SYSTEM \""); + tmp.AppendWithConversion(" SYSTEM \""); tmp.Append(mSystemId); - tmp.Append("\""); + tmp.AppendWithConversion("\""); } fputs(tmp, out); diff --git a/layout/xul/base/src/nsBoxFrame.cpp b/layout/xul/base/src/nsBoxFrame.cpp index 4aea7aa482f1..a05014590197 100644 --- a/layout/xul/base/src/nsBoxFrame.cpp +++ b/layout/xul/base/src/nsBoxFrame.cpp @@ -1387,9 +1387,9 @@ nsBoxFrame::GetFrameName(nsString& aResult) const if (content) content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id); - aResult = "Box[id="; + aResult.AssignWithConversion("Box[id="); aResult.Append(id); - aResult.Append("]"); + aResult.AppendWithConversion("]"); return NS_OK; } @@ -1985,9 +1985,9 @@ nsBoxFrameInner::DisplayDebugInfoFor(nsIBox* aBox, childFrame->GetContent(getter_AddRefs(content)); if (content) { - id = ""; - kClass = ""; - tagString = ""; + id.SetLength(0); + kClass.SetLength(0); + tagString.SetLength(0); content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id); id.ToCString(idValue,100); diff --git a/layout/xul/base/src/nsColorPickerFrame.cpp b/layout/xul/base/src/nsColorPickerFrame.cpp index 3e0a9d069dfc..bd33ce291a30 100644 --- a/layout/xul/base/src/nsColorPickerFrame.cpp +++ b/layout/xul/base/src/nsColorPickerFrame.cpp @@ -83,7 +83,7 @@ nsColorPickerFrame::Init(nsIPresContext* aPresContext, nsAutoString type; mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, type); - if (type.EqualsIgnoreCase("swatch") || type.Equals("")) + if (type.EqualsIgnoreCase("swatch") || type.IsEmpty()) { mColorPicker = new nsStdColorPicker(); mColorPicker->Init(mContent); @@ -126,9 +126,9 @@ nsColorPickerFrame::HandleMouseDownEvent(nsIPresContext* aPresContext, nsresult rv = mColorPicker->GetColor(x, y, &color); if (NS_FAILED(rv)) - node->RemoveAttribute("color"); + node->RemoveAttribute(NS_ConvertASCIItoUCS2("color")); else - node->SetAttribute("color", color); + node->SetAttribute(NS_ConvertASCIItoUCS2("color"), NS_ConvertASCIItoUCS2(color)); return NS_OK; } diff --git a/layout/xul/base/src/nsDeckFrame.h b/layout/xul/base/src/nsDeckFrame.h index 0b1d6005ad31..18162636b1c9 100644 --- a/layout/xul/base/src/nsDeckFrame.h +++ b/layout/xul/base/src/nsDeckFrame.h @@ -63,7 +63,7 @@ public: #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "Deck"; + aResult.AssignWithConversion("Deck"); return NS_OK; } #endif diff --git a/layout/xul/base/src/nsGrippyFrame.cpp b/layout/xul/base/src/nsGrippyFrame.cpp index 7b3823e0b5e6..b90ca75ccfaf 100644 --- a/layout/xul/base/src/nsGrippyFrame.cpp +++ b/layout/xul/base/src/nsGrippyFrame.cpp @@ -87,12 +87,12 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext) nsCOMPtr content; splitter->GetContent(getter_AddRefs(content)); - nsString a = "collapsed"; + nsString a; a.AssignWithConversion("collapsed"); nsString value; if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::state, value)) { - if (value.Equals("collapsed")) - a = "open"; + if (value.EqualsWithConversion("collapsed")) + a.AssignWithConversion("open"); } content->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, a, PR_TRUE); @@ -238,6 +238,6 @@ nsGrippyFrame::GetChildAt(nsIPresContext* aPresContext, nsIFrame* parent, PRInt3 NS_IMETHODIMP nsGrippyFrame::GetFrameName(nsString& aResult) const { - aResult = "Grippy"; + aResult.AssignWithConversion("Grippy"); return NS_OK; } diff --git a/layout/xul/base/src/nsImageBoxFrame.cpp b/layout/xul/base/src/nsImageBoxFrame.cpp index bace61922ee8..44da88607990 100644 --- a/layout/xul/base/src/nsImageBoxFrame.cpp +++ b/layout/xul/base/src/nsImageBoxFrame.cpp @@ -196,7 +196,7 @@ nsImageBoxFrame::Init(nsIPresContext* aPresContext, // that UpdateAttributes doesn't double start an image load. nsAutoString src; GetImageSource(src); - if (!src.Equals("")) { + if (!src.IsEmpty()) { mHasImage = PR_TRUE; } mImageLoader.Init(this, UpdateImageFrame, nsnull, baseURL, src); @@ -215,7 +215,7 @@ nsImageBoxFrame::GetImageSource(nsString& aResult) mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::src, aResult); // if the new image is empty - if (aResult.Equals("")) { + if (aResult.IsEmpty()) { // get the list-style-image const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List); @@ -244,7 +244,7 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize) // see if the source changed // get the old image src - nsAutoString oldSrc =""; + nsAutoString oldSrc; mImageLoader.GetURLSpec(oldSrc); // get the new image src @@ -254,7 +254,7 @@ nsImageBoxFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize) // see if the images are different if (!oldSrc.Equals(src)) { - if (!src.Equals("")) { + if (!src.IsEmpty()) { mSizeFrozen = PR_FALSE; mHasImage = PR_TRUE; } else { @@ -442,6 +442,6 @@ nsImageBoxFrame::CacheImageSize(nsBoxLayoutState& aState) NS_IMETHODIMP nsImageBoxFrame::GetFrameName(nsString& aResult) const { - aResult = "ImageBox"; + aResult.AssignWithConversion("ImageBox"); return NS_OK; } diff --git a/layout/xul/base/src/nsLeafBoxFrame.cpp b/layout/xul/base/src/nsLeafBoxFrame.cpp index 624945d85802..f110bc45d763 100644 --- a/layout/xul/base/src/nsLeafBoxFrame.cpp +++ b/layout/xul/base/src/nsLeafBoxFrame.cpp @@ -211,7 +211,7 @@ nsLeafBoxFrame::Reflow(nsIPresContext* aPresContext, NS_IMETHODIMP nsLeafBoxFrame::GetFrameName(nsString& aResult) const { - aResult = "LeafBox"; + aResult.AssignWithConversion("LeafBox"); return NS_OK; } diff --git a/layout/xul/base/src/nsMenuBarFrame.cpp b/layout/xul/base/src/nsMenuBarFrame.cpp index f52c7bb25b66..38232150a610 100644 --- a/layout/xul/base/src/nsMenuBarFrame.cpp +++ b/layout/xul/base/src/nsMenuBarFrame.cpp @@ -125,12 +125,12 @@ nsMenuBarFrame::Init(nsIPresContext* aPresContext, // Also hook up the listener to the window listening for focus events. This is so we can keep proper // state as the user alt-tabs through processes. - target->AddEventListener("keypress", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); - target->AddEventListener("keydown", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); - target->AddEventListener("keyup", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); + target->AddEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); + target->AddEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); + target->AddEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); - target->AddEventListener("mousedown", (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE); - target->AddEventListener("blur", (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE); + target->AddEventListener(NS_ConvertASCIItoUCS2("mousedown"), (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE); + target->AddEventListener(NS_ConvertASCIItoUCS2("blur"), (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE); return rv; } @@ -157,9 +157,9 @@ nsMenuBarFrame::SetActive(PRBool aActiveFlag) InstallKeyboardNavigator(); } else if (mKeyboardNavigator) { - mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); NS_IF_RELEASE(mKeyboardNavigator); } @@ -220,7 +220,7 @@ nsMenuBarFrame::FindMenuWithShortcut(PRUint32 aLetter) // See if it's a menu item. if (IsValidItem(current)) { // Get the shortcut attribute. - nsString shortcutKey = ""; + nsString shortcutKey; current->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey, shortcutKey); shortcutKey.ToUpperCase(); if (shortcutKey.Length() > 0) { @@ -228,7 +228,7 @@ nsMenuBarFrame::FindMenuWithShortcut(PRUint32 aLetter) char tempChar[2]; tempChar[0] = aLetter; tempChar[1] = 0; - nsAutoString tempChar2 = tempChar; + nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar); if (shortcutKey.EqualsIgnoreCase(tempChar2)) { // We match! @@ -608,9 +608,9 @@ nsMenuBarFrame::InstallKeyboardNavigator() mKeyboardNavigator = new nsMenuListener(this); NS_IF_ADDREF(mKeyboardNavigator); - mTarget->AddEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->AddEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->AddEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->AddEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->AddEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->AddEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); return NS_OK; } @@ -621,9 +621,9 @@ nsMenuBarFrame::RemoveKeyboardNavigator() if (!mKeyboardNavigator || mIsActive) return NS_OK; - mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); NS_IF_RELEASE(mKeyboardNavigator); @@ -648,9 +648,9 @@ nsMenuBarFrame::IsValidItem(nsIContent* aContent) PRBool nsMenuBarFrame::IsDisabled(nsIContent* aContent) { - nsString disabled = ""; + nsString disabled; aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled); - if (disabled.Equals("true")) + if (disabled.EqualsWithConversion("true")) return PR_TRUE; return PR_FALSE; } @@ -658,12 +658,12 @@ nsMenuBarFrame::IsDisabled(nsIContent* aContent) NS_IMETHODIMP nsMenuBarFrame::Destroy(nsIPresContext* aPresContext) { - mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); - mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); - mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mMenuBarListener, PR_FALSE); - mTarget->RemoveEventListener("mousedown", (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE); - mTarget->RemoveEventListener("blur", (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("mousedown"), (nsIDOMMouseListener*)mMenuBarListener, PR_FALSE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("blur"), (nsIDOMFocusListener*)mMenuBarListener, PR_TRUE); NS_IF_RELEASE(mMenuBarListener); diff --git a/layout/xul/base/src/nsMenuBarFrame.h b/layout/xul/base/src/nsMenuBarFrame.h index 24543187e019..3a69d668a210 100644 --- a/layout/xul/base/src/nsMenuBarFrame.h +++ b/layout/xul/base/src/nsMenuBarFrame.h @@ -110,7 +110,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "MenuBar"; + aResult.AssignWithConversion("MenuBar"); return NS_OK; } diff --git a/layout/xul/base/src/nsMenuFrame.cpp b/layout/xul/base/src/nsMenuFrame.cpp index 46c943372e3a..dd8b3da7aceb 100644 --- a/layout/xul/base/src/nsMenuFrame.cpp +++ b/layout/xul/base/src/nsMenuFrame.cpp @@ -119,8 +119,7 @@ nsMenuFrame::nsMenuFrame(nsIPresShell* aShell):nsBoxFrame(aShell), mChecked(PR_FALSE), mType(eMenuType_Normal), mMenuParent(nsnull), - mPresContext(nsnull), - mGroupName("") + mPresContext(nsnull) { } // cntr @@ -237,7 +236,7 @@ nsMenuFrame::GetFrameForPoint(nsIPresContext* aPresContext, // This allows selective overriding for subcontent. nsAutoString value; content->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, value); - if (value.Equals("true")) + if (value.EqualsWithConversion("true")) return result; } const nsStyleDisplay* disp = (const nsStyleDisplay*) @@ -302,7 +301,7 @@ nsMenuFrame::HandleEvent(nsIPresContext* aPresContext, PR_TRUE); } else { - mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, nsAutoString("true"), + mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("true"), PR_TRUE); } @@ -391,7 +390,7 @@ nsMenuFrame::SelectMenu(PRBool aActivateFlag) { if (aActivateFlag) { // Highlight the menu. - mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE); + mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, NS_ConvertASCIItoUCS2("true"), PR_TRUE); } else { // Unhighlight the menu. @@ -432,7 +431,7 @@ nsMenuFrame::MarkAsGenerated() nsAutoString genVal; child->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, genVal); if (genVal.IsEmpty()) - child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, "true", PR_TRUE); + child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, NS_ConvertASCIItoUCS2("true"), PR_TRUE); } return NS_OK; @@ -452,7 +451,7 @@ nsMenuFrame::ActivateMenu(PRBool aActivateFlag) // We wait until the last possible moment to show to avoid flashing, but we can just go // ahead and hide it here if we're told to (no additional stages necessary). if (aActivateFlag) - child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, "true", PR_TRUE); + child->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, NS_ConvertASCIItoUCS2("true"), PR_TRUE); else { child->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, PR_TRUE); child->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, PR_TRUE); @@ -473,7 +472,7 @@ nsMenuFrame::AttributeChanged(nsIPresContext* aPresContext, if (aAttribute == nsXULAtoms::open) { aChild->GetAttribute(kNameSpaceID_None, aAttribute, value); - if (value.Equals("true")) + if (value.EqualsWithConversion("true")) OpenMenuInternal(PR_TRUE); else OpenMenuInternal(PR_FALSE); @@ -495,9 +494,9 @@ nsMenuFrame::OpenMenu(PRBool aActivateFlag) // Mark it as generated, which ensures a frame gets built. MarkAsGenerated(); - domElement->SetAttribute("open", "true"); + domElement->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true")); } - else domElement->RemoveAttribute("open"); + else domElement->RemoveAttribute(NS_ConvertASCIItoUCS2("open")); return NS_OK; } @@ -578,15 +577,15 @@ nsMenuFrame::OpenMenuInternal(PRBool aActivateFlag) if (onMenuBar) { if (popupAnchor.IsEmpty()) - popupAnchor = "bottomleft"; + popupAnchor.AssignWithConversion("bottomleft"); if (popupAlign.IsEmpty()) - popupAlign = "topleft"; + popupAlign.AssignWithConversion("topleft"); } else { if (popupAnchor.IsEmpty()) - popupAnchor = "topright"; + popupAnchor.AssignWithConversion("topright"); if (popupAlign.IsEmpty()) - popupAlign = "topleft"; + popupAlign.AssignWithConversion("topleft"); } menuPopup->SyncViewWithFrame(mPresContext, popupAnchor, popupAlign, this, -1, -1); @@ -887,15 +886,15 @@ nsMenuFrame::LayoutFinished(nsBoxLayoutState& aState) if (onMenuBar) { if (popupAnchor.IsEmpty()) - popupAnchor = "bottomleft"; + popupAnchor.AssignWithConversion("bottomleft"); if (popupAlign.IsEmpty()) - popupAlign = "topleft"; + popupAlign.AssignWithConversion("topleft"); } else { if (popupAnchor.IsEmpty()) - popupAnchor = "topright"; + popupAnchor.AssignWithConversion("topright"); if (popupAlign.IsEmpty()) - popupAlign = "topleft"; + popupAlign.AssignWithConversion("topleft"); } nsIPresContext* presContext = aState.GetPresContext(); @@ -992,9 +991,9 @@ nsMenuFrame::Notify(nsITimer* aTimer) // Our timer has fired. if (aTimer == mOpenTimer.get()) { if (!mMenuOpen && mMenuParent) { - nsAutoString active = ""; + nsAutoString active; mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, active); - if (active.Equals("true")) { + if (active.EqualsWithConversion("true")) { // We're still the active menu. OpenMenu(PR_TRUE); } @@ -1011,7 +1010,7 @@ nsMenuFrame::IsDisabled() { nsAutoString disabled; mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled); - if (disabled.Equals("true")) + if (disabled.EqualsWithConversion("true")) return PR_TRUE; return PR_FALSE; } @@ -1021,9 +1020,9 @@ nsMenuFrame::UpdateMenuType(nsIPresContext* aPresContext) { nsAutoString value; mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::type, value); - if (value.Equals("checkbox")) + if (value.EqualsWithConversion("checkbox")) mType = eMenuType_Checkbox; - else if (value.Equals("radio")) { + else if (value.EqualsWithConversion("radio")) { mType = eMenuType_Radio; nsAutoString valueName; @@ -1048,7 +1047,7 @@ nsMenuFrame::UpdateMenuSpecialState(nsIPresContext* aPresContext) { mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::checked, value); - newChecked = (value.Equals("true")); + newChecked = (value.EqualsWithConversion("true")); if (newChecked == mChecked) { /* checked state didn't change */ @@ -1172,17 +1171,17 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString) if (!keyElement) return; - nsAutoString keyAtom("key"); - nsAutoString shiftAtom("shift"); - nsAutoString altAtom("alt"); - nsAutoString commandAtom("command"); - nsAutoString controlAtom("control"); + nsAutoString keyAtom; keyAtom.AssignWithConversion("key"); + nsAutoString shiftAtom; shiftAtom.AssignWithConversion("shift"); + nsAutoString altAtom; altAtom.AssignWithConversion("alt"); + nsAutoString commandAtom; commandAtom.AssignWithConversion("command"); + nsAutoString controlAtom; controlAtom.AssignWithConversion("control"); nsAutoString shiftValue; nsAutoString altValue; nsAutoString commandValue; nsAutoString controlValue; - nsAutoString keyChar = " "; + nsAutoString keyChar; keyChar.AssignWithConversion(" "); keyElement->GetAttribute(keyAtom, keyChar); keyElement->GetAttribute(shiftAtom, shiftValue); @@ -1191,11 +1190,11 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString) keyElement->GetAttribute(controlAtom, controlValue); nsAutoString xulkey; - keyElement->GetAttribute(nsAutoString("xulkey"), xulkey); - if (xulkey.Equals("true")) { + keyElement->GetAttribute(NS_ConvertASCIItoUCS2("xulkey"), xulkey); + if (xulkey.EqualsWithConversion("true")) { // Set the default for the xul key modifier #ifdef XP_MAC - commandValue = "true"; + commandValue.AssignWithConversion("true"); #elif defined(XP_PC) || defined(NTO) controlValue = "true"; #else @@ -1205,34 +1204,34 @@ nsMenuFrame::BuildAcceleratorText(nsString& aAccelString) PRBool prependPlus = PR_FALSE; - if(!commandValue.IsEmpty() && !commandValue.Equals("false")) { + if(!commandValue.IsEmpty() && !commandValue.EqualsWithConversion("false")) { prependPlus = PR_TRUE; - aAccelString += "Ctrl"; // Hmmm. Kinda defeats the point of having an abstraction. + aAccelString.AppendWithConversion("Ctrl"); // Hmmm. Kinda defeats the point of having an abstraction. } - if(!controlValue.IsEmpty() && !controlValue.Equals("false")) { + if(!controlValue.IsEmpty() && !controlValue.EqualsWithConversion("false")) { prependPlus = PR_TRUE; - aAccelString += "Ctrl"; + aAccelString.AppendWithConversion("Ctrl"); } - if(!shiftValue.IsEmpty() && !shiftValue.Equals("false")) { + if(!shiftValue.IsEmpty() && !shiftValue.EqualsWithConversion("false")) { if (prependPlus) - aAccelString += "+"; + aAccelString.AppendWithConversion("+"); prependPlus = PR_TRUE; - aAccelString += "Shift"; + aAccelString.AppendWithConversion("Shift"); } - if (!altValue.IsEmpty() && !altValue.Equals("false")) { + if (!altValue.IsEmpty() && !altValue.EqualsWithConversion("false")) { if (prependPlus) - aAccelString += "+"; + aAccelString.AppendWithConversion("+"); prependPlus = PR_TRUE; - aAccelString += "Alt"; + aAccelString.AppendWithConversion("Alt"); } keyChar.ToUpperCase(); if (!keyChar.IsEmpty()) { if (prependPlus) - aAccelString += "+"; + aAccelString.AppendWithConversion("+"); prependPlus = PR_TRUE; aAccelString += keyChar; } @@ -1450,7 +1449,7 @@ nsMenuFrame::GetPrefSize(nsBoxLayoutState& aState, nsSize& aSize) if (!element) { nsAutoString value; menulist->GetValue(value); - if (value == "") { + if (value.IsEmpty()) { nsCOMPtr child; GetMenuChildrenElement(getter_AddRefs(child)); if (child) { diff --git a/layout/xul/base/src/nsMenuFrame.h b/layout/xul/base/src/nsMenuFrame.h index 14ddae112dc4..b676532d7406 100644 --- a/layout/xul/base/src/nsMenuFrame.h +++ b/layout/xul/base/src/nsMenuFrame.h @@ -154,7 +154,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "Menu"; + aResult.AssignWithConversion("Menu"); return NS_OK; } diff --git a/layout/xul/base/src/nsMenuPopupFrame.cpp b/layout/xul/base/src/nsMenuPopupFrame.cpp index ff96a4e1a81d..035ea8bcb777 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.cpp +++ b/layout/xul/base/src/nsMenuPopupFrame.cpp @@ -319,35 +319,35 @@ nsMenuPopupFrame :: AdjustPositionForAnchorAlign ( PRInt32* ioXPos, PRInt32* ioY const nsString& aPopupAnchor, const nsString& aPopupAlign, PRBool* outFlushWithTopBottom ) { - if (aPopupAnchor.Equals("topright") && aPopupAlign.Equals("topleft")) { + if (aPopupAnchor.EqualsWithConversion("topright") && aPopupAlign.EqualsWithConversion("topleft")) { *ioXPos += inParentRect.width; } - else if (aPopupAnchor.Equals("topright") && aPopupAlign.Equals("bottomright")) { + else if (aPopupAnchor.EqualsWithConversion("topright") && aPopupAlign.EqualsWithConversion("bottomright")) { *ioXPos -= (mRect.width - inParentRect.width); *ioYPos -= mRect.height; *outFlushWithTopBottom = PR_TRUE; } - else if (aPopupAnchor.Equals("bottomright") && aPopupAlign.Equals("bottomleft")) { + else if (aPopupAnchor.EqualsWithConversion("bottomright") && aPopupAlign.EqualsWithConversion("bottomleft")) { *ioXPos += inParentRect.width; *ioYPos -= (mRect.height - inParentRect.height); } - else if (aPopupAnchor.Equals("bottomright") && aPopupAlign.Equals("topright")) { + else if (aPopupAnchor.EqualsWithConversion("bottomright") && aPopupAlign.EqualsWithConversion("topright")) { *ioXPos -= (mRect.width - inParentRect.width); *ioYPos += inParentRect.height; *outFlushWithTopBottom = PR_TRUE; } - else if (aPopupAnchor.Equals("topleft") && aPopupAlign.Equals("topright")) { + else if (aPopupAnchor.EqualsWithConversion("topleft") && aPopupAlign.EqualsWithConversion("topright")) { *ioXPos -= mRect.width; } - else if (aPopupAnchor.Equals("topleft") && aPopupAlign.Equals("bottomleft")) { + else if (aPopupAnchor.EqualsWithConversion("topleft") && aPopupAlign.EqualsWithConversion("bottomleft")) { *ioYPos -= mRect.height; *outFlushWithTopBottom = PR_TRUE; } - else if (aPopupAnchor.Equals("bottomleft") && aPopupAlign.Equals("bottomright")) { + else if (aPopupAnchor.EqualsWithConversion("bottomleft") && aPopupAlign.EqualsWithConversion("bottomright")) { *ioXPos -= mRect.width; *ioYPos -= (mRect.height - inParentRect.height); } - else if (aPopupAnchor.Equals("bottomleft") && aPopupAlign.Equals("topleft")) { + else if (aPopupAnchor.EqualsWithConversion("bottomleft") && aPopupAlign.EqualsWithConversion("topleft")) { *ioYPos += inParentRect.height; *outFlushWithTopBottom = PR_TRUE; } @@ -709,10 +709,10 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext, nsAutoString shouldDisplay, menuActive; mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, menuActive); - if (!menuActive.Equals("true")) { + if (!menuActive.EqualsWithConversion("true")) { mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, shouldDisplay); - if ( shouldDisplay.Equals("true") ) - mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, "true", PR_TRUE); + if ( shouldDisplay.EqualsWithConversion("true") ) + mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, NS_ConvertASCIItoUCS2("true"), PR_TRUE); } return NS_OK; @@ -972,14 +972,14 @@ nsMenuPopupFrame::FindMenuWithShortcut(PRUint32 aLetter) // See if it's a menu item. if (IsValidItem(current)) { // Get the shortcut attribute. - nsAutoString shortcutKey = ""; + nsAutoString shortcutKey; current->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey, shortcutKey); if (shortcutKey.Length() > 0) { // We've got something. char tempChar[2]; tempChar[0] = aLetter; tempChar[1] = 0; - nsAutoString tempChar2 = tempChar; + nsAutoString tempChar2; tempChar2.AssignWithConversion(tempChar); if (shortcutKey.EqualsIgnoreCase(tempChar2)) { // We match! @@ -1210,9 +1210,9 @@ nsMenuPopupFrame::InstallKeyboardNavigator() mKeyboardNavigator = new nsMenuListener(this); NS_IF_ADDREF(mKeyboardNavigator); - target->AddEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - target->AddEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - target->AddEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + target->AddEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + target->AddEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + target->AddEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); return NS_OK; } @@ -1223,9 +1223,9 @@ nsMenuPopupFrame::RemoveKeyboardNavigator() if (!mKeyboardNavigator) return NS_OK; - mTarget->RemoveEventListener("keypress", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->RemoveEventListener("keydown", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); - mTarget->RemoveEventListener("keyup", (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keypress"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keydown"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); + mTarget->RemoveEventListener(NS_ConvertASCIItoUCS2("keyup"), (nsIDOMKeyListener*)mKeyboardNavigator, PR_TRUE); NS_IF_RELEASE(mKeyboardNavigator); @@ -1249,9 +1249,9 @@ nsMenuPopupFrame::IsValidItem(nsIContent* aContent) PRBool nsMenuPopupFrame::IsDisabled(nsIContent* aContent) { - nsString disabled = ""; + nsString disabled; aContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::disabled, disabled); - if (disabled.Equals("true")) + if (disabled.EqualsWithConversion("true")) return PR_TRUE; return PR_FALSE; } diff --git a/layout/xul/base/src/nsMenuPopupFrame.h b/layout/xul/base/src/nsMenuPopupFrame.h index ad39a13d27eb..81ffcd087731 100644 --- a/layout/xul/base/src/nsMenuPopupFrame.h +++ b/layout/xul/base/src/nsMenuPopupFrame.h @@ -132,7 +132,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "MenuPopup"; + aResult.AssignWithConversion("MenuPopup"); return NS_OK; } diff --git a/layout/xul/base/src/nsPopupSetFrame.cpp b/layout/xul/base/src/nsPopupSetFrame.cpp index 38b89cf13a29..7092baa8210a 100644 --- a/layout/xul/base/src/nsPopupSetFrame.cpp +++ b/layout/xul/base/src/nsPopupSetFrame.cpp @@ -376,9 +376,9 @@ nsPopupSetFrame::LayoutFinished(nsBoxLayoutState& aState) menuPopupContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::popupalign, popupAlign); if (popupAnchor.IsEmpty()) - popupAnchor = "bottomleft"; + popupAnchor.AssignWithConversion("bottomleft"); if (popupAlign.IsEmpty()) - popupAlign = "topleft"; + popupAlign.AssignWithConversion("topleft"); nsIPresContext* presContext = aState.GetPresContext(); ((nsMenuPopupFrame*)activeChild)->SyncViewWithFrame(presContext, popupAnchor, popupAlign, mElementFrame, mXPos, mYPos); @@ -483,7 +483,7 @@ nsPopupSetFrame::CreatePopup(nsIFrame* aElementFrame, nsIContent* aPopupContent, // determine if this menu is a context menu and flag it nsIFrame* activeChild = GetActiveChild(); nsCOMPtr childPopup ( do_QueryInterface(activeChild) ); - if ( childPopup && aPopupType.Equals("context") ) + if ( childPopup && aPopupType.EqualsWithConversion("context") ) childPopup->SetIsContextMenu(PR_TRUE); // Now we'll have it in our child frame list. @@ -523,7 +523,7 @@ nsPopupSetFrame::MarkAsGenerated(nsIContent* aPopupContent) nsAutoString value; childContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, value); - if (value.Equals("true")) { + if (value.EqualsWithConversion("true")) { // Ungenerate this element. childContent->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, PR_TRUE); @@ -535,9 +535,9 @@ nsPopupSetFrame::MarkAsGenerated(nsIContent* aPopupContent) nsAutoString value; aPopupContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, value); - if (!value.Equals("true")) { + if (!value.EqualsWithConversion("true")) { // Generate this element. - aPopupContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, "true", + aPopupContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::menugenerated, NS_ConvertASCIItoUCS2("true"), PR_TRUE); } } @@ -582,7 +582,7 @@ nsPopupSetFrame::ActivatePopup(PRBool aActivateFlag) // We wait until the last possible moment to show to avoid flashing, but we can just go // ahead and hide it here if we're told to (no additional stages necessary). if (aActivateFlag) - content->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, "true", PR_TRUE); + content->SetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, NS_ConvertASCIItoUCS2("true"), PR_TRUE); else { content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menuactive, PR_TRUE); content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::menutobedisplayed, PR_TRUE); diff --git a/layout/xul/base/src/nsPopupSetFrame.h b/layout/xul/base/src/nsPopupSetFrame.h index 103fbe271988..c057bdc7bc0c 100644 --- a/layout/xul/base/src/nsPopupSetFrame.h +++ b/layout/xul/base/src/nsPopupSetFrame.h @@ -110,7 +110,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "PopupSet"; + aResult.AssignWithConversion("PopupSet"); return NS_OK; } diff --git a/layout/xul/base/src/nsProgressMeterFrame.cpp b/layout/xul/base/src/nsProgressMeterFrame.cpp index bf8da0c5ff88..7ccf31d09161 100644 --- a/layout/xul/base/src/nsProgressMeterFrame.cpp +++ b/layout/xul/base/src/nsProgressMeterFrame.cpp @@ -122,8 +122,8 @@ nsProgressMeterFrame::AttributeChanged(nsIPresContext* aPresContext, PRInt32 remainder = 100 - flex; nsAutoString leftFlex, rightFlex; - leftFlex.Append(flex); - rightFlex.Append(remainder); + leftFlex.AppendInt(flex); + rightFlex.AppendInt(remainder); progressBar->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, leftFlex, PR_TRUE); progressRemainder->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, rightFlex, PR_TRUE); } diff --git a/layout/xul/base/src/nsScrollbarButtonFrame.cpp b/layout/xul/base/src/nsScrollbarButtonFrame.cpp index 07dac3dbcda2..1af4890d83b4 100644 --- a/layout/xul/base/src/nsScrollbarButtonFrame.cpp +++ b/layout/xul/base/src/nsScrollbarButtonFrame.cpp @@ -156,9 +156,9 @@ nsScrollbarButtonFrame::MouseClicked() { // if our class is DecrementButton subtract the current pos by increment amount // if our class is IncrementButton increment the current pos by the decrement amount - if (value.Equals("decrement")) + if (value.EqualsWithConversion("decrement")) curpos -= increment; - else if (value.Equals("increment")) + else if (value.EqualsWithConversion("increment")) curpos += increment; // make sure the current positon is between the current and max positions @@ -171,7 +171,7 @@ nsScrollbarButtonFrame::MouseClicked() char v[100]; sprintf(v, "%d", curpos); - content->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, v, PR_TRUE); + content->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2(v), PR_TRUE); } diff --git a/layout/xul/base/src/nsSliderFrame.cpp b/layout/xul/base/src/nsSliderFrame.cpp index da1b2602a86c..12c2b19aeebc 100644 --- a/layout/xul/base/src/nsSliderFrame.cpp +++ b/layout/xul/base/src/nsSliderFrame.cpp @@ -181,7 +181,7 @@ nsSliderFrame::AttributeChanged(nsIPresContext* aPresContext, sprintf(ch,"%d", current); // set the new position but don't notify anyone. We already know - scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_FALSE); + scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2(ch), PR_FALSE); } } @@ -614,7 +614,7 @@ nsSliderFrame::SetCurrentPosition(nsIContent* scrollbar, nsIFrame* aThumbFrame, sprintf(ch,"%d", newpos); // set the new position - scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, nsAutoString(ch), PR_TRUE); + scrollbar->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2(ch), PR_TRUE); if (DEBUG_SLIDER) printf("Current Pos=%s\n",ch); diff --git a/layout/xul/base/src/nsSplitterFrame.cpp b/layout/xul/base/src/nsSplitterFrame.cpp index 3a6dd04e1b72..4aaf9af6d47a 100644 --- a/layout/xul/base/src/nsSplitterFrame.cpp +++ b/layout/xul/base/src/nsSplitterFrame.cpp @@ -276,7 +276,7 @@ nsSplitterFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // create a spring nsCOMPtr content; NS_CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, content); - content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, "100%", PR_FALSE); + content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, NS_ConvertASCIItoUCS2("100%"), PR_FALSE); aAnonymousChildren.AppendElement(content); // a grippy @@ -285,7 +285,7 @@ nsSplitterFrame::CreateAnonymousContent(nsIPresContext* aPresContext, // create a spring NS_CreateAnonymousNode(mContent, nsXULAtoms::spring, nsXULAtoms::nameSpaceID, content); - content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, "100%", PR_FALSE); + content->SetAttribute(kNameSpaceID_None, nsXULAtoms::flex, NS_ConvertASCIItoUCS2("100%"), PR_FALSE); aAnonymousChildren.AppendElement(content); } } @@ -492,7 +492,7 @@ nsSplitterFrameInner::MouseUp(nsIPresContext* aPresContext, nsGUIEvent* aEvent) State newState = GetState(); // if the state is dragging then make it Open. if (newState == Dragging) - mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "", PR_TRUE); + mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, nsAutoString(), PR_TRUE); mPressed = PR_FALSE; @@ -586,7 +586,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent //printf("Collapse right\n"); if (GetCollapseDirection() == After) { - mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE); + mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("collapsed"), PR_TRUE); } @@ -595,7 +595,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent //printf("Collapse left\n"); if (GetCollapseDirection() == Before) { - mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE); + mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("collapsed"), PR_TRUE); } } @@ -604,7 +604,7 @@ nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent // if we are not in a collapsed position and we are not dragging make sure // we are dragging. if (currentState != Dragging) - mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "dragging", PR_TRUE); + mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("dragging"), PR_TRUE); #ifdef REAL_TIME_DRAG AdjustChildren(aPresContext); @@ -879,7 +879,7 @@ nsSplitterFrameInner::MouseMove(nsIDOMEvent* aMouseEvent) if (IsMouseCaptured(mOuter->mPresContext)) return NS_OK; - mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "dragging", PR_TRUE); + mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, NS_ConvertASCIItoUCS2("dragging"), PR_TRUE); RemoveListener(); CaptureMouse(mOuter->mPresContext, PR_TRUE); @@ -957,7 +957,7 @@ nsSplitterFrameInner::UpdateState() // Open -> Collapsed // Dragging -> Collapsed sibling->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, - "true", PR_TRUE); + NS_ConvertASCIItoUCS2("true"), PR_TRUE); } } } @@ -1144,10 +1144,10 @@ nsSplitterFrameInner::SetPreferredSize(nsBoxLayoutState& aState, nsIBox* aChildB sprintf(ch,"%d",pref/aOnePixel); nsAutoString oldValue; content->GetAttribute(kNameSpaceID_None, attribute, oldValue); - if (oldValue == ch) + if (oldValue.EqualsWithConversion(ch)) return; - content->SetAttribute(kNameSpaceID_None, attribute, ch, PR_FALSE); + content->SetAttribute(kNameSpaceID_None, attribute, NS_ConvertASCIItoUCS2(ch), PR_FALSE); #ifndef REAL_TIME_DRAG aChildBox->MarkDirty(aState); #else diff --git a/layout/xul/base/src/nsSpringFrame.h b/layout/xul/base/src/nsSpringFrame.h index 2ec9e2dd7228..5f3d2e602c8f 100644 --- a/layout/xul/base/src/nsSpringFrame.h +++ b/layout/xul/base/src/nsSpringFrame.h @@ -48,7 +48,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "Spring"; + aResult.AssignWithConversion("Spring"); return NS_OK; } diff --git a/layout/xul/base/src/nsStackFrame.h b/layout/xul/base/src/nsStackFrame.h index 705b13daaee7..ef362a1c5ba9 100644 --- a/layout/xul/base/src/nsStackFrame.h +++ b/layout/xul/base/src/nsStackFrame.h @@ -42,7 +42,7 @@ public: #ifdef NS_DEBUG NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "Stack"; + aResult.AssignWithConversion("Stack"); return NS_OK; } #endif diff --git a/layout/xul/base/src/nsStdColorPicker.cpp b/layout/xul/base/src/nsStdColorPicker.cpp index 37f4455e8c37..4edab2876ae5 100644 --- a/layout/xul/base/src/nsStdColorPicker.cpp +++ b/layout/xul/base/src/nsStdColorPicker.cpp @@ -195,7 +195,7 @@ NS_IMETHODIMP nsStdColorPicker::Paint(nsIPresContext * aPresContext, nsIRenderin for (i=0;iSetColor(color); aRenderingContext->FillRect(col*width, row*height, width, height); diff --git a/layout/xul/base/src/nsTabFrame.cpp b/layout/xul/base/src/nsTabFrame.cpp index 4163fa95dcb3..2f7d30c02f97 100644 --- a/layout/xul/base/src/nsTabFrame.cpp +++ b/layout/xul/base/src/nsTabFrame.cpp @@ -105,17 +105,17 @@ nsTabFrame::MouseClicked(nsIPresContext* aPresContext) parent->ChildAt(oldIndex, *getter_AddRefs(child)); // set the old tab to be unselected - child->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::selected, "false", PR_TRUE); + child->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::selected, NS_ConvertASCIItoUCS2("false"), PR_TRUE); // set the new tab to be selected - mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::selected, "true", PR_TRUE); + mContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::selected, NS_ConvertASCIItoUCS2("true"), PR_TRUE); } // set the panels index char value[100]; sprintf(value, "%d", index); - tabpanel->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::index, value, PR_TRUE); + tabpanel->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::index, NS_ConvertASCIItoUCS2(value), PR_TRUE); } diff --git a/layout/xul/base/src/nsTextBoxFrame.cpp b/layout/xul/base/src/nsTextBoxFrame.cpp index 9ea32cfd3f77..1765dfa6b472 100644 --- a/layout/xul/base/src/nsTextBoxFrame.cpp +++ b/layout/xul/base/src/nsTextBoxFrame.cpp @@ -107,7 +107,7 @@ nsTextBoxFrame::AttributeChanged(nsIPresContext* aPresContext, return NS_OK; } -nsTextBoxFrame::nsTextBoxFrame(nsIPresShell* aShell):nsLeafBoxFrame(aShell),mTitle(""), mCropType(CropRight),mAccessKeyInfo(nsnull) +nsTextBoxFrame::nsTextBoxFrame(nsIPresShell* aShell):nsLeafBoxFrame(aShell), mCropType(CropRight),mAccessKeyInfo(nsnull) { mState |= NS_STATE_NEED_LAYOUT; NeedsRecalc(); @@ -140,17 +140,17 @@ nsTextBoxFrame::Init(nsIPresContext* aPresContext, nsAutoString accesskey; mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey, accesskey); - if (accesskey != "") { + if (!accesskey.IsEmpty()) { if (!mAccessKeyInfo) mAccessKeyInfo = new nsAccessKeyInfo(); mAccessKeyInfo->mAccesskeyIndex = -1; mAccessKeyInfo->mAccesskeyIndex = mTitle.Find(accesskey, PR_TRUE); if (mAccessKeyInfo->mAccesskeyIndex == -1) { - nsString tmpstring = "(" ; + nsString tmpstring; tmpstring.AssignWithConversion("("); accesskey.ToUpperCase(); tmpstring += accesskey; - tmpstring += ")"; + tmpstring.AppendWithConversion(")"); PRUint32 offset = mTitle.RFind("..."); if ( offset != kNotFound) mTitle.Insert(tmpstring,offset); @@ -411,11 +411,11 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin mTitleWidth = aWidth; if (aWidth <= elipsisWidth) { - mCroppedTitle = ""; + mCroppedTitle.SetLength(0); return; } - mCroppedTitle = ELIPSIS; + mCroppedTitle.AssignWithConversion(ELIPSIS); aWidth -= elipsisWidth; @@ -468,7 +468,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin if (i == 0) break; - nsString copy = ""; + nsString copy; mTitle.Right(copy, length-i-1); mCroppedTitle = mCroppedTitle + copy; } @@ -476,10 +476,10 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin case CropCenter: - nsString elipsisLeft = ELIPSIS; + nsString elipsisLeft; elipsisLeft.AssignWithConversion(ELIPSIS); if (aWidth <= elipsisWidth) - elipsisLeft = ""; + elipsisLeft.SetLength(0); else aWidth -= elipsisWidth; @@ -513,7 +513,7 @@ nsTextBoxFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRenderin } - nsString copy = ""; + nsString copy; if (i2 > i) mTitle.Mid(copy, i,i2-i); @@ -541,7 +541,7 @@ nsTextBoxFrame::UpdateAccessUnderline() nsAutoString accesskey; mContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::accesskey, accesskey); - if (accesskey == "") { + if (accesskey.IsEmpty()) { if (mAccessKeyInfo) { delete mAccessKeyInfo; mAccessKeyInfo = nsnull; @@ -650,8 +650,8 @@ nsTextBoxFrame::GetAscent(nsBoxLayoutState& aBoxLayoutState, nscoord& aAscent) NS_IMETHODIMP nsTextBoxFrame::GetFrameName(nsString& aResult) const { - aResult = "Text[value="; + aResult.AssignWithConversion("Text[value="); aResult += mTitle; - aResult += "]"; + aResult.AppendWithConversion("]"); return NS_OK; } diff --git a/layout/xul/base/src/nsTitledButtonFrame.cpp b/layout/xul/base/src/nsTitledButtonFrame.cpp index 614f53c11126..6dec4c0db271 100644 --- a/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -221,7 +221,6 @@ nsTitledButtonFrame::nsTitledButtonFrame(nsIPresShell* aShell):nsLeafBoxFrame(aS mMinSize(0,0), mAscent(0) { - mTitle = ""; mAlign = GetDefaultAlignment(); mCropType = CropRight; mNeedsLayout = PR_TRUE; @@ -295,7 +294,7 @@ nsTitledButtonFrame::Init(nsIPresContext* aPresContext, // that UpdateAttributes doesn't double start an image load. nsAutoString src; GetImageSource(src); - if (!src.Equals("")) { + if (!src.IsEmpty()) { mHasImage = PR_TRUE; } mImageLoader.Init(this, UpdateImageFrame, nsnull, baseURL, src); @@ -315,10 +314,10 @@ nsTitledButtonFrame::Init(nsIPresContext* aPresContext, if (!accesskey.IsEmpty()) { mAccesskeyIndex = mTitle.Find(accesskey, PR_TRUE); if (mAccesskeyIndex == -1) { - nsString tmpstring = "(" ; + nsString tmpstring; tmpstring.AssignWithConversion("("); accesskey.ToUpperCase(); tmpstring += accesskey; - tmpstring += ")"; + tmpstring.AppendWithConversion(")"); PRUint32 offset = mTitle.RFind("..."); if ( offset != kNotFound) mTitle.Insert(tmpstring,offset); @@ -347,7 +346,7 @@ nsTitledButtonFrame::GetImageSource(nsString& aResult) mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::src, aResult); // if the new image is empty - if (aResult.Equals("")) { + if (aResult.IsEmpty()) { // get the list-style-image const nsStyleList* myList = (const nsStyleList*)mStyleContext->GetStyleData(eStyleStruct_List); @@ -447,7 +446,7 @@ nsTitledButtonFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize) // see if the source changed // get the old image src - nsAutoString oldSrc =""; + nsAutoString oldSrc; mImageLoader.GetURLSpec(oldSrc); // get the new image src @@ -457,7 +456,7 @@ nsTitledButtonFrame::UpdateImage(nsIPresContext* aPresContext, PRBool& aResize) // see if the images are different if (!oldSrc.Equals(src)) { - if (!src.Equals("")) { + if (!src.IsEmpty()) { mSizeFrozen = PR_FALSE; mHasImage = PR_TRUE; } else { @@ -562,7 +561,7 @@ nsTitledButtonFrame::LayoutTitleAndImage(nsIPresContext* aPresContext, nscoord center_x = rect.x + rect.width/2; nscoord center_y = rect.y + rect.height/2; - mCroppedTitle = ""; + mCroppedTitle.SetLength(0); nscoord spacing = 0; @@ -695,11 +694,11 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen mTitleRect.width = aWidth; if (aWidth <= elipsisWidth) { - mCroppedTitle = ""; + mCroppedTitle.SetLength(0); return; } - mCroppedTitle = ELIPSIS; + mCroppedTitle.AssignWithConversion(ELIPSIS); aWidth -= elipsisWidth; @@ -752,7 +751,7 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen if (i == 0) break; - nsString copy = ""; + nsString copy; mTitle.Right(copy, length-i-1); mCroppedTitle = mCroppedTitle + copy; } @@ -760,10 +759,10 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen case CropCenter: - nsString elipsisLeft = ELIPSIS; + nsString elipsisLeft; elipsisLeft.AssignWithConversion(ELIPSIS); if (aWidth <= elipsisWidth) - elipsisLeft = ""; + elipsisLeft.SetLength(0); else aWidth -= elipsisWidth; @@ -797,7 +796,7 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext* aPresContext, nsIRen } - nsString copy = ""; + nsString copy; if (i2 > i) mTitle.Mid(copy, i,i2-i); @@ -1283,9 +1282,9 @@ nsTitledButtonFrame::MouseClicked (nsIPresContext* aPresContext) nsTitledButtonFrame::CheckState nsTitledButtonFrame :: StringToCheckState ( const nsString & aStateAsString ) { - if ( aStateAsString.Equals(NS_STRING_TRUE) ) + if ( aStateAsString.EqualsWithConversion(NS_STRING_TRUE) ) return eOn; - else if ( aStateAsString.Equals(NS_STRING_FALSE) ) + else if ( aStateAsString.EqualsWithConversion(NS_STRING_FALSE) ) return eOff; // not true and not false means mixed @@ -1303,19 +1302,19 @@ nsTitledButtonFrame :: CheckStateToString ( CheckState inState, nsString& outSta { switch ( inState ) { case eOn: - outStateAsString = NS_STRING_TRUE; + outStateAsString.AssignWithConversion(NS_STRING_TRUE); break; case eOff: - outStateAsString = NS_STRING_FALSE; + outStateAsString.AssignWithConversion(NS_STRING_FALSE); break; case eMixed: - outStateAsString = "2"; + outStateAsString.AssignWithConversion("2"); break; case eUnset: - outStateAsString = ""; + outStateAsString.SetLength(0); } } // CheckStateToString @@ -1551,8 +1550,8 @@ nsTitledButtonFrame::CacheSizes(nsBoxLayoutState& aBoxLayoutState) NS_IMETHODIMP nsTitledButtonFrame::GetFrameName(nsString& aResult) const { - aResult = "TitledButton[value="; + aResult.AssignWithConversion("TitledButton[value="); aResult += mTitle; - aResult += "]"; + aResult.AppendWithConversion("]"); return NS_OK; } diff --git a/layout/xul/base/src/nsToolbarDragListener.cpp b/layout/xul/base/src/nsToolbarDragListener.cpp index 4e3f8594264c..0a789b8006e0 100644 --- a/layout/xul/base/src/nsToolbarDragListener.cpp +++ b/layout/xul/base/src/nsToolbarDragListener.cpp @@ -201,8 +201,8 @@ nsToolbarDragListener :: ItemMouseIsOver ( nsIDOMEvent* aDragEvent, nscoord* out nsCOMPtr domElement ( do_QueryInterface(content) ); if ( domElement ) { nsAutoString value; - domElement->GetAttribute(nsAutoString("container"), value); // can't use an atom here =( - isContainer = value.Equals("true"); + domElement->GetAttribute(NS_ConvertASCIItoUCS2("container"), value); // can't use an atom here =( + isContainer = value.EqualsWithConversion("true"); } else NS_WARNING("Not a DOM element"); @@ -292,10 +292,10 @@ nsToolbarDragListener::DragOver(nsIDOMEvent* aDragEvent) // need the cast, because on some platforms, PR[U]int32 != long, but we're using "%ld" sprintf(buffer, "%ld", NS_STATIC_CAST(long, xLoc)); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE ); sprintf(buffer, "%ld", NS_STATIC_CAST(long, beforeIndex)); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, buffer, PR_FALSE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, onChild ? "true" : "false", PR_FALSE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2(buffer), PR_FALSE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, NS_ConvertASCIItoUCS2(onChild ? "true" : "false"), PR_FALSE ); } // cache the current drop location @@ -343,9 +343,9 @@ nsToolbarDragListener::DragExit(nsIDOMEvent* aDragEvent) // AttributeChanged() about that attribute. char buffer[10]; sprintf(buffer, "%d", -1); - myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE ); - myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, buffer, PR_FALSE ); - myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaint, "1", PR_TRUE ); + myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE ); + myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2(buffer), PR_FALSE ); + myContent->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaint, NS_ConvertASCIItoUCS2("1"), PR_TRUE ); // reset the current drop location mCurrentDropLoc = -1; diff --git a/layout/xul/base/src/nsToolbarFrame.cpp b/layout/xul/base/src/nsToolbarFrame.cpp index 48962844224f..85a6469ca1a6 100644 --- a/layout/xul/base/src/nsToolbarFrame.cpp +++ b/layout/xul/base/src/nsToolbarFrame.cpp @@ -175,8 +175,8 @@ nsToolbarFrame :: ~nsToolbarFrame ( ) // NOTE: the last Remove will delete the drag listener if ( receiver ) { - receiver->RemoveEventListener("dragover", mDragListener, PR_TRUE); - receiver->RemoveEventListener("dragexit", mDragListener, PR_TRUE); + receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragListener, PR_TRUE); + receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragListener, PR_TRUE); } } @@ -205,8 +205,8 @@ nsToolbarFrame::Init ( nsIPresContext* aPresContext, nsIContent* aContent, // with enough info to determine where the drop would happen so that JS down the // line can do the right thing. mDragListener = new nsToolbarDragListener(this, aPresContext); - receiver->AddEventListener("dragover", mDragListener, PR_TRUE); - receiver->AddEventListener("dragexit", mDragListener, PR_TRUE); + receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragListener, PR_TRUE); + receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragListener, PR_TRUE); #if 0 //TEMP_HACK_FOR_BUG_11291 // Ok, this is a hack until Ender lands. We need to have a mouse listener on text widgets diff --git a/layout/xul/base/src/nsToolbarFrame.h b/layout/xul/base/src/nsToolbarFrame.h index a20b5e89c725..a98d17a44093 100644 --- a/layout/xul/base/src/nsToolbarFrame.h +++ b/layout/xul/base/src/nsToolbarFrame.h @@ -98,7 +98,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "Toolbar"; + aResult.AssignWithConversion("Toolbar"); return NS_OK; } diff --git a/layout/xul/base/src/nsToolboxFrame.h b/layout/xul/base/src/nsToolboxFrame.h index 36630d80648e..e9737b83187e 100644 --- a/layout/xul/base/src/nsToolboxFrame.h +++ b/layout/xul/base/src/nsToolboxFrame.h @@ -72,7 +72,7 @@ public: NS_IMETHOD GetFrameName(nsString& aResult) const { - aResult = "Toolbox"; + aResult.AssignWithConversion("Toolbox"); return NS_OK; } diff --git a/layout/xul/base/src/nsTreeCellFrame.cpp b/layout/xul/base/src/nsTreeCellFrame.cpp index 48789d6cee72..ca5b3c81fdd8 100644 --- a/layout/xul/base/src/nsTreeCellFrame.cpp +++ b/layout/xul/base/src/nsTreeCellFrame.cpp @@ -84,7 +84,7 @@ nsTreeCellFrame::Init(nsIPresContext* aPresContext, nsresult result = aContent->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, attrValue); attrValue.ToLowerCase(); PRBool allowEvents = (result == NS_CONTENT_ATTR_NO_VALUE || - (result == NS_CONTENT_ATTR_HAS_VALUE && attrValue.Equals("true"))); + (result == NS_CONTENT_ATTR_HAS_VALUE && attrValue.EqualsWithConversion("true"))); SetAllowEvents(allowEvents); // Determine if we're a column header or not. @@ -171,7 +171,7 @@ nsTreeCellFrame::GetFrameForPoint(nsIPresContext* aPresContext, // This allows selective overriding for subcontent. nsAutoString value; content->GetAttribute(kNameSpaceID_None, nsXULAtoms::allowevents, value); - if (value.Equals("true")) + if (value.EqualsWithConversion("true")) return result; } } @@ -354,18 +354,18 @@ nsTreeCellFrame::ToggleOpenClose() // Take the tree item content and toggle the value of its open attribute. nsAutoString attrValue; - treeItem->GetAttribute("open", attrValue); + treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), attrValue); attrValue.ToLowerCase(); - PRBool isExpanded = (attrValue.Equals("true")); + PRBool isExpanded = (attrValue.EqualsWithConversion("true")); if (isExpanded) { // We're collapsing and need to remove frames from the flow. - treeItem->RemoveAttribute("open"); + treeItem->RemoveAttribute(NS_ConvertASCIItoUCS2("open")); } else { // We're expanding and need to add frames to the flow. - treeItem->SetAttribute("open", "true"); + treeItem->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true")); } } } @@ -389,12 +389,12 @@ nsTreeCellFrame::Open() // Take the tree item content and toggle the value of its open attribute. nsAutoString attrValue; - treeItem->GetAttribute("open", attrValue); + treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), attrValue); attrValue.ToLowerCase(); - PRBool isExpanded = (attrValue.Equals("true")); + PRBool isExpanded = (attrValue.EqualsWithConversion("true")); if (!isExpanded) { // We're expanding and need to add frames to the flow. - treeItem->SetAttribute("open", "true"); + treeItem->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true")); } } } @@ -418,12 +418,12 @@ nsTreeCellFrame::Close() // Take the tree item content and toggle the value of its open attribute. nsAutoString attrValue; - treeItem->GetAttribute("open", attrValue); + treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), attrValue); attrValue.ToLowerCase(); - PRBool isExpanded = (attrValue.Equals("true")); + PRBool isExpanded = (attrValue.EqualsWithConversion("true")); if (isExpanded) { // We're expanding and need to add frames to the flow. - treeItem->RemoveAttribute("open"); + treeItem->RemoveAttribute(NS_ConvertASCIItoUCS2("open")); } } } @@ -449,9 +449,9 @@ void nsTreeCellFrame::Hover(nsIPresContext* aPresContext, PRBool isHover, PRBool if (isHover) { // We're selecting the node. - mContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow); - rowContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow); - itemContent->SetAttribute(kNameSpaceID_None, kHoverAtom, "true", notifyForReflow); + mContent->SetAttribute(kNameSpaceID_None, kHoverAtom, NS_ConvertASCIItoUCS2("true"), notifyForReflow); + rowContent->SetAttribute(kNameSpaceID_None, kHoverAtom, NS_ConvertASCIItoUCS2("true"), notifyForReflow); + itemContent->SetAttribute(kNameSpaceID_None, kHoverAtom, NS_ConvertASCIItoUCS2("true"), notifyForReflow); } else { diff --git a/layout/xul/base/src/nsTreeFrame.cpp b/layout/xul/base/src/nsTreeFrame.cpp index 477ecc546d36..2192428e6c74 100644 --- a/layout/xul/base/src/nsTreeFrame.cpp +++ b/layout/xul/base/src/nsTreeFrame.cpp @@ -139,7 +139,7 @@ void nsTreeFrame::SetSelection(nsIPresContext* aPresContext, nsTreeCellFrame* aF nsCOMPtr itemElement = do_QueryInterface(itemContent); nsCOMPtr kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect")); - mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, "true", PR_FALSE); + mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, NS_ConvertASCIItoUCS2("true"), PR_FALSE); treeElement->SelectItem(itemElement); mContent->UnsetAttribute(kNameSpaceID_None, kSuppressSelectChange, PR_FALSE); treeElement->SelectCell(cellElement); @@ -161,7 +161,7 @@ void nsTreeFrame::ToggleSelection(nsIPresContext* aPresContext, nsTreeCellFrame* nsCOMPtr itemElement = do_QueryInterface(itemContent); nsCOMPtr kSuppressSelectChange = dont_AddRef(NS_NewAtom("suppressonselect")); - mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, "true", PR_FALSE); + mContent->SetAttribute(kNameSpaceID_None, kSuppressSelectChange, NS_ConvertASCIItoUCS2("true"), PR_FALSE); treeElement->ToggleItemSelection(itemElement); mContent->UnsetAttribute(kNameSpaceID_None, kSuppressSelectChange, PR_FALSE); treeElement->ToggleCellSelection(cellElement); @@ -380,7 +380,7 @@ NS_IMETHODIMP nsTreeFrame::Destroy(nsIPresContext* aPresContext) { nsCOMPtr target = do_QueryInterface(mContent); - target->RemoveEventListener("mousedown", mTwistyListener, PR_TRUE); + target->RemoveEventListener(NS_ConvertASCIItoUCS2("mousedown"), mTwistyListener, PR_TRUE); mTwistyListener = nsnull; return nsTableFrame::Destroy(aPresContext); } @@ -487,11 +487,11 @@ nsTreeFrame::Init(nsIPresContext* aPresContext, nsCOMPtr target = do_QueryInterface(mContent); - target->AddEventListener("mousedown", mTwistyListener, PR_TRUE); + target->AddEventListener(NS_ConvertASCIItoUCS2("mousedown"), mTwistyListener, PR_TRUE); nsAutoString value; nsCOMPtr element = do_QueryInterface(mContent); - element->GetAttribute("rows", value); + element->GetAttribute(NS_ConvertASCIItoUCS2("rows"), value); if (!value.IsEmpty()) { PRInt32 dummy; @@ -514,7 +514,7 @@ nsTreeFrame::ContainsFlexibleColumn(PRInt32 aStartIndex, PRInt32 aEndIndex, if (colContent) { nsAutoString fixedValue; colContent->GetAttribute(kNameSpaceID_None, fixedAtom, fixedValue); - if (!fixedValue.Equals("true")) { + if (!fixedValue.EqualsWithConversion("true")) { // We are a proportional column. if (aResult) *aResult = result; diff --git a/layout/xul/base/src/nsTreeItemDragCapturer.cpp b/layout/xul/base/src/nsTreeItemDragCapturer.cpp index 94f7a6216e1b..1c7139fbc7ee 100644 --- a/layout/xul/base/src/nsTreeItemDragCapturer.cpp +++ b/layout/xul/base/src/nsTreeItemDragCapturer.cpp @@ -164,8 +164,8 @@ nsTreeItemDragCapturer :: ComputeDropPosition ( nsIDOMEvent* aDragEvent, nscoord nsCOMPtr treeItemNode ( do_QueryInterface(treeItemContent) ); if ( treeItemNode ) { nsAutoString value; - treeItemNode->GetAttribute(nsAutoString("container"), value); // can't use an atom here =( - isContainer = value.Equals("true"); + treeItemNode->GetAttribute(NS_ConvertASCIItoUCS2("container"), value); // can't use an atom here =( + isContainer = value.EqualsWithConversion("true"); } else NS_WARNING("Not a DOM element"); @@ -231,9 +231,9 @@ nsTreeItemDragCapturer::DragOver(nsIDOMEvent* aDragEvent) // need the cast, because on some platforms, PR[U]int32 != long, but we're using "%ld" sprintf(buffer, "%d", yLoc); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, beforeMe ? "true" : "false", PR_FALSE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, onMe ? "true" : "false", PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2(beforeMe ? "true" : "false"), PR_FALSE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, NS_ConvertASCIItoUCS2(onMe ? "true" : "false"), PR_TRUE ); } // cache the current drop location @@ -264,10 +264,10 @@ nsTreeItemDragCapturer::DragExit(nsIDOMEvent* aDragEvent) // AttributeChanged() about that attribute. char buffer[10]; sprintf(buffer, "%d", kNoDropLoc); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, buffer, PR_TRUE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, "false", PR_TRUE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, "false", PR_TRUE ); - content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaintRestore, "1", PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocationCoord, NS_ConvertASCIItoUCS2(buffer), PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropLocation, NS_ConvertASCIItoUCS2("false"), PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddDropOn, NS_ConvertASCIItoUCS2("false"), PR_TRUE ); + content->SetAttribute ( kNameSpaceID_None, nsXULAtoms::ddTriggerRepaintRestore, NS_ConvertASCIItoUCS2("1"), PR_TRUE ); } // cache the current drop location diff --git a/layout/xul/base/src/nsTreeRowFrame.cpp b/layout/xul/base/src/nsTreeRowFrame.cpp index c826dd5bf70c..ad3cb489a5d1 100644 --- a/layout/xul/base/src/nsTreeRowFrame.cpp +++ b/layout/xul/base/src/nsTreeRowFrame.cpp @@ -309,7 +309,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext, if (colContent) { nsAutoString fixedValue; colContent->GetAttribute(kNameSpaceID_None, fixedAtom, fixedValue); - if (!fixedValue.Equals("true")) { + if (!fixedValue.EqualsWithConversion("true")) { // We are a proportional column and should be annotated with our current // width. PRInt32 colWidth = treeFrame->GetColumnWidth(i); @@ -328,7 +328,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext, PRInt32 colWidth = colWidths[i]; char ch[100]; sprintf(ch,"%d*", colWidth); - nsAutoString propColWidth(ch); + nsAutoString propColWidth; propColWidth.AssignWithConversion(ch); colContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, propColWidth, PR_TRUE); } @@ -379,7 +379,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext, colWidth = colWidths[colX] + mod; sprintf(ch,"%d*", colWidth); - nsAutoString propColWidth(ch); + nsAutoString propColWidth; propColWidth.AssignWithConversion(ch); colFrame->GetContent(getter_AddRefs(colContent)); if (colContent) { @@ -395,7 +395,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext, if (remaining != 0 && colContent) { colWidth += remaining; sprintf(ch,"%d*", colWidth); - nsAutoString propColWidth(ch); + nsAutoString propColWidth; propColWidth.AssignWithConversion(ch); colContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, propColWidth, PR_TRUE); @@ -412,7 +412,7 @@ nsTreeRowFrame::HandleHeaderDragEvent(nsIPresContext* aPresContext, colWidth = flexWidth - delta; sprintf(ch,"%d*", colWidth); - nsAutoString propColWidth(ch); + nsAutoString propColWidth; propColWidth.AssignWithConversion(ch); flexContent->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, propColWidth, PR_TRUE); // NOW we send the notification that causes the reflow. } diff --git a/layout/xul/base/src/nsTreeRowGroupFrame.cpp b/layout/xul/base/src/nsTreeRowGroupFrame.cpp index 1f09c2886a9d..1ec4780c51bd 100644 --- a/layout/xul/base/src/nsTreeRowGroupFrame.cpp +++ b/layout/xul/base/src/nsTreeRowGroupFrame.cpp @@ -131,8 +131,8 @@ nsTreeRowGroupFrame::~nsTreeRowGroupFrame() // NOTE: the last Remove will delete the drag capturer if ( receiver ) { - receiver->RemoveEventListener("dragover", mDragCapturer, PR_TRUE); - receiver->RemoveEventListener("dragexit", mDragCapturer, PR_TRUE); + receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragCapturer, PR_TRUE); + receiver->RemoveEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragCapturer, PR_TRUE); } NS_IF_RELEASE(mContentChain); @@ -214,8 +214,8 @@ nsTreeRowGroupFrame::Init ( nsIPresContext* aPresContext, nsIContent* aContent, // with enough info to determine where the drop would happen so that JS down the // line can do the right thing. mDragCapturer = new nsTreeItemDragCapturer(this, aPresContext); - receiver->AddEventListener("dragover", mDragCapturer, PR_TRUE); - receiver->AddEventListener("dragexit", mDragCapturer, PR_TRUE); + receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragover"), mDragCapturer, PR_TRUE); + receiver->AddEventListener(NS_ConvertASCIItoUCS2("dragexit"), mDragCapturer, PR_TRUE); } return rv; @@ -551,7 +551,7 @@ nsTreeRowGroupFrame::FindRowContentAtIndex(PRInt32& aIndex, nsCOMPtr openAtom = dont_AddRef(NS_NewAtom("open")); nsAutoString isOpen; childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen); - if (isOpen.Equals("true")) { + if (isOpen.EqualsWithConversion("true")) { // Find the node. PRInt32 childContentCount; nsCOMPtr grandChild; @@ -627,7 +627,7 @@ nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpward nsCOMPtr openAtom = dont_AddRef(NS_NewAtom("open")); nsAutoString isOpen; childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen); - if (isOpen.Equals("true")) { + if (isOpen.EqualsWithConversion("true")) { // Find the node. PRInt32 childContentCount; nsCOMPtr grandChild; @@ -695,7 +695,7 @@ nsTreeRowGroupFrame::ComputeTotalRowCount(PRInt32& aCount, nsIContent* aParent) nsCOMPtr parent; childContent->GetParent(*getter_AddRefs(parent)); parent->GetAttribute(kNameSpaceID_None, openAtom, isOpen); - if (isOpen.Equals("true")) + if (isOpen.EqualsWithConversion("true")) ComputeTotalRowCount(aCount, childContent); } } @@ -828,7 +828,7 @@ nsTreeRowGroupFrame::PagedUpDown() #ifdef DEBUG_tree printf("PagedUpDown, setting increment to %d\n", rowGroupCount); #endif - scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, nsAutoString(ch), PR_FALSE); + scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, NS_ConvertASCIItoUCS2(ch), PR_FALSE); } return NS_OK; @@ -847,12 +847,12 @@ nsTreeRowGroupFrame::SetScrollbarFrame(nsIPresContext* aPresContext, nsIFrame* a aFrame->GetContent(getter_AddRefs(scrollbarContent)); nsAutoString scrollFactor; - scrollFactor.Append(SCROLL_FACTOR); + scrollFactor.AppendWithConversion(SCROLL_FACTOR); - scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, "0", PR_FALSE); + scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, NS_ConvertASCIItoUCS2("0"), PR_FALSE); scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::increment, scrollFactor, PR_FALSE); - scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, "1", PR_FALSE); - scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::maxpos, "5000", PR_FALSE); + scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::pageincrement, NS_ConvertASCIItoUCS2("1"), PR_FALSE); + scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::maxpos, NS_ConvertASCIItoUCS2("5000"), PR_FALSE); nsIFrame* result; nsScrollbarButtonFrame::GetChildWithTag(aPresContext, nsXULAtoms::slider, aFrame, result); @@ -1496,7 +1496,7 @@ void nsTreeRowGroupFrame::OnContentRemoved(nsIPresContext* aPresContext, mCurrentIndex--; nsAutoString indexStr; PRInt32 pixelIndex = mCurrentIndex * SCROLL_FACTOR; - indexStr.Append(pixelIndex); + indexStr.AppendInt(pixelIndex); nsCOMPtr scrollbarContent; mScrollbar->GetContent(getter_AddRefs(scrollbarContent)); @@ -1564,7 +1564,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext) if (count < pageRowCount) { // first set the position to 0 so that all visible content // scrolls into view - value.Append(0); + value.AppendInt(0); scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, value, PR_TRUE); @@ -1578,7 +1578,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext) nsXULAtoms::curpos, value); } - if (nukeScrollbar || (value.Equals("0") && !mIsFull)) { + if (nukeScrollbar || (value.EqualsWithConversion("0") && !mIsFull)) { // clear the scrollbar out of the event state manager so that the // event manager doesn't send events to the destroyed scrollbar frames @@ -1629,7 +1629,7 @@ nsTreeRowGroupFrame::ReflowScrollbar(nsIPresContext* aPresContext) rowCount *= SCROLL_FACTOR; char ch[100]; sprintf(ch,"%d", rowCount); - maxpos = ch; + maxpos.AssignWithConversion(ch); } // Make sure our position is accurate @@ -1673,7 +1673,7 @@ void nsTreeRowGroupFrame::CreateScrollbar(nsIPresContext* aPresContext) nsCOMPtr document(do_QueryInterface(idocument)); nsCOMPtr node; - document->CreateElement("scrollbar",getter_AddRefs(node)); + document->CreateElement(NS_ConvertASCIItoUCS2("scrollbar"),getter_AddRefs(node)); nsCOMPtr content = do_QueryInterface(node); content->SetDocument(idocument, PR_FALSE); @@ -1684,7 +1684,7 @@ void nsTreeRowGroupFrame::CreateScrollbar(nsIPresContext* aPresContext) xulContent->SetAnonymousState(PR_TRUE); // Mark as anonymous to keep events from getting out. nsCOMPtr align = dont_AddRef(NS_NewAtom("align")); - content->SetAttribute(kNameSpaceID_None, align, "vertical", PR_FALSE); + content->SetAttribute(kNameSpaceID_None, align, NS_ConvertASCIItoUCS2("vertical"), PR_FALSE); nsIFrame* aResult; mFrameConstructor->CreateTreeWidgetContent(aPresContext, this, nsnull, content, @@ -1846,7 +1846,7 @@ nsTreeRowGroupFrame::EnsureRowIsVisible(PRInt32 aRowIndex) #endif scrollTo *= SCROLL_FACTOR; - value.Append(scrollTo); + value.AppendInt(scrollTo); scrollbarContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::curpos, value, PR_TRUE); @@ -1913,7 +1913,7 @@ void nsTreeRowGroupFrame::ScrollByLines(nsIPresContext* aPresContext, scrollTo *= SCROLL_FACTOR; nsAutoString value; - value.Append(scrollTo); + value.AppendInt(scrollTo); nsCOMPtr scrollbarContent; mScrollbar->GetContent(getter_AddRefs(scrollbarContent)); @@ -2136,7 +2136,7 @@ nsTreeRowGroupFrame :: AttributeChanged ( nsIPresContext* aPresContext, nsIConte nsAutoString attribute; aChild->GetAttribute ( kNameSpaceID_None, aAttribute, attribute ); attribute.ToLowerCase(); - mDropOnContainer = attribute.Equals("true"); + mDropOnContainer = attribute.EqualsWithConversion("true"); } else rv = nsTableRowGroupFrame::AttributeChanged ( aPresContext, aChild, aNameSpaceID, aAttribute, aHint ); @@ -2443,9 +2443,9 @@ nsTreeRowGroupFrame :: IsOpenContainer ( ) const nsCOMPtr me ( do_QueryInterface(mContent) ); if ( me ) { nsAutoString isContainer, isOpen; - me->GetAttribute(nsAutoString("container"), isContainer); - me->GetAttribute(nsAutoString("open"), isOpen); - isOpenContainer = (isContainer.Equals("true") && isOpen.Equals("true")); + me->GetAttribute(NS_ConvertASCIItoUCS2("container"), isContainer); + me->GetAttribute(NS_ConvertASCIItoUCS2("open"), isOpen); + isOpenContainer = (isContainer.EqualsWithConversion("true") && isOpen.EqualsWithConversion("true")); } return isOpenContainer; diff --git a/layout/xul/base/src/nsTreeTwistyListener.cpp b/layout/xul/base/src/nsTreeTwistyListener.cpp index 43be1c8abc00..10e38837e92f 100644 --- a/layout/xul/base/src/nsTreeTwistyListener.cpp +++ b/layout/xul/base/src/nsTreeTwistyListener.cpp @@ -88,11 +88,11 @@ nsTreeTwistyListener::MouseDown(nsIDOMEvent* aEvent) nsAutoString tagName; element->GetTagName(tagName); - if (tagName.Equals("titledbutton")) { + if (tagName.EqualsWithConversion("titledbutton")) { // Find out if we're the twisty. nsAutoString classAttr; - element->GetAttribute("class", classAttr); - if (classAttr.Equals("twisty")) { + element->GetAttribute(NS_ConvertASCIItoUCS2("class"), classAttr); + if (classAttr.EqualsWithConversion("twisty")) { // Retrieve the parent treeitem. nsCOMPtr treeItem; GetTreeItem(element, getter_AddRefs(treeItem)); @@ -106,10 +106,10 @@ nsTreeTwistyListener::MouseDown(nsIDOMEvent* aEvent) aEvent->PreventDefault(); nsAutoString open; - treeItem->GetAttribute("open", open); - if (open.Equals("true")) - treeItem->RemoveAttribute("open"); - else treeItem->SetAttribute("open", "true"); + treeItem->GetAttribute(NS_ConvertASCIItoUCS2("open"), open); + if (open.EqualsWithConversion("true")) + treeItem->RemoveAttribute(NS_ConvertASCIItoUCS2("open")); + else treeItem->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true")); } } return NS_OK; diff --git a/layout/xul/content/src/nsXULAtoms.cpp b/layout/xul/content/src/nsXULAtoms.cpp index 9eed84f46e4f..653e4f1f20c0 100644 --- a/layout/xul/content/src/nsXULAtoms.cpp +++ b/layout/xul/content/src/nsXULAtoms.cpp @@ -47,7 +47,7 @@ void nsXULAtoms::AddRefAtoms() { */ if (NS_SUCCEEDED(NS_NewNameSpaceManager(&gNameSpaceManager))) { // gNameSpaceManager->CreateRootNameSpace(namespace); - nsAutoString nameSpace(kXULNameSpace); + nsAutoString nameSpace; nameSpace.AssignWithConversion(kXULNameSpace); gNameSpaceManager->RegisterNameSpace(nameSpace, nameSpaceID); } else { NS_ASSERTION(0, "failed to create xul atoms namespace manager");