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:
@@ -5,43 +5,43 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsHtml5TreeOperation.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDocElementCreatedNotificationRunner.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsXBLBinding.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsIScriptElement.h"
|
||||
#include "nsIDTD.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIMutationObserver.h"
|
||||
#include "nsIFormProcessor.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsEscape.h"
|
||||
#include "mozilla/dom/Comment.h"
|
||||
#include "mozilla/dom/DocumentType.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/HTMLFormElement.h"
|
||||
#include "mozilla/dom/HTMLImageElement.h"
|
||||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
#include "nsHtml5SVGLoadDispatcher.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "nsTextNode.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsBindingManager.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDocElementCreatedNotificationRunner.h"
|
||||
#include "nsEscape.h"
|
||||
#include "nsHtml5AutoPauseUpdate.h"
|
||||
#include "nsHtml5DocumentMode.h"
|
||||
#include "nsHtml5HtmlAttributes.h"
|
||||
#include "nsHtml5SVGLoadDispatcher.h"
|
||||
#include "nsHtml5TreeBuilder.h"
|
||||
#include "nsIDTD.h"
|
||||
#include "nsIFormControl.h"
|
||||
#include "nsIFormProcessor.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIMutationObserver.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIScriptElement.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIStyleSheetLinkingElement.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsNodeUtils.h"
|
||||
#include "nsTextNode.h"
|
||||
#include "nsXBLBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@@ -51,32 +51,34 @@ static NS_DEFINE_CID(kFormProcessorCID, NS_FORMPROCESSOR_CID);
|
||||
* Helper class that opens a notification batch if the current doc
|
||||
* is different from the executor doc.
|
||||
*/
|
||||
class MOZ_STACK_CLASS nsHtml5OtherDocUpdate {
|
||||
public:
|
||||
nsHtml5OtherDocUpdate(nsIDocument* aCurrentDoc, nsIDocument* aExecutorDoc)
|
||||
{
|
||||
NS_PRECONDITION(aCurrentDoc, "Node has no doc?");
|
||||
NS_PRECONDITION(aExecutorDoc, "Executor has no doc?");
|
||||
if (MOZ_LIKELY(aCurrentDoc == aExecutorDoc)) {
|
||||
mDocument = nullptr;
|
||||
} else {
|
||||
mDocument = aCurrentDoc;
|
||||
aCurrentDoc->BeginUpdate(UPDATE_CONTENT_MODEL);
|
||||
}
|
||||
class MOZ_STACK_CLASS nsHtml5OtherDocUpdate
|
||||
{
|
||||
public:
|
||||
nsHtml5OtherDocUpdate(nsIDocument* aCurrentDoc, nsIDocument* aExecutorDoc)
|
||||
{
|
||||
NS_PRECONDITION(aCurrentDoc, "Node has no doc?");
|
||||
NS_PRECONDITION(aExecutorDoc, "Executor has no doc?");
|
||||
if (MOZ_LIKELY(aCurrentDoc == aExecutorDoc)) {
|
||||
mDocument = nullptr;
|
||||
} else {
|
||||
mDocument = aCurrentDoc;
|
||||
aCurrentDoc->BeginUpdate(UPDATE_CONTENT_MODEL);
|
||||
}
|
||||
}
|
||||
|
||||
~nsHtml5OtherDocUpdate()
|
||||
{
|
||||
if (MOZ_UNLIKELY(mDocument)) {
|
||||
mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
|
||||
}
|
||||
~nsHtml5OtherDocUpdate()
|
||||
{
|
||||
if (MOZ_UNLIKELY(mDocument)) {
|
||||
mDocument->EndUpdate(UPDATE_CONTENT_MODEL);
|
||||
}
|
||||
private:
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
}
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIDocument> mDocument;
|
||||
};
|
||||
|
||||
nsHtml5TreeOperation::nsHtml5TreeOperation()
|
||||
: mOpCode(eTreeOpUninitialized)
|
||||
: mOpCode(eTreeOpUninitialized)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHtml5TreeOperation);
|
||||
}
|
||||
@@ -85,7 +87,7 @@ nsHtml5TreeOperation::~nsHtml5TreeOperation()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsHtml5TreeOperation);
|
||||
NS_ASSERTION(mOpCode != eTreeOpUninitialized, "Uninitialized tree op.");
|
||||
switch(mOpCode) {
|
||||
switch (mOpCode) {
|
||||
case eTreeOpAddAttributes:
|
||||
delete mTwo.attributes;
|
||||
break;
|
||||
@@ -128,12 +130,7 @@ nsHtml5TreeOperation::AppendTextToTextNode(const char16_t* aBuffer,
|
||||
MOZ_ASSERT(aBuilder);
|
||||
MOZ_ASSERT(aBuilder->IsInDocUpdate());
|
||||
uint32_t oldLength = aTextNode->TextLength();
|
||||
CharacterDataChangeInfo info = {
|
||||
true,
|
||||
oldLength,
|
||||
oldLength,
|
||||
aLength
|
||||
};
|
||||
CharacterDataChangeInfo info = { true, oldLength, oldLength, aLength };
|
||||
nsNodeUtils::CharacterDataWillChange(aTextNode, info);
|
||||
|
||||
nsresult rv = aTextNode->AppendText(aBuffer, aLength, false);
|
||||
@@ -143,7 +140,6 @@ nsHtml5TreeOperation::AppendTextToTextNode(const char16_t* aBuffer,
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
nsresult
|
||||
nsHtml5TreeOperation::AppendText(const char16_t* aBuffer,
|
||||
uint32_t aLength,
|
||||
@@ -153,12 +149,8 @@ nsHtml5TreeOperation::AppendText(const char16_t* aBuffer,
|
||||
nsresult rv = NS_OK;
|
||||
nsIContent* lastChild = aParent->GetLastChild();
|
||||
if (lastChild && lastChild->IsNodeOfType(nsINode::eTEXT)) {
|
||||
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
return AppendTextToTextNode(aBuffer,
|
||||
aLength,
|
||||
lastChild,
|
||||
aBuilder);
|
||||
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(), aBuilder->GetDocument());
|
||||
return AppendTextToTextNode(aBuffer, aLength, lastChild, aBuilder);
|
||||
}
|
||||
|
||||
nsNodeInfoManager* nodeInfoManager = aParent->OwnerDoc()->NodeInfoManager();
|
||||
@@ -178,8 +170,7 @@ nsHtml5TreeOperation::Append(nsIContent* aNode,
|
||||
MOZ_ASSERT(aBuilder);
|
||||
MOZ_ASSERT(aBuilder->IsInDocUpdate());
|
||||
nsresult rv = NS_OK;
|
||||
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(), aBuilder->GetDocument());
|
||||
rv = aParent->AppendChildTo(aNode, false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aNode->SetParserHasNotified();
|
||||
@@ -211,13 +202,14 @@ nsHtml5TreeOperation::AppendToDocument(nsIContent* aNode,
|
||||
"Someone forgot to block scripts");
|
||||
if (aNode->IsElement()) {
|
||||
nsContentUtils::AddScriptRunner(
|
||||
new nsDocElementCreatedNotificationRunner(doc));
|
||||
new nsDocElementCreatedNotificationRunner(doc));
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsElementOrTemplateContent(nsINode* aNode) {
|
||||
IsElementOrTemplateContent(nsINode* aNode)
|
||||
{
|
||||
if (aNode) {
|
||||
if (aNode->IsElement()) {
|
||||
return true;
|
||||
@@ -235,7 +227,8 @@ IsElementOrTemplateContent(nsINode* aNode) {
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeOperation::Detach(nsIContent* aNode, nsHtml5DocumentBuilder* aBuilder)
|
||||
nsHtml5TreeOperation::Detach(nsIContent* aNode,
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
MOZ_ASSERT(aBuilder);
|
||||
MOZ_ASSERT(aBuilder->IsInDocUpdate());
|
||||
@@ -247,14 +240,14 @@ nsHtml5TreeOperation::Detach(nsIContent* aNode, nsHtml5DocumentBuilder* aBuilder
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHtml5TreeOperation::AppendChildrenToNewParent(nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
nsHtml5TreeOperation::AppendChildrenToNewParent(
|
||||
nsIContent* aNode,
|
||||
nsIContent* aParent,
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
MOZ_ASSERT(aBuilder);
|
||||
MOZ_ASSERT(aBuilder->IsInDocUpdate());
|
||||
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
nsHtml5OtherDocUpdate update(aParent->OwnerDoc(), aBuilder->GetDocument());
|
||||
|
||||
bool didAppend = false;
|
||||
while (aNode->HasChildren()) {
|
||||
@@ -282,8 +275,7 @@ nsHtml5TreeOperation::FosterParent(nsIContent* aNode,
|
||||
|
||||
if (IsElementOrTemplateContent(foster)) {
|
||||
|
||||
nsHtml5OtherDocUpdate update(foster->OwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
nsHtml5OtherDocUpdate update(foster->OwnerDoc(), aBuilder->GetDocument());
|
||||
|
||||
nsresult rv = foster->InsertChildBefore(aNode, aTable, false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@@ -300,16 +292,14 @@ nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
|
||||
nsHtml5DocumentBuilder* aBuilder)
|
||||
{
|
||||
dom::Element* node = aNode->AsElement();
|
||||
nsHtml5OtherDocUpdate update(node->OwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
nsHtml5OtherDocUpdate update(node->OwnerDoc(), aBuilder->GetDocument());
|
||||
|
||||
int32_t len = aAttributes->getLength();
|
||||
for (int32_t i = len; i > 0;) {
|
||||
--i;
|
||||
// prefix doesn't need regetting. it is always null or a static atom
|
||||
// local name is never null
|
||||
RefPtr<nsAtom> localName =
|
||||
Reget(aAttributes->getLocalNameNoBoundsCheck(i));
|
||||
RefPtr<nsAtom> localName = Reget(aAttributes->getLocalNameNoBoundsCheck(i));
|
||||
int32_t nsuri = aAttributes->getURINoBoundsCheck(i);
|
||||
if (!node->HasAttr(nsuri, localName)) {
|
||||
// prefix doesn't need regetting. it is always null or a static atom
|
||||
@@ -325,9 +315,10 @@ nsHtml5TreeOperation::AddAttributes(nsIContent* aNode,
|
||||
}
|
||||
|
||||
void
|
||||
nsHtml5TreeOperation::SetHTMLElementAttributes(dom::Element* aElement,
|
||||
nsAtom* aName,
|
||||
nsHtml5HtmlAttributes* aAttributes)
|
||||
nsHtml5TreeOperation::SetHTMLElementAttributes(
|
||||
dom::Element* aElement,
|
||||
nsAtom* aName,
|
||||
nsHtml5HtmlAttributes* aAttributes)
|
||||
{
|
||||
int32_t len = aAttributes->getLength();
|
||||
for (int32_t i = 0; i < len; i++) {
|
||||
@@ -350,17 +341,9 @@ nsHtml5TreeOperation::SetHTMLElementAttributes(dom::Element* aElement,
|
||||
// Remove when fixing bug 582361
|
||||
NS_ConvertUTF16toUTF8 cname(value);
|
||||
NS_ConvertUTF8toUTF16 uv(nsUnescape(cname.BeginWriting()));
|
||||
aElement->SetAttr(nsuri,
|
||||
localName,
|
||||
prefix,
|
||||
uv,
|
||||
false);
|
||||
aElement->SetAttr(nsuri, localName, prefix, uv, false);
|
||||
} else {
|
||||
aElement->SetAttr(nsuri,
|
||||
localName,
|
||||
prefix,
|
||||
value,
|
||||
false);
|
||||
aElement->SetAttr(nsuri, localName, prefix, value, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -410,8 +393,8 @@ nsHtml5TreeOperation::CreateHTMLElement(
|
||||
(aCreator == NS_NewCustomElement) ? tagAtom : isAtom;
|
||||
|
||||
MOZ_ASSERT(nodeInfo->NameAtom()->Equals(nodeInfo->LocalName()));
|
||||
definition = nsContentUtils::LookupCustomElementDefinition(document,
|
||||
nodeInfo->NameAtom(), nodeInfo->NamespaceID(), typeAtom);
|
||||
definition = nsContentUtils::LookupCustomElementDefinition(
|
||||
document, nodeInfo->NameAtom(), nodeInfo->NamespaceID(), typeAtom);
|
||||
|
||||
if (definition) {
|
||||
willExecuteScript = true;
|
||||
@@ -426,13 +409,15 @@ nsHtml5TreeOperation::CreateHTMLElement(
|
||||
{
|
||||
nsAutoMicroTask mt;
|
||||
}
|
||||
dom::AutoCEReaction
|
||||
autoCEReaction(document->GetDocGroup()->CustomElementReactionsStack(),
|
||||
nullptr);
|
||||
dom::AutoCEReaction autoCEReaction(
|
||||
document->GetDocGroup()->CustomElementReactionsStack(), nullptr);
|
||||
|
||||
nsCOMPtr<dom::Element> newElement;
|
||||
NS_NewHTMLElement(getter_AddRefs(newElement), nodeInfo.forget(),
|
||||
aFromParser, isAtom, definition);
|
||||
NS_NewHTMLElement(getter_AddRefs(newElement),
|
||||
nodeInfo.forget(),
|
||||
aFromParser,
|
||||
isAtom,
|
||||
definition);
|
||||
|
||||
MOZ_ASSERT(newElement, "Element creation created null pointer.");
|
||||
newContent = newElement;
|
||||
@@ -455,8 +440,11 @@ nsHtml5TreeOperation::CreateHTMLElement(
|
||||
nsCOMPtr<dom::Element> newElement;
|
||||
|
||||
if (isCustomElement) {
|
||||
NS_NewHTMLElement(getter_AddRefs(newElement), nodeInfo.forget(),
|
||||
aFromParser, isAtom, definition);
|
||||
NS_NewHTMLElement(getter_AddRefs(newElement),
|
||||
nodeInfo.forget(),
|
||||
aFromParser,
|
||||
isAtom,
|
||||
definition);
|
||||
} else {
|
||||
newElement = aCreator(nodeInfo.forget(), aFromParser);
|
||||
}
|
||||
@@ -484,15 +472,11 @@ nsHtml5TreeOperation::CreateHTMLElement(
|
||||
nsTArray<nsString> theContent;
|
||||
nsAutoString theAttribute;
|
||||
|
||||
(void) theFormProcessor->ProvideContent(NS_LITERAL_STRING("select"),
|
||||
theContent,
|
||||
theAttribute);
|
||||
(void)theFormProcessor->ProvideContent(
|
||||
NS_LITERAL_STRING("select"), theContent, theAttribute);
|
||||
|
||||
newContent->SetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::moztype,
|
||||
nullptr,
|
||||
theAttribute,
|
||||
false);
|
||||
newContent->SetAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::moztype, nullptr, theAttribute, false);
|
||||
|
||||
RefPtr<dom::NodeInfo> optionNodeInfo = aNodeInfoManager->GetNodeInfo(
|
||||
nsGkAtoms::option, nullptr, kNameSpaceID_XHTML, nsINode::ELEMENT_NODE);
|
||||
@@ -502,7 +486,7 @@ nsHtml5TreeOperation::CreateHTMLElement(
|
||||
nsCOMPtr<dom::Element> optionElt =
|
||||
NS_NewHTMLOptionElement(ni.forget(), aFromParser);
|
||||
RefPtr<nsTextNode> optionText = new nsTextNode(aNodeInfoManager);
|
||||
(void) optionText->SetText(theContent[i], false);
|
||||
(void)optionText->SetText(theContent[i], false);
|
||||
optionElt->AppendChildTo(optionText, false);
|
||||
newContent->AppendChildTo(optionElt, false);
|
||||
}
|
||||
@@ -646,11 +630,16 @@ void
|
||||
nsHtml5TreeOperation::SetFormElement(nsIContent* aNode, nsIContent* aParent)
|
||||
{
|
||||
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(aNode));
|
||||
RefPtr<dom::HTMLImageElement> domImageElement = dom::HTMLImageElement::FromContentOrNull(aNode);
|
||||
// NS_ASSERTION(formControl, "Form-associated element did not implement nsIFormControl.");
|
||||
// TODO: uncomment the above line when <keygen> (bug 101019) is supported by Gecko
|
||||
RefPtr<dom::HTMLFormElement> formElement = dom::HTMLFormElement::FromContentOrNull(aParent);
|
||||
NS_ASSERTION(formElement, "The form element doesn't implement HTMLFormElement.");
|
||||
RefPtr<dom::HTMLImageElement> domImageElement =
|
||||
dom::HTMLImageElement::FromContentOrNull(aNode);
|
||||
// NS_ASSERTION(formControl, "Form-associated element did not implement
|
||||
// nsIFormControl.");
|
||||
// TODO: uncomment the above line when <keygen> (bug 101019) is supported by
|
||||
// Gecko
|
||||
RefPtr<dom::HTMLFormElement> formElement =
|
||||
dom::HTMLFormElement::FromContentOrNull(aParent);
|
||||
NS_ASSERTION(formElement,
|
||||
"The form element doesn't implement HTMLFormElement.");
|
||||
// avoid crashing on <keygen>
|
||||
if (formControl &&
|
||||
!aNode->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::form)) {
|
||||
@@ -673,18 +662,15 @@ nsHtml5TreeOperation::FosterParentText(nsIContent* aStackParent,
|
||||
nsIContent* foster = aTable->GetParent();
|
||||
|
||||
if (IsElementOrTemplateContent(foster)) {
|
||||
nsHtml5OtherDocUpdate update(foster->OwnerDoc(),
|
||||
aBuilder->GetDocument());
|
||||
nsHtml5OtherDocUpdate update(foster->OwnerDoc(), aBuilder->GetDocument());
|
||||
|
||||
nsIContent* previousSibling = aTable->GetPreviousSibling();
|
||||
if (previousSibling && previousSibling->IsNodeOfType(nsINode::eTEXT)) {
|
||||
return AppendTextToTextNode(aBuffer,
|
||||
aLength,
|
||||
previousSibling,
|
||||
aBuilder);
|
||||
return AppendTextToTextNode(aBuffer, aLength, previousSibling, aBuilder);
|
||||
}
|
||||
|
||||
nsNodeInfoManager* nodeInfoManager = aStackParent->OwnerDoc()->NodeInfoManager();
|
||||
nsNodeInfoManager* nodeInfoManager =
|
||||
aStackParent->OwnerDoc()->NodeInfoManager();
|
||||
RefPtr<nsTextNode> text = new nsTextNode(nodeInfoManager);
|
||||
NS_ASSERTION(text, "Infallible malloc failed?");
|
||||
rv = text->SetText(aBuffer, aLength, false);
|
||||
@@ -736,12 +722,8 @@ nsHtml5TreeOperation::AppendDoctypeToDocument(nsAtom* aName,
|
||||
{
|
||||
// Adapted from nsXMLContentSink
|
||||
// Create a new doctype node
|
||||
RefPtr<dom::DocumentType> docType =
|
||||
NS_NewDOMDocumentType(aBuilder->GetNodeInfoManager(),
|
||||
aName,
|
||||
aPublicId,
|
||||
aSystemId,
|
||||
VoidString());
|
||||
RefPtr<dom::DocumentType> docType = NS_NewDOMDocumentType(
|
||||
aBuilder->GetNodeInfoManager(), aName, aPublicId, aSystemId, VoidString());
|
||||
return AppendToDocument(docType, aBuilder);
|
||||
}
|
||||
|
||||
@@ -755,7 +737,8 @@ nsHtml5TreeOperation::GetDocumentFragmentForTemplate(nsIContent* aNode)
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
nsHtml5TreeOperation::GetFosterParent(nsIContent* aTable, nsIContent* aStackParent)
|
||||
nsHtml5TreeOperation::GetFosterParent(nsIContent* aTable,
|
||||
nsIContent* aStackParent)
|
||||
{
|
||||
nsIContent* tableParent = aTable->GetParent();
|
||||
return IsElementOrTemplateContent(tableParent) ? tableParent : aStackParent;
|
||||
@@ -768,7 +751,8 @@ nsHtml5TreeOperation::PreventScriptExecution(nsIContent* aNode)
|
||||
if (sele) {
|
||||
sele->PreventExecution();
|
||||
} else {
|
||||
MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled, "Node didn't QI to script, but SVG wasn't disabled.");
|
||||
MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled,
|
||||
"Node didn't QI to script, but SVG wasn't disabled.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -788,8 +772,8 @@ void
|
||||
nsHtml5TreeOperation::SvgLoad(nsIContent* aNode)
|
||||
{
|
||||
nsCOMPtr<nsIRunnable> event = new nsHtml5SVGLoadDispatcher(aNode);
|
||||
if (NS_FAILED(aNode->OwnerDoc()->Dispatch(
|
||||
TaskCategory::Network, event.forget()))) {
|
||||
if (NS_FAILED(
|
||||
aNode->OwnerDoc()->Dispatch(TaskCategory::Network, event.forget()))) {
|
||||
NS_WARNING("failed to dispatch svg load dispatcher");
|
||||
}
|
||||
}
|
||||
@@ -810,7 +794,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
bool* aInterrupted,
|
||||
bool* aStreamEnded)
|
||||
{
|
||||
switch(mOpCode) {
|
||||
switch (mOpCode) {
|
||||
case eTreeOpUninitialized: {
|
||||
MOZ_CRASH("eTreeOpUninitialized");
|
||||
}
|
||||
@@ -907,9 +891,9 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
|
||||
// intendedParent == nullptr is a special case where the
|
||||
// intended parent is the document.
|
||||
nsNodeInfoManager* nodeInfoManager = intendedParent ?
|
||||
intendedParent->OwnerDoc()->NodeInfoManager() :
|
||||
aBuilder->GetNodeInfoManager();
|
||||
nsNodeInfoManager* nodeInfoManager =
|
||||
intendedParent ? intendedParent->OwnerDoc()->NodeInfoManager()
|
||||
: aBuilder->GetNodeInfoManager();
|
||||
|
||||
*target =
|
||||
CreateMathMLElement(name, attributes, nodeInfoManager, aBuilder);
|
||||
@@ -1007,7 +991,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
auto encoding = WrapNotNull(mOne.encoding);
|
||||
int32_t charsetSource = mFour.integer;
|
||||
int32_t lineNumber = mTwo.integer;
|
||||
aBuilder->NeedsCharsetSwitchTo(encoding, charsetSource, (uint32_t)lineNumber);
|
||||
aBuilder->NeedsCharsetSwitchTo(
|
||||
encoding, charsetSource, (uint32_t)lineNumber);
|
||||
return NS_OK;
|
||||
}
|
||||
case eTreeOpUpdateStyleSheet: {
|
||||
@@ -1040,7 +1025,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
if (ssle) {
|
||||
ssle->SetLineNumber(mFour.integer);
|
||||
} else {
|
||||
MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled, "Node didn't QI to style, but SVG wasn't disabled.");
|
||||
MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled,
|
||||
"Node didn't QI to style, but SVG wasn't disabled.");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1051,7 +1037,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
sele->SetScriptLineNumber(mFour.integer);
|
||||
sele->FreezeExecutionAttrs(node->OwnerDoc());
|
||||
} else {
|
||||
MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled, "Node didn't QI to script, but SVG wasn't disabled.");
|
||||
MOZ_ASSERT(nsNameSpaceManager::GetInstance()->mSVGDisabled,
|
||||
"Node didn't QI to script, but SVG wasn't disabled.");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
@@ -1124,9 +1111,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
// "view-source:". URLs that don't return data should just be returned
|
||||
// undecorated.
|
||||
bool doesNotReturnData = false;
|
||||
rv = NS_URIChainHasFlags(uri,
|
||||
nsIProtocolHandler::URI_DOES_NOT_RETURN_DATA,
|
||||
&doesNotReturnData);
|
||||
rv = NS_URIChainHasFlags(
|
||||
uri, nsIProtocolHandler::URI_DOES_NOT_RETURN_DATA, &doesNotReturnData);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
if (!doesNotReturnData) {
|
||||
viewSourceUrl.AssignLiteral("view-source:");
|
||||
@@ -1173,7 +1159,7 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
nsAutoString message;
|
||||
if (otherAtom) {
|
||||
const char16_t* params[] = { atom->GetUTF16String(),
|
||||
otherAtom->GetUTF16String() };
|
||||
otherAtom->GetUTF16String() };
|
||||
rv = nsContentUtils::FormatLocalizedString(
|
||||
nsContentUtils::eHTMLPARSER_PROPERTIES, msgId, params, message);
|
||||
NS_ENSURE_SUCCESS(rv, NS_OK);
|
||||
@@ -1208,7 +1194,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
|
||||
return NS_OK;
|
||||
}
|
||||
case eTreeOpStartLayout: {
|
||||
aBuilder->StartLayout(aInterrupted); // this causes a notification flush anyway
|
||||
aBuilder->StartLayout(
|
||||
aInterrupted); // this causes a notification flush anyway
|
||||
return NS_OK;
|
||||
}
|
||||
default: {
|
||||
|
||||
Reference in New Issue
Block a user