/src/mozilla-central/parser/html/nsHtml5TokenizerLoopPolicies.h
Line | Count | Source (jump to first uncovered line) |
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/. */ |
4 | | |
5 | | #ifndef nsHtml5TokenizerLoopPolicies_h |
6 | | #define nsHtml5TokenizerLoopPolicies_h |
7 | | |
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 | 0 | { |
20 | 0 | return aState; |
21 | 0 | } |
22 | | static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter) |
23 | 0 | { |
24 | 0 | } |
25 | | }; |
26 | | |
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 | 0 | { |
39 | 0 | return aHighlighter->Transition(aState, aReconsume, aPos); |
40 | 0 | } |
41 | | static void completedNamedCharacterReference(nsHtml5Highlighter* aHighlighter) |
42 | 0 | { |
43 | 0 | aHighlighter->CompletedNamedCharacterReference(); |
44 | 0 | } |
45 | | }; |
46 | | |
47 | | #endif // nsHtml5TokenizerLoopPolicies_h |