NS_LITERAL_STRING cleanup (bug 26384; r=akk, sr=kin)
This commit is contained in:
Родитель
de4569576e
Коммит
f3928f8270
|
@ -510,7 +510,7 @@ nsIndentCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *
|
|||
nsresult rv = NS_OK;
|
||||
if (editorShell)
|
||||
{
|
||||
nsAutoString indentStr; indentStr.AssignWithConversion("indent");
|
||||
nsAutoString indentStr(NS_LITERAL_STRING("indent"));
|
||||
rv = editorShell->Indent(indentStr.get());
|
||||
}
|
||||
|
||||
|
@ -548,7 +548,7 @@ nsOutdentCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports
|
|||
nsresult rv = NS_OK;
|
||||
if (editorShell && EditingHTML(editorShell))
|
||||
{
|
||||
nsAutoString indentStr; indentStr.AssignWithConversion("outdent");
|
||||
nsAutoString indentStr(NS_LITERAL_STRING("outdent"));
|
||||
rv = editorShell->Indent(indentStr.get());
|
||||
}
|
||||
|
||||
|
@ -633,7 +633,7 @@ nsMultiStateCommand::UpdateCommandState(const nsAReadableString & aCommandName,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (isMixed)
|
||||
curFormat.AssignWithConversion("mixed");
|
||||
curFormat.Assign(NS_LITERAL_STRING("mixed"));
|
||||
|
||||
if (!mGotState || (curFormat != mStateString))
|
||||
{
|
||||
|
@ -723,7 +723,7 @@ nsFontFaceStateCommand::SetState(nsIEditorShell *aEditorShell, nsString& newStat
|
|||
nsCOMPtr<nsIAtom> ttAtom = getter_AddRefs(NS_NewAtom("tt"));
|
||||
nsCOMPtr<nsIAtom> fontAtom = getter_AddRefs(NS_NewAtom("font"));
|
||||
|
||||
if (newState.EqualsWithConversion("tt"))
|
||||
if (newState.Equals(NS_LITERAL_STRING("tt")))
|
||||
{
|
||||
// The old "teletype" attribute
|
||||
rv = htmlEditor->SetInlineProperty(ttAtom, NS_LITERAL_STRING(""), NS_LITERAL_STRING(""));
|
||||
|
@ -735,7 +735,7 @@ nsFontFaceStateCommand::SetState(nsIEditorShell *aEditorShell, nsString& newStat
|
|||
// Remove any existing TT nodes
|
||||
rv = htmlEditor->RemoveInlineProperty(ttAtom, NS_LITERAL_STRING(""));
|
||||
|
||||
if (!newState.Length() || newState.EqualsWithConversion("normal")) {
|
||||
if (!newState.Length() || newState.Equals(NS_LITERAL_STRING("normal"))) {
|
||||
rv = htmlEditor->RemoveInlineProperty(fontAtom, NS_LITERAL_STRING("face"));
|
||||
} else {
|
||||
rv = htmlEditor->SetInlineProperty(fontAtom, NS_LITERAL_STRING("face"), newState);
|
||||
|
@ -783,7 +783,7 @@ nsFontColorStateCommand::SetState(nsIEditorShell *aEditorShell, nsString& newSta
|
|||
|
||||
nsCOMPtr<nsIAtom> fontAtom = getter_AddRefs(NS_NewAtom("font"));
|
||||
|
||||
if (!newState.Length() || newState.EqualsWithConversion("normal")) {
|
||||
if (!newState.Length() || newState.Equals(NS_LITERAL_STRING("normal"))) {
|
||||
rv = htmlEditor->RemoveInlineProperty(fontAtom, NS_LITERAL_STRING("color"));
|
||||
} else {
|
||||
rv = htmlEditor->SetInlineProperty(fontAtom, NS_LITERAL_STRING("color"), newState);
|
||||
|
@ -855,19 +855,19 @@ nsAlignCommand::GetCurrentState(nsIEditorShell *aEditorShell, nsString& outState
|
|||
{
|
||||
default:
|
||||
case nsIHTMLEditor::eLeft:
|
||||
outStateString.AssignWithConversion("left");
|
||||
outStateString.Assign(NS_LITERAL_STRING("left"));
|
||||
break;
|
||||
|
||||
case nsIHTMLEditor::eCenter:
|
||||
outStateString.AssignWithConversion("center");
|
||||
outStateString.Assign(NS_LITERAL_STRING("center"));
|
||||
break;
|
||||
|
||||
case nsIHTMLEditor::eRight:
|
||||
outStateString.AssignWithConversion("right");
|
||||
outStateString.Assign(NS_LITERAL_STRING("right"));
|
||||
break;
|
||||
|
||||
case nsIHTMLEditor::eJustify:
|
||||
outStateString.AssignWithConversion("justify");
|
||||
outStateString.Assign(NS_LITERAL_STRING("justify"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -83,12 +83,12 @@ NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
|
|||
// begin debug output
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(mElement);
|
||||
nsAutoString elementTag; elementTag.AssignWithConversion("text node");
|
||||
nsAutoString elementTag(NS_LITERAL_STRING("text node"));
|
||||
if (element)
|
||||
element->GetTagName(elementTag);
|
||||
nsCOMPtr<nsIDOMElement> parentElement;
|
||||
parentElement = do_QueryInterface(mParent);
|
||||
nsAutoString parentElementTag; parentElementTag.AssignWithConversion("text node");
|
||||
nsAutoString parentElementTag(NS_LITERAL_STRING("text node"));
|
||||
if (parentElement)
|
||||
parentElement->GetTagName(parentElementTag);
|
||||
char *c, *p;
|
||||
|
@ -122,12 +122,12 @@ NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
|
|||
// begin debug output
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
element = do_QueryInterface(mElement);
|
||||
nsAutoString elementTag; elementTag.AssignWithConversion("text node");
|
||||
nsAutoString elementTag(NS_LITERAL_STRING("text node"));
|
||||
if (element)
|
||||
element->GetTagName(elementTag);
|
||||
nsCOMPtr<nsIDOMElement> parentElement;
|
||||
parentElement = do_QueryInterface(mParent);
|
||||
nsAutoString parentElementTag; parentElementTag.AssignWithConversion("text node");
|
||||
nsAutoString parentElementTag(NS_LITERAL_STRING("text node"));
|
||||
if (parentElement)
|
||||
parentElement->GetTagName(parentElementTag);
|
||||
char *c, *p;
|
||||
|
|
|
@ -240,9 +240,9 @@ nsPasteCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *a
|
|||
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoString cmdString(aCommandName);
|
||||
if (cmdString.EqualsWithConversion("cmd_paste"))
|
||||
if (cmdString.Equals(NS_LITERAL_STRING("cmd_paste")))
|
||||
rv = aEditor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
else if (cmdString.EqualsWithConversion("cmd_pasteQuote"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_pasteQuote")))
|
||||
{
|
||||
nsCOMPtr<nsIEditorMailSupport> mailEditor = do_QueryInterface(aEditor, &rv);
|
||||
if (mailEditor)
|
||||
|
@ -265,19 +265,19 @@ nsDeleteCommand::IsCommandEnabled(const nsAReadableString & aCommandName, nsISup
|
|||
|
||||
nsAutoString cmdString(aCommandName);
|
||||
|
||||
if (cmdString.EqualsWithConversion("cmd_delete"))
|
||||
if (cmdString.Equals(NS_LITERAL_STRING("cmd_delete")))
|
||||
rv = aEditor->CanCut(outCmdEnabled);
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteCharBackward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteCharBackward")))
|
||||
*outCmdEnabled = PR_TRUE;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteCharForward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteCharForward")))
|
||||
*outCmdEnabled = PR_TRUE;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteWordBackward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteWordBackward")))
|
||||
*outCmdEnabled = PR_TRUE;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteWordForward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteWordForward")))
|
||||
*outCmdEnabled = PR_TRUE;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteToBeginningOfLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteToBeginningOfLine")))
|
||||
*outCmdEnabled = PR_TRUE;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteToEndOfLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteToEndOfLine")))
|
||||
*outCmdEnabled = PR_TRUE;
|
||||
|
||||
return rv;
|
||||
|
@ -295,19 +295,19 @@ nsDeleteCommand::DoCommand(const nsAReadableString & aCommandName, nsISupports *
|
|||
|
||||
nsIEditor::EDirection deleteDir = nsIEditor::eNone;
|
||||
|
||||
if (cmdString.EqualsWithConversion("cmd_delete"))
|
||||
if (cmdString.Equals(NS_LITERAL_STRING("cmd_delete")))
|
||||
deleteDir = nsIEditor::ePrevious;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteCharBackward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteCharBackward")))
|
||||
deleteDir = nsIEditor::ePrevious;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteCharForward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteCharForward")))
|
||||
deleteDir = nsIEditor::eNext;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteWordBackward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteWordBackward")))
|
||||
deleteDir = nsIEditor::ePreviousWord;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteWordForward"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteWordForward")))
|
||||
deleteDir = nsIEditor::eNextWord;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteToBeginningOfLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteToBeginningOfLine")))
|
||||
deleteDir = nsIEditor::eToBeginningOfLine;
|
||||
else if (cmdString.EqualsWithConversion("cmd_deleteToEndOfLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_deleteToEndOfLine")))
|
||||
deleteDir = nsIEditor::eToEndOfLine;
|
||||
|
||||
return aEditor->DeleteSelection(deleteDir);
|
||||
|
@ -367,81 +367,81 @@ nsSelectionMoveCommands::DoCommand(const nsAReadableString & aCommandName, nsISu
|
|||
nsAutoString cmdString(aCommandName);
|
||||
|
||||
// complete scroll commands
|
||||
if (cmdString.EqualsWithConversion("cmd_scrollTop"))
|
||||
if (cmdString.Equals(NS_LITERAL_STRING("cmd_scrollTop")))
|
||||
return selCont->CompleteScroll(PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_scrollBottom"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_scrollBottom")))
|
||||
return selCont->CompleteScroll(PR_TRUE);
|
||||
|
||||
// complete move commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_moveTop"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_moveTop")))
|
||||
return selCont->CompleteMove(PR_FALSE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_moveBottom"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_moveBottom")))
|
||||
return selCont->CompleteMove(PR_TRUE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectTop"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectTop")))
|
||||
return selCont->CompleteMove(PR_FALSE, PR_TRUE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectBottom"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectBottom")))
|
||||
return selCont->CompleteMove(PR_TRUE, PR_TRUE);
|
||||
|
||||
// line move commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_lineNext"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_lineNext")))
|
||||
return selCont->LineMove(PR_TRUE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_linePrevious"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_linePrevious")))
|
||||
return selCont->LineMove(PR_FALSE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectLineNext"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectLineNext")))
|
||||
return selCont->LineMove(PR_TRUE, PR_TRUE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectLinePrevious"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectLinePrevious")))
|
||||
return selCont->LineMove(PR_FALSE, PR_TRUE);
|
||||
|
||||
// character move commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_charPrevious"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_charPrevious")))
|
||||
return selCont->CharacterMove(PR_FALSE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_charNext"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_charNext")))
|
||||
return selCont->CharacterMove(PR_TRUE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectCharPrevious"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectCharPrevious")))
|
||||
return selCont->CharacterMove(PR_FALSE, PR_TRUE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectCharNext"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectCharNext")))
|
||||
return selCont->CharacterMove(PR_TRUE, PR_TRUE);
|
||||
|
||||
// intra line move commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_beginLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_beginLine")))
|
||||
return selCont->IntraLineMove(PR_FALSE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_endLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_endLine")))
|
||||
return selCont->IntraLineMove(PR_TRUE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectBeginLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectBeginLine")))
|
||||
return selCont->IntraLineMove(PR_FALSE, PR_TRUE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectEndLine"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectEndLine")))
|
||||
return selCont->IntraLineMove(PR_TRUE, PR_TRUE);
|
||||
|
||||
// word move commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_wordPrevious"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_wordPrevious")))
|
||||
return selCont->WordMove(PR_FALSE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_wordNext"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_wordNext")))
|
||||
return selCont->WordMove(PR_TRUE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectWordPrevious"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectWordPrevious")))
|
||||
return selCont->WordMove(PR_FALSE, PR_TRUE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectWordNext"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectWordNext")))
|
||||
return selCont->WordMove(PR_TRUE, PR_TRUE);
|
||||
|
||||
// scroll page commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_scrollPageUp"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_scrollPageUp")))
|
||||
return selCont->ScrollPage(PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_scrollPageDown"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_scrollPageDown")))
|
||||
return selCont->ScrollPage(PR_TRUE);
|
||||
|
||||
// scroll line commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_scrollLineUp"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_scrollLineUp")))
|
||||
return selCont->ScrollLine(PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_scrollLineDown"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_scrollLineDown")))
|
||||
return selCont->ScrollLine(PR_TRUE);
|
||||
|
||||
// page move commands
|
||||
else if (cmdString.EqualsWithConversion("cmd_movePageUp"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_movePageUp")))
|
||||
return selCont->PageMove(PR_FALSE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_movePageDown"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_movePageDown")))
|
||||
return selCont->PageMove(PR_TRUE, PR_FALSE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectPageUp"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectPageUp")))
|
||||
return selCont->PageMove(PR_FALSE, PR_TRUE);
|
||||
else if (cmdString.EqualsWithConversion("cmd_selectPageDown"))
|
||||
else if (cmdString.Equals(NS_LITERAL_STRING("cmd_selectPageDown")))
|
||||
return selCont->PageMove(PR_TRUE, PR_TRUE);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче