Bug 16709. Set 'content ID' fields on elements as they are constructed from XUL.

This commit is contained in:
waterson%netscape.com 1999-12-06 23:05:31 +00:00
Родитель c3688d7937
Коммит 77a02a8fff
8 изменённых файлов: 28 добавлений и 12 удалений

Просмотреть файл

@ -2717,14 +2717,15 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext,
NS_IMETHODIMP NS_IMETHODIMP
nsXULElement::GetContentID(PRUint32* aID) nsXULElement::GetContentID(PRUint32* aID)
{ {
*aID = 0; *aID = mContentId;
return NS_ERROR_NOT_IMPLEMENTED; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsXULElement::SetContentID(PRUint32 aID) nsXULElement::SetContentID(PRUint32 aID)
{ {
return NS_ERROR_NOT_IMPLEMENTED; mContentId = aID;
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

Просмотреть файл

@ -519,6 +519,7 @@ protected:
nsCOMPtr<nsISupportsArray> mChildren; // [OWNER] nsCOMPtr<nsISupportsArray> mChildren; // [OWNER]
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER] nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
void* mScriptObject; // [OWNER] void* mScriptObject; // [OWNER]
PRInt32 mContentId;
// The state of our sloth for lazy content model construction via // The state of our sloth for lazy content model construction via
// RDF; see nsIXULContent and nsRDFGenericBuilder. // RDF; see nsIXULContent and nsRDFGenericBuilder.

Просмотреть файл

@ -55,6 +55,7 @@
#include "nsIBrowserWindow.h" #include "nsIBrowserWindow.h"
#include "nsIChromeRegistry.h" #include "nsIChromeRegistry.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIContentSink.h" // for NS_CONTENT_ID_COUNTER_BASE
#include "nsIContentViewer.h" #include "nsIContentViewer.h"
#include "nsICSSStyleSheet.h" #include "nsICSSStyleSheet.h"
#include "nsIDOMEvent.h" #include "nsIDOMEvent.h"
@ -203,7 +204,6 @@ nsIXULPrototypeCache* nsXULDocument::gXULCache;
PRLogModuleInfo* nsXULDocument::gXULLog; PRLogModuleInfo* nsXULDocument::gXULLog;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// //
// PlaceholderChannel // PlaceholderChannel
@ -310,6 +310,7 @@ nsXULDocument::nsXULDocument(void)
mDisplaySelection(PR_FALSE), mDisplaySelection(PR_FALSE),
mIsPopup(PR_FALSE), mIsPopup(PR_FALSE),
mResolutionPhase(nsForwardReference::eStart), mResolutionPhase(nsForwardReference::eStart),
mNextContentID(NS_CONTENT_ID_COUNTER_BASE),
mState(eState_Master), mState(eState_Master),
mCurrentScriptProto(nsnull) mCurrentScriptProto(nsnull)
{ {
@ -3886,8 +3887,8 @@ nsXULDocument::RebuildWidgetItem(nsIContent* aElement)
nsresult nsresult
nsXULDocument::CreateElement(PRInt32 aNameSpaceID, nsXULDocument::CreateElement(PRInt32 aNameSpaceID,
nsIAtom* aTag, nsIAtom* aTag,
nsIContent** aResult) nsIContent** aResult)
{ {
nsresult rv; nsresult rv;
nsCOMPtr<nsIContent> result; nsCOMPtr<nsIContent> result;
@ -3913,6 +3914,8 @@ nsXULDocument::CreateElement(PRInt32 aNameSpaceID,
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set element's document"); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set element's document");
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
result->SetContentID(mNextContentID++);
*aResult = result; *aResult = result;
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
return NS_OK; return NS_OK;
@ -4941,6 +4944,8 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
} }
} }
result->SetContentID(mNextContentID++);
*aResult = result; *aResult = result;
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
return NS_OK; return NS_OK;

Просмотреть файл

@ -525,6 +525,7 @@ protected:
nsVoidArray mForwardReferences; nsVoidArray mForwardReferences;
nsForwardReference::Phase mResolutionPhase; nsForwardReference::Phase mResolutionPhase;
PRInt32 mNextContentID;
// The following are pointers into the content model which provide access to // The following are pointers into the content model which provide access to
// the objects triggering either a popup or a tooltip. These are marked as // the objects triggering either a popup or a tooltip. These are marked as

Просмотреть файл

@ -55,6 +55,7 @@
#include "nsIBrowserWindow.h" #include "nsIBrowserWindow.h"
#include "nsIChromeRegistry.h" #include "nsIChromeRegistry.h"
#include "nsIComponentManager.h" #include "nsIComponentManager.h"
#include "nsIContentSink.h" // for NS_CONTENT_ID_COUNTER_BASE
#include "nsIContentViewer.h" #include "nsIContentViewer.h"
#include "nsICSSStyleSheet.h" #include "nsICSSStyleSheet.h"
#include "nsIDOMEvent.h" #include "nsIDOMEvent.h"
@ -203,7 +204,6 @@ nsIXULPrototypeCache* nsXULDocument::gXULCache;
PRLogModuleInfo* nsXULDocument::gXULLog; PRLogModuleInfo* nsXULDocument::gXULLog;
//---------------------------------------------------------------------- //----------------------------------------------------------------------
// //
// PlaceholderChannel // PlaceholderChannel
@ -310,6 +310,7 @@ nsXULDocument::nsXULDocument(void)
mDisplaySelection(PR_FALSE), mDisplaySelection(PR_FALSE),
mIsPopup(PR_FALSE), mIsPopup(PR_FALSE),
mResolutionPhase(nsForwardReference::eStart), mResolutionPhase(nsForwardReference::eStart),
mNextContentID(NS_CONTENT_ID_COUNTER_BASE),
mState(eState_Master), mState(eState_Master),
mCurrentScriptProto(nsnull) mCurrentScriptProto(nsnull)
{ {
@ -3886,8 +3887,8 @@ nsXULDocument::RebuildWidgetItem(nsIContent* aElement)
nsresult nsresult
nsXULDocument::CreateElement(PRInt32 aNameSpaceID, nsXULDocument::CreateElement(PRInt32 aNameSpaceID,
nsIAtom* aTag, nsIAtom* aTag,
nsIContent** aResult) nsIContent** aResult)
{ {
nsresult rv; nsresult rv;
nsCOMPtr<nsIContent> result; nsCOMPtr<nsIContent> result;
@ -3913,6 +3914,8 @@ nsXULDocument::CreateElement(PRInt32 aNameSpaceID,
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set element's document"); NS_ASSERTION(NS_SUCCEEDED(rv), "unable to set element's document");
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
result->SetContentID(mNextContentID++);
*aResult = result; *aResult = result;
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
return NS_OK; return NS_OK;
@ -4941,6 +4944,8 @@ nsXULDocument::CreateElement(nsXULPrototypeElement* aPrototype, nsIContent** aRe
} }
} }
result->SetContentID(mNextContentID++);
*aResult = result; *aResult = result;
NS_ADDREF(*aResult); NS_ADDREF(*aResult);
return NS_OK; return NS_OK;

Просмотреть файл

@ -525,6 +525,7 @@ protected:
nsVoidArray mForwardReferences; nsVoidArray mForwardReferences;
nsForwardReference::Phase mResolutionPhase; nsForwardReference::Phase mResolutionPhase;
PRInt32 mNextContentID;
// The following are pointers into the content model which provide access to // The following are pointers into the content model which provide access to
// the objects triggering either a popup or a tooltip. These are marked as // the objects triggering either a popup or a tooltip. These are marked as

Просмотреть файл

@ -2717,14 +2717,15 @@ nsXULElement::HandleDOMEvent(nsIPresContext* aPresContext,
NS_IMETHODIMP NS_IMETHODIMP
nsXULElement::GetContentID(PRUint32* aID) nsXULElement::GetContentID(PRUint32* aID)
{ {
*aID = 0; *aID = mContentId;
return NS_ERROR_NOT_IMPLEMENTED; return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
nsXULElement::SetContentID(PRUint32 aID) nsXULElement::SetContentID(PRUint32 aID)
{ {
return NS_ERROR_NOT_IMPLEMENTED; mContentId = aID;
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP

Просмотреть файл

@ -519,6 +519,7 @@ protected:
nsCOMPtr<nsISupportsArray> mChildren; // [OWNER] nsCOMPtr<nsISupportsArray> mChildren; // [OWNER]
nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER] nsCOMPtr<nsIEventListenerManager> mListenerManager; // [OWNER]
void* mScriptObject; // [OWNER] void* mScriptObject; // [OWNER]
PRInt32 mContentId;
// The state of our sloth for lazy content model construction via // The state of our sloth for lazy content model construction via
// RDF; see nsIXULContent and nsRDFGenericBuilder. // RDF; see nsIXULContent and nsRDFGenericBuilder.