Bug 1130891 part 3 - Add param to HTMLCopy to allow copy with ruby annotation. r=smaug

--HG--
extra : source : 57de10711eec392abda832e0df2b4186881180b0
This commit is contained in:
Xidorn Quan 2015-03-10 17:11:55 +11:00
Родитель 2e4cc674a2
Коммит 4407f03467
3 изменённых файлов: 13 добавлений и 8 удалений

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

@ -148,7 +148,8 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
nsIDocumentEncoder::OutputAbsoluteLinks |
nsIDocumentEncoder::SkipInvisibleContent |
nsIDocumentEncoder::OutputDropInvisibleBreak |
(aFlags & nsIDocumentEncoder::OutputNoScriptContent);
(aFlags & (nsIDocumentEncoder::OutputNoScriptContent |
nsIDocumentEncoder::OutputRubyAnnotation));
mimeType.AssignLiteral(kTextMime);
rv = docEncoder->Init(domDoc, mimeType, flags);
@ -273,11 +274,13 @@ SelectionCopyHelper(nsISelection *aSel, nsIDocument *aDoc,
nsresult
nsCopySupport::HTMLCopy(nsISelection* aSel, nsIDocument* aDoc,
int16_t aClipboardID)
int16_t aClipboardID, bool aWithRubyAnnotation)
{
return SelectionCopyHelper(aSel, aDoc, true, aClipboardID,
nsIDocumentEncoder::SkipInvisibleContent,
nullptr);
uint32_t flags = nsIDocumentEncoder::SkipInvisibleContent;
if (aWithRubyAnnotation) {
flags |= nsIDocumentEncoder::OutputRubyAnnotation;
}
return SelectionCopyHelper(aSel, aDoc, true, aClipboardID, flags, nullptr);
}
nsresult
@ -691,7 +694,7 @@ nsCopySupport::FireClipboardEvent(int32_t aType, int32_t aClipboardType, nsIPres
return false;
}
// call the copy code
rv = HTMLCopy(sel, doc, aClipboardType);
rv = HTMLCopy(sel, doc, aClipboardType, false);
if (NS_FAILED(rv)) {
return false;
}

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

@ -23,7 +23,8 @@ class nsCopySupport
{
// class of static helper functions for copy support
public:
static nsresult HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, int16_t aClipboardID);
static nsresult HTMLCopy(nsISelection *aSel, nsIDocument *aDoc,
int16_t aClipboardID, bool aWithRubyAnnotation);
static nsresult DoHooks(nsIDocument *aDoc, nsITransferable *aTrans,
bool *aDoPutOnClipboard);

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

@ -6125,5 +6125,6 @@ nsAutoCopyListener::NotifySelectionChanged(nsIDOMDocument *aDoc,
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
// call the copy code
return nsCopySupport::HTMLCopy(aSel, doc, nsIClipboard::kSelectionClipboard);
return nsCopySupport::HTMLCopy(aSel, doc,
nsIClipboard::kSelectionClipboard, false);
}