Pass a boolean indicating whether we've sent a ContentInserted or
ContentAppended notification to DoneAddingChildren. Bug 309534, r=mrbkap, sr=jst git-svn-id: svn://10.0.0.236/trunk@180787 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
9b25d9f96b
commit
33eede8798
@ -61,8 +61,8 @@ class nsIURI;
|
||||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x66b01442, 0x75ed, 0x4605, \
|
||||
{ 0x87, 0x06, 0x70, 0x22, 0x27, 0x9d, 0x19, 0x0b } }
|
||||
{ 0x89f20ce8, 0x08cd, 0x4066, \
|
||||
{ 0x8a, 0xd5, 0x9e, 0x11, 0x1e, 0x43, 0x52, 0x29 } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
@ -673,8 +673,12 @@ public:
|
||||
* boolean aFromParser to the NS_NewXXX() constructor for your element and
|
||||
* have the parser pass true. See nsHTMLInputElement.cpp and
|
||||
* nsHTMLContentSink::MakeContentObject().
|
||||
*
|
||||
* @param aHaveNotified Whether there has been a
|
||||
* ContentInserted/ContentAppended notification for this content node
|
||||
* yet.
|
||||
*/
|
||||
virtual void DoneAddingChildren()
|
||||
virtual void DoneAddingChildren(PRBool aHaveNotified)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ public:
|
||||
// nsIDOMHTMLAppletElement
|
||||
NS_DECL_NSIDOMHTMLAPPLETELEMENT
|
||||
|
||||
virtual void DoneAddingChildren();
|
||||
virtual void DoneAddingChildren(PRBool aHaveNotified);
|
||||
virtual PRBool IsDoneAddingChildren();
|
||||
|
||||
// nsIContent
|
||||
@ -141,13 +141,13 @@ nsHTMLAppletElement::GetCapabilities() const
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLAppletElement::DoneAddingChildren()
|
||||
nsHTMLAppletElement::DoneAddingChildren(PRBool aHaveNotified)
|
||||
{
|
||||
mIsDoneAddingChildren = PR_TRUE;
|
||||
// If we're already in the document, start the load, because BindToTree
|
||||
// didn't.
|
||||
if (IsInDoc()) {
|
||||
StartAppletLoad(MayHaveFrame());
|
||||
StartAppletLoad(aHaveNotified);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -95,7 +95,7 @@ public:
|
||||
NS_IMETHOD SaveState();
|
||||
virtual PRBool RestoreState(nsPresState* aState);
|
||||
|
||||
virtual void DoneAddingChildren();
|
||||
virtual void DoneAddingChildren(PRBool aHaveNotified);
|
||||
virtual PRBool IsDoneAddingChildren();
|
||||
|
||||
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
|
||||
@ -139,14 +139,14 @@ nsHTMLObjectElement::IsDoneAddingChildren()
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLObjectElement::DoneAddingChildren()
|
||||
nsHTMLObjectElement::DoneAddingChildren(PRBool aHaveNotified)
|
||||
{
|
||||
mIsDoneAddingChildren = PR_TRUE;
|
||||
|
||||
// If we're already in a document, we need to trigger the load
|
||||
// Otherwise, BindToTree takes care of that.
|
||||
if (IsInDoc()) {
|
||||
StartObjectLoad(MayHaveFrame());
|
||||
StartObjectLoad(aHaveNotified);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -357,7 +357,7 @@ public:
|
||||
|
||||
virtual nsresult GetInnerHTML(nsAString& aInnerHTML);
|
||||
virtual nsresult SetInnerHTML(const nsAString& aInnerHTML);
|
||||
virtual void DoneAddingChildren();
|
||||
virtual void DoneAddingChildren(PRBool aHaveNotified);
|
||||
virtual PRBool IsDoneAddingChildren();
|
||||
|
||||
protected:
|
||||
@ -551,7 +551,7 @@ nsHTMLScriptElement::SetInnerHTML(const nsAString& aInnerHTML)
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLScriptElement::DoneAddingChildren()
|
||||
nsHTMLScriptElement::DoneAddingChildren(PRBool aHaveNotified)
|
||||
{
|
||||
mDoneAddingChildren = PR_TRUE;
|
||||
MaybeProcessScript();
|
||||
|
||||
@ -243,7 +243,7 @@ public:
|
||||
// nsISelectElement
|
||||
NS_DECL_NSISELECTELEMENT
|
||||
|
||||
virtual void DoneAddingChildren();
|
||||
virtual void DoneAddingChildren(PRBool aHaveNotified);
|
||||
virtual PRBool IsDoneAddingChildren();
|
||||
|
||||
virtual PRBool ParseAttribute(nsIAtom* aAttribute,
|
||||
@ -1636,7 +1636,7 @@ nsHTMLSelectElement::IsDoneAddingChildren()
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLSelectElement::DoneAddingChildren()
|
||||
nsHTMLSelectElement::DoneAddingChildren(PRBool aHaveNotified)
|
||||
{
|
||||
mIsDoneAddingChildren = PR_TRUE;
|
||||
|
||||
|
||||
@ -134,7 +134,7 @@ public:
|
||||
nsEventStatus* aEventStatus);
|
||||
virtual void SetFocus(nsPresContext* aPresContext);
|
||||
|
||||
virtual void DoneAddingChildren();
|
||||
virtual void DoneAddingChildren(PRBool aHaveNotified);
|
||||
virtual PRBool IsDoneAddingChildren();
|
||||
|
||||
protected:
|
||||
@ -612,7 +612,7 @@ nsHTMLTextAreaElement::HandleDOMEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
void
|
||||
nsHTMLTextAreaElement::DoneAddingChildren()
|
||||
nsHTMLTextAreaElement::DoneAddingChildren(PRBool aHaveNotified)
|
||||
{
|
||||
if (!mValueChanged) {
|
||||
if (!mDoneAddingChildren) {
|
||||
|
||||
@ -410,7 +410,8 @@ protected:
|
||||
|
||||
// Routines for tags that require special handling when we reach their end
|
||||
// tag.
|
||||
nsresult ProcessSCRIPTEndTag(nsGenericHTMLElement* content);
|
||||
nsresult ProcessSCRIPTEndTag(nsGenericHTMLElement* content,
|
||||
PRBool aHaveNotified);
|
||||
nsresult ProcessSTYLEEndTag(nsGenericHTMLElement* content);
|
||||
|
||||
nsresult OpenHeadContext();
|
||||
@ -728,6 +729,13 @@ public:
|
||||
void DidAddContent(nsIContent* aContent, PRBool aDidNotify = PR_FALSE);
|
||||
void UpdateChildCounts();
|
||||
|
||||
private:
|
||||
// Function to check whether we've notified for the current content.
|
||||
// What this actually does is check whether we've notified for all
|
||||
// of the parent's kids.
|
||||
PRBool HaveNotifiedForCurrentContent() const;
|
||||
|
||||
public:
|
||||
HTMLContentSink* mSink;
|
||||
PRInt32 mNotifyLevel;
|
||||
nsCOMPtr<nsITextContent> mLastTextNode;
|
||||
@ -1282,6 +1290,17 @@ SinkContext::OpenContainer(const nsIParserNode& aNode)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
SinkContext::HaveNotifiedForCurrentContent() const
|
||||
{
|
||||
if (0 < mStackPos) {
|
||||
nsIContent* parent = mStack[mStackPos - 1].mContent;
|
||||
return mStack[mStackPos-1].mNumFlushed == parent->GetChildCount();
|
||||
}
|
||||
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
nsresult
|
||||
SinkContext::CloseContainer(const nsHTMLTag aTag)
|
||||
{
|
||||
@ -1376,11 +1395,12 @@ SinkContext::CloseContainer(const nsHTMLTag aTag)
|
||||
case eHTMLTag_textarea:
|
||||
case eHTMLTag_object:
|
||||
case eHTMLTag_applet:
|
||||
content->DoneAddingChildren();
|
||||
content->DoneAddingChildren(HaveNotifiedForCurrentContent());
|
||||
break;
|
||||
|
||||
case eHTMLTag_script:
|
||||
result = mSink->ProcessSCRIPTEndTag(content);
|
||||
result = mSink->ProcessSCRIPTEndTag(content,
|
||||
HaveNotifiedForCurrentContent());
|
||||
break;
|
||||
|
||||
case eHTMLTag_style:
|
||||
@ -3994,7 +4014,8 @@ HTMLContentSink::PostEvaluateScript()
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLContentSink::ProcessSCRIPTEndTag(nsGenericHTMLElement *content)
|
||||
HTMLContentSink::ProcessSCRIPTEndTag(nsGenericHTMLElement *content,
|
||||
PRBool aHaveNotified)
|
||||
{
|
||||
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(content);
|
||||
NS_ASSERTION(sele, "Not really closing a script tag?");
|
||||
@ -4032,7 +4053,7 @@ HTMLContentSink::ProcessSCRIPTEndTag(nsGenericHTMLElement *content)
|
||||
|
||||
// Now tell the script that it's ready to go. This will execute the script
|
||||
// and call our ScriptAvailable method.
|
||||
content->DoneAddingChildren();
|
||||
content->DoneAddingChildren(aHaveNotified);
|
||||
|
||||
// To prevent script evaluation in a frameset document, we suspended
|
||||
// the script loader. Now that the script content has been handled,
|
||||
|
||||
@ -498,7 +498,7 @@ nsXMLContentSink::CloseElement(nsIContent* aContent, nsIContent* aParent,
|
||||
|| nodeInfo->NamespaceID() > kNameSpaceID_LastBuiltin
|
||||
#endif
|
||||
) {
|
||||
aContent->DoneAddingChildren();
|
||||
aContent->DoneAddingChildren(PR_FALSE);
|
||||
}
|
||||
|
||||
if (!nodeInfo->NamespaceEquals(kNameSpaceID_XHTML) &&
|
||||
|
||||
@ -447,7 +447,7 @@ nsXTFElementWrapper::BeginAddingChildren()
|
||||
}
|
||||
|
||||
void
|
||||
nsXTFElementWrapper::DoneAddingChildren()
|
||||
nsXTFElementWrapper::DoneAddingChildren(PRBool aHaveNotified)
|
||||
{
|
||||
if (mNotificationMask & nsIXTFElement::NOTIFY_DONE_ADDING_CHILDREN)
|
||||
GetXTFElement()->DoneAddingChildren();
|
||||
|
||||
@ -109,7 +109,7 @@ public:
|
||||
virtual PRInt32 IntrinsicState() const;
|
||||
|
||||
virtual void BeginAddingChildren();
|
||||
virtual void DoneAddingChildren();
|
||||
virtual void DoneAddingChildren(PRBool aHaveNotified);
|
||||
|
||||
// nsIDOMElement specializations:
|
||||
NS_IMETHOD GetAttribute(const nsAString& aName,
|
||||
|
||||
@ -2787,7 +2787,7 @@ nsXULDocument::ResumeWalk()
|
||||
|
||||
#ifdef MOZ_XTF
|
||||
if (element->GetNameSpaceID() > kNameSpaceID_LastBuiltin) {
|
||||
element->DoneAddingChildren();
|
||||
element->DoneAddingChildren(PR_FALSE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user