Back to index

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

#include <nsBindingManager.h>

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

List of all members.

Classes

struct  ProcessAttachedQueueEvent

Public Member Functions

 nsBindingManager (nsIDocument *aDocument)
 ~nsBindingManager ()
virtual nsXBLBindingGetBinding (nsIContent *aContent)
NS_IMETHOD SetBinding (nsIContent *aContent, nsXBLBinding *aBinding)
NS_IMETHOD GetInsertionParent (nsIContent *aContent, nsIContent **aResult)
NS_IMETHOD SetInsertionParent (nsIContent *aContent, nsIContent *aResult)
NS_IMETHOD GetWrappedJS (nsIContent *aContent, nsIXPConnectWrappedJS **aResult)
NS_IMETHOD SetWrappedJS (nsIContent *aContent, nsIXPConnectWrappedJS *aResult)
NS_IMETHOD ChangeDocumentFor (nsIContent *aContent, nsIDocument *aOldDocument, nsIDocument *aNewDocument)
 Notify the binding manager that an element has been moved from one document to another, so that it can update any bindings or nsIAnonymousContentCreator-created anonymous content that may depend on the document.
NS_IMETHOD ResolveTag (nsIContent *aContent, PRInt32 *aNameSpaceID, nsIAtom **aResult)
NS_IMETHOD GetContentListFor (nsIContent *aContent, nsIDOMNodeList **aResult)
 Return a list of all explicit children, including any children that may have been inserted via XBL insertion points.
NS_IMETHOD SetContentListFor (nsIContent *aContent, nsVoidArray *aList)
 Set the insertion point children for the specified element.
NS_IMETHOD HasContentListFor (nsIContent *aContent, PRBool *aResult)
 Determine whether or not the explicit child list has been altered by XBL insertion points.
NS_IMETHOD GetAnonymousNodesFor (nsIContent *aContent, nsIDOMNodeList **aResult)
 For a given element, retrieve the anonymous child content.
NS_IMETHOD SetAnonymousNodesFor (nsIContent *aContent, nsVoidArray *aList)
 Set the anonymous child content for the specified element.
NS_IMETHOD GetXBLChildNodesFor (nsIContent *aContent, nsIDOMNodeList **aResult)
 Retrieves the anonymous list of children if the element has one; otherwise, retrieves the list of explicit children.
virtual nsIContentGetInsertionPoint (nsIContent *aParent, nsIContent *aChild, PRUint32 *aIndex)
 Given a parent element and a child content, determine where the child content should be inserted in the parent element's anonymous content tree.
virtual nsIContentGetSingleInsertionPoint (nsIContent *aParent, PRUint32 *aIndex, PRBool *aMultipleInsertionPoints)
 Return the unfiltered insertion point for the specified parent element.
NS_IMETHOD AddLayeredBinding (nsIContent *aContent, nsIURI *aURL)
NS_IMETHOD RemoveLayeredBinding (nsIContent *aContent, nsIURI *aURL)
NS_IMETHOD LoadBindingDocument (nsIDocument *aBoundDoc, nsIURI *aURL, nsIDocument **aResult)
NS_IMETHOD AddToAttachedQueue (nsXBLBinding *aBinding)
NS_IMETHOD ClearAttachedQueue ()
NS_IMETHOD ProcessAttachedQueue ()
NS_IMETHOD ExecuteDetachedHandlers ()
NS_IMETHOD PutXBLDocumentInfo (nsIXBLDocumentInfo *aDocumentInfo)
NS_IMETHOD GetXBLDocumentInfo (nsIURI *aURI, nsIXBLDocumentInfo **aResult)
NS_IMETHOD RemoveXBLDocumentInfo (nsIXBLDocumentInfo *aDocumentInfo)
NS_IMETHOD PutLoadingDocListener (nsIURI *aURL, nsIStreamListener *aListener)
NS_IMETHOD GetLoadingDocListener (nsIURI *aURL, nsIStreamListener **aResult)
NS_IMETHOD RemoveLoadingDocListener (nsIURI *aURL)
NS_IMETHOD FlushSkinBindings ()
NS_IMETHOD GetBindingImplementation (nsIContent *aContent, REFNSIID aIID, void **aResult)
NS_IMETHOD ShouldBuildChildFrames (nsIContent *aContent, PRBool *aResult)
NS_IMETHOD WalkRules (nsStyleSet *aStyleSet, nsIStyleRuleProcessor::EnumFunc aFunc, RuleProcessorData *aData, PRBool *aCutOffInheritance)
virtual void ContentAppended (nsIDocument *aDocument, nsIContent *aContainer, PRInt32 aNewIndexInContainer)
 Notifcation that the content model has had data appended to the given content object.
virtual void ContentInserted (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)
 Notification that content has been inserted.
virtual void ContentRemoved (nsIDocument *aDocument, nsIContent *aContainer, nsIContent *aChild, PRInt32 aIndexInContainer)
 Content has just been removed.
virtual void DocumentWillBeDestroyed (nsIDocument *aDocument)
 The document is in the process of being destroyed.
void BeginOutermostUpdate ()
void EndOutermostUpdate ()
virtual void BeginUpdate (nsIDocument *aDocument, nsUpdateType aUpdateType)=0
 Notify that a content model update is beginning.
virtual void EndUpdate (nsIDocument *aDocument, nsUpdateType aUpdateType)=0
 Notify that a content model update is finished.
virtual void BeginLoad (nsIDocument *aDocument)=0
 Notify the observer that a document load is beginning.
virtual void EndLoad (nsIDocument *aDocument)=0
 Notify the observer that a document load has finished.
virtual void BeginReflow (nsIDocument *aDocument, nsIPresShell *aShell)=0
 Notify the observer that the document is being reflowed in the given presentation shell.
virtual void EndReflow (nsIDocument *aDocument, nsIPresShell *aShell)=0
 Notify the observer that the document is done being reflowed in the given presentation shell.
virtual void CharacterDataChanged (nsIDocument *aDocument, nsIContent *aContent, PRBool aAppend)=0
 Notification that the content model has changed.
virtual void ContentStatesChanged (nsIDocument *aDocument, nsIContent *aContent1, nsIContent *aContent2, PRInt32 aStateMask)=0
 Notification that the state of a content node has changed.
virtual void AttributeChanged (nsIDocument *aDocument, nsIContent *aContent, PRInt32 aNameSpaceID, nsIAtom *aAttribute, PRInt32 aModType)=0
 Notification that the content model has changed.
virtual void StyleSheetAdded (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aDocumentSheet)=0
 A StyleSheet has just been added to the document.
virtual void StyleSheetRemoved (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aDocumentSheet)=0
 A StyleSheet has just been removed from the document.
virtual void StyleSheetApplicableStateChanged (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, PRBool aApplicable)=0
 A StyleSheet has just changed its applicable state.
virtual void StyleRuleChanged (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aOldStyleRule, nsIStyleRule *aNewStyleRule)=0
 A StyleRule has just been modified within a style sheet.
virtual void StyleRuleAdded (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)=0
 A StyleRule has just been added to a style sheet.
virtual void StyleRuleRemoved (nsIDocument *aDocument, nsIStyleSheet *aStyleSheet, nsIStyleRule *aStyleRule)=0
 A StyleRule has just been removed from a style sheet.

Protected Member Functions

nsresult GetXBLChildNodesInternal (nsIContent *aContent, nsIDOMNodeList **aResult, PRBool *aIsAnonymousContentList)
nsresult GetAnonymousNodesInternal (nsIContent *aContent, nsIDOMNodeList **aResult, PRBool *aIsAnonymousContentList)
nsIContentGetEnclosingScope (nsIContent *aContent)
nsresult GetNestedInsertionPoint (nsIContent *aParent, nsIContent *aChild, nsIContent **aResult)
void DoProcessAttachedQueue ()

Protected Attributes

nsRefPtrHashtable
< nsISupportsHashKey,
nsXBLBinding
mBindingTable
PLDHashTable mContentListTable
PLDHashTable mAnonymousNodesTable
PLDHashTable mInsertionParentTable
PLDHashTable mWrapperTable
nsInterfaceHashtable
< nsURIHashKey,
nsIXBLDocumentInfo
mDocumentTable
nsInterfaceHashtable
< nsURIHashKey,
nsIStreamListener
mLoadingDocTable
nsVoidArray mAttachedStack
PRPackedBool mProcessingAttachedStack
PRPackedBool mProcessOnEndUpdate
ProcessAttachedQueueEventmProcessAttachedQueueEvent
nsIDocumentmDocument

Friends

struct ProcessAttachedQueueEvent

Detailed Description

Definition at line 63 of file nsBindingManager.h.


Constructor & Destructor Documentation


Member Function Documentation

NS_IMETHODIMP nsBindingManager::AddLayeredBinding ( nsIContent aContent,
nsIURI aURL 
) [virtual]

Implements nsIBindingManager.

Definition at line 679 of file nsBindingManager.cpp.

{
  // First we need to load our binding.
  nsresult rv;
  nsCOMPtr<nsIXBLService> xblService = 
           do_GetService("@mozilla.org/xbl;1", &rv);
  if (!xblService)
    return rv;

  // Load the bindings.
  nsRefPtr<nsXBLBinding> binding;
  PRBool dummy;
  xblService->LoadBindings(aContent, aURL, PR_TRUE, getter_AddRefs(binding),
                           &dummy);
  if (binding) {
    AddToAttachedQueue(binding);
    ProcessAttachedQueue();
  }

  return NS_OK;
}

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 790 of file nsBindingManager.cpp.

{
  if (!mAttachedStack.AppendElement(aBinding))
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(aBinding);

  // If we're in the middle of processing our queue already, don't
  // bother posting the event.
  if (!mProcessingAttachedStack && !mProcessAttachedQueueEvent) {
    nsCOMPtr<nsIEventQueueService> eventQueueService =
      do_GetService(NS_EVENTQUEUESERVICE_CONTRACTID);
    nsCOMPtr<nsIEventQueue> eventQueue;
    if (eventQueueService) {
      eventQueueService->
        GetSpecialEventQueue(nsIEventQueueService::UI_THREAD_EVENT_QUEUE,
                             getter_AddRefs(eventQueue));
    }
    if (eventQueue) {
      ProcessAttachedQueueEvent* ev = new ProcessAttachedQueueEvent(this);
      if (ev && NS_FAILED(eventQueue->PostEvent(ev))) {
        PL_DestroyEvent(ev);
      } else {
        mProcessAttachedQueueEvent = ev;
      }
    }
  }
  
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsIDocumentObserver::AttributeChanged ( nsIDocument aDocument,
nsIContent aContent,
PRInt32  aNameSpaceID,
nsIAtom aAttribute,
PRInt32  aModType 
) [pure virtual, inherited]

Notification that the content model has changed.

This method is called automatically by content objects when an attribute's value has changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers document observers.

Parameters:
aDocumentThe document being observed
aContentthe piece of content whose attribute changed
aAttributethe atom name of the attribute
aModTypeWhether or not the attribute was added, changed, or removed. The constants are defined in nsIDOMMutationEvent.h.

Implemented in PresShell, nsContentList, nsXULContentBuilder, nsXULTemplateBuilder, nsImageMap, nsTreeContentView, and nsXMLPrettyPrinter.

virtual void nsIDocumentObserver::BeginLoad ( nsIDocument aDocument) [pure virtual, inherited]

Notify the observer that a document load is beginning.

Implemented in PresShell.

Definition at line 1373 of file nsBindingManager.cpp.

{
  mProcessOnEndUpdate = (mAttachedStack.Count() == 0);
}
virtual void nsIDocumentObserver::BeginReflow ( nsIDocument aDocument,
nsIPresShell aShell 
) [pure virtual, inherited]

Notify the observer that the document is being reflowed in the given presentation shell.

virtual void nsIDocumentObserver::BeginUpdate ( nsIDocument aDocument,
nsUpdateType  aUpdateType 
) [pure virtual, inherited]

Notify that a content model update is beginning.

This call can be nested.

Implemented in nsFragmentObserver, PresShell, HTMLContentSink, and nsXMLPrettyPrinter.

NS_IMETHODIMP nsBindingManager::ChangeDocumentFor ( nsIContent aContent,
nsIDocument aOldDocument,
nsIDocument aNewDocument 
) [virtual]

Notify the binding manager that an element has been moved from one document to another, so that it can update any bindings or nsIAnonymousContentCreator-created anonymous content that may depend on the document.

Parameters:
aContentthe element that's being moved
aOldDocumentthe old document in which the content resided. May be null if the the content was not in any document.
aNewDocumentthe document in which the content will reside. May be null if the content will not reside in any document, or if the content is being destroyed.

Implements nsIBindingManager.

Definition at line 433 of file nsBindingManager.cpp.

{
  // XXXbz this code is pretty broken, since moving from one document
  // to another always passes through a null document!
  NS_PRECONDITION(aOldDocument != nsnull, "no old document");
  NS_PRECONDITION(!aNewDocument,
                  "Changing to a non-null new document not supported yet");
  if (! aOldDocument)
    return NS_ERROR_NULL_POINTER;

  // Hold a ref to the binding so it won't die when we remove it from our
  // table.
  nsRefPtr<nsXBLBinding> binding = nsBindingManager::GetBinding(aContent);
  if (binding) {
    binding->ChangeDocument(aOldDocument, aNewDocument);
    SetBinding(aContent, nsnull);
    if (aNewDocument)
      aNewDocument->BindingManager()->SetBinding(aContent, binding);
  }

  // Clear out insertion parents and content lists.
  SetInsertionParent(aContent, nsnull);
  SetContentListFor(aContent, nsnull);
  SetAnonymousNodesFor(aContent, nsnull);

  PRUint32 count = aOldDocument->GetNumberOfShells();

  for (PRUint32 i = 0; i < count; ++i) {
    nsIPresShell *shell = aOldDocument->GetShellAt(i);
    NS_ASSERTION(shell != nsnull, "Zoiks! nsIDocument::GetShellAt() broke");

    // now clear out the anonymous content for this node in the old presshell.
    // XXXbz this really doesn't belong here, somehow... either that, or we
    // need to better define what sort of bindings we're managing.
    shell->SetAnonymousContentFor(aContent, nsnull);
  }

  return NS_OK;
}

Here is the call graph for this function:

virtual void nsIDocumentObserver::CharacterDataChanged ( nsIDocument aDocument,
nsIContent aContent,
PRBool  aAppend 
) [pure virtual, inherited]

Notification that the content model has changed.

This method is called automatically by content objects when their state is changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers. The notification is passed on to all of the document observers.

This notification is not sent when a piece of content is added/removed from the document (the other notifications are used for that).

Parameters:
aDocumentThe document being observed
aContentthe piece of content that changed
aAppendWhether the change was an append

Implemented in PresShell.

Implements nsIBindingManager.

Definition at line 822 of file nsBindingManager.cpp.

{
  mAttachedStack.EnumerateForwards(ReleaseBindings, nsnull);
  mAttachedStack.Clear();
  return NS_OK;
}

Here is the call graph for this function:

void nsBindingManager::ContentAppended ( nsIDocument aDocument,
nsIContent aContainer,
PRInt32  aNewIndexInContainer 
) [virtual]

Notifcation that the content model has had data appended to the given content object.

This method is called automatically by the content container objects when a new content object is appended to the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that had a new child appended
aNewIndexInContainerthe index in the container of the first new child

Implements nsIDocumentObserver.

Definition at line 1213 of file nsBindingManager.cpp.

{
  // XXX This is hacked and not quite correct. See below.
  if (aNewIndexInContainer == -1 || 
      (!mContentListTable.ops && !mAnonymousNodesTable.ops))
    // It's anonymous.
    return;

  PRInt32 childCount = aContainer->GetChildCount();

  nsIContent *child = aContainer->GetChildAt(aNewIndexInContainer);

  nsCOMPtr<nsIContent> ins;
  GetNestedInsertionPoint(aContainer, child, getter_AddRefs(ins));

  if (ins) {
    nsCOMPtr<nsIDOMNodeList> nodeList;
    PRBool isAnonymousContentList;
    GetXBLChildNodesInternal(ins, getter_AddRefs(nodeList),
                             &isAnonymousContentList);

    if (nodeList && isAnonymousContentList) {
      // Find a non-pseudo-insertion point and just jam ourselves in.
      // This is not 100% correct.  Hack city, baby.
      nsAnonymousContentList* contentList = NS_STATIC_CAST(nsAnonymousContentList*, NS_STATIC_CAST(nsIDOMNodeList*, nodeList.get()));

      PRInt32 count = contentList->GetInsertionPointCount();
      for (PRInt32 i = 0; i < count; i++) {
        nsXBLInsertionPoint* point = contentList->GetInsertionPointAt(i);
        PRInt32 index = point->GetInsertionIndex();
        if (index != -1) {
          // We're real. Jam all the kids in.
          // XXX Check the filters to find the correct points.
          for (PRInt32 j = aNewIndexInContainer; j < childCount; j++) {
            child = aContainer->GetChildAt(j);
            point->AddChild(child);
            SetInsertionParent(child, ins);
          }
          break;
        }
      }
    }
  }
}

Here is the call graph for this function:

void nsBindingManager::ContentInserted ( nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [virtual]

Notification that content has been inserted.

This method is called automatically by the content container objects when a new content object is inserted in the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that now contains aChild
aChildthe child that was inserted
aIndexInContainerthe index of the child in the container

Implements nsIDocumentObserver.

Definition at line 1261 of file nsBindingManager.cpp.

{
// XXX This is hacked just to make menus work again.
  if (aIndexInContainer == -1 || 
      (!mContentListTable.ops && !mAnonymousNodesTable.ops))
    // It's anonymous.
    return;

  nsCOMPtr<nsIContent> ins;
  GetNestedInsertionPoint(aContainer, aChild, getter_AddRefs(ins));

  if (ins) {
    nsCOMPtr<nsIDOMNodeList> nodeList;
    PRBool isAnonymousContentList;
    GetXBLChildNodesInternal(ins, getter_AddRefs(nodeList),
                             &isAnonymousContentList);

    if (nodeList && isAnonymousContentList) {
      // Find a non-pseudo-insertion point and just jam ourselves in.
      // This is not 100% correct.  Hack city, baby.
      nsAnonymousContentList* contentList = NS_STATIC_CAST(nsAnonymousContentList*, NS_STATIC_CAST(nsIDOMNodeList*, nodeList.get()));

      PRInt32 count = contentList->GetInsertionPointCount();
      for (PRInt32 i = 0; i < count; i++) {
        nsXBLInsertionPoint* point = contentList->GetInsertionPointAt(i);
        if (point->GetInsertionIndex() != -1) {
          // We're real. Jam the kid in.
          // XXX Check the filters to find the correct points.

          // Find the right insertion spot.  Can't just insert in the insertion
          // point at aIndexInContainer since the point may contain anonymous
          // content, not all of aContainer's kids, etc.  So find the last
          // child of aContainer that comes before aIndexInContainer and is in
          // the insertion point and insert right after it.
          PRInt32 pointSize = point->ChildCount();
          PRBool inserted = PR_FALSE;
          for (PRInt32 parentIndex = aIndexInContainer - 1;
               parentIndex >= 0 && !inserted; --parentIndex) {
            nsIContent* currentSibling = aContainer->GetChildAt(parentIndex);
            for (PRInt32 pointIndex = pointSize - 1; pointIndex >= 0;
                 --pointIndex) {
              nsCOMPtr<nsIContent> currContent = point->ChildAt(pointIndex);
              if (currContent == currentSibling) {
                point->InsertChildAt(pointIndex + 1, aChild);
                inserted = PR_TRUE;
                break;
              }
            }
          }
          if (!inserted) {
            // None of our previous siblings are in here... just stick
            // ourselves in at the beginning of the insertion point.
            // XXXbz if we ever start doing the filter thing right, this may be
            // no good, since we may _still_ have anonymous kids in there and
            // may need to get the ordering with those right.
            point->InsertChildAt(0, aChild);
          }
          SetInsertionParent(aChild, ins);
          break;
        }
      }
    }
  }
}

Here is the call graph for this function:

void nsBindingManager::ContentRemoved ( nsIDocument aDocument,
nsIContent aContainer,
nsIContent aChild,
PRInt32  aIndexInContainer 
) [virtual]

Content has just been removed.

This method is called automatically by content container objects when a content object has just been removed from the container (therefore there is normally no need to invoke this method directly). The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aContainerthe container that had a child removed
aChildthe child that was just removed
aIndexInContainerthe index of the child in the container before it was removed

Implements nsIDocumentObserver.

Definition at line 1330 of file nsBindingManager.cpp.

{
  if (aIndexInContainer == -1 || 
      (!mContentListTable.ops  && !mAnonymousNodesTable.ops))
    // It's anonymous.
    return;

  nsCOMPtr<nsIContent> point;
  GetNestedInsertionPoint(aContainer, aChild, getter_AddRefs(point));

  if (point) {
    nsCOMPtr<nsIDOMNodeList> nodeList;
    PRBool isAnonymousContentList;
    GetXBLChildNodesInternal(point, getter_AddRefs(nodeList),
                             &isAnonymousContentList);

    if (nodeList && isAnonymousContentList) {
      // Find a non-pseudo-insertion point and remove ourselves.
      nsAnonymousContentList* contentList = NS_STATIC_CAST(nsAnonymousContentList*, NS_STATIC_CAST(nsIDOMNodeList*, nodeList));
      PRInt32 count = contentList->GetInsertionPointCount();
      for (PRInt32 i =0; i < count; i++) {
        nsXBLInsertionPoint* point = contentList->GetInsertionPointAt(i);
        if (point->GetInsertionIndex() != -1) {
          point->RemoveChild(aChild);
        }
      }
    }
  }
}

Here is the call graph for this function:

virtual void nsIDocumentObserver::ContentStatesChanged ( nsIDocument aDocument,
nsIContent aContent1,
nsIContent aContent2,
PRInt32  aStateMask 
) [pure virtual, inherited]

Notification that the state of a content node has changed.

(ie: gained or lost focus, became active or hovered over) This method is called automatically by content objects when their state is changed (therefore there is normally no need to invoke this method directly). The notification is passed to any IDocumentObservers. The notification is passed on to all of the document observers.

This notification is not sent when a piece of content is added/removed from the document or the content itself changed (the other notifications are used for that).

The optional second content node is to allow optimization of the case where state moves from one node to another (as is likely for :focus and :hover)

Either content node may be nsnull, but not both

Parameters:
aDocumentThe document being observed
aContent1the piece of content that changed
aContent2optional second piece of content that changed

Implemented in PresShell, and nsTreeContentView.

The document is in the process of being destroyed.

This method is called automatically during document destruction.

Parameters:
aDocumentThe document being observed

Implements nsIDocumentObserver.

Definition at line 1364 of file nsBindingManager.cpp.

{
  // Make sure to not run any more XBL constructors
  mProcessingAttachedStack = PR_TRUE;

  mDocument = nsnull;
}

Definition at line 830 of file nsBindingManager.cpp.

{
  ProcessAttachedQueue();

  NS_ASSERTION(mAttachedStack.Count() == 0,
               "Shouldn't have pending bindings!");
  
  mProcessAttachedQueueEvent = nsnull;
}

Here is the call graph for this function:

virtual void nsIDocumentObserver::EndLoad ( nsIDocument aDocument) [pure virtual, inherited]

Notify the observer that a document load has finished.

Note that the associated reflow of the document will be done before EndLoad is invoked, not after.

Implemented in PresShell.

Definition at line 1379 of file nsBindingManager.cpp.

{
  if (mProcessOnEndUpdate) {
    mProcessOnEndUpdate = PR_FALSE;
    if (mAttachedStack.Count() != 0 && mDocument) {
      nsCOMPtr<nsIPresShell_MOZILLA_1_8_BRANCH2> shell =
        do_QueryInterface(mDocument->GetShellAt(0));
      if (shell) {
        shell->BlockFlushing();
      }
      ProcessAttachedQueue();
      if (shell) {
        shell->UnblockFlushing();
      }
    }
  }
}

Here is the call graph for this function:

virtual void nsIDocumentObserver::EndReflow ( nsIDocument aDocument,
nsIPresShell aShell 
) [pure virtual, inherited]

Notify the observer that the document is done being reflowed in the given presentation shell.

virtual void nsIDocumentObserver::EndUpdate ( nsIDocument aDocument,
nsUpdateType  aUpdateType 
) [pure virtual, inherited]

Notify that a content model update is finished.

This call can be nested.

Implemented in PresShell, HTMLContentSink, and nsXMLPrettyPrinter.

Implements nsIBindingManager.

Definition at line 889 of file nsBindingManager.cpp.

{
  // Walk our hashtable of bindings.
  if (mBindingTable.IsInitialized()) {
    BindingTableReadClosure closure;
    mBindingTable.EnumerateRead(AccumulateBindingsToDetach, &closure);
    PRUint32 i, count = closure.mBindings.Count();
    for (i = 0; i < count; ++i) {
      NS_STATIC_CAST(nsXBLBinding*, closure.mBindings[i])
        ->ExecuteDetachedHandler();
    }
    for (i = 0; i < count; ++i) {
      nsXBLBinding* b = NS_STATIC_CAST(nsXBLBinding*, closure.mBindings[i]);
      NS_RELEASE(b);
    }
  }
  return NS_OK;
}

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 996 of file nsBindingManager.cpp.

Here is the call graph for this function:

For a given element, retrieve the anonymous child content.

Implements nsIBindingManager.

Definition at line 570 of file nsBindingManager.cpp.

{
  PRBool dummy;
  return GetAnonymousNodesInternal(aContent, aResult, &dummy);
}

Here is the call graph for this function:

nsresult nsBindingManager::GetAnonymousNodesInternal ( nsIContent aContent,
nsIDOMNodeList **  aResult,
PRBool aIsAnonymousContentList 
) [protected]

Definition at line 544 of file nsBindingManager.cpp.

{ 
  // Locate the primary binding and get its node list of anonymous children.
  *aResult = nsnull;
  if (mAnonymousNodesTable.ops) {
    *aResult = NS_STATIC_CAST(nsIDOMNodeList*,
                              LookupObject(mAnonymousNodesTable, aContent));
    NS_IF_ADDREF(*aResult);
  }

  if (!*aResult) {
    *aIsAnonymousContentList = PR_FALSE;
    nsXBLBinding *binding = nsBindingManager::GetBinding(aContent);
    if (binding) {
      *aResult = binding->GetAnonymousNodes().get();
      return NS_OK;
    }
  } else
    *aIsAnonymousContentList = PR_TRUE;

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIBindingManager.

Definition at line 342 of file nsBindingManager.cpp.

{
  if (mBindingTable.IsInitialized())
    return mBindingTable.GetWeak(aContent);

  return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBindingManager::GetBindingImplementation ( nsIContent aContent,
REFNSIID  aIID,
void **  aResult 
) [virtual]

Implements nsIBindingManager.

Definition at line 1016 of file nsBindingManager.cpp.

{
  *aResult = nsnull;
  nsXBLBinding *binding = nsBindingManager::GetBinding(aContent);
  if (binding) {
    // The binding should not be asked for nsISupports
    NS_ASSERTION(!aIID.Equals(NS_GET_IID(nsISupports)), "Asking a binding for nsISupports");
    if (binding->ImplementsInterface(aIID)) {
      nsCOMPtr<nsIXPConnectWrappedJS> wrappedJS;
      GetWrappedJS(aContent, getter_AddRefs(wrappedJS));

      if (wrappedJS) {
        // Protect from recurring in QI calls through XPConnect. 
        // This can happen when a second binding is being resolved.
        // At that point a wrappedJS exists, but it doesn't yet know about
        // the iid we are asking for. So, without this protection, 
        // AggregatedQueryInterface would end up recurring back into itself
        // through this code. 
        //
        // With this protection, when we detect the recursion we return 
        // NS_NOINTERFACE in the inner call. The outer call will then fall 
        // through (see below) and build a new chained wrappedJS for the iid.
        //
        // We're careful to not assume that only one direct nesting can occur
        // because there is a call into JS in the middle and we can't assume 
        // that this code won't be reached by some more complex nesting path.
        //
        // NOTE: We *assume* this is single threaded, so we can use a
        // static linked list to do the check.

        static AntiRecursionData* list = nsnull;

        for (AntiRecursionData* p = list; p; p = p->next) {
          if (p->element == aContent && p->iid.Equals(aIID)) {
            *aResult = nsnull;
            return NS_NOINTERFACE;
          }
        }

        AntiRecursionData item(aContent, aIID, list);
        list = &item;

        nsresult rv = wrappedJS->AggregatedQueryInterface(aIID, aResult);
        
        list = item.next;
        
        if (*aResult)
          return rv;
        
        // No result was found, so this must be another XBL interface.
        // Fall through to create a new wrapper.
      }

      // We have never made a wrapper for this implementation.
      // Create an XPC wrapper for the script object and hand it back.

      nsIDocument* doc = aContent->GetOwnerDoc();
      if (!doc)
        return NS_NOINTERFACE;

      nsIScriptGlobalObject *global = doc->GetScriptGlobalObject();
      if (!global)
        return NS_NOINTERFACE;

      nsIScriptContext *context = global->GetContext();
      if (!context)
        return NS_NOINTERFACE;

      JSContext* jscontext = (JSContext*)context->GetNativeContext();
      if (!jscontext)
        return NS_NOINTERFACE;

      nsIXPConnect *xpConnect = nsContentUtils::XPConnect();

      nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
      xpConnect->GetWrappedNativeOfNativeObject(jscontext,
                                                global->GetGlobalJSObject(),
                                                aContent,
                                                NS_GET_IID(nsISupports),
                                                getter_AddRefs(wrapper));
      NS_ENSURE_TRUE(wrapper, NS_NOINTERFACE);

      JSObject* jsobj = nsnull;

      wrapper->GetJSObject(&jsobj);
      NS_ENSURE_TRUE(jsobj, NS_NOINTERFACE);

      nsresult rv = xpConnect->WrapJSAggregatedToNative(aContent, jscontext,
                                                        jsobj, aIID, aResult);
      if (NS_FAILED(rv))
        return rv;

      // We successfully created a wrapper.  We will own this wrapper for as long as the binding remains
      // alive.  At the time the binding is cleared out of the bindingManager, we will remove the wrapper
      // from the bindingManager as well.
      nsISupports* supp = NS_STATIC_CAST(nsISupports*, *aResult);
      wrappedJS = do_QueryInterface(supp);
      SetWrappedJS(aContent, wrappedJS);

      return rv;
    }
  }
  
  *aResult = nsnull;
  return NS_NOINTERFACE;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBindingManager::GetContentListFor ( nsIContent aContent,
nsIDOMNodeList **  aResult 
) [virtual]

Return a list of all explicit children, including any children that may have been inserted via XBL insertion points.

Implements nsIBindingManager.

Definition at line 496 of file nsBindingManager.cpp.

{ 
  // Locate the primary binding and get its node list of anonymous children.
  *aResult = nsnull;
  
  if (mContentListTable.ops) {
    *aResult = NS_STATIC_CAST(nsIDOMNodeList*,
                              LookupObject(mContentListTable, aContent));
    NS_IF_ADDREF(*aResult);
  }
  
  if (!*aResult) {
    nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aContent));
    return node->GetChildNodes(aResult);
  }

  return NS_OK;
}

Here is the call graph for this function:

nsIContent* nsBindingManager::GetEnclosingScope ( nsIContent aContent) [inline, protected]

Definition at line 174 of file nsBindingManager.h.

                                                      {
    return aContent->GetBindingParent();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBindingManager::GetInsertionParent ( nsIContent aContent,
nsIContent **  aResult 
) [virtual]

Implements nsIBindingManager.

Definition at line 392 of file nsBindingManager.cpp.

{ 
  if (mInsertionParentTable.ops) {
    *aResult = NS_STATIC_CAST(nsIContent*,
                              LookupObject(mInsertionParentTable, aContent));
    NS_IF_ADDREF(*aResult);
  }
  else {
    *aResult = nsnull;
  }

  return NS_OK;
}

Here is the call graph for this function:

nsIContent * nsBindingManager::GetInsertionPoint ( nsIContent aParent,
nsIContent aChild,
PRUint32 aIndex 
) [virtual]

Given a parent element and a child content, determine where the child content should be inserted in the parent element's anonymous content tree.

Specifically, aChild should be inserted beneath aResult at the index specified by aIndex.

Implements nsIBindingManager.

Definition at line 658 of file nsBindingManager.cpp.

{
  nsXBLBinding *binding = nsBindingManager::GetBinding(aParent);
  return binding ? binding->GetInsertionPoint(aChild, aIndex) : nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIBindingManager.

Definition at line 959 of file nsBindingManager.cpp.

{
  *aResult = nsnull;
  if (!mLoadingDocTable.IsInitialized())
    return NS_OK;

  mLoadingDocTable.Get(aURL, aResult);
  return NS_OK;
}

Here is the call graph for this function:

nsresult nsBindingManager::GetNestedInsertionPoint ( nsIContent aParent,
nsIContent aChild,
nsIContent **  aResult 
) [protected]

Definition at line 1188 of file nsBindingManager.cpp.

{
  *aResult = nsnull;

  // Check to see if the content is anonymous.
  if (aChild->GetBindingParent() == aParent)
    return NS_OK; // It is anonymous. Don't use the insertion point, since that's only
                  // for the explicit kids.

  PRUint32 index;
  nsIContent *insertionElement = GetInsertionPoint(aParent, aChild, &index);
  if (insertionElement != aParent) {
    // See if we nest even further in.
    nsCOMPtr<nsIContent> nestedPoint;
    GetNestedInsertionPoint(insertionElement, aChild, getter_AddRefs(nestedPoint));
    if (nestedPoint)
      insertionElement = nestedPoint;
  }

  *aResult = insertionElement;
  NS_IF_ADDREF(*aResult);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsIContent * nsBindingManager::GetSingleInsertionPoint ( nsIContent aParent,
PRUint32 aIndex,
PRBool aMultipleInsertionPoints 
) [virtual]

Return the unfiltered insertion point for the specified parent element.

If other filtered insertion points exist, aMultipleInsertionPoints will be set to true.

Implements nsIBindingManager.

Definition at line 666 of file nsBindingManager.cpp.

{
  nsXBLBinding *binding = nsBindingManager::GetBinding(aParent);
  if (binding)
    return binding->GetSingleInsertionPoint(aIndex, aMultipleInsertionPoints);

  *aMultipleInsertionPoints = PR_FALSE;
  return nsnull;
}

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 413 of file nsBindingManager.cpp.

{ 
  if (mWrapperTable.ops) {
    *aResult = NS_STATIC_CAST(nsIXPConnectWrappedJS*, LookupObject(mWrapperTable, aContent));
    NS_IF_ADDREF(*aResult);
  }
  else {
    *aResult = nsnull;
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Retrieves the anonymous list of children if the element has one; otherwise, retrieves the list of explicit children.

N.B. that if the explicit child list has not been altered by XBL insertion points, then aResult will be null.

Implements nsIBindingManager.

Definition at line 651 of file nsBindingManager.cpp.

{
  PRBool dummy;
  return GetXBLChildNodesInternal(aContent, aResult, &dummy);
}

Here is the call graph for this function:

nsresult nsBindingManager::GetXBLChildNodesInternal ( nsIContent aContent,
nsIDOMNodeList **  aResult,
PRBool aIsAnonymousContentList 
) [protected]

Definition at line 619 of file nsBindingManager.cpp.

{
  *aResult = nsnull;

  PRUint32 length;

  // Retrieve the anonymous content that we should build.
  GetAnonymousNodesInternal(aContent, aResult, aIsAnonymousContentList);
  if (*aResult) {
    (*aResult)->GetLength(&length);
    if (length == 0)
      *aResult = nsnull;
  }
    
  // We may have an altered list of children from XBL insertion points.
  // If we don't have any anonymous kids, we next check to see if we have 
  // insertion points.
  if (! *aResult) {
    if (mContentListTable.ops) {
      *aResult = NS_STATIC_CAST(nsIDOMNodeList*,
                                LookupObject(mContentListTable, aContent));
      NS_IF_ADDREF(*aResult);
      *aIsAnonymousContentList = PR_TRUE;
    }
  }

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIBindingManager.

Definition at line 934 of file nsBindingManager.cpp.

{
  *aResult = nsnull;
  if (!mDocumentTable.IsInitialized())
    return NS_OK;

  mDocumentTable.Get(aURL, aResult);
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBindingManager::HasContentListFor ( nsIContent aContent,
PRBool aResult 
) [virtual]

Determine whether or not the explicit child list has been altered by XBL insertion points.

Implements nsIBindingManager.

Definition at line 532 of file nsBindingManager.cpp.

{
  *aResult = PR_FALSE;
  if (mContentListTable.ops) {
    nsISupports* list = LookupObject(mContentListTable, aContent);
    *aResult = (list != nsnull);
  }

  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBindingManager::LoadBindingDocument ( nsIDocument aBoundDoc,
nsIURI aURL,
nsIDocument **  aResult 
) [virtual]

Implements nsIBindingManager.

Definition at line 754 of file nsBindingManager.cpp.

{
  NS_PRECONDITION(aURL, "Must have a URI to load!");
  
  nsCAutoString otherScheme;
  aURL->GetScheme(otherScheme);
  
  nsCAutoString scheme;
  aBoundDoc->GetDocumentURI()->GetScheme(scheme);

  // First we need to load our binding.
  *aResult = nsnull;
  nsresult rv;
  nsCOMPtr<nsIXBLService> xblService = 
           do_GetService("@mozilla.org/xbl;1", &rv);
  if (!xblService)
    return rv;

  // Load the binding doc.
  nsCOMPtr<nsIXBLDocumentInfo> info;
  xblService->LoadBindingDocumentInfo(nsnull, aBoundDoc, aURL,
                                      PR_TRUE, getter_AddRefs(info));
  if (!info)
    return NS_ERROR_FAILURE;

  // XXXbz Why is this based on a scheme comparison?  Shouldn't this
  // be a real security check???
    if (!strcmp(scheme.get(), otherScheme.get()))
    info->GetDocument(aResult); // Addref happens here.
    
  return NS_OK;
}

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 841 of file nsBindingManager.cpp.

{
  if (mProcessingAttachedStack || mAttachedStack.Count() == 0)
    return NS_OK;

  mProcessingAttachedStack = PR_TRUE;

  PRInt32 lastItem;
  while ((lastItem = mAttachedStack.Count() - 1) >= 0) {
    nsXBLBinding *binding = NS_STATIC_CAST(nsXBLBinding*,
                                           mAttachedStack.FastElementAt(lastItem));
    mAttachedStack.RemoveElementAt(lastItem);

    NS_ASSERTION(binding, "null item in attached stack?");
    binding->ExecuteAttachedHandler();
    NS_RELEASE(binding);
  }

  mProcessingAttachedStack = PR_FALSE;
  NS_ASSERTION(mAttachedStack.Count() == 0, "How did we get here?");
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIBindingManager.

Definition at line 945 of file nsBindingManager.cpp.

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 909 of file nsBindingManager.cpp.

{
  NS_PRECONDITION(aDocumentInfo, "Must have a non-null documentinfo!");
  
  NS_ENSURE_TRUE(mDocumentTable.IsInitialized() || mDocumentTable.Init(16),
                 NS_ERROR_OUT_OF_MEMORY);

  NS_ENSURE_TRUE(mDocumentTable.Put(aDocumentInfo->DocumentURI(),
                                    aDocumentInfo),
                 NS_ERROR_OUT_OF_MEMORY);

  return NS_OK;
}

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 702 of file nsBindingManager.cpp.

{
  // Hold a ref to the binding so it won't die when we remove it from our table
  nsRefPtr<nsXBLBinding> binding = nsBindingManager::GetBinding(aContent);
  
  if (!binding) {
    return NS_OK;
  }

  // For now we can only handle removing a binding if it's the only one
  NS_ENSURE_FALSE(binding->GetBaseBinding(), NS_ERROR_FAILURE);

  // Make sure that the binding has the URI that is requested to be removed
  nsIURI* bindingUri = binding->PrototypeBinding()->BindingURI();
  
  PRBool equalUri;
  nsresult rv = aURL->Equals(bindingUri, &equalUri);
  NS_ENSURE_SUCCESS(rv, rv);
  if (!equalUri) {
    return NS_OK;
  }

  // Make sure it isn't a style binding
  if (binding->IsStyleBinding()) {
    return NS_OK;
  }

  // Hold strong ref in case removing the binding tries to close the
  // window or something.
  // XXXbz should that be ownerdoc?  Wouldn't we need a ref to the
  // currentdoc too?  What's the one that should be passed to
  // ChangeDocument?
  nsCOMPtr<nsIDocument> doc = aContent->GetOwnerDoc();
  NS_ASSERTION(doc, "No owner document?");
  
  // Finally remove the binding...
  binding->UnhookEventHandlers();
  binding->ChangeDocument(doc, nsnull);
  SetBinding(aContent, nsnull);
  binding->MarkForDeath();
  
  // ...and recreate it's frames. We need to do this since the frames may have
  // been removed and style may have changed due to the removal of the
  // anonymous children.
  // XXXbz this should be using the current doc (if any), not the owner doc.
  nsIPresShell *presShell = doc->GetShellAt(0);
  NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);

  return presShell->RecreateFramesFor(aContent);;
}

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 970 of file nsBindingManager.cpp.

{
  if (!mLoadingDocTable.IsInitialized())
    return NS_OK;

  mLoadingDocTable.Remove(aURL);

  return NS_OK;
}

Here is the call graph for this function:

Implements nsIBindingManager.

Definition at line 924 of file nsBindingManager.cpp.

{
  if (!mDocumentTable.IsInitialized())
    return NS_OK;

  mDocumentTable.Remove(aDocumentInfo->DocumentURI());
  return NS_OK;
}

Here is the call graph for this function:

NS_IMETHODIMP nsBindingManager::ResolveTag ( nsIContent aContent,
PRInt32 aNameSpaceID,
nsIAtom **  aResult 
) [virtual]

Implements nsIBindingManager.

Definition at line 475 of file nsBindingManager.cpp.

{
  nsXBLBinding *binding = nsBindingManager::GetBinding(aContent);
  
  if (binding) {
    *aResult = binding->GetBaseTag(aNameSpaceID);

    if (*aResult) {
      NS_ADDREF(*aResult);
      return NS_OK;
    }
  }

  *aNameSpaceID = aContent->GetNameSpaceID();
  NS_ADDREF(*aResult = aContent->Tag());

  return NS_OK;
}

Here is the call graph for this function:

Set the anonymous child content for the specified element.

The binding manager assumes ownership of aList.

Implements nsIBindingManager.

Definition at line 578 of file nsBindingManager.cpp.

{
  nsIDOMNodeList* contentList = nsnull;
  if (aList) {
    contentList = new nsAnonymousContentList(aList);
    if (!contentList) {
      aList->EnumerateForwards(ReleaseInsertionPoint, nsnull);
      delete aList;
      return NS_ERROR_OUT_OF_MEMORY;
    }
  
    // If there are any items in aList that are already in aContent's
    // AnonymousNodesList, we need to make sure they don't get deleted as
    // the lists are swapped.  So, get the current list and check.
    // FIXME: This is O(n*m) where n and m are the insertion point list
    //        lengths.  But, there usually aren't many insertion points.

    if (mAnonymousNodesTable.ops) {
      nsAnonymousContentList *oldList =
        NS_STATIC_CAST(nsAnonymousContentList*,
                       LookupObject(mAnonymousNodesTable, aContent));
      if (oldList) {
        PRInt32 i = 0;
        while (i < oldList->GetInsertionPointCount()) {
          nsXBLInsertionPoint *point = oldList->GetInsertionPointAt(i);
          if (aList->IndexOf(point) != -1) {
            // We don't want this point to be deleted, so remove it
            // from the old list.
            oldList->RemoveInsertionPointAt(i);
          } else {
            ++i;
          }
        }
      }
    }
  }

  return SetOrRemoveObject(mAnonymousNodesTable, aContent, contentList);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBindingManager::SetBinding ( nsIContent aContent,
nsXBLBinding aBinding 
) [virtual]

Implements nsIBindingManager.

Definition at line 351 of file nsBindingManager.cpp.

{
  if (!mBindingTable.IsInitialized()) {
    if (!mBindingTable.Init())
      return NS_ERROR_OUT_OF_MEMORY;
  }

  // After this point, aBinding will be the most-derived binding for aContent.
  // If we already have a binding for aContent in our table, make sure to
  // remove it from the attached stack.  Otherwise we might end up firing its
  // constructor twice (if aBinding inherits from it) or firing its constructor
  // after aContent has been deleted (if aBinding is null and the content node
  // dies before we process mAttachedStack).
  nsXBLBinding* oldBinding = mBindingTable.GetWeak(aContent);
  if (oldBinding) {
    nsXBLBinding* oldBindingWithCtor =
      oldBinding->GetFirstBindingWithConstructor();
    if (oldBindingWithCtor && mAttachedStack.RemoveElement(oldBindingWithCtor)) {
      NS_RELEASE(oldBindingWithCtor);
    }
  }
  
  PRBool result = PR_TRUE;

  if (aBinding) {
    result = mBindingTable.Put(aContent, aBinding);
  } else {
    mBindingTable.Remove(aContent);

    // The death of the bindings means the death of the JS wrapper,
    // and the flushing of our explicit and anonymous insertion point
    // lists.
    SetWrappedJS(aContent, nsnull);
    SetContentListFor(aContent, nsnull);
    SetAnonymousNodesFor(aContent, nsnull);
  }

  return result ? NS_OK : NS_ERROR_FAILURE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Set the insertion point children for the specified element.

The binding manager assumes ownership of aList.

Implements nsIBindingManager.

Definition at line 516 of file nsBindingManager.cpp.

{
  nsIDOMNodeList* contentList = nsnull;
  if (aList) {
    contentList = new nsAnonymousContentList(aList);
    if (!contentList) {
      aList->EnumerateForwards(ReleaseInsertionPoint, nsnull);
      delete aList;
      return NS_ERROR_OUT_OF_MEMORY;
    }
  }

  return SetOrRemoveObject(mContentListTable, aContent, contentList);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBindingManager::SetInsertionParent ( nsIContent aContent,
nsIContent aResult 
) [virtual]

Implements nsIBindingManager.

Definition at line 407 of file nsBindingManager.cpp.

{
  return SetOrRemoveObject(mInsertionParentTable, aContent, aParent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Implements nsIBindingManager.

Definition at line 427 of file nsBindingManager.cpp.

{
  return SetOrRemoveObject(mWrapperTable, aContent, aWrappedJS);
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsBindingManager::ShouldBuildChildFrames ( nsIContent aContent,
PRBool aResult 
) [virtual]

Implements nsIBindingManager.

Definition at line 1175 of file nsBindingManager.cpp.

{
  *aResult = PR_TRUE;

  nsXBLBinding *binding = nsBindingManager::GetBinding(aContent);

  if (binding)
    *aResult = binding->ShouldBuildChildFrames();

  return NS_OK;
}

Here is the call graph for this function:

virtual void nsIDocumentObserver::StyleRuleAdded ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
) [pure virtual, inherited]

A StyleRule has just been added to a style sheet.

This method is called automatically when the rule gets added to the sheet. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been modified
aStyleRulethe rule that was added

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleRuleChanged ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aOldStyleRule,
nsIStyleRule aNewStyleRule 
) [pure virtual, inherited]

A StyleRule has just been modified within a style sheet.

This method is called automatically when the rule gets modified. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Since nsIStyleRule objects are immutable, there is a new object replacing the old one. However, the use of this method (rather than StyleRuleAdded and StyleRuleRemoved) implies that the new rule matches the same elements and has the same priority (weight, origin, specificity) as the old one. (However, if it is a CSS style rule, there may be a change in whether it has an important rule.)

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that contians the rule
aOldStyleRuleThe rule being removed. This rule may not be fully valid anymore -- however, it can still be used for pointer comparison and |QueryInterface|.
aNewStyleRuleThe rule being added.

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleRuleRemoved ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
nsIStyleRule aStyleRule 
) [pure virtual, inherited]

A StyleRule has just been removed from a style sheet.

This method is called automatically when the rule gets removed from the sheet. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been modified
aStyleRulethe rule that was removed

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleSheetAdded ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aDocumentSheet 
) [pure virtual, inherited]

A StyleSheet has just been added to the document.

This method is called automatically when a StyleSheet gets added to the document, even if the stylesheet is not applicable. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been added
aDocumentSheetTrue if sheet is in document's style sheet list, false if sheet is not (i.e., UA or user sheet)

Implemented in PresShell, and nsDOMStyleSheetList.

virtual void nsIDocumentObserver::StyleSheetApplicableStateChanged ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aApplicable 
) [pure virtual, inherited]

A StyleSheet has just changed its applicable state.

This method is called automatically when the applicable state of a StyleSheet gets changed. The style sheet passes this notification to the document. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has changed state
aApplicablePR_TRUE if the sheet is applicable, PR_FALSE if it is not applicable

Implemented in PresShell.

virtual void nsIDocumentObserver::StyleSheetRemoved ( nsIDocument aDocument,
nsIStyleSheet aStyleSheet,
PRBool  aDocumentSheet 
) [pure virtual, inherited]

A StyleSheet has just been removed from the document.

This method is called automatically when a StyleSheet gets removed from the document, even if the stylesheet is not applicable. The notification is passed on to all of the document observers.

Parameters:
aDocumentThe document being observed
aStyleSheetthe StyleSheet that has been removed
aDocumentSheetTrue if sheet is in document's style sheet list, false if sheet is not (i.e., UA or user sheet)

Implemented in PresShell, and nsDOMStyleSheetList.

NS_IMETHODIMP nsBindingManager::WalkRules ( nsStyleSet aStyleSet,
nsIStyleRuleProcessor::EnumFunc  aFunc,
RuleProcessorData aData,
PRBool aCutOffInheritance 
) [virtual]

Implements nsIStyleRuleSupplier.

Definition at line 1125 of file nsBindingManager.cpp.

{
  *aCutOffInheritance = PR_FALSE;
  
  if (!aData->mContent)
    return NS_OK;

  // Walk the binding scope chain, starting with the binding attached to our
  // content, up till we run out of scopes or we get cut off.
  nsIContent *content = aData->mContent;
  
  do {
    nsXBLBinding *binding = nsBindingManager::GetBinding(content);
    if (binding) {
      aData->mScopedRoot = content;
      binding->WalkRules(aFunc, aData);
      // If we're not looking at our original content, allow the binding to cut
      // off style inheritance
      if (content != aData->mContent) {
        if (!binding->InheritsStyle()) {
          // Go no further; we're not inheriting style from anything above here
          break;
        }
      }
    }

    nsIContent* parent = GetEnclosingScope(content);
    if (parent == content)
      break; // The scrollbar case only is deliberately hacked to return itself
             // (see GetBindingParent in nsXULElement.cpp).  Actually, all
             // native anonymous content is thus hacked.  Cut off inheritance
             // here.

    content = parent;
  } while (content);

  // If "content" is non-null that means we cut off inheritance at some point
  // in the loop.
  *aCutOffInheritance = (content != nsnull);

  // Null out the scoped root that we set repeatedly
  aData->mScopedRoot = nsnull;

  return NS_OK;
}

Here is the call graph for this function:


Friends And Related Function Documentation

friend struct ProcessAttachedQueueEvent [friend]

Definition at line 147 of file nsBindingManager.h.


Member Data Documentation

Definition at line 203 of file nsBindingManager.h.

Definition at line 230 of file nsBindingManager.h.

Definition at line 188 of file nsBindingManager.h.

Definition at line 194 of file nsBindingManager.h.

Definition at line 238 of file nsBindingManager.h.

Definition at line 222 of file nsBindingManager.h.

Definition at line 208 of file nsBindingManager.h.

Definition at line 227 of file nsBindingManager.h.

Definition at line 235 of file nsBindingManager.h.

Definition at line 231 of file nsBindingManager.h.

Definition at line 232 of file nsBindingManager.h.

Definition at line 217 of file nsBindingManager.h.


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