зеркало из https://github.com/mozilla/gecko-dev.git
Charset override implementation.
This commit is contained in:
Родитель
c22fd60f54
Коммит
3e48d964fc
|
@ -100,6 +100,8 @@
|
|||
#include "nsIPref.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "nsIDocumentCharsetInfo.h"
|
||||
|
||||
#include "nsIDocumentEncoder.h" //for outputting selection
|
||||
|
||||
|
||||
|
@ -570,6 +572,20 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> dcInfo;
|
||||
docShell->GetDocumentCharsetInfo(getter_AddRefs(dcInfo));
|
||||
PRBool override = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPref> prf(do_GetService(NS_PREF_PROGID));
|
||||
if (prf) {
|
||||
char * toOverride = nsnull;
|
||||
if(NS_SUCCEEDED(prf->CopyCharPref("intl.charset.override", &toOverride)))
|
||||
{
|
||||
if (toOverride[0] != 0) override = PR_TRUE;
|
||||
PR_FREEIF(toOverride);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// The following logic is mirrored in nsWebShell::Embed!
|
||||
//
|
||||
|
@ -658,7 +674,14 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
Recycle(forceCharsetFromWebShell);
|
||||
//TODO: we should define appropriate constant for force charset
|
||||
charsetSource = kCharsetFromPreviousLoading;
|
||||
}
|
||||
} else if ((dcInfo != NULL) && (override)) {
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
dcInfo->GetForcedCharset(getter_AddRefs(csAtom));
|
||||
if (csAtom != NULL) {
|
||||
csAtom->ToString(charset);
|
||||
charsetSource = kCharsetFromPreviousLoading;
|
||||
}
|
||||
}
|
||||
}
|
||||
nsresult rv_detect = NS_OK;
|
||||
if(! gInitDetector)
|
||||
|
|
|
@ -100,6 +100,8 @@
|
|||
#include "nsIPref.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "nsIDocumentCharsetInfo.h"
|
||||
|
||||
#include "nsIDocumentEncoder.h" //for outputting selection
|
||||
|
||||
|
||||
|
@ -570,6 +572,20 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> dcInfo;
|
||||
docShell->GetDocumentCharsetInfo(getter_AddRefs(dcInfo));
|
||||
PRBool override = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIPref> prf(do_GetService(NS_PREF_PROGID));
|
||||
if (prf) {
|
||||
char * toOverride = nsnull;
|
||||
if(NS_SUCCEEDED(prf->CopyCharPref("intl.charset.override", &toOverride)))
|
||||
{
|
||||
if (toOverride[0] != 0) override = PR_TRUE;
|
||||
PR_FREEIF(toOverride);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// The following logic is mirrored in nsWebShell::Embed!
|
||||
//
|
||||
|
@ -658,7 +674,14 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
|
|||
Recycle(forceCharsetFromWebShell);
|
||||
//TODO: we should define appropriate constant for force charset
|
||||
charsetSource = kCharsetFromPreviousLoading;
|
||||
}
|
||||
} else if ((dcInfo != NULL) && (override)) {
|
||||
nsCOMPtr<nsIAtom> csAtom;
|
||||
dcInfo->GetForcedCharset(getter_AddRefs(csAtom));
|
||||
if (csAtom != NULL) {
|
||||
csAtom->ToString(charset);
|
||||
charsetSource = kCharsetFromPreviousLoading;
|
||||
}
|
||||
}
|
||||
}
|
||||
nsresult rv_detect = NS_OK;
|
||||
if(! gInitDetector)
|
||||
|
|
Загрузка…
Ссылка в новой задаче