Refix copy/paste of XHTML to treat it like it does XML -- as plaintext-only

content, since we can't actually copy/paste XML usefully.  Bug 270145, r+sr=jst
This commit is contained in:
bzbarsky%mit.edu 2004-12-01 22:43:56 +00:00
Родитель 086155cae6
Коммит 09ecaf0056
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -319,9 +319,13 @@ nsresult nsCopySupport::IsPlainTextContext(nsISelection *aSel, nsIDocument *aDoc
}
}
// also consider ourselves in a text widget if we can't find an html document
// also consider ourselves in a text widget if we can't find an html
// document. Note that XHTML is not counted as HTML here, because we can't
// copy it properly (all the copy code for non-plaintext assumes using HTML
// serializers and parsers is OK, and those mess up XHTML).
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(aDoc);
if (!htmlDoc) *aIsPlainTextContext = PR_TRUE;
if (!htmlDoc || aDoc->IsCaseSensitive())
*aIsPlainTextContext = PR_TRUE;
return NS_OK;
}

Просмотреть файл

@ -301,6 +301,7 @@ nsDocumentEncoder::SerializeNodeStart(nsIDOMNode* aNode, PRInt32 aStartOffset,
}
case nsIDOMNode::CDATA_SECTION_NODE:
{
NS_ERROR("aaa");
nsCOMPtr<nsIDOMCDATASection> cdata = do_QueryInterface(node);
mSerializer->AppendCDATASection(cdata, aStartOffset, aEndOffset, aStr);
break;
@ -1144,7 +1145,8 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
// also consider ourselves in a text widget if we can't find an html document
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(mDocument);
if (!htmlDoc) mIsTextWidget = PR_TRUE;
if (!htmlDoc || mDocument->IsCaseSensitive())
mIsTextWidget = PR_TRUE;
// normalize selection if we are not in a widget
if (mIsTextWidget)