зеркало из https://github.com/mozilla/gecko-dev.git
NS_LITERAL_STRING cleanup (bug 26384; r=akk, sr=kin)
This commit is contained in:
Родитель
62e41cea2f
Коммит
3508890dd3
|
@ -157,7 +157,7 @@ nsresult TextEditorTest::TestTextProperties()
|
|||
TEST_RESULT(result);
|
||||
TEST_POINTER(doc.get());
|
||||
nsCOMPtr<nsIDOMNodeList>nodeList;
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
nsAutoString textTag(NS_LITERAL_STRING("__moz_text"));
|
||||
result = doc->GetElementsByTagName(textTag, getter_AddRefs(nodeList));
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(nodeList.get());
|
||||
|
|
|
@ -230,7 +230,7 @@ nsEditProperty::nsEditProperty()
|
|||
|
||||
// special
|
||||
if ( (nsIEditProperty::allProperties = new nsString) != nsnull )
|
||||
nsIEditProperty::allProperties->AssignWithConversion("moz_allproperties");
|
||||
nsIEditProperty::allProperties->Assign(NS_LITERAL_STRING("moz_allproperties"));
|
||||
}
|
||||
|
||||
nsEditProperty::~nsEditProperty()
|
||||
|
|
|
@ -698,7 +698,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
#ifdef DEBUG_clipboard
|
||||
printf("Got flavor [%s]\n", bestFlavor);
|
||||
#endif
|
||||
if (flavor.EqualsWithConversion(kHTMLMime))
|
||||
if (flavor.Equals(NS_LITERAL_STRING(kHTMLMime)))
|
||||
{
|
||||
nsCOMPtr<nsISupportsWString> textDataObj ( do_QueryInterface(genericDataObj) );
|
||||
if (textDataObj && len > 0)
|
||||
|
@ -714,7 +714,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
nsMemory::Free(text);
|
||||
}
|
||||
}
|
||||
else if (flavor.EqualsWithConversion(kUnicodeMime))
|
||||
else if (flavor.Equals(NS_LITERAL_STRING(kUnicodeMime)))
|
||||
{
|
||||
nsCOMPtr<nsISupportsWString> textDataObj ( do_QueryInterface(genericDataObj) );
|
||||
if (textDataObj && len > 0)
|
||||
|
@ -730,7 +730,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
nsMemory::Free(text);
|
||||
}
|
||||
}
|
||||
else if (flavor.EqualsWithConversion(kFileMime))
|
||||
else if (flavor.Equals(NS_LITERAL_STRING(kFileMime)))
|
||||
{
|
||||
nsCOMPtr<nsIFile> fileObj ( do_QueryInterface(genericDataObj) );
|
||||
if (fileObj && len > 0)
|
||||
|
@ -766,17 +766,17 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
len = strlen(urltext);
|
||||
if ( insertAsImage )
|
||||
{
|
||||
stuffToPaste.AssignWithConversion ( "<IMG src=\"", 10);
|
||||
stuffToPaste.Assign(NS_LITERAL_STRING("<IMG src=\""));
|
||||
stuffToPaste.AppendWithConversion ( urltext, len );
|
||||
stuffToPaste.AppendWithConversion ( "\" alt=\"\" >" );
|
||||
stuffToPaste.Append(NS_LITERAL_STRING("\" alt=\"\" >"));
|
||||
}
|
||||
else /* insert as link */
|
||||
{
|
||||
stuffToPaste.AssignWithConversion ( "<A href=\"" );
|
||||
stuffToPaste.Assign(NS_LITERAL_STRING("<A href=\""));
|
||||
stuffToPaste.AppendWithConversion ( urltext, len );
|
||||
stuffToPaste.AppendWithConversion ( "\">" );
|
||||
stuffToPaste.Append(NS_LITERAL_STRING("\">"));
|
||||
stuffToPaste.AppendWithConversion ( urltext, len );
|
||||
stuffToPaste.AppendWithConversion ( "</A>" );
|
||||
stuffToPaste.Append(NS_LITERAL_STRING("</A>"));
|
||||
}
|
||||
nsAutoEditBatch beginBatching(this);
|
||||
rv = InsertHTML(stuffToPaste);
|
||||
|
@ -785,7 +785,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
|
|||
}
|
||||
}
|
||||
}
|
||||
else if (flavor.EqualsWithConversion(kJPEGImageMime))
|
||||
else if (flavor.Equals(NS_LITERAL_STRING(kJPEGImageMime)))
|
||||
{
|
||||
// Insert Image code here
|
||||
printf("Don't know how to insert an image yet!\n");
|
||||
|
@ -1409,7 +1409,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAReadableString & aCit
|
|||
if (!handled)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> newNode;
|
||||
nsAutoString tag; tag.AssignWithConversion("blockquote");
|
||||
nsAutoString tag(NS_LITERAL_STRING("blockquote"));
|
||||
res = DeleteSelectionAndCreateNode(tag, getter_AddRefs(newNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!newNode) return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1418,8 +1418,8 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsCitedQuotation(const nsAReadableString & aCit
|
|||
nsCOMPtr<nsIDOMElement> newElement (do_QueryInterface(newNode));
|
||||
if (newElement)
|
||||
{
|
||||
nsAutoString type; type.AssignWithConversion("type");
|
||||
nsAutoString cite; cite.AssignWithConversion("cite");
|
||||
nsAutoString type(NS_LITERAL_STRING("type"));
|
||||
nsAutoString cite(NS_LITERAL_STRING("cite"));
|
||||
newElement->SetAttribute(type, cite);
|
||||
}
|
||||
|
||||
|
@ -1481,7 +1481,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
|
|||
#endif
|
||||
nsAutoString flavor; flavor.AssignWithConversion(flav);
|
||||
nsAutoString stuffToPaste;
|
||||
if (flavor.EqualsWithConversion(kUnicodeMime))
|
||||
if (flavor.Equals(NS_LITERAL_STRING(kUnicodeMime)))
|
||||
{
|
||||
nsCOMPtr<nsISupportsWString> textDataObj ( do_QueryInterface(genericDataObj) );
|
||||
if (textDataObj && len > 0)
|
||||
|
@ -1630,7 +1630,7 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsAReadableString & aQuotedText,
|
|||
if (cancel) return NS_OK; // rules canceled the operation
|
||||
if (!handled)
|
||||
{
|
||||
nsAutoString tag; tag.AssignWithConversion("blockquote");
|
||||
nsAutoString tag(NS_LITERAL_STRING("blockquote"));
|
||||
res = DeleteSelectionAndCreateNode(tag, getter_AddRefs(newNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!newNode) return NS_ERROR_NULL_POINTER;
|
||||
|
@ -1639,8 +1639,8 @@ nsHTMLEditor::InsertAsCitedQuotation(const nsAReadableString & aQuotedText,
|
|||
nsCOMPtr<nsIDOMElement> newElement (do_QueryInterface(newNode));
|
||||
if (newElement)
|
||||
{
|
||||
nsAutoString type; type.AssignWithConversion("type");
|
||||
nsAutoString cite; cite.AssignWithConversion("cite");
|
||||
nsAutoString type(NS_LITERAL_STRING("type"));
|
||||
nsAutoString cite(NS_LITERAL_STRING("cite"));
|
||||
newElement->SetAttribute(type, cite);
|
||||
|
||||
if (aCitation.Length() > 0)
|
||||
|
|
|
@ -734,7 +734,7 @@ nsHTMLEditRules::GetAlignment(PRBool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
|
|||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(nodeToExamine);
|
||||
if (elem)
|
||||
{
|
||||
nsAutoString typeAttrName; typeAttrName.Assign(NS_LITERAL_STRING("align"));
|
||||
nsAutoString typeAttrName(NS_LITERAL_STRING("align"));
|
||||
nsAutoString typeAttrVal;
|
||||
res = elem->GetAttribute(typeAttrName, typeAttrVal);
|
||||
typeAttrVal.ToLowerCase();
|
||||
|
@ -868,9 +868,8 @@ nsHTMLEditRules::GetParagraphState(PRBool *aMixed, nsAWritableString &outFormat)
|
|||
outFormat.Truncate(0);
|
||||
|
||||
PRBool bMixed = PR_FALSE;
|
||||
nsAutoString formatStr;
|
||||
// using "x" as an uninitialized value, since "" is meaningful
|
||||
formatStr.Assign(NS_LITERAL_STRING("x"));
|
||||
nsAutoString formatStr(NS_LITERAL_STRING("x"));
|
||||
|
||||
nsCOMPtr<nsISupportsArray> arrayOfNodes;
|
||||
nsresult res = GetParagraphFormatNodes(address_of(arrayOfNodes), PR_TRUE);
|
||||
|
@ -1086,7 +1085,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// dont put text in places that cant have it
|
||||
nsAutoString textTag; textTag.Assign(NS_LITERAL_STRING("__moz_text"));
|
||||
nsAutoString textTag(NS_LITERAL_STRING("__moz_text"));
|
||||
if (!mHTMLEditor->IsTextNode(selNode) && !mHTMLEditor->CanContainTag(selNode, textTag))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -1182,7 +1181,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
|||
NS_NAMED_LITERAL_STRING(tabStr, "\t");
|
||||
NS_NAMED_LITERAL_STRING(newlineStr, "\n");
|
||||
char specialChars[] = {'\t','\n',0};
|
||||
nsAutoString tabString; tabString.Assign(NS_LITERAL_STRING(" "));
|
||||
nsAutoString tabString(NS_LITERAL_STRING(" "));
|
||||
while (unicodeBuf && (pos != -1) && (pos < (PRInt32)inString->Length()))
|
||||
{
|
||||
PRInt32 oldPos = pos;
|
||||
|
@ -2527,8 +2526,7 @@ nsHTMLEditRules::WillMakeDefListItem(nsISelection *aSelection,
|
|||
PRBool *aHandled)
|
||||
{
|
||||
// for now we let WillMakeList handle this
|
||||
nsAutoString listType;
|
||||
listType.Assign(NS_LITERAL_STRING("dl"));
|
||||
nsAutoString listType(NS_LITERAL_STRING("dl"));
|
||||
return WillMakeList(aSelection, &listType, aEntireList, aCancel, aHandled, aItemType);
|
||||
}
|
||||
|
||||
|
@ -2746,7 +2744,7 @@ nsHTMLEditRules::WillIndent(nsISelection *aSelection, PRBool *aCancel, PRBool *
|
|||
{
|
||||
nsCOMPtr<nsIDOMNode> parent, theBlock;
|
||||
PRInt32 offset;
|
||||
nsAutoString quoteType; quoteType.Assign(NS_LITERAL_STRING("blockquote"));
|
||||
nsAutoString quoteType(NS_LITERAL_STRING("blockquote"));
|
||||
|
||||
// get selection location
|
||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
||||
|
@ -2867,7 +2865,7 @@ nsHTMLEditRules::WillIndent(nsISelection *aSelection, PRBool *aCancel, PRBool *
|
|||
// or if this node doesn't go in blockquote we used earlier.
|
||||
if (!curQuote)
|
||||
{
|
||||
nsAutoString quoteType; quoteType.Assign(NS_LITERAL_STRING("blockquote"));
|
||||
nsAutoString quoteType(NS_LITERAL_STRING("blockquote"));
|
||||
res = SplitAsNeeded("eType, address_of(curParent), &offset);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = mHTMLEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curQuote));
|
||||
|
@ -3388,7 +3386,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection,
|
|||
{
|
||||
PRInt32 offset;
|
||||
nsCOMPtr<nsIDOMNode> brNode, parent, theDiv, sib;
|
||||
nsAutoString divType; divType.Assign(NS_LITERAL_STRING("div"));
|
||||
nsAutoString divType(NS_LITERAL_STRING("div"));
|
||||
res = mHTMLEditor->GetStartNodeAndOffset(aSelection, address_of(parent), &offset);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = SplitAsNeeded(&divType, address_of(parent), &offset);
|
||||
|
@ -3455,7 +3453,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection,
|
|||
if (nsHTMLEditUtils::SupportsAlignAttr(curNode))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(curNode);
|
||||
nsAutoString attr; attr.Assign(NS_LITERAL_STRING("align"));
|
||||
nsAutoString attr(NS_LITERAL_STRING("align"));
|
||||
res = mHTMLEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// clear out curDiv so that we don't put nodes after this one into it
|
||||
|
@ -3488,7 +3486,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection,
|
|||
// or if this node doesn't go in div we used earlier.
|
||||
if (!curDiv || transitionList[i])
|
||||
{
|
||||
nsAutoString divType; divType.Assign(NS_LITERAL_STRING("div"));
|
||||
nsAutoString divType(NS_LITERAL_STRING("div"));
|
||||
res = SplitAsNeeded(&divType, address_of(curParent), &offset);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = mHTMLEditor->CreateNode(divType, curParent, offset, getter_AddRefs(curDiv));
|
||||
|
@ -3497,7 +3495,7 @@ nsHTMLEditRules::WillAlign(nsISelection *aSelection,
|
|||
mNewBlock = curDiv;
|
||||
// set up the alignment on the div
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(curDiv);
|
||||
nsAutoString attr; attr.Assign(NS_LITERAL_STRING("align"));
|
||||
nsAutoString attr(NS_LITERAL_STRING("align"));
|
||||
res = mHTMLEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curDiv is now the correct thing to put curNode in
|
||||
|
@ -3573,19 +3571,19 @@ nsHTMLEditRules::AlignBlockContents(nsIDOMNode *aNode, const nsAReadableString *
|
|||
// the cell already has a div containing all of it's content: just
|
||||
// act on this div.
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(firstChild);
|
||||
nsAutoString attr; attr.Assign(NS_LITERAL_STRING("align"));
|
||||
nsAutoString attr(NS_LITERAL_STRING("align"));
|
||||
res = mHTMLEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
// else we need to put in a div, set the alignment, and toss in all the children
|
||||
nsAutoString divType; divType.Assign(NS_LITERAL_STRING("div"));
|
||||
nsAutoString divType(NS_LITERAL_STRING("div"));
|
||||
res = mHTMLEditor->CreateNode(divType, aNode, 0, getter_AddRefs(divNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// set up the alignment on the div
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(divNode);
|
||||
nsAutoString attr; attr.Assign(NS_LITERAL_STRING("align"));
|
||||
nsAutoString attr(NS_LITERAL_STRING("align"));
|
||||
res = mHTMLEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// tuck the children into the end of the active div
|
||||
|
@ -5293,7 +5291,7 @@ nsHTMLEditRules::MakeBlockquote(nsISupportsArray *arrayOfNodes)
|
|||
// if no curBlock, make one
|
||||
if (!curBlock)
|
||||
{
|
||||
nsAutoString quoteType; quoteType.Assign(NS_LITERAL_STRING("blockquote"));
|
||||
nsAutoString quoteType(NS_LITERAL_STRING("blockquote"));
|
||||
res = SplitAsNeeded("eType, address_of(curParent), &offset);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = mHTMLEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curBlock));
|
||||
|
|
|
@ -77,12 +77,12 @@ nsHTMLEditUtils::IsHeader(nsIDOMNode *node)
|
|||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if ( (tag.EqualsWithConversion("h1")) ||
|
||||
(tag.EqualsWithConversion("h2")) ||
|
||||
(tag.EqualsWithConversion("h3")) ||
|
||||
(tag.EqualsWithConversion("h4")) ||
|
||||
(tag.EqualsWithConversion("h5")) ||
|
||||
(tag.EqualsWithConversion("h6")) )
|
||||
if ( (tag.Equals(NS_LITERAL_STRING("h1"))) ||
|
||||
(tag.Equals(NS_LITERAL_STRING("h2"))) ||
|
||||
(tag.Equals(NS_LITERAL_STRING("h3"))) ||
|
||||
(tag.Equals(NS_LITERAL_STRING("h4"))) ||
|
||||
(tag.Equals(NS_LITERAL_STRING("h5"))) ||
|
||||
(tag.Equals(NS_LITERAL_STRING("h6"))) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -110,9 +110,9 @@ nsHTMLEditUtils::IsListItem(nsIDOMNode *node)
|
|||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.EqualsWithConversion("li") ||
|
||||
tag.EqualsWithConversion("dd") ||
|
||||
tag.EqualsWithConversion("dt"))
|
||||
if (tag.Equals(NS_LITERAL_STRING("li")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("dd")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("dt")))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -129,10 +129,10 @@ nsHTMLEditUtils::IsTableElement(nsIDOMNode *node)
|
|||
NS_PRECONDITION(node, "null node passed to nsHTMLEditor::IsTableElement");
|
||||
nsAutoString tagName;
|
||||
nsEditor::GetTagString(node,tagName);
|
||||
if (tagName.EqualsWithConversion("table") || tagName.EqualsWithConversion("tr") ||
|
||||
tagName.EqualsWithConversion("td") || tagName.EqualsWithConversion("th") ||
|
||||
tagName.EqualsWithConversion("thead") || tagName.EqualsWithConversion("tfoot") ||
|
||||
tagName.EqualsWithConversion("tbody") || tagName.EqualsWithConversion("caption"))
|
||||
if (tagName.Equals(NS_LITERAL_STRING("table")) || tagName.Equals(NS_LITERAL_STRING("tr")) ||
|
||||
tagName.Equals(NS_LITERAL_STRING("td")) || tagName.Equals(NS_LITERAL_STRING("th")) ||
|
||||
tagName.Equals(NS_LITERAL_STRING("thead")) || tagName.Equals(NS_LITERAL_STRING("tfoot")) ||
|
||||
tagName.Equals(NS_LITERAL_STRING("tbody")) || tagName.Equals(NS_LITERAL_STRING("caption")))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ nsHTMLEditUtils::IsTableCell(nsIDOMNode *node)
|
|||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.EqualsWithConversion("td") || tag.EqualsWithConversion("th"))
|
||||
if (tag.Equals(NS_LITERAL_STRING("td")) || tag.Equals(NS_LITERAL_STRING("th")))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -187,9 +187,9 @@ nsHTMLEditUtils::IsTableCellOrCaption(nsIDOMNode *node)
|
|||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.EqualsWithConversion("td") ||
|
||||
tag.EqualsWithConversion("th") ||
|
||||
tag.EqualsWithConversion("caption") )
|
||||
if (tag.Equals(NS_LITERAL_STRING("td")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("th")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("caption")) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -207,9 +207,9 @@ nsHTMLEditUtils::IsList(nsIDOMNode *node)
|
|||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if ( (tag.EqualsWithConversion("dl")) ||
|
||||
(tag.EqualsWithConversion("ol")) ||
|
||||
(tag.EqualsWithConversion("ul")) )
|
||||
if ( (tag.Equals(NS_LITERAL_STRING("dl"))) ||
|
||||
(tag.Equals(NS_LITERAL_STRING("ol"))) ||
|
||||
(tag.Equals(NS_LITERAL_STRING("ul"))) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ nsHTMLEditUtils::IsMailCite(nsIDOMNode *node)
|
|||
if (IsBlockquote(node))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> bqElem = do_QueryInterface(node);
|
||||
nsAutoString typeAttrName; typeAttrName.AssignWithConversion("type");
|
||||
nsAutoString typeAttrName(NS_LITERAL_STRING("type"));
|
||||
nsAutoString typeAttrVal;
|
||||
nsresult res = bqElem->GetAttribute(typeAttrName, typeAttrVal);
|
||||
typeAttrVal.ToLowerCase();
|
||||
|
@ -439,22 +439,22 @@ nsHTMLEditUtils::SupportsAlignAttr(nsIDOMNode * aNode)
|
|||
nsAutoString tag;
|
||||
nsEditor::GetTagString(aNode, tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.EqualsWithConversion("hr") ||
|
||||
tag.EqualsWithConversion("table") ||
|
||||
tag.EqualsWithConversion("tbody") ||
|
||||
tag.EqualsWithConversion("tfoot") ||
|
||||
tag.EqualsWithConversion("thead") ||
|
||||
tag.EqualsWithConversion("tr") ||
|
||||
tag.EqualsWithConversion("td") ||
|
||||
tag.EqualsWithConversion("th") ||
|
||||
tag.EqualsWithConversion("div") ||
|
||||
tag.EqualsWithConversion("p") ||
|
||||
tag.EqualsWithConversion("h1") ||
|
||||
tag.EqualsWithConversion("h2") ||
|
||||
tag.EqualsWithConversion("h3") ||
|
||||
tag.EqualsWithConversion("h4") ||
|
||||
tag.EqualsWithConversion("h5") ||
|
||||
tag.EqualsWithConversion("h6")) {
|
||||
if (tag.Equals(NS_LITERAL_STRING("hr")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("table")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("tbody")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("tfoot")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("thead")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("tr")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("td")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("th")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("div")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("p")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("h1")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("h2")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("h3")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("h4")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("h5")) ||
|
||||
tag.Equals(NS_LITERAL_STRING("h6"))) {
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -1306,7 +1306,7 @@ NS_IMETHODIMP nsHTMLEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent,
|
|||
nsCOMPtr<nsIDOMNode> node = *aInOutParent;
|
||||
PRInt32 theOffset = *aInOutOffset;
|
||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(node);
|
||||
nsAutoString brType; brType.Assign(NS_LITERAL_STRING("br"));
|
||||
nsAutoString brType(NS_LITERAL_STRING("br"));
|
||||
nsCOMPtr<nsIDOMNode> brNode;
|
||||
if (nodeAsText)
|
||||
{
|
||||
|
@ -1542,7 +1542,7 @@ nsHTMLEditor::ReplaceHeadContentsWithHTML(const nsAReadableString& aSourceToInse
|
|||
// Do not use nsAutoRules -- rules code won't let us insert in <head>
|
||||
// Use the head node as a parent and delete/insert directly
|
||||
nsCOMPtr<nsIDOMNodeList>nodeList;
|
||||
nsAutoString headTag; headTag.Assign(NS_LITERAL_STRING("head"));
|
||||
nsAutoString headTag(NS_LITERAL_STRING("head"));
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(mDocWeak);
|
||||
if (!doc) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
@ -2116,7 +2116,7 @@ nsHTMLEditor::GetBackgroundColorState(PRBool *aMixed, nsAWritableString &aOutCol
|
|||
nsresult res = GetSelectedOrParentTableElement(*getter_AddRefs(element), tagName, selectedCount);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsAutoString styleName; styleName.Assign(NS_LITERAL_STRING("bgcolor"));
|
||||
nsAutoString styleName(NS_LITERAL_STRING("bgcolor"));
|
||||
|
||||
while (element)
|
||||
{
|
||||
|
@ -2258,7 +2258,7 @@ nsHTMLEditor::MakeOrChangeList(const nsAReadableString& aListType, PRBool entire
|
|||
res = CreateNode(aListType, parent, offset, getter_AddRefs(newList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// make a list item
|
||||
nsAutoString tag; tag.Assign(NS_LITERAL_STRING("li"));
|
||||
nsAutoString tag(NS_LITERAL_STRING("li"));
|
||||
nsCOMPtr<nsIDOMNode> newItem;
|
||||
res = CreateNode(tag, newList, 0, getter_AddRefs(newItem));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -2444,7 +2444,7 @@ nsHTMLEditor::Indent(const nsAReadableString& aIndent)
|
|||
if (!node) res = NS_ERROR_FAILURE;
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsAutoString inward; inward.Assign(NS_LITERAL_STRING("indent"));
|
||||
nsAutoString inward(NS_LITERAL_STRING("indent"));
|
||||
if (aIndent == inward)
|
||||
{
|
||||
if (isCollapsed)
|
||||
|
@ -3426,7 +3426,7 @@ static nsresult SetSelectionAroundHeadChildren(nsCOMPtr<nsISelection> aSelection
|
|||
nsresult res = NS_OK;
|
||||
// Set selection around <head> node
|
||||
nsCOMPtr<nsIDOMNodeList>nodeList;
|
||||
nsAutoString headTag; headTag.Assign(NS_LITERAL_STRING("head"));
|
||||
nsAutoString headTag(NS_LITERAL_STRING("head"));
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> doc = do_QueryReferent(aDocWeak);
|
||||
if (!doc) return NS_ERROR_NOT_INITIALIZED;
|
||||
|
|
|
@ -1411,10 +1411,11 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
|
|||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
|
||||
nsAutoString nodeType(aSizeChange==1 ? NS_LITERAL_STRING("big") : NS_LITERAL_STRING("small"));
|
||||
// look for siblings that are correct type of node
|
||||
nsCOMPtr<nsIDOMNode> sibling;
|
||||
GetPriorHTMLSibling(node, address_of(sibling));
|
||||
if (sibling && NodeIsType(sibling, NS_ConvertASCIItoUCS2(aSizeChange==1 ? "big" : "small")))
|
||||
if (sibling && NodeIsType(sibling, nodeType))
|
||||
{
|
||||
// previous sib is already right kind of inline node; slide this over into it
|
||||
res = MoveNode(node, sibling, -1);
|
||||
|
@ -1422,7 +1423,7 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
|
|||
}
|
||||
sibling = nsnull;
|
||||
GetNextHTMLSibling(node, address_of(sibling));
|
||||
if (sibling && NodeIsType(sibling, NS_ConvertASCIItoUCS2(aSizeChange==1 ? "big" : "small")))
|
||||
if (sibling && NodeIsType(sibling, nodeType))
|
||||
{
|
||||
// following sib is already right kind of inline node; slide this over into it
|
||||
res = MoveNode(node, sibling, 0);
|
||||
|
@ -1430,7 +1431,7 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
|
|||
}
|
||||
|
||||
// else reparent the node inside font node with appropriate relative size
|
||||
res = InsertContainerAbove(node, address_of(tmp), NS_ConvertASCIItoUCS2(aSizeChange==1 ? "big" : "small"));
|
||||
res = InsertContainerAbove(node, address_of(tmp), nodeType);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -1452,14 +1453,13 @@ nsHTMLEditor::RelativeFontChangeHelper( PRInt32 aSizeChange,
|
|||
|
||||
nsresult res = NS_OK;
|
||||
nsAutoString tag;
|
||||
if (aSizeChange == 1) tag.AssignWithConversion("big");
|
||||
else tag.AssignWithConversion("small");
|
||||
if (aSizeChange == 1) tag.Assign(NS_LITERAL_STRING("big"));
|
||||
else tag.Assign(NS_LITERAL_STRING("small"));
|
||||
nsCOMPtr<nsIDOMNodeList> childNodes;
|
||||
PRInt32 j;
|
||||
PRUint32 childCount;
|
||||
nsCOMPtr<nsIDOMNode> childNode;
|
||||
nsAutoString attr;
|
||||
attr.AssignWithConversion("size");
|
||||
nsAutoString attr(NS_LITERAL_STRING("size"));
|
||||
|
||||
// if this is a font node with size, put big/small inside it
|
||||
if (NodeIsType(aNode, nsIEditProperty::font) && HasAttr(aNode, &attr))
|
||||
|
@ -1590,12 +1590,10 @@ nsHTMLEditor::GetFontFaceState(PRBool *aMixed, nsAWritableString &outFace)
|
|||
if (!aMixed)
|
||||
return NS_ERROR_FAILURE;
|
||||
*aMixed = PR_TRUE;
|
||||
//outFace.Assign(NS_LITERAL_STRING(""));
|
||||
outFace.SetLength(0);
|
||||
|
||||
nsresult res;
|
||||
nsAutoString faceStr;
|
||||
faceStr.Assign(NS_LITERAL_STRING("face"));
|
||||
nsAutoString faceStr(NS_LITERAL_STRING("face"));
|
||||
PRBool first, any, all;
|
||||
|
||||
|
||||
|
@ -1635,7 +1633,7 @@ nsHTMLEditor::GetFontColorState(PRBool *aMixed, nsAWritableString &aOutColor)
|
|||
aOutColor.SetLength(0);
|
||||
|
||||
nsresult res;
|
||||
nsAutoString colorStr; colorStr.Assign(NS_LITERAL_STRING("color"));
|
||||
nsAutoString colorStr(NS_LITERAL_STRING("color"));
|
||||
PRBool first, any, all;
|
||||
|
||||
res = GetInlinePropertyBase(nsIEditProperty::font, &colorStr, nsnull, &first, &any, &all, &aOutColor);
|
||||
|
|
|
@ -193,7 +193,7 @@ NS_IMETHODIMP nsHTMLEditor::SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan)
|
|||
if (!aCell) return NS_ERROR_NULL_POINTER;
|
||||
nsAutoString newSpan;
|
||||
newSpan.AppendInt(aColSpan, 10);
|
||||
nsAutoString colSpan; colSpan.AssignWithConversion("colspan");
|
||||
nsAutoString colSpan(NS_LITERAL_STRING("colspan"));
|
||||
return SetAttribute(aCell, colSpan, newSpan);
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ NS_IMETHODIMP nsHTMLEditor::SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan)
|
|||
if (!aCell) return NS_ERROR_NULL_POINTER;
|
||||
nsAutoString newSpan;
|
||||
newSpan.AppendInt(aRowSpan, 10);
|
||||
nsAutoString rowSpan; rowSpan.AssignWithConversion("rowspan");
|
||||
nsAutoString rowSpan(NS_LITERAL_STRING("rowspan"));
|
||||
return SetAttribute(aCell, rowSpan, newSpan);
|
||||
}
|
||||
|
||||
|
@ -1893,7 +1893,7 @@ nsHTMLEditor::CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *so
|
|||
if (!destCell || !sourceCell) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Copy backgournd color to new cell
|
||||
nsAutoString bgcolor; bgcolor.AssignWithConversion("bgcolor");
|
||||
nsAutoString bgcolor(NS_LITERAL_STRING("bgcolor"));
|
||||
nsAutoString color;
|
||||
PRBool isSet;
|
||||
nsresult res = GetAttributeValue(sourceCell, bgcolor, color, &isSet);
|
||||
|
@ -3297,7 +3297,7 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsS
|
|||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tdName; tdName.AssignWithConversion("td");
|
||||
nsAutoString tdName(NS_LITERAL_STRING("td"));
|
||||
|
||||
// Try to get the first selected cell
|
||||
nsCOMPtr<nsIDOMElement> tableOrCellElement;
|
||||
|
@ -3314,8 +3314,8 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsS
|
|||
}
|
||||
else
|
||||
{
|
||||
nsAutoString tableName; tableName.AssignWithConversion("table");
|
||||
nsAutoString trName; trName.AssignWithConversion("tr");
|
||||
nsAutoString tableName(NS_LITERAL_STRING("table"));
|
||||
nsAutoString trName(NS_LITERAL_STRING("tr"));
|
||||
|
||||
nsCOMPtr<nsIDOMNode> anchorNode;
|
||||
res = selection->GetAnchorNode(getter_AddRefs(anchorNode));
|
||||
|
|
|
@ -168,7 +168,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertTextFromTransferable(nsITransferable *tra
|
|||
nsAutoTxnsConserveSelection dontSpazMySelection(this);
|
||||
nsAutoString flavor, stuffToPaste;
|
||||
flavor.AssignWithConversion( bestFlavor ); // just so we can use flavor.Equals()
|
||||
if (flavor.EqualsWithConversion(kUnicodeMime))
|
||||
if (flavor.Equals(NS_LITERAL_STRING(kUnicodeMime)))
|
||||
{
|
||||
nsCOMPtr<nsISupportsWString> textDataObj ( do_QueryInterface(genericDataObj) );
|
||||
if (textDataObj && len > 0)
|
||||
|
|
|
@ -336,7 +336,7 @@ nsPlaintextEditor::SetDocumentCharacterSet(const nsAReadableString & characterSe
|
|||
// not undoable, undo should undo CreateNode
|
||||
result = metaElement->SetAttribute(NS_LITERAL_STRING("http-equiv"), NS_LITERAL_STRING("Content-Type"));
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
newMetaString.AssignWithConversion("text/html;charset=");
|
||||
newMetaString.Assign(NS_LITERAL_STRING("text/html;charset="));
|
||||
newMetaString.Append(characterSet);
|
||||
// not undoable, undo should undo CreateNode
|
||||
result = metaElement->SetAttribute(NS_LITERAL_STRING("content"), newMetaString);
|
||||
|
@ -576,7 +576,7 @@ NS_IMETHODIMP nsPlaintextEditor::CreateBRImpl(nsCOMPtr<nsIDOMNode> *aInOutParent
|
|||
nsCOMPtr<nsIDOMNode> node = *aInOutParent;
|
||||
PRInt32 theOffset = *aInOutOffset;
|
||||
nsCOMPtr<nsIDOMCharacterData> nodeAsText = do_QueryInterface(node);
|
||||
nsAutoString brType; brType.AssignWithConversion("br");
|
||||
nsAutoString brType(NS_LITERAL_STRING("br"));
|
||||
nsCOMPtr<nsIDOMNode> brNode;
|
||||
if (nodeAsText)
|
||||
{
|
||||
|
@ -1024,7 +1024,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertLineBreak()
|
|||
{
|
||||
// create the new BR node
|
||||
nsCOMPtr<nsIDOMNode> newNode;
|
||||
nsAutoString tag; tag.AssignWithConversion("BR");
|
||||
nsAutoString tag(NS_LITERAL_STRING("BR"));
|
||||
res = DeleteSelectionAndCreateNode(tag, getter_AddRefs(newNode));
|
||||
if (!newNode) res = NS_ERROR_NULL_POINTER; // don't return here, so DidDoAction is called
|
||||
if (NS_SUCCEEDED(res))
|
||||
|
@ -1274,7 +1274,7 @@ nsPlaintextEditor::SetWrapWidth(PRInt32 aWrapColumn)
|
|||
if (!bodyElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// Get the current style for this body element:
|
||||
nsAutoString styleName; styleName.AssignWithConversion("style");
|
||||
nsAutoString styleName(NS_LITERAL_STRING("style"));
|
||||
nsAutoString styleValue;
|
||||
res = bodyElement->GetAttribute(styleName, styleValue);
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -1289,7 +1289,7 @@ nsPlaintextEditor::SetWrapWidth(PRInt32 aWrapColumn)
|
|||
if (styleValue.Length() > 0)
|
||||
{
|
||||
styleValue.Trim("; \t", PR_FALSE, PR_TRUE);
|
||||
styleValue.AppendWithConversion("; ");
|
||||
styleValue.Append(NS_LITERAL_STRING("; "));
|
||||
}
|
||||
|
||||
// Make sure we have fixed-width font. This should be done for us,
|
||||
|
@ -1298,19 +1298,19 @@ nsPlaintextEditor::SetWrapWidth(PRInt32 aWrapColumn)
|
|||
PRUint32 flags = 0;
|
||||
GetFlags(&flags);
|
||||
if ((flags & eEditorEnableWrapHackMask) && aWrapColumn >= 0)
|
||||
styleValue.AppendWithConversion("font-family: -moz-fixed; ");
|
||||
styleValue.Append(NS_LITERAL_STRING("font-family: -moz-fixed; "));
|
||||
|
||||
// and now we're ready to set the new whitespace/wrapping style.
|
||||
if (aWrapColumn > 0) // Wrap to a fixed column
|
||||
{
|
||||
styleValue.AppendWithConversion("white-space: -moz-pre-wrap; width: ");
|
||||
styleValue.Append(NS_LITERAL_STRING("white-space: -moz-pre-wrap; width: "));
|
||||
styleValue.AppendInt(aWrapColumn);
|
||||
styleValue.AppendWithConversion("ch;");
|
||||
styleValue.Append(NS_LITERAL_STRING("ch;"));
|
||||
}
|
||||
else if (aWrapColumn == 0)
|
||||
styleValue.AppendWithConversion("white-space: -moz-pre-wrap;");
|
||||
styleValue.Append(NS_LITERAL_STRING("white-space: -moz-pre-wrap;"));
|
||||
else
|
||||
styleValue.AppendWithConversion("white-space: pre;");
|
||||
styleValue.Append(NS_LITERAL_STRING("white-space: pre;"));
|
||||
|
||||
res = bodyElement->SetAttribute(styleName, styleValue);
|
||||
return res;
|
||||
|
@ -1637,7 +1637,7 @@ nsPlaintextEditor::PasteAsQuotation(PRInt32 aSelectionType)
|
|||
#endif
|
||||
nsAutoString flavor; flavor.AssignWithConversion(flav);
|
||||
nsAutoString stuffToPaste;
|
||||
if (flavor.EqualsWithConversion(kUnicodeMime))
|
||||
if (flavor.Equals(NS_LITERAL_STRING(kUnicodeMime)))
|
||||
{
|
||||
nsCOMPtr<nsISupportsWString> textDataObj ( do_QueryInterface(genericDataObj) );
|
||||
if (textDataObj && len > 0)
|
||||
|
@ -1776,7 +1776,7 @@ nsPlaintextEditor::Rewrap(PRBool aRespectNewlines)
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Variables we'll need either way
|
||||
nsAutoString format; format.AssignWithConversion("text/plain");
|
||||
nsAutoString format(NS_LITERAL_STRING("text/plain"));
|
||||
nsAutoString current;
|
||||
nsString wrapped;
|
||||
|
||||
|
@ -1839,7 +1839,7 @@ nsPlaintextEditor::StripCites()
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Variables we'll need either way
|
||||
nsAutoString format; format.AssignWithConversion("text/plain");
|
||||
nsAutoString format(NS_LITERAL_STRING("text/plain"));
|
||||
nsAutoString current;
|
||||
nsString stripped;
|
||||
|
||||
|
|
|
@ -596,7 +596,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
|||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// dont put text in places that cant have it
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
nsAutoString textTag(NS_LITERAL_STRING("__moz_text"));
|
||||
if (!mEditor->IsTextNode(selNode) && !mEditor->CanContainTag(selNode, textTag))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -707,7 +707,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
|||
NS_NAMED_LITERAL_STRING(tabStr, "\t");
|
||||
NS_NAMED_LITERAL_STRING(newlineStr, "\n");
|
||||
char specialChars[] = {'\t','\n',0};
|
||||
nsAutoString tabString; tabString.AssignWithConversion(" ");
|
||||
nsAutoString tabString(NS_LITERAL_STRING(" "));
|
||||
while (unicodeBuf && (pos != -1) && ((PRUint32)pos < tString.Length()))
|
||||
{
|
||||
PRInt32 oldPos = pos;
|
||||
|
@ -1038,7 +1038,7 @@ nsTextEditRules::DidRedo(nsISelection *aSelection, nsresult aResult)
|
|||
if (NS_FAILED(res)) return res;
|
||||
if (!theBody) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tagName; tagName.AssignWithConversion("div");
|
||||
nsAutoString tagName(NS_LITERAL_STRING("div"));
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
res = theBody->GetElementsByTagName(tagName, getter_AddRefs(nodeList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
@ -1231,8 +1231,7 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsISelection *aSelection)
|
|||
nsCOMPtr<nsIDOMElement>brElement;
|
||||
nsCOMPtr<nsIContent> newContent;
|
||||
|
||||
nsString qualifiedTag;
|
||||
qualifiedTag.AssignWithConversion("br");
|
||||
nsString qualifiedTag(NS_LITERAL_STRING("br"));
|
||||
|
||||
res = mEditor->CreateHTMLContent(qualifiedTag, getter_AddRefs(newContent));
|
||||
brElement = do_QueryInterface(newContent);
|
||||
|
|
|
@ -110,11 +110,11 @@ nsTextEditUtils::HasMozAttr(nsIDOMNode *node)
|
|||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(node);
|
||||
if (elem)
|
||||
{
|
||||
nsAutoString typeAttrName; typeAttrName.AssignWithConversion("type");
|
||||
nsAutoString typeAttrName(NS_LITERAL_STRING("type"));
|
||||
nsAutoString typeAttrVal;
|
||||
nsresult res = elem->GetAttribute(typeAttrName, typeAttrVal);
|
||||
typeAttrVal.ToLowerCase();
|
||||
if (NS_SUCCEEDED(res) && (typeAttrVal.EqualsWithConversion("_moz")))
|
||||
if (NS_SUCCEEDED(res) && (typeAttrVal.Equals(NS_LITERAL_STRING("_moz"))))
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче