parser/htmlparser/src/CNavDTD.cpp

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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"
     9 #include "nsIParser.h"
    10 #include "CNavDTD.h"
    11 #include "nsIHTMLContentSink.h"
    13 NS_IMPL_ISUPPORTS(CNavDTD, nsIDTD);
    15 CNavDTD::CNavDTD()
    16 {
    17 }
    19 CNavDTD::~CNavDTD()
    20 {
    21 }
    23 NS_IMETHODIMP
    24 CNavDTD::WillBuildModel(const CParserContext& aParserContext,
    25                         nsITokenizer* aTokenizer,
    26                         nsIContentSink* aSink)
    27 {
    28   return NS_OK;
    29 }
    31 NS_IMETHODIMP
    32 CNavDTD::BuildModel(nsITokenizer* aTokenizer,
    33                     nsIContentSink* aSink)
    34 {
    35   // NB: It is important to throw STOPPARSING if the sink is the wrong type in
    36   // order to make sure nsParser cleans up properly after itself.
    37   nsCOMPtr<nsIHTMLContentSink> sink = do_QueryInterface(aSink);
    38   if (!sink) {
    39     return NS_ERROR_HTMLPARSER_STOPPARSING;
    40   }
    42   nsresult rv = sink->OpenContainer(nsIHTMLContentSink::eHTML);
    43   NS_ENSURE_SUCCESS(rv, rv);
    44   rv = sink->OpenContainer(nsIHTMLContentSink::eBody);
    45   NS_ENSURE_SUCCESS(rv, rv);
    47   rv = sink->CloseContainer(nsIHTMLContentSink::eBody);
    48   MOZ_ASSERT(NS_SUCCEEDED(rv));
    49   rv = sink->CloseContainer(nsIHTMLContentSink::eHTML);
    50   MOZ_ASSERT(NS_SUCCEEDED(rv));
    52   return NS_OK;
    53 }
    55 NS_IMETHODIMP
    56 CNavDTD::DidBuildModel(nsresult anErrorCode)
    57 {
    58   return NS_OK;
    59 }
    61 NS_IMETHODIMP_(void)
    62 CNavDTD::Terminate()
    63 {
    64 }
    67 NS_IMETHODIMP_(int32_t) 
    68 CNavDTD::GetType() 
    69 { 
    70   return NS_IPARSER_FLAG_HTML; 
    71 }
    73 NS_IMETHODIMP_(nsDTDMode)
    74 CNavDTD::GetMode() const
    75 {
    76   return eDTDMode_quirks;
    77 }
    79 NS_IMETHODIMP_(bool)
    80 CNavDTD::CanContain(int32_t aParent,int32_t aChild) const
    81 {
    82   MOZ_CRASH("nobody calls this");
    83   return false;
    84 }
    86 NS_IMETHODIMP_(bool)
    87 CNavDTD::IsContainer(int32_t aTag) const
    88 {
    89   MOZ_CRASH("nobody calls this");
    90   return false;
    91 }

mercurial