fixing code that relied on implicit string construction; note that |NS_LITERAL_STRING| does not produce an |nsString|, it produces something that is a |nsAReadableString|. Many functions still take |nsString&| arguments, and so |NS_LITERAL_STRING| is not appropriate in calling them, yet.

This commit is contained in:
scc%mozilla.org 2000-08-20 00:34:08 +00:00
parent 48dcaa1bbd
commit 7a18ea22f2
12 changed files with 176 additions and 156 deletions

View File

@ -353,7 +353,7 @@ PRBool TypeInState::IsPropCleared(nsIAtom *aProp,
{
if (FindPropInList(aProp, aAttr, aValue, mClearedArray, outIndex))
return PR_TRUE;
if (FindPropInList(0, 0, 0, mClearedArray, outIndex))
if (FindPropInList(0, nsAutoString(), nsAutoString(), mClearedArray, outIndex))
{
// special case for all props cleared
outIndex = -1;

View File

@ -78,7 +78,7 @@ nsBaseComposerCommand::GetCommandNodeState(const PRUnichar *aCommand, nsIEditorS
GetInterfaceNode(aCommand, editorShell, getter_AddRefs(uiNode));
if (!uiNode) return NS_ERROR_FAILURE;
return uiNode->GetAttribute(NS_ConvertASCIItoUCS2("state").GetUnicode(), outNodeState);
return uiNode->GetAttribute(NS_ConvertASCIItoUCS2("state"), outNodeState);
}
@ -91,7 +91,7 @@ nsBaseComposerCommand::SetCommandNodeState(const PRUnichar *aCommand, nsIEditorS
GetInterfaceNode(aCommand, editorShell, getter_AddRefs(uiNode));
if (!uiNode) return NS_ERROR_FAILURE;
return uiNode->SetAttribute(NS_ConvertASCIItoUCS2("state").GetUnicode(), inNodeState);
return uiNode->SetAttribute(NS_ConvertASCIItoUCS2("state"), inNodeState);
}

View File

@ -1439,7 +1439,7 @@ nsEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
nsresult rv;
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIPresShell> presShell;
nsAutoString character_set = characterSet;
nsAutoString character_set(characterSet);
if (characterSet==nsnull) return NS_ERROR_NULL_POINTER;
@ -3866,7 +3866,7 @@ nsEditor::NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
element->GetTagName(tag);
const PRUnichar *unicodeString;
aTag->GetUnicode(&unicodeString);
if (tag.EqualsIgnoreCase(unicodeString))
if (tag.EqualsIgnoreCase(nsAutoString(unicodeString)))
{
return PR_TRUE;
}

View File

@ -790,7 +790,7 @@ nsEditorShell::SetEditorType(const PRUnichar *editorType)
if (mEditor)
return NS_ERROR_ALREADY_INITIALIZED;
nsAutoString theType = editorType;
nsAutoString theType(editorType);
theType.ToLowerCase();
PRBool textMail = theType.EqualsWithConversion("textmail");
@ -1331,7 +1331,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
{
//Load the editmode style sheet
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorContent.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
getter_AddRefs(mEditModeStyleSheet));
}
if (NS_FAILED(res)) return res;
@ -1355,7 +1355,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
else
{
// else load it
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorAllTags.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorAllTags.css"),
getter_AddRefs(mAllTagsModeStyleSheet));
}
if (NS_FAILED(res)) return res;
@ -1370,7 +1370,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
}
else
{
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorContent.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
getter_AddRefs(mEditModeStyleSheet));
}
}
@ -1431,7 +1431,7 @@ nsEditorShell::DisplayParagraphMarks(PRBool aShowMarks)
}
//First time used -- load the style sheet
nsCOMPtr<nsICSSStyleSheet> styleSheet;
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorParagraphMarks.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorParagraphMarks.css"),
getter_AddRefs(mParagraphMarksStyleSheet));
}
else if (mParagraphMarksStyleSheet)
@ -1586,7 +1586,8 @@ nsEditorShell::CheckOpenWindowForURLMatch(const PRUnichar* inFileURL, nsIDOMWind
// get an nsFileSpec from the URL
// This assumes inFileURL is "file://" format
nsFileURL fileURL(inFileURL);
nsAutoString fileURLString(inFileURL);
nsFileURL fileURL(fileURLString);
nsFileSpec fileSpec(fileURL);
nsCOMPtr<nsIDOMWindow> contentWindow;
@ -2175,7 +2176,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
{
// Didn't find one above: Create a new one
nsCOMPtr<nsIDOMElement>titleElement;
res = domDoc->CreateElement(NS_LITERAL_STRING("title"), getter_AddRefs(titleElement));
res = domDoc->CreateElement(NS_ConvertASCIItoUCS2("title"), getter_AddRefs(titleElement));
if (NS_SUCCEEDED(res) && titleElement)
{
titleNode = do_QueryInterface(titleElement);

View File

@ -464,7 +464,8 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
PRBool newMetaCharset = PR_TRUE;
// get a list of META tags
result = domdoc->GetElementsByTagName(NS_LITERAL_STRING("meta"), getter_AddRefs(metaList));
// can't use |NS_LITERAL_STRING| here until |GetElementsByTagName| is fixed to accept readables
result = domdoc->GetElementsByTagName(NS_ConvertASCIItoUCS2("meta"), getter_AddRefs(metaList));
if (NS_SUCCEEDED(result) && metaList) {
PRUint32 listLength = 0;
(void) metaList->GetLength(&listLength);
@ -478,17 +479,20 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
const NS_ConvertASCIItoUCS2 content("charset=");
nsString currentValue;
if (NS_FAILED(metaElement->GetAttribute(NS_LITERAL_STRING("http-equiv"), currentValue))) continue;
// can't use |NS_LITERAL_STRING| here until |GetAttribute| is fixed to accept readables
if (NS_FAILED(metaElement->GetAttribute(NS_ConvertASCIItoUCS2("http-equiv"), currentValue))) continue;
if (kNotFound != currentValue.Find("content-type", PR_TRUE)) {
if (NS_FAILED(metaElement->GetAttribute(NS_LITERAL_STRING("content"), currentValue))) continue;
if (NS_FAILED(metaElement->GetAttribute(NS_ConvertASCIItoUCS2("content"), currentValue))) continue;
// can't use |NS_LITERAL_STRING| here until |GetAttribute| is fixed to accept readables
PRInt32 offset = currentValue.Find(content.GetUnicode(), PR_TRUE);
if (kNotFound != offset) {
currentValue.Left(newMetaString, offset); // copy current value before "charset=" (e.g. text/html)
newMetaString.Append(content);
newMetaString.Append(characterSet);
result = nsEditor::SetAttribute(metaElement, NS_LITERAL_STRING("content"), newMetaString);
// can't use |NS_LITERAL_STRING| here until |SetAttributeSetAttribute| is fixed to accept readables
result = nsEditor::SetAttribute(metaElement, NS_ConvertASCIItoUCS2("content"), newMetaString);
if (NS_SUCCEEDED(result))
newMetaCharset = PR_FALSE;
break;
@ -502,12 +506,14 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
nsCOMPtr<nsIDOMNode>headNode;
nsCOMPtr<nsIDOMNode>resultNode;
result = domdoc->GetElementsByTagName(NS_LITERAL_STRING("head"),getter_AddRefs(headList));
// can't use |NS_LITERAL_STRING| here until |GetElementsByTagName| is fixed to accept readables
result = domdoc->GetElementsByTagName(NS_ConvertASCIItoUCS2("head"),getter_AddRefs(headList));
if (NS_SUCCEEDED(result) && headList) {
headList->Item(0, getter_AddRefs(headNode));
if (headNode) {
// Create a new meta charset tag
result = CreateNode(NS_LITERAL_STRING("meta"), headNode, 0, getter_AddRefs(resultNode));
// can't use |NS_LITERAL_STRING| here until |CreateNode| is fixed to accept readables
result = CreateNode(NS_ConvertASCIItoUCS2("meta"), headNode, 0, getter_AddRefs(resultNode));
if (NS_FAILED(result))
return NS_ERROR_FAILURE;
@ -516,12 +522,14 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
metaElement = do_QueryInterface(resultNode);
if (metaElement) {
// not undoable, undo should undo CreateNode
result = metaElement->SetAttribute(NS_LITERAL_STRING("http-equiv"), NS_LITERAL_STRING("Content-Type"));
// can't use |NS_LITERAL_STRING| here until |SetAttribute| is fixed to accept readables
result = metaElement->SetAttribute(NS_ConvertASCIItoUCS2("http-equiv"), NS_ConvertASCIItoUCS2("Content-Type"));
if (NS_SUCCEEDED(result)) {
newMetaString.AssignWithConversion("text/html;charset=");
newMetaString.Append(characterSet);
// not undoable, undo should undo CreateNode
result = metaElement->SetAttribute(NS_LITERAL_STRING("content"), newMetaString);
// can't use |NS_LITERAL_STRING| here until |SetAttribute| is fixed to accept readables
result = metaElement->SetAttribute(NS_ConvertASCIItoUCS2("content"), newMetaString);
}
}
}
@ -811,7 +819,8 @@ NS_IMETHODIMP nsHTMLEditor::TabInTable(PRBool inIsShift, PRBool *outHandled)
// Find enclosing table cell from the selection (cell may be the selected element)
nsCOMPtr<nsIDOMElement> cellElement;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nsnull, getter_AddRefs(cellElement));
// can't use |NS_LITERAL_STRING| here until |GetElementOrParentByTagName| is fixed to accept readables
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cellElement));
if (NS_FAILED(res)) return res;
// Do nothing -- we didn't find a table cell
if (!cellElement) return NS_OK;
@ -2573,7 +2582,7 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsString& aSourceString)
// Parse the string to rebuild the document
// Last 2 params: enableVerify and "this is the last chunk to parse"
return theParser->Parse(sourceString, (void*)document.get(), NS_LITERAL_STRING("text/html"), PR_TRUE, PR_TRUE);
return theParser->Parse(sourceString, (void*)document.get(), NS_ConvertASCIItoUCS2("text/html"), PR_TRUE, PR_TRUE);
}
NS_IMETHODIMP nsHTMLEditor::InsertBreak()
@ -2928,7 +2937,7 @@ nsHTMLEditor::GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists)
if (aGetLists)
{
// Get the "ol", "ul", or "dl" parent element
res = GetElementOrParentByTagName(NS_LITERAL_STRING("list"), node, getter_AddRefs(blockParentElem));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("list"), node, getter_AddRefs(blockParentElem));
if (NS_FAILED(res)) return res;
}
else
@ -2982,7 +2991,7 @@ nsHTMLEditor::GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists)
if (aGetLists)
{
// Get the "ol", "ul", or "dl" parent element
res = GetElementOrParentByTagName(NS_LITERAL_STRING("list"), startParent, getter_AddRefs(blockParent));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("list"), startParent, getter_AddRefs(blockParent));
}
else
{
@ -3465,7 +3474,7 @@ nsHTMLEditor::GetElementOrParentByTagName(const nsString &aTagName, nsIDOMNode *
currentNode = anchorNode;
}
nsAutoString TagName = aTagName;
nsAutoString TagName(aTagName);
TagName.ToLowerCase();
PRBool getLink = IsLink(TagName);
PRBool getNamedAnchor = IsNamedAnchor(TagName);
@ -3569,7 +3578,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
selection->GetIsCollapsed(&isCollapsed);
nsAutoString domTagName;
nsAutoString TagName = aTagName;
nsAutoString TagName(aTagName);
TagName.ToLowerCase();
// Empty string indicates we should match any element tag
PRBool anyTag = (TagName.IsEmpty());
@ -3653,7 +3662,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
}
#endif
nsCOMPtr<nsIDOMElement> parentLinkOfAnchor;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), anchorNode, getter_AddRefs(parentLinkOfAnchor));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("href"), anchorNode, getter_AddRefs(parentLinkOfAnchor));
// XXX: ERROR_HANDLING can parentLinkOfAnchor be null?
if (NS_SUCCEEDED(res) && parentLinkOfAnchor)
{
@ -3664,7 +3673,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
} else if(focusNode)
{ // Link node must be the same for both ends of selection
nsCOMPtr<nsIDOMElement> parentLinkOfFocus;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), focusNode, getter_AddRefs(parentLinkOfFocus));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("href"), focusNode, getter_AddRefs(parentLinkOfFocus));
if (NS_SUCCEEDED(res) && parentLinkOfFocus == parentLinkOfAnchor)
bNodeFound = PR_TRUE;
}
@ -3802,7 +3811,7 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
if (aTagName.IsEmpty() || !aReturn)
return NS_ERROR_NULL_POINTER;
nsAutoString TagName = aTagName;
nsAutoString TagName(aTagName);
TagName.ToLowerCase();
nsAutoString realTagName;
@ -3827,26 +3836,26 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
return NS_ERROR_FAILURE;
// Mark the new element dirty, so it will be formatted
newElement->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), nsAutoString());
newElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_dirty"), nsAutoString());
// Set default values for new elements
if (TagName.EqualsWithConversion("hr"))
{
// Note that we read the user's attributes for these from prefs (in InsertHLine JS)
newElement->SetAttribute(NS_LITERAL_STRING("align"),NS_LITERAL_STRING("center"));
newElement->SetAttribute(NS_LITERAL_STRING("width"),NS_LITERAL_STRING("100%"));
newElement->SetAttribute(NS_LITERAL_STRING("size"),NS_LITERAL_STRING("2"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("align"),NS_ConvertASCIItoUCS2("center"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("width"),NS_ConvertASCIItoUCS2("100%"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("size"),NS_ConvertASCIItoUCS2("2"));
} else if (TagName.EqualsWithConversion("table"))
{
newElement->SetAttribute(NS_LITERAL_STRING("cellpadding"),NS_LITERAL_STRING("2"));
newElement->SetAttribute(NS_LITERAL_STRING("cellspacing"),NS_LITERAL_STRING("2"));
newElement->SetAttribute(NS_LITERAL_STRING("border"),NS_LITERAL_STRING("1"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("cellpadding"),NS_ConvertASCIItoUCS2("2"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("cellspacing"),NS_ConvertASCIItoUCS2("2"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("border"),NS_ConvertASCIItoUCS2("1"));
} else if (TagName.EqualsWithConversion("tr"))
{
newElement->SetAttribute(NS_LITERAL_STRING("valign"),NS_LITERAL_STRING("top"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("valign"),NS_ConvertASCIItoUCS2("top"));
} else if (TagName.EqualsWithConversion("td"))
{
newElement->SetAttribute(NS_LITERAL_STRING("valign"),NS_LITERAL_STRING("top"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("valign"),NS_ConvertASCIItoUCS2("top"));
}
// ADD OTHER TAGS HERE
@ -3935,9 +3944,9 @@ nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
while(cell)
{
if (setColor)
res = SetAttribute(cell, NS_LITERAL_STRING("bgcolor"), aColor);
res = SetAttribute(cell, NS_ConvertASCIItoUCS2("bgcolor"), aColor);
else
res = RemoveAttribute(cell, NS_LITERAL_STRING("bgcolor"));
res = RemoveAttribute(cell, NS_ConvertASCIItoUCS2("bgcolor"));
if (NS_FAILED(res)) break;
GetNextSelectedCell(getter_AddRefs(cell), nsnull);
@ -3954,9 +3963,9 @@ nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
}
// Use the editor method that goes through the transaction system
if (setColor)
res = SetAttribute(element, NS_LITERAL_STRING("bgcolor"), aColor);
res = SetAttribute(element, NS_ConvertASCIItoUCS2("bgcolor"), aColor);
else
res = RemoveAttribute(element, NS_LITERAL_STRING("bgcolor"));
res = RemoveAttribute(element, NS_ConvertASCIItoUCS2("bgcolor"));
return res;
}
@ -5261,11 +5270,11 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsString& aQuotedText,
nsCOMPtr<nsIDOMElement> preElement (do_QueryInterface(preNode));
if (preElement)
{
preElement->SetAttribute(NS_LITERAL_STRING("_moz_quote"),
NS_LITERAL_STRING("true"));
preElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_quote"),
NS_ConvertASCIItoUCS2("true"));
// set style to not have unwanted vertical margins
preElement->SetAttribute(NS_LITERAL_STRING("style"),
NS_LITERAL_STRING("margin: 0 0 0 0px;"));
preElement->SetAttribute(NS_ConvertASCIItoUCS2("style"),
NS_ConvertASCIItoUCS2("margin: 0 0 0 0px;"));
}
// and set the selection inside it:
@ -5420,7 +5429,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToString(nsString& aOutputString,
nsresult rv = NS_OK;
nsCOMPtr<nsIDocumentEncoder> encoder;
nsCAutoString formatType = NS_DOC_ENCODER_PROGID_BASE;
nsCAutoString formatType(NS_DOC_ENCODER_PROGID_BASE);
formatType.AppendWithConversion(aFormatType);
rv = nsComponentManager::CreateInstance(formatType,
nsnull,
@ -5715,7 +5724,7 @@ nsHTMLEditor::GetHeadContentsAsHTML(nsString& aOutputString)
res = SetSelectionAroundHeadChildren(selection, mDocWeak);
if (NS_FAILED(res)) return res;
res = OutputToString(aOutputString, NS_LITERAL_STRING("text/html"),
res = OutputToString(aOutputString, NS_ConvertASCIItoUCS2("text/html"),
nsIDocumentEncoder::OutputSelectionOnly);
if (NS_SUCCEEDED(res))
{
@ -6649,7 +6658,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
if (aSizeChange==1) atom = nsIEditProperty::big;
else atom = nsIEditProperty::small;
// manipulating text attributes on a collapsed selection only sets state for the next text insertion
return mTypeInState->SetProp(atom, nsnull, nsnull);
return mTypeInState->SetProp(atom, nsAutoString(), nsAutoString());
}
// wrap with txn batching, rules sniffing, and selection preservation code
@ -6827,7 +6836,7 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
}
// reparent the node inside font node with appropriate relative size
res = InsertContainerAbove(node, &tmp, aSizeChange==1 ? NS_LITERAL_STRING("big") : NS_LITERAL_STRING("small"));
res = InsertContainerAbove(node, &tmp, NS_ConvertASCIItoUCS2(aSizeChange==1 ? "big" : "small"));
return res;
}

View File

@ -121,9 +121,9 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
nsCOMPtr<nsIDOMElement> newCell;
if (aIsHeader)
res = CreateElementWithDefaults(NS_LITERAL_STRING("th"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("th"), getter_AddRefs(newCell));
else
res = CreateElementWithDefaults(NS_LITERAL_STRING("td"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
if(NS_FAILED(res)) return res;
if(!newCell) return NS_ERROR_FAILURE;
@ -140,14 +140,14 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
// Note: Do NOT use editor transaction for this
nsAutoString newRowSpan;
newRowSpan.AppendInt(aRowSpan, 10);
newCell->SetAttribute(NS_LITERAL_STRING("rowspan"), newRowSpan);
newCell->SetAttribute(NS_ConvertASCIItoUCS2("rowspan"), newRowSpan);
}
if( aColSpan > 1)
{
// Note: Do NOT use editor transaction for this
nsAutoString newColSpan;
newColSpan.AppendInt(aColSpan, 10);
newCell->SetAttribute(NS_LITERAL_STRING("colspan"), newColSpan);
newCell->SetAttribute(NS_ConvertASCIItoUCS2("colspan"), newColSpan);
}
if(aAfter) cellOffset++;
@ -226,7 +226,7 @@ nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
for (i = 0; i < aNumber; i++)
{
nsCOMPtr<nsIDOMElement> newCell;
res = CreateElementWithDefaults(NS_LITERAL_STRING("td"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
if (NS_SUCCEEDED(res) && newCell)
{
if (aAfter) cellOffset++;
@ -243,7 +243,7 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
aRow = nsnull;
nsCOMPtr<nsIDOMElement> tableElement;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -308,7 +308,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
aRow = nsnull;
nsCOMPtr<nsIDOMElement> rowElement;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -507,7 +507,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
if (!curCell) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -607,7 +607,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
{
// Create a new row
nsCOMPtr<nsIDOMElement> newRow;
res = CreateElementWithDefaults(NS_LITERAL_STRING("tr"), getter_AddRefs(newRow));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("tr"), getter_AddRefs(newRow));
if (NS_SUCCEEDED(res))
{
if (!newRow) return NS_ERROR_FAILURE;
@ -615,7 +615,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
for (PRInt32 i = 0; i < cellsInRow; i++)
{
nsCOMPtr<nsIDOMElement> newCell;
res = CreateElementWithDefaults(NS_LITERAL_STRING("td"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
if (NS_FAILED(res)) return res;
if (!newCell) return NS_ERROR_FAILURE;
@ -825,7 +825,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
if (1 == GetNumberOfCellsInRow(table, startRowIndex))
{
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1073,7 +1073,7 @@ nsHTMLEditor::DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex)
{
// Only 1 cell in row - delete the row
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1295,7 +1295,7 @@ nsHTMLEditor::DeleteRow(nsIDOMElement *aTable, PRInt32 aRowIndex)
// Delete the entire row
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("tr"), cellInDeleteRow, getter_AddRefs(parentRow));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cellInDeleteRow, getter_AddRefs(parentRow));
if (NS_FAILED(res)) return res;
if (parentRow)
@ -1331,7 +1331,7 @@ nsHTMLEditor::SelectTable()
{
nsCOMPtr<nsIDOMElement> table;
nsresult res = NS_ERROR_FAILURE;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1350,7 +1350,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectTableCell()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1376,12 +1376,12 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
if (!selection) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> table;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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(NS_LITERAL_STRING("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;
@ -1458,7 +1458,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectAllTableCells()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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
@ -1470,7 +1470,7 @@ nsHTMLEditor::SelectAllTableCells()
// Get parent table
nsCOMPtr<nsIDOMElement> table;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), cell, getter_AddRefs(table));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
if(!table) return NS_ERROR_NULL_POINTER;
@ -1526,7 +1526,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectTableRow()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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
@ -1597,7 +1597,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectTableColumn()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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
@ -1855,7 +1855,7 @@ nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElemen
// Set to the opposite of current type
nsAutoString tagName;
GetTagString(aSourceCell, tagName);
nsString newCellType = (tagName == NS_LITERAL_STRING("td")) ? NS_LITERAL_STRING("th") : NS_LITERAL_STRING("td");
nsString newCellType( (tagName == NS_LITERAL_STRING("td")) ? NS_LITERAL_STRING("th") : NS_LITERAL_STRING("td") );
// Save current selection to restore when done
// This is needed so ReplaceContainer can monitor selection
@ -2391,7 +2391,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
if (!selection) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> table;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -2481,7 +2481,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, PRInt32 &aRowIndex, PRInt32 &
{
// Get the selected cell or the cell enclosing the selection anchor
nsCOMPtr<nsIDOMElement> cell;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nsnull, getter_AddRefs(cell));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
if (NS_SUCCEEDED(res) && cell)
aCell = cell;
else
@ -2558,7 +2558,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(NS_LITERAL_STRING("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;
@ -2593,7 +2593,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(NS_LITERAL_STRING("table"), nsnull, getter_AddRefs(table));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), nsnull, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
if (table)
aTable = table;
@ -2711,7 +2711,7 @@ nsHTMLEditor::GetCellContext(nsIDOMSelection **aSelection,
}
// Get containing table
res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), cell, getter_AddRefs(table));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
// Cell must be in a table, so fail if not found
if (!table) return NS_ERROR_FAILURE;
@ -3167,7 +3167,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
// (if aElement is null, this uses selection's anchor node)
nsCOMPtr<nsIDOMElement> table;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), aElement, getter_AddRefs(table));
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aElement, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
PRInt32 rowCount, colCount;

View File

@ -78,7 +78,7 @@ nsBaseComposerCommand::GetCommandNodeState(const PRUnichar *aCommand, nsIEditorS
GetInterfaceNode(aCommand, editorShell, getter_AddRefs(uiNode));
if (!uiNode) return NS_ERROR_FAILURE;
return uiNode->GetAttribute(NS_ConvertASCIItoUCS2("state").GetUnicode(), outNodeState);
return uiNode->GetAttribute(NS_ConvertASCIItoUCS2("state"), outNodeState);
}
@ -91,7 +91,7 @@ nsBaseComposerCommand::SetCommandNodeState(const PRUnichar *aCommand, nsIEditorS
GetInterfaceNode(aCommand, editorShell, getter_AddRefs(uiNode));
if (!uiNode) return NS_ERROR_FAILURE;
return uiNode->SetAttribute(NS_ConvertASCIItoUCS2("state").GetUnicode(), inNodeState);
return uiNode->SetAttribute(NS_ConvertASCIItoUCS2("state"), inNodeState);
}

View File

@ -790,7 +790,7 @@ nsEditorShell::SetEditorType(const PRUnichar *editorType)
if (mEditor)
return NS_ERROR_ALREADY_INITIALIZED;
nsAutoString theType = editorType;
nsAutoString theType(editorType);
theType.ToLowerCase();
PRBool textMail = theType.EqualsWithConversion("textmail");
@ -1331,7 +1331,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
{
//Load the editmode style sheet
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorContent.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
getter_AddRefs(mEditModeStyleSheet));
}
if (NS_FAILED(res)) return res;
@ -1355,7 +1355,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
else
{
// else load it
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorAllTags.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorAllTags.css"),
getter_AddRefs(mAllTagsModeStyleSheet));
}
if (NS_FAILED(res)) return res;
@ -1370,7 +1370,7 @@ nsEditorShell::SetDisplayMode(PRInt32 aDisplayMode)
}
else
{
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorContent.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorContent.css"),
getter_AddRefs(mEditModeStyleSheet));
}
}
@ -1431,7 +1431,7 @@ nsEditorShell::DisplayParagraphMarks(PRBool aShowMarks)
}
//First time used -- load the style sheet
nsCOMPtr<nsICSSStyleSheet> styleSheet;
res = styleSheets->ApplyOverrideStyleSheet(NS_LITERAL_STRING("chrome://editor/content/EditorParagraphMarks.css"),
res = styleSheets->ApplyOverrideStyleSheet(NS_ConvertASCIItoUCS2("chrome://editor/content/EditorParagraphMarks.css"),
getter_AddRefs(mParagraphMarksStyleSheet));
}
else if (mParagraphMarksStyleSheet)
@ -1586,7 +1586,8 @@ nsEditorShell::CheckOpenWindowForURLMatch(const PRUnichar* inFileURL, nsIDOMWind
// get an nsFileSpec from the URL
// This assumes inFileURL is "file://" format
nsFileURL fileURL(inFileURL);
nsAutoString fileURLString(inFileURL);
nsFileURL fileURL(fileURLString);
nsFileSpec fileSpec(fileURL);
nsCOMPtr<nsIDOMWindow> contentWindow;
@ -2175,7 +2176,7 @@ nsEditorShell::SetDocumentTitle(const PRUnichar *title)
{
// Didn't find one above: Create a new one
nsCOMPtr<nsIDOMElement>titleElement;
res = domDoc->CreateElement(NS_LITERAL_STRING("title"), getter_AddRefs(titleElement));
res = domDoc->CreateElement(NS_ConvertASCIItoUCS2("title"), getter_AddRefs(titleElement));
if (NS_SUCCEEDED(res) && titleElement)
{
titleNode = do_QueryInterface(titleElement);

View File

@ -1439,7 +1439,7 @@ nsEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
nsresult rv;
nsCOMPtr<nsIDocument> doc;
nsCOMPtr<nsIPresShell> presShell;
nsAutoString character_set = characterSet;
nsAutoString character_set(characterSet);
if (characterSet==nsnull) return NS_ERROR_NULL_POINTER;
@ -3866,7 +3866,7 @@ nsEditor::NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
element->GetTagName(tag);
const PRUnichar *unicodeString;
aTag->GetUnicode(&unicodeString);
if (tag.EqualsIgnoreCase(unicodeString))
if (tag.EqualsIgnoreCase(nsAutoString(unicodeString)))
{
return PR_TRUE;
}

View File

@ -353,7 +353,7 @@ PRBool TypeInState::IsPropCleared(nsIAtom *aProp,
{
if (FindPropInList(aProp, aAttr, aValue, mClearedArray, outIndex))
return PR_TRUE;
if (FindPropInList(0, 0, 0, mClearedArray, outIndex))
if (FindPropInList(0, nsAutoString(), nsAutoString(), mClearedArray, outIndex))
{
// special case for all props cleared
outIndex = -1;

View File

@ -464,7 +464,8 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
PRBool newMetaCharset = PR_TRUE;
// get a list of META tags
result = domdoc->GetElementsByTagName(NS_LITERAL_STRING("meta"), getter_AddRefs(metaList));
// can't use |NS_LITERAL_STRING| here until |GetElementsByTagName| is fixed to accept readables
result = domdoc->GetElementsByTagName(NS_ConvertASCIItoUCS2("meta"), getter_AddRefs(metaList));
if (NS_SUCCEEDED(result) && metaList) {
PRUint32 listLength = 0;
(void) metaList->GetLength(&listLength);
@ -478,17 +479,20 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
const NS_ConvertASCIItoUCS2 content("charset=");
nsString currentValue;
if (NS_FAILED(metaElement->GetAttribute(NS_LITERAL_STRING("http-equiv"), currentValue))) continue;
// can't use |NS_LITERAL_STRING| here until |GetAttribute| is fixed to accept readables
if (NS_FAILED(metaElement->GetAttribute(NS_ConvertASCIItoUCS2("http-equiv"), currentValue))) continue;
if (kNotFound != currentValue.Find("content-type", PR_TRUE)) {
if (NS_FAILED(metaElement->GetAttribute(NS_LITERAL_STRING("content"), currentValue))) continue;
if (NS_FAILED(metaElement->GetAttribute(NS_ConvertASCIItoUCS2("content"), currentValue))) continue;
// can't use |NS_LITERAL_STRING| here until |GetAttribute| is fixed to accept readables
PRInt32 offset = currentValue.Find(content.GetUnicode(), PR_TRUE);
if (kNotFound != offset) {
currentValue.Left(newMetaString, offset); // copy current value before "charset=" (e.g. text/html)
newMetaString.Append(content);
newMetaString.Append(characterSet);
result = nsEditor::SetAttribute(metaElement, NS_LITERAL_STRING("content"), newMetaString);
// can't use |NS_LITERAL_STRING| here until |SetAttributeSetAttribute| is fixed to accept readables
result = nsEditor::SetAttribute(metaElement, NS_ConvertASCIItoUCS2("content"), newMetaString);
if (NS_SUCCEEDED(result))
newMetaCharset = PR_FALSE;
break;
@ -502,12 +506,14 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
nsCOMPtr<nsIDOMNode>headNode;
nsCOMPtr<nsIDOMNode>resultNode;
result = domdoc->GetElementsByTagName(NS_LITERAL_STRING("head"),getter_AddRefs(headList));
// can't use |NS_LITERAL_STRING| here until |GetElementsByTagName| is fixed to accept readables
result = domdoc->GetElementsByTagName(NS_ConvertASCIItoUCS2("head"),getter_AddRefs(headList));
if (NS_SUCCEEDED(result) && headList) {
headList->Item(0, getter_AddRefs(headNode));
if (headNode) {
// Create a new meta charset tag
result = CreateNode(NS_LITERAL_STRING("meta"), headNode, 0, getter_AddRefs(resultNode));
// can't use |NS_LITERAL_STRING| here until |CreateNode| is fixed to accept readables
result = CreateNode(NS_ConvertASCIItoUCS2("meta"), headNode, 0, getter_AddRefs(resultNode));
if (NS_FAILED(result))
return NS_ERROR_FAILURE;
@ -516,12 +522,14 @@ nsHTMLEditor::SetDocumentCharacterSet(const PRUnichar* characterSet)
metaElement = do_QueryInterface(resultNode);
if (metaElement) {
// not undoable, undo should undo CreateNode
result = metaElement->SetAttribute(NS_LITERAL_STRING("http-equiv"), NS_LITERAL_STRING("Content-Type"));
// can't use |NS_LITERAL_STRING| here until |SetAttribute| is fixed to accept readables
result = metaElement->SetAttribute(NS_ConvertASCIItoUCS2("http-equiv"), NS_ConvertASCIItoUCS2("Content-Type"));
if (NS_SUCCEEDED(result)) {
newMetaString.AssignWithConversion("text/html;charset=");
newMetaString.Append(characterSet);
// not undoable, undo should undo CreateNode
result = metaElement->SetAttribute(NS_LITERAL_STRING("content"), newMetaString);
// can't use |NS_LITERAL_STRING| here until |SetAttribute| is fixed to accept readables
result = metaElement->SetAttribute(NS_ConvertASCIItoUCS2("content"), newMetaString);
}
}
}
@ -811,7 +819,8 @@ NS_IMETHODIMP nsHTMLEditor::TabInTable(PRBool inIsShift, PRBool *outHandled)
// Find enclosing table cell from the selection (cell may be the selected element)
nsCOMPtr<nsIDOMElement> cellElement;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nsnull, getter_AddRefs(cellElement));
// can't use |NS_LITERAL_STRING| here until |GetElementOrParentByTagName| is fixed to accept readables
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cellElement));
if (NS_FAILED(res)) return res;
// Do nothing -- we didn't find a table cell
if (!cellElement) return NS_OK;
@ -2573,7 +2582,7 @@ nsHTMLEditor::RebuildDocumentFromSource(const nsString& aSourceString)
// Parse the string to rebuild the document
// Last 2 params: enableVerify and "this is the last chunk to parse"
return theParser->Parse(sourceString, (void*)document.get(), NS_LITERAL_STRING("text/html"), PR_TRUE, PR_TRUE);
return theParser->Parse(sourceString, (void*)document.get(), NS_ConvertASCIItoUCS2("text/html"), PR_TRUE, PR_TRUE);
}
NS_IMETHODIMP nsHTMLEditor::InsertBreak()
@ -2928,7 +2937,7 @@ nsHTMLEditor::GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists)
if (aGetLists)
{
// Get the "ol", "ul", or "dl" parent element
res = GetElementOrParentByTagName(NS_LITERAL_STRING("list"), node, getter_AddRefs(blockParentElem));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("list"), node, getter_AddRefs(blockParentElem));
if (NS_FAILED(res)) return res;
}
else
@ -2982,7 +2991,7 @@ nsHTMLEditor::GetParentBlockTags(nsStringArray *aTagList, PRBool aGetLists)
if (aGetLists)
{
// Get the "ol", "ul", or "dl" parent element
res = GetElementOrParentByTagName(NS_LITERAL_STRING("list"), startParent, getter_AddRefs(blockParent));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("list"), startParent, getter_AddRefs(blockParent));
}
else
{
@ -3465,7 +3474,7 @@ nsHTMLEditor::GetElementOrParentByTagName(const nsString &aTagName, nsIDOMNode *
currentNode = anchorNode;
}
nsAutoString TagName = aTagName;
nsAutoString TagName(aTagName);
TagName.ToLowerCase();
PRBool getLink = IsLink(TagName);
PRBool getNamedAnchor = IsNamedAnchor(TagName);
@ -3569,7 +3578,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
selection->GetIsCollapsed(&isCollapsed);
nsAutoString domTagName;
nsAutoString TagName = aTagName;
nsAutoString TagName(aTagName);
TagName.ToLowerCase();
// Empty string indicates we should match any element tag
PRBool anyTag = (TagName.IsEmpty());
@ -3653,7 +3662,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
}
#endif
nsCOMPtr<nsIDOMElement> parentLinkOfAnchor;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), anchorNode, getter_AddRefs(parentLinkOfAnchor));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("href"), anchorNode, getter_AddRefs(parentLinkOfAnchor));
// XXX: ERROR_HANDLING can parentLinkOfAnchor be null?
if (NS_SUCCEEDED(res) && parentLinkOfAnchor)
{
@ -3664,7 +3673,7 @@ nsHTMLEditor::GetSelectedElement(const nsString& aTagName, nsIDOMElement** aRetu
} else if(focusNode)
{ // Link node must be the same for both ends of selection
nsCOMPtr<nsIDOMElement> parentLinkOfFocus;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), focusNode, getter_AddRefs(parentLinkOfFocus));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("href"), focusNode, getter_AddRefs(parentLinkOfFocus));
if (NS_SUCCEEDED(res) && parentLinkOfFocus == parentLinkOfAnchor)
bNodeFound = PR_TRUE;
}
@ -3802,7 +3811,7 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
if (aTagName.IsEmpty() || !aReturn)
return NS_ERROR_NULL_POINTER;
nsAutoString TagName = aTagName;
nsAutoString TagName(aTagName);
TagName.ToLowerCase();
nsAutoString realTagName;
@ -3827,26 +3836,26 @@ nsHTMLEditor::CreateElementWithDefaults(const nsString& aTagName, nsIDOMElement*
return NS_ERROR_FAILURE;
// Mark the new element dirty, so it will be formatted
newElement->SetAttribute(NS_LITERAL_STRING("_moz_dirty"), nsAutoString());
newElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_dirty"), nsAutoString());
// Set default values for new elements
if (TagName.EqualsWithConversion("hr"))
{
// Note that we read the user's attributes for these from prefs (in InsertHLine JS)
newElement->SetAttribute(NS_LITERAL_STRING("align"),NS_LITERAL_STRING("center"));
newElement->SetAttribute(NS_LITERAL_STRING("width"),NS_LITERAL_STRING("100%"));
newElement->SetAttribute(NS_LITERAL_STRING("size"),NS_LITERAL_STRING("2"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("align"),NS_ConvertASCIItoUCS2("center"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("width"),NS_ConvertASCIItoUCS2("100%"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("size"),NS_ConvertASCIItoUCS2("2"));
} else if (TagName.EqualsWithConversion("table"))
{
newElement->SetAttribute(NS_LITERAL_STRING("cellpadding"),NS_LITERAL_STRING("2"));
newElement->SetAttribute(NS_LITERAL_STRING("cellspacing"),NS_LITERAL_STRING("2"));
newElement->SetAttribute(NS_LITERAL_STRING("border"),NS_LITERAL_STRING("1"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("cellpadding"),NS_ConvertASCIItoUCS2("2"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("cellspacing"),NS_ConvertASCIItoUCS2("2"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("border"),NS_ConvertASCIItoUCS2("1"));
} else if (TagName.EqualsWithConversion("tr"))
{
newElement->SetAttribute(NS_LITERAL_STRING("valign"),NS_LITERAL_STRING("top"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("valign"),NS_ConvertASCIItoUCS2("top"));
} else if (TagName.EqualsWithConversion("td"))
{
newElement->SetAttribute(NS_LITERAL_STRING("valign"),NS_LITERAL_STRING("top"));
newElement->SetAttribute(NS_ConvertASCIItoUCS2("valign"),NS_ConvertASCIItoUCS2("top"));
}
// ADD OTHER TAGS HERE
@ -3935,9 +3944,9 @@ nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
while(cell)
{
if (setColor)
res = SetAttribute(cell, NS_LITERAL_STRING("bgcolor"), aColor);
res = SetAttribute(cell, NS_ConvertASCIItoUCS2("bgcolor"), aColor);
else
res = RemoveAttribute(cell, NS_LITERAL_STRING("bgcolor"));
res = RemoveAttribute(cell, NS_ConvertASCIItoUCS2("bgcolor"));
if (NS_FAILED(res)) break;
GetNextSelectedCell(getter_AddRefs(cell), nsnull);
@ -3954,9 +3963,9 @@ nsHTMLEditor::SetBackgroundColor(const nsString& aColor)
}
// Use the editor method that goes through the transaction system
if (setColor)
res = SetAttribute(element, NS_LITERAL_STRING("bgcolor"), aColor);
res = SetAttribute(element, NS_ConvertASCIItoUCS2("bgcolor"), aColor);
else
res = RemoveAttribute(element, NS_LITERAL_STRING("bgcolor"));
res = RemoveAttribute(element, NS_ConvertASCIItoUCS2("bgcolor"));
return res;
}
@ -5261,11 +5270,11 @@ nsHTMLEditor::InsertAsPlaintextQuotation(const nsString& aQuotedText,
nsCOMPtr<nsIDOMElement> preElement (do_QueryInterface(preNode));
if (preElement)
{
preElement->SetAttribute(NS_LITERAL_STRING("_moz_quote"),
NS_LITERAL_STRING("true"));
preElement->SetAttribute(NS_ConvertASCIItoUCS2("_moz_quote"),
NS_ConvertASCIItoUCS2("true"));
// set style to not have unwanted vertical margins
preElement->SetAttribute(NS_LITERAL_STRING("style"),
NS_LITERAL_STRING("margin: 0 0 0 0px;"));
preElement->SetAttribute(NS_ConvertASCIItoUCS2("style"),
NS_ConvertASCIItoUCS2("margin: 0 0 0 0px;"));
}
// and set the selection inside it:
@ -5420,7 +5429,7 @@ NS_IMETHODIMP nsHTMLEditor::OutputToString(nsString& aOutputString,
nsresult rv = NS_OK;
nsCOMPtr<nsIDocumentEncoder> encoder;
nsCAutoString formatType = NS_DOC_ENCODER_PROGID_BASE;
nsCAutoString formatType(NS_DOC_ENCODER_PROGID_BASE);
formatType.AppendWithConversion(aFormatType);
rv = nsComponentManager::CreateInstance(formatType,
nsnull,
@ -5715,7 +5724,7 @@ nsHTMLEditor::GetHeadContentsAsHTML(nsString& aOutputString)
res = SetSelectionAroundHeadChildren(selection, mDocWeak);
if (NS_FAILED(res)) return res;
res = OutputToString(aOutputString, NS_LITERAL_STRING("text/html"),
res = OutputToString(aOutputString, NS_ConvertASCIItoUCS2("text/html"),
nsIDocumentEncoder::OutputSelectionOnly);
if (NS_SUCCEEDED(res))
{
@ -6649,7 +6658,7 @@ nsHTMLEditor::RelativeFontChange( PRInt32 aSizeChange)
if (aSizeChange==1) atom = nsIEditProperty::big;
else atom = nsIEditProperty::small;
// manipulating text attributes on a collapsed selection only sets state for the next text insertion
return mTypeInState->SetProp(atom, nsnull, nsnull);
return mTypeInState->SetProp(atom, nsAutoString(), nsAutoString());
}
// wrap with txn batching, rules sniffing, and selection preservation code
@ -6827,7 +6836,7 @@ nsHTMLEditor::RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
}
// reparent the node inside font node with appropriate relative size
res = InsertContainerAbove(node, &tmp, aSizeChange==1 ? NS_LITERAL_STRING("big") : NS_LITERAL_STRING("small"));
res = InsertContainerAbove(node, &tmp, NS_ConvertASCIItoUCS2(aSizeChange==1 ? "big" : "small"));
return res;
}

View File

@ -121,9 +121,9 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
nsCOMPtr<nsIDOMElement> newCell;
if (aIsHeader)
res = CreateElementWithDefaults(NS_LITERAL_STRING("th"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("th"), getter_AddRefs(newCell));
else
res = CreateElementWithDefaults(NS_LITERAL_STRING("td"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
if(NS_FAILED(res)) return res;
if(!newCell) return NS_ERROR_FAILURE;
@ -140,14 +140,14 @@ nsHTMLEditor::InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpa
// Note: Do NOT use editor transaction for this
nsAutoString newRowSpan;
newRowSpan.AppendInt(aRowSpan, 10);
newCell->SetAttribute(NS_LITERAL_STRING("rowspan"), newRowSpan);
newCell->SetAttribute(NS_ConvertASCIItoUCS2("rowspan"), newRowSpan);
}
if( aColSpan > 1)
{
// Note: Do NOT use editor transaction for this
nsAutoString newColSpan;
newColSpan.AppendInt(aColSpan, 10);
newCell->SetAttribute(NS_LITERAL_STRING("colspan"), newColSpan);
newCell->SetAttribute(NS_ConvertASCIItoUCS2("colspan"), newColSpan);
}
if(aAfter) cellOffset++;
@ -226,7 +226,7 @@ nsHTMLEditor::InsertTableCell(PRInt32 aNumber, PRBool aAfter)
for (i = 0; i < aNumber; i++)
{
nsCOMPtr<nsIDOMElement> newCell;
res = CreateElementWithDefaults(NS_LITERAL_STRING("td"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
if (NS_SUCCEEDED(res) && newCell)
{
if (aAfter) cellOffset++;
@ -243,7 +243,7 @@ nsHTMLEditor::GetFirstRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
aRow = nsnull;
nsCOMPtr<nsIDOMElement> tableElement;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -308,7 +308,7 @@ nsHTMLEditor::GetNextRow(nsIDOMElement* aTableElement, nsIDOMElement* &aRow)
aRow = nsnull;
nsCOMPtr<nsIDOMElement> rowElement;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -507,7 +507,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
if (!curCell) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -607,7 +607,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
{
// Create a new row
nsCOMPtr<nsIDOMElement> newRow;
res = CreateElementWithDefaults(NS_LITERAL_STRING("tr"), getter_AddRefs(newRow));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("tr"), getter_AddRefs(newRow));
if (NS_SUCCEEDED(res))
{
if (!newRow) return NS_ERROR_FAILURE;
@ -615,7 +615,7 @@ nsHTMLEditor::InsertTableRow(PRInt32 aNumber, PRBool aAfter)
for (PRInt32 i = 0; i < cellsInRow; i++)
{
nsCOMPtr<nsIDOMElement> newCell;
res = CreateElementWithDefaults(NS_LITERAL_STRING("td"), getter_AddRefs(newCell));
res = CreateElementWithDefaults(NS_ConvertASCIItoUCS2("td"), getter_AddRefs(newCell));
if (NS_FAILED(res)) return res;
if (!newCell) return NS_ERROR_FAILURE;
@ -825,7 +825,7 @@ nsHTMLEditor::DeleteTableCell(PRInt32 aNumber)
if (1 == GetNumberOfCellsInRow(table, startRowIndex))
{
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1073,7 +1073,7 @@ nsHTMLEditor::DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex)
{
// Only 1 cell in row - delete the row
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1295,7 +1295,7 @@ nsHTMLEditor::DeleteRow(nsIDOMElement *aTable, PRInt32 aRowIndex)
// Delete the entire row
nsCOMPtr<nsIDOMElement> parentRow;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("tr"), cellInDeleteRow, getter_AddRefs(parentRow));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("tr"), cellInDeleteRow, getter_AddRefs(parentRow));
if (NS_FAILED(res)) return res;
if (parentRow)
@ -1331,7 +1331,7 @@ nsHTMLEditor::SelectTable()
{
nsCOMPtr<nsIDOMElement> table;
nsresult res = NS_ERROR_FAILURE;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1350,7 +1350,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectTableCell()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -1376,12 +1376,12 @@ nsHTMLEditor::SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndC
if (!selection) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> table;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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(NS_LITERAL_STRING("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;
@ -1458,7 +1458,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectAllTableCells()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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
@ -1470,7 +1470,7 @@ nsHTMLEditor::SelectAllTableCells()
// Get parent table
nsCOMPtr<nsIDOMElement> table;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), cell, getter_AddRefs(table));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
if(!table) return NS_ERROR_NULL_POINTER;
@ -1526,7 +1526,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectTableRow()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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
@ -1597,7 +1597,7 @@ NS_IMETHODIMP
nsHTMLEditor::SelectTableColumn()
{
nsCOMPtr<nsIDOMElement> cell;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("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
@ -1855,7 +1855,7 @@ nsHTMLEditor::SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElemen
// Set to the opposite of current type
nsAutoString tagName;
GetTagString(aSourceCell, tagName);
nsString newCellType = (tagName == NS_LITERAL_STRING("td")) ? NS_LITERAL_STRING("th") : NS_LITERAL_STRING("td");
nsString newCellType( (tagName == NS_LITERAL_STRING("td")) ? NS_LITERAL_STRING("th") : NS_LITERAL_STRING("td") );
// Save current selection to restore when done
// This is needed so ReplaceContainer can monitor selection
@ -2391,7 +2391,7 @@ nsHTMLEditor::NormalizeTable(nsIDOMElement *aTable)
if (!selection) return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> table;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("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;
@ -2481,7 +2481,7 @@ nsHTMLEditor::GetCellIndexes(nsIDOMElement *aCell, PRInt32 &aRowIndex, PRInt32 &
{
// Get the selected cell or the cell enclosing the selection anchor
nsCOMPtr<nsIDOMElement> cell;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("td"), nsnull, getter_AddRefs(cell));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("td"), nsnull, getter_AddRefs(cell));
if (NS_SUCCEEDED(res) && cell)
aCell = cell;
else
@ -2558,7 +2558,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(NS_LITERAL_STRING("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;
@ -2593,7 +2593,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(NS_LITERAL_STRING("table"), nsnull, getter_AddRefs(table));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), nsnull, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
if (table)
aTable = table;
@ -2711,7 +2711,7 @@ nsHTMLEditor::GetCellContext(nsIDOMSelection **aSelection,
}
// Get containing table
res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), cell, getter_AddRefs(table));
res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), cell, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
// Cell must be in a table, so fail if not found
if (!table) return NS_ERROR_FAILURE;
@ -3167,7 +3167,7 @@ nsHTMLEditor::GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 &aSelection
// (if aElement is null, this uses selection's anchor node)
nsCOMPtr<nsIDOMElement> table;
nsresult res = GetElementOrParentByTagName(NS_LITERAL_STRING("table"), aElement, getter_AddRefs(table));
nsresult res = GetElementOrParentByTagName(NS_ConvertASCIItoUCS2("table"), aElement, getter_AddRefs(table));
if (NS_FAILED(res)) return res;
PRInt32 rowCount, colCount;