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 | /* vim: set sw=2 ts=2 et tw=78: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "nsISupports.h" |
michael@0 | 8 | #include "nsISupportsImpl.h" |
michael@0 | 9 | #include "nsIParser.h" |
michael@0 | 10 | #include "CNavDTD.h" |
michael@0 | 11 | #include "nsIHTMLContentSink.h" |
michael@0 | 12 | |
michael@0 | 13 | NS_IMPL_ISUPPORTS(CNavDTD, nsIDTD); |
michael@0 | 14 | |
michael@0 | 15 | CNavDTD::CNavDTD() |
michael@0 | 16 | { |
michael@0 | 17 | } |
michael@0 | 18 | |
michael@0 | 19 | CNavDTD::~CNavDTD() |
michael@0 | 20 | { |
michael@0 | 21 | } |
michael@0 | 22 | |
michael@0 | 23 | NS_IMETHODIMP |
michael@0 | 24 | CNavDTD::WillBuildModel(const CParserContext& aParserContext, |
michael@0 | 25 | nsITokenizer* aTokenizer, |
michael@0 | 26 | nsIContentSink* aSink) |
michael@0 | 27 | { |
michael@0 | 28 | return NS_OK; |
michael@0 | 29 | } |
michael@0 | 30 | |
michael@0 | 31 | NS_IMETHODIMP |
michael@0 | 32 | CNavDTD::BuildModel(nsITokenizer* aTokenizer, |
michael@0 | 33 | nsIContentSink* aSink) |
michael@0 | 34 | { |
michael@0 | 35 | // NB: It is important to throw STOPPARSING if the sink is the wrong type in |
michael@0 | 36 | // order to make sure nsParser cleans up properly after itself. |
michael@0 | 37 | nsCOMPtr<nsIHTMLContentSink> sink = do_QueryInterface(aSink); |
michael@0 | 38 | if (!sink) { |
michael@0 | 39 | return NS_ERROR_HTMLPARSER_STOPPARSING; |
michael@0 | 40 | } |
michael@0 | 41 | |
michael@0 | 42 | nsresult rv = sink->OpenContainer(nsIHTMLContentSink::eHTML); |
michael@0 | 43 | NS_ENSURE_SUCCESS(rv, rv); |
michael@0 | 44 | rv = sink->OpenContainer(nsIHTMLContentSink::eBody); |
michael@0 | 45 | NS_ENSURE_SUCCESS(rv, rv); |
michael@0 | 46 | |
michael@0 | 47 | rv = sink->CloseContainer(nsIHTMLContentSink::eBody); |
michael@0 | 48 | MOZ_ASSERT(NS_SUCCEEDED(rv)); |
michael@0 | 49 | rv = sink->CloseContainer(nsIHTMLContentSink::eHTML); |
michael@0 | 50 | MOZ_ASSERT(NS_SUCCEEDED(rv)); |
michael@0 | 51 | |
michael@0 | 52 | return NS_OK; |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | NS_IMETHODIMP |
michael@0 | 56 | CNavDTD::DidBuildModel(nsresult anErrorCode) |
michael@0 | 57 | { |
michael@0 | 58 | return NS_OK; |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | NS_IMETHODIMP_(void) |
michael@0 | 62 | CNavDTD::Terminate() |
michael@0 | 63 | { |
michael@0 | 64 | } |
michael@0 | 65 | |
michael@0 | 66 | |
michael@0 | 67 | NS_IMETHODIMP_(int32_t) |
michael@0 | 68 | CNavDTD::GetType() |
michael@0 | 69 | { |
michael@0 | 70 | return NS_IPARSER_FLAG_HTML; |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | NS_IMETHODIMP_(nsDTDMode) |
michael@0 | 74 | CNavDTD::GetMode() const |
michael@0 | 75 | { |
michael@0 | 76 | return eDTDMode_quirks; |
michael@0 | 77 | } |
michael@0 | 78 | |
michael@0 | 79 | NS_IMETHODIMP_(bool) |
michael@0 | 80 | CNavDTD::CanContain(int32_t aParent,int32_t aChild) const |
michael@0 | 81 | { |
michael@0 | 82 | MOZ_CRASH("nobody calls this"); |
michael@0 | 83 | return false; |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | NS_IMETHODIMP_(bool) |
michael@0 | 87 | CNavDTD::IsContainer(int32_t aTag) const |
michael@0 | 88 | { |
michael@0 | 89 | MOZ_CRASH("nobody calls this"); |
michael@0 | 90 | return false; |
michael@0 | 91 | } |