Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsIParserService_h__ |
michael@0 | 7 | #define nsIParserService_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "nsISupports.h" |
michael@0 | 10 | #include "nsString.h" |
michael@0 | 11 | #include "nsHTMLTags.h" |
michael@0 | 12 | |
michael@0 | 13 | class nsIParser; |
michael@0 | 14 | |
michael@0 | 15 | #define NS_PARSERSERVICE_CONTRACTID "@mozilla.org/parser/parser-service;1" |
michael@0 | 16 | |
michael@0 | 17 | // {90a92e37-abd6-441b-9b39-4064d98e1ede} |
michael@0 | 18 | #define NS_IPARSERSERVICE_IID \ |
michael@0 | 19 | { 0x90a92e37, 0xabd6, 0x441b, { 0x9b, 0x39, 0x40, 0x64, 0xd9, 0x8e, 0x1e, 0xde } } |
michael@0 | 20 | |
michael@0 | 21 | class nsIParserService : public nsISupports { |
michael@0 | 22 | public: |
michael@0 | 23 | NS_DECLARE_STATIC_IID_ACCESSOR(NS_IPARSERSERVICE_IID) |
michael@0 | 24 | |
michael@0 | 25 | /** |
michael@0 | 26 | * Looks up the nsHTMLTag enum value corresponding to the tag in aAtom. The |
michael@0 | 27 | * lookup happens case insensitively. |
michael@0 | 28 | * |
michael@0 | 29 | * @param aAtom The tag to look up. |
michael@0 | 30 | * |
michael@0 | 31 | * @return int32_t The nsHTMLTag enum value corresponding to the tag in aAtom |
michael@0 | 32 | * or eHTMLTag_userdefined if the tag does not correspond to |
michael@0 | 33 | * any of the tag nsHTMLTag enum values. |
michael@0 | 34 | */ |
michael@0 | 35 | virtual int32_t HTMLAtomTagToId(nsIAtom* aAtom) const = 0; |
michael@0 | 36 | |
michael@0 | 37 | /** |
michael@0 | 38 | * Looks up the nsHTMLTag enum value corresponding to the tag in aAtom. |
michael@0 | 39 | * |
michael@0 | 40 | * @param aAtom The tag to look up. |
michael@0 | 41 | * |
michael@0 | 42 | * @return int32_t The nsHTMLTag enum value corresponding to the tag in aAtom |
michael@0 | 43 | * or eHTMLTag_userdefined if the tag does not correspond to |
michael@0 | 44 | * any of the tag nsHTMLTag enum values. |
michael@0 | 45 | */ |
michael@0 | 46 | virtual int32_t HTMLCaseSensitiveAtomTagToId(nsIAtom* aAtom) const = 0; |
michael@0 | 47 | |
michael@0 | 48 | /** |
michael@0 | 49 | * Looks up the nsHTMLTag enum value corresponding to the tag in aTag. The |
michael@0 | 50 | * lookup happens case insensitively. |
michael@0 | 51 | * |
michael@0 | 52 | * @param aTag The tag to look up. |
michael@0 | 53 | * |
michael@0 | 54 | * @return int32_t The nsHTMLTag enum value corresponding to the tag in aTag |
michael@0 | 55 | * or eHTMLTag_userdefined if the tag does not correspond to |
michael@0 | 56 | * any of the tag nsHTMLTag enum values. |
michael@0 | 57 | */ |
michael@0 | 58 | virtual int32_t HTMLStringTagToId(const nsAString& aTag) const = 0; |
michael@0 | 59 | |
michael@0 | 60 | /** |
michael@0 | 61 | * Gets the tag corresponding to the nsHTMLTag enum value in aId. The |
michael@0 | 62 | * returned tag will be in lowercase. |
michael@0 | 63 | * |
michael@0 | 64 | * @param aId The nsHTMLTag enum value to get the tag for. |
michael@0 | 65 | * |
michael@0 | 66 | * @return const char16_t* The tag corresponding to the nsHTMLTag enum |
michael@0 | 67 | * value, or nullptr if the enum value doesn't |
michael@0 | 68 | * correspond to a tag (eHTMLTag_unknown, |
michael@0 | 69 | * eHTMLTag_userdefined, eHTMLTag_text, ...). |
michael@0 | 70 | */ |
michael@0 | 71 | virtual const char16_t *HTMLIdToStringTag(int32_t aId) const = 0; |
michael@0 | 72 | |
michael@0 | 73 | /** |
michael@0 | 74 | * Gets the tag corresponding to the nsHTMLTag enum value in aId. The |
michael@0 | 75 | * returned tag will be in lowercase. |
michael@0 | 76 | * |
michael@0 | 77 | * @param aId The nsHTMLTag enum value to get the tag for. |
michael@0 | 78 | * |
michael@0 | 79 | * @return nsIAtom* The tag corresponding to the nsHTMLTag enum value, or |
michael@0 | 80 | * nullptr if the enum value doesn't correspond to a tag |
michael@0 | 81 | * (eHTMLTag_unknown, eHTMLTag_userdefined, eHTMLTag_text, |
michael@0 | 82 | * ...). |
michael@0 | 83 | */ |
michael@0 | 84 | virtual nsIAtom *HTMLIdToAtomTag(int32_t aId) const = 0; |
michael@0 | 85 | |
michael@0 | 86 | NS_IMETHOD HTMLConvertEntityToUnicode(const nsAString& aEntity, |
michael@0 | 87 | int32_t* aUnicode) const = 0; |
michael@0 | 88 | |
michael@0 | 89 | NS_IMETHOD HTMLConvertUnicodeToEntity(int32_t aUnicode, |
michael@0 | 90 | nsCString& aEntity) const = 0; |
michael@0 | 91 | |
michael@0 | 92 | NS_IMETHOD IsContainer(int32_t aId, bool& aIsContainer) const = 0; |
michael@0 | 93 | NS_IMETHOD IsBlock(int32_t aId, bool& aIsBlock) const = 0; |
michael@0 | 94 | }; |
michael@0 | 95 | |
michael@0 | 96 | NS_DEFINE_STATIC_IID_ACCESSOR(nsIParserService, NS_IPARSERSERVICE_IID) |
michael@0 | 97 | |
michael@0 | 98 | #endif // nsIParserService_h__ |