parser/html/nsHtml5TokenizerLoopPolicies.h

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

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

mercurial