XBL fixes, groundwork for 46505, r=ben

This commit is contained in:
hyatt%netscape.com 2000-08-24 09:21:27 +00:00
Родитель 3f96fe5c0f
Коммит 6b54700b73
12 изменённых файлов: 68 добавлений и 8 удалений

Просмотреть файл

@ -31,6 +31,7 @@ MODULE = layout
EXPORTS = \
nsIBindingManager.h \
nsIXBLBinding.h \
nsIXBLBindingAttachedHandler.h \
nsIXBLDocumentInfo.h \
nsIXBLService.h \
$(NULL)

Просмотреть файл

@ -1,5 +1,6 @@
nsIBindingManager.h
nsIXBLBinding.h
nsIXBLBindingAttachedHandler.h
nsIXBLDocumentInfo.h
nsIXBLService.h

Просмотреть файл

@ -24,6 +24,7 @@ DEPTH=..\..\..
EXPORTS = \
nsIBindingManager.h \
nsIXBLBinding.h \
nsIXBLBindingAttachedHandler.h \
nsIXBLDocumentInfo.h \
nsIXBLService.h \
$(NULL)

Просмотреть файл

@ -37,6 +37,7 @@
class nsIContent;
class nsIXBLBinding;
class nsIXBLBindingAttachedHandler;
class nsIXBLDocumentInfo;
class nsIAtom;
class nsIStreamListener;
@ -64,6 +65,7 @@ public:
NS_IMETHOD LoadBindingDocument(nsIDocument* aDocument, const nsAReadableString& aURL) = 0;
NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding)=0;
NS_IMETHOD AddHandlerToAttachedQueue(nsIXBLBindingAttachedHandler* aHandler)=0;
NS_IMETHOD ClearAttachedQueue()=0;
NS_IMETHOD ProcessAttachedQueue()=0;

Просмотреть файл

@ -49,6 +49,7 @@
#include "nsIXBLBinding.h"
#include "nsIXBLDocumentInfo.h"
#include "nsIXBLBindingAttachedHandler.h"
#include "nsIStyleSheet.h"
#include "nsIHTMLStyleSheet.h"
@ -168,6 +169,7 @@ public:
NS_IMETHOD LoadBindingDocument(nsIDocument* aBoundDoc, const nsAReadableString& aURL);
NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding);
NS_IMETHOD AddHandlerToAttachedQueue(nsIXBLBindingAttachedHandler* aHandler);
NS_IMETHOD ClearAttachedQueue();
NS_IMETHOD ProcessAttachedQueue();
@ -400,6 +402,17 @@ nsBindingManager::AddToAttachedQueue(nsIXBLBinding* aBinding)
return NS_OK;
}
NS_IMETHODIMP
nsBindingManager::AddHandlerToAttachedQueue(nsIXBLBindingAttachedHandler* aBinding)
{
if (!mAttachedQueue)
NS_NewISupportsArray(getter_AddRefs(mAttachedQueue)); // This call addrefs the array.
mAttachedQueue->AppendElement(aBinding);
return NS_OK;
}
NS_IMETHODIMP
nsBindingManager::ClearAttachedQueue()
{
@ -417,10 +430,18 @@ nsBindingManager::ProcessAttachedQueue()
PRUint32 count;
mAttachedQueue->Count(&count);
for (PRUint32 i = 0; i < count; i++) {
nsCOMPtr<nsIXBLBinding> binding;
mAttachedQueue->GetElementAt(0, getter_AddRefs(binding));
nsCOMPtr<nsISupports> supp;
mAttachedQueue->GetElementAt(0, getter_AddRefs(supp));
mAttachedQueue->RemoveElementAt(0);
binding->ExecuteAttachedHandler();
nsCOMPtr<nsIXBLBinding> binding(do_QueryInterface(supp));
if (binding)
binding->ExecuteAttachedHandler();
else {
nsCOMPtr<nsIXBLBindingAttachedHandler> handler(do_QueryInterface(supp));
if (handler)
handler->OnBindingAttached();
}
}
ClearAttachedQueue();

Просмотреть файл

@ -1201,7 +1201,11 @@ nsXBLBinding::GetID(nsCString& aResult)
NS_IMETHODIMP
nsXBLBinding::InheritsStyle(PRBool* aResult)
{
*aResult = mInheritStyle;
if (mContent)
*aResult = mInheritStyle;
else if (mNextBinding)
return mNextBinding->InheritsStyle(aResult);
return NS_OK;
}

Просмотреть файл

@ -31,6 +31,7 @@ MODULE = layout
EXPORTS = \
nsIBindingManager.h \
nsIXBLBinding.h \
nsIXBLBindingAttachedHandler.h \
nsIXBLDocumentInfo.h \
nsIXBLService.h \
$(NULL)

Просмотреть файл

@ -1,5 +1,6 @@
nsIBindingManager.h
nsIXBLBinding.h
nsIXBLBindingAttachedHandler.h
nsIXBLDocumentInfo.h
nsIXBLService.h

Просмотреть файл

@ -24,6 +24,7 @@ DEPTH=..\..\..
EXPORTS = \
nsIBindingManager.h \
nsIXBLBinding.h \
nsIXBLBindingAttachedHandler.h \
nsIXBLDocumentInfo.h \
nsIXBLService.h \
$(NULL)

Просмотреть файл

@ -37,6 +37,7 @@
class nsIContent;
class nsIXBLBinding;
class nsIXBLBindingAttachedHandler;
class nsIXBLDocumentInfo;
class nsIAtom;
class nsIStreamListener;
@ -64,6 +65,7 @@ public:
NS_IMETHOD LoadBindingDocument(nsIDocument* aDocument, const nsAReadableString& aURL) = 0;
NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding)=0;
NS_IMETHOD AddHandlerToAttachedQueue(nsIXBLBindingAttachedHandler* aHandler)=0;
NS_IMETHOD ClearAttachedQueue()=0;
NS_IMETHOD ProcessAttachedQueue()=0;

Просмотреть файл

@ -49,6 +49,7 @@
#include "nsIXBLBinding.h"
#include "nsIXBLDocumentInfo.h"
#include "nsIXBLBindingAttachedHandler.h"
#include "nsIStyleSheet.h"
#include "nsIHTMLStyleSheet.h"
@ -168,6 +169,7 @@ public:
NS_IMETHOD LoadBindingDocument(nsIDocument* aBoundDoc, const nsAReadableString& aURL);
NS_IMETHOD AddToAttachedQueue(nsIXBLBinding* aBinding);
NS_IMETHOD AddHandlerToAttachedQueue(nsIXBLBindingAttachedHandler* aHandler);
NS_IMETHOD ClearAttachedQueue();
NS_IMETHOD ProcessAttachedQueue();
@ -400,6 +402,17 @@ nsBindingManager::AddToAttachedQueue(nsIXBLBinding* aBinding)
return NS_OK;
}
NS_IMETHODIMP
nsBindingManager::AddHandlerToAttachedQueue(nsIXBLBindingAttachedHandler* aBinding)
{
if (!mAttachedQueue)
NS_NewISupportsArray(getter_AddRefs(mAttachedQueue)); // This call addrefs the array.
mAttachedQueue->AppendElement(aBinding);
return NS_OK;
}
NS_IMETHODIMP
nsBindingManager::ClearAttachedQueue()
{
@ -417,10 +430,18 @@ nsBindingManager::ProcessAttachedQueue()
PRUint32 count;
mAttachedQueue->Count(&count);
for (PRUint32 i = 0; i < count; i++) {
nsCOMPtr<nsIXBLBinding> binding;
mAttachedQueue->GetElementAt(0, getter_AddRefs(binding));
nsCOMPtr<nsISupports> supp;
mAttachedQueue->GetElementAt(0, getter_AddRefs(supp));
mAttachedQueue->RemoveElementAt(0);
binding->ExecuteAttachedHandler();
nsCOMPtr<nsIXBLBinding> binding(do_QueryInterface(supp));
if (binding)
binding->ExecuteAttachedHandler();
else {
nsCOMPtr<nsIXBLBindingAttachedHandler> handler(do_QueryInterface(supp));
if (handler)
handler->OnBindingAttached();
}
}
ClearAttachedQueue();

Просмотреть файл

@ -1201,7 +1201,11 @@ nsXBLBinding::GetID(nsCString& aResult)
NS_IMETHODIMP
nsXBLBinding::InheritsStyle(PRBool* aResult)
{
*aResult = mInheritStyle;
if (mContent)
*aResult = mInheritStyle;
else if (mNextBinding)
return mNextBinding->InheritsStyle(aResult);
return NS_OK;
}