Landing fix for bug 419716. Make us consistently deal how we're pass param tags to object tags when parsing XHTML. Patch by mrbkap@gmail.com and bent.mozilla@gmail.com, r+sr=jonas@sicking.cc, a=beltzner

This commit is contained in:
jst@mozilla.org 2008-04-17 15:30:51 -07:00
parent f36dc677a5
commit 4b69a276d4
17 changed files with 49 additions and 29 deletions

View File

@ -58,7 +58,7 @@ class nsGenericHTMLElement;
nsresult
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
nsINodeInfo* aNodeInfo);
nsINodeInfo* aNodeInfo, PRBool aFromParser);
nsresult
NS_NewXMLElement(nsIContent** aResult, nsINodeInfo* aNodeInfo);
@ -100,7 +100,8 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult,
nsNodeInfoManager *aNodeInfoManager);
nsresult
NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo);
NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser);
// First argument should be nsHTMLTag, but that adds dependency to parser
// for a bunch of files.

View File

@ -3030,7 +3030,8 @@ nsDocument::CreateElementNS(const nsAString& aNamespaceURI,
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIContent> content;
NS_NewElement(getter_AddRefs(content), nodeInfo->NamespaceID(), nodeInfo);
NS_NewElement(getter_AddRefs(content), nodeInfo->NamespaceID(), nodeInfo,
PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
return CallQueryInterface(content, aReturn);
@ -5373,7 +5374,7 @@ nsDocument::CreateElem(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID,
getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
return NS_NewElement(aResult, elementType, nodeInfo);
return NS_NewElement(aResult, elementType, nodeInfo, PR_FALSE);
}
PRBool

View File

@ -226,10 +226,10 @@ NameSpaceManagerImpl::GetNameSpaceID(const nsAString& aURI)
nsresult
NS_NewElement(nsIContent** aResult, PRInt32 aElementType,
nsINodeInfo* aNodeInfo)
nsINodeInfo* aNodeInfo, PRBool aFromParser)
{
if (aElementType == kNameSpaceID_XHTML) {
return NS_NewHTMLElement(aResult, aNodeInfo);
return NS_NewHTMLElement(aResult, aNodeInfo, aFromParser);
}
#ifdef MOZ_XUL
if (aElementType == kNameSpaceID_XUL) {

View File

@ -568,7 +568,8 @@ HTMLContentSink::CreateContentObject(const nsIParserNode& aNode,
}
nsresult
NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo)
NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo,
PRBool aFromParser)
{
*aResult = nsnull;
@ -590,7 +591,7 @@ NS_NewHTMLElement(nsIContent** aResult, nsINodeInfo *aNodeInfo)
*aResult = CreateHTMLElement(parserService->
HTMLCaseSensitiveAtomTagToId(name),
aNodeInfo, PR_FALSE).get();
aNodeInfo, aFromParser).get();
return *aResult ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
}
@ -2935,7 +2936,7 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode)
mNodeInfoManager->GetNodeInfo(nsGkAtoms::link, nsnull, kNameSpaceID_None,
getter_AddRefs(nodeInfo));
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo);
result = NS_NewHTMLElement(getter_AddRefs(element), nodeInfo, PR_FALSE);
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIStyleSheetLinkingElement> ssle(do_QueryInterface(element));

View File

@ -1198,7 +1198,7 @@ nsHTMLParanoidFragmentSink::AddLeaf(const nsIParserNode& aNode)
kNameSpaceID_None,
getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewHTMLElement(getter_AddRefs(content), nodeInfo);
rv = NS_NewHTMLElement(getter_AddRefs(content), nodeInfo, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
AddAttributes(aNode, content);
ProcessBaseTag(content);

View File

@ -245,7 +245,7 @@ nsPluginDocument::CreateSyntheticPluginDocument()
kNameSpaceID_None,
getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo);
rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
// make it a named element

View File

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sw=2 et tw=78: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@ -506,7 +507,7 @@ nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
nsCOMPtr<nsIContent> content;
rv = NS_NewElement(getter_AddRefs(content), aNodeInfo->NamespaceID(),
aNodeInfo);
aNodeInfo, PR_TRUE);
NS_ENSURE_SUCCESS(rv, rv);
if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML)
@ -516,7 +517,9 @@ nsXMLContentSink::CreateElement(const PRUnichar** aAtts, PRUint32 aAttsCount,
) {
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(content);
sele->SetScriptLineNumber(aLineNumber);
sele->WillCallDoneAddingChildren();
if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_SVG)) {
sele->WillCallDoneAddingChildren();
}
mConstrainSize = PR_FALSE;
}
@ -592,7 +595,7 @@ nsXMLContentSink::CloseElement(nsIContent* aContent)
|| nodeInfo->NamespaceID() > kNameSpaceID_LastBuiltin
#endif
) {
aContent->DoneAddingChildren(PR_FALSE);
aContent->DoneAddingChildren(HaveNotifiedForCurrentContent());
}
if (IsMonolithicContainer(nodeInfo)) {
@ -909,6 +912,18 @@ nsXMLContentSink::PopContent()
mContentStack.RemoveElementAt(count - 1);
}
PRBool
nsXMLContentSink::HaveNotifiedForCurrentContent() const
{
PRUint32 stackLength = mContentStack.Length();
if (stackLength) {
const StackNode& stackNode = mContentStack[stackLength - 1];
nsIContent* parent = stackNode.mContent;
return stackNode.mNumFlushed == parent->GetChildCount();
}
return PR_TRUE;
}
void
nsXMLContentSink::MaybeStartLayout(PRBool aIgnorePendingSheets)
{

View File

@ -147,6 +147,7 @@ protected:
StackNode & GetCurrentStackNode();
nsresult PushContent(nsIContent *aContent);
void PopContent();
PRBool HaveNotifiedForCurrentContent() const;
nsresult ProcessBASETag(nsIContent* aContent);

View File

@ -290,6 +290,6 @@ txMozillaTextOutput::createXHTMLElement(nsIAtom* aName,
GetNodeInfo(aName, nsnull, kNameSpaceID_XHTML, getter_AddRefs(ni));
NS_ENSURE_SUCCESS(rv, rv);
return NS_NewHTMLElement(aResult, ni);
return NS_NewHTMLElement(aResult, ni, PR_FALSE);
}

View File

@ -549,7 +549,7 @@ txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix,
getter_AddRefs(ni));
NS_ENSURE_SUCCESS(rv, rv);
NS_NewElement(getter_AddRefs(mOpenedElement), aElemType, ni);
NS_NewElement(getter_AddRefs(mOpenedElement), aElemType, ni, PR_FALSE);
// Set up the element and adjust state
if (!mNoFixup) {
@ -988,7 +988,7 @@ txMozillaXMLOutput::createHTMLElement(nsIAtom* aName,
getter_AddRefs(ni));
NS_ENSURE_SUCCESS(rv, rv);
return NS_NewHTMLElement(aResult, ni);
return NS_NewHTMLElement(aResult, ni, PR_FALSE);
}
txTransformNotifier::txTransformNotifier()

View File

@ -3527,7 +3527,7 @@ nsXULDocument::CreateElementFromPrototype(nsXULPrototypeElement* aPrototype,
getter_AddRefs(newNodeInfo));
if (NS_FAILED(rv)) return rv;
rv = NS_NewElement(getter_AddRefs(result), newNodeInfo->NamespaceID(),
newNodeInfo);
newNodeInfo, PR_FALSE);
if (NS_FAILED(rv)) return rv;
#ifdef MOZ_XTF

View File

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

View File

@ -1049,7 +1049,7 @@ nsComboboxControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
getter_AddRefs(nodeInfo));
// create button which drops the list down
NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo);
NS_NewHTMLElement(getter_AddRefs(mButtonContent), nodeInfo, PR_FALSE);
if (!mButtonContent)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -158,7 +158,7 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
getter_AddRefs(nodeInfo));
// Create the text content
NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo);
NS_NewHTMLElement(getter_AddRefs(mTextContent), nodeInfo, PR_FALSE);
if (!mTextContent)
return NS_ERROR_OUT_OF_MEMORY;
@ -195,7 +195,7 @@ nsFileControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
systemGroup);
// Create the browse button
NS_NewHTMLElement(getter_AddRefs(mBrowse), nodeInfo);
NS_NewHTMLElement(getter_AddRefs(mBrowse), nodeInfo, PR_FALSE);
if (!mBrowse)
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -194,7 +194,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
nimgr->GetNodeInfo(nsGkAtoms::hr, nsnull, kNameSpaceID_None,
getter_AddRefs(hrInfo));
NS_NewHTMLElement(getter_AddRefs(mPreHr), hrInfo);
NS_NewHTMLElement(getter_AddRefs(mPreHr), hrInfo, PR_FALSE);
if (!mPreHr || !aElements.AppendElement(mPreHr))
return NS_ERROR_OUT_OF_MEMORY;
@ -213,7 +213,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
nimgr->GetNodeInfo(nsGkAtoms::input, nsnull, kNameSpaceID_None,
getter_AddRefs(inputInfo));
NS_NewHTMLElement(getter_AddRefs(mInputContent), inputInfo);
NS_NewHTMLElement(getter_AddRefs(mInputContent), inputInfo, PR_FALSE);
if (!mInputContent)
return NS_ERROR_OUT_OF_MEMORY;
@ -227,7 +227,7 @@ nsIsIndexFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
mInputContent->AddEventListenerByIID(this, NS_GET_IID(nsIDOMKeyListener));
// Create an hr
NS_NewHTMLElement(getter_AddRefs(mPostHr), hrInfo);
NS_NewHTMLElement(getter_AddRefs(mPostHr), hrInfo, PR_FALSE);
if (!mPostHr || !aElements.AppendElement(mPostHr))
return NS_ERROR_OUT_OF_MEMORY;

View File

@ -1700,7 +1700,7 @@ nsTextControlFrame::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
getter_AddRefs(nodeInfo));
NS_ENSURE_SUCCESS(rv, rv);
rv = NS_NewHTMLElement(getter_AddRefs(mAnonymousDiv), nodeInfo);
rv = NS_NewHTMLElement(getter_AddRefs(mAnonymousDiv), nodeInfo, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
// Set the div native anonymous, so CSS will be its style language

View File

@ -1701,7 +1701,7 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
if (canHaveHorizontal) {
rv = NS_NewElement(getter_AddRefs(mHScrollbarContent),
kNameSpaceID_XUL, nodeInfo);
kNameSpaceID_XUL, nodeInfo, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
mHScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
NS_LITERAL_STRING("horizontal"), PR_FALSE);
@ -1711,7 +1711,7 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
if (canHaveVertical) {
rv = NS_NewElement(getter_AddRefs(mVScrollbarContent),
kNameSpaceID_XUL, nodeInfo);
kNameSpaceID_XUL, nodeInfo, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
mVScrollbarContent->SetAttr(kNameSpaceID_None, nsGkAtoms::orient,
NS_LITERAL_STRING("vertical"), PR_FALSE);
@ -1723,7 +1723,7 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
nodeInfoManager->GetNodeInfo(nsGkAtoms::scrollcorner, nsnull,
kNameSpaceID_XUL, getter_AddRefs(nodeInfo));
rv = NS_NewElement(getter_AddRefs(mScrollCornerContent),
kNameSpaceID_XUL, nodeInfo);
kNameSpaceID_XUL, nodeInfo, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
if (!aElements.AppendElement(mScrollCornerContent))
return NS_ERROR_OUT_OF_MEMORY;