Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends
nsXULDocument Class Reference

The XUL document class. More...

#include <nsXULDocument.h>

Inheritance diagram for nsXULDocument:
Inheritance graph
[legend]
Collaboration diagram for nsXULDocument:
Collaboration graph
[legend]

List of all members.

Classes

class  BroadcasterHookup
 Used to resolve broadcaster references. More...
class  CachedChromeStreamListener
class  ContextStack
 Context stack, which maintains the state of the Builder and allows it to be interrupted. More...
class  OverlayForwardReference
 Used to hook up overlays. More...
class  ParserObserver
class  TemplateBuilderHookup

Public Types

typedef PRBool(* nsSubDocEnumFunc )(nsIDocument *aDocument, void *aData)
 Enumerate all subdocuments.

Public Member Functions

 nsXULDocument ()
virtual ~nsXULDocument ()
NS_DECL_ISUPPORTS_INHERITED
virtual
NS_DECL_NSISTREAMLOADEROBSERVER
void 
Reset (nsIChannel *aChannel, nsILoadGroup *aLoadGroup)
 Reset the document using the given channel and loadgroup.
virtual void ResetToURI (nsIURI *aURI, nsILoadGroup *aLoadGroup)
 Reset this document to aURI and aLoadGroup.
virtual nsresult StartDocumentLoad (const char *aCommand, nsIChannel *channel, nsILoadGroup *aLoadGroup, nsISupports *aContainer, nsIStreamListener **aDocListener, PRBool aReset=PR_TRUE, nsIContentSink *aSink=nsnull)
virtual nsIPrincipalGetPrincipal ()
 Return the principal responsible for this document.
virtual void SetPrincipal (nsIPrincipal *aPrincipal)
 Set the principal responsible for this document.
virtual void SetContentType (const nsAString &aContentType)
 Get the Content-Type of this document.
virtual void EndLoad ()
virtual void ContentAppended (nsIContent *aContainer, PRInt32 aNewIndexInContainer)
virtual void ContentInserted (nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)
virtual void ContentRemoved (nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)
virtual void AttributeChanged (nsIContent *aElement, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType)
virtual nsresult HandleDOMEvent (nsPresContext *aPresContext, nsEvent *aEvent, nsIDOMEvent **aDOMEvent, PRUint32 aFlags, nsEventStatus *aEventStatus)
NS_IMETHOD AddElementForID (const nsAString &aID, nsIContent *aElement)
 Add an entry to the ID-to-element map.
NS_IMETHOD RemoveElementForID (const nsAString &aID, nsIContent *aElement)
 Remove an entry from the ID-to-element map.
NS_IMETHOD GetElementsForID (const nsAString &aID, nsISupportsArray *aElements)
 Get the elements for a particular resource in the resource-to-element map.
NS_IMETHOD AddForwardReference (nsForwardReference *aRef)
 Add a "forward declaration" of a XUL observer.
NS_IMETHOD ResolveForwardReferences ()
 Resolve the all of the document's forward references.
NS_IMETHOD SetMasterPrototype (nsIXULPrototypeDocument *aDocument)
 Set the master prototype.
NS_IMETHOD GetMasterPrototype (nsIXULPrototypeDocument **aDocument)
 Get the master prototype.
NS_IMETHOD SetCurrentPrototype (nsIXULPrototypeDocument *aDocument)
 Set the current prototype.
NS_IMETHOD AddSubtreeToDocument (nsIContent *aElement)
 Notify the XUL document that a subtree has been added.
NS_IMETHOD RemoveSubtreeFromDocument (nsIContent *aElement)
 Notify the XUL document that a subtree has been removed.
NS_IMETHOD SetTemplateBuilderFor (nsIContent *aContent, nsIXULTemplateBuilder *aBuilder)
 Attach a XUL template builder to the specified content node.
NS_IMETHOD GetTemplateBuilderFor (nsIContent *aContent, nsIXULTemplateBuilder **aResult)
 Retrieve the XUL template builder that's attached to a content node.
NS_IMETHOD OnPrototypeLoadDone ()
 Callback notifying this document when its XUL prototype document load completes.
NS_IMETHOD OnHide ()
 Notify the XUL document that it's being hidden.
NS_IMETHOD CloneNode (PRBool deep, nsIDOMNode **_retval)
NS_IMETHOD GetElementById (const nsAString &elementId, nsIDOMElement **_retval)
NS_DECL_NSIDOMXULDOCUMENT
NS_DECL_NSIDOMXULDOCUMENT2
NS_DECL_NSIDOMXULDOCUMENT_MOZILLA_1_8_BRANCH
NS_IMETHOD 
GetContentType (nsAString &aContentType)
 Get the Content-Type of this document.
virtual PRBool IsLoadedAsData ()
void SetLoadedAsData (PRBool aLoadedAsData)
virtual void StopDocumentLoad ()
virtual nsresult SetBaseURI (nsIURI *aURI)
virtual void GetBaseTarget (nsAString &aBaseTarget) const
 Get/Set the base target of a link in a document.
virtual void SetBaseTarget (const nsAString &aBaseTarget)
virtual void SetDocumentCharacterSet (const nsACString &aCharSetID)
 Return a standard name for the document's character set.
virtual nsresult AddCharSetObserver (nsIObserver *aObserver)
 Add an observer that gets notified whenever the charset changes.
virtual void RemoveCharSetObserver (nsIObserver *aObserver)
 Remove a charset observer.
virtual nsILineBreakerGetLineBreaker ()
 Return the Line Breaker for the document.
virtual void SetLineBreaker (nsILineBreaker *aLineBreaker)
virtual nsIWordBreakerGetWordBreaker ()
virtual void SetWordBreaker (nsIWordBreaker *aWordBreaker)
virtual void GetHeaderData (nsIAtom *aHeaderField, nsAString &aData) const
 Access HTTP header data (this may also get set from other sources, like HTML META tags).
virtual void SetHeaderData (nsIAtom *aheaderField, const nsAString &aData)
virtual nsresult CreateShell (nsPresContext *aContext, nsIViewManager *aViewManager, nsStyleSet *aStyleSet, nsIPresShell **aInstancePtrResult)
 Create a new presentation shell that will use aContext for it's presentation context (presentation context's must not be shared among multiple presentation shell's).
virtual PRBool DeleteShell (nsIPresShell *aShell)
virtual PRUint32 GetNumberOfShells () const
virtual nsIPresShellGetShellAt (PRUint32 aIndex) const
virtual nsresult SetSubDocumentFor (nsIContent *aContent, nsIDocument *aSubDoc)
 Set the sub document for aContent to aSubDoc.
virtual nsIDocumentGetSubDocumentFor (nsIContent *aContent) const
 Get the sub document for aContent.
virtual nsIContentFindContentForSubDocument (nsIDocument *aDocument) const
 Find the content node for which aDocument is a sub document.
virtual nsresult SetRootContent (nsIContent *aRoot)
 Set aRoot as the root content object for this document.
virtual nsIContentGetChildAt (PRUint32 aIndex) const
 Get the direct children of the document - content in the prolog, the root content and content in the epilog.
virtual PRInt32 IndexOf (nsIContent *aPossibleChild) const
virtual PRUint32 GetChildCount () const
virtual nsresult RemoveChildAt (PRUint32 aIndex, PRBool aNotify)
 Remove a child from this document.
virtual PRInt32 GetNumberOfStyleSheets () const
 Get the style sheets owned by this document.
virtual nsIStyleSheetGetStyleSheetAt (PRInt32 aIndex) const
 Get a particular stylesheet.
virtual PRInt32 GetIndexOfStyleSheet (nsIStyleSheet *aSheet) const
 Get the index of a particular stylesheet.
virtual void AddStyleSheet (nsIStyleSheet *aSheet)
 Add a stylesheet to the document.
virtual void RemoveStyleSheet (nsIStyleSheet *aSheet)
 Remove a stylesheet from the document.
virtual void UpdateStyleSheets (nsCOMArray< nsIStyleSheet > &aOldSheets, nsCOMArray< nsIStyleSheet > &aNewSheets)
 Replace the stylesheets in aOldSheets with the stylesheets in aNewSheets.
virtual void AddStyleSheetToStyleSets (nsIStyleSheet *aSheet)
virtual void RemoveStyleSheetFromStyleSets (nsIStyleSheet *aSheet)
virtual void InsertStyleSheetAt (nsIStyleSheet *aSheet, PRInt32 aIndex)
 Insert a sheet at a particular spot in the stylesheet list (zero-based)
virtual void SetStyleSheetApplicableState (nsIStyleSheet *aSheet, PRBool aApplicable)
 Notify the document that the applicable state of the sheet changed and that observers should be notified and style sets updated.
virtual PRInt32 GetNumberOfCatalogStyleSheets () const
 Just like the style sheet API, but for "catalog" sheets, extra sheets inserted at the UA level.
virtual nsIStyleSheetGetCatalogStyleSheetAt (PRInt32 aIndex) const
virtual void AddCatalogStyleSheet (nsIStyleSheet *aSheet)
virtual void EnsureCatalogStyleSheet (const char *aStyleSheetURI)
virtual nsIChannelGetChannel () const
 Get the channel that was passed to StartDocumentLoad or Reset for this document.
virtual nsHTMLStyleSheetGetAttributeStyleSheet () const
 Get this document's attribute stylesheet.
virtual nsIHTMLCSSStyleSheetGetInlineStyleSheet () const
 Get this document's inline style sheet.
virtual nsIScriptGlobalObjectGetScriptGlobalObject () const
 Set the object from which a document can get a script context.
virtual void SetScriptGlobalObject (nsIScriptGlobalObject *aGlobalObject)
virtual nsIScriptGlobalObjectGetScriptHandlingObject (PRBool &aHasHadScriptHandlingObject) const
 Get/set the object from which the context for the event/script handling can be got.
virtual void SetScriptHandlingObject (nsIScriptGlobalObject *aScriptObject)
void ClearScriptHandlingObject ()
virtual nsIScriptGlobalObjectGetScopeObject ()
 Get the object that is used as the scope for all of the content wrappers whose owner document is this document.
virtual nsPIDOMWindowGetWindow ()
 Return the window containing the document (the outer window).
virtual nsIScriptLoaderGetScriptLoader ()
 Get the script loader for this document.
virtual void AddObserver (nsIDocumentObserver *aObserver)
 Add a new observer of document change notifications.
virtual PRBool RemoveObserver (nsIDocumentObserver *aObserver)
 Remove an observer of document change notifications.
virtual void BeginUpdate (nsUpdateType aUpdateType)
virtual void EndUpdate (nsUpdateType aUpdateType)
virtual void BeginLoad ()
virtual void CharacterDataChanged (nsIContent *aContent, PRBool aAppend)
virtual void ContentStatesChanged (nsIContent *aContent1, nsIContent *aContent2, PRInt32 aStateMask)
virtual void AttributeWillChange (nsIContent *aChild, PRInt32 aNameSpaceID, nsIAtom *aAttribute)
virtual void StyleRuleChanged (nsIStyleSheet *aStyleSheet, nsIStyleRule *aOldStyleRule, nsIStyleRule *aNewStyleRule)
virtual void StyleRuleAdded (nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
virtual void StyleRuleRemoved (nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)
virtual void FlushPendingNotifications (mozFlushType aType)
 Flush notifications for this document and its parent documents (since those may affect the layout of this one).
virtual nsIScriptEventManagerGetScriptEventManager ()
virtual void SetXMLDeclaration (const PRUnichar *aVersion, const PRUnichar *aEncoding, const PRInt32 aStandalone)
 Set and get XML declaration.
virtual void GetXMLDeclaration (nsAString &aVersion, nsAString &aEncoding, nsAString &Standalone)
virtual PRBool IsScriptEnabled ()
virtual void OnPageShow (PRBool aPersisted)
 Notification that the page has been shown, for documents which are loaded into a DOM window.
virtual void OnPageHide (PRBool aPersisted)
 Notification that the page has been hidden, for documents which are loaded into a DOM window.
NS_IMETHOD WalkRadioGroup (const nsAString &aName, nsIRadioVisitor *aVisitor)
 Walk through the radio group, visiting each note with avisitor->Visit()
NS_IMETHOD SetCurrentRadioButton (const nsAString &aName, nsIDOMHTMLInputElement *aRadio)
 Set the current radio button in a group.
NS_IMETHOD GetCurrentRadioButton (const nsAString &aName, nsIDOMHTMLInputElement **aRadio)
 Get the current radio button in a group.
NS_IMETHOD GetPositionInGroup (nsIDOMHTMLInputElement *aRadio, PRInt32 *aPositionIndex, PRInt32 *aItemsInGroup)
 Get the radio group position and the number of radio buttons in the group.
NS_IMETHOD GetNextRadioButton (const nsAString &aName, const PRBool aPrevious, nsIDOMHTMLInputElement *aFocusedRadio, nsIDOMHTMLInputElement **aRadioOut)
 Get the next/prev radio button in a group.
NS_IMETHOD AddToRadioGroup (const nsAString &aName, nsIFormControl *aRadio)
 Add radio button to radio group.
NS_IMETHOD RemoveFromRadioGroup (const nsAString &aName, nsIFormControl *aRadio)
 Remove radio button from radio group.
nsresult GetRadioGroup (const nsAString &aName, nsRadioGroupStruct **aRadioGroup)
virtual nsIDOMGCParticipantGetSCCIndex ()
 Get a reference node for what is known to be a strongly connected component of nsIDOMGCParticipants.
virtual void AppendReachableList (nsCOMArray< nsIDOMGCParticipant > &aArray)
 Append the list of nsIDOMGCPartipants reachable from this one via C++ getters exposed to script that return a different result from |GetSCCIndex|.
NS_DECL_NSIDOMNODE
NS_DECL_NSIDOM3NODE
NS_DECL_NSIDOMDOCUMENT
NS_DECL_NSIDOM3DOCUMENT
NS_DECL_NSIDOMXMLDOCUMENT
NS_DECL_NSIDOMNSDOCUMENT
NS_DECL_NSIDOMDOCUMENTEVENT
NS_DECL_NSIDOM3DOCUMENTEVENT
NS_DECL_NSIDOMDOCUMENTSTYLE
NS_DECL_NSIDOMNSDOCUMENTSTYLE
NS_DECL_NSIDOMDOCUMENTVIEW
NS_DECL_NSIDOMDOCUMENTRANGE
NS_DECL_NSIDOMDOCUMENTTRAVERSAL
NS_DECL_NSIDOMDOCUMENTXBL
NS_IMETHOD 
AddEventListenerByIID (nsIDOMEventListener *aListener, const nsIID &aIID)
NS_IMETHOD RemoveEventListenerByIID (nsIDOMEventListener *aListener, const nsIID &aIID)
NS_IMETHOD GetListenerManager (nsIEventListenerManager **aInstancePtrResult)
NS_IMETHOD HandleEvent (nsIDOMEvent *aEvent)
NS_IMETHOD GetSystemEventGroup (nsIDOMEventGroup **aGroup)
virtual nsresult AddXMLEventsContent (nsIContent *aXMLEventsElement)
virtual nsresult CreateElem (nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID, PRBool aDocumentDefaultType, nsIContent **aResult)
 Create an element with the specified name, prefix and namespace ID.
virtual NS_HIDDEN_ (void *) GetProperty(nsIAtom *aPropertyName
virtual NS_HIDDEN_ (nsresult) SetProperty(nsIAtom *aPropertyName
virtual NS_HIDDEN_ (nsresult) DeleteProperty(nsIAtom *aPropertyName)
virtual NS_HIDDEN_ (void *) UnsetProperty(nsIAtom *aPropertyName
virtual NS_HIDDEN_ (nsresult) Sanitize()
virtual NS_HIDDEN_ (void) EnumerateSubDocuments(nsSubDocEnumFunc aCallback
virtual NS_HIDDEN_ (PRBool) CanSavePresentation(nsIRequest *aNewRequest)
virtual NS_HIDDEN_ (void) Destroy()
virtual NS_HIDDEN_ (already_AddRefed< nsILayoutHistoryState >) GetLayoutHistoryState() const
virtual NS_HIDDEN_ (void) BlockOnload()
virtual NS_HIDDEN_ (void) UnblockOnload()
virtual NS_HIDDEN_ (void) AddStyleRelevantLink(nsIContent *aContent
virtual NS_HIDDEN_ (void) ForgetLink(nsIContent *aContent)
virtual NS_HIDDEN_ (void) NotifyURIVisitednessChanged(nsIURI *aURI)
const nsAFlatStringGetDocumentTitle () const
 Return the title of the document.
nsIURIGetDocumentURI () const
 Return the URI for the document.
void SetDocumentURI (nsIURI *aURI)
already_AddRefed< nsILoadGroupGetDocumentLoadGroup () const
 Return the LoadGroup for the document.
nsIURIGetBaseURI () const
 Return the base URI for relative URIs in the document (the document uri unless it's overridden by SetBaseURI, HTML <base> tags, etc.).
const nsAFlatCStringGetDocumentCharacterSet () const
 Return a standard name for the document's character set.
PRInt32 GetDocumentCharacterSetSource () const
void SetDocumentCharacterSetSource (PRInt32 aCharsetSource)
void GetContentLanguage (nsAString &aContentLanguage) const
 Return the language of this document.
PRBool GetBidiEnabled () const
 Check if the document contains bidi data.
void SetBidiEnabled (PRBool aBidiEnabled)
 Indicate the document contains bidi data.
nsIDocumentGetParentDocument () const
 Return the parent document of this document.
void SetParentDocument (nsIDocument *aParent)
 Set the parent document of this document.
nsIContentGetRootContent () const
 Return the root content object for this document.
nsICSSLoaderCSSLoader () const
 Get this document's CSSLoader.
PRInt32 GetAndIncrementContentID ()
nsIBindingManagerBindingManager () const
nsNodeInfoManagerNodeInfoManager () const
 Only to be used inside Gecko, you can't really do anything with the pointer outside Gecko anyway.
void SetContainer (nsISupports *aContainer)
 Set the container (docshell) for this document.
already_AddRefed< nsISupports > GetContainer () const
 Get the container (docshell) for this document.
virtual PRBool IsCaseSensitive ()
nsISupports * GetSecurityInfo ()
 Get the security info (i.e.
virtual voidGetProperty (nsIAtom *aPropertyName, nsresult *aStatus=nsnull) const =0
virtual nsresult SetProperty (nsIAtom *aPropertyName, void *aValue, NSPropertyDtorFunc aDtor=nsnull)=0
virtual nsresult DeleteProperty (nsIAtom *aPropertyName)=0
virtual voidUnsetProperty (nsIAtom *aPropertyName, nsresult *aStatus=nsnull)=0
nsPropertyTablePropertyTable ()
void SetPartID (PRUint32 aID)
 Sets the ID used to identify this part of the multipart document.
PRUint32 GetPartID () const
 Return the ID used to identify this part of the multipart document.
virtual nsresult Sanitize ()=0
 Sanitize the document by resetting all input elements and forms that have autocomplete=off to their default values.
virtual void EnumerateSubDocuments (nsSubDocEnumFunc aCallback, void *aData)=0
virtual PRBool CanSavePresentation (nsIRequest *aNewRequest)=0
 Check whether it is safe to cache the presentation of this document and all of its subdocuments.
virtual void Destroy ()=0
 Notify the document that its associated ContentViewer is being destroyed.
virtual already_AddRefed
< nsILayoutHistoryState
GetLayoutHistoryState () const =0
 Get the layout history state that should be used to save and restore state for nodes in this document.
virtual void BlockOnload ()=0
 Methods that can be used to prevent onload firing while an event that should block onload is posted.
virtual void UnblockOnload ()=0
virtual void AddStyleRelevantLink (nsIContent *aContent, nsIURI *aURI)=0
 Notification that an element is a link with a given URI that is relevant to style.
virtual void ForgetLink (nsIContent *aContent)=0
 Notification that an element is a link and its URI might have been changed or the element removed.
virtual void NotifyURIVisitednessChanged (nsIURI *aURI)=0
 Notification that the visitedness state of a URI has been changed and style related to elements linking to that URI should be updated.
PRBool IsInitialDocument () const
 Ask this document whether it's the initial document in its window.
void SetIsInitialDocument (PRBool aIsInitialDocument)
 Tell this document that it's the initial document in its window.
boolean load (in DOMString url)
 Load an XML document.
nsIDOMRange evaluateFIXptr (in DOMString expression)
 Evaluate FIXptr expression.
nsIXPointerResult evaluateXPointer (in DOMString expression)
 Evaluate XPointer expression.
nsIDOMElement createElement (in DOMString tagName) raises (DOMException)
nsIDOMDocumentFragment createDocumentFragment ()
nsIDOMText createTextNode (in DOMString data)
nsIDOMComment createComment (in DOMString data)
nsIDOMCDATASection createCDATASection (in DOMString data) raises (DOMException)
nsIDOMProcessingInstruction createProcessingInstruction (in DOMString target, in DOMString data) raises (DOMException)
nsIDOMAttr createAttribute (in DOMString name) raises (DOMException)
nsIDOMEntityReference createEntityReference (in DOMString name) raises (DOMException)
nsIDOMNodeList getElementsByTagName (in DOMString tagname)
nsIDOMNode importNode (in nsIDOMNode importedNode, in boolean deep) raises (DOMException)
nsIDOMElement createElementNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException)
nsIDOMAttr createAttributeNS (in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException)
nsIDOMNodeList getElementsByTagNameNS (in DOMString namespaceURI, in DOMString localName)
nsIDOMElement getElementById (in DOMString elementId)
nsIDOMNode insertBefore (in nsIDOMNode newChild, in nsIDOMNode refChild) raises (DOMException)
nsIDOMNode replaceChild (in nsIDOMNode newChild, in nsIDOMNode oldChild) raises (DOMException)
nsIDOMNode removeChild (in nsIDOMNode oldChild) raises (DOMException)
nsIDOMNode appendChild (in nsIDOMNode newChild) raises (DOMException)
boolean hasChildNodes ()
nsIDOMNode cloneNode (in boolean deep)
void normalize ()
boolean isSupported (in DOMString feature, in DOMString version)
boolean hasAttributes ()
nsIBoxObject getBoxObjectFor (in nsIDOMElement elt)
void setBoxObjectFor (in nsIDOMElement elt, in nsIBoxObject boxObject)
nsIDOMEvent createEvent (in DOMString eventType) raises (DOMException)
nsIDOMEventGroup createEventGroup ()
nsIDOMRange createRange ()
nsIDOMNodeIterator createNodeIterator (in nsIDOMNode root, in unsigned long whatToShow, in nsIDOMNodeFilter filter, in boolean entityReferenceExpansion) raises (DOMException)
nsIDOMTreeWalker createTreeWalker (in nsIDOMNode root, in unsigned long whatToShow, in nsIDOMNodeFilter filter, in boolean entityReferenceExpansion) raises (DOMException)
nsIDOMNodeList getAnonymousNodes (in nsIDOMElement elt)
nsIDOMElement getAnonymousElementByAttribute (in nsIDOMElement elt, in DOMString attrName, in DOMString attrValue)
void addBinding (in nsIDOMElement elt, in DOMString bindingURL)
void removeBinding (in nsIDOMElement elt, in DOMString bindingURL)
nsIDOMElement getBindingParent (in nsIDOMNode node)
nsIDOMDocument loadBindingDocument (in DOMString documentURL)
nsIDOMNode adoptNode (in nsIDOMNode source) raises (DOMException)
void normalizeDocument ()
nsIDOMNode renameNode (in nsIDOMNode node, in DOMString namespaceURI, in DOMString qualifiedName) raises (DOMException)
unsigned short compareDocumentPosition (in nsIDOMNode other) raises (DOMException)
boolean isSameNode (in nsIDOMNode other)
DOMString lookupPrefix (in DOMString namespaceURI)
boolean isDefaultNamespace (in DOMString namespaceURI)
DOMString lookupNamespaceURI (in DOMString prefix)
boolean isEqualNode (in nsIDOMNode arg)
nsISupports getFeature (in DOMString feature, in DOMString version)
nsIVariant setUserData (in DOMString key, in nsIVariant data, in nsIDOMUserDataHandler handler)
nsIVariant getUserData (in DOMString key)
void addEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture)
 This method allows the registration of event listeners on the event target.
void addEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture, in boolean wantsUntrusted)
 This method is the same as the addEventListener() method defined in nsIDOMEventTarget, but it takes one additional argument which lets callers control whether or not they want to receive untrusted events (synthetic events generated by untrusted code)
void removeEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture)
 This method allows the removal of event listeners from the event target.
boolean dispatchEvent (in nsIDOMEvent evt) raises (DOMException)
 This method allows the dispatch of events into the implementations event model.
void addGroupedEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture, in nsIDOMEventGroup evtGroup)
void removeGroupedEventListener (in DOMString type, in nsIDOMEventListener listener, in boolean useCapture, in nsIDOMEventGroup evtGroup)
boolean canTrigger (in DOMString type)
boolean isRegisteredHere (in DOMString type)
void getInterface (in nsIIDRef uuid,[iid_is(uuid), retval] out nsQIResult result)
 Retrieves the specified interface pointer.
void onChannelRedirect (in nsIChannel oldChannel, in nsIChannel newChannel, in unsigned long flags)
 Called when a redirect occurs.
nsIDOMNode trustedGetPopupNode ()
nsIDOMNode trustedGetTooltipNode ()
nsIDOMNodeList getElementsByAttribute (in DOMString name, in DOMString value)
void addBroadcastListenerFor (in nsIDOMElement broadcaster, in nsIDOMElement observer, in DOMString attr)
void removeBroadcastListenerFor (in nsIDOMElement broadcaster, in nsIDOMElement observer, in DOMString attr)
void persist (in DOMString id, in DOMString attr)
void loadOverlay (in DOMString url, in nsIObserver aObserver)
 Loads a XUL overlay and merges it with the current document, notifying an observer when the merge is complete.
void onStreamComplete (in nsIStreamLoader loader, in nsISupports ctxt, in nsresult status, in unsigned long resultLength,[const, array, size_is(resultLength)] in octet result)

Static Public Member Functions

static PRBool MatchAttribute (nsIContent *aContent, PRInt32 aNameSpaceID, nsIAtom *aAttrName, const nsAString &aValue)

Public Attributes

virtual nsresultaStatus = nsnull) const
virtual voidaValue
virtual void NSPropertyDtorFunc aDtor = nsnull)
virtual voidaData
virtual nsIURIaURI
attribute boolean async
 Whether to load synchronously or asynchronously.
readonly attribute
nsIDOMDocumentType 
doctype
readonly attribute
nsIDOMDOMImplementation 
implementation
readonly attribute nsIDOMElement documentElement
const unsigned short ELEMENT_NODE = 1
const unsigned short ATTRIBUTE_NODE = 2
const unsigned short TEXT_NODE = 3
const unsigned short CDATA_SECTION_NODE = 4
const unsigned short ENTITY_REFERENCE_NODE = 5
const unsigned short ENTITY_NODE = 6
const unsigned short PROCESSING_INSTRUCTION_NODE = 7
const unsigned short COMMENT_NODE = 8
const unsigned short DOCUMENT_NODE = 9
const unsigned short DOCUMENT_TYPE_NODE = 10
const unsigned short DOCUMENT_FRAGMENT_NODE = 11
const unsigned short NOTATION_NODE = 12
readonly attribute DOMString nodeName
attribute DOMString nodeValue
readonly attribute unsigned short nodeType
readonly attribute nsIDOMNode parentNode
readonly attribute nsIDOMNodeList childNodes
readonly attribute nsIDOMNode firstChild
readonly attribute nsIDOMNode lastChild
readonly attribute nsIDOMNode previousSibling
readonly attribute nsIDOMNode nextSibling
readonly attribute
nsIDOMNamedNodeMap 
attributes
readonly attribute nsIDOMDocument ownerDocument
readonly attribute DOMString namespaceURI
attribute DOMString prefix
readonly attribute DOMString localName
readonly attribute DOMString characterSet
attribute DOMString dir
readonly attribute nsIDOMLocation location
attribute DOMString title
readonly attribute DOMString contentType
readonly attribute DOMString lastModified
readonly attribute DOMString referrer
readonly attribute DOMString preferredStylesheetSet
 This attribute indicates the preferredStylesheetSet as set by the author.
readonly attribute
nsIDOMStyleSheetList 
styleSheets
readonly attribute
nsIDOMAbstractView 
defaultView
readonly attribute DOMString inputEncoding
readonly attribute DOMString xmlEncoding
attribute boolean xmlStandalone
attribute DOMString xmlVersion
attribute boolean strictErrorChecking
attribute DOMString documentURI
readonly attribute
nsIDOMDOMConfiguration 
domConfig
readonly attribute DOMString baseURI
const unsigned short DOCUMENT_POSITION_DISCONNECTED = 0x01
const unsigned short DOCUMENT_POSITION_PRECEDING = 0x02
const unsigned short DOCUMENT_POSITION_FOLLOWING = 0x04
const unsigned short DOCUMENT_POSITION_CONTAINS = 0x08
const unsigned short DOCUMENT_POSITION_CONTAINED_BY = 0x10
const unsigned short DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20
attribute DOMString textContent
const unsigned long REDIRECT_TEMPORARY = 1 << 0
 This is a temporary redirect.
const unsigned long REDIRECT_PERMANENT = 1 << 1
 This is a permanent redirect.
const unsigned long REDIRECT_INTERNAL = 1 << 2
 This is an internal redirect, i.e.
attribute nsIDOMEvent trustedPopupEvent
attribute nsIDOMNode popupNode
attribute nsIDOMNode tooltipNode
readonly attribute
nsIDOMXULCommandDispatcher 
commandDispatcher
readonly attribute long width
readonly attribute long height
readonly attribute nsIDOMNode popupRangeParent
 These attributes correspond to trustedGetPopupNode().rangeOffset and rangeParent.
readonly attribute long popupRangeOffset

Protected Types

enum  State { eState_Master, eState_Overlay }

Protected Member Functions

nsresult Init (void)
nsresult StartLayout (void)
nsresult AddElementToMap (nsIContent *aElement)
nsresult RemoveElementFromMap (nsIContent *aElement)
nsresult GetPixelDimensions (nsIPresShell *aShell, PRInt32 *aWidth, PRInt32 *aHeight)
void SetIsPopup (PRBool isPopup)
nsresult PrepareToLoad (nsISupports *aContainer, const char *aCommand, nsIChannel *aChannel, nsILoadGroup *aLoadGroup, nsIParser **aResult)
nsresult PrepareToLoadPrototype (nsIURI *aURI, const char *aCommand, nsIPrincipal *aDocumentPrincipal, nsIParser **aResult)
nsresult LoadOverlayInternal (nsIURI *aURI, PRBool aIsDynamic, PRBool *aShouldReturn)
nsresult ApplyPersistentAttributes ()
nsresult ApplyPersistentAttributesToElements (nsIRDFResource *aResource, nsISupportsArray *aElements)
nsresult AddElementToDocumentPre (nsIContent *aElement)
nsresult AddElementToDocumentPost (nsIContent *aElement)
nsresult ExecuteOnBroadcastHandlerFor (nsIContent *aBroadcaster, nsIDOMElement *aListener, nsIAtom *aAttr)
void GetFocusController (nsIFocusController **aFocusController)
PRInt32 GetDefaultNamespaceID () const
 Returns the default namespace ID used for elements created in this document.
nsresult Persist (nsIContent *aElement, PRInt32 aNameSpaceID, nsIAtom *aAttribute)
nsresult DestroyForwardReferences ()
nsresult LoadScript (nsXULPrototypeScript *aScriptProto, PRBool *aBlock)
 Load the transcluded script at the specified URI.
nsresult ExecuteScript (JSObject *aScriptObject)
 Execute the precompiled script object scoped by this XUL document's containing window object, and using its associated script context.
nsresult CreateElementFromPrototype (nsXULPrototypeElement *aPrototype, nsIContent **aResult)
 Create a delegate content model element from a prototype.
nsresult CreateOverlayElement (nsXULPrototypeElement *aPrototype, nsIContent **aResult)
 Create a temporary 'overlay' element to which content nodes can be attached for later resolution.
nsresult AddAttributes (nsXULPrototypeElement *aPrototype, nsIContent *aElement)
 Add attributes from the prototype to the element.
nsresult HookupObserver (nsIContent *aElement)
 Do hookup for <xul:observes> tag.
nsresult AddPrototypeSheets ()
 Add the current prototype's style sheets to the document.
nsresult FindBroadcaster (nsIContent *aElement, nsIDOMElement **aListener, nsString &aBroadcasterID, nsString &aAttribute, nsIDOMElement **aBroadcaster)
nsresult CheckBroadcasterHookup (nsIContent *aElement, PRBool *aNeedsHookup, PRBool *aDidResolve)
void SynchronizeBroadcastListener (nsIDOMElement *aBroadcaster, nsIDOMElement *aListener, const nsAString &aAttr)
nsresult PrepareToWalk ()
 Prepare to walk the current prototype.
nsresult AddChromeOverlays ()
 Add overlays from the chrome registry to the set of unprocessed overlays still to do.
nsresult ResumeWalk ()
 Resume (or initiate) an interrupted (or newly prepared) prototype walk.
void ReportMissingOverlay (nsIURI *aURI)
 Report that an overlay failed to load.
virtual nsresult GetLoadGroup (nsILoadGroup **aLoadGroup)
void DispatchContentLoadedEvents ()
void RetrieveRelevantHeaders (nsIChannel *aChannel)
void UpdateLinkMap ()
void DestroyLinkMap ()
nsresult doCreateShell (nsPresContext *aContext, nsIViewManager *aViewManager, nsStyleSet *aStyleSet, nsCompatibility aCompatMode, nsIPresShell **aInstancePtrResult)
nsresult ResetStylesheetsToURI (nsIURI *aURI)
virtual nsStyleSet::sheetType GetAttrSheetType ()
void FillStyleSet (nsStyleSet *aStyleSet)
nsresult CreateElement (nsINodeInfo *aNodeInfo, PRInt32 aElementType, nsIContent **aResult)
PRBool IsSafeToFlush () const
void DispatchEventToWindow (nsEvent *aEvent)

Static Protected Member Functions

static PRIntn RemoveElementsFromMapByContent (const PRUnichar *aID, nsIContent *aElement, void *aClosure)
static nsresult CheckTemplateBuilderHookup (nsIContent *aElement, PRBool *aNeedsHookup)
 Check if a XUL template builder has already been hooked up.
static nsresult CreateTemplateBuilder (nsIContent *aElement)
 Create a XUL template builder on the specified node.
static nsresult InsertElement (nsIContent *aParent, nsIContent *aChild, PRBool aNotify)
static nsresult RemoveElement (nsIContent *aParent, nsIContent *aChild)
static PRBool TryChannelCharset (nsIChannel *aChannel, PRInt32 &aCharsetSource, nsACString &aCharset)

Protected Attributes

nsXULDocumentmNextSrcLoadWaiter
nsElementMap mElementMap
nsCOMPtr< nsIRDFDataSourcemLocalStore
PRPackedBool mIsPopup
PRPackedBool mIsFastLoad
PRPackedBool mApplyingPersistedAttrs
PRPackedBool mIsWritingFastLoad
PRPackedBool mDocumentLoaded
nsRefPtr< nsXULCommandDispatchermCommandDispatcher
nsSupportsHashtable * mTemplateBuilderTable
nsVoidArray mForwardReferences
nsForwardReference::Phase mResolutionPhase
nsCOMPtr< nsIDOMNodemTooltipNode
ContextStack mContextStack
State mState
nsCOMPtr< nsISupportsArraymUnloadedOverlays
 An array of overlay nsIURIs that have yet to be resolved.
nsXULPrototypeScriptmCurrentScriptProto
 The prototype-script of the current transcluded script that is being loaded.
nsCOMPtr< nsIRequestmPlaceHolderRequest
 A "dummy" channel that is used as a placeholder to signal document load completion.
nsCOMPtr< nsIXULPrototypeDocumentmCurrentPrototype
 The current prototype that we are walking to construct the content model.
nsCOMPtr< nsIXULPrototypeDocumentmMasterPrototype
 The master document (outermost, .xul) prototype, from which all subdocuments get their security principals.
nsCOMArray
< nsIXULPrototypeDocument
mPrototypes
 Owning references to all of the prototype documents that were used to construct this document.
PLDHashTablemBroadcasterMap
 A map from a broadcaster element to a list of listener elements.
nsInterfaceHashtable
< nsURIHashKey, nsIObserver
mOverlayLoadObservers
nsInterfaceHashtable
< nsURIHashKey, nsIObserver
mPendingOverlayLoadNotifications
PRBool mInitialLayoutComplete
nsCOMPtr< nsIEventQueueServicemEventQService
nsCOMPtr< nsIScriptContextmScriptContext
PRPackedBool mChannelIsPending
PRPackedBool mLoadedAsData
PRPackedBool mLoadedAsInteractiveData
PRPackedBool mAsync
PRPackedBool mLoopingForSyncLoad
nsCString mReferrer
nsString mLastModified
nsCOMPtr< nsIPrincipalmPrincipal
nsVoidArray mCharSetObservers
PLDHashTablemSubDocuments
nsSmallVoidArray mPresShells
nsAttrAndChildArray mChildren
nsCOMPtr< nsIParsermParser
nsCOMArray< nsIStyleSheetmStyleSheets
nsCOMArray< nsIStyleSheetmCatalogSheets
nsDocumentObserverList mObservers
nsCOMPtr< nsIScriptGlobalObjectmScriptGlobalObject
nsWeakPtr mScriptObject
nsWeakPtr mScopeObject
nsCOMPtr< nsIEventListenerManagermListenerManager
nsCOMPtr< nsIDOMStyleSheetListmDOMStyleSheets
nsCOMPtr< nsIScriptLoadermScriptLoader
nsDocHeaderDatamHeaderData
nsCOMPtr< nsILineBreakermLineBreaker
nsCOMPtr< nsIWordBreakermWordBreaker
nsRefPtr< nsDocumentChildNodesmChildNodes
nsHashtable mRadioGroups
PRPackedBool mIsGoingAway:1
PRPackedBool mInDestructor:1
PRPackedBool mVisible:1
PRPackedBool mHasHadScriptHandlingObject:1
PRUint8 mXMLDeclarationBits
PRUint8 mDefaultElementType
nsSupportsHashtable * mBoxObjectTable
nsCOMPtr< nsIChannelmChannel
nsRefPtr< nsHTMLStyleSheetmAttrStyleSheet
nsCOMPtr< nsIHTMLCSSStyleSheetmStyleAttrStyleSheet
nsRefPtr< nsXMLEventsManagermXMLEventsManager
nsCOMPtr< nsIScriptEventManagermScriptEventManager
nsString mBaseTarget
nsString mDocumentTitle
nsCOMPtr< nsIURImDocumentURI
nsCOMPtr< nsIURImDocumentBaseURI
nsWeakPtr mDocumentLoadGroup
nsWeakPtr mDocumentContainer
nsCString mCharacterSet
PRInt32 mCharacterSetSource
nsIDocumentmParentDocument
nsIContentmRootContent
PRInt32 mNextContentID
nsCOMPtr< nsIBindingManagermBindingManager
nsNodeInfoManagermNodeInfoManager
nsICSSLoadermCSSLoader
nsPropertyTable mPropertyTable
PRBool mBidiEnabled
nsXPIDLCString mContentLanguage
nsCString mContentType
nsCOMPtr< nsISupports > mSecurityInfo
PRUint32 mPartID
PRBool mIsInitialDocumentInWindow

Static Protected Attributes

static PRInt32 gRefCnt = 0
static nsIAtom ** kIdentityAttrs []
static nsIRDFServicegRDFService
static nsIRDFResourcekNC_persist
static nsIRDFResourcekNC_attribute
static nsIRDFResourcekNC_value
static nsIXULPrototypeCachegXULCache
static PRLogModuleInfogXULLog

Friends

class ContextStack
class BroadcasterHookup
class OverlayForwardReference
class TemplateBuilderHookup
class CachedChromeStreamListener
class ParserObserver
nsresult NS_NewXULDocument (nsIXULDocument **aResult)

Detailed Description

The XUL document class.

Definition at line 84 of file nsXULDocument.h.


Member Typedef Documentation

typedef PRBool(* nsIDocument::nsSubDocEnumFunc)(nsIDocument *aDocument, void *aData) [inherited]

Enumerate all subdocuments.

The enumerator callback should return PR_TRUE to continue enumerating, or PR_FALSE to stop.

Definition at line 699 of file nsIDocument.h.


Member Enumeration Documentation

enum nsXULDocument::State [protected]
Enumerator:
eState_Master 
eState_Overlay 

Definition at line 339 of file nsXULDocument.h.


Constructor & Destructor Documentation

Definition at line 361 of file nsXULDocument.cpp.

    : mResolutionPhase(nsForwardReference::eStart),
      mState(eState_Master)
{

    // NOTE! nsDocument::operator new() zeroes out all members, so don't
    // bother initializing members to 0.

    // Override the default in nsDocument
    mCharacterSet.AssignLiteral("UTF-8");

    mDefaultElementType = kNameSpaceID_XUL;
}

Definition at line 375 of file nsXULDocument.cpp.

{
    mCommandDispatcher->Disconnect();

    NS_ASSERTION(mNextSrcLoadWaiter == nsnull,
        "unreferenced document still waiting for script source to load?");

    // Notify our observers here, we can't let the nsDocument
    // destructor do that for us since some of the observers are
    // deleted by the time we get there.
    NS_DOCUMENT_NOTIFY_OBSERVERS(DocumentWillBeDestroyed, (this));
    mObservers.Clear();

    // In case we failed somewhere early on and the forward observer
    // decls never got resolved.
    DestroyForwardReferences();

    // Destroy our broadcaster map.
    if (mBroadcasterMap) {
        PL_DHashTableDestroy(mBroadcasterMap);
    }

    if (mLocalStore) {
        nsCOMPtr<nsIRDFRemoteDataSource> remote =
            do_QueryInterface(mLocalStore);
        if (remote)
            remote->Flush();
    }

    delete mTemplateBuilderTable;

    if (--gRefCnt == 0) {
        NS_IF_RELEASE(gRDFService);

        NS_IF_RELEASE(kNC_persist);
        NS_IF_RELEASE(kNC_attribute);
        NS_IF_RELEASE(kNC_value);

        if (gXULCache) {
            // Remove the current document here from the FastLoad table in
            // case the document did not make it past StartLayout in
            // ResumeWalk. The FastLoad table must be clear of entries so
            // that the FastLoad file footer can be properly written.
            if (mDocumentURI)
                gXULCache->RemoveFromFastLoadSet(mDocumentURI);

            NS_RELEASE(gXULCache);
        }
    }

    // The destructor of nsDocument will delete references to style
    // sheets, but we don't want that if we're a popup document, so
    // then we'll clear the stylesheets array here to prevent that
    // from happening.
    if (mIsPopup) {
        mStyleSheets.Clear();
        mStyleAttrStyleSheet = nsnull;
        mAttrStyleSheet = nsnull;
    }

    // This is done in nsDocument::~nsDocument() too, but since this
    // call ends up calling back into the document through virtual
    // methods (nsIDocument::GetPrincipal()) we must do it here before
    // we go out of nsXULDocument's destructor.
    if (mNodeInfoManager) {
        mNodeInfoManager->DropDocumentReference();
    }
}

Here is the call graph for this function:


Member Function Documentation

nsresult nsXULDocument::AddAttributes ( nsXULPrototypeElement aPrototype,
nsIContent aElement 
) [protected]

Add attributes from the prototype to the element.

Definition at line 3808 of file nsXULDocument.cpp.

{
    nsresult rv;

    for (PRUint32 i = 0; i < aPrototype->mNumAttributes; ++i) {
        nsXULPrototypeAttribute* protoattr = &(aPrototype->mAttributes[i]);
        nsAutoString  valueStr;
        protoattr->mValue.ToString(valueStr);

        rv = aElement->SetAttr(protoattr->mName.NamespaceID(),
                               protoattr->mName.LocalName(),
                               protoattr->mName.GetPrefix(),
                               valueStr,
                               PR_FALSE);
        if (NS_FAILED(rv)) return rv;
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIDOMDocumentXBL::addBinding ( in nsIDOMElement  elt,
in DOMString  bindingURL 
) [inherited]
void nsIDOMXULDocument::addBroadcastListenerFor ( in nsIDOMElement  broadcaster,
in nsIDOMElement  observer,
in DOMString  attr 
) [inherited]
void nsDocument::AddCatalogStyleSheet ( nsIStyleSheet aSheet) [virtual, inherited]

Implements nsIDocument.

Definition at line 2101 of file nsDocument.cpp.

{
  mCatalogSheets.AppendObject(aSheet);
  aSheet->SetOwningDocument(this);

  PRBool applicable;
  aSheet->GetApplicable(applicable);
                                                                                
  if (applicable) {
    // This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
    for (PRInt32 i = 0, i_end = mPresShells.Count(); i < i_end; ++i)
      NS_STATIC_CAST(nsIPresShell*, mPresShells.ElementAt(i))->StyleSet()->
        AppendStyleSheet(nsStyleSet::eAgentSheet, aSheet);
  }
                                                                                
  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, PR_FALSE));
}

Here is the call graph for this function:

nsresult nsDocument::AddCharSetObserver ( nsIObserver aObserver) [virtual, inherited]

Add an observer that gets notified whenever the charset changes.

Implements nsIDocument.

Definition at line 1464 of file nsDocument.cpp.

{
  NS_ENSURE_ARG_POINTER(aObserver);

  NS_ENSURE_TRUE(mCharSetObservers.AppendElement(aObserver), NS_ERROR_FAILURE);

  return NS_OK;
}

Add overlays from the chrome registry to the set of unprocessed overlays still to do.

Definition at line 2792 of file nsXULDocument.cpp.

{
    nsresult rv;

    nsCOMPtr<nsIURI> docUri;
    rv = mCurrentPrototype->GetURI(getter_AddRefs(docUri));
    NS_ENSURE_SUCCESS(rv, rv);

    /* overlays only apply to chrome, skip all content URIs */
    if (!IsChromeURI(docUri)) return NS_OK;

    nsCOMPtr<nsIXULOverlayProvider> chromeReg(do_GetService(NS_CHROMEREGISTRY_CONTRACTID));
    // In embedding situations, the chrome registry may not provide overlays,
    // or even exist at all; that's OK.
    NS_ENSURE_TRUE(chromeReg, NS_OK);

    nsCOMPtr<nsISimpleEnumerator> overlays;
    rv = chromeReg->GetXULOverlays(docUri, getter_AddRefs(overlays));
    NS_ENSURE_SUCCESS(rv, rv);

    PRBool moreOverlays;
    nsCOMPtr<nsISupports> next;
    nsCOMPtr<nsIURI> uri;

    while (NS_SUCCEEDED(rv = overlays->HasMoreElements(&moreOverlays)) &&
           moreOverlays) {
        rv = overlays->GetNext(getter_AddRefs(next));
        if (NS_FAILED(rv) || !next) continue;

        uri = do_QueryInterface(next);
        if (!uri) {
            NS_ERROR("Chrome registry handed me a non-nsIURI object!");
            continue;
        }

        mUnloadedOverlays->AppendElement(uri);
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsXULDocument::AddElementForID ( const nsAString &  aID,
nsIContent aElement 
) [virtual]

Add an entry to the ID-to-element map.

Implements nsIXULDocument.

Definition at line 1288 of file nsXULDocument.cpp.

{
    NS_PRECONDITION(aElement != nsnull, "null ptr");
    if (! aElement)
        return NS_ERROR_NULL_POINTER;

    mElementMap.Add(aID, aElement);
    return NS_OK;
}

Here is the call graph for this function:

Definition at line 1946 of file nsXULDocument.cpp.

{
    nsINodeInfo *ni = aElement->GetNodeInfo();

    // We need to pay special attention to the keyset tag to set up a listener
    if (ni && ni->Equals(nsXULAtoms::keyset, kNameSpaceID_XUL)) {
        // Create our XUL key listener and hook it up.
        nsCOMPtr<nsIXBLService> xblService(do_GetService("@mozilla.org/xbl;1"));
        if (xblService) {
            nsCOMPtr<nsIDOMEventReceiver> rec(do_QueryInterface(aElement));
            xblService->AttachGlobalKeyHandler(rec);
        }
    }

    // See if we need to attach a XUL template to this node
    PRBool needsHookup;
    nsresult rv = CheckTemplateBuilderHookup(aElement, &needsHookup);
    if (NS_FAILED(rv))
        return rv;

    if (needsHookup) {
        if (mResolutionPhase == nsForwardReference::eDone) {
            rv = CreateTemplateBuilder(aElement);
            if (NS_FAILED(rv))
                return rv;
        }
        else {
            TemplateBuilderHookup* hookup = new TemplateBuilderHookup(aElement);
            if (! hookup)
                return NS_ERROR_OUT_OF_MEMORY;

            rv = AddForwardReference(hookup);
            if (NS_FAILED(rv))
                return rv;
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1903 of file nsXULDocument.cpp.

{
    // Do a bunch of work that's necessary when an element gets added
    // to the XUL Document.
    nsresult rv;

    // 1. Add the element to the resource-to-element map
    rv = AddElementToMap(aElement);
    if (NS_FAILED(rv)) return rv;

    // 2. If the element is a 'command updater' (i.e., has a
    // "commandupdater='true'" attribute), then add the element to the
    // document's command dispatcher
    nsAutoString value;
    rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::commandupdater,
                           value);
    if (rv == NS_CONTENT_ATTR_HAS_VALUE &&
        value.EqualsLiteral("true")) {
        rv = nsXULContentUtils::SetCommandUpdater(this, aElement);
        if (NS_FAILED(rv)) return rv;
    }

    // 3. Check for a broadcaster hookup attribute, in which case
    // we'll hook the node up as a listener on a broadcaster.
    PRBool listener, resolved;
    rv = CheckBroadcasterHookup(aElement, &listener, &resolved);
    if (NS_FAILED(rv)) return rv;

    // If it's not there yet, we may be able to defer hookup until
    // later.
    if (listener && !resolved && (mResolutionPhase != nsForwardReference::eDone)) {
        BroadcasterHookup* hookup = new BroadcasterHookup(this, aElement);
        if (! hookup)
            return NS_ERROR_OUT_OF_MEMORY;

        rv = AddForwardReference(hookup);
        if (NS_FAILED(rv)) return rv;
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsXULDocument::AddElementToMap ( nsIContent aElement) [protected]

Definition at line 2107 of file nsXULDocument.cpp.

{
    // Look at the element's 'id' and 'ref' attributes, and if set,
    // add pointers in the resource-to-element map to the element.
    nsresult rv;

    for (PRInt32 i = 0; kIdentityAttrs[i] != nsnull; ++i) {
        nsAutoString value;
        rv = aElement->GetAttr(kNameSpaceID_None, *kIdentityAttrs[i], value);
        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get attribute");
        if (NS_FAILED(rv)) return rv;

        if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
            rv = mElementMap.Add(value, aElement);
            if (NS_FAILED(rv)) return rv;
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIDOMNSEventTarget::addEventListener ( in DOMString  type,
in nsIDOMEventListener  listener,
in boolean  useCapture,
in boolean  wantsUntrusted 
) [inherited]

This method is the same as the addEventListener() method defined in nsIDOMEventTarget, but it takes one additional argument which lets callers control whether or not they want to receive untrusted events (synthetic events generated by untrusted code)

Parameters:
typeSee the type argument to the same method in nsIDOMEventTarget.
listenerSee the listener argument to the same method in nsIDOMEventTarget.
useCaptureSee the listener argument to the same method in nsIDOMEventTarget.
wantsUntrustedIf false, the listener will not receive any untrusted events (see above), if true, the listener will receive events whether or not they're trusted
void nsIDOMEventTarget::addEventListener ( in DOMString  type,
in nsIDOMEventListener  listener,
in boolean  useCapture 
) [inherited]

This method allows the registration of event listeners on the event target.

If an EventListener is added to an EventTarget while it is processing an event, it will not be triggered by the current actions but may be triggered during a later stage of event flow, such as the bubbling phase.

If multiple identical EventListeners are registered on the same EventTarget with the same parameters the duplicate instances are discarded. They do not cause the EventListener to be called twice and since they are discarded they do not need to be removed with the removeEventListener method.

Parameters:
typeThe event type for which the user is registering
listenerThe listener parameter takes an interface implemented by the user which contains the methods to be called when the event occurs.
useCaptureIf true, useCapture indicates that the user wishes to initiate capture. After initiating capture, all events of the specified type will be dispatched to the registered EventListener before being dispatched to any EventTargets beneath them in the tree. Events which are bubbling upward through the tree will not trigger an EventListener designated to use capture.
nsresult nsDocument::AddEventListenerByIID ( nsIDOMEventListener aListener,
const nsIID aIID 
) [virtual, inherited]

Implements nsIDOMEventReceiver.

Definition at line 4263 of file nsDocument.cpp.

{
  nsCOMPtr<nsIEventListenerManager> manager;

  GetListenerManager(getter_AddRefs(manager));
  if (manager) {
    manager->AddEventListenerByIID(aListener, aIID, NS_EVENT_FLAG_BUBBLE);
    return NS_OK;
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Add a "forward declaration" of a XUL observer.

Such declarations will be resolved when document loading completes.

Implements nsIXULDocument.

Definition at line 1323 of file nsXULDocument.cpp.

{
    if (mResolutionPhase < aRef->GetPhase()) {
        mForwardReferences.AppendElement(aRef);
    }
    else {
        NS_ERROR("forward references have already been resolved");
        delete aRef;
    }

    return NS_OK;
}

Here is the caller graph for this function:

void nsIDOM3EventTarget::addGroupedEventListener ( in DOMString  type,
in nsIDOMEventListener  listener,
in boolean  useCapture,
in nsIDOMEventGroup  evtGroup 
) [inherited]
void nsDocument::AddObserver ( nsIDocumentObserver aObserver) [virtual, inherited]

Add a new observer of document change notifications.

Whenever content is changed, appended, inserted or removed the observers are informed.

Implements nsIDocument.

Definition at line 2264 of file nsDocument.cpp.

{
  // XXX Make sure the observer isn't already in the list
  if (!mObservers.Contains(aObserver)) {
    mObservers.AppendElement(aObserver);
  }
}

Add the current prototype's style sheets to the document.

Definition at line 3950 of file nsXULDocument.cpp.

{
    // Add mCurrentPrototype's style sheets to the document.
    nsresult rv;

    nsCOMPtr<nsISupportsArray> sheets;
    rv = mCurrentPrototype->GetStyleSheetReferences(getter_AddRefs(sheets));
    if (NS_FAILED(rv)) return rv;

    PRUint32 count;
    sheets->Count(&count);
    for (PRUint32 i = 0; i < count; ++i) {
        nsISupports* isupports = sheets->ElementAt(i);
        nsCOMPtr<nsIURI> uri = do_QueryInterface(isupports);
        NS_IF_RELEASE(isupports);

        NS_ASSERTION(uri, "not a URI!!!");
        if (! uri)
            return NS_ERROR_UNEXPECTED;

        nsCAutoString spec;
        uri->GetAsciiSpec(spec);

        if (!IsChromeURI(uri)) {
            // These don't get to be in the prototype cache anyway...
            // and we can't load non-chrome sheets synchronously
            continue;
        }

        nsCOMPtr<nsICSSStyleSheet> sheet;

        // If the sheet is a chrome URL, then we can refetch the sheet
        // synchronously, since we know the sheet is local.  It's not
        // too late! :) If we're lucky, the loader will just pull it
        // from the prototype cache anyway.
        // Otherwise we just bail.  It shouldn't currently
        // be possible to get into this situation for any reason
        // other than a skin switch anyway (since skin switching is the
        // only system that partially invalidates the XUL cache).
        // - dwh
        //XXXbz we hit this code from fastload all the time.  Bug 183505.
        rv = CSSLoader()->LoadAgentSheet(uri, getter_AddRefs(sheet));
        // XXXldb We need to prevent bogus sheets from being held in the
        // prototype's list, but until then, don't propagate the failure
        // from LoadAgentSheet (and thus exit the loop).
        if (NS_SUCCEEDED(rv)) {
            AddStyleSheet(sheet);
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsIDocument::AddStyleRelevantLink ( nsIContent aContent,
nsIURI aURI 
) [pure virtual, inherited]

Notification that an element is a link with a given URI that is relevant to style.

Here is the caller graph for this function:

void nsDocument::AddStyleSheet ( nsIStyleSheet aSheet) [virtual, inherited]

Add a stylesheet to the document.

Implements nsIDocument.

Definition at line 1955 of file nsDocument.cpp.

{
  NS_PRECONDITION(aSheet, "null arg");
  mStyleSheets.AppendObject(aSheet);
  aSheet->SetOwningDocument(this);

  PRBool applicable;
  aSheet->GetApplicable(applicable);

  if (applicable) {
    AddStyleSheetToStyleSets(aSheet);
  }

  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, PR_TRUE));
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsDocument::AddStyleSheetToStyleSets ( nsIStyleSheet aSheet) [virtual, inherited]

Definition at line 1944 of file nsDocument.cpp.

{
  PRInt32 count = mPresShells.Count();
  PRInt32 indx;
  for (indx = 0; indx < count; ++indx) {
    NS_STATIC_CAST(nsIPresShell*, mPresShells.ElementAt(indx))->StyleSet()->
      AddDocStyleSheet(aSheet, this);
  }
}

Notify the XUL document that a subtree has been added.

Implements nsIXULDocument.

Definition at line 1987 of file nsXULDocument.cpp.

{
    nsresult rv;

    // Do pre-order addition magic
    rv = AddElementToDocumentPre(aElement);
    if (NS_FAILED(rv)) return rv;

    // Recurse to children
    nsXULElement *xulcontent = nsXULElement::FromContent(aElement);

    PRUint32 count =
        xulcontent ? xulcontent->PeekChildCount() : aElement->GetChildCount();

    while (count-- > 0) {
        rv = AddSubtreeToDocument(aElement->GetChildAt(count));
        if (NS_FAILED(rv))
            return rv;
    }

    // Do post-order addition magic
    return AddElementToDocumentPost(aElement);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsDocument::AddToRadioGroup ( const nsAString &  aName,
nsIFormControl aRadio 
) [virtual, inherited]

Add radio button to radio group.

Note that forms do not do anything for this method since they already store radio groups on their own.

Parameters:
aNameradio group's name
aRadioradio button's pointer

Implements nsIRadioGroupContainer.

Definition at line 4698 of file nsDocument.cpp.

{
  nsRadioGroupStruct* radioGroup = nsnull;
  GetRadioGroup(aName, &radioGroup);
  if (radioGroup) {
    radioGroup->mRadioButtons.AppendElement(aRadio);
    NS_IF_ADDREF(aRadio);
  }

  return NS_OK;
}
nsresult nsDocument::AddXMLEventsContent ( nsIContent aXMLEventsElement) [virtual, inherited]

Implements nsIDocument.

Definition at line 1030 of file nsDocument.cpp.

nsIDOMNode nsIDOM3Document::adoptNode ( in nsIDOMNode  source) raises (DOMException) [inherited]
nsIDOMNode nsIDOMNode::appendChild ( in nsIDOMNode  newChild) raises (DOMException) [inherited]
void nsDocument::AppendReachableList ( nsCOMArray< nsIDOMGCParticipant > &  aArray) [virtual, inherited]

Append the list of nsIDOMGCPartipants reachable from this one via C++ getters exposed to script that return a different result from |GetSCCIndex|.

The caller is responsible for taking the transitive closure of |AppendReachableList|.

This will only be called on objects that are returned by GetSCCIndex.

null pointers may be appended; they will be ignored by the caller.

Implements nsIDOMGCParticipant.

Definition at line 3451 of file nsDocument.cpp.

Here is the call graph for this function:

Definition at line 2437 of file nsXULDocument.cpp.

{
    // Add all of the 'persisted' attributes into the content
    // model.
    if (! mLocalStore)
        return NS_OK;

    mApplyingPersistedAttrs = PR_TRUE;

    nsresult rv;
    nsCOMPtr<nsISupportsArray> elements;
    rv = NS_NewISupportsArray(getter_AddRefs(elements));
    if (NS_FAILED(rv)) return rv;

    nsCAutoString docurl;
    mDocumentURI->GetSpec(docurl);

    nsCOMPtr<nsIRDFResource> doc;
    gRDFService->GetResource(docurl, getter_AddRefs(doc));

    nsCOMPtr<nsISimpleEnumerator> persisted;
    mLocalStore->GetTargets(doc, kNC_persist, PR_TRUE, getter_AddRefs(persisted));

    while (1) {
        PRBool hasmore = PR_FALSE;
        persisted->HasMoreElements(&hasmore);
        if (! hasmore)
            break;

        nsCOMPtr<nsISupports> isupports;
        persisted->GetNext(getter_AddRefs(isupports));

        nsCOMPtr<nsIRDFResource> resource = do_QueryInterface(isupports);
        if (! resource) {
            NS_WARNING("expected element to be a resource");
            continue;
        }

        const char *uri;
        resource->GetValueConst(&uri);
        if (! uri)
            continue;

        nsAutoString id;
        nsXULContentUtils::MakeElementID(this, nsDependentCString(uri), id);

        if (id.IsEmpty())
            continue;

        // This will clear the array if there are no elements.
        GetElementsForID(id, elements);

        PRUint32 cnt = 0;
        elements->Count(&cnt);
        if (! cnt)
            continue;

        ApplyPersistentAttributesToElements(resource, elements);
    }

    mApplyingPersistedAttrs = PR_FALSE;

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 2504 of file nsXULDocument.cpp.

{
    nsresult rv;

    nsCOMPtr<nsISimpleEnumerator> attrs;
    rv = mLocalStore->ArcLabelsOut(aResource, getter_AddRefs(attrs));
    if (NS_FAILED(rv)) return rv;

    while (1) {
        PRBool hasmore;
        rv = attrs->HasMoreElements(&hasmore);
        if (NS_FAILED(rv)) return rv;

        if (! hasmore)
            break;

        nsCOMPtr<nsISupports> isupports;
        rv = attrs->GetNext(getter_AddRefs(isupports));
        if (NS_FAILED(rv)) return rv;

        nsCOMPtr<nsIRDFResource> property = do_QueryInterface(isupports);
        if (! property) {
            NS_WARNING("expected a resource");
            continue;
        }

        const char* attrname;
        rv = property->GetValueConst(&attrname);
        if (NS_FAILED(rv)) return rv;

        nsCOMPtr<nsIAtom> attr = do_GetAtom(attrname);
        if (! attr)
            return NS_ERROR_OUT_OF_MEMORY;

        // XXX could hang namespace off here, as well...

        nsCOMPtr<nsIRDFNode> node;
        rv = mLocalStore->GetTarget(aResource, property, PR_TRUE,
                                    getter_AddRefs(node));
        if (NS_FAILED(rv)) return rv;

        nsCOMPtr<nsIRDFLiteral> literal = do_QueryInterface(node);
        if (! literal) {
            NS_WARNING("expected a literal");
            continue;
        }

        const PRUnichar* value;
        rv = literal->GetValueConst(&value);
        if (NS_FAILED(rv)) return rv;

        nsDependentString wrapper(value);

        PRUint32 cnt;
        rv = aElements->Count(&cnt);
        if (NS_FAILED(rv)) return rv;

        for (PRInt32 i = PRInt32(cnt) - 1; i >= 0; --i) {
            nsISupports* isupports2 = aElements->ElementAt(i);
            if (! isupports2)
                continue;

            nsCOMPtr<nsIContent> element = do_QueryInterface(isupports2);
            NS_RELEASE(isupports2);

            rv = element->SetAttr(/* XXX */ kNameSpaceID_None,
                                  attr,
                                  wrapper,
                                  PR_TRUE);
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsXULDocument::AttributeChanged ( nsIContent aElement,
PRInt32  aNameSpaceID,
nsIAtom aAttribute,
PRInt32  aModType 
) [virtual]

Reimplemented from nsDocument.

Definition at line 1074 of file nsXULDocument.cpp.

{
    nsresult rv;

    // First see if we need to update our element map.
    if ((aAttribute == nsXULAtoms::id) || (aAttribute == nsXULAtoms::ref)) {

        rv = mElementMap.Enumerate(RemoveElementsFromMapByContent, aElement);
        if (NS_FAILED(rv)) return;

        // That'll have removed _both_ the 'ref' and 'id' entries from
        // the map. So add 'em back now.
        rv = AddElementToMap(aElement);
        if (NS_FAILED(rv)) return;
    }

    // Synchronize broadcast listeners
    if (mBroadcasterMap && CanBroadcast(aNameSpaceID, aAttribute)) {
        nsCOMPtr<nsIDOMElement> domele = do_QueryInterface(aElement);
        BroadcasterMapEntry* entry =
            NS_STATIC_CAST(BroadcasterMapEntry*,
                           PL_DHashTableOperate(mBroadcasterMap, domele.get(),
                                                PL_DHASH_LOOKUP));

        if (PL_DHASH_ENTRY_IS_BUSY(entry)) {
            // We've got listeners: push the value.
            nsAutoString value;
            rv = aElement->GetAttr(kNameSpaceID_None, aAttribute, value);

            nsCOMArray<nsIContent> listenerArray;
            PRInt32 i;
            for (i = entry->mListeners.Count() - 1; i >= 0; --i) {
                BroadcastListener* bl =
                    NS_STATIC_CAST(BroadcastListener*, entry->mListeners[i]);

                if ((bl->mAttribute == aAttribute) ||
                    (bl->mAttribute == nsXULAtoms::_star)) {
                    nsCOMPtr<nsIContent> listener
                        = do_QueryInterface(bl->mListener);
                    listenerArray.AppendObject(listener);
                }
            }
            for (i = 0; i < listenerArray.Count(); ++i) {
                nsIContent* listener = listenerArray[i];
                 if (rv == NS_CONTENT_ATTR_NO_VALUE ||
                     rv == NS_CONTENT_ATTR_HAS_VALUE) {
                     listener->SetAttr(kNameSpaceID_None, aAttribute, value,
                                       PR_TRUE);
                 }
                 else {
                     listener->UnsetAttr(kNameSpaceID_None, aAttribute,
                                         PR_TRUE);
                 }

                nsCOMPtr<nsIDOMElement> listenerEl = do_QueryInterface(listener);
                ExecuteOnBroadcastHandlerFor(aElement, listenerEl, aAttribute);
            }
        }
    }

    // Now notify external observers
    NS_DOCUMENT_NOTIFY_OBSERVERS(AttributeChanged,
                                 (this, aElement, aNameSpaceID,
                                  aAttribute, aModType));

    // See if there is anything we need to persist in the localstore.
    //
    // XXX Namespace handling broken :-(
    nsAutoString persist;
    rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::persist, persist);
    if (NS_FAILED(rv)) return;

    if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
        nsAutoString attr;
        rv = aAttribute->ToString(attr);
        if (NS_FAILED(rv)) return;

        if (persist.Find(attr) >= 0) {
            rv = Persist(aElement, kNameSpaceID_None, aAttribute);
            if (NS_FAILED(rv)) return;
        }
    }
}

Here is the call graph for this function:

void nsDocument::AttributeWillChange ( nsIContent aChild,
PRInt32  aNameSpaceID,
nsIAtom aAttribute 
) [virtual, inherited]

Implements nsIDocument.

Reimplemented in nsHTMLDocument.

Definition at line 2532 of file nsDocument.cpp.

{
  NS_ASSERTION(aChild, "Null child!");
}
void nsDocument::BeginLoad ( ) [virtual, inherited]

Implements nsIDocument.

Definition at line 2324 of file nsDocument.cpp.

void nsDocument::BeginUpdate ( nsUpdateType  aUpdateType) [virtual, inherited]

Implements nsIDocument.

Definition at line 2287 of file nsDocument.cpp.

nsIBindingManager* nsIDocument::BindingManager ( ) const [inline, inherited]

Definition at line 557 of file nsIDocument.h.

  {
    return mBindingManager;
  }

Here is the caller graph for this function:

virtual void nsIDocument::BlockOnload ( ) [pure virtual, inherited]

Methods that can be used to prevent onload firing while an event that should block onload is posted.

onload is guaranteed to not fire until either all calls to BlockOnload() have been matched by calls to UnblockOnload() or the load has been stopped altogether (by the user pressing the Stop button, say). onload may fire synchronously from inside the UnblockOnload() call.

Here is the caller graph for this function:

virtual PRBool nsIDocument::CanSavePresentation ( nsIRequest aNewRequest) [pure virtual, inherited]

Check whether it is safe to cache the presentation of this document and all of its subdocuments.

This method checks the following conditions recursively:

  • Some document types, such as plugin documents, cannot be safely cached.
  • If there are any pending requests, we don't allow the presentation to be cached. Ideally these requests would be suspended and resumed, but that is difficult in some cases, such as XMLHttpRequest.
  • If there are any beforeunload or unload listeners, we must fire them for correctness, but this likely puts the document into a state where it would not function correctly if restored.

|aNewRequest| should be the request for a new document which will replace this document in the docshell. The new document's request will be ignored when checking for active requests. If there is no request associated with the new document, this parameter may be null.

Implemented in nsPluginDocument.

Here is the caller graph for this function:

boolean nsIDOM3EventTarget::canTrigger ( in DOMString  type) [inherited]
void nsDocument::CharacterDataChanged ( nsIContent aContent,
PRBool  aAppend 
) [virtual, inherited]

Implements nsIDocument.

Definition at line 2473 of file nsDocument.cpp.

{
  NS_ABORT_IF_FALSE(aContent, "Null content!");

  NS_DOCUMENT_NOTIFY_OBSERVERS(CharacterDataChanged, (this, aContent, aAppend));
}
nsresult nsXULDocument::CheckBroadcasterHookup ( nsIContent aElement,
PRBool aNeedsHookup,
PRBool aDidResolve 
) [protected]

Definition at line 4404 of file nsXULDocument.cpp.

{
    // Resolve a broadcaster hookup. Look at the element that we're
    // trying to resolve: it could be an '<observes>' element, or just
    // a vanilla element with an 'observes' attribute on it.
    nsresult rv;

    *aDidResolve = PR_FALSE;

    nsCOMPtr<nsIDOMElement> listener;
    nsAutoString broadcasterID;
    nsAutoString attribute;
    nsCOMPtr<nsIDOMElement> broadcaster;

    rv = FindBroadcaster(aElement, getter_AddRefs(listener),
                         broadcasterID, attribute, getter_AddRefs(broadcaster));
    switch (rv) {
        case NS_FINDBROADCASTER_NOT_FOUND:
            *aNeedsHookup = PR_FALSE;
            return NS_OK;
        case NS_FINDBROADCASTER_AWAIT_OVERLAYS:
            *aNeedsHookup = PR_TRUE;
            return NS_OK;
        case NS_FINDBROADCASTER_FOUND:
            break;
        default:
            return rv;
    }

    rv = AddBroadcastListenerFor(broadcaster, listener, attribute);
    if (NS_FAILED(rv)) return rv;

#ifdef PR_LOGGING
    // Tell the world we succeeded
    if (PR_LOG_TEST(gXULLog, PR_LOG_NOTICE)) {
        nsCOMPtr<nsIContent> content =
            do_QueryInterface(listener);

        NS_ASSERTION(content != nsnull, "not an nsIContent");
        if (! content)
            return rv;

        nsAutoString tagStr;
        rv = content->Tag()->ToString(tagStr);
        if (NS_FAILED(rv)) return rv;

        nsCAutoString tagstrC, attributeC,broadcasteridC;
        tagstrC.AssignWithConversion(tagStr);
        attributeC.AssignWithConversion(attribute);
        broadcasteridC.AssignWithConversion(broadcasterID);
        PR_LOG(gXULLog, PR_LOG_NOTICE,
               ("xul: broadcaster hookup <%s attribute='%s'> to %s",
                tagstrC.get(),
                attributeC.get(),
                broadcasteridC.get()));
    }
#endif

    *aNeedsHookup = PR_FALSE;
    *aDidResolve = PR_TRUE;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsXULDocument::CheckTemplateBuilderHookup ( nsIContent aElement,
PRBool aNeedsHookup 
) [static, protected]

Check if a XUL template builder has already been hooked up.

Definition at line 3831 of file nsXULDocument.cpp.

{
    // See if the element already has a `database' attribute. If it
    // does, then the template builder has already been created.
    //
    // XXX This approach will crash and burn (well, maybe not _that_
    // bad) if aElement is not a XUL element.
    //
    // XXXvarga Do we still want to support non XUL content?
    nsCOMPtr<nsIDOMXULElement> xulElement = do_QueryInterface(aElement);
    if (xulElement) {
        nsCOMPtr<nsIRDFCompositeDataSource> ds;
        xulElement->GetDatabase(getter_AddRefs(ds));
        if (ds) {
            *aNeedsHookup = PR_FALSE;
            return NS_OK;
        }
    }

    // Check aElement for a 'datasources' attribute, if it has
    // one a XUL template builder needs to be hooked up.
    *aNeedsHookup = aElement->HasAttr(kNameSpaceID_None,
                                      nsXULAtoms::datasources);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIDOMNode nsIDOMNode::cloneNode ( in boolean  deep) [inherited]

Reimplemented from nsXMLDocument.

Definition at line 2168 of file nsXULDocument.cpp.

{
    // We don't allow cloning of a document
    *aReturn = nsnull;
    return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
unsigned short nsIDOM3Node::compareDocumentPosition ( in nsIDOMNode  other) raises (DOMException) [inherited]
void nsXULDocument::ContentAppended ( nsIContent aContainer,
PRInt32  aNewIndexInContainer 
) [virtual]

Reimplemented from nsDocument.

Definition at line 1160 of file nsXULDocument.cpp.

{
    // First update our element map
    PRUint32 count = aContainer->GetChildCount();

    for (PRUint32 i = aNewIndexInContainer; i < count; ++i) {
        nsresult rv = AddSubtreeToDocument(aContainer->GetChildAt(i));
        if (NS_FAILED(rv))
            return;
    }

    nsXMLDocument::ContentAppended(aContainer, aNewIndexInContainer);
}

Here is the call graph for this function:

void nsXULDocument::ContentInserted ( nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [virtual]

Reimplemented from nsDocument.

Definition at line 1176 of file nsXULDocument.cpp.

{
    nsresult rv = AddSubtreeToDocument(aChild);
    if (NS_FAILED(rv))
        return;

    nsXMLDocument::ContentInserted(aContainer, aChild,
                                   aIndexInContainer);
}

Here is the call graph for this function:

void nsXULDocument::ContentRemoved ( nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [virtual]

Reimplemented from nsDocument.

Definition at line 1189 of file nsXULDocument.cpp.

{
    nsresult rv;
    rv = RemoveSubtreeFromDocument(aChild);
    if (NS_FAILED(rv))
        return;

    nsXMLDocument::ContentRemoved(aContainer, aChild,
                                  aIndexInContainer);
}

Here is the call graph for this function:

void nsDocument::ContentStatesChanged ( nsIContent aContent1,
nsIContent aContent2,
PRInt32  aStateMask 
) [virtual, inherited]

Implements nsIDocument.

Definition at line 2481 of file nsDocument.cpp.

{
  NS_DOCUMENT_NOTIFY_OBSERVERS(ContentStatesChanged,
                               (this, aContent1, aContent2, aStateMask));
}
nsIDOMAttr nsIDOMDocument::createAttribute ( in DOMString  name) raises (DOMException) [inherited]
nsIDOMAttr nsIDOMDocument::createAttributeNS ( in DOMString  namespaceURI,
in DOMString  qualifiedName 
) raises (DOMException) [inherited]
nsIDOMCDATASection nsIDOMDocument::createCDATASection ( in DOMString  data) raises (DOMException) [inherited]
nsIDOMComment nsIDOMDocument::createComment ( in DOMString  data) [inherited]
nsresult nsDocument::CreateElem ( nsIAtom aName,
nsIAtom aPrefix,
PRInt32  aNamespaceID,
PRBool  aDocumentDefaultType,
nsIContent **  aResult 
) [virtual, inherited]

Create an element with the specified name, prefix and namespace ID.

If aDocumentDefaultType is true we create an element of the default type for that document (currently XHTML in HTML documents and XUL in XUL documents), otherwise we use the type specified by the namespace ID.

Implements nsIDocument.

Definition at line 4850 of file nsDocument.cpp.

{
  nsresult rv;
#ifdef DEBUG
  nsAutoString qName;
  if (aPrefix) {
    aPrefix->ToString(qName);
    qName.Append(':');
  }
  const char *name;
  aName->GetUTF8String(&name);
  AppendUTF8toUTF16(name, qName);

  rv = nsContentUtils::CheckQName(qName, PR_TRUE);
  NS_ASSERTION(NS_SUCCEEDED(rv),
               "Don't pass invalid names to nsDocument::CreateElem, "
               "check caller.");
#endif

  *aResult = nsnull;
  
  PRInt32 elementType = aDocumentDefaultType ? mDefaultElementType :
                                               aNamespaceID;

  nsCOMPtr<nsINodeInfo> nodeInfo;
  rv = mNodeInfoManager->GetNodeInfo(aName, aPrefix, aNamespaceID,
                                     getter_AddRefs(nodeInfo));
  NS_ENSURE_SUCCESS(rv, rv);

  return CreateElement(nodeInfo, elementType, aResult);
}

Here is the call graph for this function:

nsIDOMElement nsIDOMDocument::createElement ( in DOMString  tagName) raises (DOMException) [inherited]
nsresult nsDocument::CreateElement ( nsINodeInfo aNodeInfo,
PRInt32  aElementType,
nsIContent **  aResult 
) [protected, inherited]

Definition at line 2652 of file nsDocument.cpp.

{
  *aReturn = nsnull;

  nsresult rv = nsContentUtils::CheckQName(aTagName, PR_FALSE);
  NS_ENSURE_SUCCESS(rv, rv);

  NS_ASSERTION(IsCaseSensitive(),
               "nsDocument::CreateElement() called on document that is not "
               "case sensitive. Fix caller, or fix "
               "nsDocument::CreateElement()!");

  nsCOMPtr<nsIAtom> name = do_GetAtom(aTagName);

  nsCOMPtr<nsIContent> content;
  rv = CreateElem(name, nsnull, GetDefaultNamespaceID(), PR_TRUE,
                  getter_AddRefs(content));
  NS_ENSURE_SUCCESS(rv, rv);

  return CallQueryInterface(content, aReturn);
}

Here is the call graph for this function:

Create a delegate content model element from a prototype.

Note that the resulting content node is not bound to any tree

Definition at line 3715 of file nsXULDocument.cpp.

{
    // Create a content model element from a prototype element.
    NS_PRECONDITION(aPrototype != nsnull, "null ptr");
    if (! aPrototype)
        return NS_ERROR_NULL_POINTER;

    *aResult = nsnull;
    nsresult rv = NS_OK;

#ifdef PR_LOGGING
    if (PR_LOG_TEST(gXULLog, PR_LOG_NOTICE)) {
        nsAutoString tagstr;
        aPrototype->mNodeInfo->GetQualifiedName(tagstr);

        nsCAutoString tagstrC;
        tagstrC.AssignWithConversion(tagstr);
        PR_LOG(gXULLog, PR_LOG_NOTICE,
               ("xul: creating <%s> from prototype",
                tagstrC.get()));
    }
#endif

    nsCOMPtr<nsIContent> result;

    if (aPrototype->mNodeInfo->NamespaceEquals(kNameSpaceID_XUL)) {
        // If it's a XUL element, it'll be lightweight until somebody
        // monkeys with it.
        rv = nsXULElement::Create(aPrototype, this, PR_TRUE, getter_AddRefs(result));
        if (NS_FAILED(rv)) return rv;
    }
    else {
        // If it's not a XUL element, it's gonna be heavyweight no matter
        // what. So we need to copy everything out of the prototype
        // into the element.  Get a nodeinfo from our nodeinfo manager
        // for this node.
        nsCOMPtr<nsINodeInfo> newNodeInfo;
        rv = mNodeInfoManager->GetNodeInfo(aPrototype->mNodeInfo->NameAtom(),
                                           aPrototype->mNodeInfo->GetPrefixAtom(),
                                           aPrototype->mNodeInfo->NamespaceID(),
                                           getter_AddRefs(newNodeInfo));
        if (NS_FAILED(rv)) return rv;
        rv = NS_NewElement(getter_AddRefs(result), newNodeInfo->NamespaceID(),
                           newNodeInfo);
        if (NS_FAILED(rv)) return rv;

#ifdef MOZ_XTF
        if (result && newNodeInfo->NamespaceID() > kNameSpaceID_LastBuiltin) {
            result->BeginAddingChildren();
        }
#endif

        rv = AddAttributes(aPrototype, result);
        if (NS_FAILED(rv)) return rv;
    }

    result->SetContentID(mNextContentID++);

    result.swap(*aResult);

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIDOMElement nsIDOMDocument::createElementNS ( in DOMString  namespaceURI,
in DOMString  qualifiedName 
) raises (DOMException) [inherited]
nsIDOMEntityReference nsIDOMDocument::createEntityReference ( in DOMString  name) raises (DOMException) [inherited]
nsIDOMEvent nsIDOMDocumentEvent::createEvent ( in DOMString  eventType) raises (DOMException) [inherited]
nsIDOMNodeIterator nsIDOMDocumentTraversal::createNodeIterator ( in nsIDOMNode  root,
in unsigned long  whatToShow,
in nsIDOMNodeFilter  filter,
in boolean  entityReferenceExpansion 
) raises (DOMException) [inherited]
nsresult nsXULDocument::CreateOverlayElement ( nsXULPrototypeElement aPrototype,
nsIContent **  aResult 
) [protected]

Create a temporary 'overlay' element to which content nodes can be attached for later resolution.

Definition at line 3780 of file nsXULDocument.cpp.

{
    nsresult rv;

    // This doesn't really do anything except create a placeholder
    // element. I'd use an XML element, but it gets its knickers in a
    // knot with DOM ranges when you try to remove its children.
    nsCOMPtr<nsIContent> element;
    rv = nsXULElement::Create(aPrototype, this, PR_FALSE,
                              getter_AddRefs(element));
    if (NS_FAILED(rv)) return rv;

    OverlayForwardReference* fwdref =
        new OverlayForwardReference(this, element);
    if (! fwdref)
        return NS_ERROR_OUT_OF_MEMORY;

    // transferring ownership to ya...
    rv = AddForwardReference(fwdref);
    if (NS_FAILED(rv)) return rv;

    *aResult = element;
    NS_ADDREF(*aResult);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIDOMProcessingInstruction nsIDOMDocument::createProcessingInstruction ( in DOMString  target,
in DOMString  data 
) raises (DOMException) [inherited]
nsresult nsDocument::CreateShell ( nsPresContext aContext,
nsIViewManager aViewManager,
nsStyleSet aStyleSet,
nsIPresShell **  aInstancePtrResult 
) [virtual, inherited]

Create a new presentation shell that will use aContext for it's presentation context (presentation context's must not be shared among multiple presentation shell's).

Implements nsIDocument.

Reimplemented in nsHTMLDocument.

Definition at line 1658 of file nsDocument.cpp.

{
  // Don't add anything here.  Add it to |doCreateShell| instead.
  // This exists so that subclasses can pass other values for the 4th
  // parameter some of the time.
  return doCreateShell(aContext, aViewManager, aStyleSet,
                       eCompatibility_FullStandards, aInstancePtrResult);
}
nsresult nsXULDocument::CreateTemplateBuilder ( nsIContent aElement) [static, protected]

Create a XUL template builder on the specified node.

Definition at line 3859 of file nsXULDocument.cpp.

{
    // Check if need to construct a tree builder or content builder.
    PRBool isTreeBuilder = PR_FALSE;

    PRInt32 nameSpaceID;
    nsCOMPtr<nsIAtom> baseTag;

    nsCOMPtr<nsIXBLService> xblService = do_GetService("@mozilla.org/xbl;1");
    if (xblService) {
        xblService->ResolveTag(aElement, &nameSpaceID, getter_AddRefs(baseTag));
    }
    else {
        nsINodeInfo *ni = aElement->GetNodeInfo();
        nameSpaceID = ni->NamespaceID();
        baseTag = ni->NameAtom();
    }

    if ((nameSpaceID == kNameSpaceID_XUL) && (baseTag == nsXULAtoms::tree)) {
        // By default, we build content for a tree and then we attach
        // the tree content view. However, if the `dont-build-content'
        // flag is set, then we we'll attach a tree builder which
        // directly implements the tree view.

        nsAutoString flags;
        aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::flags, flags);
        if (flags.Find(NS_LITERAL_STRING("dont-build-content")) >= 0) {
            isTreeBuilder = PR_TRUE;
        }
    }

    if (isTreeBuilder) {
        // Create and initialize a tree builder.
        nsCOMPtr<nsIXULTemplateBuilder> builder =
            do_CreateInstance("@mozilla.org/xul/xul-tree-builder;1");

        if (! builder)
            return NS_ERROR_FAILURE;

        builder->Init(aElement);

        // Create a <treechildren> if one isn't there already.
        // XXXvarga what about attributes?
        nsCOMPtr<nsIContent> bodyContent;
        nsXULContentUtils::FindChildByTag(aElement, kNameSpaceID_XUL,
                                          nsXULAtoms::treechildren,
                                          getter_AddRefs(bodyContent));

        if (! bodyContent) {
            // Get the document.
            nsIDocument *document = aElement->GetDocument();
            NS_ASSERTION(document, "no document");
            if (! document)
                return NS_ERROR_UNEXPECTED;

            nsresult rv = document->CreateElem(nsXULAtoms::treechildren,
                                               nsnull, kNameSpaceID_XUL,
                                               PR_FALSE,
                                               getter_AddRefs(bodyContent));
            NS_ENSURE_SUCCESS(rv, rv);

            aElement->AppendChildTo(bodyContent, PR_FALSE);
        }
    }
    else {
        // Create and initialize a content builder.
        nsCOMPtr<nsIXULTemplateBuilder> builder
            = do_CreateInstance("@mozilla.org/xul/xul-template-builder;1");

        if (! builder)
            return NS_ERROR_FAILURE;

        builder->Init(aElement);

        nsXULElement *xulContent = nsXULElement::FromContent(aElement);
        if (xulContent) {
            // Mark the XUL element as being lazy, so the template builder
            // will run when layout first asks for these nodes.
            xulContent->SetLazyState(nsXULElement::eChildrenMustBeRebuilt);
        }
        else {
            // Force construction of immediate template sub-content _now_.
            builder->CreateContents(aElement);
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIDOMText nsIDOMDocument::createTextNode ( in DOMString  data) [inherited]
nsIDOMTreeWalker nsIDOMDocumentTraversal::createTreeWalker ( in nsIDOMNode  root,
in unsigned long  whatToShow,
in nsIDOMNodeFilter  filter,
in boolean  entityReferenceExpansion 
) raises (DOMException) [inherited]
nsICSSLoader* nsIDocument::CSSLoader ( ) const [inline, inherited]

Get this document's CSSLoader.

This is guaranteed to not return null.

Definition at line 442 of file nsIDocument.h.

                                  {
    return mCSSLoader;
  }

Here is the caller graph for this function:

virtual nsresult nsIDocument::DeleteProperty ( nsIAtom aPropertyName) [pure virtual, inherited]

Here is the caller graph for this function:

PRBool nsDocument::DeleteShell ( nsIPresShell aShell) [virtual, inherited]

Implements nsIDocument.

Definition at line 1696 of file nsDocument.cpp.

{
  return mPresShells.RemoveElement(aShell);
}
virtual void nsIDocument::Destroy ( ) [pure virtual, inherited]

Notify the document that its associated ContentViewer is being destroyed.

This releases circular references so that the document can go away. Destroy() is only called on documents that have a content viewer.

Implemented in nsImageDocument.

Definition at line 1608 of file nsXULDocument.cpp.

{
    for (PRInt32 i = mForwardReferences.Count() - 1; i >= 0; --i) {
        nsForwardReference* fwdref =
            NS_REINTERPRET_CAST(nsForwardReference*, mForwardReferences[i]);
        delete fwdref;
    }

    mForwardReferences.Clear();
    return NS_OK;
}

Here is the caller graph for this function:

void nsDocument::DestroyLinkMap ( ) [protected, inherited]

Definition at line 5386 of file nsDocument.cpp.

void nsDocument::DispatchContentLoadedEvents ( ) [protected, inherited]

Definition at line 2348 of file nsDocument.cpp.

{
  // Fire a DOM event notifying listeners that this document has been
  // loaded (excluding images and other loads initiated by this
  // document).
  nsCOMPtr<nsIDOMEvent> event;
  CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));

  nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));

  if (privateEvent) {
    event->InitEvent(NS_LITERAL_STRING("DOMContentLoaded"), PR_TRUE, PR_TRUE);
    privateEvent->SetTrusted(PR_TRUE);

    PRBool defaultActionEnabled;
    DispatchEvent(event, &defaultActionEnabled);
  }

  // If this document is a [i]frame, fire a DOMFrameContentLoaded
  // event on all parent documents notifying that the HTML (excluding
  // other external files such as images and stylesheets) in a frame
  // has finished loading.

  nsCOMPtr<nsIDocShellTreeItem> docShellParent;

  // target_frame is the [i]frame element that will be used as the
  // target for the event. It's the [i]frame whose content is done
  // loading.
  nsCOMPtr<nsIDOMEventTarget> target_frame;

  if (mScriptGlobalObject) {
    nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
      do_QueryInterface(mScriptGlobalObject->GetDocShell());

    if (docShellAsItem) {
      docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));

      nsCOMPtr<nsIDocument> parent_doc;

      GetDocumentFromDocShellTreeItem(docShellParent,
                                      getter_AddRefs(parent_doc));

      if (parent_doc) {
        target_frame = do_QueryInterface(parent_doc->FindContentForSubDocument(this));
      }
    }
  }

  if (target_frame) {
    while (docShellParent) {
      nsCOMPtr<nsIDocument> ancestor_doc;

      GetDocumentFromDocShellTreeItem(docShellParent,
                                      getter_AddRefs(ancestor_doc));

      if (!ancestor_doc) {
        break;
      }

      nsCOMPtr<nsIDOMDocumentEvent> document_event =
        do_QueryInterface(ancestor_doc);

      if (document_event) {
        document_event->CreateEvent(NS_LITERAL_STRING("Events"),
                                    getter_AddRefs(event));

        privateEvent = do_QueryInterface(event);
      }

      if (event && privateEvent) {
        event->InitEvent(NS_LITERAL_STRING("DOMFrameContentLoaded"), PR_TRUE,
                         PR_TRUE);

        privateEvent->SetTarget(target_frame);
        privateEvent->SetTrusted(PR_TRUE);

        // To dispatch this event we must manually call
        // HandleDOMEvent() on the ancestor document since the target
        // is not in the same document, so the event would never reach
        // the ancestor document if we used the normal event
        // dispatching code.

        nsEvent* innerEvent;
        privateEvent->GetInternalNSEvent(&innerEvent);
        if (innerEvent) {
          nsEventStatus status = nsEventStatus_eIgnore;

          nsIPresShell *shell = ancestor_doc->GetShellAt(0);
          if (shell) {
            nsCOMPtr<nsPresContext> context = shell->GetPresContext();

            if (context) {
              // The event argument to HandleDOMEvent() is inout, and
              // that doesn't mix well with nsCOMPtr's. We'll need to
              // perform some refcounting magic here.
              nsIDOMEvent *tmp_event = event;
              NS_ADDREF(tmp_event);

              ancestor_doc->HandleDOMEvent(context, innerEvent, &tmp_event,
                                           NS_EVENT_FLAG_INIT, &status);

              NS_IF_RELEASE(tmp_event);
            }
          }
        }
      }

      nsCOMPtr<nsIDocShellTreeItem> tmp(docShellParent);
      tmp->GetSameTypeParent(getter_AddRefs(docShellParent));
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

boolean nsIDOMEventTarget::dispatchEvent ( in nsIDOMEvent  evt) raises (DOMException) [inherited]

This method allows the dispatch of events into the implementations event model.

Events dispatched in this manner will have the same capturing and bubbling behavior as events dispatched directly by the implementation. The target of the event is the EventTarget on which dispatchEvent is called.

Parameters:
evtSpecifies the event type, behavior, and contextual information to be used in processing the event.
Returns:
Indicates whether any of the listeners which handled the event called preventDefault. If preventDefault was called the value is false, else the value is true.
Exceptions:
UNSPECIFIED_EVENT_TYPE_ERR,:Raised if the Event's type was not specified by initializing the event before dispatchEvent was called. Specification of the Event's type as null or an empty string will also trigger this exception.
void nsDocument::DispatchEventToWindow ( nsEvent aEvent) [protected, inherited]

Definition at line 5204 of file nsDocument.cpp.

{
  nsIScriptGlobalObject *sgo = GetScriptGlobalObject();
  if (!sgo)
    return;

  nsEventStatus status = nsEventStatus_eIgnore;

  // There's not always a prescontext that we can use for the event.
  // So, we force creation of a DOMEvent so that it can explicitly targeted.

  nsCOMPtr<nsIEventListenerManager> lm;
  GetListenerManager(getter_AddRefs(lm));
  if (!lm)
    return;

  nsCOMPtr<nsIDOMEvent> domEvt;
  lm->CreateEvent(nsnull, aEvent, EmptyString(), getter_AddRefs(domEvt));
  if (!domEvt)
    return;

  nsCOMPtr<nsIPrivateDOMEvent> privEvt = do_QueryInterface(domEvt);
  NS_ASSERTION(privEvt, "DOM Event objects must implement nsIPrivateDOMEvent");

  privEvt->SetTarget(this);

  nsIDOMEvent *domEvtPtr = domEvt;
  sgo->HandleDOMEvent(nsnull, aEvent, &domEvtPtr, NS_EVENT_FLAG_INIT, &status);

  NS_ASSERTION(domEvtPtr == domEvt, "event modified during dipatch");
}

Here is the call graph for this function:

nsresult nsDocument::doCreateShell ( nsPresContext aContext,
nsIViewManager aViewManager,
nsStyleSet aStyleSet,
nsCompatibility  aCompatMode,
nsIPresShell **  aInstancePtrResult 
) [protected, inherited]

Definition at line 1670 of file nsDocument.cpp.

{
  *aInstancePtrResult = nsnull;
  
  FillStyleSet(aStyleSet);
  
  nsCOMPtr<nsIPresShell> shell;
  nsresult rv = NS_NewPresShell(getter_AddRefs(shell));
  if (NS_FAILED(rv)) {
    return rv;
  }

  rv = shell->Init(this, aContext, aViewManager, aStyleSet, aCompatMode);
  NS_ENSURE_SUCCESS(rv, rv);

  // Note: we don't hold a ref to the shell (it holds a ref to us)
  mPresShells.AppendElement(shell);
  shell.swap(*aInstancePtrResult);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from nsXMLDocument.

Definition at line 664 of file nsXULDocument.cpp.

{
    nsresult rv;

    // Whack the prototype document into the cache so that the next
    // time somebody asks for it, they don't need to load it by hand.

    nsCOMPtr<nsIURI> uri;
    rv = mCurrentPrototype->GetURI(getter_AddRefs(uri));
    if (NS_FAILED(rv)) return;

    PRBool isChrome = IsChromeURI(uri);

    // Remember if the XUL cache is on
    PRBool useXULCache;
    gXULCache->GetEnabled(&useXULCache);

    // If the current prototype is an overlay document (non-master prototype)
    // and we're filling the FastLoad disk cache, tell the cache we're done
    // loading it, and write the prototype.
    if (useXULCache && mIsWritingFastLoad &&
        mMasterPrototype != mCurrentPrototype &&
        isChrome)
        gXULCache->WritePrototype(mCurrentPrototype);

    if (isChrome) {
        nsCOMPtr<nsIXULOverlayProvider> reg =
            do_GetService(NS_CHROMEREGISTRY_CONTRACTID);
        nsICSSLoader* cssLoader = CSSLoader();
        
        if (reg) {
            nsCOMPtr<nsISimpleEnumerator> overlays;
            reg->GetStyleOverlays(uri, getter_AddRefs(overlays));

            PRBool moreSheets;
            nsCOMPtr<nsISupports> next;
            nsCOMPtr<nsIURI> sheetURI;
            nsCOMPtr<nsICSSStyleSheet> sheet;

            while (NS_SUCCEEDED(rv = overlays->HasMoreElements(&moreSheets)) &&
                   moreSheets) {
                overlays->GetNext(getter_AddRefs(next));

                sheetURI = do_QueryInterface(next);
                if (!uri) {
                    NS_ERROR("Chrome registry handed me a non-nsIURI object!");
                    continue;
                }

                if (useXULCache && IsChromeURI(sheetURI)) {
                    mCurrentPrototype->AddStyleSheetReference(sheetURI);
                }

                cssLoader->LoadAgentSheet(sheetURI, getter_AddRefs(sheet));
                if (!sheet) {
                    NS_WARNING("Couldn't load chrome style overlay.");
                    continue;
                }

                AddStyleSheet(sheet);
            }
        }

        if (useXULCache) {
            // If it's a 'chrome:' prototype document, then notify any
            // documents that raced to load the prototype, and awaited
            // its load completion via proto->AwaitLoadDone().
            rv = mCurrentPrototype->NotifyLoadDone();
            if (NS_FAILED(rv)) return;
        }
    }

    // Now walk the prototype to build content.
    rv = PrepareToWalk();
    if (NS_FAILED(rv)) return;

    ResumeWalk();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsDocument::EndUpdate ( nsUpdateType  aUpdateType) [virtual, inherited]

Implements nsIDocument.

Definition at line 2304 of file nsDocument.cpp.

{
  NS_DOCUMENT_NOTIFY_OBSERVERS(EndUpdate, (this, aUpdateType));

  --mUpdateNestLevel;
  if (mUpdateNestLevel == 0) {
    // This set of updates may have created XBL bindings.  Let the
    // binding manager know we're done.
    nsIBindingManager* bm = mBindingManager;
    NS_STATIC_CAST(nsBindingManager*, bm)->EndOutermostUpdate();
  }

  if (mScriptLoader) {
    NS_STATIC_CAST(nsScriptLoader*,
                   NS_STATIC_CAST(nsIScriptLoader*,
                                  mScriptLoader))->RemoveExecuteBlocker();
  }
}
void nsDocument::EnsureCatalogStyleSheet ( const char *  aStyleSheetURI) [virtual, inherited]

Implements nsIDocument.

Definition at line 2120 of file nsDocument.cpp.

{
  nsICSSLoader* cssLoader = CSSLoader();
  PRBool enabled;
  if (NS_SUCCEEDED(cssLoader->GetEnabled(&enabled)) && enabled) {
    PRInt32 sheetCount = GetNumberOfCatalogStyleSheets();
    for (PRInt32 i = 0; i < sheetCount; i++) {
      nsIStyleSheet* sheet = GetCatalogStyleSheetAt(i);
      NS_ASSERTION(sheet, "unexpected null stylesheet in the document");
      if (sheet) {
        nsCOMPtr<nsIURI> uri;
        sheet->GetSheetURI(getter_AddRefs(uri));
        nsCAutoString uriStr;
        uri->GetSpec(uriStr);
        if (uriStr.Equals(aStyleSheetURI))
          return;
      }
    }

    nsCOMPtr<nsIURI> uri;
    NS_NewURI(getter_AddRefs(uri), aStyleSheetURI);
    if (uri) {
      nsCOMPtr<nsICSSLoader_MOZILLA_1_8_BRANCH> loader = do_QueryInterface(cssLoader);
      nsCOMPtr<nsICSSStyleSheet> sheet;
      loader->LoadSheetSync(uri, PR_TRUE, getter_AddRefs(sheet));
      if (sheet) {
        BeginUpdate(UPDATE_STYLE);
        AddCatalogStyleSheet(sheet);
        EndUpdate(UPDATE_STYLE);
      }
    }
  }
}

Here is the call graph for this function:

virtual void nsIDocument::EnumerateSubDocuments ( nsSubDocEnumFunc  aCallback,
void aData 
) [pure virtual, inherited]

Here is the caller graph for this function:

nsIDOMRange nsIDOMXMLDocument::evaluateFIXptr ( in DOMString  expression) [inherited]

Evaluate FIXptr expression.

FIXptr is a W3C NOTE, see

http://lists.w3.org/Archives/Public/www-xml-linking-comments/2001AprJun/att-0074/01-NOTE-FIXptr-20010425.htm

Parameters:
expressionFIXptr string.
Returns:
The range object that results from evaluation
nsIXPointerResult nsIDOMXMLDocument::evaluateXPointer ( in DOMString  expression) [inherited]

Evaluate XPointer expression.

nsresult nsXULDocument::ExecuteOnBroadcastHandlerFor ( nsIContent aBroadcaster,
nsIDOMElement aListener,
nsIAtom aAttr 
) [protected]

Definition at line 1010 of file nsXULDocument.cpp.

{
    // Now we execute the onchange handler in the context of the
    // observer. We need to find the observer in order to
    // execute the handler.

    nsCOMPtr<nsIContent> listener = do_QueryInterface(aListener);
    PRUint32 count = listener->GetChildCount();
    for (PRUint32 i = 0; i < count; ++i) {
        // Look for an <observes> element beneath the listener. This
        // ought to have an |element| attribute that refers to
        // aBroadcaster, and an |attribute| element that tells us what
        // attriubtes we're listening for.
        nsIContent *child = listener->GetChildAt(i);

        nsINodeInfo *ni = child->GetNodeInfo();
        if (!ni || !ni->Equals(nsXULAtoms::observes, kNameSpaceID_XUL))
            continue;

        // Is this the element that was listening to us?
        nsAutoString listeningToID;
        child->GetAttr(kNameSpaceID_None, nsXULAtoms::element, listeningToID);

        nsAutoString broadcasterID;
        aBroadcaster->GetAttr(kNameSpaceID_None, nsXULAtoms::id, broadcasterID);

        if (listeningToID != broadcasterID)
            continue;

        // We are observing the broadcaster, but is this the right
        // attribute?
        nsAutoString listeningToAttribute;
        child->GetAttr(kNameSpaceID_None, nsXULAtoms::attribute,
                       listeningToAttribute);

        if (!aAttr->Equals(listeningToAttribute) &&
            !listeningToAttribute.EqualsLiteral("*")) {
            continue;
        }

        // This is the right <observes> element. Execute the
        // |onbroadcast| event handler
        nsEvent event(PR_TRUE, NS_XUL_BROADCAST);

        PRInt32 j = mPresShells.Count();
        while (--j >= 0) {
            nsCOMPtr<nsIPresShell> shell =
                NS_STATIC_CAST(nsIPresShell*, mPresShells[j]);

            nsCOMPtr<nsPresContext> aPresContext = shell->GetPresContext();

            // Handle the DOM event
            nsEventStatus status = nsEventStatus_eIgnore;
            child->HandleDOMEvent(aPresContext, &event, nsnull,
                                  NS_EVENT_FLAG_INIT, &status);
        }
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsXULDocument::ExecuteScript ( JSObject aScriptObject) [protected]

Execute the precompiled script object scoped by this XUL document's containing window object, and using its associated script context.

Definition at line 3693 of file nsXULDocument.cpp.

{
    NS_PRECONDITION(aScriptObject != nsnull, "null ptr");
    if (! aScriptObject)
        return NS_ERROR_NULL_POINTER;

    // Execute the precompiled script with the given version
    nsresult rv = NS_ERROR_UNEXPECTED;

    NS_ASSERTION(mScriptGlobalObject != nsnull, "no script global object");

    nsCOMPtr<nsIScriptContext> context;
    if (mScriptGlobalObject && (context = mScriptGlobalObject->GetContext()))
        rv = context->ExecuteScript(aScriptObject,
                                    mScriptGlobalObject->GetGlobalJSObject(),
                                    nsnull, nsnull);

    return rv;
}

Here is the caller graph for this function:

void nsDocument::FillStyleSet ( nsStyleSet aStyleSet) [protected, inherited]

Definition at line 1243 of file nsDocument.cpp.

{
  NS_PRECONDITION(aStyleSet, "Must have a style set");
  NS_PRECONDITION(aStyleSet->SheetCount(nsStyleSet::ePresHintSheet) == 0,
                  "Style set already has a preshint sheet?");
  NS_PRECONDITION(aStyleSet->SheetCount(nsStyleSet::eHTMLPresHintSheet) == 0,
                  "Style set already has a HTML preshint sheet?");
  NS_PRECONDITION(aStyleSet->SheetCount(nsStyleSet::eDocSheet) == 0,
                  "Style set already has document sheets?");
  NS_PRECONDITION(aStyleSet->SheetCount(nsStyleSet::eStyleAttrSheet) == 0,
                  "Style set already has style attr sheets?");
  NS_PRECONDITION(mStyleAttrStyleSheet, "No style attr stylesheet?");
  NS_PRECONDITION(mAttrStyleSheet, "No attr stylesheet?");
  
  aStyleSet->AppendStyleSheet(GetAttrSheetType(), mAttrStyleSheet);

  aStyleSet->AppendStyleSheet(nsStyleSet::eStyleAttrSheet,
                              mStyleAttrStyleSheet);

  PRInt32 i;
  for (i = mStyleSheets.Count() - 1; i >= 0; --i) {
    nsIStyleSheet* sheet = mStyleSheets[i];
    PRBool sheetApplicable;
    sheet->GetApplicable(sheetApplicable);
    if (sheetApplicable) {
      aStyleSet->AddDocStyleSheet(sheet, this);
    }
  }

  for (i = mCatalogSheets.Count() - 1; i >= 0; --i) {
    nsIStyleSheet* sheet = mCatalogSheets[i];
    PRBool sheetApplicable;
    sheet->GetApplicable(sheetApplicable);
    if (sheetApplicable) {
      aStyleSet->AppendStyleSheet(nsStyleSet::eAgentSheet, sheet);
    }
  }
}

Here is the call graph for this function:

nsresult nsXULDocument::FindBroadcaster ( nsIContent aElement,
nsIDOMElement **  aListener,
nsString aBroadcasterID,
nsString aAttribute,
nsIDOMElement **  aBroadcaster 
) [protected]

Definition at line 4316 of file nsXULDocument.cpp.

{
    nsresult rv;
    nsINodeInfo *ni = aElement->GetNodeInfo();
    *aListener = nsnull;
    *aBroadcaster = nsnull;

    if (ni && ni->Equals(nsXULAtoms::observes, kNameSpaceID_XUL)) {
        // It's an <observes> element, which means that the actual
        // listener is the _parent_ node. This element should have an
        // 'element' attribute that specifies the ID of the
        // broadcaster element, and an 'attribute' element, which
        // specifies the name of the attribute to observe.
        nsIContent* parent = aElement->GetParent();

        // If we're still parented by an 'overlay' tag, then we haven't
        // made it into the real document yet. Defer hookup.
        if (parent->GetNodeInfo()->Equals(nsXULAtoms::overlay, kNameSpaceID_XUL)) {
            return NS_FINDBROADCASTER_AWAIT_OVERLAYS;
        }

        if (NS_FAILED(CallQueryInterface(parent, aListener)))
            *aListener = nsnull;

        rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::element, aBroadcasterID);
        if (NS_FAILED(rv)) return rv;

        rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::attribute,
                               aAttribute);
        if (NS_FAILED(rv)) return rv;
    }
    else {
        // It's a generic element, which means that we'll use the
        // value of the 'observes' attribute to determine the ID of
        // the broadcaster element, and we'll watch _all_ of its
        // values.
        rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::observes, aBroadcasterID);
        if (NS_FAILED(rv)) return rv;

        // Bail if there's no aBroadcasterID
        if ((rv != NS_CONTENT_ATTR_HAS_VALUE) || (aBroadcasterID.IsEmpty())) {
            // Try the command attribute next.
            rv = aElement->GetAttr(kNameSpaceID_None, nsXULAtoms::command, aBroadcasterID);
            if (NS_FAILED(rv)) return rv;

            if (rv == NS_CONTENT_ATTR_HAS_VALUE && !aBroadcasterID.IsEmpty()) {
                // We've got something in the command attribute.  We
                // only treat this as a normal broadcaster if we are
                // not a menuitem or a key.

                if (ni->Equals(nsXULAtoms::menuitem, kNameSpaceID_XUL) ||
                    ni->Equals(nsXULAtoms::key, kNameSpaceID_XUL)) {
                return NS_FINDBROADCASTER_NOT_FOUND;
              }
            }
            else {
              return NS_FINDBROADCASTER_NOT_FOUND;
            }
        }

        if (NS_FAILED(CallQueryInterface(aElement, aListener)))
            *aListener = nsnull;

        aAttribute.AssignLiteral("*");
    }

    // Make sure we got a valid listener.
    NS_ENSURE_TRUE(*aListener, NS_ERROR_UNEXPECTED);

    // Try to find the broadcaster element in the document.
    rv = GetElementById(aBroadcasterID, aBroadcaster);
    if (NS_FAILED(rv)) return rv;

    // If we can't find the broadcaster, then we'll need to defer the
    // hookup. We may need to resolve some of the other overlays
    // first.
    if (! *aBroadcaster) {
        return NS_FINDBROADCASTER_AWAIT_OVERLAYS;
    }

    return NS_FINDBROADCASTER_FOUND;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIContent * nsDocument::FindContentForSubDocument ( nsIDocument aDocument) const [virtual, inherited]

Find the content node for which aDocument is a sub document.

Implements nsIDocument.

Definition at line 1841 of file nsDocument.cpp.

Here is the call graph for this function:

void nsDocument::FlushPendingNotifications ( mozFlushType  aType) [virtual, inherited]

Flush notifications for this document and its parent documents (since those may affect the layout of this one).

Implements nsIDocument.

Reimplemented in nsHTMLDocument.

Definition at line 4427 of file nsDocument.cpp.

{
  if (aType == (aType & (Flush_Content | Flush_SinkNotifications)) ||
      !mScriptGlobalObject) {
    // Nothing to do here
    return;
  }

  // We should be able to replace all this nsIDocShell* code with code
  // that uses mParentDocument, but mParentDocument is never set in
  // the current code!

  nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
    do_QueryInterface(mScriptGlobalObject->GetDocShell());

  if (docShellAsItem) {
    nsCOMPtr<nsIDocShellTreeItem> docShellParent;
    docShellAsItem->GetSameTypeParent(getter_AddRefs(docShellParent));

    nsCOMPtr<nsIDOMWindow> win(do_GetInterface(docShellParent));

    if (win) {
      nsCOMPtr<nsIDOMDocument> dom_doc;
      win->GetDocument(getter_AddRefs(dom_doc));

      nsCOMPtr<nsIDocument> doc(do_QueryInterface(dom_doc));

      // If we have a parent we must flush the parent too to ensure that our
      // container is reflown if its size was changed.  But if it's not safe to
      // flush ourselves, then don't flush the parent, since that can cause
      // things like resizes of our frame's widget, which we can't handle while
      // flushing is unsafe.
      if (doc && IsSafeToFlush()) {
        doc->FlushPendingNotifications(aType);
      }
    }
  }

  PRInt32 i, count = mPresShells.Count();

  for (i = 0; i < count; i++) {
    nsCOMPtr<nsIPresShell> shell =
      NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);

    if (shell) {
      shell->FlushPendingNotifications(aType);
    }
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsIDocument::ForgetLink ( nsIContent aContent) [pure virtual, inherited]

Notification that an element is a link and its URI might have been changed or the element removed.

If the element is still a link relevant to style, then someone must ensure that AddStyleRelevantLink is (eventually) called on it again.

Here is the caller graph for this function:

Definition at line 552 of file nsIDocument.h.

  {
    return mNextContentID++;
  }

Here is the caller graph for this function:

nsIDOMElement nsIDOMDocumentXBL::getAnonymousElementByAttribute ( in nsIDOMElement  elt,
in DOMString  attrName,
in DOMString  attrValue 
) [inherited]
virtual nsHTMLStyleSheet* nsDocument::GetAttributeStyleSheet ( ) const [inline, virtual, inherited]

Get this document's attribute stylesheet.

May return null if there isn't one.

Implements nsIDocument.

Definition at line 527 of file nsDocument.h.

                                                           {
    return mAttrStyleSheet;
  }
nsStyleSet::sheetType nsDocument::GetAttrSheetType ( ) [protected, virtual, inherited]

Reimplemented in nsHTMLDocument.

Definition at line 1237 of file nsDocument.cpp.

void nsDocument::GetBaseTarget ( nsAString &  aBaseTarget) const [virtual, inherited]

Get/Set the base target of a link in a document.

Implements nsIDocument.

Definition at line 1424 of file nsDocument.cpp.

{
  aBaseTarget.Assign(mBaseTarget);
}
nsIURI* nsIDocument::GetBaseURI ( ) const [inline, inherited]

Return the base URI for relative URIs in the document (the document uri unless it's overridden by SetBaseURI, HTML <base> tags, etc.).

The returned URI could be null if there is no document URI.

Definition at line 183 of file nsIDocument.h.

Here is the caller graph for this function:

PRBool nsIDocument::GetBidiEnabled ( ) const [inline, inherited]

Check if the document contains bidi data.

If so, we have to apply the Unicode Bidi Algorithm.

Definition at line 258 of file nsIDocument.h.

  {
    return mBidiEnabled;
  }

Here is the caller graph for this function:

nsIStyleSheet * nsDocument::GetCatalogStyleSheetAt ( PRInt32  aIndex) const [virtual, inherited]

Implements nsIDocument.

Definition at line 2094 of file nsDocument.cpp.

{
  NS_ENSURE_TRUE(0 <= aIndex && aIndex < mCatalogSheets.Count(), nsnull);
  return mCatalogSheets[aIndex];
}
virtual nsIChannel* nsDocument::GetChannel ( ) const [inline, virtual, inherited]

Get the channel that was passed to StartDocumentLoad or Reset for this document.

Note that this may be null in some cases (eg if StartDocumentLoad or Reset were never called)

Implements nsIDocument.

Definition at line 519 of file nsDocument.h.

                                         {
    return mChannel;
  }
nsIContent * nsDocument::GetChildAt ( PRUint32  aIndex) const [virtual, inherited]

Get the direct children of the document - content in the prolog, the root content and content in the epilog.

Implements nsIDocument.

Definition at line 1890 of file nsDocument.cpp.

{
  return mChildren.GetSafeChildAt(aIndex);
}
PRUint32 nsDocument::GetChildCount ( ) const [virtual, inherited]

Implements nsIDocument.

Definition at line 1902 of file nsDocument.cpp.

{
  return mChildren.ChildCount();
}
already_AddRefed<nsISupports> nsIDocument::GetContainer ( ) const [inline, inherited]

Get the container (docshell) for this document.

Definition at line 593 of file nsIDocument.h.

  {
    nsISupports* container = nsnull;
    if (mDocumentContainer)
      CallQueryReferent(mDocumentContainer.get(), &container);

    return container;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsIDocument::GetContentLanguage ( nsAString &  aContentLanguage) const [inline, inherited]

Return the language of this document.

Definition at line 246 of file nsIDocument.h.

  {
    CopyASCIItoUCS2(mContentLanguage, aContentLanguage);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsXULDocument::GetContentType ( nsAString &  aContentType) [virtual]

Get the Content-Type of this document.

(This will always return NS_OK, but has this signature to be compatible with nsIDOMNSDocument::GetContentType())

Implements nsIDocument.

Definition at line 509 of file nsXULDocument.cpp.

{
    aContentType.AssignLiteral("application/vnd.mozilla.xul+xml");
    return NS_OK;
}
NS_IMETHODIMP nsDocument::GetCurrentRadioButton ( const nsAString &  aName,
nsIDOMHTMLInputElement **  aRadio 
) [virtual, inherited]

Get the current radio button in a group.

Parameters:
aNamethe group name
aRadiothe currently selected radio button [OUT]

Implements nsIRadioGroupContainer.

Definition at line 4600 of file nsDocument.cpp.

{
  nsRadioGroupStruct* radioGroup = nsnull;
  GetRadioGroup(aName, &radioGroup);
  if (radioGroup) {
    *aRadio = radioGroup->mSelectedRadioButton;
    NS_IF_ADDREF(*aRadio);
  }

  return NS_OK;
}
PRInt32 nsXULDocument::GetDefaultNamespaceID ( ) const [inline, protected, virtual]

Returns the default namespace ID used for elements created in this document.

Reimplemented from nsDocument.

Definition at line 234 of file nsXULDocument.h.

    {
        return kNameSpaceID_XUL;
    };

Return a standard name for the document's character set.

This will trigger a startDocumentLoad if necessary to answer the question.

Definition at line 200 of file nsIDocument.h.

  {
    return mCharacterSet;
  }

Here is the caller graph for this function:

PRInt32 nsIDocument::GetDocumentCharacterSetSource ( ) const [inline, inherited]

Definition at line 211 of file nsIDocument.h.

  {
    return mCharacterSetSource;
  }

Return the LoadGroup for the document.

May return null.

Definition at line 169 of file nsIDocument.h.

  {
    nsILoadGroup *group = nsnull;
    if (mDocumentLoadGroup)
      CallQueryReferent(mDocumentLoadGroup.get(), &group);

    return group;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

const nsAFlatString& nsIDocument::GetDocumentTitle ( ) const [inline, inherited]

Return the title of the document.

May return null.

Definition at line 139 of file nsIDocument.h.

  {
    return mDocumentTitle;
  }

Here is the caller graph for this function:

nsIURI* nsIDocument::GetDocumentURI ( ) const [inline, inherited]

Return the URI for the document.

May return null.

Definition at line 147 of file nsIDocument.h.

  {
    return mDocumentURI;
  }

Here is the caller graph for this function:

nsIDOMElement nsIDOMDocument::getElementById ( in DOMString  elementId) [inherited]
NS_IMETHODIMP nsXULDocument::GetElementById ( const nsAString &  elementId,
nsIDOMElement **  _retval 
)

Reimplemented from nsXMLDocument.

Definition at line 1879 of file nsXULDocument.cpp.

{
    NS_ENSURE_ARG_POINTER(aReturn);
    *aReturn = nsnull;

    NS_WARN_IF_FALSE(!aId.IsEmpty(),"getElementById(\"\"), fix caller?");
    if (aId.IsEmpty())
      return NS_OK;

    nsresult rv;

    nsCOMPtr<nsIContent> element;
    rv = mElementMap.FindFirst(aId, getter_AddRefs(element));
    if (NS_FAILED(rv)) return rv;

    if (element) {
        rv = CallQueryInterface(element, aReturn);
    }

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIDOMNodeList nsIDOMXULDocument::getElementsByAttribute ( in DOMString  name,
in DOMString  value 
) [inherited]
nsIDOMNodeList nsIDOMDocument::getElementsByTagName ( in DOMString  tagname) [inherited]
nsIDOMNodeList nsIDOMDocument::getElementsByTagNameNS ( in DOMString  namespaceURI,
in DOMString  localName 
) [inherited]
NS_IMETHODIMP nsXULDocument::GetElementsForID ( const nsAString &  aID,
nsISupportsArray aElements 
) [virtual]

Get the elements for a particular resource in the resource-to-element map.

The nsISupportsArray will be truncated and filled in with nsIContent pointers.

Implements nsIXULDocument.

Definition at line 1311 of file nsXULDocument.cpp.

{
    NS_PRECONDITION(aElements != nsnull, "null ptr");
    if (! aElements)
        return NS_ERROR_NULL_POINTER;

    mElementMap.Find(aID, aElements);
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsISupports nsIDOM3Node::getFeature ( in DOMString  feature,
in DOMString  version 
) [inherited]
void nsXULDocument::GetFocusController ( nsIFocusController **  aFocusController) [protected]

Definition at line 4685 of file nsXULDocument.cpp.

{
    nsCOMPtr<nsIInterfaceRequestor> ir = do_QueryReferent(mDocumentContainer);
    nsCOMPtr<nsPIDOMWindow> windowPrivate = do_GetInterface(ir);
    if (windowPrivate) {
        NS_IF_ADDREF(*aFocusController = windowPrivate->GetRootFocusController());
    } else
        *aFocusController = nsnull;
}

Here is the call graph for this function:

void nsDocument::GetHeaderData ( nsIAtom aHeaderField,
nsAString &  aData 
) const [virtual, inherited]

Access HTTP header data (this may also get set from other sources, like HTML META tags).

Implements nsIDocument.

Definition at line 1526 of file nsDocument.cpp.

{
  aData.Truncate();
  const nsDocHeaderData* data = mHeaderData;
  while (data) {
    if (data->mField == aHeaderField) {
      aData = data->mData;

      break;
    }
    data = data->mNext;
  }
}
PRInt32 nsDocument::GetIndexOfStyleSheet ( nsIStyleSheet aSheet) const [virtual, inherited]

Get the index of a particular stylesheet.

This will always consider the "special" sheets as part of the sheet list.

Parameters:
aSheetthe sheet to get the index of
Returns:
aIndex the index of the sheet in the full list

Implements nsIDocument.

Definition at line 1938 of file nsDocument.cpp.

{
  return mStyleSheets.IndexOf(aSheet);
}
virtual nsIHTMLCSSStyleSheet* nsDocument::GetInlineStyleSheet ( ) const [inline, virtual, inherited]

Get this document's inline style sheet.

May return null if there isn't one

Implements nsIDocument.

Definition at line 535 of file nsDocument.h.

                                                            {
    return mStyleAttrStyleSheet;
  }
void nsIInterfaceRequestor::getInterface ( in nsIIDRef  uuid,
[iid_is(uuid), retval] out nsQIResult  result 
) [inherited]

Retrieves the specified interface pointer.

Parameters:
uuidThe IID of the interface being requested.
result[out] The interface pointer to be filled in if the interface is accessible.
Returns:
NS_OK - interface was successfully returned. NS_NOINTERFACE - interface not accessible. NS_ERROR* - method failure.
virtual already_AddRefed<nsILayoutHistoryState> nsIDocument::GetLayoutHistoryState ( ) const [pure virtual, inherited]

Get the layout history state that should be used to save and restore state for nodes in this document.

This may return null; if that happens state saving and restoration is not possible.

Here is the caller graph for this function:

nsILineBreaker * nsDocument::GetLineBreaker ( ) [virtual, inherited]

Return the Line Breaker for the document.

Implements nsIDocument.

Definition at line 1480 of file nsDocument.cpp.

Here is the call graph for this function:

nsresult nsDocument::GetListenerManager ( nsIEventListenerManager **  aInstancePtrResult) [virtual, inherited]

Implements nsIDOMEventReceiver.

Definition at line 4141 of file nsDocument.cpp.

{
  if (mListenerManager) {
    *aInstancePtrResult = mListenerManager;
    NS_ADDREF(*aInstancePtrResult);

    return NS_OK;
  }

  nsresult rv = NS_NewEventListenerManager(getter_AddRefs(mListenerManager));
  NS_ENSURE_SUCCESS(rv, rv);

  mListenerManager->SetListenerTarget(NS_STATIC_CAST(nsIDocument *,this));

  *aInstancePtrResult = mListenerManager;
  NS_ADDREF(*aInstancePtrResult);

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsXMLDocument::GetLoadGroup ( nsILoadGroup **  aLoadGroup) [protected, virtual, inherited]

Definition at line 348 of file nsXMLDocument.cpp.

{
  NS_ENSURE_ARG_POINTER(aLoadGroup);
  *aLoadGroup = nsnull;

  if (mScriptContext) {
    nsCOMPtr<nsIDOMWindow> window =
      do_QueryInterface(mScriptContext->GetGlobalObject());

    if (window) {
      nsCOMPtr<nsIDOMDocument> domdoc;
      window->GetDocument(getter_AddRefs(domdoc));
      nsCOMPtr<nsIDocument> doc = do_QueryInterface(domdoc);
      if (doc) {
        *aLoadGroup = doc->GetDocumentLoadGroup().get(); // already_AddRefed
      }
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Get the master prototype.

Implements nsIXULDocument.

Definition at line 1394 of file nsXULDocument.cpp.

{
    *aDocument = mMasterPrototype;
    NS_IF_ADDREF(*aDocument);
    return NS_OK;
}
NS_IMETHODIMP nsDocument::GetNextRadioButton ( const nsAString &  aName,
const PRBool  aPrevious,
nsIDOMHTMLInputElement aFocusedRadio,
nsIDOMHTMLInputElement **  aRadio 
) [virtual, inherited]

Get the next/prev radio button in a group.

Parameters:
aNamethe group name
aPrevious,truegets previous radio button, false gets next
aFocusedRadiothe currently focused radio button
aRadiothe currently selected radio button [OUT]

Implements nsIRadioGroupContainer.

Definition at line 4640 of file nsDocument.cpp.

{
  // XXX Can we combine the HTML radio button method impls of 
  //     nsDocument and nsHTMLFormControl?
  // XXX Why is HTML radio button stuff in nsDocument, as 
  //     opposed to nsHTMLDocument?
  *aRadioOut = nsnull;

  nsRadioGroupStruct* radioGroup = nsnull;
  GetRadioGroup(aName, &radioGroup);
  if (!radioGroup) {
    return NS_ERROR_FAILURE;
  }

  // Return the radio button relative to the focused radio button.
  // If no radio is focused, get the radio relative to the selected one.
  nsCOMPtr<nsIDOMHTMLInputElement> currentRadio;
  if (aFocusedRadio) {
    currentRadio = aFocusedRadio;
  }
  else {
    currentRadio = radioGroup->mSelectedRadioButton;
    if (!currentRadio) {
      return NS_ERROR_FAILURE;
    }
  }
  nsCOMPtr<nsIFormControl> radioControl(do_QueryInterface(currentRadio));
  PRInt32 index = radioGroup->mRadioButtons.IndexOf(radioControl);
  if (index < 0) {
    return NS_ERROR_FAILURE;
  }

  PRInt32 numRadios = radioGroup->mRadioButtons.Count();
  PRBool disabled;
  nsCOMPtr<nsIDOMHTMLInputElement> radio;
  do {
    if (aPrevious) {
      if (--index < 0) {
        index = numRadios -1;
      }
    }
    else if (++index >= numRadios) {
      index = 0;
    }
    radio = do_QueryInterface(NS_STATIC_CAST(nsIFormControl*, 
                              radioGroup->mRadioButtons.ElementAt(index)));
    NS_ASSERTION(radio, "mRadioButtons holding a non-radio button");
    radio->GetDisabled(&disabled);
  } while (disabled && radio != currentRadio);

  NS_IF_ADDREF(*aRadioOut = radio);
  return NS_OK;
}

Here is the call graph for this function:

PRInt32 nsDocument::GetNumberOfCatalogStyleSheets ( ) const [virtual, inherited]

Just like the style sheet API, but for "catalog" sheets, extra sheets inserted at the UA level.

Implements nsIDocument.

Definition at line 2088 of file nsDocument.cpp.

{
  return mCatalogSheets.Count();
}
PRUint32 nsDocument::GetNumberOfShells ( ) const [virtual, inherited]

Implements nsIDocument.

Definition at line 1702 of file nsDocument.cpp.

{
  return mPresShells.Count();
}

Here is the caller graph for this function:

PRInt32 nsDocument::GetNumberOfStyleSheets ( ) const [virtual, inherited]

Get the style sheets owned by this document.

These are ordered, highest priority last

Implements nsIDocument.

Definition at line 1925 of file nsDocument.cpp.

{
  return mStyleSheets.Count();
}
nsIDocument* nsIDocument::GetParentDocument ( ) const [inline, inherited]

Return the parent document of this document.

Will return null unless this document is within a compound document and has a parent. Note that this parent chain may cross chrome boundaries.

Definition at line 307 of file nsIDocument.h.

  {
    return mParentDocument;
  }

Here is the caller graph for this function:

PRUint32 nsIDocument::GetPartID ( ) const [inline, inherited]

Return the ID used to identify this part of the multipart document.

Definition at line 684 of file nsIDocument.h.

                             {
    return mPartID;
  }

Here is the caller graph for this function:

nsresult nsXULDocument::GetPixelDimensions ( nsIPresShell aShell,
PRInt32 aWidth,
PRInt32 aHeight 
) [protected]

Definition at line 1622 of file nsXULDocument.cpp.

{
    nsresult result = NS_OK;
    nsSize size;
    nsIFrame* frame;

    FlushPendingNotifications(Flush_Layout);

    if (mRootContent) {
        result = aShell->GetPrimaryFrameFor(mRootContent, &frame);
    } else {
        frame = nsnull;
    }
    if (NS_SUCCEEDED(result) && frame) {
        nsIView* view = frame->GetView();
        // If we have a view check if it's scrollable. If not,
        // just use the view size itself
        if (view) {
            nsIScrollableView* scrollableView = view->ToScrollableView();

            if (scrollableView) {
                scrollableView->GetScrolledView(view);
            }

            nsRect r = view->GetBounds();
            size.height = r.height;
            size.width = r.width;
        }
        // If we don't have a view, use the frame size
        else {
            size = frame->GetSize();
        }

        // Convert from twips to pixels
        float scale = aShell->GetPresContext()->TwipsToPixels();

        *aWidth = NSTwipsToIntPixels(size.width, scale);
        *aHeight = NSTwipsToIntPixels(size.height, scale);
    }
    else {
        *aWidth = 0;
        *aHeight = 0;
    }

    return result;
}

Here is the call graph for this function:

NS_IMETHODIMP nsDocument::GetPositionInGroup ( nsIDOMHTMLInputElement aRadio,
PRInt32 aPositionIndex,
PRInt32 aItemsInGroup 
) [virtual, inherited]

Get the radio group position and the number of radio buttons in the group.

that the radio button is in. If the radio button not grouped with any other radio buttons this method will treat it as being in a group of one.

Parameters:
aRadioradio button's pointer
aPositionIndexout indicates 0-indexed position in the radio group, or just 0 if a group cannot be found
aItemsInGroupthe number of radio buttons in the group

Implements nsIRadioGroupContainer.

Definition at line 4614 of file nsDocument.cpp.

{
  *aPositionIndex = 0;
  *aItemsInGroup = 1;
  nsAutoString name;
  aRadio->GetName(name);
  if (name.IsEmpty()) {
    return NS_OK;
  }

  nsRadioGroupStruct* radioGroup = nsnull;
  nsresult rv = GetRadioGroup(name, &radioGroup);
  NS_ENSURE_SUCCESS(rv, rv);

  nsCOMPtr<nsIFormControl> radioControl(do_QueryInterface(aRadio));
  NS_ASSERTION(radioControl, "Radio button should implement nsIFormControl");
  *aPositionIndex = radioGroup->mRadioButtons.IndexOf(radioControl);
  NS_ASSERTION(*aPositionIndex >= 0, "Radio button not found in its own group");
  *aItemsInGroup = radioGroup->mRadioButtons.Count();

  return NS_OK;
}

Here is the call graph for this function:

Return the principal responsible for this document.

Reimplemented from nsDocument.

Definition at line 648 of file nsXULDocument.cpp.

{
    NS_ASSERTION(mMasterPrototype, "Missing master prototype. See bug 169036");
    NS_ENSURE_TRUE(mMasterPrototype, nsnull);

    return mMasterPrototype->GetDocumentPrincipal();
}
virtual void* nsIDocument::GetProperty ( nsIAtom aPropertyName,
nsresult aStatus = nsnull 
) const [pure virtual, inherited]

Here is the caller graph for this function:

nsresult nsDocument::GetRadioGroup ( const nsAString &  aName,
nsRadioGroupStruct **  aRadioGroup 
) [inherited]

Definition at line 4568 of file nsDocument.cpp.

{
  nsStringKey key(aName);
  nsRadioGroupStruct *radioGroup =
    NS_STATIC_CAST(nsRadioGroupStruct *, mRadioGroups.Get(&key));

  if (!radioGroup) {
    radioGroup = new nsRadioGroupStruct();
    NS_ENSURE_TRUE(radioGroup, NS_ERROR_OUT_OF_MEMORY);
    mRadioGroups.Put(&key, radioGroup);
  }

  *aRadioGroup = radioGroup;

  return NS_OK;
}
nsIContent* nsIDocument::GetRootContent ( ) const [inline, inherited]

Return the root content object for this document.

Definition at line 339 of file nsIDocument.h.

  {
    return mRootContent;
  }

Here is the caller graph for this function:

nsIDOMGCParticipant * nsDocument::GetSCCIndex ( ) [virtual, inherited]

Get a reference node for what is known to be a strongly connected component of nsIDOMGCParticipants.

For example, DOM trees are strongly connected, so can return the root node to greatly reduce the number of nodes on which we need to run graph algorithms.

Note that it's acceptable for nodes in a single strongly connected component to return different values for GetSCCIndex, as long as those two values claim that they're reachable from each other in AppendReachableList.

Implements nsIDOMGCParticipant.

Definition at line 3445 of file nsDocument.cpp.

{
  return this;
}

Get the object that is used as the scope for all of the content wrappers whose owner document is this document.

Unlike the script global object, this will only return null when the global object for this document is truly gone. Use this object when you're trying to find a content wrapper in XPConnect.

Implements nsIDocument_MOZILLA_1_8_0_BRANCH.

Definition at line 2174 of file nsDocument.cpp.

Here is the call graph for this function:

Implements nsIDocument.

Definition at line 4478 of file nsDocument.cpp.

{
  if (!mScriptEventManager) {
    mScriptEventManager = new nsScriptEventManager(this);
    // automatically AddRefs
  }

  return mScriptEventManager;
}
nsIScriptGlobalObject * nsDocument::GetScriptGlobalObject ( ) const [virtual, inherited]

Set the object from which a document can get a script context.

This is the context within which all scripts (during document creation and during event handling) will run.

Implements nsIDocument.

Definition at line 2155 of file nsDocument.cpp.

{
   // If we're going away, we've already released the reference to our
   // ScriptGlobalObject.  We can, however, try to obtain it for the
   // caller through our docshell.

   if (mIsGoingAway) {
     nsCOMPtr<nsIInterfaceRequestor> requestor =
       do_QueryReferent(mDocumentContainer);
     if (requestor) {
       nsCOMPtr<nsIScriptGlobalObject> globalObject = do_GetInterface(requestor);
       return globalObject;
     }
   }

   return mScriptGlobalObject;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIScriptGlobalObject * nsDocument::GetScriptHandlingObject ( PRBool aHasHadScriptHandlingObject) const [virtual, inherited]

Get/set the object from which the context for the event/script handling can be got.

Normally GetScriptHandlingObject() returns the same object as GetScriptGlobalObject(), but if the document is loaded as data, non-null may be returned, even if GetScriptGlobalObject() returns null. aHasHadScriptHandlingObject is set PR_TRUE if document has had the object for event/script handling. Do not process any events/script if the method returns null, but aHasHadScriptHandlingObject is true.

Implements nsIDocument_MOZILLA_1_8_BRANCH3.

Definition at line 2210 of file nsDocument.cpp.

{
  aHasHadScriptHandlingObject = mHasHadScriptHandlingObject;
  if (mScriptGlobalObject) {
    return mScriptGlobalObject;
  }

  nsCOMPtr<nsIScriptGlobalObject> scriptHandlingObject =
    do_QueryReferent(mScriptObject);
  nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(scriptHandlingObject);
  if (win) {
    NS_ASSERTION(win->IsInnerWindow(), "Should have inner window here!");
    nsPIDOMWindow* outer = win->GetOuterWindow();
    if (!outer || outer->GetCurrentInnerWindow() != win) {
      NS_WARNING("Wrong inner/outer window combination!");
      return nsnull;
    }
  }
  return scriptHandlingObject;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIScriptLoader * nsDocument::GetScriptLoader ( ) [virtual, inherited]

Get the script loader for this document.

Implements nsIDocument.

Definition at line 2256 of file nsDocument.cpp.

{
  return mScriptLoader;
}

Here is the caller graph for this function:

nsISupports* nsIDocument::GetSecurityInfo ( ) [inline, inherited]

Get the security info (i.e.

SSL state etc) that the document got from the channel/document that created the content of the document.

See also:
nsIChannel

Definition at line 649 of file nsIDocument.h.

  {
    return mSecurityInfo;
  }
nsIPresShell * nsDocument::GetShellAt ( PRUint32  aIndex) const [virtual, inherited]

Implements nsIDocument.

Definition at line 1708 of file nsDocument.cpp.

{
  return (nsIPresShell*)mPresShells.SafeElementAt(aIndex);
}

Here is the caller graph for this function:

nsIStyleSheet * nsDocument::GetStyleSheetAt ( PRInt32  aIndex) const [virtual, inherited]

Get a particular stylesheet.

Parameters:
aIndexthe index the stylesheet lives at. This is zero-based
Returns:
the stylesheet at aIndex. Null if aIndex is out of range.
Exceptions:
noexceptions

Implements nsIDocument.

Definition at line 1931 of file nsDocument.cpp.

{
  NS_ENSURE_TRUE(0 <= aIndex && aIndex < mStyleSheets.Count(), nsnull);
  return mStyleSheets[aIndex];
}
nsIDocument * nsDocument::GetSubDocumentFor ( nsIContent aContent) const [virtual, inherited]

Get the sub document for aContent.

Implements nsIDocument.

Definition at line 1808 of file nsDocument.cpp.

Here is the call graph for this function:

NS_IMETHODIMP nsDocument::GetSystemEventGroup ( nsIDOMEventGroup **  aGroup) [virtual, inherited]

Implements nsIDOMEventReceiver.

Definition at line 4169 of file nsDocument.cpp.

{
  nsCOMPtr<nsIEventListenerManager> manager;
  if (NS_SUCCEEDED(GetListenerManager(getter_AddRefs(manager))) && manager) {
    return manager->GetSystemEventGroupLM(aGroup);
  }

  return NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Retrieve the XUL template builder that's attached to a content node.

Implements nsIXULDocument.

Definition at line 2083 of file nsXULDocument.cpp.

{
    if (mTemplateBuilderTable) {
        nsISupportsKey key(aContent);
        *aResult = NS_STATIC_CAST(nsIXULTemplateBuilder*,
                                  mTemplateBuilderTable->Get(&key));
    }
    else
        *aResult = nsnull;

    return NS_OK;
}
nsIVariant nsIDOM3Node::getUserData ( in DOMString  key) [inherited]
nsPIDOMWindow * nsDocument::GetWindow ( ) [virtual, inherited]

Return the window containing the document (the outer window).

Implements nsIDocument.

Definition at line 2244 of file nsDocument.cpp.

{
  nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(GetScriptGlobalObject()));

  if (!win) {
    return nsnull;
  }

  return win->GetOuterWindow();
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIWordBreaker * nsDocument::GetWordBreaker ( ) [virtual, inherited]

Implements nsIDocument.

Definition at line 1503 of file nsDocument.cpp.

{
  if (!mWordBreaker) {
    // no word breaker, find a default one
    nsresult rv;
    nsCOMPtr<nsIWordBreakerFactory> wbf =
      do_GetService(NS_LWBRK_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, nsnull);

    wbf->GetBreaker(EmptyString(), getter_AddRefs(mWordBreaker));
    NS_ENSURE_TRUE(wbf, nsnull);
  }

  return mWordBreaker;
}

Here is the call graph for this function:

void nsDocument::GetXMLDeclaration ( nsAString &  aVersion,
nsAString &  aEncoding,
nsAString &  Standalone 
) [virtual, inherited]

Implements nsIDocument.

Definition at line 4514 of file nsDocument.cpp.

{
  aVersion.Truncate();
  aEncoding.Truncate();
  aStandalone.Truncate();

  if (!(mXMLDeclarationBits & XML_DECLARATION_BITS_DECLARATION_EXISTS)) {
    return;
  }

  // always until we start supporting 1.1 etc.
  aVersion.AssignLiteral("1.0");

  if (mXMLDeclarationBits & XML_DECLARATION_BITS_ENCODING_EXISTS) {
    // This is what we have stored, not necessarily what was written
    // in the original
    GetCharacterSet(aEncoding);
  }

  if (mXMLDeclarationBits & XML_DECLARATION_BITS_STANDALONE_EXISTS) {
    if (mXMLDeclarationBits & XML_DECLARATION_BITS_STANDALONE_YES) {
      aStandalone.AssignLiteral("yes");
    } else {
      aStandalone.AssignLiteral("no");
    }
  }
}
nsresult nsXULDocument::HandleDOMEvent ( nsPresContext aPresContext,
nsEvent aEvent,
nsIDOMEvent **  aDOMEvent,
PRUint32  aFlags,
nsEventStatus aEventStatus 
) [virtual]

Reimplemented from nsDocument.

Definition at line 1203 of file nsXULDocument.cpp.

{
    // Make sure to tell the event that dispatch has started.
    NS_MARK_EVENT_DISPATCH_STARTED(aEvent);

    nsresult ret = NS_OK;
    nsIDOMEvent* domEvent = nsnull;
    PRBool externalDOMEvent = PR_FALSE;

    if (NS_EVENT_FLAG_INIT & aFlags) {
        if (aDOMEvent) {
            if (*aDOMEvent) {
                externalDOMEvent = PR_TRUE;
            }
        }
        else {
            aDOMEvent = &domEvent;
        }
        aEvent->flags |= aFlags;
        aFlags &= ~(NS_EVENT_FLAG_CANT_BUBBLE | NS_EVENT_FLAG_CANT_CANCEL);
        aFlags |= NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_CAPTURE;
    }

    // Capturing stage
    if (NS_EVENT_FLAG_CAPTURE & aFlags && mScriptGlobalObject) {
        mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
                                            aFlags & NS_EVENT_CAPTURE_MASK,
                                            aEventStatus);
    }

    // Local handling stage
    if (mListenerManager) {
        aEvent->flags |= aFlags;
        mListenerManager->HandleEvent(aPresContext, aEvent, aDOMEvent,
                                      this, aFlags, aEventStatus);
        aEvent->flags &= ~aFlags;
    }

    // Bubbling stage
    if (NS_EVENT_FLAG_BUBBLE & aFlags && mScriptGlobalObject) {
        mScriptGlobalObject->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
                                            aFlags & NS_EVENT_BUBBLE_MASK,
                                            aEventStatus);
    }

    if (NS_EVENT_FLAG_INIT & aFlags) {
        // We're leaving the DOM event loop so if we created a DOM
        // event, release here.
        if (*aDOMEvent && !externalDOMEvent) {
            nsrefcnt rc;
            NS_RELEASE2(*aDOMEvent, rc);
            if (0 != rc) {
                // Okay, so someone in the DOM loop (a listener, JS
                // object) still has a ref to the DOM Event but the
                // internal data hasn't been malloc'd.  Force a copy
                // of the data here so the DOM Event is still valid.
                nsCOMPtr<nsIPrivateDOMEvent> privateEvent =
                    do_QueryInterface(*aDOMEvent);

                if (privateEvent) {
                    privateEvent->DuplicatePrivateData();
                }
            }
        }
        aDOMEvent = nsnull;

        // Now that we're done with this event, remove the flag that says
        // we're in the process of dispatching this event.
        NS_MARK_EVENT_DISPATCH_DONE(aEvent);
    }

    return ret;
}

Here is the call graph for this function:

nsresult nsDocument::HandleEvent ( nsIDOMEvent aEvent) [virtual, inherited]

Implements nsIDOMEventReceiver.

Reimplemented in nsImageDocument.

Definition at line 4162 of file nsDocument.cpp.

{
  PRBool defaultActionEnabled;
  return DispatchEvent(aEvent, &defaultActionEnabled);
}
nsresult nsXULDocument::HookupObserver ( nsIContent aElement) [protected]

Do hookup for <xul:observes> tag.

nsIDOMNode nsIDOMDocument::importNode ( in nsIDOMNode  importedNode,
in boolean  deep 
) raises (DOMException) [inherited]
PRInt32 nsDocument::IndexOf ( nsIContent aPossibleChild) const [virtual, inherited]

Implements nsIDocument.

Definition at line 1896 of file nsDocument.cpp.

{
  return mChildren.IndexOfChild(aPossibleChild);
}
nsresult nsXULDocument::Init ( void  ) [protected, virtual]

Reimplemented from nsXMLDocument.

Definition at line 2182 of file nsXULDocument.cpp.

{
    nsresult rv = nsXMLDocument::Init();
    NS_ENSURE_SUCCESS(rv, rv);

    // Create our command dispatcher and hook it up.
    rv = nsXULCommandDispatcher::Create(this,
                                        getter_AddRefs(mCommandDispatcher));
    NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create a focus tracker");
    if (NS_FAILED(rv)) return rv;

    // this _could_ fail; e.g., if we've tried to grab the local store
    // before profiles have initialized. If so, no big deal; nothing
    // will persist.
    mLocalStore = do_GetService(kLocalStoreCID);

    // Create a new nsISupportsArray for dealing with overlay references
    rv = NS_NewISupportsArray(getter_AddRefs(mUnloadedOverlays));
    if (NS_FAILED(rv)) return rv;

    if (gRefCnt++ == 0) {
        // Keep the RDF service cached in a member variable to make using
        // it a bit less painful
        rv = CallGetService(kRDFServiceCID, &gRDFService);
        NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF Service");
        if (NS_FAILED(rv)) return rv;

        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "persist"),
                                 &kNC_persist);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "attribute"),
                                 &kNC_attribute);
        gRDFService->GetResource(NS_LITERAL_CSTRING(NC_NAMESPACE_URI "value"),
                                 &kNC_value);

        rv = CallGetService(kXULPrototypeCacheCID, &gXULCache);
        if (NS_FAILED(rv)) return rv;
    }

#ifdef PR_LOGGING
    if (! gXULLog)
        gXULLog = PR_NewLogModule("nsXULDocument");
#endif

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIDOMNode nsIDOMNode::insertBefore ( in nsIDOMNode  newChild,
in nsIDOMNode  refChild 
) raises (DOMException) [inherited]
nsresult nsXULDocument::InsertElement ( nsIContent aParent,
nsIContent aChild,
PRBool  aNotify 
) [static, protected]

Definition at line 4470 of file nsXULDocument.cpp.

{
    // Insert aChild appropriately into aParent, accounting for a
    // 'pos' attribute set on aChild.
    nsresult rv;

    nsAutoString posStr;
    PRBool wasInserted = PR_FALSE;

    // insert after an element of a given id
    rv = aChild->GetAttr(kNameSpaceID_None, nsXULAtoms::insertafter, posStr);
    if (NS_FAILED(rv)) return rv;
    PRBool isInsertAfter = PR_TRUE;

    if (rv != NS_CONTENT_ATTR_HAS_VALUE) {
        rv = aChild->GetAttr(kNameSpaceID_None, nsXULAtoms::insertbefore,
                             posStr);
        if (NS_FAILED(rv)) return rv;
        isInsertAfter = PR_FALSE;
    }

    if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
        nsCOMPtr<nsIDOMDocument> domDocument(
               do_QueryInterface(aParent->GetDocument()));
        nsCOMPtr<nsIDOMElement> domElement;

        char* str = ToNewCString(posStr);
        char* rest;
        char* token = nsCRT::strtok(str, ", ", &rest);

        while (token) {
            rv = domDocument->GetElementById(NS_ConvertASCIItoUCS2(token),
                                             getter_AddRefs(domElement));
            if (domElement)
                break;

            token = nsCRT::strtok(rest, ", ", &rest);
        }
        nsMemory::Free(str);
        if (NS_FAILED(rv))
            return rv;

        if (domElement) {
            nsCOMPtr<nsIContent> content(do_QueryInterface(domElement));
            NS_ASSERTION(content != nsnull, "null ptr");
            if (!content)
                return NS_ERROR_UNEXPECTED;

            PRInt32 pos = aParent->IndexOf(content);

            if (pos != -1) {
                pos = isInsertAfter ? pos + 1 : pos;
                rv = aParent->InsertChildAt(aChild, pos, aNotify);
                if (NS_FAILED(rv))
                    return rv;

                wasInserted = PR_TRUE;
            }
        }
    }

    if (!wasInserted) {

        rv = aChild->GetAttr(kNameSpaceID_None, nsXULAtoms::position, posStr);
        if (NS_FAILED(rv)) return rv;

        if (rv == NS_CONTENT_ATTR_HAS_VALUE) {
            // Positions are one-indexed.
            PRInt32 pos = posStr.ToInteger(NS_REINTERPRET_CAST(PRInt32*, &rv));
            // Note: if the insertion index (which is |pos - 1|) would be less
            // than 0 or greater than the number of children aParent has, then
            // don't insert, since the position is bogus.  Just skip on to
            // appending.
            if (NS_SUCCEEDED(rv) && pos > 0 &&
                PRUint32(pos - 1) <= aParent->GetChildCount()) {
                rv = aParent->InsertChildAt(aChild, pos - 1, aNotify);
                if (NS_SUCCEEDED(rv))
                    wasInserted = PR_TRUE;
                // If the insertion fails, then we should still
                // attempt an append.  Thus, rather than returning rv
                // immediately, we fall through to the final
                // "catch-all" case that just does an AppendChildTo.
            }
        }
    }

    if (! wasInserted) {
        rv = aParent->AppendChildTo(aChild, aNotify);
        if (NS_FAILED(rv)) return rv;
    }
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsDocument::InsertStyleSheetAt ( nsIStyleSheet aSheet,
PRInt32  aIndex 
) [virtual, inherited]

Insert a sheet at a particular spot in the stylesheet list (zero-based)

Parameters:
aSheetthe sheet to insert
aIndexthe index to insert at. This index will be adjusted for the "special" sheets.
Exceptions:
noexceptions

Implements nsIDocument.

Definition at line 2043 of file nsDocument.cpp.

{
  NS_PRECONDITION(aSheet, "null ptr");
  mStyleSheets.InsertObjectAt(aSheet, aIndex);

  aSheet->SetOwningDocument(this);

  PRBool applicable;
  aSheet->GetApplicable(applicable);

  if (applicable) {
    AddStyleSheetToStyleSets(aSheet);
  }

  NS_DOCUMENT_NOTIFY_OBSERVERS(StyleSheetAdded, (this, aSheet, PR_TRUE));
}

Here is the call graph for this function:

virtual PRBool nsIDocument::IsCaseSensitive ( ) [inline, virtual, inherited]

Reimplemented in nsHTMLDocument.

Definition at line 617 of file nsIDocument.h.

  {
    return PR_TRUE;
  }

Here is the caller graph for this function:

boolean nsIDOM3Node::isDefaultNamespace ( in DOMString  namespaceURI) [inherited]

Ask this document whether it's the initial document in its window.

Definition at line 891 of file nsIDocument.h.

PRBool nsXMLDocument::IsLoadedAsData ( ) [virtual, inherited]

Reimplemented from nsIDocument.

Definition at line 653 of file nsXMLDocument.cpp.

{
  return mLoadedAsData;
}
boolean nsIDOM3EventTarget::isRegisteredHere ( in DOMString  type) [inherited]
PRBool nsDocument::IsSafeToFlush ( ) const [protected, inherited]

Definition at line 4900 of file nsDocument.cpp.

{
  PRBool isSafeToFlush = PR_TRUE;
  PRInt32 i = 0, n = mPresShells.Count();
  while (i < n && isSafeToFlush) {
    nsCOMPtr<nsIPresShell> shell =
      NS_STATIC_CAST(nsIPresShell*, mPresShells[i]);

    if (shell) {
      shell->IsSafeToFlush(isSafeToFlush);
    }
    ++i;
  }
  return isSafeToFlush;
}

Here is the caller graph for this function:

boolean nsIDOM3Node::isSameNode ( in nsIDOMNode  other) [inherited]
PRBool nsDocument::IsScriptEnabled ( ) [virtual, inherited]

Implements nsIDocument.

Definition at line 4544 of file nsDocument.cpp.

{
  nsCOMPtr<nsIScriptSecurityManager> sm(do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID));
  NS_ENSURE_TRUE(sm, PR_TRUE);

  nsIPrincipal* principal = GetPrincipal();
  NS_ENSURE_TRUE(principal, PR_TRUE);

  nsIScriptGlobalObject* globalObject = GetScriptGlobalObject();
  NS_ENSURE_TRUE(globalObject, PR_TRUE);

  nsIScriptContext *scriptContext = globalObject->GetContext();
  NS_ENSURE_TRUE(scriptContext, PR_TRUE);

  JSContext* cx = (JSContext *) scriptContext->GetNativeContext();
  NS_ENSURE_TRUE(cx, PR_TRUE);

  PRBool enabled;
  nsresult rv = sm->CanExecuteScripts(cx, principal, &enabled);
  NS_ENSURE_SUCCESS(rv, PR_TRUE);
  return enabled;
}

Here is the call graph for this function:

boolean nsIDOMNode::isSupported ( in DOMString  feature,
in DOMString  version 
) [inherited]
boolean nsIDOMXMLDocument::load ( in DOMString  url) [inherited]

Load an XML document.

Parameters:
urlURL to an XML document.
Returns:
True if load successfull.
nsIDOMDocument nsIDOMDocumentXBL::loadBindingDocument ( in DOMString  documentURL) [inherited]
void nsIDOMXULDocument::loadOverlay ( in DOMString  url,
in nsIObserver  aObserver 
) [inherited]

Loads a XUL overlay and merges it with the current document, notifying an observer when the merge is complete.

Parameters:
urlThe URL of the overlay to load and merge
observerAn object implementing nsIObserver that will be notified with a message of topic "xul-overlay-merged" when the merge is complete. The subject parameter of |observe| will QI to a nsIURI - the URI of the merged overlay. This parameter is optional and may be null.

NOTICE: In the 2.0 timeframe this API will change such that the implementation will fire a DOMXULOverlayMerged event upon merge completion rather than notifying an observer. Do not rely on this API's behavior not to change because it will!

  • Ben Goodger (8/23/2005)
nsresult nsXULDocument::LoadOverlayInternal ( nsIURI aURI,
PRBool  aIsDynamic,
PRBool aShouldReturn 
) [protected]

Definition at line 2864 of file nsXULDocument.cpp.

{
    nsresult rv;

    *aShouldReturn = PR_FALSE;

    nsCOMPtr<nsIScriptSecurityManager> secMan = do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
    NS_ENSURE_SUCCESS(rv, rv);

#ifdef PR_LOGGING
    if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) {
        nsCAutoString urlspec;
        aURI->GetSpec(urlspec);

        PR_LOG(gXULLog, PR_LOG_DEBUG,
                ("xul: loading overlay %s", urlspec.get()));
    }
#endif

    mResolutionPhase = nsForwardReference::eStart;

    // Chrome documents are allowed to load overlays from anywhere.
    // In all other cases, the overlay is only allowed to load if
    // the master document and prototype document have the same origin.

    if (!IsChromeURI(mDocumentURI)) {
        // Make sure we're allowed to load this overlay.
        rv = secMan->CheckSameOriginURI(mDocumentURI, aURI);
        if (NS_FAILED(rv)) return rv;
    }

    // Look in the prototype cache for the prototype document with
    // the specified overlay URI.
    PRBool overlayIsChrome = IsChromeURI(aURI);
    if (overlayIsChrome)
        gXULCache->GetPrototype(aURI, getter_AddRefs(mCurrentPrototype));
    else
        mCurrentPrototype = nsnull;

    // Same comment as nsChromeProtocolHandler::NewChannel and
    // nsXULDocument::StartDocumentLoad
    // - Ben Goodger
    //
    // We don't abort on failure here because there are too many valid
    // cases that can return failure, and the null-ness of |proto| is
    // enough to trigger the fail-safe parse-from-disk solution.
    // Example failure cases (for reference) include:
    //
    // NS_ERROR_NOT_AVAILABLE: the URI was not found in the FastLoad file,
    //                         parse from disk
    // other: the FastLoad file, XUL.mfl, could not be found, probably
    //        due to being accessed before a profile has been selected
    //        (e.g. loading chrome for the profile manager itself).
    //        The .xul file must be parsed from disk.

    PRBool useXULCache;
    gXULCache->GetEnabled(&useXULCache);
    mIsWritingFastLoad = useXULCache;

    if (useXULCache && mCurrentPrototype) {
        PRBool loaded;
        rv = mCurrentPrototype->AwaitLoadDone(this, &loaded);
        if (NS_FAILED(rv)) return rv;

        if (! loaded) {
            // Return to the main event loop and eagerly await the
            // prototype overlay load's completion. When the content
            // sink completes, it will trigger an EndLoad(), which'll
            // wind us back up here, in ResumeWalk().
            *aShouldReturn = PR_TRUE;
            return NS_OK;
        }

        // Found the overlay's prototype in the cache, fully loaded.
        rv = AddPrototypeSheets();
        if (NS_FAILED(rv)) return rv;

        // Now prepare to walk the prototype to create its content
        rv = PrepareToWalk();
        if (NS_FAILED(rv)) return rv;

        PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul: overlay was cached"));

        // If this is a dynamic overlay and we have the prototype in the chrome 
        // cache already, we must manually call ResumeWalk.
        if (aIsDynamic)
            return ResumeWalk();
    }
    else {
        // Not there. Initiate a load.
        PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul: overlay was not cached"));

        nsCOMPtr<nsIParser> parser;
        rv = PrepareToLoadPrototype(aURI, "view", nsnull, getter_AddRefs(parser));
        if (NS_FAILED(rv)) return rv;

        // Predicate mIsWritingFastLoad on the XUL cache being enabled,
        // so we don't have to re-check whether the cache is enabled all
        // the time.
        mIsWritingFastLoad = useXULCache;

        nsCOMPtr<nsIStreamListener> listener = do_QueryInterface(parser);
        if (! listener)
            return NS_ERROR_UNEXPECTED;

        // Add an observer to the parser; this'll get called when
        // Necko fires its On[Start|Stop]Request() notifications,
        // and will let us recover from a missing overlay.
        ParserObserver* parserObserver = new ParserObserver(this);
        if (! parserObserver)
            return NS_ERROR_OUT_OF_MEMORY;

        NS_ADDREF(parserObserver);
        parser->Parse(aURI, parserObserver);
        NS_RELEASE(parserObserver);

        nsCOMPtr<nsILoadGroup> group = do_QueryReferent(mDocumentLoadGroup);
        rv = NS_OpenURI(listener, nsnull, aURI, nsnull, group);
        if (NS_FAILED(rv)) {
            // Just move on to the next overlay.  NS_OpenURI could fail
            // just because a channel could not be opened, which can happen
            // if a file or chrome package does not exist.
            ReportMissingOverlay(aURI);
            return rv;
        }

        // If it's a 'chrome:' prototype document, then put it into
        // the prototype cache; other XUL documents will be reloaded
        // each time.  We must do this after NS_OpenURI and AsyncOpen,
        // or chrome code will wrongly create a cached chrome channel
        // instead of a real one.
        if (useXULCache && overlayIsChrome) {
            rv = gXULCache->PutPrototype(mCurrentPrototype);
            if (NS_FAILED(rv)) return rv;
        }

        // Return to the main event loop and eagerly await the
        // overlay load's completion. When the content sink
        // completes, it will trigger an EndLoad(), which'll wind
        // us back in ResumeWalk().
        if (!aIsDynamic)
            *aShouldReturn = PR_TRUE;
    }
    return NS_OK;
}

Here is the call graph for this function:

nsresult nsXULDocument::LoadScript ( nsXULPrototypeScript aScriptProto,
PRBool aBlock 
) [protected]

Load the transcluded script at the specified URI.

If the prototype construction must 'block' until the load has completed, aBlock will be set to true.

Definition at line 3462 of file nsXULDocument.cpp.

{
    // Load a transcluded script
    nsresult rv;

    PRBool isChromeDoc = IsChromeURI(mDocumentURI);

    if (isChromeDoc && aScriptProto->mJSObject) {
        rv = ExecuteScript(aScriptProto->mJSObject);

        // Ignore return value from execution, and don't block
        *aBlock = PR_FALSE;
        return NS_OK;
    }

    // Try the XUL script cache, in case two XUL documents source the same
    // .js file (e.g., strres.js from navigator.xul and utilityOverlay.xul).
    // XXXbe the cache relies on aScriptProto's GC root!
    PRBool useXULCache;
    gXULCache->GetEnabled(&useXULCache);

    if (isChromeDoc && useXULCache) {
        gXULCache->GetScript(aScriptProto->mSrcURI,
                             NS_REINTERPRET_CAST(void**, &aScriptProto->mJSObject));

        if (aScriptProto->mJSObject) {
            rv = ExecuteScript(aScriptProto->mJSObject);

            // Ignore return value from execution, and don't block
            *aBlock = PR_FALSE;
            return NS_OK;
        }
    }

    // Set the current script prototype so that OnStreamComplete can report
    // the right file if there are errors in the script.
    NS_ASSERTION(!