Bug 1446097. Switch to "set" as the canonical nsGkAtoms name of the string "set", so it matches the actual tag name "set" in SVG. r=hsivonen,njn

Most of the noise is from the fact that clang-format on parser/html/*.{h,cpp}
reformatted all sorts of stuff.  Not running it caused lots of format changes
from the generator... I guess we changed the format rules since the last time
this got run?

MozReview-Commit-ID: IA2G87zUIKN
This commit is contained in:
Boris Zbarsky
2018-03-16 11:26:06 -04:00
parent 4f8ec3af2d
commit 051041fc49
80 changed files with 12758 additions and 5466 deletions

View File

@@ -9,10 +9,10 @@
#include "mozilla/AutoRestore.h"
#include "nsCRT.h"
#include "nsContentUtils.h" // for kLoadAsData
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"
#include "nsHtml5AtomTable.h"
#include "nsHtml5DependentUTF16Buffer.h"
#include "nsHtml5Tokenizer.h"
#include "nsHtml5TreeBuilder.h"
#include "nsNetUtil.h"
NS_INTERFACE_TABLE_HEAD(nsHtml5Parser)
@@ -73,7 +73,7 @@ nsHtml5Parser::SetContentSink(nsIContentSink* aSink)
NS_IMETHODIMP_(nsIContentSink*)
nsHtml5Parser::GetContentSink()
{
return static_cast<nsIContentSink*> (mExecutor);
return static_cast<nsIContentSink*>(mExecutor);
}
NS_IMETHODIMP_(void)
@@ -85,11 +85,9 @@ nsHtml5Parser::GetCommand(nsCString& aCommand)
NS_IMETHODIMP_(void)
nsHtml5Parser::SetCommand(const char* aCommand)
{
NS_ASSERTION(!strcmp(aCommand, "view") ||
!strcmp(aCommand, "view-source") ||
!strcmp(aCommand, "external-resource") ||
!strcmp(aCommand, "import") ||
!strcmp(aCommand, kLoadAsData),
NS_ASSERTION(!strcmp(aCommand, "view") || !strcmp(aCommand, "view-source") ||
!strcmp(aCommand, "external-resource") ||
!strcmp(aCommand, "import") || !strcmp(aCommand, kLoadAsData),
"Unsupported parser command");
}
@@ -104,9 +102,9 @@ void
nsHtml5Parser::SetDocumentCharset(NotNull<const Encoding*> aEncoding,
int32_t aCharsetSource)
{
NS_PRECONDITION(!mExecutor->HasStarted(),
"Document charset set too late.");
NS_PRECONDITION(GetStreamParser(), "Setting charset on a script-only parser.");
NS_PRECONDITION(!mExecutor->HasStarted(), "Document charset set too late.");
NS_PRECONDITION(GetStreamParser(),
"Setting charset on a script-only parser.");
GetStreamParser()->SetDocumentCharset(aEncoding, aCharsetSource);
mExecutor->SetDocumentCharsetAndSource(aEncoding, aCharsetSource);
}
@@ -182,7 +180,7 @@ nsHtml5Parser::IsComplete()
NS_IMETHODIMP
nsHtml5Parser::Parse(nsIURI* aURL,
nsIRequestObserver* aObserver,
void* aKey, // legacy; ignored
void* aKey, // legacy; ignored
nsDTDMode aMode) // legacy; ignored
{
/*
@@ -399,7 +397,7 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
}
if (mTreeBuilder->HasScript()) {
mTreeBuilder->Flush(); // Move ops to the executor
mTreeBuilder->Flush(); // Move ops to the executor
rv = executor->FlushDocumentWrite(); // run the ops
NS_ENSURE_SUCCESS(rv, rv);
// Flushing tree ops can cause all sorts of things.
@@ -428,12 +426,12 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
// aKey case and we have something to swap into firstLevelMarker in the
// null aKey case.
if (aKey) {
NS_ASSERTION(mFirstBuffer != mLastBuffer,
"Where's the keyholder?");
NS_ASSERTION(mFirstBuffer != mLastBuffer, "Where's the keyholder?");
// the key holder is still somewhere further down the list from
// prevSearchBuf (which may be null)
if (mFirstBuffer->key == aKey) {
NS_ASSERTION(!prevSearchBuf,
NS_ASSERTION(
!prevSearchBuf,
"Non-null prevSearchBuf when mFirstBuffer is the key holder?");
heapBuffer->next = mFirstBuffer;
mFirstBuffer = heapBuffer;
@@ -457,9 +455,9 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
if (!mBlocked) { // buffer was tokenized to completion
NS_ASSERTION(!stackBuffer.hasMore(),
"Buffer wasn't tokenized to completion?");
"Buffer wasn't tokenized to completion?");
// Scripting semantics require a forced tree builder flush here
mTreeBuilder->Flush(); // Move ops to the executor
mTreeBuilder->Flush(); // Move ops to the executor
rv = executor->FlushDocumentWrite(); // run the ops
NS_ENSURE_SUCCESS(rv, rv);
} else if (stackBuffer.hasMore()) {
@@ -471,11 +469,11 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
if (!mDocWriteSpeculativeTreeBuilder) {
// Lazily initialize if uninitialized
mDocWriteSpeculativeTreeBuilder =
new nsHtml5TreeBuilder(nullptr, executor->GetStage());
new nsHtml5TreeBuilder(nullptr, executor->GetStage());
mDocWriteSpeculativeTreeBuilder->setScriptingEnabled(
mTreeBuilder->isScriptingEnabled());
mTreeBuilder->isScriptingEnabled());
mDocWriteSpeculativeTokenizer =
new nsHtml5Tokenizer(mDocWriteSpeculativeTreeBuilder, false);
new nsHtml5Tokenizer(mDocWriteSpeculativeTreeBuilder, false);
mDocWriteSpeculativeTokenizer->setInterner(&mAtomTable);
mDocWriteSpeculativeTokenizer->start();
}
@@ -497,11 +495,11 @@ nsHtml5Parser::Parse(const nsAString& aSourceBuffer,
stackBuffer.adjust(mDocWriteSpeculativeLastWasCR);
if (stackBuffer.hasMore()) {
if (!mDocWriteSpeculativeTokenizer->EnsureBufferSpace(
stackBuffer.getLength())) {
stackBuffer.getLength())) {
return executor->MarkAsBroken(NS_ERROR_OUT_OF_MEMORY);
}
mDocWriteSpeculativeLastWasCR =
mDocWriteSpeculativeTokenizer->tokenizeBuffer(&stackBuffer);
mDocWriteSpeculativeTokenizer->tokenizeBuffer(&stackBuffer);
nsresult rv;
if (NS_FAILED((rv = mDocWriteSpeculativeTreeBuilder->IsBroken()))) {
return executor->MarkAsBroken(rv);
@@ -601,8 +599,8 @@ nsHtml5Parser::MarkAsNotScriptCreated(const char* aCommand)
#ifdef DEBUG
else {
NS_ASSERTION(!nsCRT::strcmp(aCommand, "view") ||
!nsCRT::strcmp(aCommand, "external-resource") ||
!nsCRT::strcmp(aCommand, "import"),
!nsCRT::strcmp(aCommand, "external-resource") ||
!nsCRT::strcmp(aCommand, "import"),
"Unsupported parser command!");
}
#endif
@@ -624,12 +622,13 @@ nsHtml5Parser::ParseUntilBlocked()
{
nsresult rv = mExecutor->IsBroken();
NS_ENSURE_SUCCESS(rv, rv);
if (mBlocked || mInsertionPointPermanentlyUndefined || mExecutor->IsComplete()) {
if (mBlocked || mInsertionPointPermanentlyUndefined ||
mExecutor->IsComplete()) {
return NS_OK;
}
NS_ASSERTION(mExecutor->HasStarted(), "Bad life cycle.");
NS_ASSERTION(!mInDocumentWrite,
"ParseUntilBlocked entered while in doc.write!");
"ParseUntilBlocked entered while in doc.write!");
mDocWriteSpeculatorActive = false;
@@ -669,9 +668,8 @@ nsHtml5Parser::ParseUntilBlocked()
!mExecutor->IsScriptExecuting()) {
mTreeBuilder->Flush();
mReturnToStreamParserPermitted = false;
GetStreamParser()->ContinueAfterScripts(mTokenizer,
mTreeBuilder,
mLastWasCR);
GetStreamParser()->ContinueAfterScripts(
mTokenizer, mTreeBuilder, mLastWasCR);
}
} else {
// Script-created parser
@@ -679,7 +677,7 @@ nsHtml5Parser::ParseUntilBlocked()
// No need to flush the executor, because the executor is already
// in a flush
NS_ASSERTION(mExecutor->IsInFlushLoop(),
"How did we come here without being in the flush loop?");
"How did we come here without being in the flush loop?");
}
return NS_OK; // no more data for now but expecting more
}
@@ -732,7 +730,8 @@ nsHtml5Parser::Initialize(nsIDocument* aDoc,
}
void
nsHtml5Parser::StartTokenizer(bool aScriptingEnabled) {
nsHtml5Parser::StartTokenizer(bool aScriptingEnabled)
{
bool isSrcdoc = false;
nsCOMPtr<nsIChannel> channel;
@@ -761,8 +760,8 @@ nsHtml5Parser::InitializeDocWriteParserState(nsAHtml5TreeBuilderState* aState,
void
nsHtml5Parser::ContinueAfterFailedCharsetSwitch()
{
NS_PRECONDITION(GetStreamParser(),
NS_PRECONDITION(
GetStreamParser(),
"Tried to continue after failed charset switch without a stream parser");
GetStreamParser()->ContinueAfterFailedCharsetSwitch();
}