2009-06-29 02:44:22 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 sw=2 et tw=78: */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Communicator client code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
|
|
|
* Henri Sivonen <hsivonen@iki.fi>
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsHtml5TreeOperation.h"
|
2009-08-13 11:51:06 +04:00
|
|
|
#include "nsContentUtils.h"
|
2009-06-29 02:44:22 +04:00
|
|
|
#include "nsNodeUtils.h"
|
|
|
|
#include "nsAttrName.h"
|
|
|
|
#include "nsHtml5TreeBuilder.h"
|
2009-08-13 11:51:06 +04:00
|
|
|
#include "nsIDOMMutationEvent.h"
|
|
|
|
#include "mozAutoDocUpdate.h"
|
|
|
|
#include "nsBindingManager.h"
|
|
|
|
#include "nsXBLBinding.h"
|
2009-09-18 13:21:47 +04:00
|
|
|
#include "nsHtml5DocumentMode.h"
|
2009-09-21 15:43:43 +04:00
|
|
|
#include "nsHtml5HtmlAttributes.h"
|
|
|
|
#include "nsContentCreatorFunctions.h"
|
|
|
|
#include "nsIScriptElement.h"
|
|
|
|
#include "nsIDTD.h"
|
|
|
|
#include "nsTraceRefcnt.h"
|
|
|
|
#include "nsIDOMHTMLFormElement.h"
|
|
|
|
#include "nsIFormControl.h"
|
|
|
|
#include "nsIStyleSheetLinkingElement.h"
|
|
|
|
#include "nsIDOMDocumentType.h"
|
2009-06-29 02:44:22 +04:00
|
|
|
|
|
|
|
nsHtml5TreeOperation::nsHtml5TreeOperation()
|
2009-09-21 17:18:20 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
: mOpCode(eTreeOpUninitialized)
|
|
|
|
#endif
|
2009-06-29 02:44:22 +04:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(nsHtml5TreeOperation);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsHtml5TreeOperation::~nsHtml5TreeOperation()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(nsHtml5TreeOperation);
|
2009-09-21 17:18:20 +04:00
|
|
|
NS_ASSERTION(mOpCode != eTreeOpUninitialized, "Uninitialized tree op.");
|
2009-09-21 15:43:43 +04:00
|
|
|
switch(mOpCode) {
|
|
|
|
case eTreeOpAddAttributes:
|
|
|
|
delete mTwo.attributes;
|
|
|
|
break;
|
|
|
|
case eTreeOpCreateElement:
|
|
|
|
delete mThree.attributes;
|
|
|
|
break;
|
|
|
|
case eTreeOpCreateDoctype:
|
|
|
|
delete mTwo.stringPair;
|
|
|
|
break;
|
|
|
|
case eTreeOpCreateTextNode:
|
|
|
|
case eTreeOpCreateComment:
|
|
|
|
delete[] mTwo.unicharPtr;
|
|
|
|
break;
|
2009-09-21 17:18:20 +04:00
|
|
|
case eTreeOpSetDocumentCharset:
|
|
|
|
case eTreeOpNeedsCharsetSwitchTo:
|
|
|
|
delete[] mOne.charPtr;
|
|
|
|
break;
|
2009-09-21 15:43:43 +04:00
|
|
|
default: // keep the compiler happy
|
|
|
|
break;
|
|
|
|
}
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2009-09-18 13:21:47 +04:00
|
|
|
nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder)
|
2009-06-29 02:44:22 +04:00
|
|
|
{
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
switch(mOpCode) {
|
|
|
|
case eTreeOpAppend: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
nsIContent* parent = *(mTwo.node);
|
|
|
|
aBuilder->PostPendingAppendNotification(parent, node);
|
|
|
|
rv = parent->AppendChildTo(node, PR_FALSE);
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpDetach: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
2009-06-29 02:44:22 +04:00
|
|
|
aBuilder->FlushPendingAppendNotifications();
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* parent = node->GetParent();
|
2009-06-29 02:44:22 +04:00
|
|
|
if (parent) {
|
2009-09-21 15:43:43 +04:00
|
|
|
PRUint32 pos = parent->IndexOf(node);
|
2009-06-29 02:44:22 +04:00
|
|
|
NS_ASSERTION((pos >= 0), "Element not found as child of its parent");
|
|
|
|
rv = parent->RemoveChildAt(pos, PR_TRUE, PR_FALSE);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpAppendChildrenToNewParent: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
nsIContent* parent = *(mTwo.node);
|
2009-06-29 02:44:22 +04:00
|
|
|
aBuilder->FlushPendingAppendNotifications();
|
2009-09-21 15:43:43 +04:00
|
|
|
PRUint32 childCount = parent->GetChildCount();
|
2009-06-29 02:44:22 +04:00
|
|
|
PRBool didAppend = PR_FALSE;
|
2009-09-21 15:43:43 +04:00
|
|
|
while (node->GetChildCount()) {
|
|
|
|
nsCOMPtr<nsIContent> child = node->GetChildAt(0);
|
|
|
|
rv = node->RemoveChildAt(0, PR_TRUE, PR_FALSE);
|
2009-06-29 02:44:22 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2009-09-21 15:43:43 +04:00
|
|
|
rv = parent->AppendChildTo(child, PR_FALSE);
|
2009-06-29 02:44:22 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
didAppend = PR_TRUE;
|
|
|
|
}
|
|
|
|
if (didAppend) {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsNodeUtils::ContentAppended(parent, childCount);
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpFosterParent: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
nsIContent* parent = *(mTwo.node);
|
|
|
|
nsIContent* table = *(mThree.node);
|
|
|
|
nsIContent* foster = table->GetParent();
|
|
|
|
if (foster && foster->IsNodeOfType(nsINode::eELEMENT)) {
|
2009-06-29 02:44:22 +04:00
|
|
|
aBuilder->FlushPendingAppendNotifications();
|
2009-09-21 15:43:43 +04:00
|
|
|
PRUint32 pos = foster->IndexOf(table);
|
|
|
|
rv = foster->InsertChildAt(node, pos, PR_FALSE);
|
2009-06-29 02:44:22 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2009-09-21 15:43:43 +04:00
|
|
|
nsNodeUtils::ContentInserted(foster, node, pos);
|
2009-06-29 02:44:22 +04:00
|
|
|
} else {
|
2009-09-21 15:43:43 +04:00
|
|
|
aBuilder->PostPendingAppendNotification(parent, node);
|
|
|
|
rv = parent->AppendChildTo(node, PR_FALSE);
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpAppendToDocument: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
2009-06-29 02:44:22 +04:00
|
|
|
aBuilder->FlushPendingAppendNotifications();
|
|
|
|
nsIDocument* doc = aBuilder->GetDocument();
|
|
|
|
PRUint32 childCount = doc->GetChildCount();
|
2009-09-21 15:43:43 +04:00
|
|
|
rv = doc->AppendChildTo(node, PR_FALSE);
|
2009-06-29 02:44:22 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2009-09-21 15:43:43 +04:00
|
|
|
nsNodeUtils::ContentInserted(doc, node, childCount);
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpAddAttributes: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
nsHtml5HtmlAttributes* attributes = mTwo.attributes;
|
|
|
|
|
|
|
|
nsIDocument* document = node->GetCurrentDoc();
|
|
|
|
|
|
|
|
PRInt32 len = attributes->getLength();
|
|
|
|
for (PRInt32 i = 0; i < len; ++i) {
|
|
|
|
// prefix doesn't need regetting. it is always null or a static atom
|
|
|
|
// local name is never null
|
|
|
|
nsCOMPtr<nsIAtom> localName = Reget(attributes->getLocalName(i));
|
|
|
|
PRInt32 nsuri = attributes->getURI(i);
|
|
|
|
if (!node->HasAttr(nsuri, localName)) {
|
|
|
|
|
2009-08-13 11:51:06 +04:00
|
|
|
// the manual notification code is based on nsGenericElement
|
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
PRUint32 stateMask = PRUint32(node->IntrinsicState());
|
|
|
|
nsNodeUtils::AttributeWillChange(node,
|
2009-08-13 11:51:06 +04:00
|
|
|
nsuri,
|
|
|
|
localName,
|
|
|
|
static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION));
|
2009-09-21 15:43:43 +04:00
|
|
|
|
|
|
|
// prefix doesn't need regetting. it is always null or a static atom
|
|
|
|
// local name is never null
|
|
|
|
node->SetAttr(nsuri, localName, attributes->getPrefix(i), *(attributes->getValue(i)), PR_FALSE);
|
|
|
|
// XXX what to do with nsresult?
|
2009-08-13 11:51:06 +04:00
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
if (document || node->HasFlag(NODE_FORCE_XBL_BINDINGS)) {
|
|
|
|
nsIDocument* ownerDoc = node->GetOwnerDoc();
|
2009-08-13 11:51:06 +04:00
|
|
|
if (ownerDoc) {
|
|
|
|
nsRefPtr<nsXBLBinding> binding =
|
2009-09-21 15:43:43 +04:00
|
|
|
ownerDoc->BindingManager()->GetBinding(node);
|
2009-08-13 11:51:06 +04:00
|
|
|
if (binding) {
|
|
|
|
binding->AttributeChanged(localName, nsuri, PR_FALSE, PR_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-09-21 15:43:43 +04:00
|
|
|
stateMask ^= PRUint32(node->IntrinsicState());
|
2009-08-13 11:51:06 +04:00
|
|
|
if (stateMask && document) {
|
|
|
|
MOZ_AUTO_DOC_UPDATE(document, UPDATE_CONTENT_STATE, PR_TRUE);
|
2009-09-21 15:43:43 +04:00
|
|
|
document->ContentStatesChanged(node, nsnull, stateMask);
|
2009-08-13 11:51:06 +04:00
|
|
|
}
|
2009-09-21 15:43:43 +04:00
|
|
|
nsNodeUtils::AttributeChanged(node,
|
2009-08-13 11:51:06 +04:00
|
|
|
nsuri,
|
|
|
|
localName,
|
|
|
|
static_cast<PRUint8>(nsIDOMMutationEvent::ADDITION),
|
|
|
|
stateMask);
|
2009-06-29 02:44:22 +04:00
|
|
|
}
|
|
|
|
}
|
2009-09-21 15:43:43 +04:00
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpCreateElement: {
|
|
|
|
nsIContent** target = mOne.node;
|
|
|
|
PRInt32 ns = mInt;
|
|
|
|
nsCOMPtr<nsIAtom> name = Reget(mTwo.atom);
|
|
|
|
nsHtml5HtmlAttributes* attributes = mThree.attributes;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> newContent;
|
|
|
|
nsCOMPtr<nsINodeInfo> nodeInfo = aBuilder->GetNodeInfoManager()->GetNodeInfo(name, nsnull, ns);
|
|
|
|
NS_ASSERTION(nodeInfo, "Got null nodeinfo.");
|
|
|
|
NS_NewElement(getter_AddRefs(newContent), nodeInfo->NamespaceID(), nodeInfo, PR_TRUE);
|
|
|
|
NS_ASSERTION(newContent, "Element creation created null pointer.");
|
|
|
|
|
|
|
|
aBuilder->HoldElement(*target = newContent);
|
|
|
|
|
|
|
|
if (!attributes) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 len = attributes->getLength();
|
|
|
|
for (PRInt32 i = 0; i < len; ++i) {
|
|
|
|
// prefix doesn't need regetting. it is always null or a static atom
|
|
|
|
// local name is never null
|
|
|
|
nsCOMPtr<nsIAtom> localName = Reget(attributes->getLocalName(i));
|
|
|
|
newContent->SetAttr(attributes->getURI(i), localName, attributes->getPrefix(i), *(attributes->getValue(i)), PR_FALSE);
|
|
|
|
// XXX what to do with nsresult?
|
|
|
|
}
|
|
|
|
if (ns != kNameSpaceID_MathML && (name == nsHtml5Atoms::style || (ns == kNameSpaceID_XHTML && name == nsHtml5Atoms::link))) {
|
|
|
|
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(newContent));
|
|
|
|
if (ssle) {
|
|
|
|
ssle->InitStyleLinkElement(PR_FALSE);
|
|
|
|
ssle->SetEnableUpdates(PR_FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpSetFormElement: {
|
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
nsIContent* parent = *(mTwo.node);
|
|
|
|
nsCOMPtr<nsIFormControl> formControl(do_QueryInterface(node));
|
|
|
|
NS_ASSERTION(formControl, "Form-associated element did not implement nsIFormControl.");
|
|
|
|
nsCOMPtr<nsIDOMHTMLFormElement> formElement(do_QueryInterface(parent));
|
|
|
|
NS_ASSERTION(formElement, "The form element doesn't implement nsIDOMHTMLFormElement.");
|
|
|
|
if (formControl) { // avoid crashing on <output>
|
|
|
|
formControl->SetForm(formElement);
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpCreateTextNode: {
|
|
|
|
nsIContent** target = mOne.node;
|
|
|
|
PRUnichar* buffer = mTwo.unicharPtr;
|
|
|
|
PRInt32 length = mInt;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> text;
|
|
|
|
NS_NewTextNode(getter_AddRefs(text), aBuilder->GetNodeInfoManager());
|
|
|
|
// XXX nsresult and comment null check?
|
|
|
|
text->SetText(buffer, length, PR_FALSE);
|
|
|
|
// XXX nsresult
|
|
|
|
|
|
|
|
aBuilder->HoldNonElement(*target = text);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpCreateComment: {
|
|
|
|
nsIContent** target = mOne.node;
|
|
|
|
PRUnichar* buffer = mTwo.unicharPtr;
|
|
|
|
PRInt32 length = mInt;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContent> comment;
|
|
|
|
NS_NewCommentNode(getter_AddRefs(comment), aBuilder->GetNodeInfoManager());
|
|
|
|
// XXX nsresult and comment null check?
|
|
|
|
comment->SetText(buffer, length, PR_FALSE);
|
|
|
|
// XXX nsresult
|
|
|
|
|
|
|
|
aBuilder->HoldNonElement(*target = comment);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpCreateDoctype: {
|
|
|
|
nsCOMPtr<nsIAtom> name = Reget(mOne.atom);
|
|
|
|
nsHtml5TreeOperationStringPair* pair = mTwo.stringPair;
|
|
|
|
nsString publicId;
|
|
|
|
nsString systemId;
|
|
|
|
pair->Get(publicId, systemId);
|
|
|
|
nsIContent** target = mThree.node;
|
|
|
|
|
|
|
|
// Adapted from nsXMLContentSink
|
|
|
|
// Create a new doctype node
|
|
|
|
nsCOMPtr<nsIDOMDocumentType> docType;
|
|
|
|
nsAutoString voidString;
|
|
|
|
voidString.SetIsVoid(PR_TRUE);
|
|
|
|
NS_NewDOMDocumentType(getter_AddRefs(docType),
|
|
|
|
aBuilder->GetNodeInfoManager(),
|
|
|
|
nsnull,
|
|
|
|
name,
|
|
|
|
nsnull,
|
|
|
|
nsnull,
|
|
|
|
publicId,
|
|
|
|
systemId,
|
|
|
|
voidString);
|
|
|
|
NS_ASSERTION(docType, "Doctype creation failed.");
|
|
|
|
nsCOMPtr<nsIContent> asContent = do_QueryInterface(docType);
|
|
|
|
aBuilder->HoldNonElement(*target = asContent);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpRunScript: {
|
|
|
|
nsIContent* node = *(mOne.node);
|
2009-09-21 17:18:20 +04:00
|
|
|
nsAHtml5TreeBuilderState* snapshot = mTwo.state;
|
|
|
|
if (snapshot) {
|
|
|
|
aBuilder->InitializeDocWriteParserState(snapshot);
|
|
|
|
}
|
2009-09-21 15:43:43 +04:00
|
|
|
aBuilder->SetScriptElement(node);
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpDoneAddingChildren: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
node->DoneAddingChildren(aBuilder->HaveNotified(node));
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpDoneCreatingElement: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
node->DoneCreatingElement();
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
2009-09-21 17:18:20 +04:00
|
|
|
case eTreeOpSetDocumentCharset: {
|
|
|
|
char* str = mOne.charPtr;
|
|
|
|
nsDependentCString dependentString(str);
|
|
|
|
aBuilder->SetDocumentCharset(dependentString);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpNeedsCharsetSwitchTo: {
|
|
|
|
char* str = mOne.charPtr;
|
|
|
|
aBuilder->NeedsCharsetSwitchTo(str);
|
|
|
|
return rv;
|
|
|
|
}
|
2009-06-29 02:44:22 +04:00
|
|
|
case eTreeOpUpdateStyleSheet: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
aBuilder->UpdateStyleSheet(node);
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpProcessBase: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
rv = aBuilder->ProcessBASETag(node);
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpProcessMeta: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
rv = aBuilder->ProcessMETATag(node);
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpProcessOfflineManifest: {
|
2009-09-21 15:43:43 +04:00
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
aBuilder->ProcessOfflineManifest(node);
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
case eTreeOpMarkMalformedIfScript: {
|
|
|
|
nsIContent* node = *(mOne.node);
|
|
|
|
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(node);
|
|
|
|
if (sele) {
|
|
|
|
// Make sure to serialize this script correctly, for nice round tripping.
|
|
|
|
sele->SetIsMalformed();
|
|
|
|
}
|
2009-06-29 02:44:22 +04:00
|
|
|
return rv;
|
|
|
|
}
|
2009-09-21 17:18:20 +04:00
|
|
|
case eTreeOpStreamEnded: {
|
|
|
|
aBuilder->StreamEnded();
|
|
|
|
return rv;
|
|
|
|
}
|
2009-06-29 02:44:22 +04:00
|
|
|
case eTreeOpStartLayout: {
|
|
|
|
aBuilder->StartLayout(); // this causes a flush anyway
|
|
|
|
return rv;
|
|
|
|
}
|
2009-09-18 13:21:47 +04:00
|
|
|
case eTreeOpDocumentMode: {
|
2009-09-21 15:43:43 +04:00
|
|
|
aBuilder->DocumentMode(mOne.mode);
|
2009-09-18 13:21:47 +04:00
|
|
|
return rv;
|
|
|
|
}
|
2009-06-29 02:44:22 +04:00
|
|
|
default: {
|
|
|
|
NS_NOTREACHED("Bogus tree op");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return rv; // keep compiler happy
|
|
|
|
}
|