Back to index

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

#include <nsDOMDocumentType.h>

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

List of all members.

Public Types

enum  {
  eTEXT = 0x00000001, eELEMENT = 0x00000002, eHTML = 0x00000004, eHTML_FORM_CONTROL = 0x00000008,
  eXUL = 0x00000010, ePROCESSING_INSTRUCTION = 0x00000020, eSVG = 0x00000040, eCOMMENT = 0x00000080
}
 Bit-flags to pass (or'ed together) to IsContentOfType() More...
enum  ETabFocusType { eTabFocus_formElementsMask = (1<<1), eTabFocus_linksMask = (1<<2), eTabFocus_any = 1 + (1<<1) + (1<<2) }

Public Member Functions

 nsDOMDocumentType (nsNodeInfoManager *aNodeInfoManager, nsIAtom *aName, nsIDOMNamedNodeMap *aEntities, nsIDOMNamedNodeMap *aNotations, const nsAString &aPublicId, const nsAString &aSystemId, const nsAString &aInternalSubset)
virtual ~nsDOMDocumentType ()
NS_DECL_ISUPPORTS_INHERITED
NS_IMPL_NSIDOMNODE_USING_GENERIC_DOM_DATA
virtual
NS_DECL_NSIDOMDOCUMENTTYPE
nsIAtom
Tag () const
 Get the tag for this element.
nsresult GetNodeValue (nsAString &aNodeValue)
nsresult SetNodeValue (const nsAString &aNodeValue)
nsresult GetParentNode (nsIDOMNode **aParentNode)
nsresult GetAttributes (nsIDOMNamedNodeMap **aAttributes)
nsresult GetPreviousSibling (nsIDOMNode **aPreviousSibling)
nsresult GetNextSibling (nsIDOMNode **aNextSibling)
nsresult GetChildNodes (nsIDOMNodeList **aChildNodes)
nsresult HasChildNodes (PRBool *aHasChildNodes)
nsresult HasAttributes (PRBool *aHasAttributes)
nsresult GetFirstChild (nsIDOMNode **aFirstChild)
nsresult GetLastChild (nsIDOMNode **aLastChild)
nsresult InsertBefore (nsIDOMNode *aNewChild, nsIDOMNode *aRefChild, nsIDOMNode **aReturn)
nsresult ReplaceChild (nsIDOMNode *aNewChild, nsIDOMNode *aOldChild, nsIDOMNode **aReturn)
nsresult RemoveChild (nsIDOMNode *aOldChild, nsIDOMNode **aReturn)
nsresult AppendChild (nsIDOMNode *aNewChild, nsIDOMNode **aReturn)
nsresult GetOwnerDocument (nsIDOMDocument **aOwnerDocument)
nsresult GetNamespaceURI (nsAString &aNamespaceURI)
nsresult GetLocalName (nsAString &aLocalName)
nsresult GetPrefix (nsAString &aPrefix)
nsresult SetPrefix (const nsAString &aPrefix)
nsresult Normalize ()
nsresult IsSupported (const nsAString &aFeature, const nsAString &aVersion, PRBool *aReturn)
nsresult GetBaseURI (nsAString &aURI)
virtual already_AddRefed< nsIURIGetBaseURI () const
 Get the base URI for any relative URIs within this piece of content.
nsresult LookupPrefix (const nsAString &aNamespaceURI, nsAString &aPrefix)
nsresult LookupNamespaceURI (const nsAString &aNamespacePrefix, nsAString &aNamespaceURI)
nsresult GetData (nsAString &aData)
nsresult SetData (const nsAString &aData)
nsresult GetLength (PRUint32 *aLength)
nsresult SubstringData (PRUint32 aOffset, PRUint32 aCount, nsAString &aReturn)
nsresult AppendData (const nsAString &aArg)
nsresult InsertData (PRUint32 aOffset, const nsAString &aArg)
nsresult DeleteData (PRUint32 aOffset, PRUint32 aCount)
nsresult ReplaceData (PRUint32 aOffset, PRUint32 aCount, const nsAString &aArg)
virtual nsIDOMGCParticipantGetSCCIndex ()
 See comment for nsGenericElement::GetSCCIndex.
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|.
nsIDocumentGetDocument () const
 DEPRECATED - Use GetCurrentDoc or GetOwnerDoc.
virtual nsresult BindToTree (nsIDocument *aDocument, nsIContent *aParent, nsIContent *aBindingParent, PRBool aCompileEventHandlers)
 Bind this content node to a tree.
virtual void UnbindFromTree (PRBool aDeep=PR_TRUE, PRBool aNullParent=PR_TRUE)
 Unbind this content node from a tree.
PRBool IsInDoc () const
 Returns true if the content has an ancestor that is a document.
nsIDocumentGetCurrentDoc () const
 Get the document that this content is currently in, if any.
nsIDocumentGetOwnerDoc () const
 Get the ownerDocument for this content.
virtual PRBool IsNativeAnonymous () const
 Get whether this content is C++-generated anonymous content.
virtual void SetNativeAnonymous (PRBool aAnonymous)
 Set whether this content is anonymous.
virtual PRInt32 GetNameSpaceID () const
 Get the namespace that this element's tag is defined in.
virtual nsIAtomGetIDAttributeName () const
 Returns an atom holding the name of the attribute of type ID on this content node (if applicable).
virtual already_AddRefed
< nsINodeInfo
GetExistingAttrNameFromQName (const nsAString &aStr) const
 Normalizes an attribute name and returns it as a nodeinfo if an attribute with that name exists.
nsresult SetAttr (PRInt32 aNameSpaceID, nsIAtom *aName, const nsAString &aValue, PRBool aNotify)
 Set attribute values.
virtual nsresult SetAttr (PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsIAtom *aPrefix, const nsAString &aValue, PRBool aNotify)
 Set attribute values.
virtual nsresult UnsetAttr (PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRBool aNotify)
 Remove an attribute so that it is no longer explicitly specified.
virtual nsresult GetAttr (PRInt32 aNameSpaceID, nsIAtom *aAttribute, nsAString &aResult) const
 Get the current value of the attribute.
virtual PRBool HasAttr (PRInt32 aNameSpaceID, nsIAtom *aAttribute) const
 Determine if an attribute has been set (empty string or otherwise).
virtual nsresult GetAttrNameAt (PRUint32 aIndex, PRInt32 *aNameSpaceID, nsIAtom **aName, nsIAtom **aPrefix) const
 Get the namespace / name / prefix of a given attribute.
virtual PRUint32 GetAttrCount () const
 Get the number of all specified attributes.
virtual nsresult HandleDOMEvent (nsPresContext *aPresContext, nsEvent *aEvent, nsIDOMEvent **aDOMEvent, PRUint32 aFlags, nsEventStatus *aEventStatus)
 Handle a DOM event for this piece of content.
virtual PRUint32 ContentID () const
 Get a unique ID for this piece of content.
virtual nsresult RangeAdd (nsIDOMRange *aRange)
 Inform content of range ownership changes.
virtual void RangeRemove (nsIDOMRange *aRange)
 Inform content that it no longer owns either range endpoint.
virtual const nsVoidArrayGetRangeList () const
 Get the list of ranges that have either endpoint in this content item.
virtual nsIContentGetBindingParent () const
 Gets content node with the binding responsible for our construction (and existence).
virtual PRBool IsContentOfType (PRUint32 aFlags) const
 API for doing a quick check if a content object is of a given type, such as HTML, XUL, Text, ...
virtual nsresult GetListenerManager (nsIEventListenerManager **aResult)
 Get the event listener manager, the guy you talk to to register for events on this element.
virtual nsINodeInfoGetNodeInfo () const
 Get the NodeInfo for this element.
virtual PRUint32 GetChildCount () const
 Get the number of children.
virtual nsIContentGetChildAt (PRUint32 aIndex) const
 Get a child by index.
virtual PRInt32 IndexOf (nsIContent *aPossibleChild) const
 Get the index of a child within this content.
virtual nsresult InsertChildAt (nsIContent *aKid, PRUint32 aIndex, PRBool aNotify)
 Insert a content node at a particular index.
virtual nsresult AppendChildTo (nsIContent *aKid, PRBool aNotify)
 Append a content node to the end of the child list.
virtual nsresult RemoveChildAt (PRUint32 aIndex, PRBool aNotify)
 Remove a child from this content node.
virtual PRBool MayHaveFrame () const
 Returns PR_TRUE if there is a chance that the content node has a frame, PR_FALSE otherwise.
virtual const nsTextFragmentText ()
 Get direct access (but read only) to the text in the text content.
virtual PRUint32 TextLength ()
 Get the length of the text content.
virtual void SetText (const PRUnichar *aBuffer, PRUint32 aLength, PRBool aNotify)
 Set the text to the given value.
virtual void SetText (const nsAString &aStr, PRBool aNotify)
 Set the text to the given value.
virtual void SetText (const char *aBuffer, PRUint32 aLength, PRBool aNotify)
 Set the text to the given value.
virtual PRBool IsOnlyWhitespace ()
 Query method to see if the frame is nothing but whitespace.
virtual void AppendTextTo (nsAString &aResult)
 Append the text content to aResult.
virtual already_AddRefed
< nsITextContent
CloneContent (PRBool aCloneText, nsNodeInfoManager *aNodeInfoManager)
nsIContentGetParent () const
 Get the parent content for this content.
virtual void SetContentID (PRUint32 aID)
 Set the unique content ID for this content.
virtual void SetFocus (nsPresContext *aPresContext)
 Set the focus on this content.
virtual void RemoveFocus (nsPresContext *aPresContext)
 Remove the focus on this content.
virtual PRBool IsFocusable (PRInt32 *aTabIndex=nsnull)
 Check if this content is focusable and in the current tab order.
virtual void DoneCreatingElement ()
 This method is called when the parser finishes creating the element.
virtual void SetMayHaveFrame (PRBool aMayHaveFrame)
 Call to let the content node know that it may now have a frame.
virtual void BeginAddingChildren ()
 This method is called when the parser begins creating the element's children, if any are present.
virtual void DoneAddingChildren ()
 This method is called when the parser finishes creating the element's children, if any are present.
virtual PRBool IsDoneAddingChildren ()
 For HTML textarea, select, applet, and object elements, returns PR_TRUE if all children have been added OR if the element was not created by the parser.
virtual PRInt32 IntrinsicState () const
 Method to get the intrinsic content state of this content node.
virtual voidGetProperty (nsIAtom *aPropertyName, nsresult *aStatus=nsnull) const
virtual nsresult SetProperty (nsIAtom *aPropertyName, void *aValue, NSPropertyDtorFunc aDtor=nsnull)
virtual nsresult DeleteProperty (nsIAtom *aPropertyName)
virtual voidUnsetProperty (nsIAtom *aPropertyName, nsresult *aStatus=nsnull)
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 ()

Public Attributes

readonly attribute DOMString name
readonly attribute
nsIDOMNamedNodeMap 
entities
readonly attribute
nsIDOMNamedNodeMap 
notations
readonly attribute DOMString publicId
readonly attribute DOMString systemId
readonly attribute DOMString internalSubset
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

Static Public Attributes

static PRInt32 sTabFocusModel = eTabFocus_any
static PRBool sTabFocusModelAppliesToXUL = PR_FALSE

Protected Types

typedef unsigned long PtrBits
enum  { kParentBitMask = 0x3 }

Protected Member Functions

nsresult SplitText (PRUint32 aOffset, nsIDOMText **aReturn)
void DoSetText (const PRUnichar *aBuffer, PRUint32 aLength, PRBool aIsAppend, PRBool aNotify)
void DoSetText (const char *aBuffer, PRUint32 aLength, PRBool aIsAppend, PRBool aNotify)
void DoSetText (const nsAString &aStr, PRBool aIsAppend, PRBool aNotify)
nsNodeInfoManagerGetNodeInfoManager () const
void SetNodeInfoManager (nsNodeInfoManager *aNodeInfoManager)

Protected Attributes

nsCOMPtr< nsIAtommName
nsCOMPtr< nsIDOMNamedNodeMapmEntities
nsCOMPtr< nsIDOMNamedNodeMapmNotations
nsString mPublicId
nsString mSystemId
nsString mInternalSubset
nsTextFragment mText
PtrBits mParentPtrBits

Detailed Description

Definition at line 52 of file nsDOMDocumentType.h.


Member Typedef Documentation

typedef unsigned long nsGenericDOMDataNode::PtrBits [protected, inherited]

Reimplemented from nsIContent.

Definition at line 285 of file nsGenericDOMDataNode.h.


Member Enumeration Documentation

anonymous enum [inherited]

Bit-flags to pass (or'ed together) to IsContentOfType()

Enumerator:
eTEXT 

text elements

eELEMENT 

dom elements

eHTML 

html elements

eHTML_FORM_CONTROL 

form controls

eXUL 

XUL elements.

ePROCESSING_INSTRUCTION 

xml processing instructions

eSVG 

svg elements

eCOMMENT 

comment nodes

Definition at line 524 of file nsIContent.h.

       {
    eTEXT                = 0x00000001,
    eELEMENT             = 0x00000002,
    eHTML                = 0x00000004,
    eHTML_FORM_CONTROL   = 0x00000008,
    eXUL                 = 0x00000010,
    ePROCESSING_INSTRUCTION = 0x00000020,
    eSVG                 = 0x00000040,
    eCOMMENT             = 0x00000080
  };
anonymous enum [protected, inherited]
Enumerator:
kParentBitMask 

Definition at line 729 of file nsIContent.h.

{ kParentBitMask = 0x3 };
enum nsIContent::ETabFocusType [inherited]
Enumerator:
eTabFocus_formElementsMask 
eTabFocus_linksMask 
eTabFocus_any 

Definition at line 711 of file nsIContent.h.

                     {
  //eTabFocus_textControlsMask = (1<<0),  // unused - textboxes always tabbable
    eTabFocus_formElementsMask = (1<<1),  // non-text form elements
    eTabFocus_linksMask = (1<<2),         // links
    eTabFocus_any = 1 + (1<<1) + (1<<2)   // everything that can be focused
  };

Constructor & Destructor Documentation

nsDOMDocumentType::nsDOMDocumentType ( nsNodeInfoManager aNodeInfoManager,
nsIAtom aName,
nsIDOMNamedNodeMap aEntities,
nsIDOMNamedNodeMap aNotations,
const nsAString &  aPublicId,
const nsAString &  aSystemId,
const nsAString &  aInternalSubset 
)

Definition at line 91 of file nsDOMDocumentType.cpp.

                                                                       :
  nsGenericDOMDataNode(aNodeInfoManager),
  mName(aName),
  mEntities(aEntities),
  mNotations(aNotations),
  mPublicId(aPublicId),
  mSystemId(aSystemId),
  mInternalSubset(aInternalSubset)
{
}

Definition at line 108 of file nsDOMDocumentType.cpp.

{
}

Member Function Documentation

nsIDOMNode nsIDOMNode::appendChild ( in nsIDOMNode  newChild) raises (DOMException) [inherited]
nsresult nsGenericDOMDataNode::AppendChild ( nsIDOMNode aNewChild,
nsIDOMNode **  aReturn 
) [inline, inherited]

Definition at line 136 of file nsGenericDOMDataNode.h.

nsresult nsGenericDOMDataNode::AppendChildTo ( nsIContent aKid,
PRBool  aNotify 
) [virtual, inherited]

Append a content node to the end of the child list.

Parameters:
aKidthe content to append
aNotifywhether to notify the document and appropriate mutation event listeners that the replace has occurred

Implements nsIContent.

Definition at line 961 of file nsGenericDOMDataNode.cpp.

{
  return NS_OK;
}
nsresult nsGenericDOMDataNode::AppendData ( const nsAString &  aArg) [inherited]

Definition at line 422 of file nsGenericDOMDataNode.cpp.

{
  PRInt32 length = 0;

  // See bugzilla bug 77585.
  if (mText.Is2b() || (!IsASCII(aData))) {
    nsAutoString old_data;
    mText.AppendTo(old_data);
    length = old_data.Length();
    // XXXjag We'd like to just say |old_data + aData|, but due
    // to issues with dependent concatenation and sliding (sub)strings
    // we'll just have to copy for now. See bug 121841 for details.
    old_data.Append(aData);
    DoSetText(old_data, PR_TRUE, PR_TRUE);
  } else {
    // We know aData and the current data is ASCII, so use a
    // nsC*String, no need for any fancy unicode stuff here.
    nsCAutoString old_data;
    mText.AppendTo(old_data);
    length = old_data.Length();
    LossyAppendUTF16toASCII(aData, old_data);
    DoSetText(old_data.get(), old_data.Length(), PR_TRUE, PR_TRUE);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

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 639 of file nsGenericDOMDataNode.cpp.

{
  NS_ASSERTION(GetCurrentDoc() == nsnull,
               "shouldn't be an SCC index if we're in a doc");

  // This node is the root of a subtree that's been removed from the
  // document (since AppendReachableList is only called on SCC index
  // nodes).  The document is reachable from it (through
  // .ownerDocument), but it's not reachable from the document.
  nsCOMPtr<nsIDOMGCParticipant> participant = do_QueryInterface(GetOwnerDoc());
  aArray.AppendObject(participant);
}

Here is the call graph for this function:

void nsGenericDOMDataNode::AppendTextTo ( nsAString &  aResult) [virtual, inherited]

Append the text content to aResult.

Implements nsITextContent.

Definition at line 1338 of file nsGenericDOMDataNode.cpp.

Here is the call graph for this function:

virtual void nsIContent::BeginAddingChildren ( ) [inline, virtual, inherited]

This method is called when the parser begins creating the element's children, if any are present.

This is only called for XTF elements currently.

Reimplemented in nsXTFElementWrapper.

Definition at line 626 of file nsIContent.h.

  {
  }
nsresult nsGenericDOMDataNode::BindToTree ( nsIDocument aDocument,
nsIContent aParent,
nsIContent aBindingParent,
PRBool  aCompileEventHandlers 
) [virtual, inherited]

Bind this content node to a tree.

If this method throws, the caller must call UnbindFromTree() on the node. In the typical case of a node being appended to a parent, this will be called after the node has been added to the parent's child list and before nsIDocumentObserver notifications for the addition are dispatched.

Parameters:
aDocumentThe new document for the content node. Must match the current document of aParent, if aParent is not null. May not be null if aParent is null.
aParentThe new parent for the content node. May be null if the node is being bound as a direct child of the document.
aBindingParentThe new binding parent for the content node. This is allowed to be null. In that case, the binding parent of aParent, if any, will be used.
aCompileEventHandlerswhether to initialize the event handlers in the document (used by nsXULElement)
Note:
either aDocument or aParent must be non-null. If both are null, this method will crash.
This method must not be called by consumers of nsIContent on a node that is already bound to a tree. Call UnbindFromTree first.
This method will handle rebinding descendants appropriately (eg changing their binding parent as needed).
This method does not add the content node to aParent's child list
Exceptions:
NS_ERROR_OUT_OF_MEMORYif that happens

Implements nsIContent.

Reimplemented in nsAttributeTextNode, and nsXMLStylesheetPI.

Definition at line 666 of file nsGenericDOMDataNode.cpp.

{
  NS_PRECONDITION(aParent || aDocument, "Must have document if no parent!");
  // XXXbz XUL elements are confused about their current doc when they're
  // cloned, so we don't assert if aParent is a XUL element and aDocument is
  // null, even if aParent->GetCurrentDoc() is non-null
  //  NS_PRECONDITION(!aParent || aDocument == aParent->GetCurrentDoc(),
  //                  "aDocument must be current doc of aParent");
  NS_PRECONDITION(!aParent ||
                  (aParent->IsContentOfType(eXUL) && aDocument == nsnull) ||
                  aDocument == aParent->GetCurrentDoc(),
                  "aDocument must be current doc of aParent");
  NS_PRECONDITION(!GetCurrentDoc(), "Already have a document.  Unbind first!");
  // Note that as we recurse into the kids, they'll have a non-null parent.  So
  // only assert if our parent is _changing_ while we have a parent.
  NS_PRECONDITION(!GetParent() || aParent == GetParent(),
                  "Already have a parent.  Unbind first!");
  // XXXbz GetBindingParent() is broken for us, so can't assert
  // anything about it yet.
  //  NS_PRECONDITION(!GetBindingParent() ||
  //                  aBindingParent == GetBindingParent() ||
  //                  (aParent &&
  //                   aParent->GetBindingParent() == GetBindingParent()),
  //                  "Already have a binding parent.  Unbind first!");

  // XXXbz we don't keep track of the binding parent yet.  We should.
  
  // Set parent
  PtrBits new_bits = NS_REINTERPRET_CAST(PtrBits, aParent);
  new_bits |= mParentPtrBits & nsIContent::kParentBitMask;
  mParentPtrBits = new_bits;

  nsIDocument *oldOwnerDocument = GetOwnerDoc();
  nsIDocument *newOwnerDocument;
  nsNodeInfoManager* nodeInfoManager;

  // XXXbz sXBL/XBL2 issue!
  // Set document
  if (aDocument) {
    mParentPtrBits |= PARENT_BIT_INDOCUMENT;
    if (mText.IsBidi()) {
      aDocument->SetBidiEnabled(PR_TRUE);
    }

    newOwnerDocument = aDocument;
    nodeInfoManager = newOwnerDocument->NodeInfoManager();
  } else {
    newOwnerDocument = aParent->GetOwnerDoc();
    nodeInfoManager = aParent->GetNodeInfo()->NodeInfoManager();
  }

  if (oldOwnerDocument && oldOwnerDocument != newOwnerDocument) {
    // Remove all properties.
    oldOwnerDocument->PropertyTable()->DeleteAllPropertiesFor(this);
  }

  SetNodeInfoManager(nodeInfoManager);

  NS_POSTCONDITION(aDocument == GetCurrentDoc(), "Bound to wrong document");
  NS_POSTCONDITION(aParent == GetParent(), "Bound to wrong parent");
  // XXXbz GetBindingParent() is broken for us, so can't assert
  // anything about it yet.
  //  NS_POSTCONDITION(aBindingParent = GetBindingParent(),
  //                   "Bound to wrong binding parent");

  return NS_OK;
}

Here is the call graph for this function:

already_AddRefed< nsITextContent > nsGenericDOMDataNode::CloneContent ( PRBool  aCloneText,
nsNodeInfoManager aNodeInfoManager 
) [virtual, inherited]

Reimplemented in nsCommentNode, nsTextNode, and nsXMLCDATASection.

Definition at line 1407 of file nsGenericDOMDataNode.cpp.

{
  NS_ERROR("Huh, this shouldn't be called!");

  return nsnull;
}

Here is the caller graph for this function:

nsIDOMNode nsIDOMNode::cloneNode ( in boolean  deep) [inherited]
PRUint32 nsGenericDOMDataNode::ContentID ( ) const [virtual, inherited]

Get a unique ID for this piece of content.

This ID is used as a key to store state information about this content object and its associated frame object. The state information is stored in a dictionary that is manipulated by the frame manager (nsIFrameManager) inside layout. An opaque pointer to this dictionary is passed to the session history as a handle associated with the current document's state

These methods are DEPRECATED, DON'T USE THEM!!!

Implements nsIContent.

Definition at line 924 of file nsGenericDOMDataNode.cpp.

{
  return 0;
}
nsresult nsGenericDOMDataNode::DeleteData ( PRUint32  aOffset,
PRUint32  aCount 
) [inherited]

Definition at line 457 of file nsGenericDOMDataNode.cpp.

{
  nsAutoString empty;
  return ReplaceData(aOffset, aCount, empty);
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual nsresult nsIContent::DeleteProperty ( nsIAtom aPropertyName) [inline, virtual, inherited]

Reimplemented in nsGenericElement.

Definition at line 686 of file nsIContent.h.

virtual void nsIContent::DoneAddingChildren ( ) [inline, virtual, inherited]

This method is called when the parser finishes creating the element's children, if any are present.

NOTE: this is currently only called for textarea, select, applet, and object elements in the HTML content sink. If you want to call it on your element, modify the content sink of your choice to do so. This is an efficiency measure.

If you also need to determine whether the parser is the one creating your element (through createElement() or cloneNode() generally) then add a boolean aFromParser to the NS_NewXXX() constructor for your element and have the parser pass true. See nsHTMLInputElement.cpp and nsHTMLContentSink::MakeContentObject().

Reimplemented in nsHTMLSelectElement, nsHTMLTextAreaElement, nsXTFElementWrapper, nsHTMLObjectElement, and nsHTMLAppletElement.

Definition at line 645 of file nsIContent.h.

  {
  }

Here is the caller graph for this function:

virtual void nsIContent::DoneCreatingElement ( ) [inline, virtual, inherited]

This method is called when the parser finishes creating the element.

This particularly means that it has done everything you would expect it to have done after it encounters the > at the end of the tag (for HTML or XML). This includes setting the attributes, setting the document / form, and placing the element into the tree at its proper place.

For container elements, this is called before any of the children are created or added into the tree.

NOTE: this is currently only called for input and button, in the HTML content sink. If you want to call it on your element, modify the content sink of your choice to do so. This is an efficiency measure.

If you also need to determine whether the parser is the one creating your element (through createElement() or cloneNode() generally) then add a boolean aFromParser to the NS_NewXXX() constructor for your element and have the parser pass true. See nsHTMLInputElement.cpp and nsHTMLContentSink::MakeContentObject().

DO NOT USE THIS METHOD to get around the fact that it's hard to deal with attributes dynamically. If you make attributes affect your element from this method, it will only happen on initialization and JavaScript will not be able to create elements (which requires them to first create the element and then call setAttribute() directly, at which point DoneCreatingElement() has already been called and is out of the picture).

Reimplemented in nsHTMLInputElement.

Definition at line 598 of file nsIContent.h.

  {
  }
void nsGenericDOMDataNode::DoSetText ( const PRUnichar aBuffer,
PRUint32  aLength,
PRBool  aIsAppend,
PRBool  aNotify 
) [protected, inherited]

Definition at line 1175 of file nsGenericDOMDataNode.cpp.

{
  if (!aBuffer) {
    NS_ERROR("Null buffer passed to SetText()!");

    return;
  }

  nsIDocument *document = GetCurrentDoc();
  mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);

  PRBool haveMutationListeners =
    document && nsGenericElement::HasMutationListeners(this, NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED);

  nsCOMPtr<nsIAtom> oldValue;
  if (haveMutationListeners) {
    oldValue = GetCurrentValueAtom();
  }
    
  mText.SetTo(aBuffer, aLength);

  SetBidiStatus();

  // Trigger a reflow
  if (aNotify && document) {
    document->CharacterDataChanged(this, aIsAppend);
  }

  if (haveMutationListeners) {
    nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(this));
    nsMutationEvent mutation(PR_TRUE, NS_MUTATION_CHARACTERDATAMODIFIED, node);

    mutation.mPrevAttrValue = oldValue;
    if (aLength > 0) {
      // Must use Substring() since nsDependentString() requires null
      // terminated strings.
      mutation.mNewAttrValue =
        do_GetAtom(Substring(aBuffer, aBuffer + aLength));
    }

    nsEventStatus status = nsEventStatus_eIgnore;
    HandleDOMEvent(nsnull, &mutation, nsnull,
                   NS_EVENT_FLAG_INIT, &status);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsGenericDOMDataNode::DoSetText ( const char *  aBuffer,
PRUint32  aLength,
PRBool  aIsAppend,
PRBool  aNotify 
) [protected, inherited]

Definition at line 1223 of file nsGenericDOMDataNode.cpp.

{
  if (!aBuffer) {
    NS_ERROR("Null buffer passed to SetText()!");

    return;
  }

  nsIDocument *document = GetCurrentDoc();
  mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);

  PRBool haveMutationListeners =
    document && nsGenericElement::HasMutationListeners(this, NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED);

  nsCOMPtr<nsIAtom> oldValue;
  if (haveMutationListeners) {
    oldValue = GetCurrentValueAtom();
  }
    
  mText.SetTo(aBuffer, aLength);

  // Trigger a reflow
  if (aNotify && document) {
    document->CharacterDataChanged(this, aIsAppend);
  }

  if (haveMutationListeners) {
    nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(this));
    nsMutationEvent mutation(PR_TRUE, NS_MUTATION_CHARACTERDATAMODIFIED, node);

    mutation.mPrevAttrValue = oldValue;
    if (aLength > 0) {
      // Must use Substring() since nsDependentCString() requires null
      // terminated strings.
      mutation.mNewAttrValue =
        do_GetAtom(Substring(aBuffer, aBuffer + aLength));
    }

    nsEventStatus status = nsEventStatus_eIgnore;
    HandleDOMEvent(nsnull, &mutation, nsnull,
                   NS_EVENT_FLAG_INIT, &status);
  }
}

Here is the call graph for this function:

void nsGenericDOMDataNode::DoSetText ( const nsAString &  aStr,
PRBool  aIsAppend,
PRBool  aNotify 
) [protected, inherited]

Definition at line 1269 of file nsGenericDOMDataNode.cpp.

{
  nsIDocument *document = GetCurrentDoc();
  mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, aNotify);

  PRBool haveMutationListeners =
    document && nsGenericElement::HasMutationListeners(this, NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED);

  nsCOMPtr<nsIAtom> oldValue;
  if (haveMutationListeners) {
    oldValue = GetCurrentValueAtom();
  }

  mText = aStr;

  SetBidiStatus();

  // Trigger a reflow
  if (aNotify && document) {
    document->CharacterDataChanged(this, aIsAppend);
  }

  if (haveMutationListeners) {
    nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(this));
    nsMutationEvent mutation(PR_TRUE, NS_MUTATION_CHARACTERDATAMODIFIED, node);

    mutation.mPrevAttrValue = oldValue;
    if (!aStr.IsEmpty())
      mutation.mNewAttrValue = do_GetAtom(aStr);
    nsEventStatus status = nsEventStatus_eIgnore;
    HandleDOMEvent(nsnull, &mutation, nsnull,
                   NS_EVENT_FLAG_INIT, &status);
  }
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::GetAttr ( PRInt32  aNameSpaceID,
nsIAtom aName,
nsAString &  aResult 
) const [virtual, inherited]

Get the current value of the attribute.

This returns a form that is suitable for passing back into SetAttr.

Parameters:
aNameSpaceIDthe namespace of the attr
aNamethe name of the attr
aResultthe value (may legitimately be the empty string) [OUT]
Exceptions:
NS_CONTENT_ATTR_NOT_THEREif the attribute is not set and has no default value
NS_CONTENT_ATTR_NO_VALUEif the attribute exists but has no value
NS_CONTENT_ATTR_HAS_VALUEif the attribute exists and has a non-empty value (==NS_OK)

Implements nsIContent.

Definition at line 793 of file nsGenericDOMDataNode.cpp.

{
  aResult.Truncate();

  return NS_CONTENT_ATTR_NOT_THERE;
}
PRUint32 nsGenericDOMDataNode::GetAttrCount ( ) const [virtual, inherited]

Get the number of all specified attributes.

Returns:
the number of attributes

Implements nsIContent.

Definition at line 819 of file nsGenericDOMDataNode.cpp.

{
  return 0;
}
nsresult nsGenericDOMDataNode::GetAttributes ( nsIDOMNamedNodeMap **  aAttributes) [inline, inherited]

Definition at line 74 of file nsGenericDOMDataNode.h.

  {
    NS_ENSURE_ARG_POINTER(aAttributes);
    *aAttributes = nsnull;
    return NS_OK;
  }
nsresult nsGenericDOMDataNode::GetAttrNameAt ( PRUint32  aIndex,
PRInt32 aNameSpaceID,
nsIAtom **  aName,
nsIAtom **  aPrefix 
) const [virtual, inherited]

Get the namespace / name / prefix of a given attribute.

Parameters:
aIndexthe index of the attribute name
aNameSpacethe name space ID of the attribute name [OUT]
aNamethe attribute name [OUT]
aPrefixthe attribute prefix [OUT]

Implements nsIContent.

Definition at line 808 of file nsGenericDOMDataNode.cpp.

{
  *aNameSpaceID = kNameSpaceID_None;
  *aName = nsnull;
  *aPrefix = nsnull;

  return NS_ERROR_ILLEGAL_VALUE;
}
nsresult nsGenericDOMDataNode::GetBaseURI ( nsAString &  aURI) [inherited]

Definition at line 289 of file nsGenericDOMDataNode.cpp.

{
  nsCOMPtr<nsIURI> baseURI = GetBaseURI();
  nsCAutoString spec;

  if (baseURI) {
    baseURI->GetSpec(spec);
  }

  CopyUTF8toUTF16(spec, aURI);

  return NS_OK;
}

Here is the call graph for this function:

already_AddRefed< nsIURI > nsGenericDOMDataNode::GetBaseURI ( ) const [virtual, inherited]

Get the base URI for any relative URIs within this piece of content.

Generally, this is the document's base URI, but certain content carries a local base for backward compatibility, and XML supports setting a per-node base URI.

Returns:
the base URI

Implements nsIContent.

Definition at line 1085 of file nsGenericDOMDataNode.cpp.

{
  // DOM Data Node inherits the base from its parent element/document
  nsIContent *parent = GetParent();
  if (parent) {
    return parent->GetBaseURI();
  }

  nsIURI *uri;
  nsIDocument *doc = GetOwnerDoc();
  if (doc) {
    NS_IF_ADDREF(uri = doc->GetBaseURI());
  }
  else {
    uri = nsnull;
  }

  return uri;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIContent * nsGenericDOMDataNode::GetBindingParent ( ) const [virtual, inherited]

Gets content node with the binding responsible for our construction (and existence).

Used by anonymous content (XBL-generated). null for all explicit content.

Returns:
the binding parent

Implements nsIContent.

Definition at line 1059 of file nsGenericDOMDataNode.cpp.

{
  nsIContent* parent = GetParent();
  return parent ? parent->GetBindingParent() : nsnull;
}

Here is the call graph for this function:

nsIContent * nsGenericDOMDataNode::GetChildAt ( PRUint32  aIndex) const [virtual, inherited]

Get a child by index.

Parameters:
aIndexthe index of the child to get, or null if index out of bounds
Returns:
the child

Implements nsIContent.

Definition at line 942 of file nsGenericDOMDataNode.cpp.

{
  return nsnull;
}
PRUint32 nsGenericDOMDataNode::GetChildCount ( ) const [virtual, inherited]

Get the number of children.

Returns:
the number of children

Implements nsIContent.

Definition at line 936 of file nsGenericDOMDataNode.cpp.

{
  return 0;
}

Definition at line 217 of file nsGenericDOMDataNode.cpp.

{
  // XXX Since we believe this won't be done very often, we won't
  // burn another slot in the data node and just create a new
  // (empty) childNodes list every time we're asked.
  nsChildContentList* list = new nsChildContentList(nsnull);
  if (!list) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  return CallQueryInterface(list, aChildNodes);
}

Here is the call graph for this function:

nsIDocument* nsGenericDOMDataNode::GetCurrentDoc ( ) const [inline, inherited]

Get the document that this content is currently in, if any.

This will be null if the content has no ancestor that is a document.

Returns:
the current document

Reimplemented from nsIContent.

Definition at line 185 of file nsGenericDOMDataNode.h.

  {
    return IsInDoc() ? GetOwnerDoc() : nsnull;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsGenericDOMDataNode::GetData ( nsAString &  aData) [inherited]

Definition at line 343 of file nsGenericDOMDataNode.cpp.

{
  if (mText.Is2b()) {
    aData.Assign(mText.Get2b(), mText.GetLength());
  } else {
    // Must use Substring() since nsDependentCString() requires null
    // terminated strings.

    const char *data = mText.Get1b();

    if (data) {
      CopyASCIItoUCS2(Substring(data, data + mText.GetLength()), aData);
    } else {
      aData.Truncate();
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIDocument * nsGenericDOMDataNode::GetDocument ( ) const [virtual, inherited]

DEPRECATED - Use GetCurrentDoc or GetOwnerDoc.

Get the document for this content.

Returns:
the document

Implements nsIContent.

Definition at line 614 of file nsGenericDOMDataNode.cpp.

{
  return GetCurrentDoc();
}

Here is the call graph for this function:

already_AddRefed< nsINodeInfo > nsGenericDOMDataNode::GetExistingAttrNameFromQName ( const nsAString &  aStr) const [virtual, inherited]

Normalizes an attribute name and returns it as a nodeinfo if an attribute with that name exists.

This method is intended for character case conversion if the content object is case insensitive (e.g. HTML). Returns the nodeinfo of the attribute with the specified name if one exists or null otherwise.

Parameters:
aStrthe unparsed attribute string
Returns:
the node info. May be nsnull.

Implements nsIContent.

Definition at line 772 of file nsGenericDOMDataNode.cpp.

{
  return nsnull;
}
nsresult nsGenericDOMDataNode::GetFirstChild ( nsIDOMNode **  aFirstChild) [inline, inherited]

Definition at line 95 of file nsGenericDOMDataNode.h.

  {
    NS_ENSURE_ARG_POINTER(aFirstChild);
    *aFirstChild = nsnull;
    return NS_OK;
  }
nsIAtom * nsGenericDOMDataNode::GetIDAttributeName ( ) const [virtual, inherited]

Returns an atom holding the name of the attribute of type ID on this content node (if applicable).

Returns null for non-element content nodes.

Implements nsIContent.

Definition at line 766 of file nsGenericDOMDataNode.cpp.

{
  return nsnull;
}
nsresult nsGenericDOMDataNode::GetLastChild ( nsIDOMNode **  aLastChild) [inline, inherited]

Definition at line 101 of file nsGenericDOMDataNode.h.

  {
    NS_ENSURE_ARG_POINTER(aLastChild);
    *aLastChild = nsnull;
    return NS_OK;
  }

Definition at line 383 of file nsGenericDOMDataNode.cpp.

{
  *aLength = mText.GetLength();
  return NS_OK;
}

Here is the call graph for this function:

Get the event listener manager, the guy you talk to to register for events on this element.

Parameters:
aResultthe event listener manager [OUT]

Implements nsIContent.

Definition at line 524 of file nsGenericDOMDataNode.cpp.

{
  nsCOMPtr<nsIEventListenerManager> listener_manager;
  LookupListenerManager(getter_AddRefs(listener_manager));

  if (listener_manager) {
    *aResult = listener_manager;
    NS_ADDREF(*aResult);

    return NS_OK;
  }

  if (!nsGenericElement::sEventListenerManagersHash.ops) {
    nsresult rv = nsGenericElement::InitHashes();
    NS_ENSURE_SUCCESS(rv, rv);
  }

  nsresult rv = NS_NewEventListenerManager(aResult);
  NS_ENSURE_SUCCESS(rv, rv);

  // Add a mapping to the hash table
  EventListenerManagerMapEntry *entry =
    NS_STATIC_CAST(EventListenerManagerMapEntry *,
                   PL_DHashTableOperate(&nsGenericElement::
                                        sEventListenerManagersHash, this,
                                        PL_DHASH_ADD));

  entry->mListenerManager = *aResult;

  entry->mListenerManager->SetListenerTarget(this);

  SetHasEventListenerManager();

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::GetLocalName ( nsAString &  aLocalName) [inherited]

Definition at line 266 of file nsGenericDOMDataNode.cpp.

{
  SetDOMStringToNull(aLocalName);

  return NS_OK;
}

Here is the call graph for this function:

PRInt32 nsGenericDOMDataNode::GetNameSpaceID ( ) const [virtual, inherited]

Get the namespace that this element's tag is defined in.

Returns:
the namespace

Implements nsIContent.

Definition at line 760 of file nsGenericDOMDataNode.cpp.

{
  return kNameSpaceID_None;
}
nsresult nsGenericDOMDataNode::GetNamespaceURI ( nsAString &  aNamespaceURI) [inherited]

Definition at line 244 of file nsGenericDOMDataNode.cpp.

{
  SetDOMStringToNull(aNamespaceURI);

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::GetNextSibling ( nsIDOMNode **  aNextSibling) [inherited]

Definition at line 184 of file nsGenericDOMDataNode.cpp.

{
  nsresult rv = NS_OK;

  nsIContent *sibling = nsnull;
  nsIContent *parent = GetParent();
  if (parent) {
    PRInt32 pos = parent->IndexOf(this);
    if (pos > -1) {
      sibling = parent->GetChildAt(pos + 1);
    }
  }
  else {
    nsIDocument *doc = GetCurrentDoc();
    if (doc) {
      PRInt32 pos = doc->IndexOf(this);
      if (pos > -1) {
        sibling = doc->GetChildAt(pos + 1);
      }
    }
  }

  if (sibling) {
    rv = CallQueryInterface(sibling, aNextSibling);
    NS_ASSERTION(NS_SUCCEEDED(rv), "Must be a DOM Node");
  } else {
    *aNextSibling = nsnull;
  }

  return rv;
}

Here is the call graph for this function:

nsINodeInfo * nsGenericDOMDataNode::GetNodeInfo ( ) const [virtual, inherited]

Get the NodeInfo for this element.

Returns:
the nodes node info

Implements nsIContent.

Definition at line 930 of file nsGenericDOMDataNode.cpp.

{
  return nsnull;
}
nsNodeInfoManager* nsGenericDOMDataNode::GetNodeInfoManager ( ) const [inline, protected, inherited]

Definition at line 286 of file nsGenericDOMDataNode.h.

Here is the caller graph for this function:

nsresult nsGenericDOMDataNode::GetNodeValue ( nsAString &  aNodeValue) [inherited]
nsIDocument* nsGenericDOMDataNode::GetOwnerDoc ( ) const [inline, virtual, inherited]

Get the ownerDocument for this content.

Returns:
the ownerDocument

Implements nsIContent.

Definition at line 190 of file nsGenericDOMDataNode.h.

  {
    return GetNodeInfoManager()->GetDocument();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 231 of file nsGenericDOMDataNode.cpp.

{
  nsIDocument *document = GetOwnerDoc();
  if (document) {
    return CallQueryInterface(document, aOwnerDocument);
  }

  *aOwnerDocument = nsnull;

  return NS_OK;
}

Here is the call graph for this function:

nsIContent* nsIContent::GetParent ( ) const [inline, inherited]

Get the parent content for this content.

Returns:
the parent, or null if no parent

Definition at line 163 of file nsIContent.h.

nsresult nsGenericDOMDataNode::GetParentNode ( nsIDOMNode **  aParentNode) [inherited]

Definition at line 130 of file nsGenericDOMDataNode.cpp.

{
  nsresult rv = NS_OK;

  nsIContent *parent = GetParent();
  if (parent) {
    rv = CallQueryInterface(parent, aParentNode);
  }
  else if (IsInDoc()) {
    rv = CallQueryInterface(GetCurrentDoc(), aParentNode);
  }
  else {
    *aParentNode = nsnull;
  }

  NS_ASSERTION(NS_SUCCEEDED(rv), "Must be a DOM Node");

  return rv;
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::GetPrefix ( nsAString &  aPrefix) [inherited]

Definition at line 252 of file nsGenericDOMDataNode.cpp.

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::GetPreviousSibling ( nsIDOMNode **  aPreviousSibling) [inherited]

Definition at line 151 of file nsGenericDOMDataNode.cpp.

{
  nsresult rv = NS_OK;

  nsIContent *sibling = nsnull;
  nsIContent *parent = GetParent();
  if (parent) {
    PRInt32 pos = parent->IndexOf(this);
    if (pos > 0) {
      sibling = parent->GetChildAt(pos - 1);
    }
  }
  else {
    nsIDocument *doc = GetCurrentDoc();
    if (doc) {
      PRInt32 pos = doc->IndexOf(this);
      if (pos > 0) {
        sibling = doc->GetChildAt(pos - 1);
      }
    }
  }

  if (sibling) {
    rv = CallQueryInterface(sibling, aPrevSibling);
    NS_ASSERTION(NS_SUCCEEDED(rv), "Must be a DOM Node");
  } else {
    *aPrevSibling = nsnull;
  }

  return rv;
}

Here is the call graph for this function:

virtual void* nsIContent::GetProperty ( nsIAtom aPropertyName,
nsresult aStatus = nsnull 
) const [inline, virtual, inherited]

Reimplemented in nsGenericElement.

Definition at line 677 of file nsIContent.h.

  { if (aStatus) *aStatus = NS_ERROR_NOT_IMPLEMENTED; return nsnull; }
const nsVoidArray * nsGenericDOMDataNode::GetRangeList ( ) const [virtual, inherited]

Get the list of ranges that have either endpoint in this content item.

Returns:
the list of ranges owned partially by this content. The nsVoidArray is owned by the content object and its lifetime is controlled completely by the content object.

Implements nsIContent.

Definition at line 1053 of file nsGenericDOMDataNode.cpp.

{
  return LookupRangeList();
}

Here is the call graph for this function:

See comment for nsGenericElement::GetSCCIndex.

Implements nsIDOMGCParticipant.

Definition at line 623 of file nsGenericDOMDataNode.cpp.

{
  // This is an optimized way of walking nsIDOMNode::GetParentNode to
  // the top of the tree.
  nsCOMPtr<nsIDOMGCParticipant> result = do_QueryInterface(GetCurrentDoc());
  if (!result) {
    nsIContent *top = this;
    while (top->GetParent())
      top = top->GetParent();
    result = do_QueryInterface(top);
  }

  return result;
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::HandleDOMEvent ( nsPresContext aPresContext,
nsEvent aEvent,
nsIDOMEvent **  aDOMEvent,
PRUint32  aFlags,
nsEventStatus aEventStatus 
) [virtual, inherited]

Handle a DOM event for this piece of content.

This method is responsible for handling and controlling all three stages of events, capture, local and bubble. It also does strange things to anonymous content which whiz right by this author's head.

Here are some beginning explanations:

  • if in INIT or CAPTURE mode, it must pass the event to its parent in CAPTURE mode (this happens before the event is fired, therefore the firing of events will occur from the root up to the target).
  • The event is fired to listeners.
  • If in INIT or BUBBLE mode, it passes the event to its parent in BUBBLE mode. This means that the events will be fired up the chain starting from the target to the ancestor.

NOTE: if you are extending nsGenericElement and have to do a default action, call super::HandleDOMEvent() first and check for aEventStatus != nsEventStatus_eIgnore and make sure you are not in CAPTURE mode before proceeding.

XXX Go comment that method, Will Robinson.

Parameters:
aPresContextthe current presentation context
aEventthe event that is being propagated
aDOMEventa special event that may contain a modified target. Pass in null here or aDOMEvent if you are in HandleDOMEvent already; don't worry your pretty little head about it.
aFlagsflags that describe what mode we are in. Generally NS_EVENT_FLAG_CAPTURE, NS_EVENT_FLAG_BUBBLE and NS_EVENT_FLAG_INIT are the ones that matter.
aEventStatusthe status returned from the function. Generally nsEventStatus_eIgnore

Implements nsIContent.

Definition at line 825 of file nsGenericDOMDataNode.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) {
      aDOMEvent = &domEvent;
    } else {
      externalDOMEvent = PR_TRUE;
    }

    aEvent->flags |= aFlags;
    aFlags &= ~(NS_EVENT_FLAG_CANT_BUBBLE | NS_EVENT_FLAG_CANT_CANCEL);
    aFlags |= NS_EVENT_FLAG_BUBBLE | NS_EVENT_FLAG_CAPTURE;
  }

  nsIContent *parent = GetParent();

  //Capturing stage evaluation
  if ((NS_EVENT_FLAG_CAPTURE & aFlags) &&
      !(IsNativeAnonymous() && aEvent->eventStructType == NS_MUTATION_EVENT)) {
    //Initiate capturing phase.  Special case first call to document
    if (parent) {
      parent->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
                             aFlags & NS_EVENT_CAPTURE_MASK, aEventStatus);
    }
    else {
      nsIDocument *document = GetCurrentDoc();
      if (document) {
        document->HandleDOMEvent(aPresContext, aEvent, aDOMEvent,
                                 aFlags & NS_EVENT_CAPTURE_MASK,
                                 aEventStatus);
      }
    }
  }

  nsCOMPtr<nsIEventListenerManager> listener_manager;
  LookupListenerManager(getter_AddRefs(listener_manager));

  //Local handling stage
  //Check for null ELM, check if we're a non-bubbling event in the bubbling state (bubbling state
  //is indicated by the presence of the NS_EVENT_FLAG_BUBBLE flag and not the NS_EVENT_FLAG_INIT), and check 
  //if we're a no content dispatch event
  if (listener_manager &&
       !(NS_EVENT_FLAG_CANT_BUBBLE & aEvent->flags && NS_EVENT_FLAG_BUBBLE & aFlags && !(NS_EVENT_FLAG_INIT & aFlags)) &&
       !(aEvent->flags & NS_EVENT_FLAG_NO_CONTENT_DISPATCH)) {
    aEvent->flags |= aFlags;
    listener_manager->HandleEvent(aPresContext, aEvent, aDOMEvent, nsnull,
                                  aFlags, aEventStatus);
    aEvent->flags &= ~aFlags;
  }

  //Bubbling stage
  if ((NS_EVENT_FLAG_BUBBLE & aFlags) && parent &&
      !(IsNativeAnonymous() && aEvent->eventStructType == NS_MUTATION_EVENT)) {
    ret = parent->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 (!externalDOMEvent && *aDOMEvent) {
      if (0 != (*aDOMEvent)->Release()) {
        // 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:

Here is the caller graph for this function:

PRBool nsGenericDOMDataNode::HasAttr ( PRInt32  aNameSpaceID,
nsIAtom aName 
) const [virtual, inherited]

Determine if an attribute has been set (empty string or otherwise).

Parameters:
aNameSpaceIdthe namespace id of the attribute
aAttrthe attribute name
Returns:
whether an attribute exists

Implements nsIContent.

Definition at line 802 of file nsGenericDOMDataNode.cpp.

{
  return PR_FALSE;
}
nsresult nsGenericDOMDataNode::HasAttributes ( PRBool aHasAttributes) [inline, inherited]

Definition at line 89 of file nsGenericDOMDataNode.h.

  {
    NS_ENSURE_ARG_POINTER(aHasAttributes);
    *aHasAttributes = PR_FALSE;
    return NS_OK;
  }
nsresult nsGenericDOMDataNode::HasChildNodes ( PRBool aHasChildNodes) [inline, inherited]

Definition at line 83 of file nsGenericDOMDataNode.h.

  {
    NS_ENSURE_ARG_POINTER(aHasChildNodes);
    *aHasChildNodes = PR_FALSE;
    return NS_OK;
  }
PRInt32 nsGenericDOMDataNode::IndexOf ( nsIContent aPossibleChild) const [virtual, inherited]

Get the index of a child within this content.

Parameters:
aPossibleChildthe child to get the index
Returns:
the index of the child, or -1 if not a child

Implements nsIContent.

Definition at line 948 of file nsGenericDOMDataNode.cpp.

{
  return -1;
}
nsIDOMNode nsIDOMNode::insertBefore ( in nsIDOMNode  newChild,
in nsIDOMNode  refChild 
) raises (DOMException) [inherited]
nsresult nsGenericDOMDataNode::InsertBefore ( nsIDOMNode aNewChild,
nsIDOMNode aRefChild,
nsIDOMNode **  aReturn 
) [inline, inherited]

Definition at line 107 of file nsGenericDOMDataNode.h.

nsresult nsGenericDOMDataNode::InsertChildAt ( nsIContent aKid,
PRUint32  aIndex,
PRBool  aNotify 
) [virtual, inherited]

Insert a content node at a particular index.

Parameters:
aKidthe content to insert
aIndexthe index it is being inserted at (the index it will have after it is inserted)
aNotifywhether to notify the document and appropriate mutation event listeners that the insert has occurred

Implements nsIContent.

Definition at line 954 of file nsGenericDOMDataNode.cpp.

{
  return NS_OK;
}
nsresult nsGenericDOMDataNode::InsertData ( PRUint32  aOffset,
const nsAString &  aArg 
) [inherited]

Definition at line 450 of file nsGenericDOMDataNode.cpp.

{
  return ReplaceData(aOffset, 0, aData);
}

Here is the call graph for this function:

virtual PRInt32 nsIContent::IntrinsicState ( ) const [inline, virtual, inherited]

Method to get the intrinsic content state of this content node.

This is the state that is independent of the node's presentation. To get the full content state, use nsIEventStateManager. Also see nsIEventStateManager for the possible bits that could be set here.

Reimplemented in nsGenericHTMLFormElement, nsHTMLInputElement, nsHTMLOptionElement, nsXTFElementWrapper, and nsHTMLOptGroupElement.

Definition at line 667 of file nsIContent.h.

  {
    return 0;
  }

Here is the caller graph for this function:

PRBool nsGenericDOMDataNode::IsContentOfType ( PRUint32  aFlags) const [virtual, inherited]

API for doing a quick check if a content object is of a given type, such as HTML, XUL, Text, ...

Use this when you can instead of checking the tag.

Parameters:
aFlagswhat types you want to test for (see above, eTEXT, eELEMENT, eHTML, eHTML_FORM_CONTROL, eXUL)
Returns:
whether the content matches ALL flags passed in

Implements nsIContent.

Reimplemented in nsTextNode, nsXMLCDATASection, nsXMLProcessingInstruction, and nsCommentNode.

Definition at line 1066 of file nsGenericDOMDataNode.cpp.

{
  return PR_FALSE;
}
virtual PRBool nsIContent::IsDoneAddingChildren ( ) [inline, virtual, inherited]

For HTML textarea, select, applet, and object elements, returns PR_TRUE if all children have been added OR if the element was not created by the parser.

Returns PR_TRUE for all other elements.

Reimplemented in nsHTMLSelectElement, nsHTMLTextAreaElement, nsHTMLObjectElement, and nsHTMLAppletElement.

Definition at line 654 of file nsIContent.h.

  {
    return PR_TRUE;
  }

Here is the caller graph for this function:

virtual PRBool nsIContent::IsFocusable ( PRInt32 aTabIndex = nsnull) [inline, virtual, inherited]

Check if this content is focusable and in the current tab order.

Note: most callers should use nsIFrame::IsFocusable() instead as it checks visibility and other layout factors as well. Tabbable is indicated by a nonnegative tabindex & is a subset of focusable. For example, only the selected radio button in a group is in the tab order, unless the radio group has no selection in which case all of the visible, non-disabled radio buttons in the group are in the tab order. On the other hand, all of the visible, non-disabled radio buttons are always focusable via clicking or script. Also, depending on either the accessibility.tabfocus pref or a system setting (nowadays: Full keyboard access, mac only) some widgets may be focusable but removed from the tab order.

Parameters:
[inout,optional]aTabIndex the computed tab index In: default tabindex for element (-1 nonfocusable, == 0 focusable) Out: computed tabindex
[optional]aTabIndex the computed tab index < 0 if not tabbable == 0 if in normal tab order > 0 can be tabbed to in the order specified by this value
Returns:
whether the content is focusable via mouse, kbd or script.

Reimplemented in nsGenericHTMLFrameElement, nsXULElement, nsHTMLSelectElement, nsGenericHTMLElement, nsHTMLInputElement, nsHTMLSharedElement, nsHTMLImageElement, nsHTMLButtonElement, nsHTMLAppletElement, nsXMLElement, nsHTMLObjectElement, and nsHTMLObjectElement.

Definition at line 505 of file nsIContent.h.

  {
    if (aTabIndex) 
      *aTabIndex = -1; // Default, not tabbable
    return PR_FALSE;
  }

Here is the caller graph for this function:

PRBool nsGenericDOMDataNode::IsInDoc ( ) const [inline, virtual, inherited]

Returns true if the content has an ancestor that is a document.

Returns:
whether this content is in a document tree

Implements nsIContent.

Definition at line 180 of file nsGenericDOMDataNode.h.

Here is the caller graph for this function:

PRBool nsGenericDOMDataNode::IsNativeAnonymous ( ) const [virtual, inherited]

Get whether this content is C++-generated anonymous content.

See also:
nsIAnonymousContentCreator
Returns:
whether this content is anonymous

Implements nsIContent.

Definition at line 746 of file nsGenericDOMDataNode.cpp.

Here is the caller graph for this function:

Query method to see if the frame is nothing but whitespace.

Implements nsITextContent.

Definition at line 1306 of file nsGenericDOMDataNode.cpp.

{
  nsTextFragment& frag = mText;
  if (frag.Is2b()) {
    const PRUnichar* cp = frag.Get2b();
    const PRUnichar* end = cp + frag.GetLength();

    while (cp < end) {
      PRUnichar ch = *cp++;

      if (!XP_IS_SPACE(ch)) {
        return PR_FALSE;
      }
    }
  } else {
    const char* cp = frag.Get1b();
    const char* end = cp + frag.GetLength();

    while (cp < end) {
      PRUnichar ch = PRUnichar(*(unsigned char*)cp);
      ++cp;

      if (!XP_IS_SPACE(ch)) {
        return PR_FALSE;
      }
    }
  }

  return PR_TRUE;
}

Here is the call graph for this function:

boolean nsIDOMNode::isSupported ( in DOMString  feature,
in DOMString  version 
) [inherited]
nsresult nsGenericDOMDataNode::IsSupported ( const nsAString &  aFeature,
const nsAString &  aVersion,
PRBool aReturn 
) [inherited]

Definition at line 280 of file nsGenericDOMDataNode.cpp.

{
  return nsGenericElement::InternalIsSupported(NS_STATIC_CAST(nsIContent*, this),
                                               aFeature, aVersion, aReturn);
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::LookupNamespaceURI ( const nsAString &  aNamespacePrefix,
nsAString &  aNamespaceURI 
) [inherited]

Definition at line 321 of file nsGenericDOMDataNode.cpp.

{
  aNamespaceURI.Truncate();

  nsIContent *parent_weak = GetParent();

  // DOM Data Node passes the query on to its parent
  nsCOMPtr<nsIDOM3Node> node(do_QueryInterface(parent_weak));

  if (node) {
    return node->LookupNamespaceURI(aNamespacePrefix, aNamespaceURI);
  }

  return NS_OK;
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::LookupPrefix ( const nsAString &  aNamespaceURI,
nsAString &  aPrefix 
) [inherited]

Definition at line 304 of file nsGenericDOMDataNode.cpp.

{
  aPrefix.Truncate();

  nsIContent *parent_weak = GetParent();

  // DOM Data Node passes the query on to its parent
  nsCOMPtr<nsIDOM3Node> node(do_QueryInterface(parent_weak));
  if (node) {
    return node->LookupPrefix(aNamespaceURI, aPrefix);
  }

  return NS_OK;
}

Here is the call graph for this function:

PRBool nsGenericDOMDataNode::MayHaveFrame ( ) const [virtual, inherited]

Returns PR_TRUE if there is a chance that the content node has a frame, PR_FALSE otherwise.

Reimplemented from nsIContent.

Reimplemented in nsXMLProcessingInstruction, and nsCommentNode.

Definition at line 974 of file nsGenericDOMDataNode.cpp.

{
  nsIContent* parent = GetParent();
  return parent && parent->MayHaveFrame();
}

Here is the call graph for this function:

void nsIDOMNode::normalize ( ) [inherited]

Definition at line 274 of file nsGenericDOMDataNode.cpp.

{
  return NS_OK;
}
nsresult nsGenericDOMDataNode::RangeAdd ( nsIDOMRange aRange) [virtual, inherited]

Inform content of range ownership changes.

This allows content to do the right thing to ranges in the face of changes to the content model. RangeRemove -- informs content that it no longer owns a range endpoint GetRangeList -- returns the list of ranges that have one or both endpoints within this content item Inform content that it owns one or both range endpoints

Parameters:
aRangethe range the content owns

Implements nsIContent.

Definition at line 981 of file nsGenericDOMDataNode.cpp.

{
  // lazy allocation of range list

  if (!nsGenericElement::sRangeListsHash.ops) {
    nsresult rv = nsGenericElement::InitHashes();
    NS_ENSURE_SUCCESS(rv, rv);
  }

  RangeListMapEntry *entry =
    NS_STATIC_CAST(RangeListMapEntry *,
                   PL_DHashTableOperate(&nsGenericElement::sRangeListsHash,
                                        this, PL_DHASH_ADD));

  if (!entry) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  nsVoidArray *range_list = entry->mRangeList;

  if (!range_list) {
    range_list = new nsAutoVoidArray();

    if (!range_list) {
      PL_DHashTableRawRemove(&nsGenericElement::sRangeListsHash, entry);

      return NS_ERROR_OUT_OF_MEMORY;
    }

    entry->mRangeList = range_list;

    SetHasRangeList();
  } else {
    // Make sure we don't add a range that is already
    // in the list!
    PRInt32 i = range_list->IndexOf(aRange);

    if (i >= 0) {
      // Range is already in the list, so there is nothing to do!

      return NS_OK;
    }
  }

  // dont need to addref - this call is made by the range object itself
  PRBool rv = range_list->AppendElement(aRange);

  return rv ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

void nsGenericDOMDataNode::RangeRemove ( nsIDOMRange aRange) [virtual, inherited]

Inform content that it no longer owns either range endpoint.

Parameters:
aRangethe range the content no longer owns

Implements nsIContent.

Definition at line 1033 of file nsGenericDOMDataNode.cpp.

{
  if (!CouldHaveRangeList()) {
    return;
  }

  RangeListMapEntry *entry =
    NS_STATIC_CAST(RangeListMapEntry *,
                   PL_DHashTableOperate(&nsGenericElement::sRangeListsHash,
                                        this, PL_DHASH_LOOKUP));

  // Don't need to release: this call is made by the range object itself.
  if (entry && PL_DHASH_ENTRY_IS_BUSY(entry) &&
      entry->mRangeList->RemoveElement(aRange) &&
      entry->mRangeList->Count() == 0) {
    PL_DHashTableRawRemove(&nsGenericElement::sRangeListsHash, entry);
  }
}

Here is the call graph for this function:

nsIDOMNode nsIDOMNode::removeChild ( in nsIDOMNode  oldChild) raises (DOMException) [inherited]
nsresult nsGenericDOMDataNode::RemoveChild ( nsIDOMNode aOldChild,
nsIDOMNode **  aReturn 
) [inline, inherited]

Definition at line 125 of file nsGenericDOMDataNode.h.

  {
    NS_ENSURE_ARG_POINTER(aReturn);
    *aReturn = nsnull;

    /*
     * Data nodes can't have children, i.e. aOldChild can't be a child of
     * this node.
     */
    return NS_ERROR_DOM_NOT_FOUND_ERR;
  }
nsresult nsGenericDOMDataNode::RemoveChildAt ( PRUint32  aIndex,
PRBool  aNotify 
) [virtual, inherited]

Remove a child from this content node.

Parameters:
aIndexthe index of the child to remove
aNotifywhether to notify the document and appropriate mutation event listeners that the replace has occurred

Implements nsIContent.

Definition at line 967 of file nsGenericDOMDataNode.cpp.

{
  return NS_OK;
}
virtual void nsIContent::RemoveFocus ( nsPresContext aPresContext) [inline, virtual, inherited]

Remove the focus on this content.

This is generally something for the event state manager to do, not ordinary people. Ordinary people should do something like nsGenericHTMLElement::SetElementFocus(). This method is the end result, the point where the content finds out it has been focused.

All content elements are potentially focusable.

Parameters:
aPresContextthe pres context
See also:
nsGenericHTMLElement::SetElementFocus()

Reimplemented in nsXULElement, and nsGenericHTMLElement.

Definition at line 479 of file nsIContent.h.

  {
  }
nsIDOMNode nsIDOMNode::replaceChild ( in nsIDOMNode  newChild,
in nsIDOMNode  oldChild 
) raises (DOMException) [inherited]
nsresult nsGenericDOMDataNode::ReplaceChild ( nsIDOMNode aNewChild,
nsIDOMNode aOldChild,
nsIDOMNode **  aReturn 
) [inline, inherited]

Definition at line 114 of file nsGenericDOMDataNode.h.

  {
    NS_ENSURE_ARG_POINTER(aReturn);
    *aReturn = nsnull;

    /*
     * Data nodes can't have children.
     */
    return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
  }
nsresult nsGenericDOMDataNode::ReplaceData ( PRUint32  aOffset,
PRUint32  aCount,
const nsAString &  aArg 
) [inherited]

Definition at line 464 of file nsGenericDOMDataNode.cpp.

{
  // sanitize arguments
  PRUint32 textLength = mText.GetLength();
  if (aOffset > textLength) {
    return NS_ERROR_DOM_INDEX_SIZE_ERR;
  }

  // Fast path (hit by editor when typing at the end of the paragraph, for
  // example): aOffset == textLength (so just doing an append; note that in
  // this case any value of aCount would just get converted to 0 by the very
  // next if block).  Call AppendData so that we pass PR_TRUE for our aAppend
  // arg to CharacterDataChanged.
  if (aOffset == textLength) {
    return AppendData(aData);
  }

  // Allocate new buffer
  PRUint32 endOffset = aOffset + aCount;
  if (endOffset > textLength) {
    aCount = textLength - aOffset;
    endOffset = textLength;
  }
  PRInt32 dataLength = aData.Length();
  PRInt32 newLength = textLength - aCount + dataLength;
  PRUnichar* to = new PRUnichar[newLength + 1];
  if (!to) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  // inform any enclosed ranges of change
  nsVoidArray *rangeList = LookupRangeList();
  if (rangeList) {
    nsRange::TextOwnerChanged(this, rangeList, aOffset, endOffset, dataLength);
  }

  // Copy over appropriate data
  if (0 != aOffset) {
    mText.CopyTo(to, 0, aOffset);
  }
  if (0 != dataLength) {
    CopyUnicodeTo(aData, 0, to+aOffset, dataLength);
  }
  if (endOffset != textLength) {
    mText.CopyTo(to + aOffset + dataLength, endOffset, textLength - endOffset);
  }

  // Null terminate the new buffer...
  to[newLength] = (PRUnichar)0;

  SetText(to, newLength, PR_TRUE);
  delete [] to;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsGenericDOMDataNode::SetAttr ( PRInt32  aNameSpaceID,
nsIAtom aName,
const nsAString &  aValue,
PRBool  aNotify 
) [inline, inherited]

Set attribute values.

All attribute values are assumed to have a canonical string representation that can be used for these methods. The SetAttr method is assumed to perform a translation of the canonical form into the underlying content specific form.

Parameters:
aNameSpaceIDthe namespace of the attribute
aNamethe name of the attribute
aValuethe value to set
aNotifyspecifies how whether or not the document and appropriate mutation event listeners should be notified of the attribute change.

Reimplemented from nsIContent.

Definition at line 200 of file nsGenericDOMDataNode.h.

  {
    return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);
  }
nsresult nsGenericDOMDataNode::SetAttr ( PRInt32  aNameSpaceID,
nsIAtom aName,
nsIAtom aPrefix,
const nsAString &  aValue,
PRBool  aNotify 
) [virtual, inherited]

Set attribute values.

All attribute values are assumed to have a canonical String representation that can be used for these methods. The SetAttr method is assumed to perform a translation of the canonical form into the underlying content specific form.

Parameters:
aNameSpaceIDthe namespace of the attribute
aNamethe name of the attribute
aPrefixthe prefix of the attribute
aValuethe value to set
aNotifyspecifies how whether or not the document and appropriate mutation event listeners should be notified of the attribute change.

Implements nsIContent.

Definition at line 778 of file nsGenericDOMDataNode.cpp.

{
  return NS_OK;
}
virtual void nsIContent::SetContentID ( PRUint32  aID) [inline, virtual, inherited]

Set the unique content ID for this content.

Parameters:
aIDthe ID to set

Reimplemented in nsXULElement, and nsGenericElement.

Definition at line 449 of file nsIContent.h.

  {
  }
nsresult nsGenericDOMDataNode::SetData ( const nsAString &  aData) [inherited]

Definition at line 364 of file nsGenericDOMDataNode.cpp.

{
  // inform any enclosed ranges of change
  // we can lie and say we are deleting all the text, since in a total
  // text replacement we should just collapse all the ranges.

  nsVoidArray *rangeList = LookupRangeList();
  if (rangeList) {
    nsRange::TextOwnerChanged(this, rangeList, 0, mText.GetLength(), 0);
  }

  nsCOMPtr<nsITextContent> textContent = do_QueryInterface(this);

  SetText(aData, PR_TRUE);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsIContent::SetFocus ( nsPresContext aPresContext) [inline, virtual, inherited]

Set the focus on this content.

This is generally something for the event state manager to do, not ordinary people. Ordinary people should do something like nsGenericHTMLElement::SetElementFocus(). This method is the end result, the point where the content finds out it has been focused.

All content elements are potentially focusable.

Parameters:
aPresContextthe pres context
See also:
nsGenericHTMLElement::SetElementFocus()

Reimplemented in nsXULElement, nsGenericElement, nsHTMLSelectElement, nsHTMLInputElement, nsHTMLSharedElement, nsHTMLTextAreaElement, nsHTMLAnchorElement, nsHTMLButtonElement, nsHTMLLabelElement, nsHTMLAreaElement, nsHTMLLegendElement, nsHTMLAppletElement, and nsHTMLObjectElement.

Definition at line 464 of file nsIContent.h.

  {
  }

Here is the caller graph for this function:

virtual void nsIContent::SetMayHaveFrame ( PRBool  aMayHaveFrame) [inline, virtual, inherited]

Call to let the content node know that it may now have a frame.

The content node may use this to determine what MayHaveFrame returns.

Reimplemented in nsGenericElement.

Definition at line 607 of file nsIContent.h.

  {
  }

Here is the caller graph for this function:

void nsGenericDOMDataNode::SetNativeAnonymous ( PRBool  aAnonymous) [virtual, inherited]

Set whether this content is anonymous.

See also:
nsIAnonymousContentCreator
Parameters:
aAnonymouswhether this content is anonymous

Implements nsIContent.

Definition at line 752 of file nsGenericDOMDataNode.cpp.

void nsGenericDOMDataNode::SetNodeInfoManager ( nsNodeInfoManager aNodeInfoManager) [protected, inherited]

Definition at line 653 of file nsGenericDOMDataNode.cpp.

{
  nsNodeInfoManager* old = GetNodeInfoManager();
  if (old != aNodeInfoManager) {
    NS_IF_ADDREF(aNodeInfoManager);
    NS_IF_RELEASE(old);
    mNodeInfoManagerBits = (void*)(PtrBits(aNodeInfoManager) |
                                   (PtrBits(mNodeInfoManagerBits) &
                                    NODEINFOMANAGER_BIT_IS_NATIVE_ANONYMOUS));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsGenericDOMDataNode::SetNodeValue ( const nsAString &  aNodeValue) [inherited]

Reimplemented in nsXMLStylesheetPI.

Definition at line 124 of file nsGenericDOMDataNode.cpp.

{
  return SetData(aNodeValue);
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::SetPrefix ( const nsAString &  aPrefix) [inherited]

Definition at line 260 of file nsGenericDOMDataNode.cpp.

virtual nsresult nsIContent::SetProperty ( nsIAtom aPropertyName,
void aValue,
NSPropertyDtorFunc  aDtor = nsnull 
) [inline, virtual, inherited]

Reimplemented in nsGenericElement.

Definition at line 681 of file nsIContent.h.

virtual void nsGenericDOMDataNode::SetText ( const PRUnichar aBuffer,
PRUint32  aLength,
PRBool  aNotify 
) [inline, virtual, inherited]

Set the text to the given value.

If aNotify is PR_TRUE then the document is notified of the content change.

Implements nsITextContent.

Definition at line 248 of file nsGenericDOMDataNode.h.

  {
    DoSetText(aBuffer, aLength, PR_FALSE, aNotify);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsGenericDOMDataNode::SetText ( const nsAString &  aStr,
PRBool  aNotify 
) [inline, virtual, inherited]

Set the text to the given value.

If aNotify is PR_TRUE then the document is notified of the content change.

Implements nsITextContent.

Definition at line 253 of file nsGenericDOMDataNode.h.

  {
    DoSetText(aStr, PR_FALSE, aNotify);
  }

Here is the call graph for this function:

virtual void nsGenericDOMDataNode::SetText ( const char *  aBuffer,
PRUint32  aLength,
PRBool  aNotify 
) [inline, virtual, inherited]

Set the text to the given value.

If aNotify is PR_TRUE then the document is notified of the content change.

Implements nsITextContent.

Definition at line 257 of file nsGenericDOMDataNode.h.

  {
    DoSetText(aBuffer, aLength, PR_FALSE, aNotify);
  }

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::SplitText ( PRUint32  aOffset,
nsIDOMText **  aReturn 
) [protected, inherited]

Definition at line 1110 of file nsGenericDOMDataNode.cpp.

{
  nsresult rv = NS_OK;
  nsAutoString cutText;
  PRUint32 length = TextLength();

  if (aOffset > length) {
    return NS_ERROR_DOM_INDEX_SIZE_ERR;
  }

  rv = SubstringData(aOffset, length - aOffset, cutText);
  if (NS_FAILED(rv)) {
    return rv;
  }

  rv = DeleteData(aOffset, length - aOffset);
  if (NS_FAILED(rv)) {
    return rv;
  }

  /*
   * Use CloneContent() for creating the new node so that the new node is of
   * same class as this node!
   */

  nsCOMPtr<nsITextContent> newContent = CloneContent(PR_FALSE,
                                                     GetNodeInfoManager());
  if (!newContent) {
    return NS_ERROR_OUT_OF_MEMORY;
  }

  newContent->SetText(cutText, PR_TRUE);

  nsIContent* parent = GetParent();

  if (parent) {
    PRInt32 index = parent->IndexOf(this);

    nsCOMPtr<nsIContent> content(do_QueryInterface(newContent));

    parent->InsertChildAt(content, index+1, PR_TRUE);
  }

  // XXX Shouldn't we handle the case where this is a child of the document?

  return CallQueryInterface(newContent, aReturn);
}

Here is the call graph for this function:

nsresult nsGenericDOMDataNode::SubstringData ( PRUint32  aOffset,
PRUint32  aCount,
nsAString &  aReturn 
) [inherited]

Definition at line 390 of file nsGenericDOMDataNode.cpp.

{
  aReturn.Truncate();

  // XXX add <0 checks if types change
  PRUint32 textLength = PRUint32( mText.GetLength() );
  if (aStart > textLength) {
    return NS_ERROR_DOM_INDEX_SIZE_ERR;
  }

  PRUint32 amount = aCount;
  if (amount > textLength - aStart) {
    amount = textLength - aStart;
  }

  if (mText.Is2b()) {
    aReturn.Assign(mText.Get2b() + aStart, amount);
  } else {
    // Must use Substring() since nsDependentCString() requires null
    // terminated strings.

    const char *data = mText.Get1b() + aStart;
    CopyASCIItoUCS2(Substring(data, data + amount), aReturn);
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIAtom * nsDOMDocumentType::Tag ( ) const [virtual]

Get the tag for this element.

This will always return a non-null atom pointer (as implied by the naming of the method).

Implements nsIContent.

Definition at line 185 of file nsDOMDocumentType.cpp.

{
  return mName;
}
const nsTextFragment * nsGenericDOMDataNode::Text ( ) [virtual, inherited]

Get direct access (but read only) to the text in the text content.

Implements nsITextContent.

Definition at line 1163 of file nsGenericDOMDataNode.cpp.

{
  return &mText;
}
PRUint32 nsGenericDOMDataNode::TextLength ( ) [virtual, inherited]

Get the length of the text content.

Implements nsITextContent.

Definition at line 1169 of file nsGenericDOMDataNode.cpp.

{
  return mText.GetLength();
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsGenericDOMDataNode::UnbindFromTree ( PRBool  aDeep = PR_TRUE,
PRBool  aNullParent = PR_TRUE 
) [virtual, inherited]

Unbind this content node from a tree.

This will set its current document and binding parent to null. In the typical case of a node being removed from a parent, this will be called after it has been removed from the parent's child list and after the nsIDocumentObserver notifications for the removal have been dispatched.

Parameters:
aDeepWhether to recursively unbind the entire subtree rooted at this node. The only time PR_FALSE should be passed is when the parent node of the content is being destroyed.
aNullParentWhether to null out the parent pointer as well. This is usually desirable. This argument should only be false while recursively calling UnbindFromTree when a subtree is detached.
Note:
This method is safe to call on nodes that are not bound to a tree.

Implements nsIContent.

Reimplemented in nsAttributeTextNode, and nsXMLStylesheetPI.

Definition at line 737 of file nsGenericDOMDataNode.cpp.

nsresult nsGenericDOMDataNode::UnsetAttr ( PRInt32  aNameSpaceID,
nsIAtom aAttr,
PRBool  aNotify 
) [virtual, inherited]

Remove an attribute so that it is no longer explicitly specified.

Parameters:
aNameSpaceIDthe namespace id of the attribute
aAttrthe name of the attribute to unset
aNotifyspecifies whether or not the document and appropriate mutation event listeners should be notified of the attribute change

Implements nsIContent.

Definition at line 786 of file nsGenericDOMDataNode.cpp.

{
  return NS_OK;
}
virtual void* nsIContent::UnsetProperty ( nsIAtom aPropertyName,
nsresult aStatus = nsnull 
) [inline, virtual, inherited]

Reimplemented in nsGenericElement.

Definition at line 689 of file nsIContent.h.

  { if (aStatus) *aStatus = NS_ERROR_NOT_IMPLEMENTED; return nsnull; }

Member Data Documentation

const unsigned short nsIDOMNode::ATTRIBUTE_NODE = 2 [inherited]

Definition at line 57 of file nsIDOMNode.idl.

Definition at line 80 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::CDATA_SECTION_NODE = 4 [inherited]

Definition at line 59 of file nsIDOMNode.idl.

Definition at line 75 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::COMMENT_NODE = 8 [inherited]

Definition at line 63 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::DOCUMENT_FRAGMENT_NODE = 11 [inherited]

Definition at line 66 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::DOCUMENT_NODE = 9 [inherited]

Definition at line 64 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::DOCUMENT_TYPE_NODE = 10 [inherited]

Definition at line 65 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::ELEMENT_NODE = 1 [inherited]

Definition at line 56 of file nsIDOMNode.idl.

Definition at line 58 of file nsIDOMDocumentType.idl.

const unsigned short nsIDOMNode::ENTITY_NODE = 6 [inherited]

Definition at line 61 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::ENTITY_REFERENCE_NODE = 5 [inherited]

Definition at line 60 of file nsIDOMNode.idl.

Definition at line 76 of file nsIDOMNode.idl.

readonly attribute DOMString nsIDOMDocumentType::internalSubset [inherited]

Definition at line 62 of file nsIDOMDocumentType.idl.

Definition at line 77 of file nsIDOMNode.idl.

readonly attribute DOMString nsIDOMNode::localName [inherited]

Definition at line 107 of file nsIDOMNode.idl.

Definition at line 80 of file nsDOMDocumentType.h.

Definition at line 84 of file nsDOMDocumentType.h.

Definition at line 79 of file nsDOMDocumentType.h.

Definition at line 81 of file nsDOMDocumentType.h.

PtrBits nsIContent::mParentPtrBits [protected, inherited]

Definition at line 731 of file nsIContent.h.

Definition at line 82 of file nsDOMDocumentType.h.

Definition at line 83 of file nsDOMDocumentType.h.

Definition at line 284 of file nsGenericDOMDataNode.h.

readonly attribute DOMString nsIDOMDocumentType::name [inherited]

Definition at line 57 of file nsIDOMDocumentType.idl.

readonly attribute DOMString nsIDOMNode::namespaceURI [inherited]

Definition at line 101 of file nsIDOMNode.idl.

Definition at line 79 of file nsIDOMNode.idl.

readonly attribute DOMString nsIDOMNode::nodeName [inherited]

Definition at line 69 of file nsIDOMNode.idl.

readonly attribute unsigned short nsIDOMNode::nodeType [inherited]

Definition at line 73 of file nsIDOMNode.idl.

attribute DOMString nsIDOMNode::nodeValue [inherited]

Definition at line 70 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::NOTATION_NODE = 12 [inherited]

Definition at line 67 of file nsIDOMNode.idl.

Definition at line 59 of file nsIDOMDocumentType.idl.

Definition at line 82 of file nsIDOMNode.idl.

Definition at line 74 of file nsIDOMNode.idl.

attribute DOMString nsIDOMNode::prefix [inherited]

Definition at line 103 of file nsIDOMNode.idl.

Definition at line 78 of file nsIDOMNode.idl.

const unsigned short nsIDOMNode::PROCESSING_INSTRUCTION_NODE = 7 [inherited]

Definition at line 62 of file nsIDOMNode.idl.

readonly attribute DOMString nsIDOMDocumentType::publicId [inherited]

Definition at line 60 of file nsIDOMDocumentType.idl.

Definition at line 719 of file nsIContent.h.

Definition at line 723 of file nsIContent.h.

readonly attribute DOMString nsIDOMDocumentType::systemId [inherited]

Definition at line 61 of file nsIDOMDocumentType.idl.

const unsigned short nsIDOMNode::TEXT_NODE = 3 [inherited]

Definition at line 58 of file nsIDOMNode.idl.


The documentation for this class was generated from the following files: