From 380edd4af3e57719d413b0796863cd3cc646498f Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 11 Jan 2002 19:39:51 +0000 Subject: [PATCH] Change more instances of NS_ConvertASCIItoUCS2 to NS_LITERAL_STRING. Bug 104159, r=jag, sr=alecf git-svn-id: svn://10.0.0.236/trunk@111953 18797224-902f-48f8-a5cc-f745e15eee43 --- .../layout/forms/nsComboboxControlFrame.cpp | 2 +- mozilla/layout/forms/nsFormControlHelper.cpp | 4 ++-- .../forms/nsGfxCheckboxControlFrame.cpp | 2 +- .../layout/forms/nsGfxRadioControlFrame.cpp | 4 ++-- mozilla/layout/forms/nsIsIndexFrame.cpp | 2 +- .../html/forms/src/nsComboboxControlFrame.cpp | 2 +- .../html/forms/src/nsFormControlHelper.cpp | 4 ++-- .../forms/src/nsGfxCheckboxControlFrame.cpp | 2 +- .../html/forms/src/nsGfxRadioControlFrame.cpp | 4 ++-- .../html/forms/src/nsGfxTextControlFrame.cpp | 20 +++++++++---------- .../html/forms/src/nsGfxTextControlFrame2.cpp | 12 +++++------ .../layout/html/forms/src/nsIsIndexFrame.cpp | 2 +- 12 files changed, 30 insertions(+), 30 deletions(-) diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index 734c1d0711c..ee6d5d6f2dd 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -2258,7 +2258,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, eventReceiver->AddEventListenerByIID(mButtonListener, NS_GET_IID(nsIDOMMouseListener)); } - btnContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE); + btnContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_LITERAL_STRING("button"), PR_FALSE); aChildList.AppendElement(btnContent); } } diff --git a/mozilla/layout/forms/nsFormControlHelper.cpp b/mozilla/layout/forms/nsFormControlHelper.cpp index ad2b50ac287..11e5cbf710d 100644 --- a/mozilla/layout/forms/nsFormControlHelper.cpp +++ b/mozilla/layout/forms/nsFormControlHelper.cpp @@ -135,10 +135,10 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString) { // Windows linebreaks: Map CRLF to LF: - aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\n")); + aString.ReplaceSubstring(NS_LITERAL_STRING("\r\n").get(), NS_LITERAL_STRING("\n").get()); // Mac linebreaks: Map any remaining CR to LF: - aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n")); + aString.ReplaceSubstring(NS_LITERAL_STRING("\r").get(), NS_LITERAL_STRING("\n").get()); } PRBool nsFormControlHelper::GetBool(const nsAReadableString& aValue) diff --git a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp index aeaa5e39873..217a4596454 100644 --- a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -156,7 +156,7 @@ nsGfxCheckboxControlFrame::Init(nsIPresContext* aPresContext, // give the attribute a default value so it's always present, if we're a tristate if ( IsTristateCheckbox() ) - mContent->SetAttr ( kNameSpaceID_None, GetTristateValueAtom(), NS_ConvertASCIItoUCS2("0"), PR_FALSE ); + mContent->SetAttr ( kNameSpaceID_None, GetTristateValueAtom(), NS_LITERAL_STRING("0"), PR_FALSE ); return NS_OK; } diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp index bff1033983f..b1f8e5e217a 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp @@ -219,9 +219,9 @@ nsGfxRadioControlFrame::SetChecked(nsIPresContext* aPresContext, PRBool aValue, { if (aSetInitialValue) { if (aValue) { - mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("1"), PR_FALSE); // XXX should be "empty" value + mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_LITERAL_STRING("1"), PR_FALSE); // XXX should be "empty" value } else { - mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("0"), PR_FALSE); + mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_LITERAL_STRING("0"), PR_FALSE); } } diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp index bc83727ee8f..05778806dbb 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.cpp +++ b/mozilla/layout/forms/nsIsIndexFrame.cpp @@ -272,7 +272,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext, result = content->QueryInterface(NS_GET_IID(nsIHTMLContent),(void**)&mInputContent); if (NS_SUCCEEDED(result)) { - mInputContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE); + mInputContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_LITERAL_STRING("text"), PR_FALSE); aChildList.AppendElement(mInputContent); // Register as an event listener to submit on Enter press diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index 734c1d0711c..ee6d5d6f2dd 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -2258,7 +2258,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsIPresContext* aPresContext, eventReceiver->AddEventListenerByIID(mButtonListener, NS_GET_IID(nsIDOMMouseListener)); } - btnContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("button"), PR_FALSE); + btnContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_LITERAL_STRING("button"), PR_FALSE); aChildList.AppendElement(btnContent); } } diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp index ad2b50ac287..11e5cbf710d 100644 --- a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp @@ -135,10 +135,10 @@ void nsFormControlHelper::ForceDrawFrame(nsIPresContext* aPresContext, nsIFrame void nsFormControlHelper::PlatformToDOMLineBreaks(nsString &aString) { // Windows linebreaks: Map CRLF to LF: - aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r\n"), NS_ConvertASCIItoUCS2("\n")); + aString.ReplaceSubstring(NS_LITERAL_STRING("\r\n").get(), NS_LITERAL_STRING("\n").get()); // Mac linebreaks: Map any remaining CR to LF: - aString.ReplaceSubstring(NS_ConvertASCIItoUCS2("\r"), NS_ConvertASCIItoUCS2("\n")); + aString.ReplaceSubstring(NS_LITERAL_STRING("\r").get(), NS_LITERAL_STRING("\n").get()); } PRBool nsFormControlHelper::GetBool(const nsAReadableString& aValue) diff --git a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index aeaa5e39873..217a4596454 100644 --- a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -156,7 +156,7 @@ nsGfxCheckboxControlFrame::Init(nsIPresContext* aPresContext, // give the attribute a default value so it's always present, if we're a tristate if ( IsTristateCheckbox() ) - mContent->SetAttr ( kNameSpaceID_None, GetTristateValueAtom(), NS_ConvertASCIItoUCS2("0"), PR_FALSE ); + mContent->SetAttr ( kNameSpaceID_None, GetTristateValueAtom(), NS_LITERAL_STRING("0"), PR_FALSE ); return NS_OK; } diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp index bff1033983f..b1f8e5e217a 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -219,9 +219,9 @@ nsGfxRadioControlFrame::SetChecked(nsIPresContext* aPresContext, PRBool aValue, { if (aSetInitialValue) { if (aValue) { - mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("1"), PR_FALSE); // XXX should be "empty" value + mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_LITERAL_STRING("1"), PR_FALSE); // XXX should be "empty" value } else { - mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_ConvertASCIItoUCS2("0"), PR_FALSE); + mContent->SetAttr(kNameSpaceID_HTML, nsHTMLAtoms::checked, NS_LITERAL_STRING("0"), PR_FALSE); } } diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp index 1ede27b3249..da669ff63af 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -980,7 +980,7 @@ NS_METHOD nsGfxTextControlFrame::HandleEvent(nsIPresContext* aPresContext, break; case NS_FORM_SELECTED: - return UpdateTextControlCommands(NS_ConvertASCIItoUCS2("select")); + return UpdateTextControlCommands(NS_LITERAL_STRING("select")); break; } return NS_OK; @@ -1417,7 +1417,7 @@ nsGfxTextControlFrame::CreateSubDoc(nsRect *aSizeOfSubdocContainer) if (!htmlElement) { return NS_ERROR_NULL_POINTER; } // create the head - nimgr->GetNodeInfo(NS_ConvertASCIItoUCS2("head"), nsnull, + nimgr->GetNodeInfo(NS_LITERAL_STRING("head"), nsnull, kNameSpaceID_None, *getter_AddRefs(nodeInfo)); rv = NS_NewHTMLHeadElement(getter_AddRefs(headElement), nodeInfo); @@ -3411,7 +3411,7 @@ nsGfxTextControlFrame::InitializeTextControl(nsIPresShell *aPresShell, nsIDOMDoc if (NS_FAILED(result)) { return result; } if (!selection) { return NS_ERROR_NULL_POINTER; } nsCOMPtrbodyNode; - result = GetFirstNodeOfType(NS_ConvertASCIItoUCS2("body"), aDoc, + result = GetFirstNodeOfType(NS_LITERAL_STRING("body"), aDoc, getter_AddRefs(bodyNode)); if (NS_SUCCEEDED(result) && bodyNode) { @@ -3506,13 +3506,13 @@ nsGfxTextControlFrame::InternalContentChanged() return mContent->HandleDOMEvent(mFramePresContext, &theEvent, nsnull, NS_EVENT_FLAG_INIT, &status); } -nsresult nsGfxTextControlFrame::UpdateTextControlCommands(const nsString& aCommand) +nsresult nsGfxTextControlFrame::UpdateTextControlCommands(const nsAString& aCommand) { nsresult rv = NS_OK; if (mEditor) { - if (aCommand == NS_ConvertASCIItoUCS2("select")) // optimize select updates + if (aCommand == NS_LITERAL_STRING("select")) // optimize select updates { nsCOMPtr domSelection; rv = mEditor->GetSelection(getter_AddRefs(domSelection)); @@ -3624,7 +3624,7 @@ nsGfxTextControlFrame::SaveState(nsIPresContext* aPresContext, nsIPresState** aS nsLinebreakConverter::eLinebreakPlatform, nsLinebreakConverter::eLinebreakContent); NS_ASSERTION(NS_SUCCEEDED(res), "Converting linebreaks failed!"); - (*aState)->SetStateProperty(NS_ConvertASCIItoUCS2("value"), theString); + (*aState)->SetStateProperty(NS_LITERAL_STRING("value"), theString); return res; } @@ -3632,7 +3632,7 @@ NS_IMETHODIMP nsGfxTextControlFrame::RestoreState(nsIPresContext* aPresContext, nsIPresState* aState) { nsAutoString stateString; - aState->GetStateProperty(NS_ConvertASCIItoUCS2("value"), stateString); + aState->GetStateProperty(NS_LITERAL_STRING("value"), stateString); nsresult res = SetProperty(aPresContext, nsHTMLAtoms::value, stateString); return res; } @@ -4651,7 +4651,7 @@ NS_IMETHODIMP nsEnderEventListener::DidDo(nsITransactionManager *aManager, if (undoCount == 1) { if (mFirstDoOfFirstUndo) - gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo")); + gfxFrame->UpdateTextControlCommands(NS_LITERAL_STRING("undo")); mFirstDoOfFirstUndo = PR_FALSE; } @@ -4678,7 +4678,7 @@ NS_IMETHODIMP nsEnderEventListener::DidUndo(nsITransactionManager *aManager, if (undoCount == 0) mFirstDoOfFirstUndo = PR_TRUE; // reset the state for the next do - gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo")); + gfxFrame->UpdateTextControlCommands(NS_LITERAL_STRING("undo")); } return NS_OK; @@ -4697,7 +4697,7 @@ NS_IMETHODIMP nsEnderEventListener::DidRedo(nsITransactionManager *aManager, nsGfxTextControlFrame *gfxFrame = mFrame.Reference(); if (gfxFrame) { - gfxFrame->UpdateTextControlCommands(NS_ConvertASCIItoUCS2("undo")); + gfxFrame->UpdateTextControlCommands(NS_LITERAL_STRING("undo")); } return NS_OK; diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 0c4e2ecdb68..492c4371729 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -221,7 +221,7 @@ public: protected: - nsresult UpdateTextInputCommands(const nsString& commandsToUpdate); + nsresult UpdateTextInputCommands(const nsAString& commandsToUpdate); protected: @@ -406,7 +406,7 @@ nsTextInputListener::NotifySelectionChanged(nsIDOMDocument* aDoc, nsISelection* mSelectionWasCollapsed = collapsed; mKnowSelectionCollapsed = PR_TRUE; - return UpdateTextInputCommands(NS_ConvertASCIItoUCS2("select")); + return UpdateTextInputCommands(NS_LITERAL_STRING("select")); } //EDITOR INTERFACE @@ -477,7 +477,7 @@ NS_IMETHODIMP nsTextInputListener::DidDo(nsITransactionManager *aManager, if (undoCount == 1) { if (mFirstDoOfFirstUndo) - UpdateTextInputCommands(NS_ConvertASCIItoUCS2("undo")); + UpdateTextInputCommands(NS_LITERAL_STRING("undo")); mFirstDoOfFirstUndo = PR_FALSE; } @@ -500,7 +500,7 @@ NS_IMETHODIMP nsTextInputListener::DidUndo(nsITransactionManager *aManager, if (undoCount == 0) mFirstDoOfFirstUndo = PR_TRUE; // reset the state for the next do - UpdateTextInputCommands(NS_ConvertASCIItoUCS2("undo")); + UpdateTextInputCommands(NS_LITERAL_STRING("undo")); return NS_OK; } @@ -515,7 +515,7 @@ NS_IMETHODIMP nsTextInputListener::WillRedo(nsITransactionManager *aManager, NS_IMETHODIMP nsTextInputListener::DidRedo(nsITransactionManager *aManager, nsITransaction *aTransaction, nsresult aRedoResult) { - UpdateTextInputCommands(NS_ConvertASCIItoUCS2("undo")); + UpdateTextInputCommands(NS_LITERAL_STRING("undo")); return NS_OK; } @@ -557,7 +557,7 @@ NS_IMETHODIMP nsTextInputListener::DidMerge(nsITransactionManager *aManager, -nsresult nsTextInputListener::UpdateTextInputCommands(const nsString& commandsToUpdate) +nsresult nsTextInputListener::UpdateTextInputCommands(const nsAString& commandsToUpdate) { if (!mFrame) return NS_ERROR_NOT_INITIALIZED; diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp index bc83727ee8f..05778806dbb 100644 --- a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp +++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp @@ -272,7 +272,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsIPresContext* aPresContext, result = content->QueryInterface(NS_GET_IID(nsIHTMLContent),(void**)&mInputContent); if (NS_SUCCEEDED(result)) { - mInputContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_ConvertASCIItoUCS2("text"), PR_FALSE); + mInputContent->SetAttr(kNameSpaceID_None, nsHTMLAtoms::type, NS_LITERAL_STRING("text"), PR_FALSE); aChildList.AppendElement(mInputContent); // Register as an event listener to submit on Enter press