Bug 737417 part 1 - Split charset source constants out of nsIParser.h. r=smaug.

This commit is contained in:
Henri Sivonen 2012-03-22 16:42:42 +02:00
parent eae91d8179
commit 3dfb9fb844
38 changed files with 70 additions and 66 deletions

View File

@ -58,7 +58,6 @@
#include "nsIHttpChannel.h"
#include "nsIContent.h"
#include "nsIScriptElement.h"
#include "nsIParser.h"
#include "nsContentErrors.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"

View File

@ -42,8 +42,6 @@
#include "nsContentUtils.h"
#include "nsIScriptSecurityManager.h"
#include "nsNetUtil.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsMimeTypes.h"
#include "nsIStreamConverterService.h"
#include "nsStringStream.h"

View File

@ -148,6 +148,7 @@
#include "nsBlobProtocolHandler.h"
#include "nsCharsetAlias.h"
#include "nsCharsetSource.h"
#include "nsIParser.h"
#include "nsIContentSink.h"

View File

@ -65,7 +65,6 @@
#include "nsAutoPtr.h"
#include "nsIXPConnect.h"
#include "nsContentErrors.h"
#include "nsIParser.h"
#include "nsThreadUtils.h"
#include "nsDocShellCID.h"
#include "nsIContentSecurityPolicy.h"

View File

@ -51,7 +51,6 @@
#include "nsCOMPtr.h"
#include "nsTArray.h"
#include "nsString.h"
#include "nsIParser.h"
#define kIndentStr NS_LITERAL_STRING(" ")
#define kEndTag NS_LITERAL_STRING("</")

View File

@ -48,7 +48,7 @@
#include "nsIContentViewer.h"
#include "nsIMarkupDocumentViewer.h"
#include "nsIDocShell.h"
#include "nsIParser.h" // kCharsetFrom* macro definition
#include "nsCharsetSource.h" // kCharsetFrom* macro definition
#include "nsNodeInfoManager.h"
#include "nsContentUtils.h"

View File

@ -55,7 +55,6 @@
#include "nsIHTMLContentSink.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIParser.h"
#include "nsScriptLoader.h"
#include "nsIURI.h"
#include "nsNetUtil.h"

View File

@ -45,8 +45,6 @@
#include "nsIURL.h"
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsNetUtil.h"
#include "plstr.h"
#include "nsIContent.h"

View File

@ -49,8 +49,6 @@
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsNetUtil.h"
#include "plstr.h"
#include "nsIContent.h"

View File

@ -42,7 +42,6 @@
#include "nsIDocument.h"
#include "nsBindingManager.h"
#include "nsIDOMNode.h"
#include "nsIParser.h"
#include "nsGkAtoms.h"
#include "nsINameSpaceManager.h"
#include "nsHTMLTokens.h"

View File

@ -48,8 +48,6 @@
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsReadableUtils.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsNetUtil.h"
#include "plstr.h"
#include "nsContentCreatorFunctions.h"

View File

@ -53,8 +53,6 @@
#include "nsIURL.h"
#include "nsIChannel.h"
#include "nsXPIDLString.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "plstr.h"
#include "nsIContent.h"
#include "nsIDocument.h"

View File

@ -39,7 +39,7 @@
#include "nsXMLDocument.h"
#include "nsParserCIID.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIXMLContentSink.h"
#include "nsPresContext.h"
#include "nsIContent.h"

View File

@ -43,7 +43,6 @@
#include "nsContentSink.h"
#include "nsIExpatSink.h"
#include "nsIDTD.h"
#include "nsIParser.h"
#include "nsIDocument.h"
#include "nsIDOMDocumentFragment.h"
#include "nsIContent.h"

View File

@ -50,6 +50,7 @@
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIRequestObserver.h"
#include "nsIScriptSecurityManager.h"
#include "nsContentPolicyUtils.h"

View File

@ -44,7 +44,7 @@
#include "nsIDOMDocumentFragment.h"
#include "nsIDocumentTransformer.h"
#include "nsNetUtil.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsCharsetAlias.h"
#include "nsIPrincipal.h"
#include "txURIUtils.h"

View File

@ -44,7 +44,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMDocumentType.h"
#include "nsIScriptElement.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIRefreshURI.h"
#include "nsPIDOMWindow.h"
#include "nsIContent.h"

View File

@ -62,7 +62,6 @@
#include "nsHTMLStyleSheet.h"
#include "nsINameSpaceManager.h"
#include "nsINodeInfo.h"
#include "nsIParser.h"
#include "nsIScriptContext.h"
#include "nsIScriptRuntime.h"
#include "nsIScriptGlobalObject.h"

View File

@ -111,6 +111,7 @@
#include "nsContentCreatorFunctions.h"
#include "nsContentUtils.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIParserService.h"
#include "nsCSSStyleSheet.h"
#include "mozilla/css/Loader.h"

View File

@ -38,7 +38,7 @@
#define nsIWebShellServices_h___
#include "nsISupports.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
// Interface ID for nsIWebShellServices

View File

@ -60,7 +60,7 @@
#include "nsIFrame.h"
#include "nsIWidget.h"
#include "nsGUIEvent.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsJSEnvironment.h"
#include "nsJSUtils.h"

View File

@ -76,8 +76,6 @@
#include "nsIDOMDocumentFragment.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsXPCOM.h"
#include "nsISupportsPrimitives.h"
#include "nsLinebreakConverter.h"
@ -133,8 +131,6 @@ using namespace mozilla;
const PRUnichar nbsp = 160;
static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID);
#define kInsertCookie "_moz_Insert Here_moz_"
#define NS_FOUND_TARGET NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_EDITOR, 3)

View File

@ -97,7 +97,7 @@
#include "nsIDocShell.h"
#include "nsIBaseWindow.h"
#include "nsILayoutHistoryState.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsGUIEvent.h"
#include "nsHTMLReflowState.h"
#include "nsIDOMHTMLAnchorElement.h"

View File

@ -108,8 +108,6 @@
#include "nsCaret.h"
#include "nsIDOMHTMLDocument.h"
#include "nsIDOMXMLDocument.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsViewsCID.h"
#include "nsFrameManager.h"
#include "nsEventStateManager.h"

View File

@ -60,7 +60,7 @@
#endif
#include "nsContentUtils.h"
#include "imgILoader.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsMimeTypes.h"
#include "mozilla/FunctionTimer.h"

View File

@ -142,7 +142,6 @@ static const char kPrintingPromptService[] = "@mozilla.org/embedcomp/printingpro
#include "nsIBaseWindow.h"
#include "nsILayoutHistoryState.h"
#include "nsFrameManager.h"
#include "nsIParser.h"
#include "nsGUIEvent.h"
#include "nsHTMLReflowState.h"
#include "nsIDOMHTMLAnchorElement.h"

View File

@ -40,7 +40,7 @@
#include "mozilla/net/NeckoChild.h"
#include "WyciwygChannelChild.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsStringStream.h"
#include "nsMimeTypes.h"
#include "nsNetUtil.h"

View File

@ -41,7 +41,7 @@
#include "nsWyciwygChannel.h"
#include "nsNetUtil.h"
#include "nsISupportsPriority.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsISerializable.h"
#include "nsSerializationHelper.h"

View File

@ -47,7 +47,7 @@
#include "nsContentUtils.h"
#include "nsICacheService.h"
#include "nsICacheSession.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsThreadUtils.h"
#include "nsProxyRelease.h"

View File

@ -45,4 +45,8 @@ include $(DEPTH)/config/autoconf.mk
MODULE = parser
DIRS = expat xml htmlparser html
EXPORTS = \
nsCharsetSource.h \
$(NULL)
include $(topsrcdir)/config/rules.mk

View File

@ -57,6 +57,7 @@
#include "expat_config.h"
#include "expat.h"
#include "nsINestedURI.h"
#include "nsCharsetSource.h"
using namespace mozilla;

View File

@ -39,13 +39,16 @@
#define NS_IPARSER___
/**
* MODULE NOTES:
*
* This class defines the iparser interface. This XPCOM
* inteface is all that parser clients ever need to see.
/**
* This GECKO-INTERNAL interface is on track to being REMOVED (or refactored
* to the point of being near-unrecognizable).
*
**/
* Please DO NOT #include this file in comm-central code, in your XULRunner
* app or binary extensions.
*
* Please DO NOT #include this into new files even inside Gecko. It is more
* likely than not that #including this header is the wrong thing to do.
*/
#include "nsISupports.h"
#include "nsIStreamListener.h"
@ -54,6 +57,7 @@
#include "nsTArray.h"
#include "nsIAtom.h"
#include "nsParserBase.h"
#include "nsCharsetSource.h" // avoid burning comm-central
#define NS_IPARSER_IID \
{ 0xd064f0d6, 0x44e3, 0x4366, \
@ -85,28 +89,6 @@ enum eParserDocType {
eHTML_Strict
};
// define Charset source constants
// note: the value order defines the priority; higher numbers take priority
#define kCharsetUninitialized 0
#define kCharsetFromWeakDocTypeDefault 1
#define kCharsetFromUserDefault 2
#define kCharsetFromDocTypeDefault 3 // This and up confident for XHR
#define kCharsetFromCache 4
#define kCharsetFromParentFrame 5
#define kCharsetFromAutoDetection 6
#define kCharsetFromHintPrevDoc 7
#define kCharsetFromMetaPrescan 8 // this one and smaller: HTML5 Tentative
#define kCharsetFromMetaTag 9 // this one and greater: HTML5 Confident
#define kCharsetFromIrreversibleAutoDetection 10
#define kCharsetFromByteOrderMark 11
#define kCharsetFromChannel 12
#define kCharsetFromOtherComponent 13
// Levels below here will be forced onto childframes too
#define kCharsetFromParentForced 14
#define kCharsetFromUserForced 15
#define kCharsetFromPreviousLoading 16
enum eStreamState {eNone,eOnStart,eOnDataAvail,eOnStop};
/**
@ -127,8 +109,14 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDebugDumpContent, NS_IDEBUG_DUMP_CONTENT_IID)
/**
* This class defines the iparser interface. This XPCOM
* inteface is all that parser clients ever need to see.
* This GECKO-INTERNAL interface is on track to being REMOVED (or refactored
* to the point of being near-unrecognizable).
*
* Please DO NOT #include this file in comm-central code, in your XULRunner
* app or binary extensions.
*
* Please DO NOT #include this into new files even inside Gecko. It is more
* likely than not that #including this header is the wrong thing to do.
*/
class nsIParser : public nsParserBase {
public:

View File

@ -98,7 +98,6 @@
#include "nsIDTD.h"
#include "nsISupports.h"
#include "nsIParser.h"
#include "nsHTMLTags.h"
#include "nsDeque.h"
#include "nsParserCIID.h"

View File

@ -74,6 +74,7 @@
#include "mozilla/CondVar.h"
#include "mozilla/Mutex.h"
#include "nsParserConstants.h"
#include "nsCharsetSource.h"
using namespace mozilla;

View File

@ -50,6 +50,7 @@
#include "nsUTF8Utils.h" // for LossyConvertEncoding
#include "nsCRT.h"
#include "nsParser.h"
#include "nsCharsetSource.h"
// We replace NUL characters with this character.
static PRUnichar sInvalid = UCS2_REPLACEMENT_CHAR;

28
parser/nsCharsetSource.h Normal file
View File

@ -0,0 +1,28 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsCharsetSource_h_
#define nsCharsetSource_h_
// note: the value order defines the priority; higher numbers take priority
#define kCharsetUninitialized 0
#define kCharsetFromWeakDocTypeDefault 1
#define kCharsetFromUserDefault 2
#define kCharsetFromDocTypeDefault 3 // This and up confident for XHR
#define kCharsetFromCache 4
#define kCharsetFromParentFrame 5
#define kCharsetFromAutoDetection 6
#define kCharsetFromHintPrevDoc 7
#define kCharsetFromMetaPrescan 8 // this one and smaller: HTML5 Tentative
#define kCharsetFromMetaTag 9 // this one and greater: HTML5 Confident
#define kCharsetFromIrreversibleAutoDetection 10
#define kCharsetFromByteOrderMark 11
#define kCharsetFromChannel 12
#define kCharsetFromOtherComponent 13
// Levels below here will be forced onto childframes too
#define kCharsetFromParentForced 14
#define kCharsetFromUserForced 15
#define kCharsetFromPreviousLoading 16
#endif /* nsCharsetSource_h_ */

View File

@ -40,6 +40,7 @@
#include "nsNetCID.h"
#include "nsNetUtil.h"
#include "nsCharsetAlias.h"
#include "nsIParser.h"
#include "nsParserCIID.h"
#include "nsStreamUtils.h"
#include "nsStringStream.h"
@ -47,6 +48,7 @@
#include "nsSAXAttributes.h"
#include "nsSAXLocator.h"
#include "nsSAXXMLReader.h"
#include "nsCharsetSource.h"
#define XMLNS_URI "http://www.w3.org/2000/xmlns/"

View File

@ -41,6 +41,7 @@
#include "nsIComponentManager.h"
#include "nsIParser.h"
#include "nsCharsetSource.h"
#include "nsIRDFContentSink.h"
#include "nsParserCIID.h"
#include "nsStringStream.h"