Bug 569538 - Make aFromParser distinguish network, document.write and fragments in the HTML case. r=Olli.Pettay.

--HG--
extra : rebase_source : 2f4804245ff7b235736b882e0f9e84403e4e0ae6
This commit is contained in:
Henri Sivonen 2010-06-09 09:44:25 +03:00
Родитель 5d9a735086
Коммит d938851670
36 изменённых файлов: 89 добавлений и 62 удалений

Просмотреть файл

@ -56,9 +56,17 @@ class imgIRequest;
class nsNodeInfoManager;
class nsGenericHTMLElement;
/**
* Constants for passing as aFromParser
*/
#define NS_NOT_FROM_PARSER 0
#define NS_FROM_PARSER_NETWORK 1
#define NS_FROM_PARSER_DOCUMENT_WRITE (1 << 1)
#define NS_FROM_PARSER_FRAGMENT (1 << 2)
nsresult
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
nsINodeInfo* aNodeInfo, PRBool aFromParser);
nsINodeInfo* aNodeInfo, PRUint32 aFromParser);
nsresult
NS_NewXMLElement(nsIContent** aResult, nsINodeInfo* aNodeInfo);
@ -101,13 +109,13 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
nsresult
NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser);
PRUint32 aFromParser);
// First argument should be nsHTMLTag, but that adds dependency to parser
// for a bunch of files.
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(PRUint32 aNodeType, nsINodeInfo *aNodeInfo,
PRBool aFromParser);
PRUint32 aFromParser);
#ifdef MOZ_MATHML
nsresult
@ -122,7 +130,7 @@ NS_NewXULElement(nsIContent** aResult, nsINodeInfo* aNodeInfo);
#ifdef MOZ_SVG
nsresult
NS_NewSVGElement(nsIContent** aResult, nsINodeInfo* aNodeInfo,
PRBool aFromParser);
PRUint32 aFromParser);
#endif
nsresult

Просмотреть файл

@ -691,8 +691,8 @@ public:
*
* If you also need to determine whether the parser is the one creating your
* element (through createElement() or cloneNode() generally) then add a
* boolean aFromParser to the NS_NewXXX() constructor for your element and
* have the parser pass true. See nsHTMLInputElement.cpp and
* PRUint32 aFromParser to the NS_NewXXX() constructor for your element and
* have the parser pass the appropriate flags. See nsHTMLInputElement.cpp and
* nsHTMLContentSink::MakeContentObject().
*
* DO NOT USE THIS METHOD to get around the fact that it's hard to deal with

Просмотреть файл

@ -227,7 +227,7 @@ NameSpaceManagerImpl::GetNameSpaceID(const nsAString& aURI)
nsresult
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
nsINodeInfo* aNodeInfo, PRBool aFromParser)
nsINodeInfo* aNodeInfo, PRUint32 aFromParser)
{
if (aElementType == kNameSpaceID_XHTML) {
return NS_NewHTMLElement(aResult, aNodeInfo, aFromParser);

Просмотреть файл

@ -50,7 +50,7 @@ class nsHTMLAudioElement : public nsHTMLMediaElement,
public nsIJSNativeInitializer
{
public:
nsHTMLAudioElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
nsHTMLAudioElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser = 0);
virtual ~nsHTMLAudioElement();
// nsISupports

Просмотреть файл

@ -67,7 +67,7 @@ public:
CANPLAY_YES
};
nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = 0);
virtual ~nsHTMLMediaElement();
/**

Просмотреть файл

@ -45,7 +45,7 @@ class nsHTMLVideoElement : public nsHTMLMediaElement,
public nsIDOMHTMLVideoElement
{
public:
nsHTMLVideoElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
nsHTMLVideoElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser = 0);
virtual ~nsHTMLVideoElement();
// nsISupports

Просмотреть файл

@ -966,14 +966,14 @@ protected:
*/
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)\
{ \
return new nsHTML##_elementName##Element(aNodeInfo); \
}
#define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)\
{ \
return new nsHTML##_elementName##Element(aNodeInfo, aFromParser); \
}
@ -1305,12 +1305,12 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
#define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \
PRBool aFromParser = PR_FALSE);
PRUint32 aFromParser = 0);
#define NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(_elementName) \
inline nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \
PRBool aFromParser = PR_FALSE) \
PRUint32 aFromParser = 0) \
{ \
return NS_NewHTMLSharedElement(aNodeInfo, aFromParser); \
}

Просмотреть файл

@ -68,7 +68,7 @@
#include "nsHTMLMediaError.h"
nsGenericHTMLElement*
NS_NewHTMLAudioElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
NS_NewHTMLAudioElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
{
/*
* nsHTMLAudioElement's will be created without a nsINodeInfo passed in
@ -104,7 +104,7 @@ NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLAudioElement)
NS_IMPL_ELEMENT_CLONE(nsHTMLAudioElement)
nsHTMLAudioElement::nsHTMLAudioElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
nsHTMLAudioElement::nsHTMLAudioElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
{
}

Просмотреть файл

@ -56,7 +56,7 @@ using namespace mozilla;
using namespace mozilla::layers;
nsGenericHTMLElement*
NS_NewHTMLCanvasElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
NS_NewHTMLCanvasElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
{
return new nsHTMLCanvasElement(aNodeInfo);
}

Просмотреть файл

@ -210,7 +210,7 @@ ShouldBeInElements(nsIFormControl* aFormControl)
// construction, destruction
nsGenericHTMLElement*
NS_NewHTMLFormElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
NS_NewHTMLFormElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
{
nsHTMLFormElement* it = new nsHTMLFormElement(aNodeInfo);
if (!it) {

Просмотреть файл

@ -156,7 +156,7 @@ protected:
};
nsGenericHTMLElement*
NS_NewHTMLImageElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
NS_NewHTMLImageElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
{
/*
* nsHTMLImageElement's will be created without a nsINodeInfo passed in

Просмотреть файл

@ -244,7 +244,7 @@ class nsHTMLInputElement : public nsGenericHTMLFormElement,
public nsIFileControlElement
{
public:
nsHTMLInputElement(nsINodeInfo *aNodeInfo, PRBool aFromParser);
nsHTMLInputElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser);
virtual ~nsHTMLInputElement();
// nsISupports
@ -543,7 +543,7 @@ static nsresult FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Input)
nsHTMLInputElement::nsHTMLInputElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mType(kInputDefaultType->value),
mBitField(0)

Просмотреть файл

@ -945,7 +945,7 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMuted(PRBool aMuted)
return NS_OK;
}
nsHTMLMediaElement::nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
nsHTMLMediaElement::nsHTMLMediaElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
: nsGenericHTMLElement(aNodeInfo),
mCurrentLoadID(0),
mNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY),

Просмотреть файл

@ -59,7 +59,7 @@ class nsHTMLObjectElement : public nsGenericHTMLFormElement,
#endif
{
public:
nsHTMLObjectElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
nsHTMLObjectElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser = 0);
virtual ~nsHTMLObjectElement();
// nsISupports
@ -144,7 +144,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Object)
nsHTMLObjectElement::nsHTMLObjectElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mIsDoneAddingChildren(!aFromParser)
{

Просмотреть файл

@ -138,7 +138,7 @@ protected:
};
nsGenericHTMLElement*
NS_NewHTMLOptionElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
NS_NewHTMLOptionElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
{
/*
* nsHTMLOptionElement's will be created without a nsINodeInfo passed in

Просмотреть файл

@ -309,7 +309,7 @@ class nsHTMLScriptElement : public nsGenericHTMLElement,
public nsScriptElement
{
public:
nsHTMLScriptElement(nsINodeInfo *aNodeInfo, PRBool aFromParser);
nsHTMLScriptElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser);
virtual ~nsHTMLScriptElement();
// nsISupports
@ -362,7 +362,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Script)
nsHTMLScriptElement::nsHTMLScriptElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
: nsGenericHTMLElement(aNodeInfo)
{
mDoneAddingChildren = !aFromParser;

Просмотреть файл

@ -134,7 +134,7 @@ nsSafeOptionListMutation::~nsSafeOptionListMutation()
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Select)
nsHTMLSelectElement::nsHTMLSelectElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mOptions(new nsHTMLOptionCollection(this)),
mIsDoneAddingChildren(!aFromParser),

Просмотреть файл

@ -244,7 +244,7 @@ class nsHTMLSelectElement : public nsGenericHTMLFormElement,
public nsISelectElement
{
public:
nsHTMLSelectElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
nsHTMLSelectElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser = 0);
virtual ~nsHTMLSelectElement();
// nsISupports

Просмотреть файл

@ -67,7 +67,7 @@ class nsHTMLSharedObjectElement : public nsGenericHTMLElement,
{
public:
nsHTMLSharedObjectElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser = PR_FALSE);
PRUint32 aFromParser = 0);
virtual ~nsHTMLSharedObjectElement();
// nsISupports
@ -173,7 +173,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(SharedObject)
nsHTMLSharedObjectElement::nsHTMLSharedObjectElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
: nsGenericHTMLElement(aNodeInfo),
mIsDoneAddingChildren(aNodeInfo->Equals(nsGkAtoms::embed) || !aFromParser)
{

Просмотреть файл

@ -91,7 +91,7 @@ class nsHTMLTextAreaElement : public nsGenericHTMLFormElement,
public nsStubMutationObserver
{
public:
nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser = 0);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -244,7 +244,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mValueChanged(PR_FALSE),
mHandlingSelect(PR_FALSE),

Просмотреть файл

@ -100,7 +100,7 @@ NS_IMETHODIMP nsHTMLVideoElement::GetVideoHeight(PRUint32 *aVideoHeight)
return NS_OK;
}
nsHTMLVideoElement::nsHTMLVideoElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
nsHTMLVideoElement::nsHTMLVideoElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
{
}

Просмотреть файл

@ -138,10 +138,10 @@ static PRLogModuleInfo* gSinkLogModuleInfo;
//----------------------------------------------------------------------
typedef nsGenericHTMLElement* (*contentCreatorCallback)(nsINodeInfo*, PRBool aFromParser);
typedef nsGenericHTMLElement* (*contentCreatorCallback)(nsINodeInfo*, PRUint32 aFromParser);
nsGenericHTMLElement*
NS_NewHTMLNOTUSEDElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
NS_NewHTMLNOTUSEDElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser)
{
NS_NOTREACHED("The element ctor should never be called");
return nsnull;
@ -557,7 +557,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
nsresult
NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
{
*aResult = nsnull;
@ -578,7 +578,7 @@ NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(PRUint32 aNodeType, nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
{
NS_ASSERTION(aNodeType <= NS_HTML_TAG_MAX ||
aNodeType == eHTMLTag_userdefined,

Просмотреть файл

@ -424,7 +424,7 @@ NS_NewSVG##_elementName##Element(nsIContent **aResult, \
nsresult \
NS_NewSVG##_elementName##Element(nsIContent **aResult, \
nsINodeInfo *aNodeInfo, \
PRBool aFromParser) \
PRUint32 aFromParser) \
{ \
nsRefPtr<nsSVG##_elementName##Element> it = \
new nsSVG##_elementName##Element(aNodeInfo, aFromParser); \

Просмотреть файл

@ -67,7 +67,7 @@ nsresult
NS_NewSVGGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGSVGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser);
PRUint32 aFromParser);
nsresult
NS_NewSVGForeignObjectElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
@ -94,7 +94,7 @@ nsresult
NS_NewSVGDescElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGScriptElement(nsIContent **aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser);
PRUint32 aFromParser);
nsresult
NS_NewSVGUseElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
@ -179,7 +179,7 @@ NS_NewSVGSetElement(nsIContent **aResult, nsINodeInfo *aNodeInfo);
nsresult
NS_NewSVGElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
{
NS_PRECONDITION(NS_SVGEnabled(),
"creating an SVG element while SVG disabled");

Просмотреть файл

@ -193,7 +193,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGSVGElementBase)
//----------------------------------------------------------------------
// Implementation
nsSVGSVGElement::nsSVGSVGElement(nsINodeInfo* aNodeInfo, PRBool aFromParser)
nsSVGSVGElement::nsSVGSVGElement(nsINodeInfo* aNodeInfo, PRUint32 aFromParser)
: nsSVGSVGElementBase(aNodeInfo),
mCoordCtx(nsnull),
mViewportWidth(0),

Просмотреть файл

@ -133,8 +133,8 @@ class nsSVGSVGElement : public nsSVGSVGElementBase,
protected:
friend nsresult NS_NewSVGSVGElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo,
PRBool aFromParser);
nsSVGSVGElement(nsINodeInfo* aNodeInfo, PRBool aFromParser);
PRUint32 aFromParser);
nsSVGSVGElement(nsINodeInfo* aNodeInfo, PRUint32 aFromParser);
public:

Просмотреть файл

@ -59,8 +59,8 @@ class nsSVGScriptElement : public nsSVGScriptElementBase,
protected:
friend nsresult NS_NewSVGScriptElement(nsIContent **aResult,
nsINodeInfo *aNodeInfo,
PRBool aFromParser);
nsSVGScriptElement(nsINodeInfo *aNodeInfo, PRBool aFromParser);
PRUint32 aFromParser);
nsSVGScriptElement(nsINodeInfo *aNodeInfo, PRUint32 aFromParser);
public:
// interfaces:
@ -131,7 +131,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGScriptElementBase)
// Implementation
nsSVGScriptElement::nsSVGScriptElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
PRUint32 aFromParser)
: nsSVGScriptElementBase(aNodeInfo)
{
mDoneAddingChildren = !aFromParser;

Просмотреть файл

@ -56,7 +56,7 @@ class nsINodeInfo;
nsresult
NS_NewSVGSVGElement(nsIContent **aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser);
PRUint32 aFromParser);
typedef nsSVGGraphicElement nsSVGUseElementBase;

Просмотреть файл

@ -871,7 +871,7 @@ nsresult
nsXBLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser)
PRUint32 aFromParser)
{
#ifdef MOZ_XUL
if (!aNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) {

Просмотреть файл

@ -124,7 +124,7 @@ protected:
nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser);
PRUint32 aFromParser);
nsresult AddAttributes(const PRUnichar** aAtts,
nsIContent* aContent);

Просмотреть файл

@ -503,7 +503,7 @@ nsresult
nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser)
PRUint32 aFromParser)
{
NS_ASSERTION(aNodeInfo, "can't create element without nodeinfo");

Просмотреть файл

@ -137,7 +137,7 @@ protected:
virtual nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser);
PRUint32 aFromParser);
// aParent is allowed to be null here if this is the root content
// being closed

Просмотреть файл

@ -117,7 +117,7 @@ protected:
virtual nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser);
PRUint32 aFromParser);
virtual nsresult CloseElement(nsIContent* aContent);
virtual void MaybeStartLayout(PRBool aIgnorePendingSheets);
@ -259,7 +259,7 @@ nsresult
nsXMLFragmentContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRBool aFromParser)
PRUint32 aFromParser)
{
// Claim to not be coming from parser, since we don't do any of the
// fancy CloseElement stuff.

Просмотреть файл

@ -91,7 +91,13 @@ nsHtml5TreeBuilder::createElement(PRInt32 aNamespace, nsIAtom* aName, nsHtml5Htm
nsIContent** content = AllocateContentHandle();
nsHtml5TreeOperation* treeOp = mOpQueue.AppendElement();
NS_ASSERTION(treeOp, "Tree op allocation failed.");
treeOp->Init(aNamespace, aName, aAttributes, content);
treeOp->Init(aNamespace,
aName,
aAttributes,
content,
!!mSpeculativeLoadStage);
// mSpeculativeLoadStage is non-null only in the off-the-main-thread
// tree builder, which handles the network stream
// Start wall of code for speculative loading and line numbers

Просмотреть файл

@ -107,7 +107,8 @@ nsHtml5TreeOperation::~nsHtml5TreeOperation()
case eTreeOpAddAttributes:
delete mTwo.attributes;
break;
case eTreeOpCreateElement:
case eTreeOpCreateElementNetwork:
case eTreeOpCreateElementNotNetwork:
delete mThree.attributes;
break;
case eTreeOpAppendDoctypeToDocument:
@ -362,7 +363,8 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
return rv;
}
case eTreeOpCreateElement: {
case eTreeOpCreateElementNetwork:
case eTreeOpCreateElementNotNetwork: {
nsIContent** target = mOne.node;
PRInt32 ns = mInt;
nsCOMPtr<nsIAtom> name = Reget(mTwo.atom);
@ -376,7 +378,14 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
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_NewElement(getter_AddRefs(newContent),
nodeInfo->NamespaceID(),
nodeInfo,
(mOpCode == eTreeOpCreateElementNetwork ?
NS_FROM_PARSER_NETWORK
: (aBuilder->IsFragmentMode() ?
NS_FROM_PARSER_FRAGMENT :
NS_FROM_PARSER_DOCUMENT_WRITE)));
NS_ASSERTION(newContent, "Element creation created null pointer.");
aBuilder->HoldElement(*target = newContent);

Просмотреть файл

@ -58,7 +58,8 @@ enum eHtml5TreeOperation {
eTreeOpAppendToDocument,
eTreeOpAddAttributes,
eTreeOpDocumentMode,
eTreeOpCreateElement,
eTreeOpCreateElementNetwork,
eTreeOpCreateElementNotNetwork,
eTreeOpSetFormElement,
eTreeOpAppendText,
eTreeOpFosterParentText,
@ -179,12 +180,15 @@ class nsHtml5TreeOperation {
inline void Init(PRInt32 aNamespace,
nsIAtom* aName,
nsHtml5HtmlAttributes* aAttributes,
nsIContent** aTarget) {
nsIContent** aTarget,
PRBool aFromNetwork) {
NS_PRECONDITION(mOpCode == eTreeOpUninitialized,
"Op code must be uninitialized when initializing.");
NS_PRECONDITION(aName, "Initialized tree op with null name.");
NS_PRECONDITION(aTarget, "Initialized tree op with null target node.");
mOpCode = eTreeOpCreateElement;
mOpCode = aFromNetwork ?
eTreeOpCreateElementNetwork :
eTreeOpCreateElementNotNetwork;
mInt = aNamespace;
mOne.node = aTarget;
mTwo.atom = aName;