diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index 9a7c122f57cd..ec5ff97e84d7 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -113,7 +113,7 @@ static const char kInvalidTagStackPos[] = "Error: invalid tag stack position"; #define NS_DTD_FLAG_HAS_MAIN_CONTAINER (NS_DTD_FLAG_HAD_BODY | \ NS_DTD_FLAG_HAD_FRAMESET) -NS_IMPL_ISUPPORTS2(CNavDTD, nsIDTD, CNavDTD) +NS_IMPL_ISUPPORTS1(CNavDTD, nsIDTD) CNavDTD::CNavDTD() : mMisplacedContent(0), diff --git a/parser/htmlparser/src/CNavDTD.h b/parser/htmlparser/src/CNavDTD.h index cd8d975f3f65..dd91f1aa1056 100644 --- a/parser/htmlparser/src/CNavDTD.h +++ b/parser/htmlparser/src/CNavDTD.h @@ -107,11 +107,6 @@ #include "nsDTDUtils.h" #include "nsParser.h" -#define NS_INAVHTML_DTD_IID \ - {0x5c5cce40, 0xcfd6, 0x11d1, \ - {0xaa, 0xda, 0x00, 0x80, 0x5f, 0x8a, 0x3e, 0x14}} - - class nsIHTMLContentSink; class nsIParserNode; class nsDTDContext; @@ -166,8 +161,6 @@ public: NS_DECL_ISUPPORTS NS_DECL_NSIDTD - NS_DECLARE_STATIC_IID_ACCESSOR(NS_INAVHTML_DTD_IID); - private: /** * This method is called to determine whether or not a tag diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index 6b0966ea0c79..e6426b1af50f 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -1505,20 +1505,22 @@ nsParser::ParseFragment(const nsAString& aSourceBuffer, // was no in the context. // XXX This is extremely ugly. Maybe CNavDTD should have FlushMisplaced()? NS_ASSERTION(mParserContext, "Parsing didn't create a parser context?"); - nsCOMPtr dtd = do_QueryInterface(mParserContext->mDTD); - if (dtd) { - CStartToken bodyToken(NS_LITERAL_STRING("BODY"), eHTMLTag_body); - nsCParserNode bodyNode(&bodyToken, 0); + CNavDTD* dtd = NS_STATIC_CAST(CNavDTD*, + NS_STATIC_CAST(nsIDTD*, + mParserContext->mDTD)); + NS_ASSERTION(dtd, "How did we parse anything without a dtd?"); - dtd->OpenContainer(&bodyNode, eHTMLTag_body); + CStartToken bodyToken(NS_LITERAL_STRING("BODY"), eHTMLTag_body); + nsCParserNode bodyNode(&bodyToken, 0); - // Now parse the flushed out tags. - result = BuildModel(); - if (NS_FAILED(result)) { - mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED; - return result; - } + dtd->OpenContainer(&bodyNode, eHTMLTag_body); + + // Now parse the flushed out tags. + result = BuildModel(); + if (NS_FAILED(result)) { + mFlags |= NS_PARSER_FLAG_OBSERVERS_ENABLED; + return result; } // Now that we've flushed all of the tags out of the body, we have to make