mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-12 02:31:41 +00:00
back out hyatt's accidental checkin.
This commit is contained in:
parent
2b7eb1c1a2
commit
0066373134
@ -100,8 +100,6 @@ public:
|
||||
|
||||
NS_IMETHOD InheritsStyle(nsIContent* aContent, PRBool* aResult) = 0;
|
||||
NS_IMETHOD FlushChromeBindings() = 0;
|
||||
|
||||
NS_IMETHOD GetBindingImplementation(nsIContent* aContent, void* aScriptObject, REFNSIID aIID, void** aResult)=0;
|
||||
};
|
||||
|
||||
#endif // nsIBinding_Manager_h__
|
||||
|
@ -98,8 +98,6 @@ public:
|
||||
|
||||
NS_IMETHOD MarkForDeath()=0;
|
||||
NS_IMETHOD MarkedForDeath(PRBool* aResult)=0;
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult)=0;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
|
@ -84,8 +84,6 @@ public:
|
||||
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNamespaceID, nsIAtom** aTag)=0;
|
||||
NS_IMETHOD SetBaseTag(PRInt32 aNamespaceID, nsIAtom* aTag)=0;
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult)=0;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
|
@ -62,8 +62,6 @@
|
||||
#include "nsIXBLPrototypeBinding.h"
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
// Static IIDs/CIDs. Try to minimize these.
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
@ -234,8 +232,6 @@ public:
|
||||
NS_IMETHOD InheritsStyle(nsIContent* aContent, PRBool* aResult);
|
||||
NS_IMETHOD FlushChromeBindings();
|
||||
|
||||
NS_IMETHOD GetBindingImplementation(nsIContent* aContent, void* aScriptObject, REFNSIID aIID, void** aResult);
|
||||
|
||||
// nsIStyleRuleSupplier
|
||||
NS_IMETHOD UseDocumentRules(nsIContent* aContent, PRBool* aResult);
|
||||
NS_IMETHOD WalkRules(nsIStyleSet* aStyleSet,
|
||||
@ -671,50 +667,6 @@ nsBindingManager::FlushChromeBindings()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::GetBindingImplementation(nsIContent* aContent, void* aScriptObject, REFNSIID aIID, void** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
GetBinding(aContent, getter_AddRefs(binding));
|
||||
if (binding) {
|
||||
PRBool supports;
|
||||
binding->ImplementsInterface(aIID, &supports);
|
||||
if (supports) {
|
||||
// Create an XPC wrapper for the script object and hand it back.
|
||||
JSObject* jsobj = (JSObject*)aScriptObject;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (!doc)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
doc->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if (!global)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
global->GetContext(getter_AddRefs(context));
|
||||
if (!context)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
JSContext* jscontext = (JSContext*)context->GetNativeContext();
|
||||
if (!jscontext)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsCOMPtr<nsIXPConnect> xpConnect = do_GetService("@mozilla.org/js/xpc/XPConnect;1");
|
||||
if (!xpConnect)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
return xpConnect->WrapJS(jscontext, jsobj, aIID, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::InheritsStyle(nsIContent* aContent, PRBool* aResult)
|
||||
{
|
||||
|
@ -1451,15 +1451,6 @@ nsXBLBinding::MarkedForDeath(PRBool* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::ImplementsInterface(REFNSIID aIID, PRBool* aResult)
|
||||
{
|
||||
mPrototypeBinding->ImplementsInterface(aIID, aResult);
|
||||
if (!*aResult && mNextBinding)
|
||||
return mNextBinding->ImplementsInterface(aIID, aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Creation Routine ///////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
|
@ -93,8 +93,6 @@ class nsXBLBinding: public nsIXBLBinding
|
||||
NS_IMETHOD MarkForDeath();
|
||||
NS_IMETHOD MarkedForDeath(PRBool* aResult);
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult);
|
||||
|
||||
public:
|
||||
nsXBLBinding(nsIXBLPrototypeBinding* aProtoBinding);
|
||||
virtual ~nsXBLBinding();
|
||||
|
@ -49,8 +49,6 @@
|
||||
#include "nsXBLService.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsFixedSizeAllocator.h"
|
||||
#include "xptinfo.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
|
||||
// Helper Classes =====================================================================
|
||||
|
||||
@ -119,8 +117,7 @@ nsIAtom* nsXBLPrototypeBinding::kContentAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kInheritsAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kHTMLAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kValueAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kImplementationAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kImplementsAtom = nsnull;
|
||||
|
||||
nsFixedSizeAllocator nsXBLPrototypeBinding::kPool;
|
||||
|
||||
static const size_t kBucketSizes[] = {
|
||||
@ -143,8 +140,7 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a
|
||||
mInheritStyle(PR_TRUE),
|
||||
mHasBaseProto(PR_TRUE),
|
||||
mAttributeTable(nsnull),
|
||||
mInsertionPointTable(nsnull),
|
||||
mInterfaceTable(nsnull)
|
||||
mInsertionPointTable(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
@ -164,8 +160,6 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a
|
||||
kInheritsAtom = NS_NewAtom("inherits");
|
||||
kHTMLAtom = NS_NewAtom("html");
|
||||
kValueAtom = NS_NewAtom("value");
|
||||
kImplementationAtom = NS_NewAtom("implementation");
|
||||
kImplementsAtom = NS_NewAtom("implements");
|
||||
}
|
||||
|
||||
// These all use atoms, so we have to do these ops last to ensure
|
||||
@ -184,11 +178,6 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a
|
||||
ConstructAttributeTable(content);
|
||||
ConstructInsertionTable(content);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> impl;
|
||||
GetImmediateChild(kImplementationAtom, getter_AddRefs(impl));
|
||||
if (impl)
|
||||
ConstructInterfaceTable(impl);
|
||||
}
|
||||
|
||||
|
||||
@ -196,7 +185,6 @@ nsXBLPrototypeBinding::~nsXBLPrototypeBinding(void)
|
||||
{
|
||||
delete mAttributeTable;
|
||||
delete mInsertionPointTable;
|
||||
delete mInterfaceTable;
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
NS_RELEASE(kInheritStyleAtom);
|
||||
@ -207,8 +195,6 @@ nsXBLPrototypeBinding::~nsXBLPrototypeBinding(void)
|
||||
NS_RELEASE(kInheritsAtom);
|
||||
NS_RELEASE(kHTMLAtom);
|
||||
NS_RELEASE(kValueAtom);
|
||||
NS_RELEASE(kImplementationAtom);
|
||||
NS_RELEASE(kImplementsAtom);
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,17 +521,6 @@ nsXBLPrototypeBinding::GetBaseTag(PRInt32* aNamespaceID, nsIAtom** aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeBinding::ImplementsInterface(REFNSIID aIID, PRBool* aResult)
|
||||
{
|
||||
// Init the answer to FALSE.
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
// Now check our IID table.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Internal helpers ///////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
@ -829,55 +804,6 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::ConstructInterfaceTable(nsIContent* aElement)
|
||||
{
|
||||
nsAutoString impls;
|
||||
aElement->GetAttribute(kNameSpaceID_None, kImplementsAtom, impls);
|
||||
if (!impls.IsEmpty()) {
|
||||
// Obtain the interface info manager that can tell us the IID
|
||||
// for a given interface name.
|
||||
nsCOMPtr<nsIInterfaceInfoManager> infoManager = getter_AddRefs(XPTI_GetInterfaceInfoManager());
|
||||
if (!infoManager)
|
||||
return;
|
||||
|
||||
// Create the table.
|
||||
if (!mInterfaceTable)
|
||||
mInterfaceTable = new nsSupportsHashtable(4);
|
||||
|
||||
// The user specified at least one attribute.
|
||||
char* str = impls.ToNewCString();
|
||||
char* newStr;
|
||||
// XXX We should use a strtok function that tokenizes PRUnichars
|
||||
// so that we don't have to convert from Unicode to ASCII and then back
|
||||
|
||||
char* token = nsCRT::strtok( str, ", ", &newStr );
|
||||
while( token != NULL ) {
|
||||
// Take the name and try obtain an IID.
|
||||
nsIID* iid = nsnull;
|
||||
infoManager->GetIIDForName(token, &iid);
|
||||
if (iid) {
|
||||
// We found a valid iid. Add it to our table.
|
||||
nsIIDKey key(*iid);
|
||||
mInterfaceTable->Put(&key, mBinding);
|
||||
nsMemory::Free(iid);
|
||||
}
|
||||
|
||||
token = nsCRT::strtok( newStr, ", ", &newStr );
|
||||
}
|
||||
|
||||
nsMemory::Free(str);
|
||||
}
|
||||
|
||||
// Recur into our children.
|
||||
PRInt32 childCount;
|
||||
aElement->ChildCount(childCount);
|
||||
for (PRInt32 i = 0; i < childCount; i++) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
aElement->ChildAt(i, *getter_AddRefs(child));
|
||||
ConstructAttributeTable(child);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::GetNestedChildren(nsIAtom* aTag, nsIContent* aContent, nsISupportsArray** aList)
|
||||
|
@ -84,8 +84,6 @@ class nsXBLPrototypeBinding: public nsIXBLPrototypeBinding
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNamespaceID, nsIAtom** aTag);
|
||||
NS_IMETHOD SetBaseTag(PRInt32 aNamespaceID, nsIAtom* aTag);
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult);
|
||||
|
||||
public:
|
||||
nsXBLPrototypeBinding(const nsCString& aRef, nsIContent* aElement,
|
||||
nsIXBLDocumentInfo* aInfo);
|
||||
@ -101,9 +99,7 @@ public:
|
||||
static nsIAtom* kInheritsAtom;
|
||||
static nsIAtom* kHTMLAtom;
|
||||
static nsIAtom* kValueAtom;
|
||||
static nsIAtom* kImplementationAtom;
|
||||
static nsIAtom* kImplementsAtom;
|
||||
|
||||
|
||||
static nsFixedSizeAllocator kPool;
|
||||
|
||||
// Internal member functions
|
||||
@ -116,33 +112,8 @@ protected:
|
||||
void ConstructHandlers();
|
||||
void ConstructAttributeTable(nsIContent* aElement);
|
||||
void ConstructInsertionTable(nsIContent* aElement);
|
||||
void ConstructInterfaceTable(nsIContent* aElement);
|
||||
void GetNestedChildren(nsIAtom* aTag, nsIContent* aContent, nsISupportsArray** aList);
|
||||
|
||||
protected:
|
||||
// Internal helper class for managing our IID table.
|
||||
class nsIIDKey : public nsHashKey {
|
||||
protected:
|
||||
nsIID mKey;
|
||||
|
||||
public:
|
||||
nsIIDKey(REFNSIID key) : mKey(key) {}
|
||||
~nsIIDKey(void) {}
|
||||
|
||||
PRUint32 HashCode(void) const {
|
||||
// Just use the 32-bit m0 field.
|
||||
return mKey.m0;
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
return mKey.Equals( ((nsIIDKey*) aKey)->mKey);
|
||||
}
|
||||
|
||||
nsHashKey *Clone(void) const {
|
||||
return new nsIIDKey(mKey);
|
||||
}
|
||||
};
|
||||
|
||||
// MEMBER VARIABLES
|
||||
protected:
|
||||
nsCString mID;
|
||||
@ -163,8 +134,6 @@ protected:
|
||||
nsSupportsHashtable* mInsertionPointTable; // A table of insertion points for placing explicit content
|
||||
// underneath anonymous content.
|
||||
|
||||
nsSupportsHashtable* mInterfaceTable; // A table of cached interfaces that we support.
|
||||
|
||||
PRInt32 mBaseNameSpaceID; // If we extend a tagname/namespace, then that information will
|
||||
nsCOMPtr<nsIAtom> mBaseTag; // be stored in here.
|
||||
};
|
||||
|
@ -949,9 +949,9 @@ NS_IMETHODIMP nsXBLService::GetBindingInternal(nsIContent* aBoundElement,
|
||||
else
|
||||
protoBinding->GetBindingElement(getter_AddRefs(child));
|
||||
|
||||
NS_ASSERTION(protoBinding, "Unable to locate an XBL binding.");
|
||||
if (!protoBinding)
|
||||
return NS_ERROR_FAILURE;
|
||||
// NS_ASSERTION(protoBinding, "Unable to locate an XBL binding.");
|
||||
// if (!protoBinding)
|
||||
// return NS_ERROR_FAILURE;
|
||||
|
||||
// If our prototype already has a base, then don't check for an "extends" attribute.
|
||||
nsCOMPtr<nsIXBLBinding> baseBinding;
|
||||
|
@ -100,8 +100,6 @@ public:
|
||||
|
||||
NS_IMETHOD InheritsStyle(nsIContent* aContent, PRBool* aResult) = 0;
|
||||
NS_IMETHOD FlushChromeBindings() = 0;
|
||||
|
||||
NS_IMETHOD GetBindingImplementation(nsIContent* aContent, void* aScriptObject, REFNSIID aIID, void** aResult)=0;
|
||||
};
|
||||
|
||||
#endif // nsIBinding_Manager_h__
|
||||
|
@ -98,8 +98,6 @@ public:
|
||||
|
||||
NS_IMETHOD MarkForDeath()=0;
|
||||
NS_IMETHOD MarkedForDeath(PRBool* aResult)=0;
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult)=0;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
|
@ -84,8 +84,6 @@ public:
|
||||
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNamespaceID, nsIAtom** aTag)=0;
|
||||
NS_IMETHOD SetBaseTag(PRInt32 aNamespaceID, nsIAtom* aTag)=0;
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult)=0;
|
||||
};
|
||||
|
||||
extern nsresult
|
||||
|
@ -62,8 +62,6 @@
|
||||
#include "nsIXBLPrototypeBinding.h"
|
||||
#include "nsIWeakReference.h"
|
||||
|
||||
#include "nsIXPConnect.h"
|
||||
|
||||
// Static IIDs/CIDs. Try to minimize these.
|
||||
static NS_DEFINE_CID(kNameSpaceManagerCID, NS_NAMESPACEMANAGER_CID);
|
||||
static NS_DEFINE_CID(kXMLDocumentCID, NS_XMLDOCUMENT_CID);
|
||||
@ -234,8 +232,6 @@ public:
|
||||
NS_IMETHOD InheritsStyle(nsIContent* aContent, PRBool* aResult);
|
||||
NS_IMETHOD FlushChromeBindings();
|
||||
|
||||
NS_IMETHOD GetBindingImplementation(nsIContent* aContent, void* aScriptObject, REFNSIID aIID, void** aResult);
|
||||
|
||||
// nsIStyleRuleSupplier
|
||||
NS_IMETHOD UseDocumentRules(nsIContent* aContent, PRBool* aResult);
|
||||
NS_IMETHOD WalkRules(nsIStyleSet* aStyleSet,
|
||||
@ -671,50 +667,6 @@ nsBindingManager::FlushChromeBindings()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::GetBindingImplementation(nsIContent* aContent, void* aScriptObject, REFNSIID aIID, void** aResult)
|
||||
{
|
||||
*aResult = nsnull;
|
||||
nsCOMPtr<nsIXBLBinding> binding;
|
||||
GetBinding(aContent, getter_AddRefs(binding));
|
||||
if (binding) {
|
||||
PRBool supports;
|
||||
binding->ImplementsInterface(aIID, &supports);
|
||||
if (supports) {
|
||||
// Create an XPC wrapper for the script object and hand it back.
|
||||
JSObject* jsobj = (JSObject*)aScriptObject;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
aContent->GetDocument(*getter_AddRefs(doc));
|
||||
if (!doc)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||
doc->GetScriptGlobalObject(getter_AddRefs(global));
|
||||
if (!global)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsCOMPtr<nsIScriptContext> context;
|
||||
global->GetContext(getter_AddRefs(context));
|
||||
if (!context)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
JSContext* jscontext = (JSContext*)context->GetNativeContext();
|
||||
if (!jscontext)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
nsCOMPtr<nsIXPConnect> xpConnect = do_GetService("@mozilla.org/js/xpc/XPConnect;1");
|
||||
if (!xpConnect)
|
||||
return NS_NOINTERFACE;
|
||||
|
||||
return xpConnect->WrapJS(jscontext, jsobj, aIID, aResult);
|
||||
}
|
||||
}
|
||||
|
||||
*aResult = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBindingManager::InheritsStyle(nsIContent* aContent, PRBool* aResult)
|
||||
{
|
||||
|
@ -1451,15 +1451,6 @@ nsXBLBinding::MarkedForDeath(PRBool* aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLBinding::ImplementsInterface(REFNSIID aIID, PRBool* aResult)
|
||||
{
|
||||
mPrototypeBinding->ImplementsInterface(aIID, aResult);
|
||||
if (!*aResult && mNextBinding)
|
||||
return mNextBinding->ImplementsInterface(aIID, aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Creation Routine ///////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
|
@ -93,8 +93,6 @@ class nsXBLBinding: public nsIXBLBinding
|
||||
NS_IMETHOD MarkForDeath();
|
||||
NS_IMETHOD MarkedForDeath(PRBool* aResult);
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult);
|
||||
|
||||
public:
|
||||
nsXBLBinding(nsIXBLPrototypeBinding* aProtoBinding);
|
||||
virtual ~nsXBLBinding();
|
||||
|
@ -49,8 +49,6 @@
|
||||
#include "nsXBLService.h"
|
||||
#include "nsXBLPrototypeBinding.h"
|
||||
#include "nsFixedSizeAllocator.h"
|
||||
#include "xptinfo.h"
|
||||
#include "nsIInterfaceInfoManager.h"
|
||||
|
||||
// Helper Classes =====================================================================
|
||||
|
||||
@ -119,8 +117,7 @@ nsIAtom* nsXBLPrototypeBinding::kContentAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kInheritsAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kHTMLAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kValueAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kImplementationAtom = nsnull;
|
||||
nsIAtom* nsXBLPrototypeBinding::kImplementsAtom = nsnull;
|
||||
|
||||
nsFixedSizeAllocator nsXBLPrototypeBinding::kPool;
|
||||
|
||||
static const size_t kBucketSizes[] = {
|
||||
@ -143,8 +140,7 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a
|
||||
mInheritStyle(PR_TRUE),
|
||||
mHasBaseProto(PR_TRUE),
|
||||
mAttributeTable(nsnull),
|
||||
mInsertionPointTable(nsnull),
|
||||
mInterfaceTable(nsnull)
|
||||
mInsertionPointTable(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
|
||||
@ -164,8 +160,6 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a
|
||||
kInheritsAtom = NS_NewAtom("inherits");
|
||||
kHTMLAtom = NS_NewAtom("html");
|
||||
kValueAtom = NS_NewAtom("value");
|
||||
kImplementationAtom = NS_NewAtom("implementation");
|
||||
kImplementsAtom = NS_NewAtom("implements");
|
||||
}
|
||||
|
||||
// These all use atoms, so we have to do these ops last to ensure
|
||||
@ -184,11 +178,6 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding(const nsCString& aID, nsIContent* a
|
||||
ConstructAttributeTable(content);
|
||||
ConstructInsertionTable(content);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> impl;
|
||||
GetImmediateChild(kImplementationAtom, getter_AddRefs(impl));
|
||||
if (impl)
|
||||
ConstructInterfaceTable(impl);
|
||||
}
|
||||
|
||||
|
||||
@ -196,7 +185,6 @@ nsXBLPrototypeBinding::~nsXBLPrototypeBinding(void)
|
||||
{
|
||||
delete mAttributeTable;
|
||||
delete mInsertionPointTable;
|
||||
delete mInterfaceTable;
|
||||
gRefCnt--;
|
||||
if (gRefCnt == 0) {
|
||||
NS_RELEASE(kInheritStyleAtom);
|
||||
@ -207,8 +195,6 @@ nsXBLPrototypeBinding::~nsXBLPrototypeBinding(void)
|
||||
NS_RELEASE(kInheritsAtom);
|
||||
NS_RELEASE(kHTMLAtom);
|
||||
NS_RELEASE(kValueAtom);
|
||||
NS_RELEASE(kImplementationAtom);
|
||||
NS_RELEASE(kImplementsAtom);
|
||||
}
|
||||
}
|
||||
|
||||
@ -535,17 +521,6 @@ nsXBLPrototypeBinding::GetBaseTag(PRInt32* aNamespaceID, nsIAtom** aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXBLPrototypeBinding::ImplementsInterface(REFNSIID aIID, PRBool* aResult)
|
||||
{
|
||||
// Init the answer to FALSE.
|
||||
*aResult = PR_FALSE;
|
||||
|
||||
// Now check our IID table.
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Internal helpers ///////////////////////////////////////////////////////////////////////
|
||||
|
||||
void
|
||||
@ -829,55 +804,6 @@ nsXBLPrototypeBinding::ConstructInsertionTable(nsIContent* aContent)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::ConstructInterfaceTable(nsIContent* aElement)
|
||||
{
|
||||
nsAutoString impls;
|
||||
aElement->GetAttribute(kNameSpaceID_None, kImplementsAtom, impls);
|
||||
if (!impls.IsEmpty()) {
|
||||
// Obtain the interface info manager that can tell us the IID
|
||||
// for a given interface name.
|
||||
nsCOMPtr<nsIInterfaceInfoManager> infoManager = getter_AddRefs(XPTI_GetInterfaceInfoManager());
|
||||
if (!infoManager)
|
||||
return;
|
||||
|
||||
// Create the table.
|
||||
if (!mInterfaceTable)
|
||||
mInterfaceTable = new nsSupportsHashtable(4);
|
||||
|
||||
// The user specified at least one attribute.
|
||||
char* str = impls.ToNewCString();
|
||||
char* newStr;
|
||||
// XXX We should use a strtok function that tokenizes PRUnichars
|
||||
// so that we don't have to convert from Unicode to ASCII and then back
|
||||
|
||||
char* token = nsCRT::strtok( str, ", ", &newStr );
|
||||
while( token != NULL ) {
|
||||
// Take the name and try obtain an IID.
|
||||
nsIID* iid = nsnull;
|
||||
infoManager->GetIIDForName(token, &iid);
|
||||
if (iid) {
|
||||
// We found a valid iid. Add it to our table.
|
||||
nsIIDKey key(*iid);
|
||||
mInterfaceTable->Put(&key, mBinding);
|
||||
nsMemory::Free(iid);
|
||||
}
|
||||
|
||||
token = nsCRT::strtok( newStr, ", ", &newStr );
|
||||
}
|
||||
|
||||
nsMemory::Free(str);
|
||||
}
|
||||
|
||||
// Recur into our children.
|
||||
PRInt32 childCount;
|
||||
aElement->ChildCount(childCount);
|
||||
for (PRInt32 i = 0; i < childCount; i++) {
|
||||
nsCOMPtr<nsIContent> child;
|
||||
aElement->ChildAt(i, *getter_AddRefs(child));
|
||||
ConstructAttributeTable(child);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsXBLPrototypeBinding::GetNestedChildren(nsIAtom* aTag, nsIContent* aContent, nsISupportsArray** aList)
|
||||
|
@ -84,8 +84,6 @@ class nsXBLPrototypeBinding: public nsIXBLPrototypeBinding
|
||||
NS_IMETHOD GetBaseTag(PRInt32* aNamespaceID, nsIAtom** aTag);
|
||||
NS_IMETHOD SetBaseTag(PRInt32 aNamespaceID, nsIAtom* aTag);
|
||||
|
||||
NS_IMETHOD ImplementsInterface(REFNSIID aIID, PRBool* aResult);
|
||||
|
||||
public:
|
||||
nsXBLPrototypeBinding(const nsCString& aRef, nsIContent* aElement,
|
||||
nsIXBLDocumentInfo* aInfo);
|
||||
@ -101,9 +99,7 @@ public:
|
||||
static nsIAtom* kInheritsAtom;
|
||||
static nsIAtom* kHTMLAtom;
|
||||
static nsIAtom* kValueAtom;
|
||||
static nsIAtom* kImplementationAtom;
|
||||
static nsIAtom* kImplementsAtom;
|
||||
|
||||
|
||||
static nsFixedSizeAllocator kPool;
|
||||
|
||||
// Internal member functions
|
||||
@ -116,33 +112,8 @@ protected:
|
||||
void ConstructHandlers();
|
||||
void ConstructAttributeTable(nsIContent* aElement);
|
||||
void ConstructInsertionTable(nsIContent* aElement);
|
||||
void ConstructInterfaceTable(nsIContent* aElement);
|
||||
void GetNestedChildren(nsIAtom* aTag, nsIContent* aContent, nsISupportsArray** aList);
|
||||
|
||||
protected:
|
||||
// Internal helper class for managing our IID table.
|
||||
class nsIIDKey : public nsHashKey {
|
||||
protected:
|
||||
nsIID mKey;
|
||||
|
||||
public:
|
||||
nsIIDKey(REFNSIID key) : mKey(key) {}
|
||||
~nsIIDKey(void) {}
|
||||
|
||||
PRUint32 HashCode(void) const {
|
||||
// Just use the 32-bit m0 field.
|
||||
return mKey.m0;
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
return mKey.Equals( ((nsIIDKey*) aKey)->mKey);
|
||||
}
|
||||
|
||||
nsHashKey *Clone(void) const {
|
||||
return new nsIIDKey(mKey);
|
||||
}
|
||||
};
|
||||
|
||||
// MEMBER VARIABLES
|
||||
protected:
|
||||
nsCString mID;
|
||||
@ -163,8 +134,6 @@ protected:
|
||||
nsSupportsHashtable* mInsertionPointTable; // A table of insertion points for placing explicit content
|
||||
// underneath anonymous content.
|
||||
|
||||
nsSupportsHashtable* mInterfaceTable; // A table of cached interfaces that we support.
|
||||
|
||||
PRInt32 mBaseNameSpaceID; // If we extend a tagname/namespace, then that information will
|
||||
nsCOMPtr<nsIAtom> mBaseTag; // be stored in here.
|
||||
};
|
||||
|
@ -949,9 +949,9 @@ NS_IMETHODIMP nsXBLService::GetBindingInternal(nsIContent* aBoundElement,
|
||||
else
|
||||
protoBinding->GetBindingElement(getter_AddRefs(child));
|
||||
|
||||
NS_ASSERTION(protoBinding, "Unable to locate an XBL binding.");
|
||||
if (!protoBinding)
|
||||
return NS_ERROR_FAILURE;
|
||||
// NS_ASSERTION(protoBinding, "Unable to locate an XBL binding.");
|
||||
// if (!protoBinding)
|
||||
// return NS_ERROR_FAILURE;
|
||||
|
||||
// If our prototype already has a base, then don't check for an "extends" attribute.
|
||||
nsCOMPtr<nsIXBLBinding> baseBinding;
|
||||
|
Loading…
x
Reference in New Issue
Block a user