making string conversions explicit

This commit is contained in:
scc%netscape.com 2000-04-16 11:19:26 +00:00
Родитель 61b4c6f8bb
Коммит b4caf7e667
82 изменённых файлов: 539 добавлений и 548 удалений

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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);

Просмотреть файл

@ -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");

Просмотреть файл

@ -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<nsIDOMAttr> attr(do_QueryInterface(attribute));
nsAutoString name;
attr->GetName(name);
if (!name.Equals("excludes")) {
if (!name.EqualsWithConversion("excludes")) {
nsAutoString value;
nsCOMPtr<nsIDOMElement> 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<nsIAtom> 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<nsIAtom> eventName = getter_AddRefs(NS_NewAtom(eventStr));

Просмотреть файл

@ -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<nsIDOMKeyEvent> 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<nsIDOMKeyEvent> 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<nsIDOMKeyEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIAtom> 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);
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -1342,7 +1342,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
nsCOMPtr<nsIDOMDocument> 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);

Просмотреть файл

@ -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;

Просмотреть файл

@ -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<nsIHTTPProtocolHandler> theService(do_GetService(kHTTPHandlerCID,

Просмотреть файл

@ -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);

Просмотреть файл

@ -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<nsIAtom> 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<nsIContent> 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);
}
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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<nsISupports> 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<nsIDOMHTMLCollection> 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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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<nsIAtom> 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<nsIContent> 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);
}
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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 {

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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<nsISupports> 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<nsIDOMHTMLCollection> 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;
}

Просмотреть файл

@ -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;

Просмотреть файл

@ -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<nsIEditorIMESupport> 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);
nsCOMPtr<nsIDOMDocument>domDoc;
@ -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; }
nsCOMPtr<nsIDOMNode>bodyNode;
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<nsIDOMSelection> 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;

Просмотреть файл

@ -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<nsISupports> 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<nsIDOMHTMLCollection> 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;
}

Просмотреть файл

@ -1342,7 +1342,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
nsCOMPtr<nsIDOMDocument> 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);

Просмотреть файл

@ -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<nsIDOMAttr> attr(do_QueryInterface(attribute));
nsAutoString name;
attr->GetName(name);
if (!name.Equals("excludes")) {
if (!name.EqualsWithConversion("excludes")) {
nsAutoString value;
nsCOMPtr<nsIDOMElement> 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<nsIAtom> 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<nsIAtom> eventName = getter_AddRefs(NS_NewAtom(eventStr));

Просмотреть файл

@ -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<nsIDOMKeyEvent> 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<nsIDOMKeyEvent> 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<nsIDOMKeyEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIDOMUIEvent> 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<nsIAtom> 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);
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -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);

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -63,7 +63,7 @@ public:
#ifdef NS_DEBUG
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "Deck";
aResult.AssignWithConversion("Deck");
return NS_OK;
}
#endif

Просмотреть файл

@ -87,12 +87,12 @@ nsGrippyFrame::MouseClicked(nsIPresContext* aPresContext)
nsCOMPtr<nsIContent> 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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -211,7 +211,7 @@ nsLeafBoxFrame::Reflow(nsIPresContext* aPresContext,
NS_IMETHODIMP
nsLeafBoxFrame::GetFrameName(nsString& aResult) const
{
aResult = "LeafBox";
aResult.AssignWithConversion("LeafBox");
return NS_OK;
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -110,7 +110,7 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "MenuBar";
aResult.AssignWithConversion("MenuBar");
return NS_OK;
}

Просмотреть файл

@ -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<nsIContent> child;
GetMenuChildrenElement(getter_AddRefs(child));
if (child) {

Просмотреть файл

@ -154,7 +154,7 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "Menu";
aResult.AssignWithConversion("Menu");
return NS_OK;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -132,7 +132,7 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "MenuPopup";
aResult.AssignWithConversion("MenuPopup");
return NS_OK;
}

Просмотреть файл

@ -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<nsIMenuParent> 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);

Просмотреть файл

@ -110,7 +110,7 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "PopupSet";
aResult.AssignWithConversion("PopupSet");
return NS_OK;
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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);

Просмотреть файл

@ -276,7 +276,7 @@ nsSplitterFrame::CreateAnonymousContent(nsIPresContext* aPresContext,
// create a spring
nsCOMPtr<nsIContent> 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

Просмотреть файл

@ -48,7 +48,7 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "Spring";
aResult.AssignWithConversion("Spring");
return NS_OK;
}

Просмотреть файл

@ -42,7 +42,7 @@ public:
#ifdef NS_DEBUG
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "Stack";
aResult.AssignWithConversion("Stack");
return NS_OK;
}
#endif

Просмотреть файл

@ -195,7 +195,7 @@ NS_IMETHODIMP nsStdColorPicker::Paint(nsIPresContext * aPresContext, nsIRenderin
for (i=0;i<mColors;i++)
{
NS_LooseHexToRGB(mPalette[i], &color);
NS_LooseHexToRGB(NS_ConvertASCIItoUCS2(mPalette[i]), &color);
aRenderingContext->SetColor(color);
aRenderingContext->FillRect(col*width, row*height, width, height);

Просмотреть файл

@ -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);
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -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;
}

Просмотреть файл

@ -201,8 +201,8 @@ nsToolbarDragListener :: ItemMouseIsOver ( nsIDOMEvent* aDragEvent, nscoord* out
nsCOMPtr<nsIDOMElement> 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;

Просмотреть файл

@ -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

Просмотреть файл

@ -98,7 +98,7 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "Toolbar";
aResult.AssignWithConversion("Toolbar");
return NS_OK;
}

Просмотреть файл

@ -72,7 +72,7 @@ public:
NS_IMETHOD GetFrameName(nsString& aResult) const
{
aResult = "Toolbox";
aResult.AssignWithConversion("Toolbox");
return NS_OK;
}

Просмотреть файл

@ -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
{

Просмотреть файл

@ -139,7 +139,7 @@ void nsTreeFrame::SetSelection(nsIPresContext* aPresContext, nsTreeCellFrame* aF
nsCOMPtr<nsIDOMXULElement> itemElement = do_QueryInterface(itemContent);
nsCOMPtr<nsIAtom> 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<nsIDOMXULElement> itemElement = do_QueryInterface(itemContent);
nsCOMPtr<nsIAtom> 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<nsIDOMEventReceiver> 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<nsIDOMEventReceiver> target = do_QueryInterface(mContent);
target->AddEventListener("mousedown", mTwistyListener, PR_TRUE);
target->AddEventListener(NS_ConvertASCIItoUCS2("mousedown"), mTwistyListener, PR_TRUE);
nsAutoString value;
nsCOMPtr<nsIDOMElement> 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;

Просмотреть файл

@ -164,8 +164,8 @@ nsTreeItemDragCapturer :: ComputeDropPosition ( nsIDOMEvent* aDragEvent, nscoord
nsCOMPtr<nsIDOMElement> 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

Просмотреть файл

@ -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.
}

Просмотреть файл

@ -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<nsIAtom> openAtom = dont_AddRef(NS_NewAtom("open"));
nsAutoString isOpen;
childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
if (isOpen.Equals("true")) {
if (isOpen.EqualsWithConversion("true")) {
// Find the <treechildren> node.
PRInt32 childContentCount;
nsCOMPtr<nsIContent> grandChild;
@ -627,7 +627,7 @@ nsTreeRowGroupFrame::FindPreviousRowContent(PRInt32& aDelta, nsIContent* aUpward
nsCOMPtr<nsIAtom> openAtom = dont_AddRef(NS_NewAtom("open"));
nsAutoString isOpen;
childContent->GetAttribute(kNameSpaceID_None, openAtom, isOpen);
if (isOpen.Equals("true")) {
if (isOpen.EqualsWithConversion("true")) {
// Find the <treechildren> node.
PRInt32 childContentCount;
nsCOMPtr<nsIContent> grandChild;
@ -695,7 +695,7 @@ nsTreeRowGroupFrame::ComputeTotalRowCount(PRInt32& aCount, nsIContent* aParent)
nsCOMPtr<nsIContent> 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<nsIContent> 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<nsIDOMDocument> document(do_QueryInterface(idocument));
nsCOMPtr<nsIDOMElement> node;
document->CreateElement("scrollbar",getter_AddRefs(node));
document->CreateElement(NS_ConvertASCIItoUCS2("scrollbar"),getter_AddRefs(node));
nsCOMPtr<nsIContent> 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<nsIAtom> 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<nsIContent> 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<nsIDOMElement> 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;

Просмотреть файл

@ -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<nsIDOMElement> 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;

Просмотреть файл

@ -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");