1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=2 et tw=78: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "nsISupports.h"
8 #include "nsISupportsImpl.h"
11 #include "nsIHTMLContentSink.h"
13 NS_IMPL_ISUPPORTS(CNavDTD
, nsIDTD
);
17 CNavDTD::~CNavDTD() {}
20 CNavDTD::WillBuildModel(const CParserContext
& aParserContext
,
21 nsITokenizer
* aTokenizer
, nsIContentSink
* aSink
) {
26 CNavDTD::BuildModel(nsITokenizer
* aTokenizer
, nsIContentSink
* aSink
) {
27 // NB: It is important to throw STOPPARSING if the sink is the wrong type in
28 // order to make sure nsParser cleans up properly after itself.
29 nsCOMPtr
<nsIHTMLContentSink
> sink
= do_QueryInterface(aSink
);
31 return NS_ERROR_HTMLPARSER_STOPPARSING
;
34 nsresult rv
= sink
->OpenContainer(nsIHTMLContentSink::eHTML
);
35 NS_ENSURE_SUCCESS(rv
, rv
);
36 rv
= sink
->OpenContainer(nsIHTMLContentSink::eBody
);
37 NS_ENSURE_SUCCESS(rv
, rv
);
39 rv
= sink
->CloseContainer(nsIHTMLContentSink::eBody
);
40 MOZ_ASSERT(NS_SUCCEEDED(rv
));
41 rv
= sink
->CloseContainer(nsIHTMLContentSink::eHTML
);
42 MOZ_ASSERT(NS_SUCCEEDED(rv
));
48 CNavDTD::DidBuildModel(nsresult anErrorCode
) { return NS_OK
; }
51 CNavDTD::Terminate() {}
53 NS_IMETHODIMP_(int32_t)
54 CNavDTD::GetType() { return NS_IPARSER_FLAG_HTML
; }
56 NS_IMETHODIMP_(nsDTDMode
)
57 CNavDTD::GetMode() const { return eDTDMode_quirks
; }
60 CNavDTD::CanContain(int32_t aParent
, int32_t aChild
) const {
61 MOZ_CRASH("nobody calls this");
66 CNavDTD::IsContainer(int32_t aTag
) const {
67 MOZ_CRASH("nobody calls this");