Bug 370332: Kill nsIBindingManager and nsIStyleRuleSupplier. r=dbaron for the layout/style parts, r/sr=jst for the rest.

This commit is contained in:
jonas%sicking.cc 2007-02-16 23:02:08 +00:00
parent 7299ef3901
commit 073b1fd3fe
44 changed files with 255 additions and 412 deletions

View File

@ -876,12 +876,10 @@ protected:
// We'd like these to be nsRefPtrs, but that'd require us to include
// additional headers that we don't want to expose.
// The cleanup is handled by the nsDocument destructor.
nsBindingManager* mBindingManager; // [STRONG]
nsNodeInfoManager* mNodeInfoManager; // [STRONG]
nsICSSLoader* mCSSLoader; // [STRONG; not a COMPtr to avoid
// including nsICSSLoader.h; the ownership
// is managed by nsDocument]
nsICSSLoader* mCSSLoader; // [STRONG]
// Table of element properties for this document.
nsPropertyTable mPropertyTable;

View File

@ -121,7 +121,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "jsdbgapi.h"
#include "nsIJSRuntimeService.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIURI.h"
#include "nsIURL.h"
#include "nsXBLBinding.h"

View File

@ -870,6 +870,8 @@ nsDocument::~nsDocument()
mStyleAttrStyleSheet->SetOwningDocument(nsnull);
}
NS_IF_RELEASE(mBindingManager);
delete mHeaderData;
delete mBoxObjectTable;
delete mContentWrapperHash;
@ -945,8 +947,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument, nsIDocument)
cb.NoteXPCOMChild(tmp->mChildren.ChildAt(indx - 1));
}
// Traverse all nsIDocument nsCOMPtrs.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBindingManager)
// Traverse all nsIDocument pointer members.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(mBindingManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSecurityInfo)
// Traverse all nsDocument nsCOMPtrs.
@ -1011,7 +1013,7 @@ nsDocument::Init()
// Force initialization.
nsBindingManager *bindingManager = new nsBindingManager();
NS_ENSURE_TRUE(bindingManager, NS_ERROR_OUT_OF_MEMORY);
mBindingManager = bindingManager;
NS_ADDREF(mBindingManager = bindingManager);
// The binding manager needs to come before everything but us in our
// mutation observer list.
@ -3646,6 +3648,24 @@ nsDocument::ClearBoxObjectFor(nsIContent* aContent)
}
}
nsresult
nsDocument::GetXBLChildNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult)
{
return mBindingManager->GetXBLChildNodesFor(aContent, aResult);
}
nsresult
nsDocument::GetContentListFor(nsIContent* aContent, nsIDOMNodeList** aResult)
{
return mBindingManager->GetContentListFor(aContent, aResult);
}
nsresult
nsDocument::FlushSkinBindings()
{
return mBindingManager->FlushSkinBindings();
}
struct DirTable {
const char* mName;
PRUint8 mValue;

View File

@ -70,7 +70,7 @@
#include "nsIDOM3Node.h"
#include "nsIPrincipal.h"
#include "nsIParser.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsINodeInfo.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOM3DocumentEvent.h"
@ -644,6 +644,12 @@ public:
NS_HIDDEN_(void) ClearBoxObjectFor(nsIContent* aContent);
virtual NS_HIDDEN_(nsresult) GetXBLChildNodesFor(nsIContent* aContent,
nsIDOMNodeList** aResult);
virtual NS_HIDDEN_(nsresult) GetContentListFor(nsIContent* aContent,
nsIDOMNodeList** aResult);
virtual NS_HIDDEN_(nsresult) FlushSkinBindings();
NS_DECL_CYCLE_COLLECTION_CLASS(nsDocument)
/**

View File

@ -60,6 +60,7 @@
#include "nsEventDispatcher.h"
#include "nsCOMArray.h"
#include "nsNodeUtils.h"
#include "nsBindingManager.h"
#include "pldhash.h"
#include "prprf.h"

View File

@ -83,7 +83,7 @@
#include "nsNodeUtils.h"
#include "nsDocument.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsXBLBinding.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMViewCSS.h"
@ -3678,7 +3678,7 @@ nsGenericElement::List(FILE* out, PRInt32 aIndent,
}
}
nsIBindingManager* bindingManager = document->BindingManager();
nsBindingManager* bindingManager = document->BindingManager();
nsCOMPtr<nsIDOMNodeList> anonymousChildren;
bindingManager->GetAnonymousNodesFor(NS_CONST_CAST(nsGenericElement*, this),
getter_AddRefs(anonymousChildren));

View File

@ -43,7 +43,7 @@
#include "nsIDOMEventReceiver.h"
#include "nsIDOMMutationEvent.h"
#include "nsMutationEvent.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsXBLBinding.h"
#include "nsStyleConsts.h"
#include "nsDOMError.h"
@ -548,7 +548,7 @@ nsSVGElement::GetOwnerSVGElement(nsIDOMSVGSVGElement * *aOwnerSVGElement)
{
*aOwnerSVGElement = nsnull;
nsIBindingManager *bindingManager = nsnull;
nsBindingManager *bindingManager = nsnull;
// XXXbz I _think_ this is right. We want to be using the binding manager
// that would have attached the binding that gives us our anonymous parent.
// That's the binding manager for the document we actually belong to, which

View File

@ -44,7 +44,7 @@
#include "nsSVGMatrix.h"
#include "nsISVGSVGElement.h"
#include "nsIDOMEventTarget.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIFrame.h"
#include "nsISVGChildFrame.h"
#include "nsIDOMSVGPoint.h"
@ -142,7 +142,7 @@ NS_IMETHODIMP nsSVGGraphicElement::GetCTM(nsIDOMSVGMatrix **_retval)
nsresult rv;
*_retval = nsnull;
nsIBindingManager *bindingManager = nsnull;
nsBindingManager *bindingManager = nsnull;
// XXXbz I _think_ this is right. We want to be using the binding manager
// that would have attached the binding that gives us our anonymous parent.
// That's the binding manager for the document we actually belong to, which
@ -184,7 +184,7 @@ NS_IMETHODIMP nsSVGGraphicElement::GetScreenCTM(nsIDOMSVGMatrix **_retval)
nsresult rv;
*_retval = nsnull;
nsIBindingManager *bindingManager = nsnull;
nsBindingManager *bindingManager = nsnull;
// XXXbz I _think_ this is right. We want to be using the binding manager
// that would have attached the binding that gives us our anonymous parent.
// That's the binding manager for the document we actually belong to, which

View File

@ -50,7 +50,7 @@
#include "nsSVGPoint.h"
#include "nsSVGTransform.h"
#include "nsIDOMEventTarget.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIFrame.h"
#include "nsISVGSVGFrame.h" //XXX
#include "nsSVGNumber.h"
@ -715,7 +715,7 @@ nsSVGSVGElement::GetCTM(nsIDOMSVGMatrix **_retval)
// first try to get the "screen" CTM of our nearest SVG ancestor
nsIBindingManager *bindingManager = nsnull;
nsBindingManager *bindingManager = nsnull;
// XXXbz I _think_ this is right. We want to be using the binding manager
// that would have attached the bindings that gives us our anonymous
// ancestors. That's the binding manager for the document we actually belong
@ -828,7 +828,7 @@ nsSVGSVGElement::GetScreenCTM(nsIDOMSVGMatrix **_retval)
// first try to get the "screen" CTM of our nearest SVG ancestor
nsIBindingManager *bindingManager = nsnull;
nsBindingManager *bindingManager = nsnull;
// XXXbz I _think_ this is right. We want to be using the binding manager
// that would have attached the bindings that gives us our anonymous
// ancestors. That's the binding manager for the document we actually belong

View File

@ -45,7 +45,6 @@ include $(DEPTH)/config/autoconf.mk
MODULE = content
EXPORTS = \
nsIBindingManager.h \
nsIXBLDocumentInfo.h \
nsIXBLService.h \
$(NULL)

View File

@ -1,206 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Communicator client code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: David W. Hyatt (hyatt@netscape.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* Private interface to the XBL Binding. This interface is currently
* undergoing deCOMtamination and some methods are only accessible from
* inside of gklayout.
*/
#ifndef nsIBinding_Manager_h__
#define nsIBinding_Manager_h__
#include "nsISupports.h"
class nsIContent;
class nsIDocument;
class nsXBLBinding;
class nsIXBLDocumentInfo;
class nsIAtom;
class nsIStreamListener;
class nsIURI;
class nsIXPConnectWrappedJS;
class nsIDOMNodeList;
class nsIMutationObserver;
class nsXBLInsertionPoint;
template<class E> class nsTArray;
template<class E> class nsRefPtr;
typedef nsTArray<nsRefPtr<nsXBLInsertionPoint> > nsInsertionPointList;
#define NS_IBINDING_MANAGER_IID \
{ 0xda349538, 0xfda2, 0x41ed, \
{ 0x9b, 0xba, 0x66, 0x56, 0x2c, 0x42, 0x49, 0x3d } }
class nsIBindingManager : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IBINDING_MANAGER_IID)
virtual nsXBLBinding* GetBinding(nsIContent* aContent) = 0;
NS_IMETHOD SetBinding(nsIContent* aContent, nsXBLBinding* aBinding) = 0;
NS_IMETHOD GetInsertionParent(nsIContent* aContent, nsIContent** aResult)=0;
NS_IMETHOD SetInsertionParent(nsIContent* aContent, nsIContent* aResult)=0;
NS_IMETHOD GetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS** aResult) = 0;
NS_IMETHOD SetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS* aResult) = 0;
/**
* 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.
* @param aContent the element that's being moved
* @param aOldDocument the old document in which the
* content resided. May be null if the the content
* was not in any document.
* @param aNewDocument the 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.
*/
NS_IMETHOD ChangeDocumentFor(nsIContent* aContent, nsIDocument* aOldDocument,
nsIDocument* aNewDocument) = 0;
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult) = 0;
/**
* Return a list of all explicit children, including any children
* that may have been inserted via XBL insertion points.
*/
NS_IMETHOD GetContentListFor(nsIContent* aContent, nsIDOMNodeList** aResult) = 0;
/**
* Set the insertion point children for the specified element.
* The binding manager assumes ownership of aList.
*/
NS_IMETHOD SetContentListFor(nsIContent* aContent,
nsInsertionPointList* aList) = 0;
/**
* Determine whether or not the explicit child list has been altered
* by XBL insertion points.
*/
NS_IMETHOD HasContentListFor(nsIContent* aContent, PRBool* aResult) = 0;
/**
* For a given element, retrieve the anonymous child content.
*/
NS_IMETHOD GetAnonymousNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult) = 0;
/**
* Set the anonymous child content for the specified element.
* The binding manager assumes ownership of aList.
*/
NS_IMETHOD SetAnonymousNodesFor(nsIContent* aContent,
nsInsertionPointList* aList) = 0;
/**
* 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.
*/
NS_IMETHOD GetXBLChildNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult) = 0;
/**
* 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.
*/
virtual nsIContent* GetInsertionPoint(nsIContent* aParent,
nsIContent* aChild,
PRUint32* aIndex) = 0;
/**
* Return the unfiltered insertion point for the specified parent
* element. If other filtered insertion points exist,
* aMultipleInsertionPoints will be set to true.
*/
virtual nsIContent* GetSingleInsertionPoint(nsIContent* aParent,
PRUint32* aIndex,
PRBool* aMultipleInsertionPoints) = 0;
NS_IMETHOD AddLayeredBinding(nsIContent* aContent, nsIURI* aURL) = 0;
NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL) = 0;
NS_IMETHOD LoadBindingDocument(nsIDocument* aDocument, nsIURI* aURL,
nsIDocument** aResult) = 0;
NS_IMETHOD AddToAttachedQueue(nsXBLBinding* aBinding)=0;
NS_IMETHOD ClearAttachedQueue()=0;
NS_IMETHOD ProcessAttachedQueue()=0;
NS_IMETHOD ExecuteDetachedHandlers()=0;
NS_IMETHOD PutXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo)=0;
NS_IMETHOD RemoveXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo)=0;
NS_IMETHOD GetXBLDocumentInfo(nsIURI* aURI, nsIXBLDocumentInfo** aResult)=0;
NS_IMETHOD PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener) = 0;
NS_IMETHOD GetLoadingDocListener(nsIURI* aURL, nsIStreamListener** aResult) = 0;
NS_IMETHOD RemoveLoadingDocListener(nsIURI* aURL) = 0;
NS_IMETHOD FlushSkinBindings() = 0;
NS_IMETHOD GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult)=0;
NS_IMETHOD ShouldBuildChildFrames(nsIContent* aContent, PRBool* aResult) = 0;
/**
* Add a new observer of document change notifications. Whenever content is
* changed, appended, inserted or removed the observers are informed. This
* is like nsIDocument::AddObserver, but these observers will be notified
* after the XBL data structures are updated for
* ContentInserted/ContentAppended and before they're updated for
* ContentRemoved.
*/
virtual void AddObserver(nsIMutationObserver* aObserver) = 0;
/**
* Remove an observer of document change notifications. This will
* return false if the observer cannot be found.
*/
virtual PRBool RemoveObserver(nsIMutationObserver* aObserver) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIBindingManager, NS_IBINDING_MANAGER_IID)
#endif // nsIBinding_Manager_h__

View File

@ -89,6 +89,11 @@ CPPSRCS = \
nsXBLInsertionPoint.cpp \
$(NULL)
EXPORTS = \
nsBindingManager.h \
nsXBLBinding.h \
$(NULL)
include $(topsrcdir)/config/config.mk
# we don't want the shared lib, but we want to force the creation of a static lib.

View File

@ -281,7 +281,7 @@ SetOrRemoveObject(PLDHashTable& table, nsISupports* aKey, nsISupports* aValue)
// Implement our nsISupports methods
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsBindingManager, nsIBindingManager)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsBindingManager, nsIMutationObserver)
if (tmp->mBindingTable.IsInitialized())
tmp->mBindingTable.Clear();
@ -355,7 +355,7 @@ XBLBindingHashtableTraverser(nsISupports* key,
return PL_DHASH_NEXT;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsBindingManager, nsIBindingManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsBindingManager, nsIMutationObserver)
if (tmp->mBindingTable.IsInitialized())
tmp->mBindingTable.EnumerateRead(&XBLBindingHashtableTraverser, &cb);
if (tmp->mDocumentTable.IsInitialized())
@ -367,15 +367,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_CLASS(nsBindingManager)
NS_INTERFACE_MAP_BEGIN(nsBindingManager)
NS_INTERFACE_MAP_ENTRY(nsIBindingManager)
NS_INTERFACE_MAP_ENTRY(nsIStyleRuleSupplier)
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIBindingManager)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY_CYCLE_COLLECTION(nsBindingManager)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(nsBindingManager, nsIBindingManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(nsBindingManager, nsIBindingManager)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsBindingManager)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsBindingManager)
// Constructors/Destructors
nsBindingManager::nsBindingManager(void)
@ -408,7 +406,7 @@ nsBindingManager::GetBinding(nsIContent* aContent)
return nsnull;
}
NS_IMETHODIMP
nsresult
nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
{
if (!mBindingTable.IsInitialized()) {
@ -445,7 +443,7 @@ nsBindingManager::SetBinding(nsIContent* aContent, nsXBLBinding* aBinding)
return result ? NS_OK : NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsresult
nsBindingManager::GetInsertionParent(nsIContent* aContent, nsIContent** aResult)
{
if (mInsertionParentTable.ops) {
@ -460,13 +458,13 @@ nsBindingManager::GetInsertionParent(nsIContent* aContent, nsIContent** aResult)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::SetInsertionParent(nsIContent* aContent, nsIContent* aParent)
{
return SetOrRemoveObject(mInsertionParentTable, aContent, aParent);
}
NS_IMETHODIMP
nsresult
nsBindingManager::GetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS** aResult)
{
if (mWrapperTable.ops) {
@ -480,13 +478,13 @@ nsBindingManager::GetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS** aRe
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::SetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS* aWrappedJS)
{
return SetOrRemoveObject(mWrapperTable, aContent, aWrappedJS);
}
NS_IMETHODIMP
nsresult
nsBindingManager::ChangeDocumentFor(nsIContent* aContent, nsIDocument* aOldDocument,
nsIDocument* aNewDocument)
{
@ -528,7 +526,7 @@ nsBindingManager::ChangeDocumentFor(nsIContent* aContent, nsIDocument* aOldDocum
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID,
nsIAtom** aResult)
{
@ -549,7 +547,7 @@ nsBindingManager::ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::GetContentListFor(nsIContent* aContent, nsIDOMNodeList** aResult)
{
// Locate the primary binding and get its node list of anonymous children.
@ -569,7 +567,7 @@ nsBindingManager::GetContentListFor(nsIContent* aContent, nsIDOMNodeList** aResu
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::SetContentListFor(nsIContent* aContent,
nsInsertionPointList* aList)
{
@ -585,7 +583,7 @@ nsBindingManager::SetContentListFor(nsIContent* aContent,
return SetOrRemoveObject(mContentListTable, aContent, contentList);
}
NS_IMETHODIMP
nsresult
nsBindingManager::HasContentListFor(nsIContent* aContent, PRBool* aResult)
{
*aResult = PR_FALSE;
@ -623,7 +621,7 @@ nsBindingManager::GetAnonymousNodesInternal(nsIContent* aContent,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::GetAnonymousNodesFor(nsIContent* aContent,
nsIDOMNodeList** aResult)
{
@ -631,7 +629,7 @@ nsBindingManager::GetAnonymousNodesFor(nsIContent* aContent,
return GetAnonymousNodesInternal(aContent, aResult, &dummy);
}
NS_IMETHODIMP
nsresult
nsBindingManager::SetAnonymousNodesFor(nsIContent* aContent,
nsInsertionPointList* aList)
{
@ -704,7 +702,7 @@ nsBindingManager::GetXBLChildNodesInternal(nsIContent* aContent,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::GetXBLChildNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult)
{
PRBool dummy;
@ -732,7 +730,7 @@ nsBindingManager::GetSingleInsertionPoint(nsIContent* aParent,
return nsnull;
}
NS_IMETHODIMP
nsresult
nsBindingManager::AddLayeredBinding(nsIContent* aContent, nsIURI* aURL)
{
// First we need to load our binding.
@ -755,7 +753,7 @@ nsBindingManager::AddLayeredBinding(nsIContent* aContent, nsIURI* aURL)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL)
{
// Hold a ref to the binding so it won't die when we remove it from our table
@ -807,7 +805,7 @@ nsBindingManager::RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL)
return presShell->RecreateFramesFor(aContent);;
}
NS_IMETHODIMP
nsresult
nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc,
nsIURI* aURL,
nsIDocument** aResult)
@ -843,7 +841,7 @@ nsBindingManager::LoadBindingDocument(nsIDocument* aBoundDoc,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::AddToAttachedQueue(nsXBLBinding* aBinding)
{
if (!mAttachedStack.AppendElement(aBinding))
@ -852,14 +850,14 @@ nsBindingManager::AddToAttachedQueue(nsXBLBinding* aBinding)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::ClearAttachedQueue()
{
mAttachedStack.Clear();
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::ProcessAttachedQueue()
{
if (mProcessingAttachedStack)
@ -903,7 +901,7 @@ ExecuteDetachedHandler(void* aBinding, void* aClosure)
return PR_TRUE;
}
NS_IMETHODIMP
nsresult
nsBindingManager::ExecuteDetachedHandlers()
{
// Walk our hashtable of bindings.
@ -915,7 +913,7 @@ nsBindingManager::ExecuteDetachedHandlers()
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::PutXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo)
{
NS_PRECONDITION(aDocumentInfo, "Must have a non-null documentinfo!");
@ -930,7 +928,7 @@ nsBindingManager::PutXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::RemoveXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo)
{
if (!mDocumentTable.IsInitialized())
@ -940,7 +938,7 @@ nsBindingManager::RemoveXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::GetXBLDocumentInfo(nsIURI* aURL, nsIXBLDocumentInfo** aResult)
{
*aResult = nsnull;
@ -951,7 +949,7 @@ nsBindingManager::GetXBLDocumentInfo(nsIURI* aURL, nsIXBLDocumentInfo** aResult)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener)
{
NS_PRECONDITION(aListener, "Must have a non-null listener!");
@ -965,7 +963,7 @@ nsBindingManager::PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListen
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::GetLoadingDocListener(nsIURI* aURL, nsIStreamListener** aResult)
{
*aResult = nsnull;
@ -976,7 +974,7 @@ nsBindingManager::GetLoadingDocListener(nsIURI* aURL, nsIStreamListener** aResul
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::RemoveLoadingDocListener(nsIURI* aURL)
{
if (!mLoadingDocTable.IsInitialized())
@ -1002,7 +1000,7 @@ MarkForDeath(nsISupports *aKey, nsXBLBinding *aBinding, void* aClosure)
return PL_DHASH_NEXT;
}
NS_IMETHODIMP
nsresult
nsBindingManager::FlushSkinBindings()
{
if (mBindingTable.IsInitialized())
@ -1022,7 +1020,7 @@ struct AntiRecursionData {
: element(aElement), iid(aIID), next(aNext) {}
};
NS_IMETHODIMP
nsresult
nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
void** aResult)
{
@ -1131,7 +1129,7 @@ nsBindingManager::GetBindingImplementation(nsIContent* aContent, REFNSIID aIID,
return NS_NOINTERFACE;
}
NS_IMETHODIMP
nsresult
nsBindingManager::WalkRules(nsStyleSet* aStyleSet,
nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData,
@ -1161,7 +1159,7 @@ nsBindingManager::WalkRules(nsStyleSet* aStyleSet,
}
}
nsIContent* parent = GetEnclosingScope(content);
nsIContent* parent = content->GetBindingParent();
if (parent == content)
break; // The scrollbar case only is deliberately hacked to return itself
// (see GetBindingParent in nsXULElement.cpp). Actually, all
@ -1181,7 +1179,7 @@ nsBindingManager::WalkRules(nsStyleSet* aStyleSet,
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsBindingManager::ShouldBuildChildFrames(nsIContent* aContent, PRBool* aResult)
{
*aResult = PR_TRUE;

View File

@ -40,14 +40,14 @@
#ifndef nsBindingManager_h_
#define nsBindingManager_h_
#include "nsIBindingManager.h"
#include "nsIStyleRuleSupplier.h"
#include "nsIMutationObserver.h"
#include "pldhash.h"
#include "nsInterfaceHashtable.h"
#include "nsRefPtrHashtable.h"
#include "nsURIHashKey.h"
#include "nsCycleCollectionParticipant.h"
#include "nsXBLBinding.h"
#include "nsTArray.h"
class nsIContent;
class nsIXPConnectWrappedJS;
@ -58,13 +58,11 @@ class nsIURI;
class nsIXBLDocumentInfo;
class nsIStreamListener;
class nsStyleSet;
template<class E> class nsTArray;
class nsXBLBinding;
template<class E> class nsRefPtr;
typedef nsTArray<nsRefPtr<nsXBLBinding> > nsBindingList;
class nsBindingManager : public nsIBindingManager,
public nsIStyleRuleSupplier,
public nsIMutationObserver
class nsBindingManager : public nsIMutationObserver
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -73,71 +71,138 @@ public:
nsBindingManager();
~nsBindingManager();
virtual nsXBLBinding* GetBinding(nsIContent* aContent);
NS_IMETHOD SetBinding(nsIContent* aContent, nsXBLBinding* aBinding);
nsXBLBinding* GetBinding(nsIContent* aContent);
nsresult SetBinding(nsIContent* aContent, nsXBLBinding* aBinding);
NS_IMETHOD GetInsertionParent(nsIContent* aContent, nsIContent** aResult);
NS_IMETHOD SetInsertionParent(nsIContent* aContent, nsIContent* aResult);
nsresult GetInsertionParent(nsIContent* aContent, nsIContent** aResult);
nsresult SetInsertionParent(nsIContent* aContent, nsIContent* aResult);
NS_IMETHOD GetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS** aResult);
NS_IMETHOD SetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS* aResult);
nsresult GetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS** aResult);
nsresult 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.
* @param aContent the element that's being moved
* @param aOldDocument the old document in which the
* content resided. May be null if the the content
* was not in any document.
* @param aNewDocument the 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.
*/
nsresult ChangeDocumentFor(nsIContent* aContent, nsIDocument* aOldDocument,
nsIDocument* aNewDocument);
NS_IMETHOD ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
nsresult ResolveTag(nsIContent* aContent, PRInt32* aNameSpaceID, nsIAtom** aResult);
NS_IMETHOD GetContentListFor(nsIContent* aContent, nsIDOMNodeList** aResult);
NS_IMETHOD SetContentListFor(nsIContent* aContent,
nsInsertionPointList* aList);
NS_IMETHOD HasContentListFor(nsIContent* aContent, PRBool* aResult);
/**
* Return a list of all explicit children, including any children
* that may have been inserted via XBL insertion points.
*/
nsresult GetContentListFor(nsIContent* aContent, nsIDOMNodeList** aResult);
NS_IMETHOD GetAnonymousNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult);
NS_IMETHOD SetAnonymousNodesFor(nsIContent* aContent,
nsInsertionPointList* aList);
/**
* Set the insertion point children for the specified element.
* The binding manager assumes ownership of aList.
*/
nsresult SetContentListFor(nsIContent* aContent,
nsInsertionPointList* aList);
NS_IMETHOD GetXBLChildNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult);
/**
* Determine whether or not the explicit child list has been altered
* by XBL insertion points.
*/
nsresult HasContentListFor(nsIContent* aContent, PRBool* aResult);
/**
* For a given element, retrieve the anonymous child content.
*/
nsresult GetAnonymousNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult);
/**
* Set the anonymous child content for the specified element.
* The binding manager assumes ownership of aList.
*/
nsresult SetAnonymousNodesFor(nsIContent* aContent,
nsInsertionPointList* aList);
/**
* 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.
*/
nsresult GetXBLChildNodesFor(nsIContent* aContent, nsIDOMNodeList** aResult);
/**
* 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.
*/
virtual nsIContent* GetInsertionPoint(nsIContent* aParent,
nsIContent* aChild, PRUint32* aIndex);
/**
* Return the unfiltered insertion point for the specified parent
* element. If other filtered insertion points exist,
* aMultipleInsertionPoints will be set to true.
*/
virtual nsIContent* GetSingleInsertionPoint(nsIContent* aParent,
PRUint32* aIndex,
PRBool* aMultipleInsertionPoints);
NS_IMETHOD AddLayeredBinding(nsIContent* aContent, nsIURI* aURL);
NS_IMETHOD RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL);
NS_IMETHOD LoadBindingDocument(nsIDocument* aBoundDoc, nsIURI* aURL,
nsIDocument** aResult);
nsresult AddLayeredBinding(nsIContent* aContent, nsIURI* aURL);
nsresult RemoveLayeredBinding(nsIContent* aContent, nsIURI* aURL);
nsresult LoadBindingDocument(nsIDocument* aBoundDoc, nsIURI* aURL,
nsIDocument** aResult);
NS_IMETHOD AddToAttachedQueue(nsXBLBinding* aBinding);
NS_IMETHOD ClearAttachedQueue();
NS_IMETHOD ProcessAttachedQueue();
nsresult AddToAttachedQueue(nsXBLBinding* aBinding);
nsresult ClearAttachedQueue();
nsresult ProcessAttachedQueue();
NS_IMETHOD ExecuteDetachedHandlers();
nsresult ExecuteDetachedHandlers();
NS_IMETHOD PutXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo);
NS_IMETHOD GetXBLDocumentInfo(nsIURI* aURI, nsIXBLDocumentInfo** aResult);
NS_IMETHOD RemoveXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo);
nsresult PutXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo);
nsresult GetXBLDocumentInfo(nsIURI* aURI, nsIXBLDocumentInfo** aResult);
nsresult RemoveXBLDocumentInfo(nsIXBLDocumentInfo* aDocumentInfo);
NS_IMETHOD PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener);
NS_IMETHOD GetLoadingDocListener(nsIURI* aURL, nsIStreamListener** aResult);
NS_IMETHOD RemoveLoadingDocListener(nsIURI* aURL);
nsresult PutLoadingDocListener(nsIURI* aURL, nsIStreamListener* aListener);
nsresult GetLoadingDocListener(nsIURI* aURL, nsIStreamListener** aResult);
nsresult RemoveLoadingDocListener(nsIURI* aURL);
NS_IMETHOD FlushSkinBindings();
nsresult FlushSkinBindings();
NS_IMETHOD GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult);
nsresult GetBindingImplementation(nsIContent* aContent, REFNSIID aIID, void** aResult);
NS_IMETHOD ShouldBuildChildFrames(nsIContent* aContent, PRBool* aResult);
nsresult ShouldBuildChildFrames(nsIContent* aContent, PRBool* aResult);
virtual NS_HIDDEN_(void) AddObserver(nsIMutationObserver* aObserver);
/**
* Add a new observer of document change notifications. Whenever content is
* changed, appended, inserted or removed the observers are informed. This
* is like nsIDocument::AddObserver, but these observers will be notified
* after the XBL data structures are updated for
* ContentInserted/ContentAppended and before they're updated for
* ContentRemoved.
*/
void AddObserver(nsIMutationObserver* aObserver);
virtual NS_HIDDEN_(PRBool) RemoveObserver(nsIMutationObserver* aObserver);
/**
* Remove an observer of document change notifications. This will
* return false if the observer cannot be found.
*/
PRBool RemoveObserver(nsIMutationObserver* aObserver);
// nsIStyleRuleSupplier
NS_IMETHOD WalkRules(nsStyleSet* aStyleSet,
nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData,
PRBool* aCutOffInheritance);
// Style rule methods
nsresult WalkRules(nsStyleSet* aStyleSet,
nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData,
PRBool* aCutOffInheritance);
NS_DECL_CYCLE_COLLECTION_CLASS(nsBindingManager)
@ -149,10 +214,6 @@ protected:
nsIDOMNodeList** aResult,
PRBool* aIsAnonymousContentList);
nsIContent* GetEnclosingScope(nsIContent* aContent) {
return aContent->GetBindingParent();
}
nsresult GetNestedInsertionPoint(nsIContent* aParent, nsIContent* aChild, nsIContent** aResult);
#define NS_BINDINGMANAGER_NOTIFY_OBSERVERS(func_, params_) \

View File

@ -263,10 +263,10 @@ struct EnumData {
};
struct ContentListData : public EnumData {
nsIBindingManager* mBindingManager;
nsresult mRv;
nsBindingManager* mBindingManager;
nsresult mRv;
ContentListData(nsXBLBinding* aBinding, nsIBindingManager* aManager)
ContentListData(nsXBLBinding* aBinding, nsBindingManager* aManager)
:EnumData(aBinding), mBindingManager(aManager), mRv(NS_OK)
{};
};
@ -277,7 +277,7 @@ BuildContentLists(nsISupports* aKey,
void* aClosure)
{
ContentListData* data = (ContentListData*)aClosure;
nsIBindingManager* bm = data->mBindingManager;
nsBindingManager* bm = data->mBindingManager;
nsXBLBinding* binding = data->mBinding;
nsIContent *boundElement = binding->GetBoundElement();
@ -366,7 +366,7 @@ RealizeDefaultContent(nsISupports* aKey,
void* aClosure)
{
ContentListData* data = (ContentListData*)aClosure;
nsIBindingManager* bm = data->mBindingManager;
nsBindingManager* bm = data->mBindingManager;
nsXBLBinding* binding = data->mBinding;
PRInt32 count = aData->Length();
@ -480,7 +480,7 @@ nsXBLBinding::GenerateAnonymousContent()
if (! doc)
return;
nsIBindingManager *bindingManager = doc->BindingManager();
nsBindingManager *bindingManager = doc->BindingManager();
nsCOMPtr<nsIDOMNodeList> children;
bindingManager->GetContentListFor(mBoundElement, getter_AddRefs(children));
@ -961,7 +961,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
// Make sure that henceforth we don't claim that mBoundElement's children
// have insertion parents in the old document.
nsIBindingManager* bindingManager = aOldDocument->BindingManager();
nsBindingManager* bindingManager = aOldDocument->BindingManager();
for (PRUint32 i = mBoundElement->GetChildCount(); i > 0; --i) {
NS_ASSERTION(mBoundElement->GetChildAt(i-1),
"Must have child at i for 0 <= i < GetChildCount()!");

View File

@ -36,6 +36,9 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsXBLBinding_h_
#define nsXBLBinding_h_
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
#include "nsIDOMNodeList.h"
@ -49,6 +52,8 @@ class nsIAtom;
class nsIDocument;
class nsIScriptContext;
class nsObjectHashtable;
class nsXBLInsertionPoint;
typedef nsTArray<nsRefPtr<nsXBLInsertionPoint> > nsInsertionPointList;
struct JSContext;
struct JSObject;
@ -91,7 +96,7 @@ public:
}
nsXBLPrototypeBinding* PrototypeBinding() { return mPrototypeBinding; }
nsIContent* GetAnonymousContent() { return mContent; }
nsIContent* GetAnonymousContent() { return mContent.get(); }
nsXBLBinding* GetBaseBinding() { return mNextBinding; }
void SetBaseBinding(nsXBLBinding *aBinding);
@ -170,3 +175,5 @@ protected:
PRPackedBool mIsStyleBinding;
PRPackedBool mMarkedForDeath;
};
#endif // nsXBLBinding_h_

View File

@ -38,7 +38,7 @@
#include "nsXBLContentSink.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIDOMNode.h"
#include "nsIParser.h"
#include "nsGkAtoms.h"

View File

@ -108,7 +108,7 @@ IsAncestorBinding(nsIDocument* aDocument,
NS_ASSERTION(aChild, "expected a child content");
nsIContent* bindingParent = aChild->GetBindingParent();
nsIBindingManager* bindingManager = aDocument->BindingManager();
nsBindingManager* bindingManager = aDocument->BindingManager();
for (nsIContent* prev = aChild;
bindingParent && prev != bindingParent;
prev = bindingParent, bindingParent = bindingParent->GetBindingParent()) {
@ -409,7 +409,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
}
// Remove ourselves from the set of pending docs.
nsIBindingManager *bindingManager = doc->BindingManager();
nsBindingManager *bindingManager = doc->BindingManager();
nsIURI* documentURI = mBindingDocument->GetDocumentURI();
bindingManager->RemoveLoadingDocListener(documentURI);
@ -420,7 +420,7 @@ nsXBLStreamListener::Load(nsIDOMEvent* aEvent)
// Put our doc info in the doc table.
nsCOMPtr<nsIXBLDocumentInfo> info;
nsIBindingManager *xblDocBindingManager = mBindingDocument->BindingManager();
nsBindingManager *xblDocBindingManager = mBindingDocument->BindingManager();
xblDocBindingManager->GetXBLDocumentInfo(documentURI, getter_AddRefs(info));
xblDocBindingManager->RemoveXBLDocumentInfo(info); // Break the self-imposed cycle.
if (!info) {
@ -543,7 +543,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, nsIURI* aURL, PRBool aAugmentFl
if (!document)
return NS_OK;
nsIBindingManager *bindingManager = document->BindingManager();
nsBindingManager *bindingManager = document->BindingManager();
nsXBLBinding *binding = bindingManager->GetBinding(aContent);
if (binding && !aAugmentFlag) {
@ -682,7 +682,7 @@ nsXBLService::FlushStyleBindings(nsIContent* aContent)
if (! document)
return NS_OK;
nsIBindingManager *bindingManager = document->BindingManager();
nsBindingManager *bindingManager = document->BindingManager();
nsXBLBinding *binding = bindingManager->GetBinding(aContent);
@ -1072,7 +1072,7 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
if (!info) {
// The second line of defense is the binding manager's document table.
nsIBindingManager *bindingManager = nsnull;
nsBindingManager *bindingManager = nsnull;
nsCOMPtr<nsIURL> bindingURL(do_QueryInterface(aBindingURI, &rv));
NS_ENSURE_SUCCESS(rv, rv);
@ -1126,7 +1126,7 @@ nsXBLService::LoadBindingDocumentInfo(nsIContent* aBoundElement,
bindingURL, aForceSyncLoad, getter_AddRefs(document));
if (document) {
nsIBindingManager *xblDocBindingManager = document->BindingManager();
nsBindingManager *xblDocBindingManager = document->BindingManager();
xblDocBindingManager->GetXBLDocumentInfo(documentURI, getter_AddRefs(info));
if (!info) {
NS_ERROR("An XBL file is malformed. Did you forget the XBL namespace on the bindings tag?");
@ -1212,7 +1212,7 @@ nsXBLService::FetchBindingDocument(nsIContent* aBoundElement, nsIDocument* aBoun
rec->AddEventListener(NS_LITERAL_STRING("load"), (nsIDOMLoadListener*)xblListener, PR_FALSE);
// Add ourselves to the list of loading docs.
nsIBindingManager *bindingManager;
nsBindingManager *bindingManager;
if (aBoundDocument)
bindingManager = aBoundDocument->BindingManager();
else

View File

@ -43,7 +43,6 @@
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIDOMViewCSS.h"
#include "nsIDOMDocumentXBL.h"
#include "nsIBindingManager.h"
#include "nsIObserver.h"
#include "nsIXSLTProcessor.h"
#include "nsSyncLoadService.h"
@ -54,6 +53,7 @@
#include "nsNetUtil.h"
#include "nsIContent.h"
#include "nsIDOMDocumentFragment.h"
#include "nsBindingManager.h"
NS_IMPL_ISUPPORTS2(nsXMLPrettyPrinter,
nsIDocumentObserver,

View File

@ -65,7 +65,7 @@
#include "nsIRDFCompositeDataSource.h"
#include "nsIRDFResource.h"
#include "nsIScriptObjectOwner.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIURI.h"
#include "nsIXULPrototypeCache.h"
#include "nsIXULTemplateBuilder.h"

View File

@ -64,7 +64,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMXULElement.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIDOMNodeList.h"
#include "nsINameSpaceManager.h"
#include "nsIRDFCompositeDataSource.h"

View File

@ -184,7 +184,7 @@
// XBL related includes.
#include "nsIXBLService.h"
#include "nsXBLBinding.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsIDOMViewCSS.h"

View File

@ -172,7 +172,7 @@
#include "nsIDOMXULDocument.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIXBLService.h"
// used for popup blocking, needs to be converted to something

View File

@ -52,7 +52,6 @@
#include "nsIDOMNodeList.h"
#include "nsIDOMXPathResult.h"
#include "nsIContent.h"
#include "nsIBindingManager.h"
#include "nsXFormsControlStub.h"
#include "nsIXFormsContextControl.h"
@ -770,16 +769,13 @@ nsXFormsRepeatElement::InsertTemplateContent(nsIDOMNode *aNode)
NS_ENSURE_STATE(domDocument);
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDocument));
nsCOMPtr<nsIBindingManager> bindingMgr(document->BindingManager());
NS_ENSURE_STATE(bindingMgr);
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
NS_ENSURE_STATE(content);
// Get a list of all explicit children, including any children that may have
// been inserted via XBL insertion points.
nsCOMPtr<nsIDOMNodeList> children;
bindingMgr->GetContentListFor(content, getter_AddRefs(children));
document->GetContentListFor(content, getter_AddRefs(children));
PRUint32 length = 0;
children->GetLength(&length);

View File

@ -96,7 +96,7 @@
#include "nsLegendFrame.h"
#include "nsIContentIterator.h"
#include "nsBoxLayoutState.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsXBLBinding.h"
#include "nsITheme.h"
#include "nsContentCID.h"
@ -140,7 +140,6 @@
#include "nsIScrollableFrame.h"
#include "nsIXBLService.h"
#include "nsIStyleRuleSupplier.h"
#undef NOISY_FIRST_LETTER
@ -4383,9 +4382,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIContent* aDocElement,
// Set up our style rule observer.
{
nsCOMPtr<nsIStyleRuleSupplier> ruleSupplier =
do_QueryInterface(mDocument->BindingManager());
mPresShell->StyleSet()->SetStyleRuleSupplier(ruleSupplier);
mPresShell->StyleSet()->SetBindingManager(mDocument->BindingManager());
}
// --------- BUILD VIEWPORT -----------
@ -8272,7 +8269,7 @@ nsCSSFrameConstructor::ContentAppended(nsIContent* aContainer,
PRBool hasInsertion = PR_FALSE;
if (!multiple) {
nsIBindingManager *bindingManager = nsnull;
nsBindingManager *bindingManager = nsnull;
nsIDocument* document = nsnull;
nsIContent *firstAppendedChild =
aContainer->GetChildAt(aNewIndexInContainer);
@ -10928,7 +10925,7 @@ nsCSSFrameConstructor::GetInsertionPoint(nsIFrame* aParentFrame,
if (!container)
return NS_OK;
nsIBindingManager *bindingManager = mDocument->BindingManager();
nsBindingManager *bindingManager = mDocument->BindingManager();
nsIContent* insertionElement;
if (aChildContent) {

View File

@ -43,7 +43,7 @@
#include "nsChildIterator.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
nsresult
ChildIterator::Init(nsIContent* aContent,

View File

@ -71,7 +71,6 @@
#include "nsIContent.h"
#include "nsINameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsIScrollableFrame.h"
#include "nsIHTMLDocument.h"

View File

@ -185,7 +185,6 @@
// For style data reconstruction
#include "nsStyleChangeList.h"
#include "nsCSSFrameConstructor.h"
#include "nsIBindingManager.h"
#ifdef MOZ_XUL
#include "nsIMenuFrame.h"
#include "nsITreeBoxObject.h"

View File

@ -130,7 +130,7 @@ inDOMUtils::GetParentForNode(nsIDOMNode* aNode,
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
if (content) {
nsCOMPtr<nsIContent> bparent;
nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
nsRefPtr<nsBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
if (bindingManager) {
bindingManager->GetInsertionParent(content, getter_AddRefs(bparent));
}

View File

@ -52,7 +52,7 @@
#include "nsIDOMDocument.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMMutationEvent.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIDocument.h"
#include "nsIServiceManager.h"
#include "nsITreeColumns.h"
@ -1243,7 +1243,7 @@ inDOMView::GetChildNodesFor(nsIDOMNode* aNode, nsCOMArray<nsIDOMNode>& aResult)
if (mShowAnonymous) {
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
if (content) {
nsCOMPtr<nsIBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
nsRefPtr<nsBindingManager> bindingManager = inLayoutUtils::GetBindingManagerFor(aNode);
if (bindingManager) {
bindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));
if (!kids) {

View File

@ -271,7 +271,7 @@ inDeepTreeWalker::PushNode(nsIDOMNode* aNode)
if (!kids) {
if (mShowAnonymousContent) {
nsCOMPtr<nsIContent> content = do_QueryInterface(aNode);
nsCOMPtr<nsIBindingManager> bindingManager;
nsRefPtr<nsBindingManager> bindingManager;
if (content &&
(bindingManager = inLayoutUtils::GetBindingManagerFor(aNode))) {
bindingManager->GetAnonymousNodesFor(content, getter_AddRefs(kids));

View File

@ -145,7 +145,7 @@ inLayoutUtils::GetClientOrigin(nsIFrame* aFrame)
return result;
}
nsIBindingManager*
nsBindingManager*
inLayoutUtils::GetBindingManagerFor(nsIDOMNode* aNode)
{
nsCOMPtr<nsIDOMDocument> domdoc;

View File

@ -46,7 +46,7 @@
#include "nsIRenderingContext.h"
#include "nsIEventStateManager.h"
#include "nsIDOMDocument.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
class inLayoutUtils
{
@ -57,7 +57,7 @@ public:
static nsIFrame* GetFrameFor(nsIDOMElement* aElement, nsIPresShell* aShell);
static already_AddRefed<nsIRenderingContext> GetRenderingContextFor(nsIPresShell* aShell);
static nsIEventStateManager* GetEventStateManagerFor(nsIDOMElement *aElement);
static nsIBindingManager* GetBindingManagerFor(nsIDOMNode* aNode);
static nsBindingManager* GetBindingManagerFor(nsIDOMNode* aNode);
static nsIDOMDocument* GetSubDocumentFor(nsIDOMNode* aNode);
static nsIDOMNode* GetContainerFor(nsIDOMDocument* aDoc);
/**

View File

@ -104,7 +104,6 @@ EXPORTS = \
nsIInspectorCSSUtils.h \
nsIStyleRule.h \
nsIStyleRuleProcessor.h \
nsIStyleRuleSupplier.h \
nsIStyleSheet.h \
nsLayoutStylesheetCache.h \
nsRuleData.h \

View File

@ -1,32 +0,0 @@
/*
* internal interface that allows XBL code to provide additional style
* rules matching an element
*/
#ifndef _nsIStyleRuleSupplier_h
#define _nsIStyleRuleSupplier_h
#include "nsISupports.h"
#include "nsIStyleRuleProcessor.h"
// {2D77A45B-4F3A-4203-A7D2-F4B84D0C1EE4}
#define NS_ISTYLERULESUPPLIER_IID \
{ 0x2d77a45b, 0x4f3a, 0x4203, { 0xa7, 0xd2, 0xf4, 0xb8, 0x4d, 0xc, 0x1e, 0xe4 } }
class nsIContent;
class nsStyleSet;
class nsIStyleRuleSupplier : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLERULESUPPLIER_IID)
NS_IMETHOD WalkRules(nsStyleSet* aStyleSet,
nsIStyleRuleProcessor::EnumFunc aFunc,
RuleProcessorData* aData,
PRBool* aCutOffInheritance)=0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleRuleSupplier, NS_ISTYLERULESUPPLIER_IID)
#endif /* _nsIStyleRuleSupplier_h */

View File

@ -53,6 +53,7 @@
#include "nsXBLPrototypeBinding.h"
#include "nsIDOMElement.h"
#include "nsIMutableArray.h"
#include "nsBindingManager.h"
nsInspectorCSSUtils::nsInspectorCSSUtils()
{

View File

@ -471,10 +471,10 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
nsRuleNode* lastHTMLPresHintRN = mRuleWalker->GetCurrentNode();
PRBool cutOffInheritance = PR_FALSE;
if (mStyleRuleSupplier) {
if (mBindingManager) {
// We can supply additional document-level sheets that should be walked.
mStyleRuleSupplier->WalkRules(this, aCollectorFunc, aData,
&cutOffInheritance);
mBindingManager->WalkRules(this, aCollectorFunc, aData,
&cutOffInheritance);
}
if (!cutOffInheritance && mRuleProcessors[eDocSheet]) // NOTE: different
(*aCollectorFunc)(mRuleProcessors[eDocSheet], aData);
@ -520,9 +520,9 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
(*aFunc)(mRuleProcessors[eHTMLPresHintSheet], aData);
PRBool cutOffInheritance = PR_FALSE;
if (mStyleRuleSupplier) {
if (mBindingManager) {
// We can supply additional document-level sheets that should be walked.
mStyleRuleSupplier->WalkRules(this, aFunc, aData, &cutOffInheritance);
mBindingManager->WalkRules(this, aFunc, aData, &cutOffInheritance);
}
if (!cutOffInheritance && mRuleProcessors[eDocSheet]) // NOTE: different
(*aFunc)(mRuleProcessors[eDocSheet], aData);

View File

@ -49,7 +49,7 @@
#include "nsIStyleRuleProcessor.h"
#include "nsICSSStyleSheet.h"
#include "nsVoidArray.h"
#include "nsIStyleRuleSupplier.h"
#include "nsBindingManager.h"
#include "nsRuleNode.h"
class nsIURI;
@ -142,14 +142,9 @@ class nsStyleSet
// APIs for registering objects that can supply additional
// rules during processing.
void SetStyleRuleSupplier(nsIStyleRuleSupplier* aSupplier)
void SetBindingManager(nsBindingManager* aBindingManager)
{
mStyleRuleSupplier = aSupplier;
}
nsIStyleRuleSupplier* GetStyleRuleSupplier() const
{
return mStyleRuleSupplier;
mBindingManager = aBindingManager;
}
// Free global data at module shutdown
@ -250,7 +245,7 @@ class nsStyleSet
// cached instance for enabling/disabling
nsCOMPtr<nsIStyleSheet> mQuirkStyleSheet;
nsCOMPtr<nsIStyleRuleSupplier> mStyleRuleSupplier;
nsRefPtr<nsBindingManager> mBindingManager;
// To be used only in case of emergency, such as being out of memory
// or operating on a deleted rule node. The latter should never

View File

@ -84,7 +84,6 @@
#include "nsIBoxLayout.h"
#include "nsSprocketLayout.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsIScrollableFrame.h"
#include "nsWidgetsCID.h"
#include "nsCSSAnonBoxes.h"

View File

@ -49,7 +49,6 @@
#include "nsIContent.h"
#include "nsINameSpaceManager.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMElement.h"

View File

@ -42,7 +42,7 @@
#include "nsBoxObject.h"
#include "nsIFrame.h"
#include "nsIDocument.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsGkAtoms.h"

View File

@ -67,7 +67,7 @@
#include "nsBoxLayoutState.h"
#include "nsIScrollableFrame.h"
#include "nsIViewManager.h"
#include "nsIBindingManager.h"
#include "nsBindingManager.h"
#include "nsIServiceManager.h"
#include "nsCSSFrameConstructor.h"
#include "nsIDOMKeyEvent.h"

View File

@ -78,7 +78,6 @@
#include "nsIDocumentObserver.h"
#include "nsIIOService.h"
#include "nsLayoutCID.h"
#include "nsIBindingManager.h"
#include "prio.h"
#include "nsInt64.h"
#include "nsIDirectoryService.h"
@ -1306,7 +1305,7 @@ static void FlushSkinBindingsForWindow(nsIDOMWindowInternal* aWindow)
return;
// Annihilate all XBL bindings.
document->BindingManager()->FlushSkinBindings();
document->FlushSkinBindings();
}
// XXXbsmedberg: move this to nsIWindowMediator

View File

@ -145,6 +145,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsCycleCollectionParticipant,
_class *tmp = NS_STATIC_CAST(_class*, NS_STATIC_CAST(_base*, s)); \
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(_class)
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(_field) \
if (tmp->_field) { cb.NoteXPCOMChild(tmp->_field); }
#define NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(_field) \
if (tmp->_field) { cb.NoteXPCOMChild(tmp->_field.get()); }