Add a beginAddingChildren notification to XTF (bug 268691). r+sr=jst

This commit is contained in:
bryner%brianryner.com 2004-11-09 23:59:24 +00:00
parent 94b08bc344
commit d37af99b29
11 changed files with 48 additions and 10 deletions

View File

@ -60,8 +60,8 @@ class nsIURI;
// IID for the nsIContent interface
#define NS_ICONTENT_IID \
{ 0x658d21a4, 0xc446, 0x11d8, \
{ 0x84, 0xe1, 0x00, 0x0a, 0x95, 0xdc, 0x23, 0x4c } }
{ 0xdd5c7dd9, 0x4c9b, 0x46ac, \
{ 0x87, 0x5c, 0xcb, 0xba, 0xe5, 0x41, 0x84, 0xb5 } }
/**
* A node of content in a document's content model. This interface
@ -583,6 +583,16 @@ public:
{
}
/**
* This method is called when the parser begins creating the element's
* children, if any are present.
*
* This is only called for XTF elements currently.
*/
virtual void BeginAddingChildren()
{
}
/**
* This method is called when the parser finishes creating the element's children,
* if any are present.

View File

@ -1063,6 +1063,11 @@ nsXMLContentSink::HandleStartElement(const PRUnichar *aName,
}
}
#ifdef MOZ_XTF
if (nameSpaceID > kNameSpaceID_LastBuiltin)
content->BeginAddingChildren();
#endif
return result;
}

View File

@ -43,7 +43,7 @@ interface nsIDOMElement;
interface nsIDOMNode;
interface nsIDOMEvent;
[scriptable, uuid(f0617ed1-db6a-4704-ac4b-67bf15a77788)]
[scriptable, uuid(e29224e9-429e-4bcc-98de-ee7fc10e5866)]
interface nsIXTFElement : nsISupports
{
// called when the wrapper object is being destroyed.
@ -113,9 +113,10 @@ interface nsIXTFElement : nsISupports
const unsigned long NOTIFY_WILL_REMOVE_ATTRIBUTE = 0x00001000;
const unsigned long NOTIFY_ATTRIBUTE_REMOVED = 0x00002000;
const unsigned long NOTIFY_DONE_ADDING_CHILDREN = 0x00004000;
const unsigned long NOTIFY_BEGIN_ADDING_CHILDREN = 0x00004000;
const unsigned long NOTIFY_DONE_ADDING_CHILDREN = 0x00008000;
const unsigned long NOTIFY_HANDLE_DEFAULT = 0x00008000;
const unsigned long NOTIFY_HANDLE_DEFAULT = 0x00010000;
// Event notifications:
@ -140,6 +141,8 @@ interface nsIXTFElement : nsISupports
void willRemoveAttribute(in nsIAtom name);
void attributeRemoved(in nsIAtom name);
// These are for batching of child insertions during document load
void beginAddingChildren();
void doneAddingChildren();
// The default handler for DOM Events.

View File

@ -40,7 +40,7 @@
interface nsIXTFGenericElementWrapper;
[scriptable, uuid(39e595c6-c566-40ad-bc4c-92fc4352cffd)]
[scriptable, uuid(e339eb1d-3ea8-4c85-87ce-644eb7a19034)]
interface nsIXTFGenericElement : nsIXTFElement
{
// onCreated: Will be called before any notifications are sent to

View File

@ -41,7 +41,7 @@
interface nsIXTFSVGVisualWrapper;
interface nsIDOMElement;
[scriptable, uuid(6e051a6a-9ac3-4f3a-b701-d794761c47d9)]
[scriptable, uuid(5fd47925-03b2-4318-b55e-c37134124b6a)]
interface nsIXTFSVGVisual : nsIXTFVisual
{
// onCreated: Will be called before any notifications are sent to

View File

@ -40,7 +40,7 @@
interface nsIDOMElement;
[scriptable, uuid(705e7fc8-6fbb-456e-8d18-fd2dae55d477)]
[scriptable, uuid(1ea57817-73cc-4224-adb7-55aa83bb3f09)]
interface nsIXTFVisual : nsIXTFElement
{
// The content tree rooted in 'visualContent' will be rendered where

View File

@ -41,7 +41,7 @@
interface nsIXTFXMLVisualWrapper;
interface nsIDOMElement;
[scriptable, uuid(f6e8a067-a3ec-450f-b1e1-3f14ac2b369e)]
[scriptable, uuid(e63d240d-bd00-4857-ba65-2f9cc599eead)]
interface nsIXTFXMLVisual : nsIXTFVisual
{
// onCreated: Will be called before any notifications are sent to

View File

@ -41,7 +41,7 @@
interface nsIXTFXULVisualWrapper;
interface nsIDOMElement;
[scriptable, uuid(d4ae63e2-bf46-4792-8ae4-5105aeab26a3)]
[scriptable, uuid(a1173d91-4428-4829-8e3e-fe66e558f161)]
interface nsIXTFXULVisual : nsIXTFVisual
{
// onCreated: Will be called before any notifications are sent to

View File

@ -337,6 +337,13 @@ nsXTFElementWrapper::GetAttrCount() const
return innerCount + nsXTFElementWrapperBase::GetAttrCount();
}
void
nsXTFElementWrapper::BeginAddingChildren()
{
if (mNotificationMask & nsIXTFElement::NOTIFY_BEGIN_ADDING_CHILDREN)
GetXTFElement()->BeginAddingChildren();
}
void
nsXTFElementWrapper::DoneAddingChildren()
{

View File

@ -99,6 +99,7 @@ public:
PRUint32 GetAttrCount() const;
virtual already_AddRefed<nsINodeInfo> GetExistingAttrNameFromQName(const nsAString& aStr) const;
virtual void BeginAddingChildren();
virtual void DoneAddingChildren();
// nsIDOMElement specializations:

View File

@ -166,6 +166,12 @@ nsXFormsStubElement::AttributeRemoved(nsIAtom *aName)
return NS_OK;
}
NS_IMETHODIMP
nsXFormsStubElement::BeginAddingChildren()
{
return NS_OK;
}
NS_IMETHODIMP
nsXFormsStubElement::DoneAddingChildren()
{
@ -315,6 +321,12 @@ nsXFormsXMLVisualStub::AttributeRemoved(nsIAtom *aName)
return NS_OK;
}
NS_IMETHODIMP
nsXFormsXMLVisualStub::BeginAddingChildren()
{
return NS_OK;
}
NS_IMETHODIMP
nsXFormsXMLVisualStub::DoneAddingChildren()
{