parser/html/nsHtml5TokenizerLoopPolicies.h

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 #ifndef nsHtml5TokenizerLoopPolicies_h
     6 #define nsHtml5TokenizerLoopPolicies_h
     8 /**
     9  * This policy does not report tokenizer transitions anywhere. To be used
    10  * when _not_ viewing source.
    11  */
    12 struct nsHtml5SilentPolicy
    13 {
    14   static const bool reportErrors = false;
    15   static int32_t transition(nsHtml5Highlighter* aHighlighter,
    16                             int32_t aState,
    17                             bool aReconsume,
    18                             int32_t aPos)
    19   {
    20     return aState;
    21   }
    22   static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter)
    23   {
    24   }
    25 };
    27 /**
    28  * This policy reports the tokenizer transitions to a highlighter. To be used
    29  * when viewing source.
    30  */
    31 struct nsHtml5ViewSourcePolicy
    32 {
    33   static const bool reportErrors = true;
    34   static int32_t transition(nsHtml5Highlighter* aHighlighter,
    35                             int32_t aState,
    36                             bool aReconsume,
    37                             int32_t aPos)
    38   {
    39     return aHighlighter->Transition(aState, aReconsume, aPos);
    40   }
    41   static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter)
    42   {
    43     aHighlighter->CompletedNamedCharacterReference();
    44   }
    45 };
    47 #endif // nsHtml5TokenizerLoopPolicies_h

mercurial