Get a hint that tells the style system what to do when an attribute on this node changes, if something needs to happen in response to the change other than the result of what is mapped into style data via any type of style rule.

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:

aDocument

The 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.

aParent

The new parent for the content node. May be null if the node is being bound as a direct child of the document.

aBindingParent

The 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.

aCompileEventHandlers

whether 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 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

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().

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).

the current form for this node. If this is non-null, and no ancestor form is found, and the current form is in a connected subtree with the node, the current form will be returned. This is needed to handle cases when HTML elements have a current form that they're not descendants of.

{
nsIContent* content = this;
while (content) {
// If the current ancestor is a form, return it as our formif (content->IsContentOfType(nsIContent::eHTML) &&
content->GetNodeInfo()->Equals(nsHTMLAtoms::form)) {
nsIDOMHTMLFormElement* form;
CallQueryInterface(content, &form);
return form;
}
nsIContent *prevContent = content;
content = prevContent->GetParent();
if (!content && aCurrentForm) {
// We got to the root of the subtree we're in, and we're being removed// from the DOM (the only time we get into this method with a non-null// aCurrentForm). Check whether aCurrentForm is in the same subtree. If// it is, we want to return aCurrentForm, since this case means that// we're one of those inputs-in-a-table that have a hacked mForm pointer// and a subtree containing both us and the form got removed from the// DOM.nsCOMPtr<nsIContent> formCOMPtr = do_QueryInterface(aCurrentForm);
NS_ASSERTION(formCOMPtr, "aCurrentForm isn't an nsIContent?");
// Use an nsIContent temporary to reduce addref/releasing as we go up the// treensIContent* iter = formCOMPtr;
do {
iter = iter->GetParent();
if (iter == prevContent) {
nsIDOMHTMLFormElement* form;
CallQueryInterface(aCurrentForm, &form);
return form;
}
} while (iter);
}
if (content) {
PRInt32i = content->IndexOf(prevContent);
if (i < 0) {
// This means 'prevContent' is anonymous content, form controls in// anonymous content can't refer to the real form, if they do// they end up in form.elements n' such, and that's wrong...returnnsnull;
}
}
}
returnnsnull;
}

{
// Generic HTML elements are focusable only if tabindex explicitly set.// SetFocus() will check to see if we're focusable and then// call into esm to do the work of focusing.if (ShouldFocus(this)) {
SetElementFocus(PR_TRUE);
}
returnNS_OK;
}

In general this is equivalent to GetEditorInternal(), but for designmode or contenteditable, this may need to get an editor that's not actually on this element's associated TextControlFrame. This is used by the spellchecking routines to get the editor affected by changing the spellcheck attribute on this node.

Get a hint that tells the style system what to do when an attribute on this node changes, if something needs to happen in response to the change other than the result of what is mapped into style data via any type of style rule.

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.

During the Mark phase of the GC, we need to mark all of the preserved wrappers that are reachable via DOM APIs.

Since reachability for DOM nodes is symmetric, if one DOM node is reachable from another via DOM APIs, then they are in the same strongly connected component. (Strongly connected components are never reachable from each other via DOM APIs.) We can refer to each strongly connected component by walking up to the top of the parent chain. This function finds that root node for any DOM node.

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:

aPresContext

the current presentation context

aEvent

the event that is being propagated

aDOMEvent

a 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.

aFlags

flags 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.

aEventStatus

the status returned from the function. Generally nsEventStatus_eIgnore