Bug 594339 - Create a FromParser enum. r=hsivonen, sr=bzbarsky, a=jonas.

--HG--
extra : rebase_source : 70d6b15b0b149a29d0cdb298209706bb5391f6b4
This commit is contained in:
Ms2ger 2010-10-25 15:17:38 +03:00
parent 589b725c55
commit a495819ba2
55 changed files with 279 additions and 173 deletions

View File

@ -0,0 +1,56 @@
/* ***** 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.org code.
*
* The Initial Developer of the Original Code is
* Ms2ger <Ms2ger@gmail.com>.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 ***** */
#ifndef mozilla_dom_FromParser_h
#define mozilla_dom_FromParser_h
namespace mozilla {
namespace dom {
/**
* Constants for passing as aFromParser
*/
enum FromParser {
NOT_FROM_PARSER = 0,
FROM_PARSER_NETWORK = 1,
FROM_PARSER_DOCUMENT_WRITE = 1 << 1,
FROM_PARSER_FRAGMENT = 1 << 2
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_FromParser_h

View File

@ -84,8 +84,9 @@ $(NULL)
EXPORTS_NAMESPACES = mozilla/dom
EXPORTS_mozilla/dom = \
Element.h \
$(NULL)
Element.h \
FromParser.h \
$(NULL)
ifndef DISABLE_XFORMS_HOOKS
EXPORTS += nsIXFormsUtilityService.h

View File

@ -42,6 +42,7 @@
#include "nscore.h"
#include "nsCOMPtr.h"
#include "mozilla/dom/FromParser.h"
/**
* Functions to create content, to be used only inside Gecko
@ -56,17 +57,10 @@ 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,
already_AddRefed<nsINodeInfo> aNodeInfo, PRUint32 aFromParser);
already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
nsresult
NS_NewXMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo);
@ -109,13 +103,13 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
nsresult
NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
// First argument should be nsHTMLTag, but that adds dependency to parser
// for a bunch of files.
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(PRUint32 aNodeType, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
#ifdef MOZ_MATHML
nsresult
@ -134,7 +128,7 @@ NS_TrustedNewXULElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNod
#ifdef MOZ_SVG
nsresult
NS_NewSVGElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
#endif
nsresult

View File

@ -58,7 +58,7 @@ class nsIScriptElement : public nsIScriptLoaderObserver {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTELEMENT_IID)
nsIScriptElement(PRUint32 aFromParser)
nsIScriptElement(mozilla::dom::FromParser aFromParser)
: mLineNumber(0),
mAlreadyStarted(PR_FALSE),
mMalformed(PR_FALSE),
@ -66,7 +66,7 @@ public:
mFrozen(PR_FALSE),
mDefer(PR_FALSE),
mAsync(PR_FALSE),
mParserCreated((PRUint8)aFromParser),
mParserCreated(aFromParser),
mCreatorParser(nsnull)
{
}
@ -120,10 +120,9 @@ public:
}
/**
* Returns a constant defined in nsContentCreatorFunctions.h. Non-zero
* values mean parser-created and zero means not parser-created.
* Returns how the element was created.
*/
PRUint32 GetParserCreated()
mozilla::dom::FromParser GetParserCreated()
{
return mParserCreated;
}
@ -156,7 +155,7 @@ public:
mFrozen = PR_FALSE;
mUri = nsnull;
mCreatorParser = nsnull;
mParserCreated = NS_NOT_FROM_PARSER;
mParserCreated = mozilla::dom::NOT_FROM_PARSER;
}
void SetCreatorParser(nsIParser* aParser)
@ -234,7 +233,7 @@ protected:
/**
* Whether this element was parser-created.
*/
PRUint8 mParserCreated;
mozilla::dom::FromParser mParserCreated;
/**
* The effective src (or null if no src).

View File

@ -4371,7 +4371,8 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
nsCOMPtr<nsIContent> content;
PRInt32 ns = nodeInfo->NamespaceID();
rv = NS_NewElement(getter_AddRefs(content), ns, nodeInfo.forget(), PR_FALSE);
rv = NS_NewElement(getter_AddRefs(content), ns, nodeInfo.forget(),
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(content, aReturn);
@ -6848,7 +6849,8 @@ nsDocument::CreateElem(const nsAString& aName, nsIAtom *aPrefix, PRInt32 aNamesp
getter_AddRefs(nodeInfo));
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
return NS_NewElement(aResult, elementType, nodeInfo.forget(), PR_FALSE);
return NS_NewElement(aResult, elementType, nodeInfo.forget(),
NOT_FROM_PARSER);
}
PRBool

View File

@ -57,6 +57,8 @@
static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#endif
using namespace mozilla::dom;
#ifdef MOZ_SVG
PRBool NS_SVGEnabled();
#endif
@ -227,7 +229,7 @@ NameSpaceManagerImpl::GetNameSpaceID(const nsAString& aURI)
nsresult
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
already_AddRefed<nsINodeInfo> aNodeInfo, PRUint32 aFromParser)
already_AddRefed<nsINodeInfo> aNodeInfo, FromParser aFromParser)
{
if (aElementType == kNameSpaceID_XHTML) {
return NS_NewHTMLElement(aResult, aNodeInfo, aFromParser);

View File

@ -59,7 +59,7 @@ public:
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
nsScriptElement(PRUint32 aFromParser)
nsScriptElement(mozilla::dom::FromParser aFromParser)
: nsIScriptElement(aFromParser)
{
}

View File

@ -595,7 +595,7 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
// The request has already been loaded and there are no pending style
// sheets. If the script comes from the network stream, cheat for
// performance reasons and avoid a trip through the event loop.
if (aElement->GetParserCreated() == NS_FROM_PARSER_NETWORK) {
if (aElement->GetParserCreated() == FROM_PARSER_NETWORK) {
return ProcessRequest(request);
}
// Otherwise, we've got a document.written script, make a trip through
@ -641,14 +641,14 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
request->mURI = mDocument->GetDocumentURI();
request->mLineNo = aElement->GetScriptLineNumber();
if (aElement->GetParserCreated() == NS_NOT_FROM_PARSER) {
if (aElement->GetParserCreated() == NOT_FROM_PARSER) {
NS_ASSERTION(!nsContentUtils::IsSafeToRunScript(),
"A script-inserted script is inserted without an update batch?");
nsContentUtils::AddScriptRunner(new nsScriptRequestProcessor(this,
request));
return NS_OK;
}
if (aElement->GetParserCreated() == NS_FROM_PARSER_NETWORK &&
if (aElement->GetParserCreated() == FROM_PARSER_NETWORK &&
!ReadyToExecuteScripts()) {
NS_ASSERTION(!mParserBlockingRequest,
"There can be only one parser-blocking script at a time");

View File

@ -51,7 +51,7 @@ class nsHTMLAudioElement : public nsHTMLMediaElement,
{
public:
nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLAudioElement();
// nsISupports

View File

@ -71,7 +71,7 @@ public:
};
nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLMediaElement();
/**

View File

@ -46,7 +46,7 @@ class nsHTMLVideoElement : public nsHTMLMediaElement,
{
public:
nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLVideoElement();
// nsISupports

View File

@ -987,10 +987,10 @@ class nsGenericHTMLFrameElement : public nsGenericHTMLElement,
{
public:
nsGenericHTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
mozilla::dom::FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo)
{
mNetworkCreated = aFromParser == NS_FROM_PARSER_NETWORK;
mNetworkCreated = aFromParser == mozilla::dom::FROM_PARSER_NETWORK;
}
virtual ~nsGenericHTMLFrameElement();
@ -1045,25 +1045,6 @@ protected:
//----------------------------------------------------------------------
/**
* A macro to implement the NS_NewHTMLXXXElement() functions.
*/
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<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(already_AddRefed<nsINodeInfo> aNodeInfo, \
PRUint32 aFromParser) \
{ \
return new nsHTML##_elementName##Element(aNodeInfo, aFromParser); \
}
/**
* A macro to implement the getter and setter for a given string
* valued content property. The method uses the generic GetAttr and
@ -1073,12 +1054,12 @@ NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
NS_IMETHODIMP \
_class::Get##_method(nsAString& aValue) \
{ \
return GetAttrHelper(nsGkAtoms::_atom, aValue); \
return GetAttrHelper(nsGkAtoms::_atom, aValue); \
} \
NS_IMETHODIMP \
_class::Set##_method(const nsAString& aValue) \
{ \
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
return SetAttrHelper(nsGkAtoms::_atom, aValue); \
}
/**
@ -1430,26 +1411,46 @@ NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
NS_OFFSET_AND_INTERFACE_TABLE_END
// Element class factory methods
/**
* A macro to declare the NS_NewHTMLXXXElement() functions.
*/
#define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
#define NS_DECLARE_NS_NEW_HTML_ELEMENT_AS_SHARED(_elementName) \
inline nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
PRUint32 aFromParser = 0) \
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER) \
{ \
return NS_NewHTMLSharedElement(aNodeInfo, aFromParser); \
}
/**
* A macro to implement the NS_NewHTMLXXXElement() functions.
*/
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
mozilla::dom::FromParser aFromParser) \
{ \
return new nsHTML##_elementName##Element(aNodeInfo); \
}
#define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName) \
nsGenericHTMLElement* \
NS_NewHTML##_elementName##Element(already_AddRefed<nsINodeInfo> aNodeInfo, \
mozilla::dom::FromParser aFromParser) \
{ \
return new nsHTML##_elementName##Element(aNodeInfo, aFromParser); \
}
// Here, we expand 'NS_DECLARE_NS_NEW_HTML_ELEMENT()' by hand.
// (Calling the macro directly (with no args) produces compiler warnings.)
nsGenericHTMLElement*
NS_NewHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)

View File

@ -68,9 +68,11 @@
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMProgressEvent.h"
using namespace mozilla::dom;
nsGenericHTMLElement*
NS_NewHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
/*
* nsHTMLAudioElement's will be created without a nsINodeInfo passed in
@ -107,7 +109,7 @@ NS_IMPL_ELEMENT_CLONE(nsHTMLAudioElement)
nsHTMLAudioElement::nsHTMLAudioElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
{
}

View File

@ -56,11 +56,12 @@
#define DEFAULT_CANVAS_HEIGHT 150
using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
nsGenericHTMLElement*
NS_NewHTMLCanvasElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
return new nsHTMLCanvasElement(aNodeInfo);
}

View File

@ -38,6 +38,7 @@
#include "nsGenericHTMLElement.h"
#include "nsIDOMHTMLElement.h"
using namespace mozilla::dom;
class nsHTMLElement : public nsGenericHTMLElement,
public nsIDOMHTMLElement
@ -69,7 +70,7 @@ public:
// (Calling the macro directly (with no args) produces compiler warnings.)
nsGenericHTMLElement*
NS_NewHTMLElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
return new nsHTMLElement(aNodeInfo);
}

View File

@ -85,6 +85,8 @@
#include "nsIDOMHTMLButtonElement.h"
using namespace mozilla::dom;
static const int NS_FORM_CONTROL_LIST_HASHTABLE_SIZE = 16;
static const PRUint8 NS_FORM_AUTOCOMPLETE_ON = 1;
@ -234,12 +236,9 @@ ShouldBeInElements(nsIFormControl* aFormControl)
// construction, destruction
nsGenericHTMLElement*
NS_NewHTMLFormElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
nsHTMLFormElement* it = new nsHTMLFormElement(aNodeInfo);
if (!it) {
return nsnull;
}
nsresult rv = it->Init();

View File

@ -41,13 +41,14 @@
#include "nsIDOMDocument.h"
#include "nsDOMError.h"
using namespace mozilla::dom;
class nsHTMLFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLFrameElement
{
public:
nsHTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = NS_NOT_FROM_PARSER);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLFrameElement();
// nsISupports
@ -81,7 +82,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Frame)
nsHTMLFrameElement::nsHTMLFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
{
}

View File

@ -48,15 +48,17 @@
#include "nsRuleData.h"
#include "nsStyleConsts.h"
class nsHTMLIFrameElement : public nsGenericHTMLFrameElement,
public nsIDOMHTMLIFrameElement
using namespace mozilla::dom;
class nsHTMLIFrameElement : public nsGenericHTMLFrameElement
, public nsIDOMHTMLIFrameElement
#ifdef MOZ_SVG
, public nsIDOMGetSVGDocument
, public nsIDOMGetSVGDocument
#endif
{
public:
nsHTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = NS_NOT_FROM_PARSER);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLIFrameElement();
// nsISupports
@ -96,7 +98,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(IFrame)
nsHTMLIFrameElement::nsHTMLIFrameElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFrameElement(aNodeInfo, aFromParser)
{
}

View File

@ -76,6 +76,8 @@
#include "nsLayoutUtils.h"
using namespace mozilla::dom;
// XXX nav attrs: suppress
class nsHTMLImageElement : public nsGenericHTMLElement,
@ -154,7 +156,7 @@ protected:
nsGenericHTMLElement*
NS_NewHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
/*
* nsHTMLImageElement's will be created without a nsINodeInfo passed in

View File

@ -127,6 +127,8 @@
#include "nsHTMLInputElement.h"
using namespace mozilla::dom;
// XXX align=left, hspace, vspace, border? other nav4 attrs
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
@ -612,14 +614,14 @@ static nsresult FireEventForAccessibility(nsIDOMHTMLInputElement* aTarget,
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Input)
nsHTMLInputElement::nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mType(kInputDefaultType->value),
mBitField(0)
{
SET_BOOLBIT(mBitField, BF_PARSER_CREATING, aFromParser);
SET_BOOLBIT(mBitField, BF_INHIBIT_RESTORATION,
aFromParser & NS_FROM_PARSER_FRAGMENT);
aFromParser & mozilla::dom::FROM_PARSER_FRAGMENT);
mInputData.mState = new nsTextEditorState(this);
NS_ADDREF(mInputData.mState);
@ -702,10 +704,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
*aResult = nsnull;
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsHTMLInputElement *it = new nsHTMLInputElement(ni.forget(), PR_FALSE);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsHTMLInputElement *it = new nsHTMLInputElement(ni.forget(), NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it);

View File

@ -123,7 +123,7 @@ public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLInputElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
virtual ~nsHTMLInputElement();
// nsISupports

View File

@ -121,6 +121,7 @@ static PRLogModuleInfo* gMediaElementEventsLog;
#include "nsIChannelPolicy.h"
#include "nsChannelPolicy.h"
using namespace mozilla::dom;
using namespace mozilla::layers;
// Under certain conditions there may be no-one holding references to
@ -1265,7 +1266,7 @@ NS_IMETHODIMP nsHTMLMediaElement::SetMuted(PRBool aMuted)
}
nsHTMLMediaElement::nsHTMLMediaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo),
mCurrentLoadID(0),
mNetworkState(nsIDOMHTMLMediaElement::NETWORK_EMPTY),

View File

@ -52,20 +52,21 @@
#include "nsIPluginInstance.h"
#include "nsIConstraintValidation.h"
using namespace mozilla::dom;
class nsHTMLObjectElement : public nsGenericHTMLFormElement,
public nsObjectLoadingContent,
public nsIDOMHTMLObjectElement,
public nsIConstraintValidation
class nsHTMLObjectElement : public nsGenericHTMLFormElement
, public nsObjectLoadingContent
, public nsIDOMHTMLObjectElement
, public nsIConstraintValidation
#ifdef MOZ_SVG
, public nsIDOMGetSVGDocument
, public nsIDOMGetSVGDocument
#endif
{
public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLObjectElement();
// nsISupports
@ -158,12 +159,12 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Object)
nsHTMLObjectElement::nsHTMLObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mIsDoneAddingChildren(!aFromParser)
{
RegisterFreezableElement();
SetIsNetworkCreated(aFromParser == NS_FROM_PARSER_NETWORK);
SetIsNetworkCreated(aFromParser == FROM_PARSER_NETWORK);
// <object> is always barred from constraint validation.
SetBarredFromConstraintValidation(PR_TRUE);

View File

@ -66,13 +66,15 @@
#include "nsContentCreatorFunctions.h"
#include "mozAutoDocUpdate.h"
using namespace mozilla::dom;
/**
* Implementation of &lt;option&gt;
*/
nsGenericHTMLElement*
NS_NewHTMLOptionElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
/*
* nsHTMLOptionElement's will be created without a nsINodeInfo passed in

View File

@ -58,6 +58,8 @@
#include "nsTArray.h"
#include "nsDOMJSUtils.h"
using namespace mozilla::dom;
//
// Helper class used to support <SCRIPT FOR=object EVENT=handler ...>
// style script tags...
@ -308,7 +310,7 @@ class nsHTMLScriptElement : public nsGenericHTMLElement,
{
public:
nsHTMLScriptElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
FromParser aFromParser);
virtual ~nsHTMLScriptElement();
// nsISupports
@ -361,7 +363,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Script)
nsHTMLScriptElement::nsHTMLScriptElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo)
, nsScriptElement(aFromParser)
{
@ -419,10 +421,8 @@ nsHTMLScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
*aResult = nsnull;
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsHTMLScriptElement* it = new nsHTMLScriptElement(ni.forget(), PR_FALSE);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsHTMLScriptElement* it =
new nsHTMLScriptElement(ni.forget(), NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = CopyInnerTo(it);

View File

@ -140,13 +140,13 @@ nsSafeOptionListMutation::~nsSafeOptionListMutation()
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Select)
nsHTMLSelectElement::nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mOptions(new nsHTMLOptionCollection(this)),
mIsDoneAddingChildren(!aFromParser),
mDisabledChanged(PR_FALSE),
mMutating(PR_FALSE),
mInhibitStateRestoration(!!(aFromParser & NS_FROM_PARSER_FRAGMENT)),
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
mNonOptionChildren(0),
mOptGroupCount(0),
mSelectedIndex(-1)

View File

@ -244,7 +244,7 @@ public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLSelectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLSelectElement();
// nsISupports

View File

@ -57,17 +57,19 @@
#undef GetObject
#endif
class nsHTMLSharedObjectElement : public nsGenericHTMLElement,
public nsObjectLoadingContent,
public nsIDOMHTMLAppletElement,
public nsIDOMHTMLEmbedElement
using namespace mozilla::dom;
class nsHTMLSharedObjectElement : public nsGenericHTMLElement
, public nsObjectLoadingContent
, public nsIDOMHTMLAppletElement
, public nsIDOMHTMLEmbedElement
#ifdef MOZ_SVG
, public nsIDOMGetSVGDocument
, public nsIDOMGetSVGDocument
#endif
{
public:
nsHTMLSharedObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
virtual ~nsHTMLSharedObjectElement();
// nsISupports
@ -178,7 +180,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(SharedObject)
nsHTMLSharedObjectElement::nsHTMLSharedObjectElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLElement(aNodeInfo),
mIsDoneAddingChildren(mNodeInfo->Equals(nsGkAtoms::embed) || !aFromParser)
{

View File

@ -81,6 +81,8 @@
#include "nsTextEditorState.h"
using namespace mozilla::dom;
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
#define NS_NO_CONTENT_DISPATCH (1 << 0)
@ -97,7 +99,7 @@ public:
using nsIConstraintValidation::GetValidationMessage;
nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser = 0);
mozilla::dom::FromParser aFromParser = mozilla::dom::NOT_FROM_PARSER);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -278,12 +280,12 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
nsHTMLTextAreaElement::nsHTMLTextAreaElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mValueChanged(PR_FALSE),
mHandlingSelect(PR_FALSE),
mDoneAddingChildren(!aFromParser),
mInhibitStateRestoration(!!(aFromParser & NS_FROM_PARSER_FRAGMENT)),
mInhibitStateRestoration(!!(aFromParser & FROM_PARSER_FRAGMENT)),
mDisabledChanged(PR_FALSE),
mState(new nsTextEditorState(this))
{

View File

@ -66,6 +66,8 @@
#include "nsIDOMProgressEvent.h"
#include "nsMediaError.h"
using namespace mozilla::dom;
NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Video)
NS_IMPL_ADDREF_INHERITED(nsHTMLVideoElement, nsHTMLMediaElement)
@ -101,7 +103,7 @@ NS_IMETHODIMP nsHTMLVideoElement::GetVideoHeight(PRUint32 *aVideoHeight)
}
nsHTMLVideoElement::nsHTMLVideoElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsHTMLMediaElement(aNodeInfo, aFromParser)
{
}

View File

@ -67,6 +67,8 @@
#include "nsTextEditorState.h"
using namespace mozilla::dom;
static NS_DEFINE_CID(kTextEditorCID, NS_TEXTEDITOR_CID);
static NS_DEFINE_CID(kFrameSelectionCID, NS_FRAMESELECTION_CID);
@ -1520,7 +1522,7 @@ nsTextEditorState::CreateRootNode()
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
nsresult rv = NS_NewHTMLElement(getter_AddRefs(mRootNode), nodeInfo.forget(),
PR_FALSE);
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
// Set the necessary classes on the text control. We use class values
@ -1597,7 +1599,7 @@ be called if @placeholder is the empty string when trimmed from line breaks");
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
rv = NS_NewHTMLElement(getter_AddRefs(mPlaceholderDiv), nodeInfo.forget(),
PR_FALSE);
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
// Create the text node for the placeholder text before doing anything else

View File

@ -139,11 +139,12 @@ static PRLogModuleInfo* gSinkLogModuleInfo;
//----------------------------------------------------------------------
typedef nsGenericHTMLElement*
(*contentCreatorCallback)(already_AddRefed<nsINodeInfo>, PRUint32 aFromParser);
(*contentCreatorCallback)(already_AddRefed<nsINodeInfo>,
FromParser aFromParser);
nsGenericHTMLElement*
NS_NewHTMLNOTUSEDElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
NS_NOTREACHED("The element ctor should never be called");
return nsnull;
@ -555,12 +556,12 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
NS_ENSURE_TRUE(nodeInfo, nsnull);
// Make the content object
return CreateHTMLElement(aNodeType, nodeInfo.forget(), PR_TRUE);
return CreateHTMLElement(aNodeType, nodeInfo.forget(), FROM_PARSER_NETWORK);
}
nsresult
NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
*aResult = nsnull;
@ -583,7 +584,7 @@ NS_NewHTMLElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
already_AddRefed<nsGenericHTMLElement>
CreateHTMLElement(PRUint32 aNodeType, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
NS_ASSERTION(aNodeType <= NS_HTML_TAG_MAX ||
aNodeType == eHTMLTag_userdefined,
@ -2619,7 +2620,8 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
nsCOMPtr<nsINodeInfo> nodeInfo;
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_XHTML);
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo.forget(), PR_FALSE);
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo.forget(),
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(element));

View File

@ -75,6 +75,7 @@
#include "nsICSSRuleList.h"
#include "nsIDOMCSSRule.h"
using namespace mozilla::dom;
namespace css = mozilla::css;
//
@ -390,7 +391,8 @@ nsHTMLFragmentContentSink::OpenContainer(const nsIParserNode& aNode)
NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
}
content = CreateHTMLElement(nodeType, nodeInfo.forget(), PR_FALSE).get();
content =
CreateHTMLElement(nodeType, nodeInfo.forget(), NOT_FROM_PARSER).get();
NS_ENSURE_TRUE(content, NS_ERROR_OUT_OF_MEMORY);
result = AddAttributes(aNode, content);
@ -477,7 +479,8 @@ nsHTMLFragmentContentSink::AddLeaf(const nsIParserNode& aNode)
NS_ADDREF(mNodeInfoCache[nodeType] = nodeInfo);
}
content = CreateHTMLElement(nodeType, nodeInfo.forget(), PR_FALSE);
content =
CreateHTMLElement(nodeType, nodeInfo.forget(), NOT_FROM_PARSER);
NS_ENSURE_TRUE(content, NS_ERROR_OUT_OF_MEMORY);
result = AddAttributes(aNode, content);

View File

@ -295,7 +295,7 @@ nsPluginDocument::CreateSyntheticPluginDocument()
kNameSpaceID_XHTML);
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo.forget(),
PR_FALSE);
NOT_FROM_PARSER);
NS_ENSURE_SUCCESS(rv, rv);
// make it a named element

View File

@ -117,7 +117,7 @@ nsVideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
nsRefPtr<nsHTMLMediaElement> element =
static_cast<nsHTMLMediaElement*>(NS_NewHTMLVideoElement(nodeInfo.forget(),
PR_FALSE));
NOT_FROM_PARSER));
if (!element)
return NS_ERROR_OUT_OF_MEMORY;
element->SetAutoplay(PR_TRUE);

View File

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

View File

@ -47,6 +47,8 @@
#include "nsSVGUtils.h"
#include "nsDebug.h"
using namespace mozilla::dom;
nsresult
NS_NewSVGAElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
@ -77,7 +79,7 @@ NS_NewSVGGElement(nsIContent **aResult,
nsresult
NS_NewSVGSVGElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
FromParser aFromParser);
nsresult
NS_NewSVGForeignObjectElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
@ -117,7 +119,7 @@ NS_NewSVGDescElement(nsIContent **aResult,
nsresult
NS_NewSVGScriptElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
FromParser aFromParser);
nsresult
NS_NewSVGUseElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo);
@ -241,7 +243,7 @@ NS_NewSVGSetElement(nsIContent **aResult,
nsresult
NS_NewSVGElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
{
NS_PRECONDITION(NS_SVGEnabled(),
"creating an SVG element while SVG disabled");

View File

@ -72,6 +72,7 @@ nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult);
#endif // MOZ_SMIL
using namespace mozilla;
using namespace mozilla::dom;
NS_SVG_VAL_IMPL_CYCLE_COLLECTION(nsSVGTranslatePoint::DOMVal, mElement)
@ -196,7 +197,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGSVGElementBase)
// Implementation
nsSVGSVGElement::nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsSVGSVGElementBase(aNodeInfo),
mCoordCtx(nsnull),
mViewportWidth(0),
@ -207,7 +208,7 @@ nsSVGSVGElement::nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mPreviousScale(1.0f),
mRedrawSuspendCount(0)
#ifdef MOZ_SMIL
,mStartAnimationOnBindToTree(!aFromParser)
, mStartAnimationOnBindToTree(!aFromParser)
#endif // MOZ_SMIL
{
}
@ -221,10 +222,7 @@ nsSVGSVGElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
{
*aResult = nsnull;
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsSVGSVGElement *it = new nsSVGSVGElement(ni.forget(), PR_FALSE);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsSVGSVGElement *it = new nsSVGSVGElement(ni.forget(), NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = it->Init();

View File

@ -51,6 +51,7 @@
#include "nsSVGEnum.h"
#include "nsSVGViewBox.h"
#include "nsSVGPreserveAspectRatio.h"
#include "mozilla/dom/FromParser.h"
#ifdef MOZ_SMIL
class nsSMILTimeContainer;
@ -133,8 +134,9 @@ class nsSVGSVGElement : public nsSVGSVGElementBase,
protected:
friend nsresult NS_NewSVGSVGElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo, PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
nsSVGSVGElement(already_AddRefed<nsINodeInfo> aNodeInfo,
mozilla::dom::FromParser aFromParser);
public:

View File

@ -49,6 +49,8 @@
#include "nsScriptElement.h"
#include "nsIDOMText.h"
using namespace mozilla::dom;
typedef nsSVGElement nsSVGScriptElementBase;
class nsSVGScriptElement : public nsSVGScriptElementBase,
@ -59,9 +61,9 @@ class nsSVGScriptElement : public nsSVGScriptElementBase,
protected:
friend nsresult NS_NewSVGScriptElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
FromParser aFromParser);
nsSVGScriptElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
FromParser aFromParser);
public:
// interfaces:
@ -133,7 +135,7 @@ NS_INTERFACE_MAP_END_INHERITING(nsSVGScriptElementBase)
// Implementation
nsSVGScriptElement::nsSVGScriptElement(already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser)
FromParser aFromParser)
: nsSVGScriptElementBase(aNodeInfo)
, nsScriptElement(aFromParser)
{
@ -150,10 +152,7 @@ nsSVGScriptElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
*aResult = nsnull;
nsCOMPtr<nsINodeInfo> ni = aNodeInfo;
nsSVGScriptElement* it = new nsSVGScriptElement(ni.forget(), PR_FALSE);
if (!it) {
return NS_ERROR_OUT_OF_MEMORY;
}
nsSVGScriptElement* it = new nsSVGScriptElement(ni.forget(), NOT_FROM_PARSER);
nsCOMPtr<nsINode> kungFuDeathGrip = it;
nsresult rv = it->Init();

View File

@ -344,7 +344,8 @@ nsSVGUseElement::CreateAnonymousContent()
return nsnull;
nsCOMPtr<nsIContent> svgNode;
NS_NewSVGSVGElement(getter_AddRefs(svgNode), nodeInfo.forget(), PR_FALSE);
NS_NewSVGSVGElement(getter_AddRefs(svgNode), nodeInfo.forget(),
NOT_FROM_PARSER);
if (!svgNode)
return nsnull;

View File

@ -46,6 +46,7 @@
#include "nsSVGString.h"
#include "nsTArray.h"
#include "nsReferencedElement.h"
#include "mozilla/dom/FromParser.h"
class nsIContent;
class nsINodeInfo;
@ -57,7 +58,7 @@ class nsINodeInfo;
nsresult
NS_NewSVGSVGElement(nsIContent **aResult,
already_AddRefed<nsINodeInfo> aNodeInfo,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
typedef nsSVGGraphicElement nsSVGUseElementBase;

View File

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

View File

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

View File

@ -102,6 +102,8 @@
#include "nsHtml5SVGLoadDispatcher.h"
#endif
using namespace mozilla::dom;
// XXX Open Issues:
// 1) what's not allowed - We need to figure out which HTML tags
// (prefixed with a HTML namespace qualifier) are explicitly not
@ -491,7 +493,7 @@ nsresult
nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRUint32 aFromParser)
FromParser aFromParser)
{
NS_ASSERTION(aNodeInfo, "can't create element without nodeinfo");
@ -1020,7 +1022,8 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
result = CreateElement(aAtts, aAttsCount, nodeInfo, aLineNumber,
getter_AddRefs(content), &appendContent, PR_TRUE);
getter_AddRefs(content), &appendContent,
FROM_PARSER_NETWORK);
NS_ENSURE_SUCCESS(result, result);
// Have to do this before we push the new content on the stack... and have to

View File

@ -47,6 +47,7 @@
#include "nsCRT.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIDTD.h"
#include "mozilla/dom/FromParser.h"
class nsIDocument;
class nsIURI;
@ -137,7 +138,7 @@ protected:
virtual nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
// aParent is allowed to be null here if this is the root content
// being closed

View File

@ -63,6 +63,8 @@
#include "nsTArray.h"
#include "nsCycleCollectionParticipant.h"
using namespace mozilla::dom;
class nsXMLFragmentContentSink : public nsXMLContentSink,
public nsIFragmentContentSink
{
@ -117,7 +119,7 @@ protected:
virtual nsresult CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRUint32 aFromParser);
mozilla::dom::FromParser aFromParser);
virtual nsresult CloseElement(nsIContent* aContent);
virtual void MaybeStartLayout(PRBool aIgnorePendingSheets);
@ -259,14 +261,14 @@ nsresult
nsXMLFragmentContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsINodeInfo* aNodeInfo, PRUint32 aLineNumber,
nsIContent** aResult, PRBool* aAppendContent,
PRUint32 aFromParser)
FromParser /*aFromParser*/)
{
// Claim to not be coming from parser, since we don't do any of the
// fancy CloseElement stuff.
nsresult rv = nsXMLContentSink::CreateElement(aAtts, aAttsCount,
aNodeInfo, aLineNumber,
aResult, aAppendContent,
PR_FALSE);
NOT_FROM_PARSER);
// When we aren't grabbing all of the content we, never open a doc
// element, we run into trouble on the first element, so we don't append,

View File

@ -56,6 +56,8 @@
#include "nsContentUtils.h"
#include "nsGkAtoms.h"
using namespace mozilla::dom;
txMozillaTextOutput::txMozillaTextOutput(nsIDOMDocument* aSourceDocument,
nsIDOMDocument* aResultDocument,
nsITransformObserver* aObserver)
@ -293,6 +295,5 @@ txMozillaTextOutput::createXHTMLElement(nsIAtom* aName,
GetNodeInfo(aName, nsnull, kNameSpaceID_XHTML);
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
return NS_NewHTMLElement(aResult, ni.forget(), PR_FALSE);
return NS_NewHTMLElement(aResult, ni.forget(), NOT_FROM_PARSER);
}

View File

@ -73,6 +73,8 @@
#include "nsContentCreatorFunctions.h"
#include "txError.h"
using namespace mozilla::dom;
#define TX_ENSURE_CURRENTNODE \
NS_ASSERTION(mCurrentNode, "mCurrentNode is NULL"); \
if (!mCurrentNode) \
@ -536,7 +538,8 @@ txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix,
ni = mNodeInfoManager->GetNodeInfo(aLocalName, aPrefix, aNsID);
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
NS_NewElement(getter_AddRefs(mOpenedElement), aNsID, ni.forget(), PR_FALSE);
NS_NewElement(getter_AddRefs(mOpenedElement), aNsID, ni.forget(),
NOT_FROM_PARSER);
// Set up the element and adjust state
if (!mNoFixup) {
@ -947,7 +950,7 @@ txMozillaXMLOutput::createHTMLElement(nsIAtom* aName,
kNameSpaceID_XHTML);
NS_ENSURE_TRUE(ni, NS_ERROR_OUT_OF_MEMORY);
return NS_NewHTMLElement(aResult, ni.forget(), PR_FALSE);
return NS_NewHTMLElement(aResult, ni.forget(), NOT_FROM_PARSER);
}
txTransformNotifier::txTransformNotifier()

View File

@ -3696,8 +3696,9 @@ nsXULDocument::CreateElementFromPrototype(nsXULPrototypeElement* aPrototype,
PRInt32 ns = newNodeInfo->NamespaceID();
nsCOMPtr<nsINodeInfo> xtfNi = newNodeInfo;
rv = NS_NewElement(getter_AddRefs(content), ns, newNodeInfo.forget(),
PR_FALSE);
if (NS_FAILED(rv)) return rv;
NOT_FROM_PARSER);
if (NS_FAILED(rv))
return rv;
result = content->AsElement();

View File

@ -1404,7 +1404,7 @@ nsXULContentBuilder::CreateElement(PRInt32 aNameSpaceID,
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(aTag, nsnull, aNameSpaceID);
rv = NS_NewElement(getter_AddRefs(result), aNameSpaceID, nodeInfo.forget(),
PR_FALSE);
NOT_FROM_PARSER);
if (NS_FAILED(rv))
return rv;

View File

@ -92,6 +92,8 @@
#include "nsThemeConstants.h"
#include "nsPLDOMEvent.h"
namespace dom = mozilla::dom;
NS_IMETHODIMP
nsComboboxControlFrame::RedisplayTextEvent::Run()
{
@ -1012,15 +1014,13 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
// create button which drops the list down
NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo.forget(),
PR_FALSE);
dom::NOT_FROM_PARSER);
if (!mButtonContent)
return NS_ERROR_OUT_OF_MEMORY;
// make someone to listen to the button. If its pressed by someone like Accessibility
// then open or close the combo box.
mButtonListener = new nsComboButtonListener(this);
if (!mButtonListener)
return NS_ERROR_OUT_OF_MEMORY;
mButtonContent->AddEventListenerByIID(mButtonListener,
NS_GET_IID(nsIDOMMouseListener));

View File

@ -93,6 +93,8 @@
#include "nsDOMFile.h"
#include "nsIEventStateManager.h"
namespace dom = mozilla::dom;
#define SYNC_TEXT 0x1
#define SYNC_BUTTON 0x2
#define SYNC_BOTH 0x3
@ -227,7 +229,8 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
kNameSpaceID_XHTML);
// Create the text content
NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo.forget(), PR_FALSE);
NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo.forget(),
dom::NOT_FROM_PARSER);
if (!mTextContent)
return NS_ERROR_OUT_OF_MEMORY;
@ -270,7 +273,8 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
// Create the browse button
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::input, nsnull,
kNameSpaceID_XHTML);
NS_NewHTMLElement(getter_AddRefs(mBrowse), nodeInfo.forget(), PR_FALSE);
NS_NewHTMLElement(getter_AddRefs(mBrowse), nodeInfo.forget(),
dom::NOT_FROM_PARSER);
if (!mBrowse)
return NS_ERROR_OUT_OF_MEMORY;
@ -295,7 +299,8 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
mCaptureMouseListener->mMode = mode;
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::input, nsnull,
kNameSpaceID_XHTML);
NS_NewHTMLElement(getter_AddRefs(mCapture), nodeInfo.forget(), PR_FALSE);
NS_NewHTMLElement(getter_AddRefs(mCapture), nodeInfo.forget(),
dom::NOT_FROM_PARSER);
if (!mCapture)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -78,6 +78,8 @@
#include "nsContentUtils.h"
#include "nsLayoutErrors.h"
namespace dom = mozilla::dom;
nsIFrame*
NS_NewIsIndexFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
{
@ -196,7 +198,8 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
nsCOMPtr<nsINodeInfo> hrInfo;
hrInfo = nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_XHTML);
NS_NewHTMLElement(getter_AddRefs(mPreHr), hrInfo.forget(), PR_FALSE);
NS_NewHTMLElement(getter_AddRefs(mPreHr), hrInfo.forget(),
dom::NOT_FROM_PARSER);
if (!mPreHr || !aElements.AppendElement(mPreHr))
return NS_ERROR_OUT_OF_MEMORY;
@ -215,7 +218,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
inputInfo = nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_XHTML);
NS_NewHTMLElement(getter_AddRefs(mInputContent), inputInfo.forget(),
PR_FALSE);
dom::NOT_FROM_PARSER);
if (!mInputContent)
return NS_ERROR_OUT_OF_MEMORY;
@ -231,7 +234,8 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
// Create an hr
hrInfo = nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_XHTML);
NS_NewHTMLElement(getter_AddRefs(mPostHr), hrInfo.forget(), PR_FALSE);
NS_NewHTMLElement(getter_AddRefs(mPostHr), hrInfo.forget(),
dom::NOT_FROM_PARSER);
if (!mPostHr || !aElements.AppendElement(mPostHr))
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -414,10 +414,10 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
NS_NewElement(getter_AddRefs(newContent),
ns, nodeInfo.forget(),
(mOpCode == eTreeOpCreateElementNetwork ?
NS_FROM_PARSER_NETWORK
dom::FROM_PARSER_NETWORK
: (aBuilder->IsFragmentMode() ?
NS_FROM_PARSER_FRAGMENT :
NS_FROM_PARSER_DOCUMENT_WRITE)));
dom::FROM_PARSER_FRAGMENT :
dom::FROM_PARSER_DOCUMENT_WRITE)));
NS_ASSERTION(newContent, "Element creation created null pointer.");
aBuilder->HoldElement(*target = newContent);
@ -458,7 +458,11 @@ nsHtml5TreeOperation::Perform(nsHtml5TreeOpExecutor* aBuilder,
NS_NewElement(getter_AddRefs(optionElt),
optionNodeInfo->NamespaceID(),
ni.forget(),
PR_TRUE);
(mOpCode == eTreeOpCreateElementNetwork ?
dom::FROM_PARSER_NETWORK
: (aBuilder->IsFragmentMode() ?
dom::FROM_PARSER_FRAGMENT :
dom::FROM_PARSER_DOCUMENT_WRITE)));
nsCOMPtr<nsIContent> optionText;
NS_NewTextNode(getter_AddRefs(optionText),
aBuilder->GetNodeInfoManager());