Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; 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 | #include "nsISupports.idl" |
michael@0 | 7 | |
michael@0 | 8 | interface nsIDOMElement; |
michael@0 | 9 | interface nsIDOMDocumentFragment; |
michael@0 | 10 | interface nsIURI; |
michael@0 | 11 | |
michael@0 | 12 | /** |
michael@0 | 13 | * This interface is OBSOLETE and exists solely for legacy extensions. |
michael@0 | 14 | */ |
michael@0 | 15 | [scriptable, uuid(3ab244a9-f09d-44da-9e3f-ee4d67367f2d)] |
michael@0 | 16 | interface nsIScriptableUnescapeHTML : nsISupports |
michael@0 | 17 | { |
michael@0 | 18 | /** |
michael@0 | 19 | * Converts HTML to plain text. This is equivalent to calling |
michael@0 | 20 | * nsIParserUtils::convertToPlainText(src, |
michael@0 | 21 | * nsIDocumentEncoder::OutputSelectionOnly | |
michael@0 | 22 | * nsIDocumentEncoder::OutputAbsoluteLinks, 0). |
michael@0 | 23 | * |
michael@0 | 24 | * You should call nsIParserUtils::convertToPlainText() instead of calling |
michael@0 | 25 | * this method. |
michael@0 | 26 | * |
michael@0 | 27 | * @param src The HTML string to convert to plain text. |
michael@0 | 28 | */ |
michael@0 | 29 | AString unescape(in AString src); |
michael@0 | 30 | |
michael@0 | 31 | /** |
michael@0 | 32 | * Parses markup into a sanitized document fragment. This is equivalent to |
michael@0 | 33 | * calling nsIParserUtils::parseFragment(fragment, 0, isXML, baseURI, |
michael@0 | 34 | * element). |
michael@0 | 35 | * |
michael@0 | 36 | * You should call nsIParserUtils::parseFragment() instead of calling this |
michael@0 | 37 | * method. |
michael@0 | 38 | * @param fragment the input markup |
michael@0 | 39 | * @param isXML true if |fragment| is XML and false if HTML |
michael@0 | 40 | * @param baseURI the base URL for this fragment |
michael@0 | 41 | * @param element the context node for the fragment parsing algorithm |
michael@0 | 42 | */ |
michael@0 | 43 | nsIDOMDocumentFragment parseFragment(in AString fragment, |
michael@0 | 44 | in boolean isXML, |
michael@0 | 45 | in nsIURI baseURI, |
michael@0 | 46 | in nsIDOMElement element); |
michael@0 | 47 | }; |
michael@0 | 48 | |
michael@0 | 49 | %{ C++ |
michael@0 | 50 | #define NS_SCRIPTABLEUNESCAPEHTML_CONTRACTID \ |
michael@0 | 51 | "@mozilla.org/feed-unescapehtml;1" |
michael@0 | 52 | #define NS_SCRIPTABLEUNESCAPEHTML_CID \ |
michael@0 | 53 | { 0x10f2f5f0, 0xf103, 0x4901, { 0x98, 0x0f, 0xba, 0x11, 0xbd, 0x70, 0xd6, 0x0d} } |
michael@0 | 54 | %} |