зеркало из https://github.com/mozilla/pjs.git
Bug 245627. Minor deCOMtamination of HTML element constructor functions. r+sr=jst
This commit is contained in:
Родитель
a05b357612
Коммит
3476550296
|
@ -977,36 +977,17 @@ protected:
|
|||
* A macro to implement the NS_NewHTMLXXXElement() functions.
|
||||
*/
|
||||
#define NS_IMPL_NS_NEW_HTML_ELEMENT(_elementName) \
|
||||
nsresult \
|
||||
NS_NewHTML##_elementName##Element(nsIHTMLContent **aResult, \
|
||||
nsINodeInfo *aNodeInfo, \
|
||||
PRBool aFromParser) \
|
||||
nsIHTMLContent* \
|
||||
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
|
||||
{ \
|
||||
nsIHTMLContent *it = new nsHTML##_elementName##Element(aNodeInfo); \
|
||||
if (!it) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
\
|
||||
NS_ADDREF(*aResult = it); \
|
||||
\
|
||||
return NS_OK; \
|
||||
return new nsHTML##_elementName##Element(aNodeInfo); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(_elementName) \
|
||||
nsresult \
|
||||
NS_NewHTML##_elementName##Element(nsIHTMLContent **aResult, \
|
||||
nsINodeInfo *aNodeInfo, \
|
||||
PRBool aFromParser) \
|
||||
nsIHTMLContent* \
|
||||
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, PRBool aFromParser)\
|
||||
{ \
|
||||
nsIHTMLContent *it = new nsHTML##_elementName##Element(aNodeInfo, \
|
||||
aFromParser); \
|
||||
if (!it) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
\
|
||||
NS_ADDREF(*aResult = it); \
|
||||
\
|
||||
return NS_OK; \
|
||||
return new nsHTML##_elementName##Element(aNodeInfo, aFromParser); \
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1189,200 +1170,59 @@ nsHTML##_elementName##Element::CloneNode(PRBool aDeep, nsIDOMNode** aReturn) \
|
|||
|
||||
// Element class factory methods
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLSharedElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
#define NS_DECLARE_NS_NEW_HTML_ELEMENT(_elementName) \
|
||||
nsIHTMLContent* \
|
||||
NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLAnchorElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLAppletElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLAreaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBRElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLBodyElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLButtonElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLModElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLDivElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFieldSetElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFontElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFormElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFrameElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLFrameSetElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLHRElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLHeadElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLHeadingElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLHtmlElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLIFrameElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLImageElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLInputElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLLIElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLLabelElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLLegendElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLLinkElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLMapElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLMetaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLSharedListElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLObjectElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLOptGroupElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLOptionElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLParagraphElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLPreElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLScriptElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLSelectElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLSpanElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLStyleElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTableCaptionElement(nsIHTMLContent** aResult,nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTableCellElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTableColElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTableElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTableRowElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTableSectionElement(nsIHTMLContent** aResult,nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTbodyElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTextAreaElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTfootElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTheadElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLTitleElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLUnknownElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser = PR_FALSE);
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Anchor)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Applet)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Area)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(BR)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Body)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Button)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Mod)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Div)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(FieldSet)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Font)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Form)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Frame)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(FrameSet)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(HR)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Head)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Heading)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Html)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(IFrame)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Image)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Input)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(LI)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Label)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Legend)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Link)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Map)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Meta)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Object)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(OptGroup)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Option)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Paragraph)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Pre)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Script)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Select)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Span)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Style)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCaption)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCell)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableCol)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Table)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableRow)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(TableSection)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Tbody)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(TextArea)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Tfoot)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Thead)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Title)
|
||||
NS_DECLARE_NS_NEW_HTML_ELEMENT(Unknown)
|
||||
|
||||
#endif /* nsGenericHTMLElement_h___ */
|
||||
|
|
|
@ -397,29 +397,24 @@ ShouldBeInElements(nsIFormControl* aFormControl)
|
|||
// nsHTMLFormElement implementation
|
||||
|
||||
// construction, destruction
|
||||
nsresult
|
||||
NS_NewHTMLFormElement(nsIHTMLContent** aInstancePtrResult,
|
||||
nsINodeInfo *aNodeInfo, PRBool aFromParser)
|
||||
nsIHTMLContent*
|
||||
NS_NewHTMLFormElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
|
||||
{
|
||||
nsHTMLFormElement* it = new nsHTMLFormElement(aNodeInfo);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsresult rv = it->Init();
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
delete it;
|
||||
|
||||
return rv;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aInstancePtrResult = it);
|
||||
|
||||
return rv;
|
||||
return it;
|
||||
}
|
||||
|
||||
|
||||
nsHTMLFormElement::nsHTMLFormElement(nsINodeInfo *aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mGeneratingSubmit(PR_FALSE),
|
||||
|
|
|
@ -153,9 +153,8 @@ protected:
|
|||
nsSize GetWidthHeight();
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLImageElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser)
|
||||
nsIHTMLContent*
|
||||
NS_NewHTMLImageElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
|
||||
{
|
||||
/*
|
||||
* nsHTMLImageElement's will be created without a nsINodeInfo passed in
|
||||
|
@ -167,25 +166,18 @@ NS_NewHTMLImageElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
|||
if (!nodeInfo) {
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
nsINodeInfoManager *nodeInfoManager = doc->GetNodeInfoManager();
|
||||
NS_ENSURE_TRUE(nodeInfoManager, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_TRUE(nodeInfoManager, nsnull);
|
||||
|
||||
rv = nodeInfoManager->GetNodeInfo(nsHTMLAtoms::img, nsnull,
|
||||
kNameSpaceID_None,
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
}
|
||||
|
||||
nsHTMLImageElement* it = new nsHTMLImageElement(nodeInfo);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult = it);
|
||||
|
||||
return NS_OK;
|
||||
return new nsHTMLImageElement(nodeInfo);
|
||||
}
|
||||
|
||||
nsHTMLImageElement::nsHTMLImageElement(nsINodeInfo *aNodeInfo)
|
||||
|
|
|
@ -151,9 +151,8 @@ protected:
|
|||
PRPackedBool mIsSelected;
|
||||
};
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLOptionElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser)
|
||||
nsIHTMLContent*
|
||||
NS_NewHTMLOptionElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
|
||||
{
|
||||
/*
|
||||
* nsHTMLOptionElement's will be created without a nsINodeInfo passed in
|
||||
|
@ -165,28 +164,20 @@ NS_NewHTMLOptionElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
|||
if (!nodeInfo) {
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_TRUE(doc, nsnull);
|
||||
|
||||
nsINodeInfoManager *nodeInfoManager = doc->GetNodeInfoManager();
|
||||
NS_ENSURE_TRUE(nodeInfoManager, NS_ERROR_UNEXPECTED);
|
||||
NS_ENSURE_TRUE(nodeInfoManager, nsnull);
|
||||
|
||||
rv = nodeInfoManager->GetNodeInfo(nsHTMLAtoms::option, nsnull,
|
||||
kNameSpaceID_None,
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
}
|
||||
|
||||
nsIHTMLContent* it = new nsHTMLOptionElement(nodeInfo);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
NS_ADDREF(*aResult = it);
|
||||
|
||||
return NS_OK;
|
||||
return new nsHTMLOptionElement(nodeInfo);
|
||||
}
|
||||
|
||||
|
||||
nsHTMLOptionElement::nsHTMLOptionElement(nsINodeInfo *aNodeInfo)
|
||||
: nsGenericHTMLElement(aNodeInfo),
|
||||
mIsInitialized(PR_FALSE),
|
||||
|
|
|
@ -1049,13 +1049,14 @@ nsHTMLSelectElement::SetLength(PRUint32 aLength)
|
|||
}
|
||||
} else if (aLength) {
|
||||
// This violates the W3C DOM but we do this for backwards compatibility
|
||||
nsCOMPtr<nsIHTMLContent> element;
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::option, getter_AddRefs(nodeInfo));
|
||||
|
||||
rv = NS_NewHTMLOptionElement(getter_AddRefs(element), nodeInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIHTMLContent> element = NS_NewHTMLOptionElement(nodeInfo);
|
||||
if (!element) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITextContent> text;
|
||||
rv = NS_NewTextNode(getter_AddRefs(text));
|
||||
|
|
|
@ -518,14 +518,13 @@ nsHTMLTableElement::CreateTHead(nsIDOMHTMLElement** aValue)
|
|||
}
|
||||
else
|
||||
{ // create a new head rowgroup
|
||||
nsCOMPtr<nsIHTMLContent> newHead;
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::thead, getter_AddRefs(nodeInfo));
|
||||
|
||||
rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newHead),nodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> newHead = NS_NewHTMLTableSectionElement(nodeInfo);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && newHead) {
|
||||
if (newHead) {
|
||||
nsCOMPtr<nsIDOMNode> child;
|
||||
|
||||
rv = GetFirstChild(getter_AddRefs(child));
|
||||
|
@ -575,14 +574,12 @@ nsHTMLTableElement::CreateTFoot(nsIDOMHTMLElement** aValue)
|
|||
}
|
||||
else
|
||||
{ // create a new foot rowgroup
|
||||
nsCOMPtr<nsIHTMLContent> newFoot;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::tfoot, getter_AddRefs(nodeInfo));
|
||||
|
||||
rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newFoot),nodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> newFoot = NS_NewHTMLTableSectionElement(nodeInfo);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && newFoot) {
|
||||
if (newFoot) {
|
||||
rv = AppendChildTo(newFoot, PR_TRUE, PR_FALSE);
|
||||
CallQueryInterface(newFoot, aValue);
|
||||
}
|
||||
|
@ -622,14 +619,12 @@ nsHTMLTableElement::CreateCaption(nsIDOMHTMLElement** aValue)
|
|||
}
|
||||
else
|
||||
{ // create a new head rowgroup
|
||||
nsCOMPtr<nsIHTMLContent> newCaption;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::caption, getter_AddRefs(nodeInfo));
|
||||
|
||||
rv = NS_NewHTMLTableCaptionElement(getter_AddRefs(newCaption),nodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> newCaption = NS_NewHTMLTableCaptionElement(nodeInfo);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && newCaption) {
|
||||
if (newCaption) {
|
||||
rv = AppendChildTo(newCaption, PR_TRUE, PR_FALSE);
|
||||
CallQueryInterface(newCaption, aValue);
|
||||
}
|
||||
|
@ -699,15 +694,12 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
|
|||
|
||||
refRow->GetParentNode(getter_AddRefs(parent));
|
||||
// create the row
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> newRow;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::tr, getter_AddRefs(nodeInfo));
|
||||
|
||||
rv = NS_NewHTMLTableRowElement(getter_AddRefs(newRow), nodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> newRow = NS_NewHTMLTableRowElement(nodeInfo);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && newRow) {
|
||||
if (newRow) {
|
||||
nsCOMPtr<nsIDOMNode> newRowNode(do_QueryInterface(newRow));
|
||||
nsCOMPtr<nsIDOMNode> retChild;
|
||||
|
||||
|
@ -749,15 +741,13 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
|
|||
}
|
||||
|
||||
if (!rowGroup) { // need to create a TBODY
|
||||
nsCOMPtr<nsIHTMLContent> newRowGroup;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::tbody, getter_AddRefs(nodeInfo));
|
||||
|
||||
rv = NS_NewHTMLTableSectionElement(getter_AddRefs(newRowGroup),
|
||||
nodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> newRowGroup
|
||||
= NS_NewHTMLTableSectionElement(nodeInfo);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && newRowGroup) {
|
||||
if (newRowGroup) {
|
||||
rv = AppendChildTo(newRowGroup, PR_TRUE, PR_FALSE);
|
||||
|
||||
rowGroup = do_QueryInterface(newRowGroup);
|
||||
|
@ -765,12 +755,10 @@ nsHTMLTableElement::InsertRow(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
|
|||
}
|
||||
|
||||
if (rowGroup) {
|
||||
nsCOMPtr<nsIHTMLContent> newRow;
|
||||
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::tr, getter_AddRefs(nodeInfo));
|
||||
|
||||
rv = NS_NewHTMLTableRowElement(getter_AddRefs(newRow), nodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> newRow = NS_NewHTMLTableRowElement(nodeInfo);
|
||||
if (newRow) {
|
||||
nsCOMPtr<nsIDOMNode> firstRow;
|
||||
|
||||
|
|
|
@ -305,16 +305,17 @@ nsHTMLTableRowElement::InsertCell(PRInt32 aIndex, nsIDOMHTMLElement** aValue)
|
|||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::td, getter_AddRefs(nodeInfo));
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> cellContent;
|
||||
nsresult rv = NS_NewHTMLTableCellElement(getter_AddRefs(cellContent),
|
||||
nodeInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIHTMLContent> cellContent = NS_NewHTMLTableCellElement(nodeInfo);
|
||||
if (!cellContent) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> cellNode(do_QueryInterface(cellContent));
|
||||
NS_ASSERTION(cellNode, "Should implement nsIDOMNode!");
|
||||
|
||||
nsCOMPtr<nsIDOMNode> retChild;
|
||||
|
||||
nsresult rv;
|
||||
if (doInsert) {
|
||||
nsCOMPtr<nsIDOMNode> refCell;
|
||||
cells->Item(aIndex, getter_AddRefs(refCell));
|
||||
|
|
|
@ -168,16 +168,17 @@ nsHTMLTableSectionElement::InsertRow(PRInt32 aIndex,
|
|||
nsCOMPtr<nsINodeInfo> nodeInfo;
|
||||
mNodeInfo->NameChanged(nsHTMLAtoms::tr, getter_AddRefs(nodeInfo));
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> rowContent;
|
||||
nsresult rv = NS_NewHTMLTableRowElement(getter_AddRefs(rowContent),
|
||||
nodeInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIHTMLContent> rowContent = NS_NewHTMLTableRowElement(nodeInfo);
|
||||
if (!nodeInfo) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNode> rowNode(do_QueryInterface(rowContent));
|
||||
NS_ASSERTION(rowNode, "Should implement nsIDOMNode!");
|
||||
|
||||
nsCOMPtr<nsIDOMNode> retChild;
|
||||
|
||||
nsresult rv;
|
||||
if (doInsert) {
|
||||
nsCOMPtr<nsIDOMNode> refRow;
|
||||
rows->Item(aIndex, getter_AddRefs(refRow));
|
||||
|
|
|
@ -179,15 +179,13 @@ static PRLogModuleInfo* gSinkLogModuleInfo;
|
|||
// sampling the clock too often.
|
||||
#define NS_MAX_TOKENS_DEFLECTED_IN_LOW_FREQ_MODE 200
|
||||
|
||||
typedef nsresult (*contentCreatorCallback)(nsIHTMLContent**, nsINodeInfo*,
|
||||
PRBool aFromParser);
|
||||
typedef nsIHTMLContent* (*contentCreatorCallback)(nsINodeInfo*, PRBool aFromParser);
|
||||
|
||||
nsresult
|
||||
NS_NewHTMLNOTUSEDElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser)
|
||||
nsIHTMLContent*
|
||||
NS_NewHTMLNOTUSEDElement(nsINodeInfo *aNodeInfo, PRBool aFromParser)
|
||||
{
|
||||
NS_NOTREACHED("The element ctor should never be called");
|
||||
return NS_ERROR_FAILURE;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
#define HTML_TAG(_tag, _classname) NS_NewHTML##_classname##Element,
|
||||
|
@ -286,10 +284,10 @@ protected:
|
|||
nsresult AddAttributes(const nsIParserNode& aNode, nsIHTMLContent* aContent,
|
||||
PRBool aNotify = PR_FALSE,
|
||||
PRBool aCheckIfPresent = PR_FALSE);
|
||||
nsresult CreateContentObject(const nsIParserNode& aNode, nsHTMLTag aNodeType,
|
||||
nsIDOMHTMLFormElement* aForm,
|
||||
nsIDocShell* aDocShell,
|
||||
nsIHTMLContent** aResult);
|
||||
already_AddRefed<nsIHTMLContent>
|
||||
CreateContentObject(const nsIParserNode& aNode, nsHTMLTag aNodeType,
|
||||
nsIDOMHTMLFormElement* aForm,
|
||||
nsIDocShell* aDocShell);
|
||||
|
||||
inline PRInt32 GetNotificationInterval()
|
||||
{
|
||||
|
@ -859,20 +857,19 @@ SetForm(nsIHTMLContent* aContent, nsIDOMHTMLFormElement* aForm)
|
|||
formControl->SetForm(aForm);
|
||||
}
|
||||
|
||||
static nsresult
|
||||
static already_AddRefed<nsIHTMLContent>
|
||||
MakeContentObject(nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo,
|
||||
nsIDOMHTMLFormElement* aForm, nsIHTMLContent** aResult,
|
||||
nsIDOMHTMLFormElement* aForm,
|
||||
PRBool aInsideNoXXXTag, PRBool aFromParser);
|
||||
|
||||
/**
|
||||
* Factory subroutine to create all of the html content objects.
|
||||
*/
|
||||
nsresult
|
||||
already_AddRefed<nsIHTMLContent>
|
||||
HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
||||
nsHTMLTag aNodeType,
|
||||
nsIDOMHTMLFormElement* aForm,
|
||||
nsIDocShell* aDocShell,
|
||||
nsIHTMLContent** aResult)
|
||||
nsIDocShell* aDocShell)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -897,7 +894,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
|||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
// XXX if the parser treated the text in a textarea like a normal
|
||||
// textnode we wouldn't need to do this.
|
||||
|
@ -905,7 +902,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
|||
if (aNodeType == eHTMLTag_textarea) {
|
||||
nsCOMPtr<nsIDTD> dtd;
|
||||
mParser->GetDTD(getter_AddRefs(dtd));
|
||||
NS_ENSURE_TRUE(dtd, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(dtd, nsnull);
|
||||
|
||||
PRInt32 lineNo = 0;
|
||||
|
||||
|
@ -913,8 +910,11 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
|||
}
|
||||
|
||||
// Make the content object
|
||||
rv = MakeContentObject(aNodeType, nodeInfo, aForm, aResult,
|
||||
!!mInsideNoXXXTag, PR_TRUE);
|
||||
nsIHTMLContent* result = MakeContentObject(aNodeType, nodeInfo, aForm,
|
||||
!!mInsideNoXXXTag, PR_TRUE).get();
|
||||
if (!result) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (aNodeType == eHTMLTag_textarea && !mSkippedContent.IsEmpty()) {
|
||||
// XXX: if the parser treated the text in a textarea like a normal
|
||||
|
@ -936,7 +936,7 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
|||
++start;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> ta(do_QueryInterface(*aResult));
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> ta(do_QueryInterface(result));
|
||||
NS_ASSERTION(ta, "Huh? text area doesn't implement "
|
||||
"nsIDOMHTMLTextAreaElement?");
|
||||
|
||||
|
@ -947,17 +947,14 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
|
|||
mSkippedContent.Truncate();
|
||||
}
|
||||
|
||||
(*aResult)->SetContentID(mDocument->GetAndIncrementContentID());
|
||||
result->SetContentID(mDocument->GetAndIncrementContentID());
|
||||
|
||||
return rv;
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
||||
PRBool aCaseSensitive)
|
||||
NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo, PRBool aCaseSensitive)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsIParserService* parserService = nsContentUtils::GetParserServiceWeakRef();
|
||||
if (!parserService)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -974,8 +971,8 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
|||
}
|
||||
|
||||
if (aCaseSensitive) {
|
||||
rv = MakeContentObject(nsHTMLTag(id), aNodeInfo, nsnull,
|
||||
aResult, PR_FALSE, PR_FALSE);
|
||||
*aResult = MakeContentObject(nsHTMLTag(id), aNodeInfo, nsnull,
|
||||
PR_FALSE, PR_FALSE).get();
|
||||
} else {
|
||||
// Revese map id to name to get the correct character case in
|
||||
// the tag name.
|
||||
|
@ -991,18 +988,18 @@ NS_CreateHTMLElement(nsIHTMLContent** aResult, nsINodeInfo *aNodeInfo,
|
|||
if (!name->Equals(nsDependentString(tag))) {
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(tag);
|
||||
|
||||
rv = aNodeInfo->NameChanged(atom, getter_AddRefs(kungFuDeathGrip));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsresult rv = aNodeInfo->NameChanged(atom, getter_AddRefs(kungFuDeathGrip));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
nodeInfo = kungFuDeathGrip;
|
||||
}
|
||||
}
|
||||
|
||||
rv = MakeContentObject(nsHTMLTag(id), nodeInfo, nsnull, aResult,
|
||||
PR_FALSE, PR_FALSE);
|
||||
*aResult = MakeContentObject(nsHTMLTag(id), nodeInfo, nsnull,
|
||||
PR_FALSE, PR_FALSE).get();
|
||||
}
|
||||
|
||||
return rv;
|
||||
return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1063,29 +1060,37 @@ nsHTMLElementFactory::CreateInstanceByTag(nsINodeInfo *aNodeInfo,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
already_AddRefed<nsIHTMLContent>
|
||||
MakeContentObject(nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo,
|
||||
nsIDOMHTMLFormElement* aForm, nsIHTMLContent** aResult,
|
||||
nsIDOMHTMLFormElement* aForm,
|
||||
PRBool aInsideNoXXXTag, PRBool aFromParser)
|
||||
{
|
||||
|
||||
if (aNodeType == eHTMLTag_form) {
|
||||
if (aForm) {
|
||||
// the form was already created
|
||||
return CallQueryInterface(aForm, aResult);
|
||||
nsIHTMLContent* result;
|
||||
CallQueryInterface(aForm, &result);
|
||||
return result;
|
||||
}
|
||||
return NS_NewHTMLFormElement(aResult, aNodeInfo);
|
||||
nsIHTMLContent* result = NS_NewHTMLFormElement(aNodeInfo);
|
||||
NS_IF_ADDREF(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
contentCreatorCallback cb = sContentCreatorCallbacks[aNodeType];
|
||||
|
||||
NS_ASSERTION(cb != NS_NewHTMLNOTUSEDElement,
|
||||
"Don't know how to construct tag element!");
|
||||
|
||||
rv = cb(aResult, aNodeInfo, aFromParser);
|
||||
nsIHTMLContent* result = cb(aNodeInfo, aFromParser);
|
||||
if (!result) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
if (NS_SUCCEEDED(rv) && !aInsideNoXXXTag) {
|
||||
NS_ADDREF(result);
|
||||
|
||||
if (!aInsideNoXXXTag) {
|
||||
switch (aNodeType) {
|
||||
case eHTMLTag_button:
|
||||
case eHTMLTag_fieldset:
|
||||
|
@ -1095,14 +1100,14 @@ MakeContentObject(nsHTMLTag aNodeType, nsINodeInfo *aNodeInfo,
|
|||
case eHTMLTag_input:
|
||||
case eHTMLTag_select:
|
||||
case eHTMLTag_textarea:
|
||||
SetForm(*aResult, aForm);
|
||||
SetForm(result, aForm);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
return result;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -1258,12 +1263,14 @@ SinkContext::OpenContainer(const nsIParserNode& aNode)
|
|||
|
||||
// Create new container content object
|
||||
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
|
||||
nsIHTMLContent* content;
|
||||
nsIDocShell *docshell = nsnull;
|
||||
if (mSink->mFrameset) docshell = (nsIDocShell *) mSink->mDocShell;
|
||||
rv = mSink->CreateContentObject(aNode, nodeType, mSink->mCurrentForm,
|
||||
docshell, &content);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsIHTMLContent* content =
|
||||
mSink->CreateContentObject(aNode, nodeType, mSink->mCurrentForm,
|
||||
docshell).get();
|
||||
if (!content) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mStack[mStackPos].mType = nodeType;
|
||||
mStack[mStackPos].mContent = content;
|
||||
|
@ -1505,11 +1512,10 @@ SinkContext::AddLeaf(const nsIParserNode& aNode)
|
|||
|
||||
// Create new leaf content object
|
||||
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
|
||||
nsCOMPtr<nsIHTMLContent> content;
|
||||
rv = mSink->CreateContentObject(aNode, nodeType,
|
||||
mSink->mCurrentForm, mSink->mDocShell,
|
||||
getter_AddRefs(content));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIHTMLContent> content =
|
||||
mSink->CreateContentObject(aNode, nodeType,
|
||||
mSink->mCurrentForm, mSink->mDocShell);
|
||||
NS_ENSURE_TRUE(content, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
// Set the content's document
|
||||
content->SetDocument(mSink->mDocument, PR_FALSE, PR_TRUE);
|
||||
|
@ -2202,12 +2208,13 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
|||
|
||||
CallQueryInterface(doc_root, &mRoot);
|
||||
} else {
|
||||
rv = NS_NewHTMLHtmlElement(&mRoot, nodeInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
mRoot = NS_NewHTMLHtmlElement(nodeInfo);
|
||||
if (!mRoot) {
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
|
||||
MOZ_TIMER_STOP(mWatch);
|
||||
return rv;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(mRoot);
|
||||
|
||||
mRoot->SetDocument(mDocument, PR_FALSE, PR_TRUE);
|
||||
mDocument->SetRootContent(mRoot);
|
||||
|
@ -2219,12 +2226,13 @@ HTMLContentSink::Init(nsIDocument* aDoc,
|
|||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = NS_NewHTMLHeadElement(&mHead, nodeInfo);
|
||||
mHead = NS_NewHTMLHeadElement(nodeInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_TIMER_DEBUGLOG(("Stop: nsHTMLContentSink::Init()\n"));
|
||||
MOZ_TIMER_STOP(mWatch);
|
||||
return rv;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
NS_ADDREF(mHead);
|
||||
|
||||
mRoot->AppendChildTo(mHead, PR_FALSE, PR_FALSE);
|
||||
|
||||
|
@ -2874,9 +2882,10 @@ HTMLContentSink::OpenForm(const nsIParserNode& aNode)
|
|||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> content;
|
||||
result = NS_NewHTMLFormElement(getter_AddRefs(content), nodeInfo);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
nsCOMPtr<nsIHTMLContent> content = NS_NewHTMLFormElement(nodeInfo);
|
||||
if (!content) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
mCurrentForm = do_QueryInterface(content);
|
||||
|
||||
|
@ -3206,9 +3215,10 @@ HTMLContentSink::SetDocumentTitle(const nsAString& aTitle)
|
|||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> it;
|
||||
rv = NS_NewHTMLTitleElement(getter_AddRefs(it), nodeInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIHTMLContent> it = NS_NewHTMLTitleElement(nodeInfo);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsITextContent> text;
|
||||
rv = NS_NewTextNode(getter_AddRefs(text));
|
||||
|
@ -3748,11 +3758,10 @@ HTMLContentSink::ProcessAREATag(const nsIParserNode& aNode)
|
|||
|
||||
nsHTMLTag nodeType = nsHTMLTag(aNode.GetNodeType());
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> area;
|
||||
nsresult rv = CreateContentObject(aNode, nodeType, nsnull, nsnull,
|
||||
getter_AddRefs(area));
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
nsCOMPtr<nsIHTMLContent> area =
|
||||
CreateContentObject(aNode, nodeType, nsnull, nsnull);
|
||||
if (!area) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
// Set the content's document
|
||||
|
@ -3765,7 +3774,7 @@ HTMLContentSink::ProcessAREATag(const nsIParserNode& aNode)
|
|||
AddBaseTagInfo(area);
|
||||
|
||||
// Set the content's attributes
|
||||
rv = AddAttributes(aNode, area);
|
||||
nsresult rv = AddAttributes(aNode, area);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Add AREA object to the current map
|
||||
|
@ -4037,9 +4046,10 @@ HTMLContentSink::ProcessMETATag(const nsIParserNode& aNode)
|
|||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> it;
|
||||
rv = NS_NewHTMLMetaElement(getter_AddRefs(it), nodeInfo);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIHTMLContent> it = NS_NewHTMLMetaElement(nodeInfo);
|
||||
if (!it) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
it->SetContentID(mDocument->GetAndIncrementContentID());
|
||||
|
||||
|
|
|
@ -312,10 +312,11 @@ nsHTMLFragmentContentSink::SetTitle(const nsString& aValue)
|
|||
kNameSpaceID_None,
|
||||
getter_AddRefs(nodeInfo));
|
||||
if(NS_SUCCEEDED(result)) {
|
||||
nsCOMPtr<nsIHTMLContent> content=nsnull;
|
||||
result = NS_NewHTMLTitleElement(getter_AddRefs(content), nodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> content = NS_NewHTMLTitleElement(nodeInfo);
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
if (!content) {
|
||||
result = NS_ERROR_OUT_OF_MEMORY;
|
||||
} else {
|
||||
nsIContent *parent = GetCurrentContent();
|
||||
|
||||
if (nsnull == parent) {
|
||||
|
|
|
@ -485,10 +485,9 @@ nsImageDocument::CreateSyntheticDocument()
|
|||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> image;
|
||||
rv = NS_NewHTMLImageElement(getter_AddRefs(image), nodeInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
nsCOMPtr<nsIHTMLContent> image = NS_NewHTMLImageElement(nodeInfo);
|
||||
if (!image) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
image->SetDocument(this, PR_FALSE, PR_TRUE);
|
||||
mImageElement = do_QueryInterface(image);
|
||||
|
|
|
@ -239,10 +239,9 @@ nsMediaDocument::CreateSyntheticDocument()
|
|||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> root;
|
||||
rv = NS_NewHTMLHtmlElement(getter_AddRefs(root), nodeInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
nsCOMPtr<nsIHTMLContent> root = NS_NewHTMLHtmlElement(nodeInfo);
|
||||
if (!root) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
root->SetDocument(this, PR_FALSE, PR_TRUE);
|
||||
SetRootContent(root);
|
||||
|
@ -252,10 +251,9 @@ nsMediaDocument::CreateSyntheticDocument()
|
|||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIHTMLContent> body;
|
||||
rv = NS_NewHTMLBodyElement(getter_AddRefs(body), nodeInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
nsCOMPtr<nsIHTMLContent> body = NS_NewHTMLBodyElement(nodeInfo);
|
||||
if (!body) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
body->SetDocument(this, PR_FALSE, PR_TRUE);
|
||||
mBodyContent = do_QueryInterface(body);
|
||||
|
|
|
@ -175,9 +175,9 @@ nsPluginDocument::CreateSyntheticPluginDocument()
|
|||
kNameSpaceID_None,
|
||||
getter_AddRefs(nodeInfo));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = NS_NewHTMLSharedElement(getter_AddRefs(mPluginContent), nodeInfo);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
mPluginContent = NS_NewHTMLSharedElement(nodeInfo);
|
||||
if (!mPluginContent) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
mPluginContent->SetDocument(this, PR_FALSE, PR_TRUE);
|
||||
|
||||
|
|
|
@ -342,22 +342,22 @@ nsContentDLF::CreateBlankDocument(nsILoadGroup *aLoadGroup, nsIDocument **aDocum
|
|||
nsCOMPtr<nsINodeInfo> htmlNodeInfo;
|
||||
|
||||
// generate an html html element
|
||||
nsCOMPtr<nsIHTMLContent> htmlElement;
|
||||
nim->GetNodeInfo(nsHTMLAtoms::html, 0, kNameSpaceID_None,
|
||||
getter_AddRefs(htmlNodeInfo));
|
||||
NS_NewHTMLHtmlElement(getter_AddRefs(htmlElement), htmlNodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> htmlElement
|
||||
= NS_NewHTMLHtmlElement(htmlNodeInfo);
|
||||
|
||||
// generate an html head element
|
||||
nsCOMPtr<nsIHTMLContent> headElement;
|
||||
nim->GetNodeInfo(nsHTMLAtoms::head, 0, kNameSpaceID_None,
|
||||
getter_AddRefs(htmlNodeInfo));
|
||||
NS_NewHTMLHeadElement(getter_AddRefs(headElement), htmlNodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> headElement
|
||||
= NS_NewHTMLHeadElement(htmlNodeInfo);
|
||||
|
||||
// generate an html body element
|
||||
nsCOMPtr<nsIHTMLContent> bodyElement;
|
||||
nim->GetNodeInfo(nsHTMLAtoms::body, 0, kNameSpaceID_None,
|
||||
getter_AddRefs(htmlNodeInfo));
|
||||
NS_NewHTMLBodyElement(getter_AddRefs(bodyElement), htmlNodeInfo);
|
||||
nsCOMPtr<nsIHTMLContent> bodyElement
|
||||
= NS_NewHTMLBodyElement(htmlNodeInfo);
|
||||
|
||||
// blat in the structure
|
||||
if (htmlElement && headElement && bodyElement) {
|
||||
|
|
|
@ -644,10 +644,11 @@ CreateHTMLImgElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
|||
*aResult = nsnull;
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsIHTMLContent* inst;
|
||||
// Note! NS_NewHTMLImageElement is special cased to handle a null nodeinfo
|
||||
nsresult rv = NS_NewHTMLImageElement(&inst, nsnull);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIHTMLContent* inst = NS_NewHTMLImageElement(nsnull);
|
||||
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
if (inst) {
|
||||
NS_ADDREF(inst);
|
||||
rv = inst->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(inst);
|
||||
}
|
||||
|
@ -694,10 +695,11 @@ CreateHTMLOptionElement(nsISupports* aOuter, REFNSIID aIID, void** aResult)
|
|||
*aResult = nsnull;
|
||||
if (aOuter)
|
||||
return NS_ERROR_NO_AGGREGATION;
|
||||
nsIHTMLContent* inst;
|
||||
// Note! NS_NewHTMLOptionElement is special cased to handle a null nodeinfo
|
||||
nsresult rv = NS_NewHTMLOptionElement(&inst, nsnull);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIHTMLContent* inst = NS_NewHTMLOptionElement(nsnull);
|
||||
nsresult rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
if (inst) {
|
||||
NS_ADDREF(inst);
|
||||
rv = inst->QueryInterface(aIID, aResult);
|
||||
NS_RELEASE(inst);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче