parser/html/nsHtml5TokenizerCppSupplement.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.

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 #include "mozilla/Likely.h"
michael@0 6
michael@0 7 void
michael@0 8 nsHtml5Tokenizer::StartPlainText()
michael@0 9 {
michael@0 10 stateSave = NS_HTML5TOKENIZER_PLAINTEXT;
michael@0 11 }
michael@0 12
michael@0 13 void
michael@0 14 nsHtml5Tokenizer::EnableViewSource(nsHtml5Highlighter* aHighlighter)
michael@0 15 {
michael@0 16 mViewSource = aHighlighter;
michael@0 17 }
michael@0 18
michael@0 19 bool
michael@0 20 nsHtml5Tokenizer::FlushViewSource()
michael@0 21 {
michael@0 22 return mViewSource->FlushOps();
michael@0 23 }
michael@0 24
michael@0 25 void
michael@0 26 nsHtml5Tokenizer::StartViewSource(const nsAutoString& aTitle)
michael@0 27 {
michael@0 28 mViewSource->Start(aTitle);
michael@0 29 }
michael@0 30
michael@0 31 void
michael@0 32 nsHtml5Tokenizer::EndViewSource()
michael@0 33 {
michael@0 34 mViewSource->End();
michael@0 35 }
michael@0 36
michael@0 37 void
michael@0 38 nsHtml5Tokenizer::errWarnLtSlashInRcdata()
michael@0 39 {
michael@0 40 }
michael@0 41
michael@0 42 // The null checks below annotated MOZ_LIKELY are not actually necessary.
michael@0 43
michael@0 44 void
michael@0 45 nsHtml5Tokenizer::errUnquotedAttributeValOrNull(char16_t c)
michael@0 46 {
michael@0 47 if (MOZ_LIKELY(mViewSource)) {
michael@0 48 switch (c) {
michael@0 49 case '<':
michael@0 50 mViewSource->AddErrorToCurrentNode("errUnquotedAttributeLt");
michael@0 51 return;
michael@0 52 case '`':
michael@0 53 mViewSource->AddErrorToCurrentNode("errUnquotedAttributeGrave");
michael@0 54 return;
michael@0 55 case '\'':
michael@0 56 case '"':
michael@0 57 mViewSource->AddErrorToCurrentNode("errUnquotedAttributeQuote");
michael@0 58 return;
michael@0 59 case '=':
michael@0 60 mViewSource->AddErrorToCurrentNode("errUnquotedAttributeEquals");
michael@0 61 return;
michael@0 62 }
michael@0 63 }
michael@0 64 }
michael@0 65
michael@0 66 void
michael@0 67 nsHtml5Tokenizer::errLtOrEqualsOrGraveInUnquotedAttributeOrNull(char16_t c)
michael@0 68 {
michael@0 69 if (MOZ_LIKELY(mViewSource)) {
michael@0 70 switch (c) {
michael@0 71 case '=':
michael@0 72 mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartEquals");
michael@0 73 return;
michael@0 74 case '<':
michael@0 75 mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartLt");
michael@0 76 return;
michael@0 77 case '`':
michael@0 78 mViewSource->AddErrorToCurrentNode("errUnquotedAttributeStartGrave");
michael@0 79 return;
michael@0 80 }
michael@0 81 }
michael@0 82 }
michael@0 83
michael@0 84 void
michael@0 85 nsHtml5Tokenizer::errBadCharBeforeAttributeNameOrNull(char16_t c)
michael@0 86 {
michael@0 87 if (MOZ_LIKELY(mViewSource)) {
michael@0 88 if (c == '<') {
michael@0 89 mViewSource->AddErrorToCurrentNode("errBadCharBeforeAttributeNameLt");
michael@0 90 } else if (c == '=') {
michael@0 91 errEqualsSignBeforeAttributeName();
michael@0 92 } else if (c != 0xFFFD) {
michael@0 93 errQuoteBeforeAttributeName(c);
michael@0 94 }
michael@0 95 }
michael@0 96 }
michael@0 97
michael@0 98 void
michael@0 99 nsHtml5Tokenizer::errBadCharAfterLt(char16_t c)
michael@0 100 {
michael@0 101 if (MOZ_LIKELY(mViewSource)) {
michael@0 102 mViewSource->AddErrorToCurrentNode("errBadCharAfterLt");
michael@0 103 }
michael@0 104 }
michael@0 105
michael@0 106 void
michael@0 107 nsHtml5Tokenizer::errQuoteOrLtInAttributeNameOrNull(char16_t c)
michael@0 108 {
michael@0 109 if (MOZ_LIKELY(mViewSource)) {
michael@0 110 if (c == '<') {
michael@0 111 mViewSource->AddErrorToCurrentNode("errLtInAttributeName");
michael@0 112 } else if (c != 0xFFFD) {
michael@0 113 mViewSource->AddErrorToCurrentNode("errQuoteInAttributeName");
michael@0 114 }
michael@0 115 }
michael@0 116 }
michael@0 117
michael@0 118 void
michael@0 119 nsHtml5Tokenizer::maybeErrAttributesOnEndTag(nsHtml5HtmlAttributes* attrs)
michael@0 120 {
michael@0 121 if (mViewSource && attrs->getLength() != 0) {
michael@0 122 /*
michael@0 123 * When an end tag token is emitted with attributes, that is a parse
michael@0 124 * error.
michael@0 125 */
michael@0 126 mViewSource->AddErrorToCurrentRun("maybeErrAttributesOnEndTag");
michael@0 127 }
michael@0 128 }
michael@0 129
michael@0 130 void
michael@0 131 nsHtml5Tokenizer::maybeErrSlashInEndTag(bool selfClosing)
michael@0 132 {
michael@0 133 if (mViewSource && selfClosing && endTag) {
michael@0 134 mViewSource->AddErrorToCurrentSlash("maybeErrSlashInEndTag");
michael@0 135 }
michael@0 136 }
michael@0 137
michael@0 138 char16_t
michael@0 139 nsHtml5Tokenizer::errNcrNonCharacter(char16_t ch)
michael@0 140 {
michael@0 141 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 142 mViewSource->AddErrorToCurrentNode("errNcrNonCharacter");
michael@0 143 }
michael@0 144 return ch;
michael@0 145 }
michael@0 146
michael@0 147 void
michael@0 148 nsHtml5Tokenizer::errAstralNonCharacter(int32_t ch)
michael@0 149 {
michael@0 150 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 151 mViewSource->AddErrorToCurrentNode("errNcrNonCharacter");
michael@0 152 }
michael@0 153 }
michael@0 154
michael@0 155 char16_t
michael@0 156 nsHtml5Tokenizer::errNcrControlChar(char16_t ch)
michael@0 157 {
michael@0 158 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 159 mViewSource->AddErrorToCurrentNode("errNcrControlChar");
michael@0 160 }
michael@0 161 return ch;
michael@0 162 }
michael@0 163
michael@0 164 void
michael@0 165 nsHtml5Tokenizer::errGarbageAfterLtSlash()
michael@0 166 {
michael@0 167 if (MOZ_LIKELY(mViewSource)) {
michael@0 168 mViewSource->AddErrorToCurrentNode("errGarbageAfterLtSlash");
michael@0 169 }
michael@0 170 }
michael@0 171
michael@0 172 void
michael@0 173 nsHtml5Tokenizer::errLtSlashGt()
michael@0 174 {
michael@0 175 if (MOZ_LIKELY(mViewSource)) {
michael@0 176 mViewSource->AddErrorToCurrentNode("errLtSlashGt");
michael@0 177 }
michael@0 178 }
michael@0 179
michael@0 180 void
michael@0 181 nsHtml5Tokenizer::errCharRefLacksSemicolon()
michael@0 182 {
michael@0 183 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 184 mViewSource->AddErrorToCurrentNode("errCharRefLacksSemicolon");
michael@0 185 }
michael@0 186 }
michael@0 187
michael@0 188 void
michael@0 189 nsHtml5Tokenizer::errNoDigitsInNCR()
michael@0 190 {
michael@0 191 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 192 mViewSource->AddErrorToCurrentNode("errNoDigitsInNCR");
michael@0 193 }
michael@0 194 }
michael@0 195
michael@0 196 void
michael@0 197 nsHtml5Tokenizer::errGtInSystemId()
michael@0 198 {
michael@0 199 if (MOZ_LIKELY(mViewSource)) {
michael@0 200 mViewSource->AddErrorToCurrentNode("errGtInSystemId");
michael@0 201 }
michael@0 202 }
michael@0 203
michael@0 204 void
michael@0 205 nsHtml5Tokenizer::errGtInPublicId()
michael@0 206 {
michael@0 207 if (MOZ_LIKELY(mViewSource)) {
michael@0 208 mViewSource->AddErrorToCurrentNode("errGtInPublicId");
michael@0 209 }
michael@0 210 }
michael@0 211
michael@0 212 void
michael@0 213 nsHtml5Tokenizer::errNamelessDoctype()
michael@0 214 {
michael@0 215 if (MOZ_LIKELY(mViewSource)) {
michael@0 216 mViewSource->AddErrorToCurrentNode("errNamelessDoctype");
michael@0 217 }
michael@0 218 }
michael@0 219
michael@0 220 void
michael@0 221 nsHtml5Tokenizer::errConsecutiveHyphens()
michael@0 222 {
michael@0 223 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 224 mViewSource->AddErrorToCurrentNode("errConsecutiveHyphens");
michael@0 225 }
michael@0 226 }
michael@0 227
michael@0 228 void
michael@0 229 nsHtml5Tokenizer::errPrematureEndOfComment()
michael@0 230 {
michael@0 231 if (MOZ_LIKELY(mViewSource)) {
michael@0 232 mViewSource->AddErrorToCurrentNode("errPrematureEndOfComment");
michael@0 233 }
michael@0 234 }
michael@0 235
michael@0 236 void
michael@0 237 nsHtml5Tokenizer::errBogusComment()
michael@0 238 {
michael@0 239 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 240 mViewSource->AddErrorToCurrentNode("errBogusComment");
michael@0 241 }
michael@0 242 }
michael@0 243
michael@0 244 void
michael@0 245 nsHtml5Tokenizer::errSlashNotFollowedByGt()
michael@0 246 {
michael@0 247 if (MOZ_LIKELY(mViewSource)) {
michael@0 248 mViewSource->AddErrorToCurrentSlash("errSlashNotFollowedByGt");
michael@0 249 }
michael@0 250 }
michael@0 251
michael@0 252 void
michael@0 253 nsHtml5Tokenizer::errNoSpaceBetweenAttributes()
michael@0 254 {
michael@0 255 if (MOZ_LIKELY(mViewSource)) {
michael@0 256 mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenAttributes");
michael@0 257 }
michael@0 258 }
michael@0 259
michael@0 260 void
michael@0 261 nsHtml5Tokenizer::errAttributeValueMissing()
michael@0 262 {
michael@0 263 if (MOZ_LIKELY(mViewSource)) {
michael@0 264 mViewSource->AddErrorToCurrentNode("errAttributeValueMissing");
michael@0 265 }
michael@0 266 }
michael@0 267
michael@0 268 void
michael@0 269 nsHtml5Tokenizer::errEqualsSignBeforeAttributeName()
michael@0 270 {
michael@0 271 if (MOZ_LIKELY(mViewSource)) {
michael@0 272 mViewSource->AddErrorToCurrentNode("errEqualsSignBeforeAttributeName");
michael@0 273 }
michael@0 274 }
michael@0 275
michael@0 276 void
michael@0 277 nsHtml5Tokenizer::errLtGt()
michael@0 278 {
michael@0 279 if (MOZ_LIKELY(mViewSource)) {
michael@0 280 mViewSource->AddErrorToCurrentNode("errLtGt");
michael@0 281 }
michael@0 282 }
michael@0 283
michael@0 284 void
michael@0 285 nsHtml5Tokenizer::errProcessingInstruction()
michael@0 286 {
michael@0 287 if (MOZ_LIKELY(mViewSource)) {
michael@0 288 mViewSource->AddErrorToCurrentNode("errProcessingInstruction");
michael@0 289 }
michael@0 290 }
michael@0 291
michael@0 292 void
michael@0 293 nsHtml5Tokenizer::errUnescapedAmpersandInterpretedAsCharacterReference()
michael@0 294 {
michael@0 295 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 296 mViewSource->AddErrorToCurrentAmpersand("errUnescapedAmpersandInterpretedAsCharacterReference");
michael@0 297 }
michael@0 298 }
michael@0 299
michael@0 300 void
michael@0 301 nsHtml5Tokenizer::errNotSemicolonTerminated()
michael@0 302 {
michael@0 303 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 304 mViewSource->AddErrorToCurrentNode("errNotSemicolonTerminated");
michael@0 305 }
michael@0 306 }
michael@0 307
michael@0 308 void
michael@0 309 nsHtml5Tokenizer::errNoNamedCharacterMatch()
michael@0 310 {
michael@0 311 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 312 mViewSource->AddErrorToCurrentAmpersand("errNoNamedCharacterMatch");
michael@0 313 }
michael@0 314 }
michael@0 315
michael@0 316 void
michael@0 317 nsHtml5Tokenizer::errQuoteBeforeAttributeName(char16_t c)
michael@0 318 {
michael@0 319 if (MOZ_LIKELY(mViewSource)) {
michael@0 320 mViewSource->AddErrorToCurrentNode("errQuoteBeforeAttributeName");
michael@0 321 }
michael@0 322 }
michael@0 323
michael@0 324 void
michael@0 325 nsHtml5Tokenizer::errExpectedPublicId()
michael@0 326 {
michael@0 327 if (MOZ_LIKELY(mViewSource)) {
michael@0 328 mViewSource->AddErrorToCurrentNode("errExpectedPublicId");
michael@0 329 }
michael@0 330 }
michael@0 331
michael@0 332 void
michael@0 333 nsHtml5Tokenizer::errBogusDoctype()
michael@0 334 {
michael@0 335 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 336 mViewSource->AddErrorToCurrentNode("errBogusDoctype");
michael@0 337 }
michael@0 338 }
michael@0 339
michael@0 340 void
michael@0 341 nsHtml5Tokenizer::errNcrSurrogate()
michael@0 342 {
michael@0 343 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 344 mViewSource->AddErrorToCurrentNode("errNcrSurrogate");
michael@0 345 }
michael@0 346 }
michael@0 347
michael@0 348 void
michael@0 349 nsHtml5Tokenizer::errNcrCr()
michael@0 350 {
michael@0 351 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 352 mViewSource->AddErrorToCurrentNode("errNcrCr");
michael@0 353 }
michael@0 354 }
michael@0 355
michael@0 356 void
michael@0 357 nsHtml5Tokenizer::errNcrInC1Range()
michael@0 358 {
michael@0 359 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 360 mViewSource->AddErrorToCurrentNode("errNcrInC1Range");
michael@0 361 }
michael@0 362 }
michael@0 363
michael@0 364 void
michael@0 365 nsHtml5Tokenizer::errEofInPublicId()
michael@0 366 {
michael@0 367 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 368 mViewSource->AddErrorToCurrentRun("errEofInPublicId");
michael@0 369 }
michael@0 370 }
michael@0 371
michael@0 372 void
michael@0 373 nsHtml5Tokenizer::errEofInComment()
michael@0 374 {
michael@0 375 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 376 mViewSource->AddErrorToCurrentRun("errEofInComment");
michael@0 377 }
michael@0 378 }
michael@0 379
michael@0 380 void
michael@0 381 nsHtml5Tokenizer::errEofInDoctype()
michael@0 382 {
michael@0 383 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 384 mViewSource->AddErrorToCurrentRun("errEofInDoctype");
michael@0 385 }
michael@0 386 }
michael@0 387
michael@0 388 void
michael@0 389 nsHtml5Tokenizer::errEofInAttributeValue()
michael@0 390 {
michael@0 391 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 392 mViewSource->AddErrorToCurrentRun("errEofInAttributeValue");
michael@0 393 }
michael@0 394 }
michael@0 395
michael@0 396 void
michael@0 397 nsHtml5Tokenizer::errEofInAttributeName()
michael@0 398 {
michael@0 399 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 400 mViewSource->AddErrorToCurrentRun("errEofInAttributeName");
michael@0 401 }
michael@0 402 }
michael@0 403
michael@0 404 void
michael@0 405 nsHtml5Tokenizer::errEofWithoutGt()
michael@0 406 {
michael@0 407 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 408 mViewSource->AddErrorToCurrentRun("errEofWithoutGt");
michael@0 409 }
michael@0 410 }
michael@0 411
michael@0 412 void
michael@0 413 nsHtml5Tokenizer::errEofInTagName()
michael@0 414 {
michael@0 415 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 416 mViewSource->AddErrorToCurrentRun("errEofInTagName");
michael@0 417 }
michael@0 418 }
michael@0 419
michael@0 420 void
michael@0 421 nsHtml5Tokenizer::errEofInEndTag()
michael@0 422 {
michael@0 423 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 424 mViewSource->AddErrorToCurrentRun("errEofInEndTag");
michael@0 425 }
michael@0 426 }
michael@0 427
michael@0 428 void
michael@0 429 nsHtml5Tokenizer::errEofAfterLt()
michael@0 430 {
michael@0 431 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 432 mViewSource->AddErrorToCurrentRun("errEofAfterLt");
michael@0 433 }
michael@0 434 }
michael@0 435
michael@0 436 void
michael@0 437 nsHtml5Tokenizer::errNcrOutOfRange()
michael@0 438 {
michael@0 439 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 440 mViewSource->AddErrorToCurrentNode("errNcrOutOfRange");
michael@0 441 }
michael@0 442 }
michael@0 443
michael@0 444 void
michael@0 445 nsHtml5Tokenizer::errNcrUnassigned()
michael@0 446 {
michael@0 447 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 448 mViewSource->AddErrorToCurrentNode("errNcrUnassigned");
michael@0 449 }
michael@0 450 }
michael@0 451
michael@0 452 void
michael@0 453 nsHtml5Tokenizer::errDuplicateAttribute()
michael@0 454 {
michael@0 455 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 456 mViewSource->AddErrorToCurrentNode("errDuplicateAttribute");
michael@0 457 }
michael@0 458 }
michael@0 459
michael@0 460 void
michael@0 461 nsHtml5Tokenizer::errEofInSystemId()
michael@0 462 {
michael@0 463 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 464 mViewSource->AddErrorToCurrentRun("errEofInSystemId");
michael@0 465 }
michael@0 466 }
michael@0 467
michael@0 468 void
michael@0 469 nsHtml5Tokenizer::errExpectedSystemId()
michael@0 470 {
michael@0 471 if (MOZ_LIKELY(mViewSource)) {
michael@0 472 mViewSource->AddErrorToCurrentNode("errExpectedSystemId");
michael@0 473 }
michael@0 474 }
michael@0 475
michael@0 476 void
michael@0 477 nsHtml5Tokenizer::errMissingSpaceBeforeDoctypeName()
michael@0 478 {
michael@0 479 if (MOZ_LIKELY(mViewSource)) {
michael@0 480 mViewSource->AddErrorToCurrentNode("errMissingSpaceBeforeDoctypeName");
michael@0 481 }
michael@0 482 }
michael@0 483
michael@0 484 void
michael@0 485 nsHtml5Tokenizer::errHyphenHyphenBang()
michael@0 486 {
michael@0 487 if (MOZ_LIKELY(mViewSource)) {
michael@0 488 mViewSource->AddErrorToCurrentNode("errHyphenHyphenBang");
michael@0 489 }
michael@0 490 }
michael@0 491
michael@0 492 void
michael@0 493 nsHtml5Tokenizer::errNcrControlChar()
michael@0 494 {
michael@0 495 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 496 mViewSource->AddErrorToCurrentNode("errNcrControlChar");
michael@0 497 }
michael@0 498 }
michael@0 499
michael@0 500 void
michael@0 501 nsHtml5Tokenizer::errNcrZero()
michael@0 502 {
michael@0 503 if (MOZ_UNLIKELY(mViewSource)) {
michael@0 504 mViewSource->AddErrorToCurrentNode("errNcrZero");
michael@0 505 }
michael@0 506 }
michael@0 507
michael@0 508 void
michael@0 509 nsHtml5Tokenizer::errNoSpaceBetweenDoctypeSystemKeywordAndQuote()
michael@0 510 {
michael@0 511 if (MOZ_LIKELY(mViewSource)) {
michael@0 512 mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypeSystemKeywordAndQuote");
michael@0 513 }
michael@0 514 }
michael@0 515
michael@0 516 void
michael@0 517 nsHtml5Tokenizer::errNoSpaceBetweenPublicAndSystemIds()
michael@0 518 {
michael@0 519 if (MOZ_LIKELY(mViewSource)) {
michael@0 520 mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenPublicAndSystemIds");
michael@0 521 }
michael@0 522 }
michael@0 523
michael@0 524 void
michael@0 525 nsHtml5Tokenizer::errNoSpaceBetweenDoctypePublicKeywordAndQuote()
michael@0 526 {
michael@0 527 if (MOZ_LIKELY(mViewSource)) {
michael@0 528 mViewSource->AddErrorToCurrentNode("errNoSpaceBetweenDoctypePublicKeywordAndQuote");
michael@0 529 }
michael@0 530 }

mercurial