Bug 482921 part 1 - Implement HTML syntax highlighting using the new parser. r=Olli.Pettay.

This commit is contained in:
Henri Sivonen
2010-07-30 13:15:38 +03:00
parent 6d5bbec2af
commit a42c6e14db
37 changed files with 4254 additions and 107 deletions

View File

@@ -576,7 +576,8 @@ nsHTMLDocument::StartAutodetection(nsIDocShell *aDocShell, nsACString& aCharset,
if (mIsRegularHTML &&
nsHtml5Module::sEnabled &&
aCommand &&
!nsCRT::strcmp(aCommand, "view")) {
(!nsCRT::strcmp(aCommand, "view") ||
!nsCRT::strcmp(aCommand, "view-source"))) {
return; // the HTML5 parser uses chardet directly
}
nsCOMPtr <nsIParserFilter> cdetflt;
@@ -675,7 +676,8 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
if (loadAsHtml5 &&
!(contentType.EqualsLiteral("text/html") &&
aCommand &&
!nsCRT::strcmp(aCommand, "view"))) {
(!nsCRT::strcmp(aCommand, "view") ||
!nsCRT::strcmp(aCommand, "view-source")))) {
loadAsHtml5 = false;
}
@@ -728,7 +730,7 @@ nsHTMLDocument::StartDocumentLoad(const char* aCommand,
if (needsParser) {
if (loadAsHtml5) {
mParser = nsHtml5Module::NewHtml5Parser();
mParser->MarkAsNotScriptCreated();
mParser->MarkAsNotScriptCreated(aCommand);
} else {
mParser = do_CreateInstance(kCParserCID, &rv);
NS_ENSURE_SUCCESS(rv, rv);