mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 12:25:53 +00:00
Bug 1467802 - part 3: Create EditorBase::GetDocumentCharsetInternal() for internal use of nsIEditor::GetDocumentCharacterSet() r=m_kato
This patch creates non-virtual method, EditorBase::GetDocumentCharsetInternal(), for internal use of nsIEditor::GetDocumentCharacterSet() since the virtual call method is redundant and the caller cannot be marked as const. MozReview-Commit-ID: v6kDo2eKg3 --HG-- extra : rebase_source : 07f6dd8341cb6686835db2ee3ded479323cccca9
This commit is contained in:
parent
85b94e287c
commit
91c0a26b3f
@ -1132,13 +1132,19 @@ EditorBase::GetDocumentModified(bool* outDocModified)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
EditorBase::GetDocumentCharacterSet(nsACString& characterSet)
|
||||
EditorBase::GetDocumentCharacterSet(nsACString& aCharset)
|
||||
{
|
||||
return GetDocumentCharsetInternal(aCharset);
|
||||
}
|
||||
|
||||
nsresult
|
||||
EditorBase::GetDocumentCharsetInternal(nsACString& aCharset) const
|
||||
{
|
||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||
if (NS_WARN_IF(!document)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
document->GetDocumentCharacterSet()->Name(characterSet);
|
||||
document->GetDocumentCharacterSet()->Name(aCharset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1650,6 +1650,11 @@ protected: // Shouldn't be used by friend classes
|
||||
*/
|
||||
virtual ~EditorBase();
|
||||
|
||||
/**
|
||||
* GetDocumentCharsetInternal() returns charset of the document.
|
||||
*/
|
||||
nsresult GetDocumentCharsetInternal(nsACString& aCharset) const;
|
||||
|
||||
/**
|
||||
* SelectAllInternal() should be used instead of SelectAll() in editor
|
||||
* because SelectAll() creates AutoEditActionSetter but we should avoid
|
||||
|
@ -1811,14 +1811,14 @@ TextEditor::OutputToString(const nsAString& aFormatType,
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsAutoCString charsetStr;
|
||||
rv = GetDocumentCharacterSet(charsetStr);
|
||||
if (NS_FAILED(rv) || charsetStr.IsEmpty()) {
|
||||
charsetStr.AssignLiteral("windows-1252");
|
||||
nsAutoCString charset;
|
||||
rv = GetDocumentCharsetInternal(charset);
|
||||
if (NS_FAILED(rv) || charset.IsEmpty()) {
|
||||
charset.AssignLiteral("windows-1252");
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocumentEncoder> encoder =
|
||||
GetAndInitDocEncoder(aFormatType, aFlags, charsetStr);
|
||||
GetAndInitDocEncoder(aFormatType, aFlags, charset);
|
||||
if (NS_WARN_IF(!encoder)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user