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

git-svn-id: svn://10.0.0.236/trunk@220434 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
jonas%sicking.cc 2007-02-16 22:59:06 +00:00
parent 2429105ce7
commit c691d21bc5
5 changed files with 39 additions and 21 deletions

View File

@ -48,7 +48,8 @@
nsAccessibleTreeWalker::nsAccessibleTreeWalker(nsIWeakReference* aPresShell, nsIDOMNode* aNode, PRBool aWalkAnonContent):
mWeakShell(aPresShell),
mAccService(do_GetService("@mozilla.org/accessibilityService;1"))
mAccService(do_GetService("@mozilla.org/accessibilityService;1")),
mWalkAnonContent(aWalkAnonContent)
{
mState.domNode = aNode;
mState.prevState = nsnull;
@ -57,11 +58,6 @@ nsAccessibleTreeWalker::nsAccessibleTreeWalker(nsIWeakReference* aPresShell, nsI
mState.isHidden = false;
mState.frame = nsnull;
if (aWalkAnonContent) {
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
if (presShell)
mBindingManager = presShell->GetDocument()->BindingManager();
}
MOZ_COUNT_CTOR(nsAccessibleTreeWalker);
}
@ -91,9 +87,14 @@ void nsAccessibleTreeWalker::GetKids(nsIDOMNode *aParentNode)
// Walk anonymous content? Not currently used for HTML -- anonymous content there uses frame walking
mState.siblingIndex = 0; // Indicates our index into the sibling list
if (parentContent) {
if (mBindingManager) {
if (mWalkAnonContent) {
// Walk anonymous content
mBindingManager->GetXBLChildNodesFor(parentContent, getter_AddRefs(mState.siblingList)); // returns null if no anon nodes
nsIDocument* doc = parentContent->GetOwnerDoc();
if (doc) {
// returns null if no anon nodes
doc->GetXBLChildNodesFor(parentContent,
getter_AddRefs(mState.siblingList));
}
}
if (!mState.siblingList) {
// Walk normal DOM. Just use nsIContent -- it doesn't require

View File

@ -47,7 +47,6 @@
#include "nsIAccessible.h"
#include "nsIDOMNodeList.h"
#include "nsIAccessibilityService.h"
#include "nsIBindingManager.h"
#include "nsIWeakReference.h"
enum { eSiblingsUninitialized = -1, eSiblingsWalkFrames = -2 };
@ -92,7 +91,7 @@ protected:
nsCOMPtr<nsIWeakReference> mWeakShell;
nsCOMPtr<nsIAccessibilityService> mAccService;
nsCOMPtr<nsIBindingManager> mBindingManager;
PRBool mWalkAnonContent;
};
#endif

View File

@ -73,13 +73,10 @@ NS_IMETHODIMP nsXULAlertAccessible::GetName(nsAString &aName)
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
NS_ASSERTION(content, "Should not be null if we still have a presShell");
nsCOMPtr<nsIBindingManager> bindingManager = presShell->GetDocument()->BindingManager();
if (!bindingManager) {
return NS_OK;
}
nsCOMPtr<nsIDOMNodeList> siblingList;
bindingManager->GetXBLChildNodesFor(content, getter_AddRefs(siblingList)); // returns null if no anon nodes
// returns null if no anon nodes
presShell->GetDocument()->GetXBLChildNodesFor(content,
getter_AddRefs(siblingList));
if (siblingList) {
PRUint32 length, count;
siblingList->GetLength(&length);

View File

@ -65,7 +65,6 @@
#include "nsXULAppAPI.h"
#include "nsIAtom.h"
#include "nsIBindingManager.h"
#include "nsICommandLine.h"
#include "nsICSSLoader.h"
#include "nsICSSStyleSheet.h"
@ -836,7 +835,7 @@ static void FlushSkinBindingsForWindow(nsIDOMWindowInternal* aWindow)
return;
// Annihilate all XBL bindings.
document->BindingManager()->FlushSkinBindings();
document->FlushSkinBindings();
}
// XXXbsmedberg: move this to nsIWindowMediator

View File

@ -42,7 +42,6 @@
#include "nsIDocumentObserver.h" // for nsUpdateType
#include "nsCOMPtr.h"
#include "nsIURI.h"
#include "nsIBindingManager.h"
#include "nsWeakPtr.h"
#include "nsIWeakReferenceUtils.h"
#include "nsILoadGroup.h"
@ -89,6 +88,8 @@ class nsIVariant;
class nsIDOMUserDataHandler;
template<class E> class nsCOMArray;
class nsIDocumentObserver;
class nsBindingManager;
class nsIDOMNodeList;
// IID for the nsIDocument interface
#define NS_IDOCUMENT_IID \
@ -112,6 +113,7 @@ public:
nsIDocument()
: nsINode(nsnull),
mCharacterSet(NS_LITERAL_CSTRING("ISO-8859-1")),
mBindingManager(nsnull),
mNodeInfoManager(nsnull),
mCompatMode(eCompatibility_FullStandards),
mIsInitialDocumentInWindow(PR_FALSE),
@ -580,7 +582,7 @@ public:
*/
virtual void FlushPendingNotifications(mozFlushType aType) = 0;
nsIBindingManager* BindingManager() const
nsBindingManager* BindingManager() const
{
return mBindingManager;
}
@ -827,6 +829,23 @@ public:
return mCompatMode;
}
/**
* See GetXBLChildNodesFor on nsBindingManager
*/
virtual nsresult GetXBLChildNodesFor(nsIContent* aContent,
nsIDOMNodeList** aResult) = 0;
/**
* See GetContentListFor on nsBindingManager
*/
virtual nsresult GetContentListFor(nsIContent* aContent,
nsIDOMNodeList** aResult) = 0;
/**
* See FlushSkinBindings on nsBindingManager
*/
virtual nsresult FlushSkinBindings() = 0;
protected:
~nsIDocument()
{
@ -834,6 +853,7 @@ protected:
// releasing it) happens in the nsDocument destructor. We'd prefer to
// do it here but nsNodeInfoManager is a concrete class that we don't
// want to expose to users of the nsIDocument API outside of Gecko.
// XXX Same thing applies to mBindingManager
}
nsString mDocumentTitle;
@ -854,7 +874,9 @@ protected:
// such element exists.
nsIContent* mRootContent;
nsCOMPtr<nsIBindingManager> mBindingManager;
// We'd like these to be nsRefPtrs, but that'd require us to include
// additional headers that we don't want to expose.
nsBindingManager* mBindingManager; // [STRONG]
nsNodeInfoManager* mNodeInfoManager; // [STRONG]
nsICSSLoader* mCSSLoader; // [STRONG; not a COMPtr to avoid