mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
making string conversions explicit
This commit is contained in:
parent
9ac6c4fb06
commit
04b44006ee
@ -198,7 +198,7 @@ NS_IMETHODIMP SplitElementTxn::GetUndoString(nsString *aString)
|
||||
{
|
||||
if (nsnull!=aString)
|
||||
{
|
||||
*aString="Join Element";
|
||||
aString->AssignWithConversion("Join Element");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -207,7 +207,7 @@ NS_IMETHODIMP SplitElementTxn::GetRedoString(nsString *aString)
|
||||
{
|
||||
if (nsnull!=aString)
|
||||
{
|
||||
*aString="Split Element";
|
||||
aString->AssignWithConversion("Split Element");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ nsresult TextEditorTest::RunUnitTest(PRInt32 *outNumTests, PRInt32 *outNumTestsF
|
||||
// shouldn't we just bail on error here?
|
||||
|
||||
// insert some simple text
|
||||
nsString docContent("1234567890abcdefghij1234567890");
|
||||
nsString docContent; docContent.AssignWithConversion("1234567890abcdefghij1234567890");
|
||||
result = mTextEditor->InsertText(docContent);
|
||||
TEST_RESULT(result);
|
||||
(*outNumTests)++;
|
||||
(*outNumTestsFailed) += (NS_FAILED(result) != NS_OK);
|
||||
|
||||
// insert some more text
|
||||
nsString docContent2("Moreover, I am cognizant of the interrelatedness of all communities and states. I cannot sit idly by in Atlanta and not be concerned about what happens in Birmingham. Injustice anywhere is a threat to justice everywhere");
|
||||
nsString docContent2; docContent2.AssignWithConversion("Moreover, I am cognizant of the interrelatedness of all communities and states. I cannot sit idly by in Atlanta and not be concerned about what happens in Birmingham. Injustice anywhere is a threat to justice everywhere");
|
||||
result = mTextEditor->InsertText(docContent2);
|
||||
TEST_RESULT(result);
|
||||
(*outNumTests)++;
|
||||
@ -142,7 +142,7 @@ nsresult TextEditorTest::TestTextProperties()
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(doc.get());
|
||||
nsCOMPtr<nsIDOMNodeList>nodeList;
|
||||
nsAutoString textTag = "__moz_text";
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
result = doc->GetElementsByTagName(textTag, getter_AddRefs(nodeList));
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(nodeList.get());
|
||||
|
@ -389,7 +389,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// dont put text in places that cant have it
|
||||
nsAutoString textTag = "__moz_text";
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
if (!mEditor->IsTextNode(selNode) && !mEditor->CanContainTag(selNode, textTag))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -464,7 +464,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a return?
|
||||
if (subStr.Equals("\n"))
|
||||
if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -479,7 +479,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
else
|
||||
{
|
||||
char specialChars[] = {'\t','\n',0};
|
||||
nsAutoString tabString = " ";
|
||||
nsAutoString tabString; tabString.AssignWithConversion(" ");
|
||||
while (unicodeBuf && (pos != -1) && (pos < inString->Length()))
|
||||
{
|
||||
PRInt32 oldPos = pos;
|
||||
@ -502,13 +502,13 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a tab?
|
||||
if (subStr.Equals("\t"))
|
||||
if (subStr.EqualsWithConversion("\t"))
|
||||
{
|
||||
res = mEditor->InsertTextImpl(tabString, &curNode, &curOffset, doc);
|
||||
pos++;
|
||||
}
|
||||
// is it a return?
|
||||
else if (subStr.Equals("\n"))
|
||||
else if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -1077,8 +1077,8 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
*aCancel = PR_FALSE;
|
||||
*aHandled = PR_FALSE;
|
||||
|
||||
nsAutoString blockType("ul");
|
||||
if (aOrdered) blockType = "ol";
|
||||
nsAutoString blockType;
|
||||
blockType.AssignWithConversion( aOrdered ? "ol" : "ul");
|
||||
|
||||
PRBool outMakeEmpty;
|
||||
res = ShouldMakeEmptyBlock(aSelection, &blockType, &outMakeEmpty);
|
||||
@ -1094,13 +1094,12 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
|
||||
// make sure we can put a list here
|
||||
nsAutoString listType;
|
||||
if (aOrdered) listType = "ol";
|
||||
else listType = "ul";
|
||||
listType.AssignWithConversion( aOrdered ? "ol" : "ul" );
|
||||
if (mEditor->CanContainTag(parent,listType))
|
||||
{
|
||||
res = mEditor->CreateNode(listType, parent, offset, getter_AddRefs(theList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = mEditor->CreateNode("li", theList, 0, getter_AddRefs(theListItem));
|
||||
res = mEditor->CreateNode(NS_ConvertASCIItoUCS2("li"), theList, 0, getter_AddRefs(theListItem));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// put selection in new list item
|
||||
res = aSelection->Collapse(theListItem,0);
|
||||
@ -1283,10 +1282,7 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
// or if this node doesn't go in list we used earlier.
|
||||
if (!curList || transitionList[i])
|
||||
{
|
||||
nsAutoString listType;
|
||||
if (aOrdered) listType = "ol";
|
||||
else listType = "ul";
|
||||
res = mEditor->CreateNode(listType, curParent, offset, getter_AddRefs(curList));
|
||||
res = mEditor->CreateNode(NS_ConvertASCIItoUCS2( aOrdered ? "ol" : "ul" ), curParent, offset, getter_AddRefs(curList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curList is now the correct thing to put curNode in
|
||||
prevListItem = 0;
|
||||
@ -1320,11 +1316,11 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
// don't wrap li around a paragraph. instead replace paragraph with li
|
||||
if (nsHTMLEditUtils::IsParagraph(curNode))
|
||||
{
|
||||
res = mEditor->ReplaceContainer(curNode, &listItem, "li");
|
||||
res = mEditor->ReplaceContainer(curNode, &listItem, NS_ConvertASCIItoUCS2("li"));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = mEditor->InsertContainerAbove(curNode, &listItem, "li");
|
||||
res = mEditor->InsertContainerAbove(curNode, &listItem, NS_ConvertASCIItoUCS2("li"));
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (nsEditor::IsInlineNode(curNode))
|
||||
@ -1361,9 +1357,6 @@ nsHTMLEditRules::WillRemoveList(nsIDOMSelection *aSelection,
|
||||
// initialize out param
|
||||
*aCancel = PR_FALSE;
|
||||
*aHandled = PR_TRUE;
|
||||
|
||||
nsAutoString blockType("ul");
|
||||
if (aOrdered) blockType = "ol";
|
||||
|
||||
nsAutoSelectionReset selectionResetter(aSelection, mEditor);
|
||||
|
||||
@ -1585,15 +1578,14 @@ nsHTMLEditRules::WillIndent(nsIDOMSelection *aSelection, PRBool *aCancel, PRBool
|
||||
// or if this node doesn't go in blockquote we used earlier.
|
||||
if (!curQuote || transitionList[i])
|
||||
{
|
||||
nsAutoString quoteType("blockquote");
|
||||
nsAutoString quoteType; quoteType.AssignWithConversion("blockquote");
|
||||
if (mEditor->CanContainTag(curParent,quoteType))
|
||||
{
|
||||
res = mEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curQuote));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// set style to not have unwanted vertical margins
|
||||
nsAutoString attr("style"), attrval("margin: 0 0 0 40px;");
|
||||
nsCOMPtr<nsIDOMElement> quoteElem = do_QueryInterface(curQuote);
|
||||
res = mEditor->SetAttribute(quoteElem, attr, attrval);
|
||||
res = mEditor->SetAttribute(quoteElem, NS_ConvertASCIItoUCS2("style"), NS_ConvertASCIItoUCS2("margin: 0 0 0 40px;"));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curQuote is now the correct thing to put curNode in
|
||||
}
|
||||
@ -1768,7 +1760,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> newNode;
|
||||
nsCOMPtr<nsIDOMText> nodeAsText;
|
||||
res = aDoc->CreateTextNode("", getter_AddRefs(nodeAsText));
|
||||
res = aDoc->CreateTextNode(nsAutoString(), getter_AddRefs(nodeAsText));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!nodeAsText) return NS_ERROR_NULL_POINTER;
|
||||
newNode = do_QueryInterface(nodeAsText);
|
||||
@ -1941,14 +1933,14 @@ nsHTMLEditRules::WillAlign(nsIDOMSelection *aSelection,
|
||||
{
|
||||
PRInt32 offset;
|
||||
nsCOMPtr<nsIDOMNode> brNode, parent, theDiv;
|
||||
nsAutoString divType("div");
|
||||
nsAutoString divType; divType.AssignWithConversion("div");
|
||||
res = mEditor->GetStartNodeAndOffset(aSelection, &parent, &offset);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = mEditor->CreateNode(divType, parent, offset, getter_AddRefs(theDiv));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// set up the alignment on the div
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(theDiv);
|
||||
nsAutoString attr("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
*aHandled = PR_TRUE;
|
||||
@ -2004,7 +1996,7 @@ nsHTMLEditRules::WillAlign(nsIDOMSelection *aSelection,
|
||||
if (nsHTMLEditUtils::IsDiv(curNode))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(curNode);
|
||||
nsAutoString attr("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->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
|
||||
@ -2027,12 +2019,12 @@ nsHTMLEditRules::WillAlign(nsIDOMSelection *aSelection,
|
||||
// or if this node doesn't go in div we used earlier.
|
||||
if (!curDiv || transitionList[i])
|
||||
{
|
||||
nsAutoString divType("div");
|
||||
nsAutoString divType; divType.AssignWithConversion("div");
|
||||
res = mEditor->CreateNode(divType, curParent, offset, getter_AddRefs(curDiv));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// set up the alignment on the div
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(curDiv);
|
||||
nsAutoString attr("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curDiv is now the correct thing to put curNode in
|
||||
@ -2132,19 +2124,19 @@ nsHTMLEditRules::AlignTableCellContents(nsIDOMNode *aNode, const nsString *align
|
||||
// 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("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->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 al the children
|
||||
nsAutoString divType("div");
|
||||
nsAutoString divType; divType.AssignWithConversion("div");
|
||||
res = mEditor->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("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// tuck the children into the end of the active div
|
||||
@ -2782,14 +2774,14 @@ nsHTMLEditRules::InsertTab(nsIDOMSelection *aSelection,
|
||||
|
||||
if (isPRE)
|
||||
{
|
||||
*outString = '\t';
|
||||
outString->AssignWithConversion('\t');
|
||||
}
|
||||
else
|
||||
{
|
||||
// number of spaces should be a pref?
|
||||
// note that we dont play around with nbsps here anymore.
|
||||
// let the AfterEdit whitespace cleanup code handle it.
|
||||
*outString = " ";
|
||||
outString->AssignWithConversion(" ");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -3242,7 +3234,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
|
||||
// we special case an empty tag name to mean "remove block parents".
|
||||
// This is used for the "normal" paragraph style in mail-compose
|
||||
if (aBlockTag->IsEmpty() || aBlockTag->Equals("normal")) bNoParent = PR_TRUE;
|
||||
if (aBlockTag->IsEmpty() || aBlockTag->EqualsWithConversion("normal")) bNoParent = PR_TRUE;
|
||||
|
||||
arrayOfNodes->Count(&listCount);
|
||||
|
||||
@ -3269,15 +3261,15 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
// it with a new block of correct type.
|
||||
// xxx floppy moose: pre cant hold everything the others can
|
||||
if (nsHTMLEditUtils::IsMozDiv(curNode) ||
|
||||
(curNodeTag.Equals("pre")) ||
|
||||
(curNodeTag.Equals("p")) ||
|
||||
(curNodeTag.Equals("h1")) ||
|
||||
(curNodeTag.Equals("h2")) ||
|
||||
(curNodeTag.Equals("h3")) ||
|
||||
(curNodeTag.Equals("h4")) ||
|
||||
(curNodeTag.Equals("h5")) ||
|
||||
(curNodeTag.Equals("h6")) ||
|
||||
(curNodeTag.Equals("address")))
|
||||
(curNodeTag.EqualsWithConversion("pre")) ||
|
||||
(curNodeTag.EqualsWithConversion("p")) ||
|
||||
(curNodeTag.EqualsWithConversion("h1")) ||
|
||||
(curNodeTag.EqualsWithConversion("h2")) ||
|
||||
(curNodeTag.EqualsWithConversion("h3")) ||
|
||||
(curNodeTag.EqualsWithConversion("h4")) ||
|
||||
(curNodeTag.EqualsWithConversion("h5")) ||
|
||||
(curNodeTag.EqualsWithConversion("h6")) ||
|
||||
(curNodeTag.EqualsWithConversion("address")))
|
||||
{
|
||||
curBlock = 0; // forget any previous block used for previous inline nodes
|
||||
if (bNoParent)
|
||||
@ -3293,15 +3285,15 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
else if ((curNodeTag.Equals("table")) ||
|
||||
(curNodeTag.Equals("tbody")) ||
|
||||
(curNodeTag.Equals("tr")) ||
|
||||
(curNodeTag.Equals("td")) ||
|
||||
(curNodeTag.Equals("ol")) ||
|
||||
(curNodeTag.Equals("ul")) ||
|
||||
(curNodeTag.Equals("li")) ||
|
||||
(curNodeTag.Equals("blockquote")) ||
|
||||
(curNodeTag.Equals("div"))) // div's other than mozdivs
|
||||
else if ((curNodeTag.EqualsWithConversion("table")) ||
|
||||
(curNodeTag.EqualsWithConversion("tbody")) ||
|
||||
(curNodeTag.EqualsWithConversion("tr")) ||
|
||||
(curNodeTag.EqualsWithConversion("td")) ||
|
||||
(curNodeTag.EqualsWithConversion("ol")) ||
|
||||
(curNodeTag.EqualsWithConversion("ul")) ||
|
||||
(curNodeTag.EqualsWithConversion("li")) ||
|
||||
(curNodeTag.EqualsWithConversion("blockquote")) ||
|
||||
(curNodeTag.EqualsWithConversion("div"))) // div's other than mozdivs
|
||||
{
|
||||
curBlock = 0; // forget any previous block used for previous inline nodes
|
||||
// recursion time
|
||||
@ -3313,7 +3305,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
}
|
||||
|
||||
// if the node is a break, we honor it by putting further nodes in a new parent
|
||||
else if (curNodeTag.Equals("br"))
|
||||
else if (curNodeTag.EqualsWithConversion("br"))
|
||||
{
|
||||
curBlock = 0; // forget any previous block used for previous inline nodes
|
||||
if (!bNoParent)
|
||||
@ -3334,7 +3326,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
else if (nsEditor::IsInlineNode(curNode) && !bNoParent)
|
||||
{
|
||||
// if curNode is a non editable, drop it if we are going to <pre>
|
||||
if ((aBlockTag->Equals("pre")) && (!mEditor->IsEditable(curNode)))
|
||||
if ((aBlockTag->EqualsWithConversion("pre")) && (!mEditor->IsEditable(curNode)))
|
||||
continue; // do nothing to this block
|
||||
|
||||
// if no curBlock, make one
|
||||
@ -4049,40 +4041,40 @@ nsHTMLEditRules::ConvertWhitespace(const nsString & inString, nsString & outStri
|
||||
switch (len)
|
||||
{
|
||||
case 0:
|
||||
outString = "";
|
||||
outString.SetLength(0);
|
||||
return NS_OK;
|
||||
case 1:
|
||||
if (inString.Equals("\n")) // a bit of a hack: don't convert single newlines that
|
||||
outString = "\n"; // dont have whitespace adjacent. This is to preserve
|
||||
if (inString.EqualsWithConversion("\n")) // a bit of a hack: don't convert single newlines that
|
||||
outString.AssignWithConversion("\n"); // dont have whitespace adjacent. This is to preserve
|
||||
else // html source formatting to some degree.
|
||||
outString = " ";
|
||||
outString.AssignWithConversion(" ");
|
||||
return NS_OK;
|
||||
case 2:
|
||||
outString = (PRUnichar)nbsp;
|
||||
outString += " ";
|
||||
outString.Assign((PRUnichar)nbsp);
|
||||
outString.AppendWithConversion(" ");
|
||||
return NS_OK;
|
||||
case 3:
|
||||
outString = " ";
|
||||
outString.AssignWithConversion(" ");
|
||||
outString += (PRUnichar)nbsp;
|
||||
outString += " ";
|
||||
outString.AppendWithConversion(" ");
|
||||
return NS_OK;
|
||||
}
|
||||
if (len%2) // length is odd
|
||||
{
|
||||
for (j=0;j<len;j++)
|
||||
{
|
||||
if (!(j%2)) outString += " "; // even char
|
||||
if (!(j%2)) outString.AppendWithConversion(" "); // even char
|
||||
else outString += (PRUnichar)nbsp; // odd char
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outString = " ";
|
||||
outString.AssignWithConversion(" ");
|
||||
outString += (PRUnichar)nbsp;
|
||||
outString += (PRUnichar)nbsp;
|
||||
for (j=0;j<len-3;j++)
|
||||
{
|
||||
if (!(j%2)) outString += " "; // even char
|
||||
if (!(j%2)) outString.AppendWithConversion(" "); // even char
|
||||
else outString += (PRUnichar)nbsp; // odd char
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ nsHTMLEditUtils::IsBody(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("body"))
|
||||
if (tag.EqualsWithConversion("body"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -60,7 +60,7 @@ nsHTMLEditUtils::IsBreak(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("br"))
|
||||
if (tag.EqualsWithConversion("br"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -78,7 +78,7 @@ nsHTMLEditUtils::IsBig(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("big"))
|
||||
if (tag.EqualsWithConversion("big"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -96,7 +96,7 @@ nsHTMLEditUtils::IsSmall(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("small"))
|
||||
if (tag.EqualsWithConversion("small"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -128,11 +128,11 @@ nsHTMLEditUtils::HasMozAttr(nsIDOMNode *node)
|
||||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(node);
|
||||
if (elem)
|
||||
{
|
||||
nsAutoString typeAttrName("type");
|
||||
nsAutoString typeAttrName; typeAttrName.AssignWithConversion("type");
|
||||
nsAutoString typeAttrVal;
|
||||
nsresult res = elem->GetAttribute(typeAttrName, typeAttrVal);
|
||||
typeAttrVal.ToLowerCase();
|
||||
if (NS_SUCCEEDED(res) && (typeAttrVal.Equals("_moz")))
|
||||
if (NS_SUCCEEDED(res) && (typeAttrVal.EqualsWithConversion("_moz")))
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
@ -174,12 +174,12 @@ nsHTMLEditUtils::IsHeader(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if ( (tag.Equals("h1")) ||
|
||||
(tag.Equals("h2")) ||
|
||||
(tag.Equals("h3")) ||
|
||||
(tag.Equals("h4")) ||
|
||||
(tag.Equals("h5")) ||
|
||||
(tag.Equals("h6")) )
|
||||
if ( (tag.EqualsWithConversion("h1")) ||
|
||||
(tag.EqualsWithConversion("h2")) ||
|
||||
(tag.EqualsWithConversion("h3")) ||
|
||||
(tag.EqualsWithConversion("h4")) ||
|
||||
(tag.EqualsWithConversion("h5")) ||
|
||||
(tag.EqualsWithConversion("h6")) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -197,7 +197,7 @@ nsHTMLEditUtils::IsParagraph(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("p"))
|
||||
if (tag.EqualsWithConversion("p"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -215,7 +215,7 @@ nsHTMLEditUtils::IsListItem(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("li"))
|
||||
if (tag.EqualsWithConversion("li"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -232,7 +232,7 @@ nsHTMLEditUtils::IsTable(nsIDOMNode *node)
|
||||
NS_PRECONDITION(node, "null node passed to nsHTMLEditor::IsTable");
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
if (tag.Equals("table"))
|
||||
if (tag.EqualsWithConversion("table"))
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
@ -248,7 +248,7 @@ nsHTMLEditUtils::IsTableRow(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("tr"))
|
||||
if (tag.EqualsWithConversion("tr"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -266,7 +266,7 @@ nsHTMLEditUtils::IsTableCell(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("td") || tag.Equals("th"))
|
||||
if (tag.EqualsWithConversion("td") || tag.EqualsWithConversion("th"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -284,8 +284,8 @@ nsHTMLEditUtils::IsList(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if ( (tag.Equals("ol")) ||
|
||||
(tag.Equals("ul")) )
|
||||
if ( (tag.EqualsWithConversion("ol")) ||
|
||||
(tag.EqualsWithConversion("ul")) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -303,7 +303,7 @@ nsHTMLEditUtils::IsOrderedList(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("ol"))
|
||||
if (tag.EqualsWithConversion("ol"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -321,7 +321,7 @@ nsHTMLEditUtils::IsUnorderedList(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("ul"))
|
||||
if (tag.EqualsWithConversion("ul"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -339,7 +339,7 @@ nsHTMLEditUtils::IsBlockquote(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("blockquote"))
|
||||
if (tag.EqualsWithConversion("blockquote"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -357,7 +357,7 @@ nsHTMLEditUtils::IsPre(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("pre"))
|
||||
if (tag.EqualsWithConversion("pre"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -375,7 +375,7 @@ nsHTMLEditUtils::IsAddress(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("address"))
|
||||
if (tag.EqualsWithConversion("address"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -393,7 +393,7 @@ nsHTMLEditUtils::IsAnchor(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("a"))
|
||||
if (tag.EqualsWithConversion("a"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -411,7 +411,7 @@ nsHTMLEditUtils::IsImage(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("img"))
|
||||
if (tag.EqualsWithConversion("img"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -429,7 +429,7 @@ nsHTMLEditUtils::IsDiv(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("div"))
|
||||
if (tag.EqualsWithConversion("div"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -470,13 +470,13 @@ nsHTMLEditUtils::IsMailCite(nsIDOMNode *node)
|
||||
if (IsBlockquote(node))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> bqElem = do_QueryInterface(node);
|
||||
nsAutoString typeAttrName("type");
|
||||
nsAutoString typeAttrName; typeAttrName.AssignWithConversion("type");
|
||||
nsAutoString typeAttrVal;
|
||||
nsresult res = bqElem->GetAttribute(typeAttrName, typeAttrVal);
|
||||
typeAttrVal.ToLowerCase();
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
if (typeAttrVal.Equals("cite", PR_TRUE, 4))
|
||||
if (typeAttrVal.EqualsWithConversion("cite", PR_TRUE, 4))
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ NS_IMETHODIMP nsInterfaceState::DidDo(nsITransactionManager *aManager,
|
||||
if (undoCount == 1)
|
||||
{
|
||||
if (mFirstDoOfFirstUndo)
|
||||
CallUpdateCommands(nsAutoString("undo"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
mFirstDoOfFirstUndo = PR_FALSE;
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ NS_IMETHODIMP nsInterfaceState::DidUndo(nsITransactionManager *aManager,
|
||||
if (undoCount == 0)
|
||||
mFirstDoOfFirstUndo = PR_TRUE; // reset the state for the next do
|
||||
|
||||
CallUpdateCommands(nsAutoString("undo"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ NS_IMETHODIMP nsInterfaceState::WillRedo(nsITransactionManager *aManager,
|
||||
NS_IMETHODIMP nsInterfaceState::DidRedo(nsITransactionManager *aManager,
|
||||
nsITransaction *aTransaction, nsresult aRedoResult)
|
||||
{
|
||||
CallUpdateCommands(nsAutoString("undo"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ void nsInterfaceState::TimerCallback()
|
||||
PRBool isCollapsed = SelectionIsCollapsed();
|
||||
if (isCollapsed != mSelectionCollapsed)
|
||||
{
|
||||
CallUpdateCommands(nsAutoString("select"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("select"));
|
||||
mSelectionCollapsed = isCollapsed;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ nsInterfaceState::UpdateParagraphState(const char* observerName, const char* att
|
||||
// selection and if different from the anchorNodeBlockParent, use "mixed" state
|
||||
// *** Not doing this now reduces risk for Beta1 -- simply assume mixed state
|
||||
// Note that "mixed" displays as "normal" in UI as of 3/6.
|
||||
tagName = "mixed";
|
||||
tagName.AssignWithConversion("mixed");
|
||||
}
|
||||
|
||||
if (tagName != mParagraphFormat)
|
||||
@ -471,19 +471,19 @@ nsInterfaceState::UpdateListState(const char* observerName)
|
||||
domSelection->GetAnchorNode(getter_AddRefs(domNode));
|
||||
|
||||
// tagStr will hold the list state when we're done.
|
||||
nsAutoString tagStr("ol");
|
||||
nsAutoString tagStr; tagStr.AssignWithConversion("ol");
|
||||
nsCOMPtr<nsIDOMElement> parentElement;
|
||||
rv = mEditor->GetElementOrParentByTagName(tagStr, domNode, getter_AddRefs(parentElement));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!parentElement)
|
||||
{
|
||||
tagStr = "ul";
|
||||
tagStr.AssignWithConversion("ul");
|
||||
rv = mEditor->GetElementOrParentByTagName(tagStr, domNode, getter_AddRefs(parentElement));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!parentElement)
|
||||
tagStr = "";
|
||||
tagStr.SetLength(0);
|
||||
}
|
||||
|
||||
if (tagStr != mListTag)
|
||||
@ -505,7 +505,7 @@ nsInterfaceState::UpdateFontFace(const char* observerName, const char* attribute
|
||||
PRBool allOfSelectionHasProp = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAtom> styleAtom = getter_AddRefs(NS_NewAtom("font"));
|
||||
nsAutoString faceStr("face");
|
||||
nsAutoString faceStr; faceStr.AssignWithConversion("face");
|
||||
nsAutoString thisFace;
|
||||
|
||||
// Use to test for "Default Fixed Width"
|
||||
@ -522,7 +522,7 @@ nsInterfaceState::UpdateFontFace(const char* observerName, const char* attribute
|
||||
{
|
||||
testBoolean = anyOfSelectionHasProp;
|
||||
if (anyOfSelectionHasProp)
|
||||
thisFace = "tt";
|
||||
thisFace.AssignWithConversion("tt");
|
||||
}
|
||||
else
|
||||
rv = NS_OK; // we don't want to propagate this error
|
||||
@ -558,7 +558,7 @@ nsInterfaceState::UpdateTextState(const char* tagName, const char* observerName,
|
||||
|
||||
if (testBoolean != ioState)
|
||||
{
|
||||
rv = SetNodeAttribute(observerName, attributeName, testBoolean ? "true" : "false");
|
||||
rv = SetNodeAttribute(observerName, attributeName, NS_ConvertASCIItoUCS2(testBoolean ? "true" : "false"));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -575,7 +575,7 @@ nsInterfaceState::UpdateDirtyState(PRBool aNowDirty)
|
||||
{
|
||||
nsresult rv; // = SetNodeAttribute("Editor:Save", "disabled", aNowDirty ? "true" : "false");
|
||||
|
||||
rv = SetNodeAttribute("Editor:Save", "disabled", aNowDirty ? "false" : "true");
|
||||
rv = SetNodeAttribute("Editor:Save", "disabled", NS_ConvertASCIItoUCS2(aNowDirty ? "false" : "true"));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mDirtyState = aNowDirty;
|
||||
@ -594,7 +594,7 @@ nsInterfaceState::XULNodeExists(const char* nodeID)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = mChromeDoc->GetElementById( nodeID, getter_AddRefs(elem) );
|
||||
rv = mChromeDoc->GetElementById( NS_ConvertASCIItoUCS2(nodeID), getter_AddRefs(elem) );
|
||||
|
||||
return NS_SUCCEEDED(rv) && elem;
|
||||
}
|
||||
@ -608,10 +608,10 @@ nsInterfaceState::SetNodeAttribute(const char* nodeID, const char* attributeName
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = mChromeDoc->GetElementById( nodeID, getter_AddRefs(elem) );
|
||||
rv = mChromeDoc->GetElementById( NS_ConvertASCIItoUCS2(nodeID), getter_AddRefs(elem) );
|
||||
if (NS_FAILED(rv) || !elem) return rv;
|
||||
|
||||
return elem->SetAttribute(attributeName, newValue);
|
||||
return elem->SetAttribute(NS_ConvertASCIItoUCS2(attributeName), newValue);
|
||||
}
|
||||
|
||||
|
||||
@ -624,10 +624,10 @@ nsInterfaceState::UnsetNodeAttribute(const char* nodeID, const char* attributeNa
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = mChromeDoc->GetElementById( nodeID, getter_AddRefs(elem) );
|
||||
rv = mChromeDoc->GetElementById( NS_ConvertASCIItoUCS2(nodeID), getter_AddRefs(elem) );
|
||||
if (NS_FAILED(rv) || !elem) return rv;
|
||||
|
||||
return elem->RemoveAttribute(attributeName);
|
||||
return elem->RemoveAttribute(NS_ConvertASCIItoUCS2(attributeName));
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,14 +67,14 @@ nsInternetCiter::GetCiteString(const nsString& aInString, nsString& aOutString)
|
||||
PRUnichar newline ('\n');
|
||||
PRInt32 i = 0;
|
||||
PRInt32 length = aInString.Length();
|
||||
aOutString = "";
|
||||
aOutString.SetLength(0);
|
||||
PRUnichar uch = newline;
|
||||
|
||||
// Loop over the string:
|
||||
while (i < length)
|
||||
{
|
||||
if (uch == newline)
|
||||
aOutString += "> ";
|
||||
aOutString.AppendWithConversion("> ");
|
||||
|
||||
uch = aInString[i++];
|
||||
aOutString += uch;
|
||||
|
@ -152,7 +152,7 @@ AddStyleSheetTxn::GetUndoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Remove Style Sheet";
|
||||
aString->AssignWithConversion("Remove Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -162,7 +162,7 @@ AddStyleSheetTxn::GetRedoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Add Style Sheet";
|
||||
aString->AssignWithConversion("Add Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -289,7 +289,7 @@ RemoveStyleSheetTxn::GetUndoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Add Style Sheet";
|
||||
aString->AssignWithConversion("Add Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -299,7 +299,7 @@ RemoveStyleSheetTxn::GetRedoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Remove Style Sheet";
|
||||
aString->AssignWithConversion("Remove Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
|
||||
if( NS_SUCCEEDED(res))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> newCell;
|
||||
res = CreateElementWithDefaults("td", getter_AddRefs(newCell));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
|
||||
if(NS_FAILED(res)) return res;
|
||||
if(!newCell) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -129,13 +129,13 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
|
||||
{
|
||||
nsAutoString newRowSpan(aRowSpan);
|
||||
// Note: Do NOT use editor txt for this
|
||||
newCell->SetAttribute("rowspan", newRowSpan);
|
||||
newCell->SetAttribute(NS_ConvertASCIItoUCS2("rowspan"), newRowSpan);
|
||||
}
|
||||
if( aColSpan > 1)
|
||||
{
|
||||
nsAutoString newColSpan(aColSpan);
|
||||
// Note: Do NOT use editor txt for this
|
||||
newCell->SetAttribute("colspan", newColSpan);
|
||||
newCell->SetAttribute(NS_ConvertASCIItoUCS2("colspan"), newColSpan);
|
||||
}
|
||||
if(aAfter) cellOffset++;
|
||||
|
||||
@ -164,8 +164,8 @@ NS_IMETHODIMP nsHTMLEditor::SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan)
|
||||
{
|
||||
if (!aCell) return NS_ERROR_NULL_POINTER;
|
||||
nsAutoString newSpan;
|
||||
newSpan.Append(aColSpan, 10);
|
||||
nsAutoString colSpan("colspan");
|
||||
newSpan.AppendInt(aColSpan, 10);
|
||||
nsAutoString colSpan; colSpan.AssignWithConversion("colspan");
|
||||
return SetAttribute(aCell, colSpan, newSpan);
|
||||
}
|
||||
|
||||
@ -173,8 +173,8 @@ NS_IMETHODIMP nsHTMLEditor::SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan)
|
||||
{
|
||||
if (!aCell) return NS_ERROR_NULL_POINTER;
|
||||
nsAutoString newSpan;
|
||||
newSpan.Append(aRowSpan, 10);
|
||||
nsAutoString rowSpan("rowspan");
|
||||
newSpan.AppendInt(aRowSpan, 10);
|
||||
nsAutoString rowSpan; rowSpan.AssignWithConversion("rowspan");
|
||||
return SetAttribute(aCell, rowSpan, newSpan);
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
|
||||
for (i = 0; i < aNumber; i++)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> newCell;
|
||||
res = CreateElementWithDefaults("td", getter_AddRefs(newCell));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
|
||||
if (NS_SUCCEEDED(res) && newCell)
|
||||
{
|
||||
if (aAfter) cellOffset++;
|
||||
@ -230,7 +230,7 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
|
||||
aRow = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> tableElement;
|
||||
nsresult res = GetElementOrParentByTagName("table", aTableElement, getter_AddRefs(tableElement));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aTableElement, getter_AddRefs(tableElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!tableElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -295,7 +295,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
|
||||
aRow = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> rowElement;
|
||||
nsresult res = GetElementOrParentByTagName("tr", aTableElement, getter_AddRefs(rowElement));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), aTableElement, getter_AddRefs(rowElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!rowElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -484,7 +484,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
if (!curCell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", curCell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), curCell, getter_AddRefs(parentRow));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!parentRow) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -582,7 +582,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
{
|
||||
// Create a new row
|
||||
nsCOMPtr<nsIDOMElement> newRow;
|
||||
res = CreateElementWithDefaults("tr", getter_AddRefs(newRow));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("tr"), getter_AddRefs(newRow));
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
if (!newRow) return NS_ERROR_FAILURE;
|
||||
@ -590,7 +590,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
for (PRInt32 i = 0; i < cellsInRow; i++)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> newCell;
|
||||
res = CreateElementWithDefaults("td", getter_AddRefs(newCell));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!newCell) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -673,7 +673,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
||||
if (1 == GetNumberOfCellsInRow(table, startRowIndex))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", cell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cell, getter_AddRefs(parentRow));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!parentRow) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -827,7 +827,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
||||
{
|
||||
// Only 1 cell in row - delete the row
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", cell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cell, getter_AddRefs(parentRow));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!parentRow) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -943,7 +943,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
||||
|
||||
// Delete the row
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", cell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cell, getter_AddRefs(parentRow));
|
||||
if (NS_SUCCEEDED(res) && parentRow)
|
||||
res = DeleteNode(parentRow);
|
||||
if (NS_FAILED(res))
|
||||
@ -963,7 +963,7 @@ nsHTMLEditor::SelectTable()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
res = GetElementOrParentByTagName("table", nsnull, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), nsnull, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we didn't find a table
|
||||
if (!table) return NS_OK;
|
||||
@ -982,7 +982,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableCell()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we didn't find a table
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
@ -1008,12 +1008,12 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
res = GetElementOrParentByTagName("table", aStartCell, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aStartCell, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> endTable;
|
||||
res = GetElementOrParentByTagName("table", aEndCell, getter_AddRefs(endTable));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aEndCell, getter_AddRefs(endTable));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!endTable) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1089,7 +1089,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectAllTableCells()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Don't fail if we didn't find a cell
|
||||
@ -1156,7 +1156,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableRow()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Don't fail if we didn't find a cell
|
||||
@ -1224,7 +1224,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableColumn()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Don't fail if we didn't find a cell
|
||||
@ -1377,7 +1377,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
res = GetElementOrParentByTagName("table", aTable, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aTable, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we didn't find a table
|
||||
if (!table) return NS_OK;
|
||||
@ -1494,7 +1494,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, PRInt32 &aRowIndex, PRInt32 &
|
||||
{
|
||||
// Get the selected cell or the cell enclosing the selection anchor
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_SUCCEEDED(res) && cell)
|
||||
aCell = cell;
|
||||
else
|
||||
@ -1571,7 +1571,7 @@ nsHTMLEditor::GetTableSize(nsIDOMElement *aTable, PRInt32& aRowCount, PRInt32& a
|
||||
aColCount = 0;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
// Get the selected talbe or the table enclosing the selection anchor
|
||||
res = GetElementOrParentByTagName("table", aTable, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aTable, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1606,7 +1606,7 @@ nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aC
|
||||
{
|
||||
// Get the selected table or the table enclosing the selection anchor
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
res = GetElementOrParentByTagName("table", nsnull, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), nsnull, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (table)
|
||||
aTable = table;
|
||||
@ -1657,12 +1657,12 @@ nsHTMLEditor::GetCellContext(nsCOMPtr<nsIDOMSelection> &aSelection,
|
||||
{
|
||||
// Get cell if it's the child of selection anchor node,
|
||||
// or get the enclosing by a cell
|
||||
res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(aCell));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(aCell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aCell) return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Get containing table and the immediate parent of the cell
|
||||
res = GetElementOrParentByTagName("table", aCell, getter_AddRefs(aTable));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aCell, getter_AddRefs(aTable));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aTable) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1863,7 +1863,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsString& aTagName, PRInt32 &aSelectedCount)
|
||||
{
|
||||
aTableElement = nsnull;
|
||||
aTagName = "";
|
||||
aTagName.SetLength(0);
|
||||
aSelectedCount = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
@ -1871,9 +1871,9 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsS
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tableName("table");
|
||||
nsAutoString trName("tr");
|
||||
nsAutoString tdName("td");
|
||||
nsAutoString tableName; tableName.AssignWithConversion("table");
|
||||
nsAutoString trName; trName.AssignWithConversion("tr");
|
||||
nsAutoString tdName; tdName.AssignWithConversion("td");
|
||||
|
||||
nsCOMPtr<nsIDOMNode> anchorNode;
|
||||
res = selection->GetAnchorNode(getter_AddRefs(anchorNode));
|
||||
@ -1964,7 +1964,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
// (if aElement is null, this uses selection's anchor node)
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
||||
nsresult res = GetElementOrParentByTagName("table", aElement, getter_AddRefs(table));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aElement, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
|
@ -385,9 +385,9 @@ nsTextEditRules::GetTopEnclosingPre(nsIDOMNode *aNode,
|
||||
{
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node, tag);
|
||||
if (tag.Equals("pre", PR_TRUE))
|
||||
if (tag.EqualsWithConversion("pre", PR_TRUE))
|
||||
*aOutPreNode = node;
|
||||
else if (tag.Equals("body", PR_TRUE))
|
||||
else if (tag.EqualsWithConversion("body", PR_TRUE))
|
||||
break;
|
||||
|
||||
res = node->GetParentNode(getter_AddRefs(parentNode));
|
||||
@ -448,7 +448,7 @@ nsTextEditRules::WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel, P
|
||||
nsCOMPtr<nsIDOMElement> preElement (do_QueryInterface(preNode));
|
||||
if (preElement)
|
||||
{
|
||||
nsString mozQuote ("_moz_quote");
|
||||
nsString mozQuote; mozQuote.AssignWithConversion("_moz_quote");
|
||||
nsString mozQuoteVal;
|
||||
PRBool isMozQuote = PR_FALSE;
|
||||
if (NS_SUCCEEDED(mEditor->GetAttributeValue(preElement, mozQuote,
|
||||
@ -598,7 +598,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// dont put text in places that cant have it
|
||||
nsAutoString textTag = "__moz_text";
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
if (!mEditor->IsTextNode(selNode) && !mEditor->CanContainTag(selNode, textTag))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -660,7 +660,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a return?
|
||||
if (subStr.Equals("\n"))
|
||||
if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -675,7 +675,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
else
|
||||
{
|
||||
char specialChars[] = {'\t','\n',0};
|
||||
nsAutoString tabString = " ";
|
||||
nsAutoString tabString; tabString.AssignWithConversion(" ");
|
||||
while (unicodeBuf && (pos != -1) && (pos < outString->Length()))
|
||||
{
|
||||
PRInt32 oldPos = pos;
|
||||
@ -698,13 +698,13 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a tab?
|
||||
if (subStr.Equals("\t"))
|
||||
if (subStr.EqualsWithConversion("\t"))
|
||||
{
|
||||
res = mEditor->InsertTextImpl(tabString, &curNode, &curOffset, doc);
|
||||
pos++;
|
||||
}
|
||||
// is it a return?
|
||||
else if (subStr.Equals("\n"))
|
||||
else if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -947,7 +947,7 @@ nsTextEditRules:: DidUndo(nsIDOMSelection *aSelection, nsresult aResult)
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!theBody) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tagName("div");
|
||||
nsAutoString tagName; tagName.AssignWithConversion("div");
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
res = theBody->GetElementsByTagName(tagName, getter_AddRefs(nodeList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
@ -996,7 +996,7 @@ nsTextEditRules::DidRedo(nsIDOMSelection *aSelection, nsresult aResult)
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!theBody) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tagName("div");
|
||||
nsAutoString tagName; tagName.AssignWithConversion("div");
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
res = theBody->GetElementsByTagName(tagName, getter_AddRefs(nodeList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
@ -1032,7 +1032,7 @@ nsTextEditRules::WillOutputText(nsIDOMSelection *aSelection,
|
||||
*aCancel = PR_FALSE;
|
||||
*aHandled = PR_FALSE;
|
||||
|
||||
if (PR_TRUE == aOutputFormat->Equals("text/plain"))
|
||||
if (PR_TRUE == aOutputFormat->EqualsWithConversion("text/plain"))
|
||||
{ // only use these rules for plain text output
|
||||
if (mFlags & nsIHTMLEditor::eEditorPasswordMask)
|
||||
{
|
||||
@ -1041,7 +1041,7 @@ nsTextEditRules::WillOutputText(nsIDOMSelection *aSelection,
|
||||
}
|
||||
else if (mBogusNode)
|
||||
{ // this means there's no content, so output null string
|
||||
*aOutString = "";
|
||||
aOutString->SetLength(0);
|
||||
*aHandled = PR_TRUE;
|
||||
}
|
||||
}
|
||||
@ -1187,7 +1187,7 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection)
|
||||
if (needsBogusContent)
|
||||
{
|
||||
// set mBogusNode to be the newly created <br>
|
||||
res = mEditor->CreateNode(nsAutoString("br"), bodyNode, 0,
|
||||
res = mEditor->CreateNode(NS_ConvertASCIItoUCS2("br"), bodyNode, 0,
|
||||
getter_AddRefs(mBogusNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!mBogusNode) return NS_ERROR_NULL_POINTER;
|
||||
@ -1197,9 +1197,10 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection)
|
||||
newPElement = do_QueryInterface(mBogusNode);
|
||||
if (newPElement)
|
||||
{
|
||||
nsAutoString att(nsEditor::kMOZEditorBogusNodeAttr);
|
||||
nsAutoString val(nsEditor::kMOZEditorBogusNodeValue);
|
||||
newPElement->SetAttribute(att, val);
|
||||
newPElement->SetAttribute(
|
||||
NS_ConvertASCIItoUCS2(nsEditor::kMOZEditorBogusNodeAttr),
|
||||
NS_ConvertASCIItoUCS2(nsEditor::kMOZEditorBogusNodeValue)
|
||||
);
|
||||
}
|
||||
|
||||
// set selection
|
||||
@ -1243,7 +1244,7 @@ nsTextEditRules::TruncateInsertionIfNeeded(nsIDOMSelection *aSelection,
|
||||
PRInt32 resultingDocLength = docLength - selectionLength;
|
||||
if (resultingDocLength >= aMaxLength)
|
||||
{
|
||||
*aOutString = "";
|
||||
aOutString->SetLength(0);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
@ -1270,9 +1271,9 @@ nsTextEditRules::EchoInsertionToPWBuff(PRInt32 aStart, PRInt32 aEnd, nsString *a
|
||||
// change the output to '*' only
|
||||
PRInt32 length = aOutString->Length();
|
||||
PRInt32 i;
|
||||
*aOutString = "";
|
||||
aOutString->SetLength(0);
|
||||
for (i=0; i<length; i++)
|
||||
*aOutString += '*';
|
||||
aOutString->AppendWithConversion('*');
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1293,7 +1294,7 @@ nsTextEditRules::CreateMozBR(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<ns
|
||||
nsCOMPtr<nsIDOMElement> brElem = do_QueryInterface(*outBRNode);
|
||||
if (brElem)
|
||||
{
|
||||
res = mEditor->SetAttribute(brElem, "type", "_moz");
|
||||
res = mEditor->SetAttribute(brElem, NS_ConvertASCIItoUCS2("type"), NS_ConvertASCIItoUCS2("_moz"));
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
return res;
|
||||
|
@ -150,7 +150,7 @@ NS_IMETHODIMP nsInterfaceState::DidDo(nsITransactionManager *aManager,
|
||||
if (undoCount == 1)
|
||||
{
|
||||
if (mFirstDoOfFirstUndo)
|
||||
CallUpdateCommands(nsAutoString("undo"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
mFirstDoOfFirstUndo = PR_FALSE;
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ NS_IMETHODIMP nsInterfaceState::DidUndo(nsITransactionManager *aManager,
|
||||
if (undoCount == 0)
|
||||
mFirstDoOfFirstUndo = PR_TRUE; // reset the state for the next do
|
||||
|
||||
CallUpdateCommands(nsAutoString("undo"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ NS_IMETHODIMP nsInterfaceState::WillRedo(nsITransactionManager *aManager,
|
||||
NS_IMETHODIMP nsInterfaceState::DidRedo(nsITransactionManager *aManager,
|
||||
nsITransaction *aTransaction, nsresult aRedoResult)
|
||||
{
|
||||
CallUpdateCommands(nsAutoString("undo"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("undo"));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -257,7 +257,7 @@ void nsInterfaceState::TimerCallback()
|
||||
PRBool isCollapsed = SelectionIsCollapsed();
|
||||
if (isCollapsed != mSelectionCollapsed)
|
||||
{
|
||||
CallUpdateCommands(nsAutoString("select"));
|
||||
CallUpdateCommands(NS_ConvertASCIItoUCS2("select"));
|
||||
mSelectionCollapsed = isCollapsed;
|
||||
}
|
||||
|
||||
@ -443,7 +443,7 @@ nsInterfaceState::UpdateParagraphState(const char* observerName, const char* att
|
||||
// selection and if different from the anchorNodeBlockParent, use "mixed" state
|
||||
// *** Not doing this now reduces risk for Beta1 -- simply assume mixed state
|
||||
// Note that "mixed" displays as "normal" in UI as of 3/6.
|
||||
tagName = "mixed";
|
||||
tagName.AssignWithConversion("mixed");
|
||||
}
|
||||
|
||||
if (tagName != mParagraphFormat)
|
||||
@ -471,19 +471,19 @@ nsInterfaceState::UpdateListState(const char* observerName)
|
||||
domSelection->GetAnchorNode(getter_AddRefs(domNode));
|
||||
|
||||
// tagStr will hold the list state when we're done.
|
||||
nsAutoString tagStr("ol");
|
||||
nsAutoString tagStr; tagStr.AssignWithConversion("ol");
|
||||
nsCOMPtr<nsIDOMElement> parentElement;
|
||||
rv = mEditor->GetElementOrParentByTagName(tagStr, domNode, getter_AddRefs(parentElement));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!parentElement)
|
||||
{
|
||||
tagStr = "ul";
|
||||
tagStr.AssignWithConversion("ul");
|
||||
rv = mEditor->GetElementOrParentByTagName(tagStr, domNode, getter_AddRefs(parentElement));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (!parentElement)
|
||||
tagStr = "";
|
||||
tagStr.SetLength(0);
|
||||
}
|
||||
|
||||
if (tagStr != mListTag)
|
||||
@ -505,7 +505,7 @@ nsInterfaceState::UpdateFontFace(const char* observerName, const char* attribute
|
||||
PRBool allOfSelectionHasProp = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIAtom> styleAtom = getter_AddRefs(NS_NewAtom("font"));
|
||||
nsAutoString faceStr("face");
|
||||
nsAutoString faceStr; faceStr.AssignWithConversion("face");
|
||||
nsAutoString thisFace;
|
||||
|
||||
// Use to test for "Default Fixed Width"
|
||||
@ -522,7 +522,7 @@ nsInterfaceState::UpdateFontFace(const char* observerName, const char* attribute
|
||||
{
|
||||
testBoolean = anyOfSelectionHasProp;
|
||||
if (anyOfSelectionHasProp)
|
||||
thisFace = "tt";
|
||||
thisFace.AssignWithConversion("tt");
|
||||
}
|
||||
else
|
||||
rv = NS_OK; // we don't want to propagate this error
|
||||
@ -558,7 +558,7 @@ nsInterfaceState::UpdateTextState(const char* tagName, const char* observerName,
|
||||
|
||||
if (testBoolean != ioState)
|
||||
{
|
||||
rv = SetNodeAttribute(observerName, attributeName, testBoolean ? "true" : "false");
|
||||
rv = SetNodeAttribute(observerName, attributeName, NS_ConvertASCIItoUCS2(testBoolean ? "true" : "false"));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
@ -575,7 +575,7 @@ nsInterfaceState::UpdateDirtyState(PRBool aNowDirty)
|
||||
{
|
||||
nsresult rv; // = SetNodeAttribute("Editor:Save", "disabled", aNowDirty ? "true" : "false");
|
||||
|
||||
rv = SetNodeAttribute("Editor:Save", "disabled", aNowDirty ? "false" : "true");
|
||||
rv = SetNodeAttribute("Editor:Save", "disabled", NS_ConvertASCIItoUCS2(aNowDirty ? "false" : "true"));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
mDirtyState = aNowDirty;
|
||||
@ -594,7 +594,7 @@ nsInterfaceState::XULNodeExists(const char* nodeID)
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = mChromeDoc->GetElementById( nodeID, getter_AddRefs(elem) );
|
||||
rv = mChromeDoc->GetElementById( NS_ConvertASCIItoUCS2(nodeID), getter_AddRefs(elem) );
|
||||
|
||||
return NS_SUCCEEDED(rv) && elem;
|
||||
}
|
||||
@ -608,10 +608,10 @@ nsInterfaceState::SetNodeAttribute(const char* nodeID, const char* attributeName
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = mChromeDoc->GetElementById( nodeID, getter_AddRefs(elem) );
|
||||
rv = mChromeDoc->GetElementById( NS_ConvertASCIItoUCS2(nodeID), getter_AddRefs(elem) );
|
||||
if (NS_FAILED(rv) || !elem) return rv;
|
||||
|
||||
return elem->SetAttribute(attributeName, newValue);
|
||||
return elem->SetAttribute(NS_ConvertASCIItoUCS2(attributeName), newValue);
|
||||
}
|
||||
|
||||
|
||||
@ -624,10 +624,10 @@ nsInterfaceState::UnsetNodeAttribute(const char* nodeID, const char* attributeNa
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> elem;
|
||||
rv = mChromeDoc->GetElementById( nodeID, getter_AddRefs(elem) );
|
||||
rv = mChromeDoc->GetElementById( NS_ConvertASCIItoUCS2(nodeID), getter_AddRefs(elem) );
|
||||
if (NS_FAILED(rv) || !elem) return rv;
|
||||
|
||||
return elem->RemoveAttribute(attributeName);
|
||||
return elem->RemoveAttribute(NS_ConvertASCIItoUCS2(attributeName));
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,7 +198,7 @@ NS_IMETHODIMP SplitElementTxn::GetUndoString(nsString *aString)
|
||||
{
|
||||
if (nsnull!=aString)
|
||||
{
|
||||
*aString="Join Element";
|
||||
aString->AssignWithConversion("Join Element");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -207,7 +207,7 @@ NS_IMETHODIMP SplitElementTxn::GetRedoString(nsString *aString)
|
||||
{
|
||||
if (nsnull!=aString)
|
||||
{
|
||||
*aString="Split Element";
|
||||
aString->AssignWithConversion("Split Element");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ AddStyleSheetTxn::GetUndoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Remove Style Sheet";
|
||||
aString->AssignWithConversion("Remove Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -162,7 +162,7 @@ AddStyleSheetTxn::GetRedoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Add Style Sheet";
|
||||
aString->AssignWithConversion("Add Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -289,7 +289,7 @@ RemoveStyleSheetTxn::GetUndoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Add Style Sheet";
|
||||
aString->AssignWithConversion("Add Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@ -299,7 +299,7 @@ RemoveStyleSheetTxn::GetRedoString(nsString *aString)
|
||||
{
|
||||
if (aString)
|
||||
{
|
||||
*aString="Remove Style Sheet";
|
||||
aString->AssignWithConversion("Remove Style Sheet");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -70,14 +70,14 @@ nsresult TextEditorTest::RunUnitTest(PRInt32 *outNumTests, PRInt32 *outNumTestsF
|
||||
// shouldn't we just bail on error here?
|
||||
|
||||
// insert some simple text
|
||||
nsString docContent("1234567890abcdefghij1234567890");
|
||||
nsString docContent; docContent.AssignWithConversion("1234567890abcdefghij1234567890");
|
||||
result = mTextEditor->InsertText(docContent);
|
||||
TEST_RESULT(result);
|
||||
(*outNumTests)++;
|
||||
(*outNumTestsFailed) += (NS_FAILED(result) != NS_OK);
|
||||
|
||||
// insert some more text
|
||||
nsString docContent2("Moreover, I am cognizant of the interrelatedness of all communities and states. I cannot sit idly by in Atlanta and not be concerned about what happens in Birmingham. Injustice anywhere is a threat to justice everywhere");
|
||||
nsString docContent2; docContent2.AssignWithConversion("Moreover, I am cognizant of the interrelatedness of all communities and states. I cannot sit idly by in Atlanta and not be concerned about what happens in Birmingham. Injustice anywhere is a threat to justice everywhere");
|
||||
result = mTextEditor->InsertText(docContent2);
|
||||
TEST_RESULT(result);
|
||||
(*outNumTests)++;
|
||||
@ -142,7 +142,7 @@ nsresult TextEditorTest::TestTextProperties()
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(doc.get());
|
||||
nsCOMPtr<nsIDOMNodeList>nodeList;
|
||||
nsAutoString textTag = "__moz_text";
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
result = doc->GetElementsByTagName(textTag, getter_AddRefs(nodeList));
|
||||
TEST_RESULT(result);
|
||||
TEST_POINTER(nodeList.get());
|
||||
|
@ -389,7 +389,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// dont put text in places that cant have it
|
||||
nsAutoString textTag = "__moz_text";
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
if (!mEditor->IsTextNode(selNode) && !mEditor->CanContainTag(selNode, textTag))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -464,7 +464,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a return?
|
||||
if (subStr.Equals("\n"))
|
||||
if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -479,7 +479,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
else
|
||||
{
|
||||
char specialChars[] = {'\t','\n',0};
|
||||
nsAutoString tabString = " ";
|
||||
nsAutoString tabString; tabString.AssignWithConversion(" ");
|
||||
while (unicodeBuf && (pos != -1) && (pos < inString->Length()))
|
||||
{
|
||||
PRInt32 oldPos = pos;
|
||||
@ -502,13 +502,13 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a tab?
|
||||
if (subStr.Equals("\t"))
|
||||
if (subStr.EqualsWithConversion("\t"))
|
||||
{
|
||||
res = mEditor->InsertTextImpl(tabString, &curNode, &curOffset, doc);
|
||||
pos++;
|
||||
}
|
||||
// is it a return?
|
||||
else if (subStr.Equals("\n"))
|
||||
else if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -1077,8 +1077,8 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
*aCancel = PR_FALSE;
|
||||
*aHandled = PR_FALSE;
|
||||
|
||||
nsAutoString blockType("ul");
|
||||
if (aOrdered) blockType = "ol";
|
||||
nsAutoString blockType;
|
||||
blockType.AssignWithConversion( aOrdered ? "ol" : "ul");
|
||||
|
||||
PRBool outMakeEmpty;
|
||||
res = ShouldMakeEmptyBlock(aSelection, &blockType, &outMakeEmpty);
|
||||
@ -1094,13 +1094,12 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
|
||||
// make sure we can put a list here
|
||||
nsAutoString listType;
|
||||
if (aOrdered) listType = "ol";
|
||||
else listType = "ul";
|
||||
listType.AssignWithConversion( aOrdered ? "ol" : "ul" );
|
||||
if (mEditor->CanContainTag(parent,listType))
|
||||
{
|
||||
res = mEditor->CreateNode(listType, parent, offset, getter_AddRefs(theList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = mEditor->CreateNode("li", theList, 0, getter_AddRefs(theListItem));
|
||||
res = mEditor->CreateNode(NS_ConvertASCIItoUCS2("li"), theList, 0, getter_AddRefs(theListItem));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// put selection in new list item
|
||||
res = aSelection->Collapse(theListItem,0);
|
||||
@ -1283,10 +1282,7 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
// or if this node doesn't go in list we used earlier.
|
||||
if (!curList || transitionList[i])
|
||||
{
|
||||
nsAutoString listType;
|
||||
if (aOrdered) listType = "ol";
|
||||
else listType = "ul";
|
||||
res = mEditor->CreateNode(listType, curParent, offset, getter_AddRefs(curList));
|
||||
res = mEditor->CreateNode(NS_ConvertASCIItoUCS2( aOrdered ? "ol" : "ul" ), curParent, offset, getter_AddRefs(curList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curList is now the correct thing to put curNode in
|
||||
prevListItem = 0;
|
||||
@ -1320,11 +1316,11 @@ nsHTMLEditRules::WillMakeList(nsIDOMSelection *aSelection,
|
||||
// don't wrap li around a paragraph. instead replace paragraph with li
|
||||
if (nsHTMLEditUtils::IsParagraph(curNode))
|
||||
{
|
||||
res = mEditor->ReplaceContainer(curNode, &listItem, "li");
|
||||
res = mEditor->ReplaceContainer(curNode, &listItem, NS_ConvertASCIItoUCS2("li"));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = mEditor->InsertContainerAbove(curNode, &listItem, "li");
|
||||
res = mEditor->InsertContainerAbove(curNode, &listItem, NS_ConvertASCIItoUCS2("li"));
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (nsEditor::IsInlineNode(curNode))
|
||||
@ -1361,9 +1357,6 @@ nsHTMLEditRules::WillRemoveList(nsIDOMSelection *aSelection,
|
||||
// initialize out param
|
||||
*aCancel = PR_FALSE;
|
||||
*aHandled = PR_TRUE;
|
||||
|
||||
nsAutoString blockType("ul");
|
||||
if (aOrdered) blockType = "ol";
|
||||
|
||||
nsAutoSelectionReset selectionResetter(aSelection, mEditor);
|
||||
|
||||
@ -1585,15 +1578,14 @@ nsHTMLEditRules::WillIndent(nsIDOMSelection *aSelection, PRBool *aCancel, PRBool
|
||||
// or if this node doesn't go in blockquote we used earlier.
|
||||
if (!curQuote || transitionList[i])
|
||||
{
|
||||
nsAutoString quoteType("blockquote");
|
||||
nsAutoString quoteType; quoteType.AssignWithConversion("blockquote");
|
||||
if (mEditor->CanContainTag(curParent,quoteType))
|
||||
{
|
||||
res = mEditor->CreateNode(quoteType, curParent, offset, getter_AddRefs(curQuote));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// set style to not have unwanted vertical margins
|
||||
nsAutoString attr("style"), attrval("margin: 0 0 0 40px;");
|
||||
nsCOMPtr<nsIDOMElement> quoteElem = do_QueryInterface(curQuote);
|
||||
res = mEditor->SetAttribute(quoteElem, attr, attrval);
|
||||
res = mEditor->SetAttribute(quoteElem, NS_ConvertASCIItoUCS2("style"), NS_ConvertASCIItoUCS2("margin: 0 0 0 40px;"));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curQuote is now the correct thing to put curNode in
|
||||
}
|
||||
@ -1768,7 +1760,7 @@ nsHTMLEditRules::CreateStyleForInsertText(nsIDOMSelection *aSelection, nsIDOMDoc
|
||||
}
|
||||
nsCOMPtr<nsIDOMNode> newNode;
|
||||
nsCOMPtr<nsIDOMText> nodeAsText;
|
||||
res = aDoc->CreateTextNode("", getter_AddRefs(nodeAsText));
|
||||
res = aDoc->CreateTextNode(nsAutoString(), getter_AddRefs(nodeAsText));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!nodeAsText) return NS_ERROR_NULL_POINTER;
|
||||
newNode = do_QueryInterface(nodeAsText);
|
||||
@ -1941,14 +1933,14 @@ nsHTMLEditRules::WillAlign(nsIDOMSelection *aSelection,
|
||||
{
|
||||
PRInt32 offset;
|
||||
nsCOMPtr<nsIDOMNode> brNode, parent, theDiv;
|
||||
nsAutoString divType("div");
|
||||
nsAutoString divType; divType.AssignWithConversion("div");
|
||||
res = mEditor->GetStartNodeAndOffset(aSelection, &parent, &offset);
|
||||
if (NS_FAILED(res)) return res;
|
||||
res = mEditor->CreateNode(divType, parent, offset, getter_AddRefs(theDiv));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// set up the alignment on the div
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(theDiv);
|
||||
nsAutoString attr("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
*aHandled = PR_TRUE;
|
||||
@ -2004,7 +1996,7 @@ nsHTMLEditRules::WillAlign(nsIDOMSelection *aSelection,
|
||||
if (nsHTMLEditUtils::IsDiv(curNode))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(curNode);
|
||||
nsAutoString attr("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->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
|
||||
@ -2027,12 +2019,12 @@ nsHTMLEditRules::WillAlign(nsIDOMSelection *aSelection,
|
||||
// or if this node doesn't go in div we used earlier.
|
||||
if (!curDiv || transitionList[i])
|
||||
{
|
||||
nsAutoString divType("div");
|
||||
nsAutoString divType; divType.AssignWithConversion("div");
|
||||
res = mEditor->CreateNode(divType, curParent, offset, getter_AddRefs(curDiv));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// set up the alignment on the div
|
||||
nsCOMPtr<nsIDOMElement> divElem = do_QueryInterface(curDiv);
|
||||
nsAutoString attr("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// curDiv is now the correct thing to put curNode in
|
||||
@ -2132,19 +2124,19 @@ nsHTMLEditRules::AlignTableCellContents(nsIDOMNode *aNode, const nsString *align
|
||||
// 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("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->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 al the children
|
||||
nsAutoString divType("div");
|
||||
nsAutoString divType; divType.AssignWithConversion("div");
|
||||
res = mEditor->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("align");
|
||||
nsAutoString attr; attr.AssignWithConversion("align");
|
||||
res = mEditor->SetAttribute(divElem, attr, *alignType);
|
||||
if (NS_FAILED(res)) return res;
|
||||
// tuck the children into the end of the active div
|
||||
@ -2782,14 +2774,14 @@ nsHTMLEditRules::InsertTab(nsIDOMSelection *aSelection,
|
||||
|
||||
if (isPRE)
|
||||
{
|
||||
*outString = '\t';
|
||||
outString->AssignWithConversion('\t');
|
||||
}
|
||||
else
|
||||
{
|
||||
// number of spaces should be a pref?
|
||||
// note that we dont play around with nbsps here anymore.
|
||||
// let the AfterEdit whitespace cleanup code handle it.
|
||||
*outString = " ";
|
||||
outString->AssignWithConversion(" ");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -3242,7 +3234,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
|
||||
// we special case an empty tag name to mean "remove block parents".
|
||||
// This is used for the "normal" paragraph style in mail-compose
|
||||
if (aBlockTag->IsEmpty() || aBlockTag->Equals("normal")) bNoParent = PR_TRUE;
|
||||
if (aBlockTag->IsEmpty() || aBlockTag->EqualsWithConversion("normal")) bNoParent = PR_TRUE;
|
||||
|
||||
arrayOfNodes->Count(&listCount);
|
||||
|
||||
@ -3269,15 +3261,15 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
// it with a new block of correct type.
|
||||
// xxx floppy moose: pre cant hold everything the others can
|
||||
if (nsHTMLEditUtils::IsMozDiv(curNode) ||
|
||||
(curNodeTag.Equals("pre")) ||
|
||||
(curNodeTag.Equals("p")) ||
|
||||
(curNodeTag.Equals("h1")) ||
|
||||
(curNodeTag.Equals("h2")) ||
|
||||
(curNodeTag.Equals("h3")) ||
|
||||
(curNodeTag.Equals("h4")) ||
|
||||
(curNodeTag.Equals("h5")) ||
|
||||
(curNodeTag.Equals("h6")) ||
|
||||
(curNodeTag.Equals("address")))
|
||||
(curNodeTag.EqualsWithConversion("pre")) ||
|
||||
(curNodeTag.EqualsWithConversion("p")) ||
|
||||
(curNodeTag.EqualsWithConversion("h1")) ||
|
||||
(curNodeTag.EqualsWithConversion("h2")) ||
|
||||
(curNodeTag.EqualsWithConversion("h3")) ||
|
||||
(curNodeTag.EqualsWithConversion("h4")) ||
|
||||
(curNodeTag.EqualsWithConversion("h5")) ||
|
||||
(curNodeTag.EqualsWithConversion("h6")) ||
|
||||
(curNodeTag.EqualsWithConversion("address")))
|
||||
{
|
||||
curBlock = 0; // forget any previous block used for previous inline nodes
|
||||
if (bNoParent)
|
||||
@ -3293,15 +3285,15 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
}
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
else if ((curNodeTag.Equals("table")) ||
|
||||
(curNodeTag.Equals("tbody")) ||
|
||||
(curNodeTag.Equals("tr")) ||
|
||||
(curNodeTag.Equals("td")) ||
|
||||
(curNodeTag.Equals("ol")) ||
|
||||
(curNodeTag.Equals("ul")) ||
|
||||
(curNodeTag.Equals("li")) ||
|
||||
(curNodeTag.Equals("blockquote")) ||
|
||||
(curNodeTag.Equals("div"))) // div's other than mozdivs
|
||||
else if ((curNodeTag.EqualsWithConversion("table")) ||
|
||||
(curNodeTag.EqualsWithConversion("tbody")) ||
|
||||
(curNodeTag.EqualsWithConversion("tr")) ||
|
||||
(curNodeTag.EqualsWithConversion("td")) ||
|
||||
(curNodeTag.EqualsWithConversion("ol")) ||
|
||||
(curNodeTag.EqualsWithConversion("ul")) ||
|
||||
(curNodeTag.EqualsWithConversion("li")) ||
|
||||
(curNodeTag.EqualsWithConversion("blockquote")) ||
|
||||
(curNodeTag.EqualsWithConversion("div"))) // div's other than mozdivs
|
||||
{
|
||||
curBlock = 0; // forget any previous block used for previous inline nodes
|
||||
// recursion time
|
||||
@ -3313,7 +3305,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
}
|
||||
|
||||
// if the node is a break, we honor it by putting further nodes in a new parent
|
||||
else if (curNodeTag.Equals("br"))
|
||||
else if (curNodeTag.EqualsWithConversion("br"))
|
||||
{
|
||||
curBlock = 0; // forget any previous block used for previous inline nodes
|
||||
if (!bNoParent)
|
||||
@ -3334,7 +3326,7 @@ nsHTMLEditRules::ApplyBlockStyle(nsISupportsArray *arrayOfNodes, const nsString
|
||||
else if (nsEditor::IsInlineNode(curNode) && !bNoParent)
|
||||
{
|
||||
// if curNode is a non editable, drop it if we are going to <pre>
|
||||
if ((aBlockTag->Equals("pre")) && (!mEditor->IsEditable(curNode)))
|
||||
if ((aBlockTag->EqualsWithConversion("pre")) && (!mEditor->IsEditable(curNode)))
|
||||
continue; // do nothing to this block
|
||||
|
||||
// if no curBlock, make one
|
||||
@ -4049,40 +4041,40 @@ nsHTMLEditRules::ConvertWhitespace(const nsString & inString, nsString & outStri
|
||||
switch (len)
|
||||
{
|
||||
case 0:
|
||||
outString = "";
|
||||
outString.SetLength(0);
|
||||
return NS_OK;
|
||||
case 1:
|
||||
if (inString.Equals("\n")) // a bit of a hack: don't convert single newlines that
|
||||
outString = "\n"; // dont have whitespace adjacent. This is to preserve
|
||||
if (inString.EqualsWithConversion("\n")) // a bit of a hack: don't convert single newlines that
|
||||
outString.AssignWithConversion("\n"); // dont have whitespace adjacent. This is to preserve
|
||||
else // html source formatting to some degree.
|
||||
outString = " ";
|
||||
outString.AssignWithConversion(" ");
|
||||
return NS_OK;
|
||||
case 2:
|
||||
outString = (PRUnichar)nbsp;
|
||||
outString += " ";
|
||||
outString.Assign((PRUnichar)nbsp);
|
||||
outString.AppendWithConversion(" ");
|
||||
return NS_OK;
|
||||
case 3:
|
||||
outString = " ";
|
||||
outString.AssignWithConversion(" ");
|
||||
outString += (PRUnichar)nbsp;
|
||||
outString += " ";
|
||||
outString.AppendWithConversion(" ");
|
||||
return NS_OK;
|
||||
}
|
||||
if (len%2) // length is odd
|
||||
{
|
||||
for (j=0;j<len;j++)
|
||||
{
|
||||
if (!(j%2)) outString += " "; // even char
|
||||
if (!(j%2)) outString.AppendWithConversion(" "); // even char
|
||||
else outString += (PRUnichar)nbsp; // odd char
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outString = " ";
|
||||
outString.AssignWithConversion(" ");
|
||||
outString += (PRUnichar)nbsp;
|
||||
outString += (PRUnichar)nbsp;
|
||||
for (j=0;j<len-3;j++)
|
||||
{
|
||||
if (!(j%2)) outString += " "; // even char
|
||||
if (!(j%2)) outString.AppendWithConversion(" "); // even char
|
||||
else outString += (PRUnichar)nbsp; // odd char
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ nsHTMLEditUtils::IsBody(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("body"))
|
||||
if (tag.EqualsWithConversion("body"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -60,7 +60,7 @@ nsHTMLEditUtils::IsBreak(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("br"))
|
||||
if (tag.EqualsWithConversion("br"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -78,7 +78,7 @@ nsHTMLEditUtils::IsBig(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("big"))
|
||||
if (tag.EqualsWithConversion("big"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -96,7 +96,7 @@ nsHTMLEditUtils::IsSmall(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("small"))
|
||||
if (tag.EqualsWithConversion("small"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -128,11 +128,11 @@ nsHTMLEditUtils::HasMozAttr(nsIDOMNode *node)
|
||||
nsCOMPtr<nsIDOMElement> elem = do_QueryInterface(node);
|
||||
if (elem)
|
||||
{
|
||||
nsAutoString typeAttrName("type");
|
||||
nsAutoString typeAttrName; typeAttrName.AssignWithConversion("type");
|
||||
nsAutoString typeAttrVal;
|
||||
nsresult res = elem->GetAttribute(typeAttrName, typeAttrVal);
|
||||
typeAttrVal.ToLowerCase();
|
||||
if (NS_SUCCEEDED(res) && (typeAttrVal.Equals("_moz")))
|
||||
if (NS_SUCCEEDED(res) && (typeAttrVal.EqualsWithConversion("_moz")))
|
||||
return PR_TRUE;
|
||||
}
|
||||
return PR_FALSE;
|
||||
@ -174,12 +174,12 @@ nsHTMLEditUtils::IsHeader(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if ( (tag.Equals("h1")) ||
|
||||
(tag.Equals("h2")) ||
|
||||
(tag.Equals("h3")) ||
|
||||
(tag.Equals("h4")) ||
|
||||
(tag.Equals("h5")) ||
|
||||
(tag.Equals("h6")) )
|
||||
if ( (tag.EqualsWithConversion("h1")) ||
|
||||
(tag.EqualsWithConversion("h2")) ||
|
||||
(tag.EqualsWithConversion("h3")) ||
|
||||
(tag.EqualsWithConversion("h4")) ||
|
||||
(tag.EqualsWithConversion("h5")) ||
|
||||
(tag.EqualsWithConversion("h6")) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -197,7 +197,7 @@ nsHTMLEditUtils::IsParagraph(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("p"))
|
||||
if (tag.EqualsWithConversion("p"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -215,7 +215,7 @@ nsHTMLEditUtils::IsListItem(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("li"))
|
||||
if (tag.EqualsWithConversion("li"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -232,7 +232,7 @@ nsHTMLEditUtils::IsTable(nsIDOMNode *node)
|
||||
NS_PRECONDITION(node, "null node passed to nsHTMLEditor::IsTable");
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
if (tag.Equals("table"))
|
||||
if (tag.EqualsWithConversion("table"))
|
||||
return PR_TRUE;
|
||||
|
||||
return PR_FALSE;
|
||||
@ -248,7 +248,7 @@ nsHTMLEditUtils::IsTableRow(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("tr"))
|
||||
if (tag.EqualsWithConversion("tr"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -266,7 +266,7 @@ nsHTMLEditUtils::IsTableCell(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("td") || tag.Equals("th"))
|
||||
if (tag.EqualsWithConversion("td") || tag.EqualsWithConversion("th"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -284,8 +284,8 @@ nsHTMLEditUtils::IsList(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if ( (tag.Equals("ol")) ||
|
||||
(tag.Equals("ul")) )
|
||||
if ( (tag.EqualsWithConversion("ol")) ||
|
||||
(tag.EqualsWithConversion("ul")) )
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -303,7 +303,7 @@ nsHTMLEditUtils::IsOrderedList(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("ol"))
|
||||
if (tag.EqualsWithConversion("ol"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -321,7 +321,7 @@ nsHTMLEditUtils::IsUnorderedList(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("ul"))
|
||||
if (tag.EqualsWithConversion("ul"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -339,7 +339,7 @@ nsHTMLEditUtils::IsBlockquote(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("blockquote"))
|
||||
if (tag.EqualsWithConversion("blockquote"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -357,7 +357,7 @@ nsHTMLEditUtils::IsPre(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("pre"))
|
||||
if (tag.EqualsWithConversion("pre"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -375,7 +375,7 @@ nsHTMLEditUtils::IsAddress(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("address"))
|
||||
if (tag.EqualsWithConversion("address"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -393,7 +393,7 @@ nsHTMLEditUtils::IsAnchor(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("a"))
|
||||
if (tag.EqualsWithConversion("a"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -411,7 +411,7 @@ nsHTMLEditUtils::IsImage(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("img"))
|
||||
if (tag.EqualsWithConversion("img"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -429,7 +429,7 @@ nsHTMLEditUtils::IsDiv(nsIDOMNode *node)
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node,tag);
|
||||
tag.ToLowerCase();
|
||||
if (tag.Equals("div"))
|
||||
if (tag.EqualsWithConversion("div"))
|
||||
{
|
||||
return PR_TRUE;
|
||||
}
|
||||
@ -470,13 +470,13 @@ nsHTMLEditUtils::IsMailCite(nsIDOMNode *node)
|
||||
if (IsBlockquote(node))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> bqElem = do_QueryInterface(node);
|
||||
nsAutoString typeAttrName("type");
|
||||
nsAutoString typeAttrName; typeAttrName.AssignWithConversion("type");
|
||||
nsAutoString typeAttrVal;
|
||||
nsresult res = bqElem->GetAttribute(typeAttrName, typeAttrVal);
|
||||
typeAttrVal.ToLowerCase();
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
if (typeAttrVal.Equals("cite", PR_TRUE, 4))
|
||||
if (typeAttrVal.EqualsWithConversion("cite", PR_TRUE, 4))
|
||||
return PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
|
||||
if( NS_SUCCEEDED(res))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> newCell;
|
||||
res = CreateElementWithDefaults("td", getter_AddRefs(newCell));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
|
||||
if(NS_FAILED(res)) return res;
|
||||
if(!newCell) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -129,13 +129,13 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
|
||||
{
|
||||
nsAutoString newRowSpan(aRowSpan);
|
||||
// Note: Do NOT use editor txt for this
|
||||
newCell->SetAttribute("rowspan", newRowSpan);
|
||||
newCell->SetAttribute(NS_ConvertASCIItoUCS2("rowspan"), newRowSpan);
|
||||
}
|
||||
if( aColSpan > 1)
|
||||
{
|
||||
nsAutoString newColSpan(aColSpan);
|
||||
// Note: Do NOT use editor txt for this
|
||||
newCell->SetAttribute("colspan", newColSpan);
|
||||
newCell->SetAttribute(NS_ConvertASCIItoUCS2("colspan"), newColSpan);
|
||||
}
|
||||
if(aAfter) cellOffset++;
|
||||
|
||||
@ -164,8 +164,8 @@ NS_IMETHODIMP nsHTMLEditor::SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan)
|
||||
{
|
||||
if (!aCell) return NS_ERROR_NULL_POINTER;
|
||||
nsAutoString newSpan;
|
||||
newSpan.Append(aColSpan, 10);
|
||||
nsAutoString colSpan("colspan");
|
||||
newSpan.AppendInt(aColSpan, 10);
|
||||
nsAutoString colSpan; colSpan.AssignWithConversion("colspan");
|
||||
return SetAttribute(aCell, colSpan, newSpan);
|
||||
}
|
||||
|
||||
@ -173,8 +173,8 @@ NS_IMETHODIMP nsHTMLEditor::SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan)
|
||||
{
|
||||
if (!aCell) return NS_ERROR_NULL_POINTER;
|
||||
nsAutoString newSpan;
|
||||
newSpan.Append(aRowSpan, 10);
|
||||
nsAutoString rowSpan("rowspan");
|
||||
newSpan.AppendInt(aRowSpan, 10);
|
||||
nsAutoString rowSpan; rowSpan.AssignWithConversion("rowspan");
|
||||
return SetAttribute(aCell, rowSpan, newSpan);
|
||||
}
|
||||
|
||||
@ -213,7 +213,7 @@ nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
|
||||
for (i = 0; i < aNumber; i++)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> newCell;
|
||||
res = CreateElementWithDefaults("td", getter_AddRefs(newCell));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
|
||||
if (NS_SUCCEEDED(res) && newCell)
|
||||
{
|
||||
if (aAfter) cellOffset++;
|
||||
@ -230,7 +230,7 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
|
||||
aRow = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> tableElement;
|
||||
nsresult res = GetElementOrParentByTagName("table", aTableElement, getter_AddRefs(tableElement));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aTableElement, getter_AddRefs(tableElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!tableElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -295,7 +295,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
|
||||
aRow = nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> rowElement;
|
||||
nsresult res = GetElementOrParentByTagName("tr", aTableElement, getter_AddRefs(rowElement));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), aTableElement, getter_AddRefs(rowElement));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!rowElement) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -484,7 +484,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
if (!curCell) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", curCell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), curCell, getter_AddRefs(parentRow));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!parentRow) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -582,7 +582,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
{
|
||||
// Create a new row
|
||||
nsCOMPtr<nsIDOMElement> newRow;
|
||||
res = CreateElementWithDefaults("tr", getter_AddRefs(newRow));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("tr"), getter_AddRefs(newRow));
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
if (!newRow) return NS_ERROR_FAILURE;
|
||||
@ -590,7 +590,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
|
||||
for (PRInt32 i = 0; i < cellsInRow; i++)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> newCell;
|
||||
res = CreateElementWithDefaults("td", getter_AddRefs(newCell));
|
||||
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!newCell) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -673,7 +673,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
|
||||
if (1 == GetNumberOfCellsInRow(table, startRowIndex))
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", cell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cell, getter_AddRefs(parentRow));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!parentRow) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -827,7 +827,7 @@ nsHTMLEditor::DeleteTableColumn(PRInt32 aNumber)
|
||||
{
|
||||
// Only 1 cell in row - delete the row
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", cell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cell, getter_AddRefs(parentRow));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if(!parentRow) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
@ -943,7 +943,7 @@ nsHTMLEditor::DeleteTableRow(PRInt32 aNumber)
|
||||
|
||||
// Delete the row
|
||||
nsCOMPtr<nsIDOMElement> parentRow;
|
||||
res = GetElementOrParentByTagName("tr", cell, getter_AddRefs(parentRow));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cell, getter_AddRefs(parentRow));
|
||||
if (NS_SUCCEEDED(res) && parentRow)
|
||||
res = DeleteNode(parentRow);
|
||||
if (NS_FAILED(res))
|
||||
@ -963,7 +963,7 @@ nsHTMLEditor::SelectTable()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
res = GetElementOrParentByTagName("table", nsnull, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), nsnull, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we didn't find a table
|
||||
if (!table) return NS_OK;
|
||||
@ -982,7 +982,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableCell()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we didn't find a table
|
||||
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
|
||||
@ -1008,12 +1008,12 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
res = GetElementOrParentByTagName("table", aStartCell, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aStartCell, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> endTable;
|
||||
res = GetElementOrParentByTagName("table", aEndCell, getter_AddRefs(endTable));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aEndCell, getter_AddRefs(endTable));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!endTable) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1089,7 +1089,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectAllTableCells()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Don't fail if we didn't find a cell
|
||||
@ -1156,7 +1156,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableRow()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Don't fail if we didn't find a cell
|
||||
@ -1224,7 +1224,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::SelectTableColumn()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
nsresult res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// Don't fail if we didn't find a cell
|
||||
@ -1377,7 +1377,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
res = GetElementOrParentByTagName("table", aTable, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aTable, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
// Don't fail if we didn't find a table
|
||||
if (!table) return NS_OK;
|
||||
@ -1494,7 +1494,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, PRInt32 &aRowIndex, PRInt32 &
|
||||
{
|
||||
// Get the selected cell or the cell enclosing the selection anchor
|
||||
nsCOMPtr<nsIDOMElement> cell;
|
||||
res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(cell));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
|
||||
if (NS_SUCCEEDED(res) && cell)
|
||||
aCell = cell;
|
||||
else
|
||||
@ -1571,7 +1571,7 @@ nsHTMLEditor::GetTableSize(nsIDOMElement *aTable, PRInt32& aRowCount, PRInt32& a
|
||||
aColCount = 0;
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
// Get the selected talbe or the table enclosing the selection anchor
|
||||
res = GetElementOrParentByTagName("table", aTable, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aTable, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!table) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1606,7 +1606,7 @@ nsHTMLEditor::GetCellDataAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aC
|
||||
{
|
||||
// Get the selected table or the table enclosing the selection anchor
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
res = GetElementOrParentByTagName("table", nsnull, getter_AddRefs(table));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), nsnull, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (table)
|
||||
aTable = table;
|
||||
@ -1657,12 +1657,12 @@ nsHTMLEditor::GetCellContext(nsCOMPtr<nsIDOMSelection> &aSelection,
|
||||
{
|
||||
// Get cell if it's the child of selection anchor node,
|
||||
// or get the enclosing by a cell
|
||||
res = GetElementOrParentByTagName("td", nsnull, getter_AddRefs(aCell));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(aCell));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aCell) return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Get containing table and the immediate parent of the cell
|
||||
res = GetElementOrParentByTagName("table", aCell, getter_AddRefs(aTable));
|
||||
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aCell, getter_AddRefs(aTable));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!aTable) return NS_ERROR_FAILURE;
|
||||
|
||||
@ -1863,7 +1863,7 @@ NS_IMETHODIMP
|
||||
nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsString& aTagName, PRInt32 &aSelectedCount)
|
||||
{
|
||||
aTableElement = nsnull;
|
||||
aTagName = "";
|
||||
aTagName.SetLength(0);
|
||||
aSelectedCount = 0;
|
||||
|
||||
nsCOMPtr<nsIDOMSelection> selection;
|
||||
@ -1871,9 +1871,9 @@ nsHTMLEditor::GetSelectedOrParentTableElement(nsIDOMElement* &aTableElement, nsS
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!selection) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tableName("table");
|
||||
nsAutoString trName("tr");
|
||||
nsAutoString tdName("td");
|
||||
nsAutoString tableName; tableName.AssignWithConversion("table");
|
||||
nsAutoString trName; trName.AssignWithConversion("tr");
|
||||
nsAutoString tdName; tdName.AssignWithConversion("td");
|
||||
|
||||
nsCOMPtr<nsIDOMNode> anchorNode;
|
||||
res = selection->GetAnchorNode(getter_AddRefs(anchorNode));
|
||||
@ -1964,7 +1964,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
|
||||
// (if aElement is null, this uses selection's anchor node)
|
||||
nsCOMPtr<nsIDOMElement> table;
|
||||
|
||||
nsresult res = GetElementOrParentByTagName("table", aElement, getter_AddRefs(table));
|
||||
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aElement, getter_AddRefs(table));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
PRInt32 rowCount, colCount;
|
||||
|
@ -67,14 +67,14 @@ nsInternetCiter::GetCiteString(const nsString& aInString, nsString& aOutString)
|
||||
PRUnichar newline ('\n');
|
||||
PRInt32 i = 0;
|
||||
PRInt32 length = aInString.Length();
|
||||
aOutString = "";
|
||||
aOutString.SetLength(0);
|
||||
PRUnichar uch = newline;
|
||||
|
||||
// Loop over the string:
|
||||
while (i < length)
|
||||
{
|
||||
if (uch == newline)
|
||||
aOutString += "> ";
|
||||
aOutString.AppendWithConversion("> ");
|
||||
|
||||
uch = aInString[i++];
|
||||
aOutString += uch;
|
||||
|
@ -385,9 +385,9 @@ nsTextEditRules::GetTopEnclosingPre(nsIDOMNode *aNode,
|
||||
{
|
||||
nsAutoString tag;
|
||||
nsEditor::GetTagString(node, tag);
|
||||
if (tag.Equals("pre", PR_TRUE))
|
||||
if (tag.EqualsWithConversion("pre", PR_TRUE))
|
||||
*aOutPreNode = node;
|
||||
else if (tag.Equals("body", PR_TRUE))
|
||||
else if (tag.EqualsWithConversion("body", PR_TRUE))
|
||||
break;
|
||||
|
||||
res = node->GetParentNode(getter_AddRefs(parentNode));
|
||||
@ -448,7 +448,7 @@ nsTextEditRules::WillInsertBreak(nsIDOMSelection *aSelection, PRBool *aCancel, P
|
||||
nsCOMPtr<nsIDOMElement> preElement (do_QueryInterface(preNode));
|
||||
if (preElement)
|
||||
{
|
||||
nsString mozQuote ("_moz_quote");
|
||||
nsString mozQuote; mozQuote.AssignWithConversion("_moz_quote");
|
||||
nsString mozQuoteVal;
|
||||
PRBool isMozQuote = PR_FALSE;
|
||||
if (NS_SUCCEEDED(mEditor->GetAttributeValue(preElement, mozQuote,
|
||||
@ -598,7 +598,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
// dont put text in places that cant have it
|
||||
nsAutoString textTag = "__moz_text";
|
||||
nsAutoString textTag; textTag.AssignWithConversion("__moz_text");
|
||||
if (!mEditor->IsTextNode(selNode) && !mEditor->CanContainTag(selNode, textTag))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
@ -660,7 +660,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a return?
|
||||
if (subStr.Equals("\n"))
|
||||
if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -675,7 +675,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
else
|
||||
{
|
||||
char specialChars[] = {'\t','\n',0};
|
||||
nsAutoString tabString = " ";
|
||||
nsAutoString tabString; tabString.AssignWithConversion(" ");
|
||||
while (unicodeBuf && (pos != -1) && (pos < outString->Length()))
|
||||
{
|
||||
PRInt32 oldPos = pos;
|
||||
@ -698,13 +698,13 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
|
||||
subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
|
||||
|
||||
// is it a tab?
|
||||
if (subStr.Equals("\t"))
|
||||
if (subStr.EqualsWithConversion("\t"))
|
||||
{
|
||||
res = mEditor->InsertTextImpl(tabString, &curNode, &curOffset, doc);
|
||||
pos++;
|
||||
}
|
||||
// is it a return?
|
||||
else if (subStr.Equals("\n"))
|
||||
else if (subStr.EqualsWithConversion("\n"))
|
||||
{
|
||||
res = mEditor->CreateBRImpl(&curNode, &curOffset, &unused, nsIEditor::eNone);
|
||||
pos++;
|
||||
@ -947,7 +947,7 @@ nsTextEditRules:: DidUndo(nsIDOMSelection *aSelection, nsresult aResult)
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!theBody) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tagName("div");
|
||||
nsAutoString tagName; tagName.AssignWithConversion("div");
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
res = theBody->GetElementsByTagName(tagName, getter_AddRefs(nodeList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
@ -996,7 +996,7 @@ nsTextEditRules::DidRedo(nsIDOMSelection *aSelection, nsresult aResult)
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!theBody) return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString tagName("div");
|
||||
nsAutoString tagName; tagName.AssignWithConversion("div");
|
||||
nsCOMPtr<nsIDOMNodeList> nodeList;
|
||||
res = theBody->GetElementsByTagName(tagName, getter_AddRefs(nodeList));
|
||||
if (NS_FAILED(res)) return res;
|
||||
@ -1032,7 +1032,7 @@ nsTextEditRules::WillOutputText(nsIDOMSelection *aSelection,
|
||||
*aCancel = PR_FALSE;
|
||||
*aHandled = PR_FALSE;
|
||||
|
||||
if (PR_TRUE == aOutputFormat->Equals("text/plain"))
|
||||
if (PR_TRUE == aOutputFormat->EqualsWithConversion("text/plain"))
|
||||
{ // only use these rules for plain text output
|
||||
if (mFlags & nsIHTMLEditor::eEditorPasswordMask)
|
||||
{
|
||||
@ -1041,7 +1041,7 @@ nsTextEditRules::WillOutputText(nsIDOMSelection *aSelection,
|
||||
}
|
||||
else if (mBogusNode)
|
||||
{ // this means there's no content, so output null string
|
||||
*aOutString = "";
|
||||
aOutString->SetLength(0);
|
||||
*aHandled = PR_TRUE;
|
||||
}
|
||||
}
|
||||
@ -1187,7 +1187,7 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection)
|
||||
if (needsBogusContent)
|
||||
{
|
||||
// set mBogusNode to be the newly created <br>
|
||||
res = mEditor->CreateNode(nsAutoString("br"), bodyNode, 0,
|
||||
res = mEditor->CreateNode(NS_ConvertASCIItoUCS2("br"), bodyNode, 0,
|
||||
getter_AddRefs(mBogusNode));
|
||||
if (NS_FAILED(res)) return res;
|
||||
if (!mBogusNode) return NS_ERROR_NULL_POINTER;
|
||||
@ -1197,9 +1197,10 @@ nsTextEditRules::CreateBogusNodeIfNeeded(nsIDOMSelection *aSelection)
|
||||
newPElement = do_QueryInterface(mBogusNode);
|
||||
if (newPElement)
|
||||
{
|
||||
nsAutoString att(nsEditor::kMOZEditorBogusNodeAttr);
|
||||
nsAutoString val(nsEditor::kMOZEditorBogusNodeValue);
|
||||
newPElement->SetAttribute(att, val);
|
||||
newPElement->SetAttribute(
|
||||
NS_ConvertASCIItoUCS2(nsEditor::kMOZEditorBogusNodeAttr),
|
||||
NS_ConvertASCIItoUCS2(nsEditor::kMOZEditorBogusNodeValue)
|
||||
);
|
||||
}
|
||||
|
||||
// set selection
|
||||
@ -1243,7 +1244,7 @@ nsTextEditRules::TruncateInsertionIfNeeded(nsIDOMSelection *aSelection,
|
||||
PRInt32 resultingDocLength = docLength - selectionLength;
|
||||
if (resultingDocLength >= aMaxLength)
|
||||
{
|
||||
*aOutString = "";
|
||||
aOutString->SetLength(0);
|
||||
return res;
|
||||
}
|
||||
else
|
||||
@ -1270,9 +1271,9 @@ nsTextEditRules::EchoInsertionToPWBuff(PRInt32 aStart, PRInt32 aEnd, nsString *a
|
||||
// change the output to '*' only
|
||||
PRInt32 length = aOutString->Length();
|
||||
PRInt32 i;
|
||||
*aOutString = "";
|
||||
aOutString->SetLength(0);
|
||||
for (i=0; i<length; i++)
|
||||
*aOutString += '*';
|
||||
aOutString->AppendWithConversion('*');
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -1293,7 +1294,7 @@ nsTextEditRules::CreateMozBR(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<ns
|
||||
nsCOMPtr<nsIDOMElement> brElem = do_QueryInterface(*outBRNode);
|
||||
if (brElem)
|
||||
{
|
||||
res = mEditor->SetAttribute(brElem, "type", "_moz");
|
||||
res = mEditor->SetAttribute(brElem, NS_ConvertASCIItoUCS2("type"), NS_ConvertASCIItoUCS2("_moz"));
|
||||
if (NS_FAILED(res)) return res;
|
||||
}
|
||||
return res;
|
||||
|
Loading…
Reference in New Issue
Block a user