Backed out 2 changesets (bug 1908320) for causing wr failures on align-items-baseline...
[gecko.git] / parser / html / nsHtml5TokenizerHSupplement.h
blob2c5321e3a570f735a4180ca901e641dc53a19d3d
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 friend struct nsHtml5ViewSourcePolicy;
6 friend struct nsHtml5LineColPolicy;
7 friend struct nsHtml5FastestPolicy;
9 private:
10 int32_t col;
11 bool nextCharOnNewLine;
13 public:
14 inline int32_t getColumnNumber() { return col; }
16 inline void setColumnNumberAndResetNextLine(int32_t aCol) {
17 col = aCol;
18 // The restored position only ever points to the position of
19 // script tag's > character, so we can unconditionally use
20 // `false` below.
21 nextCharOnNewLine = false;
24 inline nsHtml5HtmlAttributes* GetAttributes() { return attributes; }
26 /**
27 * Makes sure the buffers are large enough to be able to tokenize aLength
28 * UTF-16 code units before having to make the buffers larger.
30 * @param aLength the number of UTF-16 code units to be tokenized before the
31 * next call to this method.
32 * @return true if successful; false if out of memory
34 bool EnsureBufferSpace(int32_t aLength);
36 bool TemplatePushedOrHeadPopped();
38 void RememberGt(int32_t aPos);
40 void AtKilobyteBoundary() { suspendAfterCurrentTokenIfNotInText(); }
42 bool IsInTokenStartedAtKilobyteBoundary() {
43 return suspensionAfterCurrentNonTextTokenPending();
46 mozilla::UniquePtr<nsHtml5Highlighter> mViewSource;
48 /**
49 * Starts handling text/plain. This is a one-way initialization. There is
50 * no corresponding EndPlainText() call.
52 void StartPlainText();
54 void EnableViewSource(nsHtml5Highlighter* aHighlighter);
56 bool ShouldFlushViewSource();
58 mozilla::Result<bool, nsresult> FlushViewSource();
60 void StartViewSource(const nsAutoString& aTitle);
62 void StartViewSourceCharacters();
64 [[nodiscard]] bool EndViewSource();
66 void RewindViewSource();
68 void SetViewSourceOpSink(nsAHtml5TreeOpSink* aOpSink);
70 void errGarbageAfterLtSlash();
72 void errLtSlashGt();
74 void errWarnLtSlashInRcdata();
76 void errCharRefLacksSemicolon();
78 void errNoDigitsInNCR();
80 void errGtInSystemId();
82 void errGtInPublicId();
84 void errNamelessDoctype();
86 void errConsecutiveHyphens();
88 void errPrematureEndOfComment();
90 void errBogusComment();
92 void errUnquotedAttributeValOrNull(char16_t c);
94 void errSlashNotFollowedByGt();
96 void errNoSpaceBetweenAttributes();
98 void errLtOrEqualsOrGraveInUnquotedAttributeOrNull(char16_t c);
100 void errAttributeValueMissing();
102 void errBadCharBeforeAttributeNameOrNull(char16_t c);
104 void errEqualsSignBeforeAttributeName();
106 void errBadCharAfterLt(char16_t c);
108 void errLtGt();
110 void errProcessingInstruction();
112 void errUnescapedAmpersandInterpretedAsCharacterReference();
114 void errNotSemicolonTerminated();
116 void errNoNamedCharacterMatch();
118 void errQuoteBeforeAttributeName(char16_t c);
120 void errQuoteOrLtInAttributeNameOrNull(char16_t c);
122 void errExpectedPublicId();
124 void errBogusDoctype();
126 void maybeErrAttributesOnEndTag(nsHtml5HtmlAttributes* attrs);
128 void maybeErrSlashInEndTag(bool selfClosing);
130 char16_t errNcrNonCharacter(char16_t ch);
132 void errAstralNonCharacter(int32_t ch);
134 void errNcrSurrogate();
136 char16_t errNcrControlChar(char16_t ch);
138 void errNcrCr();
140 void errNcrInC1Range();
142 void errEofInPublicId();
144 void errEofInComment();
146 void errEofInDoctype();
148 void errEofInAttributeValue();
150 void errEofInAttributeName();
152 void errEofWithoutGt();
154 void errEofInTagName();
156 void errEofInEndTag();
158 void errEofAfterLt();
160 void errNcrOutOfRange();
162 void errNcrUnassigned();
164 void errDuplicateAttribute();
166 void errEofInSystemId();
168 void errExpectedSystemId();
170 void errMissingSpaceBeforeDoctypeName();
172 void errNestedComment();
174 void errNcrControlChar();
176 void errNcrZero();
178 void errNoSpaceBetweenDoctypeSystemKeywordAndQuote();
180 void errNoSpaceBetweenPublicAndSystemIds();
182 void errNoSpaceBetweenDoctypePublicKeywordAndQuote();