diff --git a/accessible/src/atk/AtkSocketAccessible.cpp b/accessible/src/atk/AtkSocketAccessible.cpp index 3a6c13ac4d61..8d32c35c6b68 100644 --- a/accessible/src/atk/AtkSocketAccessible.cpp +++ b/accessible/src/atk/AtkSocketAccessible.cpp @@ -162,9 +162,9 @@ mai_atk_socket_get_extents(AtkComponent* aComponent, } AtkSocketAccessible::AtkSocketAccessible(nsIContent* aContent, - nsDocAccessible* aDoc, + nsIWeakReference* aShell, const nsCString& aPlugId) : - nsAccessibleWrap(aContent, aDoc) + nsAccessibleWrap(aContent, aShell) { mAtkObject = mai_atk_socket_new(this); if (!mAtkObject) diff --git a/accessible/src/atk/AtkSocketAccessible.h b/accessible/src/atk/AtkSocketAccessible.h index 2a049f74cb2a..dd3cc5aa6722 100644 --- a/accessible/src/atk/AtkSocketAccessible.h +++ b/accessible/src/atk/AtkSocketAccessible.h @@ -72,7 +72,7 @@ public: */ static bool gCanEmbed; - AtkSocketAccessible(nsIContent* aContent, nsDocAccessible* aDoc, + AtkSocketAccessible(nsIContent* aContent, nsIWeakReference* aShell, const nsCString& aPlugId); // nsAccessNode diff --git a/accessible/src/atk/nsAccessNodeWrap.cpp b/accessible/src/atk/nsAccessNodeWrap.cpp index 92f502d4eca7..bdc8f3a0b3ba 100644 --- a/accessible/src/atk/nsAccessNodeWrap.cpp +++ b/accessible/src/atk/nsAccessNodeWrap.cpp @@ -55,8 +55,8 @@ //----------------------------------------------------- nsAccessNodeWrap:: - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessNode(aContent, aDoc) + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessNode(aContent, aShell) { } diff --git a/accessible/src/atk/nsAccessNodeWrap.h b/accessible/src/atk/nsAccessNodeWrap.h index deb048a0adc5..7258ae530384 100644 --- a/accessible/src/atk/nsAccessNodeWrap.h +++ b/accessible/src/atk/nsAccessNodeWrap.h @@ -49,11 +49,12 @@ class nsAccessNodeWrap : public nsAccessNode { public: // construction, destruction - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc); - virtual ~nsAccessNodeWrap(); + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell); + virtual ~nsAccessNodeWrap(); + + static void InitAccessibility(); + static void ShutdownAccessibility(); - static void InitAccessibility(); - static void ShutdownAccessibility(); }; #endif diff --git a/accessible/src/atk/nsAccessibleWrap.cpp b/accessible/src/atk/nsAccessibleWrap.cpp index 64cfc554db76..00430256de8a 100644 --- a/accessible/src/atk/nsAccessibleWrap.cpp +++ b/accessible/src/atk/nsAccessibleWrap.cpp @@ -281,8 +281,8 @@ PRInt32 nsAccessibleWrap::mAccWrapDeleted = 0; #endif nsAccessibleWrap:: - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessible(aContent, aDoc), mAtkObject(nsnull) + nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessible(aContent, aShell), mAtkObject(nsnull) { #ifdef MAI_LOGGING ++mAccWrapCreated; @@ -362,7 +362,7 @@ NS_IMETHODIMP nsAccessibleWrap::GetNativeInterface(void **aOutAccessible) *aOutAccessible = nsnull; if (!mAtkObject) { - if (IsDefunct() || !nsAccUtils::IsEmbeddedObject(this)) { + if (!mWeakShell || !nsAccUtils::IsEmbeddedObject(this)) { // We don't create ATK objects for node which has been shutdown, or // nsIAccessible plain text leaves return NS_ERROR_FAILURE; diff --git a/accessible/src/atk/nsAccessibleWrap.h b/accessible/src/atk/nsAccessibleWrap.h index 6e4e200eb739..4f8a9c4717bf 100644 --- a/accessible/src/atk/nsAccessibleWrap.h +++ b/accessible/src/atk/nsAccessibleWrap.h @@ -84,7 +84,7 @@ class MaiHyperlink; class nsAccessibleWrap: public nsAccessible { public: - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsAccessibleWrap(); void ShutdownAtkObject(); diff --git a/accessible/src/base/NotificationController.cpp b/accessible/src/base/NotificationController.cpp index d5d0ab76786d..670796fa1245 100644 --- a/accessible/src/base/NotificationController.cpp +++ b/accessible/src/base/NotificationController.cpp @@ -671,7 +671,7 @@ NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent) { nsAccessible* container = GetAccService()->GetContainerAccessible(aEvent->mNode, - aEvent->GetDocAccessible()->PresShell()); + aEvent->mAccessible->GetWeakShell()); if (!container) return; diff --git a/accessible/src/base/nsARIAGridAccessible.cpp b/accessible/src/base/nsARIAGridAccessible.cpp index ed7304d59aa9..ed0dc98aa64d 100644 --- a/accessible/src/base/nsARIAGridAccessible.cpp +++ b/accessible/src/base/nsARIAGridAccessible.cpp @@ -57,8 +57,8 @@ using namespace mozilla::a11y; // Constructor nsARIAGridAccessible:: - nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsARIAGridAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -932,8 +932,8 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount, // Constructor nsARIAGridCellAccessible:: - nsARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsARIAGridCellAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/base/nsARIAGridAccessible.h b/accessible/src/base/nsARIAGridAccessible.h index 9a1806bc701c..b8d0062885e9 100644 --- a/accessible/src/base/nsARIAGridAccessible.h +++ b/accessible/src/base/nsARIAGridAccessible.h @@ -50,7 +50,7 @@ class nsARIAGridAccessible : public nsAccessibleWrap, public nsIAccessibleTable { public: - nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsARIAGridAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -110,7 +110,7 @@ class nsARIAGridCellAccessible : public nsHyperTextAccessibleWrap, public nsIAccessibleTableCell { public: - nsARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsARIAGridCellAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/base/nsAccUtils.cpp b/accessible/src/base/nsAccUtils.cpp index 73aa9d65df95..05e56796f1b8 100644 --- a/accessible/src/base/nsAccUtils.cpp +++ b/accessible/src/base/nsAccUtils.cpp @@ -425,11 +425,11 @@ nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection) nsCOMPtr focusNode(do_QueryInterface(focusDOMNode)); nsCOMPtr resultNode = nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset); - nsIPresShell* presShell(nsCoreUtils::GetPresShellFor(resultNode)); + nsCOMPtr weakShell(nsCoreUtils::GetWeakShellFor(resultNode)); // Get text accessible containing the result node. nsAccessible* accessible = - GetAccService()->GetAccessibleOrContainer(resultNode, presShell); + GetAccService()->GetAccessibleOrContainer(resultNode, weakShell); if (!accessible) { NS_NOTREACHED("No nsIAccessibleText for selection change event!"); return nsnull; @@ -525,8 +525,9 @@ nsAccUtils::GetScreenCoordsForWindow(nsAccessNode *aAccessNode) nsIntPoint nsAccUtils::GetScreenCoordsForParent(nsAccessNode *aAccessNode) { - nsDocAccessible* document = aAccessNode->GetDocAccessible(); - nsAccessible* parent = document->GetContainerAccessible(aAccessNode->GetNode()); + nsAccessible *parent = + GetAccService()->GetContainerAccessible(aAccessNode->GetNode(), + aAccessNode->GetWeakShell()); if (!parent) return nsIntPoint(0, 0); diff --git a/accessible/src/base/nsAccUtils.h b/accessible/src/base/nsAccUtils.h index f26fcd7a86d2..f471fb559a71 100644 --- a/accessible/src/base/nsAccUtils.h +++ b/accessible/src/base/nsAccUtils.h @@ -157,10 +157,11 @@ public: /** * Return document accessible for the given presshell. */ - static nsDocAccessible* GetDocAccessibleFor(const nsIPresShell* aPresShell) + static nsDocAccessible *GetDocAccessibleFor(nsIWeakReference *aWeakShell) { - return aPresShell ? - GetAccService()->GetDocAccessible(aPresShell->GetDocument()) : nsnull; + nsCOMPtr presShell(do_QueryReferent(aWeakShell)); + return presShell ? + GetAccService()->GetDocAccessible(presShell->GetDocument()) : nsnull; } /** diff --git a/accessible/src/base/nsAccessNode.cpp b/accessible/src/base/nsAccessNode.cpp index 1fc01292ca1d..70bb46422425 100644 --- a/accessible/src/base/nsAccessNode.cpp +++ b/accessible/src/base/nsAccessNode.cpp @@ -101,8 +101,8 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsAccessNode, LastRelease()) // nsAccessNode construction/desctruction nsAccessNode:: - nsAccessNode(nsIContent* aContent, nsDocAccessible* aDoc) : - mContent(aContent), mDoc(aDoc) + nsAccessNode(nsIContent *aContent, nsIWeakReference *aShell) : + mContent(aContent), mWeakShell(aShell) { #ifdef DEBUG_A11Y mIsInitialized = false; @@ -111,15 +111,15 @@ nsAccessNode:: nsAccessNode::~nsAccessNode() { - NS_ASSERTION(!mDoc, "LastRelease was never called!?!"); + NS_ASSERTION(!mWeakShell, "LastRelease was never called!?!"); } void nsAccessNode::LastRelease() { // First cleanup if needed... - if (mDoc) { + if (mWeakShell) { Shutdown(); - NS_ASSERTION(!mDoc, "A Shutdown() impl forgot to call its parent's Shutdown?"); + NS_ASSERTION(!mWeakShell, "A Shutdown() impl forgot to call its parent's Shutdown?"); } // ... then die. delete this; @@ -145,7 +145,7 @@ void nsAccessNode::Shutdown() { mContent = nsnull; - mDoc = nsnull; + mWeakShell = nsnull; } nsApplicationAccessible* @@ -227,15 +227,31 @@ void nsAccessNode::ShutdownXPAccessibility() NotifyA11yInitOrShutdown(false); } +already_AddRefed +nsAccessNode::GetPresShell() +{ + nsIPresShell* presShell = nsnull; + if (mWeakShell) + CallQueryReferent(mWeakShell.get(), &presShell); + + return presShell; +} + // nsAccessNode protected nsPresContext* nsAccessNode::GetPresContext() { - if (IsDefunct()) + nsCOMPtr presShell(GetPresShell()); + if (!presShell) { return nsnull; + } + return presShell->GetPresContext(); +} - nsIPresShell* presShell(mDoc->PresShell()); - - return presShell ? presShell->GetPresContext() : nsnull; +nsDocAccessible * +nsAccessNode::GetDocAccessible() const +{ + return mContent ? + GetAccService()->GetDocAccessible(mContent->OwnerDoc()) : nsnull; } nsRootAccessible* @@ -322,13 +338,13 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType) if (IsDefunct()) return NS_ERROR_FAILURE; - nsIPresShell* shell = mDoc->PresShell(); + nsCOMPtr shell(GetPresShell()); NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); nsIFrame *frame = GetFrame(); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); - nsIContent* content = frame->GetContent(); + nsCOMPtr content = frame->GetContent(); NS_ENSURE_TRUE(content, NS_ERROR_FAILURE); PRInt16 vPercent, hPercent; @@ -399,7 +415,9 @@ nsAccessNode::GetCurrentFocus() { // XXX: consider to use nsFocusManager directly, it allows us to avoid // unnecessary query interface calls. - nsIDocument* doc = GetDocumentNode(); + nsCOMPtr shell = GetPresShell(); + NS_ENSURE_TRUE(shell, nsnull); + nsIDocument *doc = shell->GetDocument(); NS_ENSURE_TRUE(doc, nsnull); nsIDOMWindow* win = doc->GetWindow(); diff --git a/accessible/src/base/nsAccessNode.h b/accessible/src/base/nsAccessNode.h index cef411b4f3a3..b58ff1d2f7a7 100644 --- a/accessible/src/base/nsAccessNode.h +++ b/accessible/src/base/nsAccessNode.h @@ -80,7 +80,7 @@ class nsAccessNode: public nsIAccessNode { public: - nsAccessNode(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessNode(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsAccessNode(); NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -100,7 +100,7 @@ public: /** * Return the document accessible for this access node. */ - nsDocAccessible* GetDocAccessible() const { return mDoc; } + nsDocAccessible *GetDocAccessible() const; /** * Return the root document accessible for this accessnode. @@ -171,6 +171,16 @@ public: return GetNode() && GetNode()->IsNodeOfType(nsINode::eDOCUMENT); } + /** + * Return the corresponding press shell for this accessible. + */ + already_AddRefed GetPresShell(); + + /** + * Return presentation shell for the accessible. + */ + nsIWeakReference* GetWeakShell() const { return mWeakShell; } + /** * Return the unique identifier of the accessible. */ @@ -191,7 +201,7 @@ protected: void LastRelease(); nsCOMPtr mContent; - nsDocAccessible* mDoc; + nsCOMPtr mWeakShell; /** * Notify global nsIObserver's that a11y is getting init'd or shutdown diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index ebe33f788e4f..2598db9788bf 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -204,15 +204,14 @@ nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell, } return nsnull; } - + already_AddRefed nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsOuterDocAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsOuterDocAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -220,10 +219,9 @@ already_AddRefed nsAccessibilityService::CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTML4ButtonAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTML4ButtonAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -231,10 +229,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLButtonAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLButtonAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -242,10 +239,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLLIAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLLIAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -253,10 +249,9 @@ already_AddRefed nsAccessibilityService::CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHyperTextAccessibleWrap(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -264,10 +259,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLCheckboxAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLCheckboxAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -275,10 +269,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLComboboxAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLComboboxAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -286,10 +279,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLCanvasAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLCanvasAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLCanvasAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -297,10 +289,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLFileInputAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLFileInputAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLFileInputAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -315,13 +306,11 @@ nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent, mapElm = do_QueryInterface(document->FindImageMap(mapElmName)); } + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); nsAccessible* accessible = mapElm ? - new nsHTMLImageMapAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell), - mapElm) : - new nsHTMLImageAccessibleWrap(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + new nsHTMLImageMapAccessible(aContent, weakShell, mapElm) : + new nsHTMLImageAccessibleWrap(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -329,10 +318,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLGroupboxAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLGroupboxAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -340,10 +328,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLSelectListAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLSelectListAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -351,11 +338,10 @@ already_AddRefed nsAccessibilityService::CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsEnumRoleAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell), - roles::GROUPING); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsEnumRoleAccessible(aContent, weakShell, + roles::GROUPING); + NS_IF_ADDREF(accessible); return accessible; } @@ -375,6 +361,7 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, if (aFrame->GetRect().IsEmpty()) return nsnull; + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); // 1) for object elements containing either HTML or TXT documents nsCOMPtr obj(do_QueryInterface(aContent)); @@ -395,11 +382,10 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, HWND pluginPort = nsnull; aFrame->GetPluginPort(&pluginPort); - nsAccessible* accessible = - new nsHTMLWin32ObjectOwnerAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell), - pluginPort); - NS_ADDREF(accessible); + nsAccessible* accessible = new nsHTMLWin32ObjectOwnerAccessible(aContent, + weakShell, + pluginPort); + NS_IF_ADDREF(accessible); return accessible; #elif MOZ_ACCESSIBILITY_ATK @@ -411,11 +397,9 @@ nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, NPPVpluginNativeAccessibleAtkPlugId, &plugId); if (NS_SUCCEEDED(rv) && !plugId.IsEmpty()) { AtkSocketAccessible* socketAccessible = - new AtkSocketAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell), - plugId); + new AtkSocketAccessible(aContent, weakShell, plugId); - NS_ADDREF(socketAccessible); + NS_IF_ADDREF(socketAccessible); return socketAccessible; } #endif @@ -432,10 +416,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLRadioButtonAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLRadioButtonAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -443,10 +426,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLTableAccessibleWrap(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLTableAccessibleWrap(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -454,10 +436,10 @@ already_AddRefed nsAccessibilityService::CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLTableCellAccessibleWrap(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLTableCellAccessibleWrap(aContent, + weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -465,10 +447,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLTextAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLTextAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -476,10 +457,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLTextFieldAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLTextFieldAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -487,10 +467,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLLabelAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLLabelAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -498,10 +477,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLHRAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLHRAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -509,10 +487,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLBRAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLBRAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -520,10 +497,9 @@ already_AddRefed nsAccessibilityService::CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell) { - nsAccessible* accessible = - new nsHTMLCaptionAccessible(aContent, - nsAccUtils::GetDocAccessibleFor(aPresShell)); - NS_ADDREF(accessible); + nsCOMPtr weakShell(do_GetWeakReference(aPresShell)); + nsAccessible* accessible = new nsHTMLCaptionAccessible(aContent, weakShell); + NS_IF_ADDREF(accessible); return accessible; } @@ -913,12 +889,14 @@ nsAccessibilityService::GetAccessible(nsINode* aNode) } nsAccessible* -nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode, nsIPresShell* aPresShell) +nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode, + nsIWeakReference* aWeakShell) { if (!aNode) return nsnull; - nsDocAccessible* document = nsAccUtils::GetDocAccessibleFor(aPresShell); + // XXX: weak shell is ignored until multiple shell documents are supported. + nsDocAccessible* document = GetDocAccessible(aNode->OwnerDoc()); return document ? document->GetAccessibleOrContainer(aNode) : nsnull; } @@ -1061,7 +1039,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, return nsnull; } - newAcc = new nsHyperTextAccessibleWrap(content, docAcc); + newAcc = new nsHyperTextAccessibleWrap(content, aWeakShell); if (docAcc->BindToDocument(newAcc, nsAccUtils::GetRoleMapEntry(aNode))) return newAcc; return nsnull; @@ -1155,12 +1133,12 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, if (roleMapEntry->role == roles::TABLE || roleMapEntry->role == roles::TREE_TABLE) { - newAcc = new nsARIAGridAccessibleWrap(content, docAcc); + newAcc = new nsARIAGridAccessibleWrap(content, aWeakShell); } else if (roleMapEntry->role == roles::GRID_CELL || roleMapEntry->role == roles::ROWHEADER || roleMapEntry->role == roles::COLUMNHEADER) { - newAcc = new nsARIAGridCellAccessibleWrap(content, docAcc); + newAcc = new nsARIAGridCellAccessibleWrap(content, aWeakShell); } } } @@ -1172,7 +1150,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, // we do not call it if accessibles for table related content are // prevented above. newAcc = CreateHTMLAccessibleByMarkup(weakFrame.GetFrame(), content, - docAcc); + aWeakShell); if (!newAcc) { // Do not create accessible object subtrees for non-rendered table @@ -1204,24 +1182,24 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, if (!newAcc) { // Elements may implement nsIAccessibleProvider via XBL. This allows them to // say what kind of accessible to create. - newAcc = CreateAccessibleByType(content, docAcc); + newAcc = CreateAccessibleByType(content, aWeakShell); } if (!newAcc) { // Create generic accessibles for SVG and MathML nodes. if (content->IsSVG(nsGkAtoms::svg)) { - newAcc = new nsEnumRoleAccessible(content, docAcc, + newAcc = new nsEnumRoleAccessible(content, aWeakShell, roles::DIAGRAM); } else if (content->IsMathML(nsGkAtoms::math)) { - newAcc = new nsEnumRoleAccessible(content, docAcc, + newAcc = new nsEnumRoleAccessible(content, aWeakShell, roles::EQUATION); } } if (!newAcc) { newAcc = CreateAccessibleForDeckChild(weakFrame.GetFrame(), content, - docAcc); + aWeakShell); } // If no accessible, see if we need to create a generic accessible because @@ -1238,11 +1216,11 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode, // other accessibles can point to it, or so that it can hold a state, etc. if (isHTML) { // Interesting HTML container which may have selectable text and/or embedded objects - newAcc = new nsHyperTextAccessibleWrap(content, docAcc); + newAcc = new nsHyperTextAccessibleWrap(content, aWeakShell); } else { // XUL, SVG, MathML etc. // Interesting generic non-HTML container - newAcc = new nsAccessibleWrap(content, docAcc); + newAcc = new nsAccessibleWrap(content, aWeakShell); } } @@ -1323,7 +1301,7 @@ nsAccessibilityService::HasUniversalAriaProperty(nsIContent *aContent) already_AddRefed nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent, - nsDocAccessible* aDoc) + nsIWeakReference* aWeakShell) { nsCOMPtr accessibleProvider(do_QueryInterface(aContent)); if (!accessibleProvider) @@ -1335,7 +1313,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent, return nsnull; if (type == nsIAccessibleProvider::OuterDoc) { - nsAccessible* accessible = new nsOuterDocAccessible(aContent, aDoc); + nsAccessible* accessible = new nsOuterDocAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } @@ -1349,35 +1327,35 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent, // XUL controls case nsIAccessibleProvider::XULAlert: - accessible = new nsXULAlertAccessible(aContent, aDoc); + accessible = new nsXULAlertAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULButton: - accessible = new nsXULButtonAccessible(aContent, aDoc); + accessible = new nsXULButtonAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULCheckbox: - accessible = new nsXULCheckboxAccessible(aContent, aDoc); + accessible = new nsXULCheckboxAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULColorPicker: - accessible = new nsXULColorPickerAccessible(aContent, aDoc); + accessible = new nsXULColorPickerAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULColorPickerTile: - accessible = new nsXULColorPickerTileAccessible(aContent, aDoc); + accessible = new nsXULColorPickerTileAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULCombobox: - accessible = new nsXULComboboxAccessible(aContent, aDoc); + accessible = new nsXULComboboxAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULDropmarker: - accessible = new nsXULDropmarkerAccessible(aContent, aDoc); + accessible = new nsXULDropmarkerAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULGroupbox: - accessible = new nsXULGroupboxAccessible(aContent, aDoc); + accessible = new nsXULGroupboxAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULImage: @@ -1387,40 +1365,40 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent, nsGkAtoms::tooltiptext)) return nsnull; - accessible = new nsHTMLImageAccessibleWrap(aContent, aDoc); + accessible = new nsHTMLImageAccessibleWrap(aContent, aWeakShell); break; } case nsIAccessibleProvider::XULLink: - accessible = new nsXULLinkAccessible(aContent, aDoc); + accessible = new nsXULLinkAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULListbox: - accessible = new nsXULListboxAccessibleWrap(aContent, aDoc); + accessible = new nsXULListboxAccessibleWrap(aContent, aWeakShell); break; case nsIAccessibleProvider::XULListCell: - accessible = new nsXULListCellAccessibleWrap(aContent, aDoc); + accessible = new nsXULListCellAccessibleWrap(aContent, aWeakShell); break; case nsIAccessibleProvider::XULListHead: - accessible = new nsXULColumnsAccessible(aContent, aDoc); + accessible = new nsXULColumnsAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULListHeader: - accessible = new nsXULColumnItemAccessible(aContent, aDoc); + accessible = new nsXULColumnItemAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULListitem: - accessible = new nsXULListitemAccessible(aContent, aDoc); + accessible = new nsXULListitemAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULMenubar: - accessible = new nsXULMenubarAccessible(aContent, aDoc); + accessible = new nsXULMenubarAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULMenuitem: - accessible = new nsXULMenuitemAccessibleWrap(aContent, aDoc); + accessible = new nsXULMenuitemAccessibleWrap(aContent, aWeakShell); break; case nsIAccessibleProvider::XULMenupopup: @@ -1436,167 +1414,167 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent, kNameSpaceID_XUL)) return nsnull; #endif - accessible = new nsXULMenupopupAccessible(aContent, aDoc); + accessible = new nsXULMenupopupAccessible(aContent, aWeakShell); break; } case nsIAccessibleProvider::XULMenuSeparator: - accessible = new nsXULMenuSeparatorAccessible(aContent, aDoc); + accessible = new nsXULMenuSeparatorAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULPane: - accessible = new nsEnumRoleAccessible(aContent, aDoc, + accessible = new nsEnumRoleAccessible(aContent, aWeakShell, roles::PANE); break; case nsIAccessibleProvider::XULProgressMeter: - accessible = new XULProgressMeterAccessible(aContent, aDoc); + accessible = new XULProgressMeterAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULStatusBar: - accessible = new nsXULStatusBarAccessible(aContent, aDoc); + accessible = new nsXULStatusBarAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULScale: - accessible = new nsXULSliderAccessible(aContent, aDoc); + accessible = new nsXULSliderAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULRadioButton: - accessible = new nsXULRadioButtonAccessible(aContent, aDoc); + accessible = new nsXULRadioButtonAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULRadioGroup: - accessible = new nsXULRadioGroupAccessible(aContent, aDoc); + accessible = new nsXULRadioGroupAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULTab: - accessible = new nsXULTabAccessible(aContent, aDoc); + accessible = new nsXULTabAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULTabs: - accessible = new nsXULTabsAccessible(aContent, aDoc); + accessible = new nsXULTabsAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULTabpanels: - accessible = new nsXULTabpanelsAccessible(aContent, aDoc); + accessible = new nsXULTabpanelsAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULText: - accessible = new nsXULTextAccessible(aContent, aDoc); + accessible = new nsXULTextAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULTextBox: - accessible = new nsXULTextFieldAccessible(aContent, aDoc); + accessible = new nsXULTextFieldAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULThumb: - accessible = new nsXULThumbAccessible(aContent, aDoc); + accessible = new nsXULThumbAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULTree: - return CreateAccessibleForXULTree(aContent, aDoc); + return CreateAccessibleForXULTree(aContent, aWeakShell); case nsIAccessibleProvider::XULTreeColumns: - accessible = new nsXULTreeColumnsAccessible(aContent, aDoc); + accessible = new nsXULTreeColumnsAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULTreeColumnItem: - accessible = new nsXULColumnItemAccessible(aContent, aDoc); + accessible = new nsXULColumnItemAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULToolbar: - accessible = new nsXULToolbarAccessible(aContent, aDoc); + accessible = new nsXULToolbarAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULToolbarSeparator: - accessible = new nsXULToolbarSeparatorAccessible(aContent, aDoc); + accessible = new nsXULToolbarSeparatorAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULTooltip: - accessible = new nsXULTooltipAccessible(aContent, aDoc); + accessible = new nsXULTooltipAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XULToolbarButton: - accessible = new nsXULToolbarButtonAccessible(aContent, aDoc); + accessible = new nsXULToolbarButtonAccessible(aContent, aWeakShell); break; #endif // MOZ_XUL // XForms elements case nsIAccessibleProvider::XFormsContainer: - accessible = new nsXFormsContainerAccessible(aContent, aDoc); + accessible = new nsXFormsContainerAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsLabel: - accessible = new nsXFormsLabelAccessible(aContent, aDoc); + accessible = new nsXFormsLabelAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsOutput: - accessible = new nsXFormsOutputAccessible(aContent, aDoc); + accessible = new nsXFormsOutputAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsTrigger: - accessible = new nsXFormsTriggerAccessible(aContent, aDoc); + accessible = new nsXFormsTriggerAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsInput: - accessible = new nsXFormsInputAccessible(aContent, aDoc); + accessible = new nsXFormsInputAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsInputBoolean: - accessible = new nsXFormsInputBooleanAccessible(aContent, aDoc); + accessible = new nsXFormsInputBooleanAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsInputDate: - accessible = new nsXFormsInputDateAccessible(aContent, aDoc); + accessible = new nsXFormsInputDateAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsSecret: - accessible = new nsXFormsSecretAccessible(aContent, aDoc); + accessible = new nsXFormsSecretAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsSliderRange: - accessible = new nsXFormsRangeAccessible(aContent, aDoc); + accessible = new nsXFormsRangeAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsSelect: - accessible = new nsXFormsSelectAccessible(aContent, aDoc); + accessible = new nsXFormsSelectAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsChoices: - accessible = new nsXFormsChoicesAccessible(aContent, aDoc); + accessible = new nsXFormsChoicesAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsSelectFull: - accessible = new nsXFormsSelectFullAccessible(aContent, aDoc); + accessible = new nsXFormsSelectFullAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsItemCheckgroup: - accessible = new nsXFormsItemCheckgroupAccessible(aContent, aDoc); + accessible = new nsXFormsItemCheckgroupAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsItemRadiogroup: - accessible = new nsXFormsItemRadiogroupAccessible(aContent, aDoc); + accessible = new nsXFormsItemRadiogroupAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsSelectCombobox: - accessible = new nsXFormsSelectComboboxAccessible(aContent, aDoc); + accessible = new nsXFormsSelectComboboxAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsItemCombobox: - accessible = new nsXFormsItemComboboxAccessible(aContent, aDoc); + accessible = new nsXFormsItemComboboxAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsDropmarkerWidget: - accessible = new nsXFormsDropmarkerWidgetAccessible(aContent, aDoc); + accessible = new nsXFormsDropmarkerWidgetAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsCalendarWidget: - accessible = new nsXFormsCalendarWidgetAccessible(aContent, aDoc); + accessible = new nsXFormsCalendarWidgetAccessible(aContent, aWeakShell); break; case nsIAccessibleProvider::XFormsComboboxPopupWidget: - accessible = new nsXFormsComboboxPopupWidgetAccessible(aContent, aDoc); + accessible = new nsXFormsComboboxPopupWidgetAccessible(aContent, aWeakShell); break; default: @@ -1610,45 +1588,46 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent, already_AddRefed nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, nsIContent* aContent, - nsDocAccessible* aDoc) + nsIWeakReference* aWeakShell) { // This method assumes we're in an HTML namespace. nsIAtom* tag = aContent->Tag(); if (tag == nsGkAtoms::figcaption) { nsAccessible* accessible = - new nsHTMLFigcaptionAccessible(aContent, aDoc); + new nsHTMLFigcaptionAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::figure) { - nsAccessible* accessible = new nsHTMLFigureAccessible(aContent, aDoc); + nsAccessible* accessible = new nsHTMLFigureAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::legend) { - nsAccessible* accessible = new nsHTMLLegendAccessible(aContent, aDoc); + nsAccessible* accessible = new nsHTMLLegendAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::option) { - nsAccessible* accessible = new nsHTMLSelectOptionAccessible(aContent, aDoc); + nsAccessible* accessible = new nsHTMLSelectOptionAccessible(aContent, + aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::optgroup) { nsAccessible* accessible = new nsHTMLSelectOptGroupAccessible(aContent, - aDoc); + aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::ul || tag == nsGkAtoms::ol || tag == nsGkAtoms::dl) { - nsAccessible* accessible = new nsHTMLListAccessible(aContent, aDoc); + nsAccessible* accessible = new nsHTMLListAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } @@ -1659,12 +1638,13 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aContent); if (roleMapEntry && roleMapEntry->role != roles::NOTHING && roleMapEntry->role != roles::LINK) { - nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent, aDoc); + nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent, + aWeakShell); NS_IF_ADDREF(accessible); return accessible; } - nsAccessible* accessible = new nsHTMLLinkAccessible(aContent, aDoc); + nsAccessible* accessible = new nsHTMLLinkAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } @@ -1675,7 +1655,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, // Normally for li, it is created by the list item frame (in nsBlockFrame) // which knows about the bullet frame; however, in this case the list item // must have been styled using display: foo - nsAccessible* accessible = new nsHTMLLIAccessible(aContent, aDoc); + nsAccessible* accessible = new nsHTMLLIAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } @@ -1692,13 +1672,13 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, tag == nsGkAtoms::h5 || tag == nsGkAtoms::h6 || tag == nsGkAtoms::q) { - nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent, aDoc); + nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::tr) { - nsAccessible* accessible = new nsEnumRoleAccessible(aContent, aDoc, + nsAccessible* accessible = new nsEnumRoleAccessible(aContent, aWeakShell, roles::ROW); NS_IF_ADDREF(accessible); return accessible; @@ -1706,20 +1686,20 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, if (nsCoreUtils::IsHTMLTableHeader(aContent)) { nsAccessible* accessible = new nsHTMLTableHeaderCellAccessibleWrap(aContent, - aDoc); + aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::output) { - nsAccessible* accessible = new nsHTMLOutputAccessible(aContent, aDoc); + nsAccessible* accessible = new nsHTMLOutputAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } if (tag == nsGkAtoms::progress) { nsAccessible* accessible = - new HTMLProgressMeterAccessible(aContent, aDoc); + new HTMLProgressMeterAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } @@ -1803,7 +1783,7 @@ NS_GetAccessibilityService(nsIAccessibilityService** aResult) already_AddRefed nsAccessibilityService::CreateAccessibleForDeckChild(nsIFrame* aFrame, nsIContent* aContent, - nsDocAccessible* aDoc) + nsIWeakReference* aWeakShell) { if (aFrame->GetType() == nsGkAtoms::boxFrame || aFrame->GetType() == nsGkAtoms::scrollFrame) { @@ -1816,12 +1796,13 @@ nsAccessibilityService::CreateAccessibleForDeckChild(nsIFrame* aFrame, #ifdef MOZ_XUL if (parentContent->NodeInfo()->Equals(nsGkAtoms::tabpanels, kNameSpaceID_XUL)) { - nsAccessible* accessible = new nsXULTabpanelAccessible(aContent, aDoc); + nsAccessible* accessible = new nsXULTabpanelAccessible(aContent, + aWeakShell); NS_IF_ADDREF(accessible); return accessible; } #endif - nsAccessible* accessible = new nsEnumRoleAccessible(aContent, aDoc, + nsAccessible* accessible = new nsEnumRoleAccessible(aContent, aWeakShell, roles::PROPERTYPAGE); NS_IF_ADDREF(accessible); return accessible; @@ -1834,7 +1815,7 @@ nsAccessibilityService::CreateAccessibleForDeckChild(nsIFrame* aFrame, #ifdef MOZ_XUL already_AddRefed nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent, - nsDocAccessible* aDoc) + nsIWeakReference* aWeakShell) { nsCOMPtr treeBoxObj = nsCoreUtils::GetTreeBoxObject(aContent); if (!treeBoxObj) @@ -1850,13 +1831,13 @@ nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent, // Outline of list accessible. if (count == 1) { - nsAccessible* accessible = new nsXULTreeAccessible(aContent, aDoc); + nsAccessible* accessible = new nsXULTreeAccessible(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } // Table or tree table accessible. - nsAccessible* accessible = new nsXULTreeGridAccessibleWrap(aContent, aDoc); + nsAccessible* accessible = new nsXULTreeGridAccessibleWrap(aContent, aWeakShell); NS_IF_ADDREF(accessible); return accessible; } diff --git a/accessible/src/base/nsAccessibilityService.h b/accessible/src/base/nsAccessibilityService.h index 8a01ee2898f4..6370e74d6fae 100644 --- a/accessible/src/base/nsAccessibilityService.h +++ b/accessible/src/base/nsAccessibilityService.h @@ -217,15 +217,17 @@ public: * Return an accessible for the given DOM node or container accessible if * the node is not accessible. */ - nsAccessible* GetAccessibleOrContainer(nsINode* aNode, nsIPresShell* aPresShell); + nsAccessible* GetAccessibleOrContainer(nsINode* aNode, + nsIWeakReference* aWeakShell); /** * Return a container accessible for the given DOM node. */ - inline nsAccessible* GetContainerAccessible(nsINode* aNode, nsIPresShell* aPresShell) + inline nsAccessible* GetContainerAccessible(nsINode* aNode, + nsIWeakReference* aWeakShell) { return aNode ? - GetAccessibleOrContainer(aNode->GetNodeParent(), aPresShell) : nsnull; + GetAccessibleOrContainer(aNode->GetNodeParent(), aWeakShell) : nsnull; } private: @@ -251,28 +253,28 @@ private: * interface. */ already_AddRefed - CreateAccessibleByType(nsIContent* aContent, nsDocAccessible* aDoc); + CreateAccessibleByType(nsIContent* aContent, nsIWeakReference* aWeakShell); /** * Create accessible for HTML node by tag name. */ already_AddRefed CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, nsIContent* aContent, - nsDocAccessible* aDoc); + nsIWeakReference* aWeakShell); /** * Create accessible if parent is a deck frame. */ already_AddRefed CreateAccessibleForDeckChild(nsIFrame* aFrame, nsIContent* aContent, - nsDocAccessible* aDoc); + nsIWeakReference* aWeakShell); #ifdef MOZ_XUL /** * Create accessible for XUL tree element. */ already_AddRefed - CreateAccessibleForXULTree(nsIContent* aContent, nsDocAccessible* aDoc); + CreateAccessibleForXULTree(nsIContent* aContent, nsIWeakReference* aWeakShell); #endif /** diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index dd4d0261a5c1..a85043c2c55b 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -190,8 +190,8 @@ nsresult nsAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr) return nsAccessNodeWrap::QueryInterface(aIID, aInstancePtr); } -nsAccessible::nsAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessNodeWrap(aContent, aDoc), +nsAccessible::nsAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessNodeWrap(aContent, aShell), mParent(nsnull), mIndexInParent(-1), mFlags(eChildrenUninitialized), mIndexOfEmbeddedChild(-1), mRoleMapEntry(nsnull) { @@ -597,7 +597,7 @@ nsAccessible::VisibilityState() if (!frame) return vstates; - nsIPresShell* shell(mDoc->PresShell()); + const nsCOMPtr shell(GetPresShell()); if (!shell) return vstates; @@ -764,7 +764,7 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY, // Get accessible for the node with the point or the first accessible in // the DOM parent chain. nsAccessible* accessible = - GetAccService()->GetAccessibleOrContainer(content, presShell); + GetAccService()->GetAccessibleOrContainer(content, mWeakShell); if (!accessible) return fallbackAnswer; @@ -951,7 +951,7 @@ nsAccessible::GetBounds(PRInt32* aX, PRInt32* aY, if (IsDefunct()) return NS_ERROR_FAILURE; - nsIPresShell* presShell = mDoc->PresShell(); + nsCOMPtr presShell = GetPresShell(); // This routine will get the entire rectangle for all the frames in this node. // ------------------------------------------------------------------------- @@ -1630,7 +1630,7 @@ nsAccessible::GetValue(nsAString& aValue) // Check if it's a simple xlink. if (nsCoreUtils::IsXLink(mContent)) { - nsIPresShell* presShell = mDoc->PresShell(); + nsCOMPtr presShell(do_QueryReferent(mWeakShell)); if (presShell) { nsCOMPtr DOMNode(do_QueryInterface(mContent)); return presShell->GetLinkLocation(DOMNode, aValue); @@ -2156,7 +2156,7 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex) if (IsDefunct()) return; - nsIPresShell* presShell = mDoc->PresShell(); + nsCOMPtr presShell = GetPresShell(); // Scroll into view. presShell->ScrollContentIntoView(aContent, NS_PRESSHELL_SCROLL_ANYWHERE, @@ -2936,10 +2936,7 @@ nsAccessible::ContainerWidget() const void nsAccessible::CacheChildren() { - nsDocAccessible* doc = GetDocAccessible(); - NS_ENSURE_TRUE(doc,); - - nsAccTreeWalker walker(doc->GetWeakShell(), mContent, GetAllowsAnonChildAccessibles()); + nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles()); nsAccessible* child = nsnull; while ((child = walker.NextChild()) && AppendChild(child)); @@ -3012,7 +3009,8 @@ nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError) const nsAccessible * nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const { - nsAccessible* accessible = mDoc->GetAccessible(aStartNode); + nsAccessible* accessible = + GetAccService()->GetAccessibleInWeakShell(aStartNode, mWeakShell); if (accessible) return accessible; @@ -3034,7 +3032,8 @@ nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const return nsnull; nsCOMPtr node(do_QueryInterface(currentNode)); - nsAccessible* accessible = mDoc->GetAccessible(node); + nsAccessible* accessible = + GetAccService()->GetAccessibleInWeakShell(node, mWeakShell); if (accessible) return accessible; } diff --git a/accessible/src/base/nsAccessible.h b/accessible/src/base/nsAccessible.h index 7df2e33a6e0f..1e9af8783388 100644 --- a/accessible/src/base/nsAccessible.h +++ b/accessible/src/base/nsAccessible.h @@ -104,7 +104,7 @@ class nsAccessible : public nsAccessNodeWrap, public nsIAccessibleValue { public: - nsAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsAccessible(); NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index 18e3a685196a..9816e1bce084 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -59,8 +59,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsLeafAccessible:: - nsLeafAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsLeafAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -92,8 +92,8 @@ nsLeafAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsLinkableAccessible:: - nsLinkableAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc), + nsLinkableAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell), mActionAcc(nsnull), mIsLink(false), mIsOnclick(false) @@ -253,9 +253,9 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent, //////////////////////////////////////////////////////////////////////////////// nsEnumRoleAccessible:: - nsEnumRoleAccessible(nsIContent* aNode, nsDocAccessible* aDoc, + nsEnumRoleAccessible(nsIContent *aNode, nsIWeakReference *aShell, roles::Role aRole) : - nsAccessibleWrap(aNode, aDoc), mRole(aRole) + nsAccessibleWrap(aNode, aShell), mRole(aRole) { } diff --git a/accessible/src/base/nsBaseWidgetAccessible.h b/accessible/src/base/nsBaseWidgetAccessible.h index 9e061ac2469f..56fbcaa66440 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.h +++ b/accessible/src/base/nsBaseWidgetAccessible.h @@ -56,7 +56,7 @@ class nsLeafAccessible : public nsAccessibleWrap { public: - nsLeafAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsLeafAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -82,7 +82,7 @@ class nsLinkableAccessible : public nsAccessibleWrap public: enum { eAction_Jump = 0 }; - nsLinkableAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsLinkableAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED @@ -123,7 +123,7 @@ protected: class nsEnumRoleAccessible : public nsAccessibleWrap { public: - nsEnumRoleAccessible(nsIContent* aContent, nsDocAccessible* aDoc, + nsEnumRoleAccessible(nsIContent *aContent, nsIWeakReference *aShell, mozilla::a11y::role aRole); virtual ~nsEnumRoleAccessible() { } diff --git a/accessible/src/base/nsDocAccessible.cpp b/accessible/src/base/nsDocAccessible.cpp index b350bce0b40e..ea950f4cb352 100644 --- a/accessible/src/base/nsDocAccessible.cpp +++ b/accessible/src/base/nsDocAccessible.cpp @@ -103,10 +103,9 @@ static const PRUint32 kRelationAttrsLen = NS_ARRAY_LENGTH(kRelationAttrs); nsDocAccessible:: nsDocAccessible(nsIDocument *aDocument, nsIContent *aRootContent, nsIWeakReference *aShell) : - nsHyperTextAccessibleWrap(aRootContent, this), + nsHyperTextAccessibleWrap(aRootContent, aShell), mDocument(aDocument), mScrollPositionChangedTicks(0), - mLoadState(eTreeConstructionPending), mLoadEventType(0), - mPresShell(nsCOMPtr(do_QueryReferent(aShell)).get()) + mLoadState(eTreeConstructionPending), mLoadEventType(0) { mFlags |= eDocAccessible; @@ -130,9 +129,9 @@ nsDocAccessible:: nsDocAccessible::~nsDocAccessible() { - NS_ASSERTION(!mPresShell, "LastRelease was never called!?!"); } + //////////////////////////////////////////////////////////////////////////////// // nsISupports @@ -194,6 +193,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDocAccessible) NS_IMPL_ADDREF_INHERITED(nsDocAccessible, nsHyperTextAccessible) NS_IMPL_RELEASE_INHERITED(nsDocAccessible, nsHyperTextAccessible) + //////////////////////////////////////////////////////////////////////////////// // nsIAccessible @@ -586,7 +586,8 @@ nsDocAccessible::Init() NS_LOG_ACCDOCCREATE_FOR("document initialize", mDocument, this) // Initialize notification controller. - mNotificationController = new NotificationController(this, mPresShell); + nsCOMPtr shell(GetPresShell()); + mNotificationController = new NotificationController(this, shell); if (!mNotificationController) return false; @@ -603,7 +604,7 @@ nsDocAccessible::Init() void nsDocAccessible::Shutdown() { - if (!mPresShell) // already shutdown + if (!mWeakShell) // already shutdown return; NS_LOG_ACCDOCDESTROY_FOR("document shutdown", mDocument, this) @@ -636,7 +637,7 @@ nsDocAccessible::Shutdown() mChildDocuments.Clear(); - mPresShell = nsnull; // Avoid reentrancy + mWeakShell = nsnull; // Avoid reentrancy mDependentIDsHash.Clear(); mNodeToAccessibleMap.Clear(); @@ -650,9 +651,11 @@ nsDocAccessible::Shutdown() nsIFrame* nsDocAccessible::GetFrame() const { + nsCOMPtr shell(do_QueryReferent(mWeakShell)); + nsIFrame* root = nsnull; - if (mPresShell) - root = mPresShell->GetRootFrame(); + if (shell) + root = shell->GetRootFrame(); return root; } @@ -710,7 +713,8 @@ nsresult nsDocAccessible::AddEventListeners() // 1) Set up scroll position listener // 2) Check for editor and listen for changes to editor - NS_ENSURE_TRUE(mPresShell, NS_ERROR_FAILURE); + nsCOMPtr presShell(GetPresShell()); + NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE); nsCOMPtr container = mDocument->GetContainer(); nsCOMPtr docShellTreeItem(do_QueryInterface(container)); @@ -738,7 +742,7 @@ nsresult nsDocAccessible::AddEventListeners() NS_ENSURE_TRUE(rootAccessible, NS_ERROR_FAILURE); nsRefPtr caretAccessible = rootAccessible->GetCaretAccessible(); if (caretAccessible) { - caretAccessible->AddDocSelectionListener(mPresShell); + caretAccessible->AddDocSelectionListener(presShell); } } @@ -784,8 +788,11 @@ nsresult nsDocAccessible::RemoveEventListeners() nsRootAccessible* rootAccessible = RootAccessible(); if (rootAccessible) { nsRefPtr caretAccessible = rootAccessible->GetCaretAccessible(); - if (caretAccessible) - caretAccessible->RemoveDocSelectionListener(mPresShell); + if (caretAccessible) { + // Don't use GetPresShell() which can call Shutdown() if it sees dead pres shell + nsCOMPtr presShell(do_QueryReferent(mWeakShell)); + caretAccessible->RemoveDocSelectionListener(presShell); + } } return NS_OK; @@ -815,10 +822,11 @@ void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure) // nsDocAccessible protected member void nsDocAccessible::AddScrollListener() { - if (!mPresShell) + nsCOMPtr presShell(do_QueryReferent(mWeakShell)); + if (!presShell) return; - nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollableExternal(); + nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollableExternal(); if (sf) { sf->AddScrollPositionListener(this); NS_LOG_ACCDOCCREATE_TEXT("add scroll listener") @@ -828,10 +836,11 @@ void nsDocAccessible::AddScrollListener() // nsDocAccessible protected member void nsDocAccessible::RemoveScrollListener() { - if (!mPresShell) + nsCOMPtr presShell(do_QueryReferent(mWeakShell)); + if (!presShell) return; - nsIScrollableFrame* sf = mPresShell->GetRootScrollFrameAsScrollableExternal(); + nsIScrollableFrame* sf = presShell->GetRootScrollFrameAsScrollableExternal(); if (sf) { sf->RemoveScrollPositionListener(this); } @@ -1269,10 +1278,11 @@ nsDocAccessible::HandleAccEvent(AccEvent* aAccEvent) void* nsDocAccessible::GetNativeWindow() const { - if (!mPresShell) + nsCOMPtr shell(do_QueryReferent(mWeakShell)); + if (!shell) return nsnull; - nsIViewManager* vm = mPresShell->GetViewManager(); + nsIViewManager* vm = shell->GetViewManager(); if (!vm) return nsnull; @@ -1459,7 +1469,7 @@ nsDocAccessible::CacheChildren() { // Search for accessible children starting from the document element since // some web pages tend to insert elements under it rather than document body. - nsAccTreeWalker walker(do_GetWeakReference(mPresShell).get(), mDocument->GetRootElement(), + nsAccTreeWalker walker(mWeakShell, mDocument->GetRootElement(), GetAllowsAnonChildAccessibles()); nsAccessible* child = nsnull; @@ -1815,7 +1825,7 @@ nsDocAccessible::UpdateTree(nsAccessible* aContainer, nsIContent* aChildNode, updateFlags |= UpdateTreeInternal(child, aIsInsert); } else { - nsAccTreeWalker walker(do_GetWeakReference(mPresShell).get(), aChildNode, + nsAccTreeWalker walker(mWeakShell, aChildNode, aContainer->GetAllowsAnonChildAccessibles(), true); while ((child = walker.NextChild())) diff --git a/accessible/src/base/nsDocAccessible.h b/accessible/src/base/nsDocAccessible.h index cf9d716ae6c3..19b34f9f6941 100644 --- a/accessible/src/base/nsDocAccessible.h +++ b/accessible/src/base/nsDocAccessible.h @@ -129,17 +129,6 @@ public: // nsDocAccessible - /** - * Return presentation shell for this document accessible. - */ - nsIPresShell* PresShell() const { return mPresShell; } - - /** - * Return weak reference to presentation shell for this document accessible. - */ - nsIWeakReference* GetWeakShell() const - { return do_GetWeakReference(mPresShell).get(); } - /** * Return true if associated DOM document was loaded and isn't unloading. */ @@ -172,8 +161,7 @@ public: * Return true if the document has given document state. */ bool HasLoadState(LoadState aState) const - { return (mLoadState & static_cast(aState)) == - static_cast(aState); } + { return (mLoadState & aState) == aState; } /** * Return a native window handler or pointer depending on platform. @@ -380,8 +368,6 @@ public: protected: - void LastRelease(); - // nsAccessible virtual void CacheChildren(); @@ -648,10 +634,6 @@ protected: */ nsRefPtr mNotificationController; friend class NotificationController; - -private: - - nsIPresShell* mPresShell; }; NS_DEFINE_STATIC_IID_ACCESSOR(nsDocAccessible, diff --git a/accessible/src/base/nsFormControlAccessible.cpp b/accessible/src/base/nsFormControlAccessible.cpp index 1fa733b4c2de..887c12153371 100644 --- a/accessible/src/base/nsFormControlAccessible.cpp +++ b/accessible/src/base/nsFormControlAccessible.cpp @@ -201,8 +201,8 @@ ProgressMeterAccessible::SetCurrentValue(double aValue) //////////////////////////////////////////////////////////////////////////////// nsRadioButtonAccessible:: - nsRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsFormControlAccessible(aContent, aDoc) + nsRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsFormControlAccessible(aContent, aShell) { } diff --git a/accessible/src/base/nsFormControlAccessible.h b/accessible/src/base/nsFormControlAccessible.h index ccfe8941d3d9..10fec9cce56c 100644 --- a/accessible/src/base/nsFormControlAccessible.h +++ b/accessible/src/base/nsFormControlAccessible.h @@ -50,8 +50,8 @@ template class ProgressMeterAccessible: public nsFormControlAccessible { public: - ProgressMeterAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsFormControlAccessible(aContent, aDoc) + ProgressMeterAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsFormControlAccessible(aContent, aShell) { } @@ -75,7 +75,7 @@ class nsRadioButtonAccessible : public nsFormControlAccessible { public: - nsRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); diff --git a/accessible/src/base/nsOuterDocAccessible.cpp b/accessible/src/base/nsOuterDocAccessible.cpp index cf5ad424f0e1..78ffcdda7da8 100644 --- a/accessible/src/base/nsOuterDocAccessible.cpp +++ b/accessible/src/base/nsOuterDocAccessible.cpp @@ -50,8 +50,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsOuterDocAccessible:: - nsOuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsOuterDocAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/base/nsOuterDocAccessible.h b/accessible/src/base/nsOuterDocAccessible.h index 9a19f1e5232d..c6c87a986365 100644 --- a/accessible/src/base/nsOuterDocAccessible.h +++ b/accessible/src/base/nsOuterDocAccessible.h @@ -53,7 +53,7 @@ class nsOuterDocAccessible : public nsAccessibleWrap { public: - nsOuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsOuterDocAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/base/nsRootAccessible.cpp b/accessible/src/base/nsRootAccessible.cpp index 4e13c9bde831..355effda1b5e 100644 --- a/accessible/src/base/nsRootAccessible.cpp +++ b/accessible/src/base/nsRootAccessible.cpp @@ -371,13 +371,18 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent) nsAutoString eventType; aDOMEvent->GetType(eventType); + nsCOMPtr weakShell = + nsCoreUtils::GetWeakShellFor(origTargetNode); + if (!weakShell) + return; + if (eventType.EqualsLiteral("popuphiding")) { HandlePopupHidingEvent(origTargetNode); return; } nsAccessible* accessible = - GetAccService()->GetAccessibleOrContainer(origTargetNode, nsnull); + GetAccService()->GetAccessibleOrContainer(origTargetNode, weakShell); if (!accessible) return; @@ -563,7 +568,7 @@ void nsRootAccessible::Shutdown() { // Called manually or by nsAccessNode::LastRelease() - if (!PresShell()) + if (!mWeakShell) return; // Already shutdown nsDocAccessibleWrap::Shutdown(); diff --git a/accessible/src/base/nsTextAccessible.cpp b/accessible/src/base/nsTextAccessible.cpp index 475b29fd14cb..c6eb27c46c96 100644 --- a/accessible/src/base/nsTextAccessible.cpp +++ b/accessible/src/base/nsTextAccessible.cpp @@ -49,8 +49,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsTextAccessible:: - nsTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsLinkableAccessible(aContent, aDoc) + nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsLinkableAccessible(aContent, aShell) { mFlags |= eTextLeafAccessible; } diff --git a/accessible/src/base/nsTextAccessible.h b/accessible/src/base/nsTextAccessible.h index ecfe9adb3c8d..be685aea3984 100644 --- a/accessible/src/base/nsTextAccessible.h +++ b/accessible/src/base/nsTextAccessible.h @@ -47,7 +47,7 @@ class nsTextAccessible : public nsLinkableAccessible { public: - nsTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); diff --git a/accessible/src/html/nsHTMLCanvasAccessible.cpp b/accessible/src/html/nsHTMLCanvasAccessible.cpp index 820e8e857477..4a870a9d12e1 100644 --- a/accessible/src/html/nsHTMLCanvasAccessible.cpp +++ b/accessible/src/html/nsHTMLCanvasAccessible.cpp @@ -42,8 +42,8 @@ using namespace mozilla::a11y; nsHTMLCanvasAccessible:: - nsHTMLCanvasAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessible(aContent, aDoc) + nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsHyperTextAccessible(aContent, aShell) { } diff --git a/accessible/src/html/nsHTMLCanvasAccessible.h b/accessible/src/html/nsHTMLCanvasAccessible.h index 0caf534e366b..77614ea5b624 100644 --- a/accessible/src/html/nsHTMLCanvasAccessible.h +++ b/accessible/src/html/nsHTMLCanvasAccessible.h @@ -46,7 +46,7 @@ class nsHTMLCanvasAccessible : public nsHyperTextAccessible { public: - nsHTMLCanvasAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell); virtual ~nsHTMLCanvasAccessible() { } // nsAccessible diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index 69698e1e2e86..3e9ec1df5791 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -68,8 +68,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLCheckboxAccessible:: - nsHTMLCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsFormControlAccessible(aContent, aDoc) + nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsFormControlAccessible(aContent, aShell) { } @@ -154,8 +154,8 @@ nsHTMLCheckboxAccessible::IsWidget() const //////////////////////////////////////////////////////////////////////////////// nsHTMLRadioButtonAccessible:: - nsHTMLRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsRadioButtonAccessible(aContent, aDoc) + nsHTMLRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsRadioButtonAccessible(aContent, aShell) { } @@ -243,8 +243,8 @@ nsHTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet, //////////////////////////////////////////////////////////////////////////////// nsHTMLButtonAccessible:: - nsHTMLButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -358,8 +358,8 @@ nsHTMLButtonAccessible::IsWidget() const //////////////////////////////////////////////////////////////////////////////// nsHTML4ButtonAccessible:: - nsHTML4ButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTML4ButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -423,8 +423,8 @@ nsHTML4ButtonAccessible::IsWidget() const //////////////////////////////////////////////////////////////////////////////// nsHTMLTextFieldAccessible:: - nsHTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLTextFieldAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -655,8 +655,8 @@ nsHTMLTextFieldAccessible::ContainerWidget() const //////////////////////////////////////////////////////////////////////////////// nsHTMLFileInputAccessible:: -nsHTMLFileInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) +nsHTMLFileInputAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { mFlags |= eHTMLFileInputAccessible; } @@ -710,8 +710,8 @@ nsHTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent) //////////////////////////////////////////////////////////////////////////////// nsHTMLGroupboxAccessible:: - nsHTMLGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -770,8 +770,8 @@ nsHTMLGroupboxAccessible::RelationByType(PRUint32 aType) //////////////////////////////////////////////////////////////////////////////// nsHTMLLegendAccessible:: - nsHTMLLegendAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLLegendAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -800,8 +800,8 @@ nsHTMLLegendAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsHTMLFigureAccessible:: - nsHTMLFigureAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLFigureAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -870,8 +870,8 @@ nsHTMLFigureAccessible::Caption() const //////////////////////////////////////////////////////////////////////////////// nsHTMLFigcaptionAccessible:: - nsHTMLFigcaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLFigcaptionAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/html/nsHTMLFormControlAccessible.h b/accessible/src/html/nsHTMLFormControlAccessible.h index 20c9ed21087a..ead615bdacec 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.h +++ b/accessible/src/html/nsHTMLFormControlAccessible.h @@ -56,7 +56,7 @@ class nsHTMLCheckboxAccessible : public nsFormControlAccessible public: enum { eAction_Click = 0 }; - nsHTMLCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -81,7 +81,7 @@ class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible { public: - nsHTMLRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual PRUint64 NativeState(); @@ -100,7 +100,7 @@ class nsHTMLButtonAccessible : public nsHyperTextAccessibleWrap public: enum { eAction_Click = 0 }; - nsHTMLButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -129,7 +129,7 @@ class nsHTML4ButtonAccessible : public nsHyperTextAccessibleWrap public: enum { eAction_Click = 0 }; - nsHTML4ButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTML4ButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -156,7 +156,7 @@ class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap public: enum { eAction_Click = 0 }; - nsHTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLTextFieldAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED @@ -190,7 +190,7 @@ public: class nsHTMLFileInputAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLFileInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLFileInputAccessible(nsIContent* aContent, nsIWeakReference* aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -203,7 +203,7 @@ public: class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual nsresult GetNameInternal(nsAString& aName); @@ -221,7 +221,7 @@ protected: class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLLegendAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLLegendAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -234,7 +234,7 @@ public: class nsHTMLFigureAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLFigureAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLFigureAccessible(nsIContent* aContent, nsIWeakReference* aShell); // nsAccessible virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes); @@ -253,7 +253,7 @@ protected: class nsHTMLFigcaptionAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLFigcaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLFigcaptionAccessible(nsIContent* aContent, nsIWeakReference* aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); diff --git a/accessible/src/html/nsHTMLImageAccessible.cpp b/accessible/src/html/nsHTMLImageAccessible.cpp index 14742e2ae952..f00a853a3a68 100644 --- a/accessible/src/html/nsHTMLImageAccessible.cpp +++ b/accessible/src/html/nsHTMLImageAccessible.cpp @@ -60,8 +60,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLImageAccessible:: - nsHTMLImageAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsLinkableAccessible(aContent, aDoc) + nsHTMLImageAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsLinkableAccessible(aContent, aShell) { } diff --git a/accessible/src/html/nsHTMLImageAccessible.h b/accessible/src/html/nsHTMLImageAccessible.h index d6f54151fa77..93f9fad7b24c 100644 --- a/accessible/src/html/nsHTMLImageAccessible.h +++ b/accessible/src/html/nsHTMLImageAccessible.h @@ -51,7 +51,7 @@ class nsHTMLImageAccessible : public nsLinkableAccessible, public nsIAccessibleImage { public: - nsHTMLImageAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLImageAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/html/nsHTMLImageMapAccessible.cpp b/accessible/src/html/nsHTMLImageMapAccessible.cpp index 72aa40691584..56617be3404f 100644 --- a/accessible/src/html/nsHTMLImageMapAccessible.cpp +++ b/accessible/src/html/nsHTMLImageMapAccessible.cpp @@ -57,9 +57,9 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLImageMapAccessible:: - nsHTMLImageMapAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsIDOMHTMLMapElement* aMapElm) : - nsHTMLImageAccessibleWrap(aContent, aDoc), mMapElement(aMapElm) + nsHTMLImageMapAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsIDOMHTMLMapElement *aMapElm) : + nsHTMLImageAccessibleWrap(aContent, aShell), mMapElement(aMapElm) { } @@ -130,7 +130,7 @@ nsHTMLImageMapAccessible::CacheChildren() nsCOMPtr areaContent(do_QueryInterface(areaNode)); nsRefPtr area = - new nsHTMLAreaAccessible(areaContent, mDoc); + new nsHTMLAreaAccessible(areaContent, mWeakShell); if (!document->BindToDocument(area, nsAccUtils::GetRoleMapEntry(areaContent)) || !AppendChild(area)) { @@ -145,8 +145,8 @@ nsHTMLImageMapAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsHTMLAreaAccessible:: - nsHTMLAreaAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHTMLLinkAccessible(aContent, aDoc) + nsHTMLAreaAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHTMLLinkAccessible(aContent, aShell) { } diff --git a/accessible/src/html/nsHTMLImageMapAccessible.h b/accessible/src/html/nsHTMLImageMapAccessible.h index 7bc1867803bb..3f32cf11aaa8 100644 --- a/accessible/src/html/nsHTMLImageMapAccessible.h +++ b/accessible/src/html/nsHTMLImageMapAccessible.h @@ -51,8 +51,8 @@ class nsHTMLImageMapAccessible : public nsHTMLImageAccessibleWrap { public: - nsHTMLImageMapAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsIDOMHTMLMapElement* aMapElm); + nsHTMLImageMapAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsIDOMHTMLMapElement *aMapElm); // nsISupports and cycle collector NS_DECL_ISUPPORTS_INHERITED @@ -83,7 +83,7 @@ class nsHTMLAreaAccessible : public nsHTMLLinkAccessible { public: - nsHTMLAreaAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLAreaAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible diff --git a/accessible/src/html/nsHTMLLinkAccessible.cpp b/accessible/src/html/nsHTMLLinkAccessible.cpp index f421e1ef5ef3..6f3e9824ea66 100644 --- a/accessible/src/html/nsHTMLLinkAccessible.cpp +++ b/accessible/src/html/nsHTMLLinkAccessible.cpp @@ -43,7 +43,6 @@ #include "Role.h" #include "States.h" -#include "nsDocAccessible.h" #include "nsEventStates.h" #include "mozilla/dom/Element.h" @@ -54,8 +53,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLLinkAccessible:: - nsHTMLLinkAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLLinkAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -117,7 +116,7 @@ nsHTMLLinkAccessible::GetValue(nsAString& aValue) if (!aValue.IsEmpty()) return NS_OK; - nsIPresShell* presShell(mDoc->PresShell()); + nsCOMPtr presShell(do_QueryReferent(mWeakShell)); nsCOMPtr DOMNode(do_QueryInterface(mContent)); return presShell->GetLinkLocation(DOMNode, aValue); } diff --git a/accessible/src/html/nsHTMLLinkAccessible.h b/accessible/src/html/nsHTMLLinkAccessible.h index 12bdeaf7062d..55cc566032a7 100644 --- a/accessible/src/html/nsHTMLLinkAccessible.h +++ b/accessible/src/html/nsHTMLLinkAccessible.h @@ -45,7 +45,7 @@ class nsHTMLLinkAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLLinkAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLLinkAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/html/nsHTMLSelectAccessible.cpp b/accessible/src/html/nsHTMLSelectAccessible.cpp index f05971bd9f35..67353746c268 100644 --- a/accessible/src/html/nsHTMLSelectAccessible.cpp +++ b/accessible/src/html/nsHTMLSelectAccessible.cpp @@ -65,8 +65,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLSelectListAccessible:: - nsHTMLSelectListAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsHTMLSelectListAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { mFlags |= eListControlAccessible; } @@ -179,7 +179,7 @@ nsHTMLSelectListAccessible::CacheChildren() void nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent) { - nsIPresShell* presShell(mDoc->PresShell()); + nsCOMPtr presShell(do_QueryReferent(mWeakShell)); for (nsIContent* childContent = aParentContent->GetFirstChild(); childContent; childContent = childContent->GetNextSibling()) { if (!childContent->IsHTML()) { @@ -193,7 +193,7 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent) // Get an accessible for option or optgroup and cache it. nsRefPtr accessible = GetAccService()->GetOrCreateAccessible(childContent, presShell, - mDoc->GetWeakShell()); + mWeakShell); if (accessible) AppendChild(accessible); @@ -210,8 +210,8 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent) //////////////////////////////////////////////////////////////////////////////// nsHTMLSelectOptionAccessible:: - nsHTMLSelectOptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLSelectOptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -454,9 +454,9 @@ nsHTMLSelectOptionAccessible::GetSelectState(PRUint64* aState) //////////////////////////////////////////////////////////////////////////////// nsHTMLSelectOptGroupAccessible:: - nsHTMLSelectOptGroupAccessible(nsIContent* aContent, - nsDocAccessible* aDoc) : - nsHTMLSelectOptionAccessible(aContent, aDoc) + nsHTMLSelectOptGroupAccessible(nsIContent *aContent, + nsIWeakReference *aShell) : + nsHTMLSelectOptionAccessible(aContent, aShell) { } @@ -511,8 +511,8 @@ nsHTMLSelectOptGroupAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsHTMLComboboxAccessible:: - nsHTMLComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsHTMLComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { mFlags |= eComboboxAccessible; } @@ -552,7 +552,7 @@ nsHTMLComboboxAccessible::CacheChildren() if (!mListAccessible) { mListAccessible = - new nsHTMLComboboxListAccessible(mParent, mContent, mDoc); + new nsHTMLComboboxListAccessible(mParent, mContent, mWeakShell); // Initialize and put into cache. if (!GetDocAccessible()->BindToDocument(mListAccessible, nsnull)) @@ -733,9 +733,9 @@ nsHTMLComboboxAccessible::SelectedOption() const //////////////////////////////////////////////////////////////////////////////// nsHTMLComboboxListAccessible:: - nsHTMLComboboxListAccessible(nsIAccessible* aParent, nsIContent* aContent, - nsDocAccessible* aDoc) : - nsHTMLSelectListAccessible(aContent, aDoc) + nsHTMLComboboxListAccessible(nsIAccessible *aParent, nsIContent *aContent, + nsIWeakReference *aShell) : + nsHTMLSelectListAccessible(aContent, aShell) { } diff --git a/accessible/src/html/nsHTMLSelectAccessible.h b/accessible/src/html/nsHTMLSelectAccessible.h index 821fa73b9c16..796be65d8567 100644 --- a/accessible/src/html/nsHTMLSelectAccessible.h +++ b/accessible/src/html/nsHTMLSelectAccessible.h @@ -68,7 +68,7 @@ class nsHTMLSelectListAccessible : public nsAccessibleWrap { public: - nsHTMLSelectListAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLSelectListAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsHTMLSelectListAccessible() {} // nsAccessible @@ -108,7 +108,7 @@ class nsHTMLSelectOptionAccessible : public nsHyperTextAccessibleWrap public: enum { eAction_Select = 0 }; - nsHTMLSelectOptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLSelectOptionAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsHTMLSelectOptionAccessible() {} // nsIAccessible @@ -152,7 +152,7 @@ class nsHTMLSelectOptGroupAccessible : public nsHTMLSelectOptionAccessible { public: - nsHTMLSelectOptGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLSelectOptGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsHTMLSelectOptGroupAccessible() {} // nsIAccessible @@ -185,7 +185,7 @@ class nsHTMLComboboxAccessible : public nsAccessibleWrap public: enum { eAction_Click = 0 }; - nsHTMLComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsHTMLComboboxAccessible() {} // nsIAccessible @@ -234,9 +234,9 @@ class nsHTMLComboboxListAccessible : public nsHTMLSelectListAccessible { public: - nsHTMLComboboxListAccessible(nsIAccessible* aParent, - nsIContent* aContent, - nsDocAccessible* aDoc); + nsHTMLComboboxListAccessible(nsIAccessible *aParent, + nsIContent *aContent, + nsIWeakReference* aShell); virtual ~nsHTMLComboboxListAccessible() {} // nsAccessNode diff --git a/accessible/src/html/nsHTMLTableAccessible.cpp b/accessible/src/html/nsHTMLTableAccessible.cpp index 9a7e1a7ae283..05ce35aba143 100644 --- a/accessible/src/html/nsHTMLTableAccessible.cpp +++ b/accessible/src/html/nsHTMLTableAccessible.cpp @@ -76,8 +76,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLTableCellAccessible:: - nsHTMLTableCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLTableCellAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -347,11 +347,9 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell, else if (aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells) desiredRole = roles::COLUMNHEADER; - nsIWeakReference* weakShell = mDoc->GetWeakShell(); - do { nsAccessible* headerCell = - GetAccService()->GetAccessibleInWeakShell(headerCellElm, weakShell); + GetAccService()->GetAccessibleInWeakShell(headerCellElm, mWeakShell); if (headerCell && headerCell->Role() == desiredRole) headerCells->AppendElement(static_cast(headerCell), @@ -378,9 +376,9 @@ nsHTMLTableCellAccessible::GetHeaderCells(PRInt32 aRowOrColumnHeaderCell, //////////////////////////////////////////////////////////////////////////////// nsHTMLTableHeaderCellAccessible:: - nsHTMLTableHeaderCellAccessible(nsIContent* aContent, - nsDocAccessible* aDoc) : - nsHTMLTableCellAccessible(aContent, aDoc) + nsHTMLTableHeaderCellAccessible(nsIContent *aContent, + nsIWeakReference *aShell) : + nsHTMLTableCellAccessible(aContent, aShell) { } @@ -438,8 +436,8 @@ nsHTMLTableHeaderCellAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsHTMLTableAccessible:: - nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsHTMLTableAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -460,7 +458,7 @@ nsHTMLTableAccessible::CacheChildren() // caption only, because nsAccessibilityService ensures we don't create // accessibles for the other captions, since only the first is actually // visible. - nsAccTreeWalker walker(mDoc->GetWeakShell(), mContent, GetAllowsAnonChildAccessibles()); + nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles()); nsAccessible* child = nsnull; while ((child = walker.NextChild())) { @@ -706,7 +704,6 @@ nsHTMLTableAccessible::GetSelectedCells(nsIArray **aCells) rowSpan, colSpan, actualRowSpan, actualColSpan; bool isSelected = false; - nsIWeakReference* weakShell = mDoc->GetWeakShell(); PRInt32 rowIndex, index; for (rowIndex = 0, index = 0; rowIndex < rowCount; rowIndex++) { PRInt32 columnIndex; @@ -722,7 +719,7 @@ nsHTMLTableAccessible::GetSelectedCells(nsIArray **aCells) startColIndex == columnIndex && isSelected) { nsCOMPtr cellContent(do_QueryInterface(cellElement)); nsAccessible *cell = - GetAccService()->GetAccessibleInWeakShell(cellContent, weakShell); + GetAccService()->GetAccessibleInWeakShell(cellContent, mWeakShell); selCells->AppendElement(static_cast(cell), false); } } @@ -895,8 +892,8 @@ nsHTMLTableAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr cellContent(do_QueryInterface(cellElement)); - nsAccessible* cell = - GetAccService()->GetAccessibleInWeakShell(cellContent, mDoc->GetWeakShell()); + nsAccessible *cell = + GetAccService()->GetAccessibleInWeakShell(cellContent, mWeakShell); if (!cell) { return NS_ERROR_INVALID_ARG; @@ -1197,7 +1194,7 @@ nsHTMLTableAccessible::AddRowOrColumnToSelection(PRInt32 aIndex, NS_ENSURE_SUCCESS(rv, rv); - nsIPresShell* presShell(mDoc->PresShell()); + nsCOMPtr presShell(GetPresShell()); nsRefPtr tableSelection = const_cast(presShell->ConstFrameSelection()); @@ -1229,7 +1226,7 @@ nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex, nsITableLayout *tableLayout = GetTableLayout(); NS_ENSURE_STATE(tableLayout); - nsIPresShell* presShell(mDoc->PresShell()); + nsCOMPtr presShell(GetPresShell()); nsRefPtr tableSelection = const_cast(presShell->ConstFrameSelection()); diff --git a/accessible/src/html/nsHTMLTableAccessible.h b/accessible/src/html/nsHTMLTableAccessible.h index bf10061ba038..bbff743540f0 100644 --- a/accessible/src/html/nsHTMLTableAccessible.h +++ b/accessible/src/html/nsHTMLTableAccessible.h @@ -52,7 +52,7 @@ class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap, public nsIAccessibleTableCell { public: - nsHTMLTableCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLTableCellAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -95,8 +95,8 @@ protected: class nsHTMLTableHeaderCellAccessible : public nsHTMLTableCellAccessible { public: - nsHTMLTableHeaderCellAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsHTMLTableHeaderCellAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -124,7 +124,7 @@ class nsHTMLTableAccessible : public nsAccessibleWrap, public nsIAccessibleTable { public: - nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLTableAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIACCESSIBLETABLE @@ -211,9 +211,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLTableAccessible, class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLCaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) { } - virtual ~nsHTMLCaptionAccessible() { } + nsHTMLCaptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } // nsIAccessible diff --git a/accessible/src/html/nsHTMLTextAccessible.cpp b/accessible/src/html/nsHTMLTextAccessible.cpp index fe9c359f7e3f..36d6ad47eb73 100644 --- a/accessible/src/html/nsHTMLTextAccessible.cpp +++ b/accessible/src/html/nsHTMLTextAccessible.cpp @@ -61,8 +61,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLTextAccessible:: - nsHTMLTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsTextAccessibleWrap(aContent, aDoc) + nsHTMLTextAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsTextAccessibleWrap(aContent, aShell) { } @@ -122,8 +122,8 @@ nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes //////////////////////////////////////////////////////////////////////////////// nsHTMLHRAccessible:: - nsHTMLHRAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsLeafAccessible(aContent, aDoc) + nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsLeafAccessible(aContent, aShell) { } @@ -139,8 +139,8 @@ nsHTMLHRAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsHTMLBRAccessible:: - nsHTMLBRAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsLeafAccessible(aContent, aDoc) + nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsLeafAccessible(aContent, aShell) { } @@ -168,8 +168,8 @@ nsHTMLBRAccessible::GetNameInternal(nsAString& aName) //////////////////////////////////////////////////////////////////////////////// nsHTMLLabelAccessible:: - nsHTMLLabelAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -192,8 +192,8 @@ nsHTMLLabelAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsHTMLOutputAccessible:: - nsHTMLOutputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -233,14 +233,14 @@ nsHTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut //////////////////////////////////////////////////////////////////////////////// nsHTMLLIAccessible:: - nsHTMLLIAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc), mBullet(nsnull) + nsHTMLLIAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsHyperTextAccessibleWrap(aContent, aShell), mBullet(nsnull) { mFlags |= eHTMLListItemAccessible; nsBlockFrame* blockFrame = do_QueryFrame(GetFrame()); if (blockFrame && blockFrame->HasBullet()) { - mBullet = new nsHTMLListBulletAccessible(mContent, mDoc); + mBullet = new nsHTMLListBulletAccessible(mContent, mWeakShell); if (!GetDocAccessible()->BindToDocument(mBullet, nsnull)) mBullet = nsnull; } @@ -296,7 +296,7 @@ nsHTMLLIAccessible::UpdateBullet(bool aHasBullet) nsDocAccessible* document = GetDocAccessible(); if (aHasBullet) { - mBullet = new nsHTMLListBulletAccessible(mContent, mDoc); + mBullet = new nsHTMLListBulletAccessible(mContent, mWeakShell); if (document->BindToDocument(mBullet, nsnull)) { InsertChildAt(0, mBullet); } @@ -328,8 +328,8 @@ nsHTMLLIAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsHTMLListBulletAccessible:: - nsHTMLListBulletAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsLeafAccessible(aContent, aDoc) + nsHTMLListBulletAccessible(nsIContent* aContent, nsIWeakReference* aShell) : + nsLeafAccessible(aContent, aShell) { } @@ -400,8 +400,8 @@ nsHTMLListBulletAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset //////////////////////////////////////////////////////////////////////////////// nsHTMLListAccessible:: - nsHTMLListAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/html/nsHTMLTextAccessible.h b/accessible/src/html/nsHTMLTextAccessible.h index c2a9c86d1158..44417f98d5ee 100644 --- a/accessible/src/html/nsHTMLTextAccessible.h +++ b/accessible/src/html/nsHTMLTextAccessible.h @@ -50,7 +50,7 @@ class nsHTMLTextAccessible : public nsTextAccessibleWrap { public: - nsHTMLTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLTextAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -70,7 +70,7 @@ public: class nsHTMLHRAccessible : public nsLeafAccessible { public: - nsHTMLHRAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -82,7 +82,7 @@ public: class nsHTMLBRAccessible : public nsLeafAccessible { public: - nsHTMLBRAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual nsresult GetNameInternal(nsAString& aName); @@ -96,7 +96,7 @@ public: class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLLabelAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED @@ -111,7 +111,7 @@ public: class nsHTMLOutputAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLOutputAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell); NS_DECL_ISUPPORTS_INHERITED @@ -127,7 +127,7 @@ public: class nsHTMLListBulletAccessible : public nsLeafAccessible { public: - nsHTMLListBulletAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLListBulletAccessible(nsIContent* aContent, nsIWeakReference* aShell); // nsIAccessible NS_IMETHOD GetName(nsAString& aName); @@ -148,7 +148,7 @@ public: class nsHTMLListAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLListAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -164,7 +164,7 @@ public: class nsHTMLLIAccessible : public nsHyperTextAccessibleWrap { public: - nsHTMLLIAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsHTMLLIAccessible(nsIContent* aContent, nsIWeakReference* aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index b501c30f5a2e..29e567015071 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -41,7 +41,6 @@ #include "nsAccessibilityService.h" #include "nsAccUtils.h" -#include "nsDocAccessible.h" #include "nsTextAttrs.h" #include "Role.h" #include "States.h" @@ -72,8 +71,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHyperTextAccessible:: - nsHyperTextAccessible(nsIContent* aNode, nsDocAccessible* aDoc) : - nsAccessibleWrap(aNode, aDoc) + nsHyperTextAccessible(nsIContent *aNode, nsIWeakReference *aShell) : + nsAccessibleWrap(aNode, aShell) { mFlags |= eHyperTextAccessible; } @@ -210,8 +209,7 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a &startContentOffsetInFrame, &frame); NS_ENSURE_SUCCESS(rv, screenRect); - NS_ENSURE_TRUE(mDoc, screenRect); - nsIPresShell* shell = mDoc->PresShell(); + nsCOMPtr shell = GetPresShell(); NS_ENSURE_TRUE(shell, screenRect); nsPresContext *context = shell->GetPresContext(); @@ -884,10 +882,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe NS_ENSURE_ARG_POINTER(aEndOffset); *aStartOffset = *aEndOffset = 0; - if (!mDoc) - return NS_ERROR_FAILURE; - - nsIPresShell* presShell = mDoc->PresShell(); + nsCOMPtr presShell = GetPresShell(); if (!presShell) { return NS_ERROR_FAILURE; } @@ -1298,10 +1293,7 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY, PRUint32 aCoordType, PRInt32 *aOffset) { *aOffset = -1; - if (!mDoc) - return NS_ERROR_FAILURE; - - nsIPresShell* shell = mDoc->PresShell(); + nsCOMPtr shell = GetPresShell(); if (!shell) { return NS_ERROR_FAILURE; } @@ -1551,12 +1543,14 @@ nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor) if (!editingSession) return NS_OK; // No editing session interface - NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE); - nsIDocument* docNode = mDoc->GetDocumentNode(); - NS_ENSURE_TRUE(docNode, NS_ERROR_FAILURE); + nsCOMPtr shell = GetPresShell(); + NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); + + nsCOMPtr doc = shell->GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); nsCOMPtr editor; - return editingSession->GetEditorForWindow(docNode->GetWindow(), aEditor); + return editingSession->GetEditorForWindow(doc->GetWindow(), aEditor); } /** @@ -1594,10 +1588,11 @@ nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos) // Now that selection is done, move the focus to the selection. nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager(); if (DOMFocusManager) { - NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE); - nsIDocument* docNode = mDoc->GetDocumentNode(); - NS_ENSURE_TRUE(docNode, NS_ERROR_FAILURE); - nsCOMPtr window = docNode->GetWindow(); + nsCOMPtr shell = GetPresShell(); + NS_ENSURE_TRUE(shell, NS_ERROR_FAILURE); + nsCOMPtr doc = shell->GetDocument(); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); + nsCOMPtr window = doc->GetWindow(); nsCOMPtr result; DOMFocusManager->MoveFocus(window, nsnull, nsIFocusManager::MOVEFOCUS_CARET, nsIFocusManager::FLAG_BYMOVEFOCUS, getter_AddRefs(result)); diff --git a/accessible/src/html/nsHyperTextAccessible.h b/accessible/src/html/nsHyperTextAccessible.h index 1522ecb13456..e0e36a2930c3 100644 --- a/accessible/src/html/nsHyperTextAccessible.h +++ b/accessible/src/html/nsHyperTextAccessible.h @@ -76,9 +76,7 @@ class nsHyperTextAccessible : public nsAccessibleWrap, public nsIAccessibleEditableText { public: - nsHyperTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc); - virtual ~nsHyperTextAccessible() { } - + nsHyperTextAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED NS_DECL_NSIACCESSIBLETEXT NS_DECL_NSIACCESSIBLEHYPERTEXT diff --git a/accessible/src/mac/nsAccessNodeWrap.h b/accessible/src/mac/nsAccessNodeWrap.h index e61650264465..867ac7f2e142 100644 --- a/accessible/src/mac/nsAccessNodeWrap.h +++ b/accessible/src/mac/nsAccessNodeWrap.h @@ -47,12 +47,12 @@ class nsAccessNodeWrap : public nsAccessNode { -public: - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc); - virtual ~nsAccessNodeWrap(); + public: // construction, destruction + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell); + virtual ~nsAccessNodeWrap(); - static void InitAccessibility(); - static void ShutdownAccessibility(); + static void InitAccessibility(); + static void ShutdownAccessibility(); }; #endif diff --git a/accessible/src/mac/nsAccessNodeWrap.mm b/accessible/src/mac/nsAccessNodeWrap.mm index 084ac925333f..f4e417f1383f 100644 --- a/accessible/src/mac/nsAccessNodeWrap.mm +++ b/accessible/src/mac/nsAccessNodeWrap.mm @@ -52,8 +52,8 @@ //----------------------------------------------------- nsAccessNodeWrap:: - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessNode(aContent, aDoc) + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessNode(aContent, aShell) { } diff --git a/accessible/src/mac/nsAccessibleWrap.h b/accessible/src/mac/nsAccessibleWrap.h index 1a1fb9c8b98a..6e63ae494a56 100644 --- a/accessible/src/mac/nsAccessibleWrap.h +++ b/accessible/src/mac/nsAccessibleWrap.h @@ -62,7 +62,7 @@ class nsAccessibleWrap : public nsAccessible { public: // construction, destruction - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessibleWrap(nsIContent* aContent, nsIWeakReference* aShell); virtual ~nsAccessibleWrap(); /** diff --git a/accessible/src/mac/nsAccessibleWrap.mm b/accessible/src/mac/nsAccessibleWrap.mm index ad45f36cbdc5..2ef4b1569cae 100644 --- a/accessible/src/mac/nsAccessibleWrap.mm +++ b/accessible/src/mac/nsAccessibleWrap.mm @@ -51,8 +51,8 @@ using namespace mozilla::a11y; nsAccessibleWrap:: - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessible(aContent, aDoc), mNativeObject(nil), + nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessible(aContent, aShell), mNativeObject(nil), mNativeInited(false) { } diff --git a/accessible/src/msaa/nsARIAGridAccessibleWrap.h b/accessible/src/msaa/nsARIAGridAccessibleWrap.h index ad2daa433ac7..962efed325de 100644 --- a/accessible/src/msaa/nsARIAGridAccessibleWrap.h +++ b/accessible/src/msaa/nsARIAGridAccessibleWrap.h @@ -53,8 +53,8 @@ class nsARIAGridAccessibleWrap : public nsARIAGridAccessible, public CAccessibleTable { public: - nsARIAGridAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsARIAGridAccessible(aContent, aDoc) {} + nsARIAGridAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsARIAGridAccessible(aContent, aShell) {} // IUnknown DECL_IUNKNOWN_INHERITED @@ -71,8 +71,8 @@ class nsARIAGridCellAccessibleWrap : public nsARIAGridCellAccessible, public CAccessibleTableCell { public: - nsARIAGridCellAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsARIAGridCellAccessible(aContent, aDoc) {} + nsARIAGridCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsARIAGridCellAccessible(aContent, aShell) {} // IUnknown DECL_IUNKNOWN_INHERITED diff --git a/accessible/src/msaa/nsAccessNodeWrap.cpp b/accessible/src/msaa/nsAccessNodeWrap.cpp index b30a5d330de5..9123392a3040 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.cpp +++ b/accessible/src/msaa/nsAccessNodeWrap.cpp @@ -78,8 +78,8 @@ AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull; //////////////////////////////////////////////////////////////////////////////// nsAccessNodeWrap:: - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessNode(aContent, aDoc) + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessNode(aContent, aShell) { } @@ -421,7 +421,8 @@ nsAccessNodeWrap::MakeAccessNode(nsINode *aNode) nsAccessNodeWrap *newNode = NULL; ISimpleDOMNode *iNode = NULL; - nsAccessible* acc = mDoc->GetAccessible(aNode); + nsAccessible *acc = + GetAccService()->GetAccessibleInWeakShell(aNode, mWeakShell); if (acc) { IAccessible *msaaAccessible = nsnull; acc->GetNativeInterface((void**)&msaaAccessible); // addrefs @@ -435,7 +436,7 @@ nsAccessNodeWrap::MakeAccessNode(nsINode *aNode) return NULL; } - newNode = new nsAccessNodeWrap(content, mDoc); + newNode = new nsAccessNodeWrap(content, mWeakShell); if (!newNode) return NULL; diff --git a/accessible/src/msaa/nsAccessNodeWrap.h b/accessible/src/msaa/nsAccessNodeWrap.h index 2084399ffc1a..df25bf5848a9 100644 --- a/accessible/src/msaa/nsAccessNodeWrap.h +++ b/accessible/src/msaa/nsAccessNodeWrap.h @@ -85,7 +85,7 @@ class nsAccessNodeWrap : public nsAccessNode, STDMETHODIMP QueryService(REFGUID guidService, REFIID riid, void** ppv); public: // construction, destruction - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsAccessNodeWrap(); // IUnknown diff --git a/accessible/src/msaa/nsAccessibleWrap.cpp b/accessible/src/msaa/nsAccessibleWrap.cpp index 8d0676185414..c543cca7fa79 100644 --- a/accessible/src/msaa/nsAccessibleWrap.cpp +++ b/accessible/src/msaa/nsAccessibleWrap.cpp @@ -97,8 +97,8 @@ ITypeInfo* nsAccessibleWrap::gTypeInfo = NULL; // construction //----------------------------------------------------- nsAccessibleWrap:: - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessible(aContent, aDoc), mEnumVARIANTPosition(0) + nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessible(aContent, aShell), mEnumVARIANTPosition(0) { } @@ -1550,7 +1550,7 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent) return NS_OK; // Means we're not active. - NS_ENSURE_TRUE(!IsDefunct(), NS_ERROR_FAILURE); + NS_ENSURE_TRUE(mWeakShell, NS_ERROR_FAILURE); nsAccessible *accessible = aEvent->GetAccessible(); if (!accessible) @@ -1621,10 +1621,6 @@ HWND nsAccessibleWrap::GetHWNDFor(nsAccessible *aAccessible) { if (aAccessible) { - nsDocAccessible* document = aAccessible->GetDocAccessible(); - if(!document) - return nsnull; - // Popup lives in own windows, use its HWND until the popup window is // hidden to make old JAWS versions work with collapsed comboboxes (see // discussion in bug 379678). @@ -1635,7 +1631,7 @@ nsAccessibleWrap::GetHWNDFor(nsAccessible *aAccessible) bool isVisible = false; widget->IsVisible(isVisible); if (isVisible) { - nsCOMPtr shell(document->PresShell()); + nsCOMPtr shell(aAccessible->GetPresShell()); nsIViewManager* vm = shell->GetViewManager(); if (vm) { nsCOMPtr rootWidget; @@ -1650,7 +1646,9 @@ nsAccessibleWrap::GetHWNDFor(nsAccessible *aAccessible) } } - return static_cast(document->GetNativeWindow()); + nsDocAccessible* document = aAccessible->GetDocAccessible(); + if (document) + return static_cast(document->GetNativeWindow()); } return nsnull; } diff --git a/accessible/src/msaa/nsAccessibleWrap.h b/accessible/src/msaa/nsAccessibleWrap.h index 66e273dbd2b3..130dd3f5d5ff 100644 --- a/accessible/src/msaa/nsAccessibleWrap.h +++ b/accessible/src/msaa/nsAccessibleWrap.h @@ -104,7 +104,7 @@ class nsAccessibleWrap : public nsAccessible, public IEnumVARIANT { public: // construction, destruction - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsAccessibleWrap(); // nsISupports diff --git a/accessible/src/msaa/nsHTMLImageAccessibleWrap.h b/accessible/src/msaa/nsHTMLImageAccessibleWrap.h index 57478b525b08..2a582c5214a8 100644 --- a/accessible/src/msaa/nsHTMLImageAccessibleWrap.h +++ b/accessible/src/msaa/nsHTMLImageAccessibleWrap.h @@ -48,8 +48,8 @@ class nsHTMLImageAccessibleWrap : public nsHTMLImageAccessible, public CAccessibleImage { public: - nsHTMLImageAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHTMLImageAccessible(aContent, aDoc) {} + nsHTMLImageAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsHTMLImageAccessible(aContent, aShell) {} // IUnknown DECL_IUNKNOWN_INHERITED diff --git a/accessible/src/msaa/nsHTMLTableAccessibleWrap.h b/accessible/src/msaa/nsHTMLTableAccessibleWrap.h index c0b4ef377970..ffa42023c823 100644 --- a/accessible/src/msaa/nsHTMLTableAccessibleWrap.h +++ b/accessible/src/msaa/nsHTMLTableAccessibleWrap.h @@ -54,8 +54,8 @@ class nsHTMLTableAccessibleWrap : public nsHTMLTableAccessible, public CAccessibleTable { public: - nsHTMLTableAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHTMLTableAccessible(aContent, aDoc) {} + nsHTMLTableAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsHTMLTableAccessible(aContent, aShell) {} // IUnknown DECL_IUNKNOWN_INHERITED @@ -73,8 +73,8 @@ class nsHTMLTableCellAccessibleWrap : public nsHTMLTableCellAccessible, public CAccessibleTableCell { public: - nsHTMLTableCellAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHTMLTableCellAccessible(aContent, aDoc) {} + nsHTMLTableCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsHTMLTableCellAccessible(aContent, aShell) {} // IUnknown DECL_IUNKNOWN_INHERITED @@ -92,9 +92,9 @@ class nsHTMLTableHeaderCellAccessibleWrap : public nsHTMLTableHeaderCellAccessib public CAccessibleTableCell { public: - nsHTMLTableHeaderCellAccessibleWrap(nsIContent* aContent, - nsDocAccessible* aDoc) : - nsHTMLTableHeaderCellAccessible(aContent, aDoc) {} + nsHTMLTableHeaderCellAccessibleWrap(nsIContent *aContent, + nsIWeakReference *aShell) : + nsHTMLTableHeaderCellAccessible(aContent, aShell) {} // IUnknown DECL_IUNKNOWN_INHERITED diff --git a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp index 1a9a070d0fac..6467cf3b1442 100644 --- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp +++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp @@ -48,9 +48,9 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsHTMLWin32ObjectOwnerAccessible:: - nsHTMLWin32ObjectOwnerAccessible(nsIContent* aContent, - nsDocAccessible* aDoc, void* aHwnd) : - nsAccessibleWrap(aContent, aDoc), mHwnd(aHwnd) + nsHTMLWin32ObjectOwnerAccessible(nsIContent *aContent, + nsIWeakReference *aShell, void *aHwnd) : + nsAccessibleWrap(aContent, aShell), mHwnd(aHwnd) { // Our only child is a nsHTMLWin32ObjectAccessible object. mNativeAccessible = new nsHTMLWin32ObjectAccessible(mHwnd); diff --git a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h index dbb632649517..cda51b534030 100644 --- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h +++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h @@ -53,8 +53,8 @@ public: // because the native plugin accessible doesn't know where it exists in the // Mozilla tree, and returns null for previous and next sibling. This would // have the effect of cutting off all content after the plugin. - nsHTMLWin32ObjectOwnerAccessible(nsIContent* aContent, - nsDocAccessible* aDoc, void* aHwnd); + nsHTMLWin32ObjectOwnerAccessible(nsIContent *aContent, + nsIWeakReference *aShell, void *aHwnd); virtual ~nsHTMLWin32ObjectOwnerAccessible() {} // nsAccessNode diff --git a/accessible/src/msaa/nsHyperTextAccessibleWrap.h b/accessible/src/msaa/nsHyperTextAccessibleWrap.h index 82bde6ebb006..a56d28c7dea2 100644 --- a/accessible/src/msaa/nsHyperTextAccessibleWrap.h +++ b/accessible/src/msaa/nsHyperTextAccessibleWrap.h @@ -51,8 +51,8 @@ class nsHyperTextAccessibleWrap : public nsHyperTextAccessible, public CAccessibleEditableText { public: - nsHyperTextAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessible(aContent, aDoc) {} + nsHyperTextAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessible(aContent, aShell) {} // IUnknown DECL_IUNKNOWN_INHERITED diff --git a/accessible/src/msaa/nsTextAccessibleWrap.cpp b/accessible/src/msaa/nsTextAccessibleWrap.cpp index ffc45f68a5ad..0c4d45683137 100644 --- a/accessible/src/msaa/nsTextAccessibleWrap.cpp +++ b/accessible/src/msaa/nsTextAccessibleWrap.cpp @@ -56,8 +56,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsTextAccessibleWrap:: - nsTextAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsTextAccessible(aContent, aDoc) + nsTextAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsTextAccessible(aContent, aShell) { } diff --git a/accessible/src/msaa/nsTextAccessibleWrap.h b/accessible/src/msaa/nsTextAccessibleWrap.h index a368a49d08cf..45750b038bf7 100644 --- a/accessible/src/msaa/nsTextAccessibleWrap.h +++ b/accessible/src/msaa/nsTextAccessibleWrap.h @@ -50,7 +50,7 @@ class nsTextAccessibleWrap : public nsTextAccessible, public ISimpleDOMText { public: - nsTextAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsTextAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsTextAccessibleWrap() {} // IUnknown methods - see iunknown.h for documentation diff --git a/accessible/src/msaa/nsXULListboxAccessibleWrap.cpp b/accessible/src/msaa/nsXULListboxAccessibleWrap.cpp index 54e69536fbac..0bc82b963751 100644 --- a/accessible/src/msaa/nsXULListboxAccessibleWrap.cpp +++ b/accessible/src/msaa/nsXULListboxAccessibleWrap.cpp @@ -43,8 +43,8 @@ //////////////////////////////////////////////////////////////////////////////// nsXULListboxAccessibleWrap:: - nsXULListboxAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULListboxAccessible(aContent, aDoc) + nsXULListboxAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULListboxAccessible(aContent, aShell) { } @@ -62,8 +62,8 @@ IMPL_IUNKNOWN_QUERY_TAIL //////////////////////////////////////////////////////////////////////////////// nsXULListCellAccessibleWrap:: - nsXULListCellAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULListCellAccessible(aContent, aDoc) + nsXULListCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULListCellAccessible(aContent, aShell) { } diff --git a/accessible/src/msaa/nsXULListboxAccessibleWrap.h b/accessible/src/msaa/nsXULListboxAccessibleWrap.h index 5bd50fed60bb..c8b4b4fdb313 100644 --- a/accessible/src/msaa/nsXULListboxAccessibleWrap.h +++ b/accessible/src/msaa/nsXULListboxAccessibleWrap.h @@ -52,7 +52,7 @@ class nsXULListboxAccessibleWrap : public nsXULListboxAccessible, public CAccessibleTable { public: - nsXULListboxAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULListboxAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); // IUnknown DECL_IUNKNOWN_INHERITED @@ -69,7 +69,7 @@ class nsXULListCellAccessibleWrap : public nsXULListCellAccessible, public CAccessibleTableCell { public: - nsXULListCellAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULListCellAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); // IUnknown DECL_IUNKNOWN_INHERITED diff --git a/accessible/src/msaa/nsXULMenuAccessibleWrap.cpp b/accessible/src/msaa/nsXULMenuAccessibleWrap.cpp index a0e6f81ce4c1..20b1fd4a3f62 100644 --- a/accessible/src/msaa/nsXULMenuAccessibleWrap.cpp +++ b/accessible/src/msaa/nsXULMenuAccessibleWrap.cpp @@ -43,8 +43,8 @@ //////////////////////////////////////////////////////////////////////////////// nsXULMenuitemAccessibleWrap:: - nsXULMenuitemAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULMenuitemAccessible(aContent, aDoc) + nsXULMenuitemAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULMenuitemAccessible(aContent, aShell) { } diff --git a/accessible/src/msaa/nsXULMenuAccessibleWrap.h b/accessible/src/msaa/nsXULMenuAccessibleWrap.h index fdd122f43c4f..cb82d65c0c56 100644 --- a/accessible/src/msaa/nsXULMenuAccessibleWrap.h +++ b/accessible/src/msaa/nsXULMenuAccessibleWrap.h @@ -43,7 +43,7 @@ class nsXULMenuitemAccessibleWrap : public nsXULMenuitemAccessible { public: - nsXULMenuitemAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULMenuitemAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsXULMenuitemAccessibleWrap() {} // nsIAccessible diff --git a/accessible/src/msaa/nsXULTreeGridAccessibleWrap.cpp b/accessible/src/msaa/nsXULTreeGridAccessibleWrap.cpp index 50683f666866..9455cec3cbe1 100644 --- a/accessible/src/msaa/nsXULTreeGridAccessibleWrap.cpp +++ b/accessible/src/msaa/nsXULTreeGridAccessibleWrap.cpp @@ -44,8 +44,8 @@ //////////////////////////////////////////////////////////////////////////////// nsXULTreeGridAccessibleWrap:: - nsXULTreeGridAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULTreeGridAccessible(aContent, aDoc) + nsXULTreeGridAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULTreeGridAccessible(aContent, aShell) { } @@ -62,13 +62,13 @@ IMPL_IUNKNOWN_INHERITED1(nsXULTreeGridAccessibleWrap, //////////////////////////////////////////////////////////////////////////////// nsXULTreeGridCellAccessibleWrap:: - nsXULTreeGridCellAccessibleWrap(nsIContent* aContent, - nsDocAccessible* aDoc, - nsXULTreeGridRowAccessible* aRowAcc, - nsITreeBoxObject* aTree, - nsITreeView* aTreeView, + nsXULTreeGridCellAccessibleWrap(nsIContent *aContent, + nsIWeakReference *aShell, + nsXULTreeGridRowAccessible *aRowAcc, + nsITreeBoxObject *aTree, + nsITreeView *aTreeView, PRInt32 aRow, nsITreeColumn* aColumn) : - nsXULTreeGridCellAccessible(aContent, aDoc, aRowAcc, aTree, aTreeView, + nsXULTreeGridCellAccessible(aContent, aShell, aRowAcc, aTree, aTreeView, aRow, aColumn) { } diff --git a/accessible/src/msaa/nsXULTreeGridAccessibleWrap.h b/accessible/src/msaa/nsXULTreeGridAccessibleWrap.h index df4801b55387..1ad02119d8d2 100644 --- a/accessible/src/msaa/nsXULTreeGridAccessibleWrap.h +++ b/accessible/src/msaa/nsXULTreeGridAccessibleWrap.h @@ -53,7 +53,7 @@ class nsXULTreeGridAccessibleWrap : public nsXULTreeGridAccessible, public CAccessibleTable { public: - nsXULTreeGridAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTreeGridAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); // IUnknown DECL_IUNKNOWN_INHERITED @@ -70,11 +70,11 @@ class nsXULTreeGridCellAccessibleWrap : public nsXULTreeGridCellAccessible, public CAccessibleTableCell { public: - nsXULTreeGridCellAccessibleWrap(nsIContent* aContent, - nsDocAccessible* aDoc, - nsXULTreeGridRowAccessible* aRowAcc, - nsITreeBoxObject* aTree, - nsITreeView* aTreeView, + nsXULTreeGridCellAccessibleWrap(nsIContent *aContent, + nsIWeakReference *aShell, + nsXULTreeGridRowAccessible *aRowAcc, + nsITreeBoxObject *aTree, + nsITreeView *aTreeView, PRInt32 aRow, nsITreeColumn* aColumn); // IUnknown diff --git a/accessible/src/other/nsAccessNodeWrap.cpp b/accessible/src/other/nsAccessNodeWrap.cpp index 1eb3632ca73d..c02518b31cd4 100644 --- a/accessible/src/other/nsAccessNodeWrap.cpp +++ b/accessible/src/other/nsAccessNodeWrap.cpp @@ -52,8 +52,8 @@ //----------------------------------------------------- nsAccessNodeWrap:: - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessNode(aContent, aDoc) + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference* aShell) : + nsAccessNode(aContent, aShell) { } diff --git a/accessible/src/other/nsAccessNodeWrap.h b/accessible/src/other/nsAccessNodeWrap.h index ee75d2fbdeb3..315bb28c2c9b 100644 --- a/accessible/src/other/nsAccessNodeWrap.h +++ b/accessible/src/other/nsAccessNodeWrap.h @@ -48,7 +48,7 @@ class nsAccessNodeWrap : public nsAccessNode { public: // construction, destruction - nsAccessNodeWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessNodeWrap(nsIContent *aContent, nsIWeakReference* aShell); virtual ~nsAccessNodeWrap(); static void InitAccessibility(); diff --git a/accessible/src/other/nsAccessibleWrap.cpp b/accessible/src/other/nsAccessibleWrap.cpp index 2c587a64a647..dd3596fd4708 100644 --- a/accessible/src/other/nsAccessibleWrap.cpp +++ b/accessible/src/other/nsAccessibleWrap.cpp @@ -42,8 +42,8 @@ // construction //----------------------------------------------------- nsAccessibleWrap:: - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessible(aContent, aDoc) + nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessible(aContent, aShell) { } diff --git a/accessible/src/other/nsAccessibleWrap.h b/accessible/src/other/nsAccessibleWrap.h index 3cd8085a87a6..44c8caf412fe 100644 --- a/accessible/src/other/nsAccessibleWrap.h +++ b/accessible/src/other/nsAccessibleWrap.h @@ -49,7 +49,7 @@ class nsAccessibleWrap : public nsAccessible { public: // construction, destruction - nsAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc); + nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsAccessibleWrap(); protected: diff --git a/accessible/src/xforms/nsXFormsAccessible.cpp b/accessible/src/xforms/nsXFormsAccessible.cpp index d3f9dbad50c5..c4d37f83eaf2 100644 --- a/accessible/src/xforms/nsXFormsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsAccessible.cpp @@ -40,7 +40,6 @@ #include "nsAccessibilityService.h" #include "nsAccUtils.h" -#include "nsDocAccessible.h" #include "nsTextEquivUtils.h" #include "Role.h" #include "States.h" @@ -78,8 +77,8 @@ nsXFormsAccessibleBase::nsXFormsAccessibleBase() //////////////////////////////////////////////////////////////////////////////// nsXFormsAccessible:: - nsXFormsAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) +nsXFormsAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -124,7 +123,7 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode) if (!children) return; - nsIPresShell* presShell(mDoc->PresShell()); + nsCOMPtr presShell(do_QueryReferent(mWeakShell)); PRUint32 length = 0; children->GetLength(&length); @@ -137,7 +136,7 @@ nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode) nsCOMPtr child(do_QueryInterface(DOMChild)); nsAccessible* accessible = - GetAccService()->GetOrCreateAccessible(child, presShell, mDoc->GetWeakShell()); + GetAccService()->GetOrCreateAccessible(child, presShell, mWeakShell); if (!accessible) continue; @@ -225,8 +224,8 @@ nsXFormsAccessible::GetAllowsAnonChildAccessibles() //////////////////////////////////////////////////////////////////////////////// nsXFormsContainerAccessible:: - nsXFormsContainerAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -248,8 +247,8 @@ nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles() //////////////////////////////////////////////////////////////////////////////// nsXFormsEditableAccessible:: - nsXFormsEditableAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsEditableAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -298,8 +297,8 @@ nsXFormsEditableAccessible::GetAssociatedEditor(nsIEditor **aEditor) //////////////////////////////////////////////////////////////////////////////// nsXFormsSelectableAccessible:: - nsXFormsSelectableAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsEditableAccessible(aContent, aDoc), mIsSelect1Element(nsnull) + nsXFormsSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsEditableAccessible(aContent, aShell), mIsSelect1Element(nsnull) { mIsSelect1Element = mContent->NodeInfo()->Equals(nsGkAtoms::select1); @@ -326,12 +325,12 @@ nsXFormsSelectableAccessible::SelectedItems() nsCOMPtr itemDOMNode; rv = sXFormsService->GetSelectedItemForSelect1(DOMNode, getter_AddRefs(itemDOMNode)); - if (NS_FAILED(rv) || !itemDOMNode || !mDoc) + if (NS_FAILED(rv) || !itemDOMNode) return nsnull; nsCOMPtr itemNode(do_QueryInterface(itemDOMNode)); nsIAccessible* item = GetAccService()->GetAccessibleInWeakShell(itemNode, - mDoc->GetWeakShell()); + mWeakShell); if (item) selectedItems->AppendElement(item, false); @@ -343,12 +342,11 @@ nsXFormsSelectableAccessible::SelectedItems() nsCOMPtr itemNodeList; rv = sXFormsService->GetSelectedItemsForSelect(DOMNode, getter_AddRefs(itemNodeList)); - if (NS_FAILED(rv) || !itemNodeList || !mDoc) + if (NS_FAILED(rv) || !itemNodeList) return nsnull; PRUint32 length = 0; itemNodeList->GetLength(&length); - for (PRUint32 index = 0; index < length; index++) { nsCOMPtr itemDOMNode; itemNodeList->Item(index, getter_AddRefs(itemDOMNode)); @@ -356,7 +354,8 @@ nsXFormsSelectableAccessible::SelectedItems() return nsnull; nsCOMPtr itemNode(do_QueryInterface(itemDOMNode)); - nsIAccessible* item = mDoc->GetAccessible(itemNode); + nsIAccessible* item = GetAccService()->GetAccessibleInWeakShell(itemNode, + mWeakShell); if (item) selectedItems->AppendElement(item, false); } @@ -431,9 +430,6 @@ nsXFormsSelectableAccessible::RemoveItemFromSelection(PRUint32 aIndex) nsAccessible* nsXFormsSelectableAccessible::GetSelectedItem(PRUint32 aIndex) { - if (!mDoc) - return nsnull; - nsresult rv; nsCOMPtr DOMNode(do_QueryInterface(mContent)); if (mIsSelect1Element) { @@ -445,7 +441,7 @@ nsXFormsSelectableAccessible::GetSelectedItem(PRUint32 aIndex) getter_AddRefs(itemDOMNode)); if (NS_SUCCEEDED(rv) && itemDOMNode) { nsCOMPtr itemNode(do_QueryInterface(itemDOMNode)); - return mDoc->GetAccessible(itemNode); + return GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell); } return nsnull; } @@ -460,7 +456,7 @@ nsXFormsSelectableAccessible::GetSelectedItem(PRUint32 aIndex) itemNodeList->Item(aIndex, getter_AddRefs(itemDOMNode)); nsCOMPtr itemNode(do_QueryInterface(itemDOMNode)); - return mDoc->GetAccessible(itemNode); + return GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell); } bool @@ -538,9 +534,9 @@ nsXFormsSelectableAccessible::GetItemByIndex(PRUint32* aIndex, //////////////////////////////////////////////////////////////////////////////// nsXFormsSelectableItemAccessible:: - nsXFormsSelectableItemAccessible(nsIContent* aContent, - nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsSelectableItemAccessible(nsIContent *aContent, + nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } diff --git a/accessible/src/xforms/nsXFormsAccessible.h b/accessible/src/xforms/nsXFormsAccessible.h index 8add1e8988f5..e3c47aaac828 100644 --- a/accessible/src/xforms/nsXFormsAccessible.h +++ b/accessible/src/xforms/nsXFormsAccessible.h @@ -70,7 +70,7 @@ class nsXFormsAccessible : public nsHyperTextAccessibleWrap, public nsXFormsAccessibleBase { public: - nsXFormsAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible @@ -124,7 +124,7 @@ protected: class nsXFormsContainerAccessible : public nsXFormsAccessible { public: - nsXFormsContainerAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -142,7 +142,7 @@ public: class nsXFormsEditableAccessible : public nsXFormsAccessible { public: - nsXFormsEditableAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsEditableAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessibleEditableText NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor); @@ -159,7 +159,7 @@ public: class nsXFormsSelectableAccessible : public nsXFormsEditableAccessible { public: - nsXFormsSelectableAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsSelectableAccessible(nsIContent *aContent, nsIWeakReference *aShell); // SelectAccessible virtual bool IsSelect(); @@ -186,8 +186,8 @@ protected: class nsXFormsSelectableItemAccessible : public nsXFormsAccessible { public: - nsXFormsSelectableItemAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsSelectableItemAccessible(nsIContent *aContent, + nsIWeakReference *aShell); NS_IMETHOD GetValue(nsAString& aValue); NS_IMETHOD DoAction(PRUint8 aIndex); diff --git a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp index 579c0e84cbc7..30f91d31477a 100644 --- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp @@ -49,8 +49,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXFormsLabelAccessible:: - nsXFormsLabelAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -81,8 +81,8 @@ nsXFormsLabelAccessible::Description(nsString& aDescription) //////////////////////////////////////////////////////////////////////////////// nsXFormsOutputAccessible:: - nsXFormsOutputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -98,8 +98,8 @@ nsXFormsOutputAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsXFormsTriggerAccessible:: - nsXFormsTriggerAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsTriggerAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -148,8 +148,8 @@ nsXFormsTriggerAccessible::DoAction(PRUint8 aIndex) //////////////////////////////////////////////////////////////////////////////// nsXFormsInputAccessible:: - nsXFormsInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsEditableAccessible(aContent, aDoc) + nsXFormsInputAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsEditableAccessible(aContent, aShell) { } @@ -193,8 +193,8 @@ nsXFormsInputAccessible::DoAction(PRUint8 aIndex) //////////////////////////////////////////////////////////////////////////////// nsXFormsInputBooleanAccessible:: - nsXFormsInputBooleanAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsInputBooleanAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -261,8 +261,8 @@ nsXFormsInputBooleanAccessible::DoAction(PRUint8 aIndex) //////////////////////////////////////////////////////////////////////////////// nsXFormsInputDateAccessible:: - nsXFormsInputDateAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsContainerAccessible(aContent, aDoc) + nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsContainerAccessible(aContent, aShell) { } @@ -278,8 +278,8 @@ nsXFormsInputDateAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsXFormsSecretAccessible:: - nsXFormsSecretAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsInputAccessible(aContent, aDoc) + nsXFormsSecretAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsInputAccessible(aContent, aShell) { } @@ -307,8 +307,8 @@ nsXFormsSecretAccessible::GetValue(nsAString& aValue) //////////////////////////////////////////////////////////////////////////////// nsXFormsRangeAccessible:: - nsXFormsRangeAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsRangeAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -400,8 +400,8 @@ nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue) //////////////////////////////////////////////////////////////////////////////// nsXFormsSelectAccessible:: - nsXFormsSelectAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsContainerAccessible(aContent, aDoc) + nsXFormsSelectAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsContainerAccessible(aContent, aShell) { } @@ -427,8 +427,8 @@ nsXFormsSelectAccessible::NativeState() //////////////////////////////////////////////////////////////////////////////// nsXFormsChoicesAccessible:: - nsXFormsChoicesAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsChoicesAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } @@ -457,8 +457,8 @@ nsXFormsChoicesAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsXFormsSelectFullAccessible:: - nsXFormsSelectFullAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsSelectableAccessible(aContent, aDoc) + nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsSelectableAccessible(aContent, aShell) { } @@ -480,8 +480,8 @@ nsXFormsSelectFullAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsXFormsItemCheckgroupAccessible:: - nsXFormsItemCheckgroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsSelectableItemAccessible(aContent, aDoc) + nsXFormsItemCheckgroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsSelectableItemAccessible(aContent, aShell) { } @@ -522,8 +522,8 @@ nsXFormsItemCheckgroupAccessible::GetActionName(PRUint8 aIndex, nsAString& aName //////////////////////////////////////////////////////////////////////////////// nsXFormsItemRadiogroupAccessible:: - nsXFormsItemRadiogroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsSelectableItemAccessible(aContent, aDoc) + nsXFormsItemRadiogroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsSelectableItemAccessible(aContent, aShell) { } @@ -560,8 +560,8 @@ nsXFormsItemRadiogroupAccessible::GetActionName(PRUint8 aIndex, nsAString& aName //////////////////////////////////////////////////////////////////////////////// nsXFormsSelectComboboxAccessible:: - nsXFormsSelectComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsSelectableAccessible(aContent, aDoc) + nsXFormsSelectComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsSelectableAccessible(aContent, aShell) { } @@ -601,8 +601,8 @@ nsXFormsSelectComboboxAccessible::GetAllowsAnonChildAccessibles() //////////////////////////////////////////////////////////////////////////////// nsXFormsItemComboboxAccessible:: - nsXFormsItemComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXFormsSelectableItemAccessible(aContent, aDoc) + nsXFormsItemComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXFormsSelectableItemAccessible(aContent, aShell) { } diff --git a/accessible/src/xforms/nsXFormsFormControlsAccessible.h b/accessible/src/xforms/nsXFormsFormControlsAccessible.h index 81176b614bf4..b9a0a3113910 100644 --- a/accessible/src/xforms/nsXFormsFormControlsAccessible.h +++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.h @@ -48,7 +48,7 @@ class nsXFormsLabelAccessible : public nsXFormsAccessible { public: - nsXFormsLabelAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual void Description(nsString& aDescription); @@ -63,7 +63,7 @@ public: class nsXFormsOutputAccessible : public nsXFormsAccessible { public: - nsXFormsOutputAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -76,7 +76,7 @@ public: class nsXFormsTriggerAccessible : public nsXFormsAccessible { public: - nsXFormsTriggerAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsTriggerAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetValue(nsAString& aValue); @@ -98,7 +98,7 @@ public: class nsXFormsInputAccessible : public nsXFormsEditableAccessible { public: - nsXFormsInputAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsInputAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED @@ -120,7 +120,7 @@ public: class nsXFormsInputBooleanAccessible : public nsXFormsAccessible { public: - nsXFormsInputBooleanAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsInputBooleanAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -141,7 +141,7 @@ public: class nsXFormsInputDateAccessible : public nsXFormsContainerAccessible { public: - nsXFormsInputDateAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -154,7 +154,7 @@ public: class nsXFormsSecretAccessible : public nsXFormsInputAccessible { public: - nsXFormsSecretAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsSecretAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetValue(nsAString& aValue); @@ -172,7 +172,7 @@ public: class nsXFormsRangeAccessible : public nsXFormsAccessible { public: - nsXFormsRangeAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsRangeAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessibleValue NS_IMETHOD GetMaximumValue(double *aMaximumValue); @@ -194,7 +194,7 @@ public: class nsXFormsSelectAccessible : public nsXFormsContainerAccessible { public: - nsXFormsSelectAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsSelectAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual PRUint64 NativeState(); @@ -208,7 +208,7 @@ public: class nsXFormsChoicesAccessible : public nsXFormsAccessible { public: - nsXFormsChoicesAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsChoicesAccessible(nsIContent* aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetValue(nsAString& aValue); @@ -230,7 +230,7 @@ protected: class nsXFormsSelectFullAccessible : public nsXFormsSelectableAccessible { public: - nsXFormsSelectFullAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -250,8 +250,8 @@ protected: class nsXFormsItemCheckgroupAccessible : public nsXFormsSelectableItemAccessible { public: - nsXFormsItemCheckgroupAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsItemCheckgroupAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -271,8 +271,8 @@ public: class nsXFormsItemRadiogroupAccessible : public nsXFormsSelectableItemAccessible { public: - nsXFormsItemRadiogroupAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsItemRadiogroupAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -291,8 +291,8 @@ public: class nsXFormsSelectComboboxAccessible : public nsXFormsSelectableAccessible { public: - nsXFormsSelectComboboxAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsSelectComboboxAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -310,8 +310,8 @@ public: class nsXFormsItemComboboxAccessible : public nsXFormsSelectableItemAccessible { public: - nsXFormsItemComboboxAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsItemComboboxAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); diff --git a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp index 7362725b0230..8b02570567a9 100644 --- a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp +++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp @@ -48,9 +48,9 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXFormsDropmarkerWidgetAccessible:: - nsXFormsDropmarkerWidgetAccessible(nsIContent* aContent, - nsDocAccessible* aDoc) : - nsLeafAccessible(aContent, aDoc) + nsXFormsDropmarkerWidgetAccessible(nsIContent *aContent, + nsIWeakReference *aShell) : + nsLeafAccessible(aContent, aShell) { } @@ -113,8 +113,8 @@ nsXFormsDropmarkerWidgetAccessible::DoAction(PRUint8 aIndex) //////////////////////////////////////////////////////////////////////////////// nsXFormsCalendarWidgetAccessible:: - nsXFormsCalendarWidgetAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) +nsXFormsCalendarWidgetAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -130,9 +130,9 @@ nsXFormsCalendarWidgetAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsXFormsComboboxPopupWidgetAccessible:: - nsXFormsComboboxPopupWidgetAccessible(nsIContent* aContent, - nsDocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) + nsXFormsComboboxPopupWidgetAccessible(nsIContent *aContent, + nsIWeakReference *aShell) : + nsXFormsAccessible(aContent, aShell) { } diff --git a/accessible/src/xforms/nsXFormsWidgetsAccessible.h b/accessible/src/xforms/nsXFormsWidgetsAccessible.h index bf140d76f8c1..b5b1f8709d3e 100644 --- a/accessible/src/xforms/nsXFormsWidgetsAccessible.h +++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.h @@ -51,8 +51,8 @@ class nsXFormsDropmarkerWidgetAccessible : public nsLeafAccessible, public nsXFormsAccessibleBase { public: - nsXFormsDropmarkerWidgetAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsDropmarkerWidgetAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -73,8 +73,8 @@ public: class nsXFormsCalendarWidgetAccessible : public nsAccessibleWrap { public: - nsXFormsCalendarWidgetAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsCalendarWidgetAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -88,8 +88,8 @@ public: class nsXFormsComboboxPopupWidgetAccessible : public nsXFormsAccessible { public: - nsXFormsComboboxPopupWidgetAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXFormsComboboxPopupWidgetAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetValue(nsAString& aValue); diff --git a/accessible/src/xul/XULSelectControlAccessible.cpp b/accessible/src/xul/XULSelectControlAccessible.cpp index 9cf18631aac4..72a92b14a430 100644 --- a/accessible/src/xul/XULSelectControlAccessible.cpp +++ b/accessible/src/xul/XULSelectControlAccessible.cpp @@ -61,8 +61,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// XULSelectControlAccessible:: - XULSelectControlAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + XULSelectControlAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { mSelectControl = do_QueryInterface(aContent); } @@ -92,7 +92,7 @@ XULSelectControlAccessible::SelectedItems() { nsCOMPtr selectedItems = do_CreateInstance(NS_ARRAY_CONTRACTID); - if (!selectedItems || !mDoc) + if (!selectedItems) return nsnull; // For XUL multi-select control @@ -105,7 +105,8 @@ XULSelectControlAccessible::SelectedItems() nsCOMPtr itemElm; xulMultiSelect->GetSelectedItem(index, getter_AddRefs(itemElm)); nsCOMPtr itemNode(do_QueryInterface(itemElm)); - nsAccessible* item = mDoc->GetAccessible(itemNode); + nsAccessible* item = + GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell); if (item) selectedItems->AppendElement(static_cast(item), false); @@ -115,12 +116,13 @@ XULSelectControlAccessible::SelectedItems() mSelectControl->GetSelectedItem(getter_AddRefs(itemElm)); nsCOMPtr itemNode(do_QueryInterface(itemElm)); if(itemNode) { - nsAccessible* item = mDoc->GetAccessible(itemNode); + nsAccessible* item = + GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell); if (item) selectedItems->AppendElement(static_cast(item), false); } - } + } nsIMutableArray* items = nsnull; selectedItems.forget(&items); @@ -140,8 +142,8 @@ XULSelectControlAccessible::GetSelectedItem(PRUint32 aIndex) mSelectControl->GetSelectedItem(getter_AddRefs(itemElm)); nsCOMPtr itemNode(do_QueryInterface(itemElm)); - return itemNode && mDoc ? - GetAccService()->GetAccessibleInWeakShell(itemNode, mDoc->GetWeakShell()) : nsnull; + return itemNode ? + GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell) : nsnull; } PRUint32 diff --git a/accessible/src/xul/XULSelectControlAccessible.h b/accessible/src/xul/XULSelectControlAccessible.h index 4941d5f2320b..53f0758e49ee 100644 --- a/accessible/src/xul/XULSelectControlAccessible.h +++ b/accessible/src/xul/XULSelectControlAccessible.h @@ -49,7 +49,7 @@ class XULSelectControlAccessible : public nsAccessibleWrap { public: - XULSelectControlAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + XULSelectControlAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~XULSelectControlAccessible() {} // nsAccessNode diff --git a/accessible/src/xul/nsXULAlertAccessible.cpp b/accessible/src/xul/nsXULAlertAccessible.cpp index 530cf520f640..6669274fdfc7 100644 --- a/accessible/src/xul/nsXULAlertAccessible.cpp +++ b/accessible/src/xul/nsXULAlertAccessible.cpp @@ -47,8 +47,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULAlertAccessible:: - nsXULAlertAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULAlertAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/xul/nsXULAlertAccessible.h b/accessible/src/xul/nsXULAlertAccessible.h index e3eaf6e43cfe..1e217b614b77 100644 --- a/accessible/src/xul/nsXULAlertAccessible.h +++ b/accessible/src/xul/nsXULAlertAccessible.h @@ -47,7 +47,7 @@ class nsXULAlertAccessible : public nsAccessibleWrap { public: - nsXULAlertAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULAlertAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/xul/nsXULColorPickerAccessible.cpp b/accessible/src/xul/nsXULColorPickerAccessible.cpp index 551adf34b593..276a3fecff0f 100644 --- a/accessible/src/xul/nsXULColorPickerAccessible.cpp +++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp @@ -55,8 +55,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULColorPickerTileAccessible:: - nsXULColorPickerTileAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULColorPickerTileAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -117,8 +117,8 @@ nsXULColorPickerTileAccessible::ContainerWidget() const //////////////////////////////////////////////////////////////////////////////// nsXULColorPickerAccessible:: - nsXULColorPickerAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULColorPickerTileAccessible(aContent, aDoc) + nsXULColorPickerAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULColorPickerTileAccessible(aContent, aShell) { mFlags |= eMenuButtonAccessible; } @@ -177,9 +177,7 @@ nsXULColorPickerAccessible::AreItemsOperable() const void nsXULColorPickerAccessible::CacheChildren() { - NS_ENSURE_TRUE(mDoc,); - - nsAccTreeWalker walker(mDoc->GetWeakShell(), mContent, true); + nsAccTreeWalker walker(mWeakShell, mContent, true); nsAccessible* child = nsnull; while ((child = walker.NextChild())) { diff --git a/accessible/src/xul/nsXULColorPickerAccessible.h b/accessible/src/xul/nsXULColorPickerAccessible.h index 7dc3f18bdbb2..5be95f5dca56 100644 --- a/accessible/src/xul/nsXULColorPickerAccessible.h +++ b/accessible/src/xul/nsXULColorPickerAccessible.h @@ -47,8 +47,8 @@ class nsXULColorPickerTileAccessible : public nsAccessibleWrap { public: - nsXULColorPickerTileAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsXULColorPickerTileAccessible(nsIContent *aContent, + nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetValue(nsAString& _retval); @@ -68,7 +68,7 @@ public: class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible { public: - nsXULColorPickerAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULColorPickerAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); diff --git a/accessible/src/xul/nsXULComboboxAccessible.cpp b/accessible/src/xul/nsXULComboboxAccessible.cpp index 658b0299f711..84eb9d2ac6aa 100644 --- a/accessible/src/xul/nsXULComboboxAccessible.cpp +++ b/accessible/src/xul/nsXULComboboxAccessible.cpp @@ -41,7 +41,6 @@ #include "nsXULComboboxAccessible.h" #include "nsAccessibilityService.h" -#include "nsDocAccessible.h" #include "nsCoreUtils.h" #include "Role.h" #include "States.h" @@ -57,8 +56,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULComboboxAccessible:: - nsXULComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::autocomplete, eIgnoreCase)) @@ -132,8 +131,9 @@ nsXULComboboxAccessible::Description(nsString& aDescription) menuListElm->GetSelectedItem(getter_AddRefs(focusedOptionItem)); nsCOMPtr focusedOptionContent = do_QueryInterface(focusedOptionItem); - if (focusedOptionContent && mDoc) { - nsAccessible* focusedOptionAcc = mDoc->GetAccessible(focusedOptionContent); + if (focusedOptionContent) { + nsAccessible* focusedOptionAcc = GetAccService()-> + GetAccessibleInWeakShell(focusedOptionContent, mWeakShell); if (focusedOptionAcc) focusedOptionAcc->Description(aDescription); } diff --git a/accessible/src/xul/nsXULComboboxAccessible.h b/accessible/src/xul/nsXULComboboxAccessible.h index 70da83263d52..c479af111163 100644 --- a/accessible/src/xul/nsXULComboboxAccessible.h +++ b/accessible/src/xul/nsXULComboboxAccessible.h @@ -50,7 +50,7 @@ class nsXULComboboxAccessible : public nsAccessibleWrap public: enum { eAction_Click = 0 }; - nsXULComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetValue(nsAString& aValue); diff --git a/accessible/src/xul/nsXULFormControlAccessible.cpp b/accessible/src/xul/nsXULFormControlAccessible.cpp index ee6e2b503812..6715b9215798 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.cpp +++ b/accessible/src/xul/nsXULFormControlAccessible.cpp @@ -71,8 +71,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULButtonAccessible:: - nsXULButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { if (ContainsMenu()) mFlags |= eMenuButtonAccessible; @@ -226,14 +226,13 @@ nsXULButtonAccessible::CacheChildren() mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, nsGkAtoms::menuButton, eCaseMatters); - NS_ENSURE_TRUE(mDoc,); if (!isMenu && !isMenuButton) return; nsAccessible* menupopup = nsnull; nsAccessible* button = nsnull; - nsAccTreeWalker walker(mDoc->GetWeakShell(), mContent, true); + nsAccTreeWalker walker(mWeakShell, mContent, true); nsAccessible* child = nsnull; while ((child = walker.NextChild())) { @@ -282,8 +281,8 @@ nsXULButtonAccessible::ContainsMenu() //////////////////////////////////////////////////////////////////////////////// nsXULDropmarkerAccessible:: - nsXULDropmarkerAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsFormControlAccessible(aContent, aDoc) + nsXULDropmarkerAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsFormControlAccessible(aContent, aShell) { } @@ -363,8 +362,8 @@ nsXULDropmarkerAccessible::NativeState() //////////////////////////////////////////////////////////////////////////////// nsXULCheckboxAccessible:: - nsXULCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsFormControlAccessible(aContent, aDoc) + nsXULCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsFormControlAccessible(aContent, aShell) { } @@ -443,8 +442,8 @@ nsXULCheckboxAccessible::NativeState() //////////////////////////////////////////////////////////////////////////////// nsXULGroupboxAccessible:: - nsXULGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -500,8 +499,8 @@ nsXULGroupboxAccessible::RelationByType(PRUint32 aType) //////////////////////////////////////////////////////////////////////////////// nsXULRadioButtonAccessible:: - nsXULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsRadioButtonAccessible(aContent, aDoc) + nsXULRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsRadioButtonAccessible(aContent, aShell) { } @@ -559,8 +558,8 @@ nsXULRadioButtonAccessible::ContainerWidget() const */ nsXULRadioGroupAccessible:: - nsXULRadioGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - XULSelectControlAccessible(aContent, aDoc) + nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + XULSelectControlAccessible(aContent, aShell) { } @@ -606,8 +605,8 @@ nsXULRadioGroupAccessible::AreItemsOperable() const //////////////////////////////////////////////////////////////////////////////// nsXULStatusBarAccessible:: - nsXULStatusBarAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -623,8 +622,8 @@ nsXULStatusBarAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsXULToolbarButtonAccessible:: - nsXULToolbarButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULButtonAccessible(aContent, aDoc) + nsXULToolbarButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULButtonAccessible(aContent, aShell) { } @@ -681,8 +680,8 @@ nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible) //////////////////////////////////////////////////////////////////////////////// nsXULToolbarAccessible:: - nsXULToolbarAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -710,9 +709,9 @@ nsXULToolbarAccessible::GetNameInternal(nsAString& aName) //////////////////////////////////////////////////////////////////////////////// nsXULToolbarSeparatorAccessible:: - nsXULToolbarSeparatorAccessible(nsIContent* aContent, - nsDocAccessible* aDoc) : - nsLeafAccessible(aContent, aDoc) + nsXULToolbarSeparatorAccessible(nsIContent *aContent, + nsIWeakReference *aShell) : + nsLeafAccessible(aContent, aShell) { } @@ -733,8 +732,8 @@ nsXULToolbarSeparatorAccessible::NativeState() //////////////////////////////////////////////////////////////////////////////// nsXULTextFieldAccessible:: - nsXULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsXULTextFieldAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -784,7 +783,7 @@ nsXULTextFieldAccessible::NativeState() // Create a temporary accessible from the HTML text field to get // the accessible state from. Doesn't add to cache into document cache. nsRefPtr tempAccessible = - new nsHTMLTextFieldAccessible(inputField, mDoc); + new nsHTMLTextFieldAccessible(inputField, mWeakShell); if (!tempAccessible) return state; @@ -873,14 +872,13 @@ NS_IMETHODIMP nsXULTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor) void nsXULTextFieldAccessible::CacheChildren() { - NS_ENSURE_TRUE(mDoc,); // Create child accessibles for native anonymous content of underlying HTML // input element. nsCOMPtr inputContent(GetInputField()); if (!inputContent) return; - nsAccTreeWalker walker(mDoc->GetWeakShell(), inputContent, false); + nsAccTreeWalker walker(mWeakShell, inputContent, false); nsAccessible* child = nsnull; while ((child = walker.NextChild()) && AppendChild(child)); diff --git a/accessible/src/xul/nsXULFormControlAccessible.h b/accessible/src/xul/nsXULFormControlAccessible.h index 3edde57d4384..be1b534d7778 100644 --- a/accessible/src/xul/nsXULFormControlAccessible.h +++ b/accessible/src/xul/nsXULFormControlAccessible.h @@ -61,7 +61,7 @@ class nsXULButtonAccessible : public nsAccessibleWrap { public: enum { eAction_Click = 0 }; - nsXULButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -100,7 +100,7 @@ class nsXULCheckboxAccessible : public nsFormControlAccessible { public: enum { eAction_Click = 0 }; - nsXULCheckboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -121,7 +121,7 @@ class nsXULDropmarkerAccessible : public nsFormControlAccessible { public: enum { eAction_Click = 0 }; - nsXULDropmarkerAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULDropmarkerAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -144,7 +144,7 @@ private: class nsXULGroupboxAccessible : public nsAccessibleWrap { public: - nsXULGroupboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -159,7 +159,7 @@ class nsXULRadioButtonAccessible : public nsRadioButtonAccessible { public: - nsXULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet, @@ -176,7 +176,7 @@ public: class nsXULRadioGroupAccessible : public XULSelectControlAccessible { public: - nsXULRadioGroupAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -194,7 +194,7 @@ public: class nsXULStatusBarAccessible : public nsAccessibleWrap { public: - nsXULStatusBarAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -206,7 +206,7 @@ public: class nsXULToolbarButtonAccessible : public nsXULButtonAccessible { public: - nsXULToolbarButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULToolbarButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet, @@ -222,7 +222,7 @@ public: class nsXULToolbarAccessible : public nsAccessibleWrap { public: - nsXULToolbarAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -236,7 +236,7 @@ class nsXULToolbarSeparatorAccessible : public nsLeafAccessible { public: nsXULToolbarSeparatorAccessible(nsIContent* aContent, - nsDocAccessible* aDoc); + nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -251,7 +251,7 @@ class nsXULTextFieldAccessible : public nsHyperTextAccessibleWrap public: enum { eAction_Click = 0 }; - nsXULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTextFieldAccessible(nsIContent* aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/xul/nsXULListboxAccessible.cpp b/accessible/src/xul/nsXULListboxAccessible.cpp index 6f34cab5729e..260711e956a9 100644 --- a/accessible/src/xul/nsXULListboxAccessible.cpp +++ b/accessible/src/xul/nsXULListboxAccessible.cpp @@ -42,7 +42,6 @@ #include "nsAccessibilityService.h" #include "nsAccUtils.h" -#include "nsDocAccessible.h" #include "Role.h" #include "States.h" @@ -62,8 +61,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULColumnsAccessible:: - nsXULColumnsAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -85,8 +84,8 @@ nsXULColumnsAccessible::NativeState() //////////////////////////////////////////////////////////////////////////////// nsXULColumnItemAccessible:: - nsXULColumnItemAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsLeafAccessible(aContent, aDoc) + nsXULColumnItemAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsLeafAccessible(aContent, aShell) { } @@ -133,8 +132,8 @@ nsXULColumnItemAccessible::DoAction(PRUint8 aIndex) //////////////////////////////////////////////////////////////////////////////// nsXULListboxAccessible:: - nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - XULSelectControlAccessible(aContent, aDoc) + nsXULListboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + XULSelectControlAccessible(aContent, aShell) { nsIContent* parentContent = mContent->GetParent(); if (parentContent) { @@ -317,8 +316,9 @@ nsXULListboxAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn, NS_ENSURE_TRUE(item, NS_ERROR_INVALID_ARG); nsCOMPtr itemContent(do_QueryInterface(item)); - NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE); - nsAccessible *row = mDoc->GetAccessible(itemContent); + + nsAccessible *row = + GetAccService()->GetAccessibleInWeakShell(itemContent, mWeakShell); NS_ENSURE_STATE(row); nsresult rv = row->GetChildAt(aColumn, aAccessibleCell); @@ -601,13 +601,13 @@ nsXULListboxAccessible::GetSelectedCells(nsIArray **aCells) rv = selectedItems->GetLength(&selectedItemsCount); NS_ENSURE_SUCCESS(rv, rv); - NS_ENSURE_TRUE(mDoc, NS_ERROR_FAILURE); PRUint32 index = 0; for (; index < selectedItemsCount; index++) { nsCOMPtr itemNode; selectedItems->Item(index, getter_AddRefs(itemNode)); nsCOMPtr itemContent(do_QueryInterface(itemNode)); - nsAccessible *item = mDoc->GetAccessible(itemContent); + nsAccessible *item = + GetAccService()->GetAccessibleInWeakShell(itemContent, mWeakShell); if (item) { PRInt32 cellCount = item->GetChildCount(); @@ -900,8 +900,8 @@ nsXULListboxAccessible::ContainerWidget() const //////////////////////////////////////////////////////////////////////////////// nsXULListitemAccessible:: - nsXULListitemAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULMenuitemAccessible(aContent, aDoc) + nsXULListitemAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULMenuitemAccessible(aContent, aShell) { mIsCheckbox = mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type, @@ -929,7 +929,7 @@ nsXULListitemAccessible::GetListAccessible() if (!listContent) return nsnull; - return mDoc->GetAccessible(listContent); + return GetAccService()->GetAccessibleInWeakShell(listContent, mWeakShell); } //////////////////////////////////////////////////////////////////////////////// @@ -1053,8 +1053,8 @@ nsXULListitemAccessible::ContainerWidget() const //////////////////////////////////////////////////////////////////////////////// nsXULListCellAccessible:: - nsXULListCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsXULListCellAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/xul/nsXULListboxAccessible.h b/accessible/src/xul/nsXULListboxAccessible.h index 4e81be3582bf..a51a872255de 100644 --- a/accessible/src/xul/nsXULListboxAccessible.h +++ b/accessible/src/xul/nsXULListboxAccessible.h @@ -56,7 +56,7 @@ class nsIWeakReference; class nsXULColumnsAccessible : public nsAccessibleWrap { public: - nsXULColumnsAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -70,7 +70,7 @@ public: class nsXULColumnItemAccessible : public nsLeafAccessible { public: - nsXULColumnItemAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULColumnItemAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -93,7 +93,7 @@ class nsXULListboxAccessible : public XULSelectControlAccessible, public nsIAccessibleTable { public: - nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULListboxAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsXULListboxAccessible() {} NS_DECL_ISUPPORTS_INHERITED @@ -127,7 +127,7 @@ public: NS_DECL_ISUPPORTS_INHERITED - nsXULListitemAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULListitemAccessible(nsIContent *aContent, nsIWeakReference *aShell); virtual ~nsXULListitemAccessible() {} // nsIAccessible @@ -163,7 +163,7 @@ class nsXULListCellAccessible : public nsHyperTextAccessibleWrap, public nsIAccessibleTableCell { public: - nsXULListCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULListCellAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/xul/nsXULMenuAccessible.cpp b/accessible/src/xul/nsXULMenuAccessible.cpp index ae7423531037..c50149bc8b62 100644 --- a/accessible/src/xul/nsXULMenuAccessible.cpp +++ b/accessible/src/xul/nsXULMenuAccessible.cpp @@ -71,8 +71,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULMenuitemAccessible:: - nsXULMenuitemAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULMenuitemAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -408,8 +408,8 @@ nsXULMenuitemAccessible::ContainerWidget() const //////////////////////////////////////////////////////////////////////////////// nsXULMenuSeparatorAccessible:: - nsXULMenuSeparatorAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULMenuitemAccessible(aContent, aDoc) + nsXULMenuSeparatorAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULMenuitemAccessible(aContent, aShell) { } @@ -454,8 +454,8 @@ nsXULMenuSeparatorAccessible::ActionCount() //////////////////////////////////////////////////////////////////////////////// nsXULMenupopupAccessible:: - nsXULMenupopupAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - XULSelectControlAccessible(aContent, aDoc) + nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + XULSelectControlAccessible(aContent, aShell) { nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame()); if (menuPopupFrame && menuPopupFrame->IsMenu()) @@ -594,8 +594,8 @@ nsXULMenupopupAccessible::ContainerWidget() const //////////////////////////////////////////////////////////////////////////////// nsXULMenubarAccessible:: - nsXULMenubarAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULMenubarAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/xul/nsXULMenuAccessible.h b/accessible/src/xul/nsXULMenuAccessible.h index aeb955c558a0..96b3164eeb58 100644 --- a/accessible/src/xul/nsXULMenuAccessible.h +++ b/accessible/src/xul/nsXULMenuAccessible.h @@ -51,7 +51,7 @@ class nsXULMenuitemAccessible : public nsAccessibleWrap public: enum { eAction_Click = 0 }; - nsXULMenuitemAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULMenuitemAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD DoAction(PRUint8 index); @@ -85,7 +85,7 @@ public: class nsXULMenuSeparatorAccessible : public nsXULMenuitemAccessible { public: - nsXULMenuSeparatorAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULMenuSeparatorAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD DoAction(PRUint8 index); @@ -107,7 +107,7 @@ public: class nsXULMenupopupAccessible : public XULSelectControlAccessible { public: - nsXULMenupopupAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual nsresult GetNameInternal(nsAString& aName); @@ -128,7 +128,7 @@ public: class nsXULMenubarAccessible : public nsAccessibleWrap { public: - nsXULMenubarAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULMenubarAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual nsresult GetNameInternal(nsAString& aName); diff --git a/accessible/src/xul/nsXULSliderAccessible.cpp b/accessible/src/xul/nsXULSliderAccessible.cpp index 96dd77eded07..4141643e9c28 100644 --- a/accessible/src/xul/nsXULSliderAccessible.cpp +++ b/accessible/src/xul/nsXULSliderAccessible.cpp @@ -53,8 +53,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULSliderAccessible:: - nsXULSliderAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULSliderAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -289,8 +289,8 @@ nsXULSliderAccessible::SetSliderAttr(nsIAtom *aName, double aValue) //////////////////////////////////////////////////////////////////////////////// nsXULThumbAccessible:: - nsXULThumbAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/xul/nsXULSliderAccessible.h b/accessible/src/xul/nsXULSliderAccessible.h index 4a26090bda9d..b964a68ef1c6 100644 --- a/accessible/src/xul/nsXULSliderAccessible.h +++ b/accessible/src/xul/nsXULSliderAccessible.h @@ -49,7 +49,7 @@ class nsXULSliderAccessible : public nsAccessibleWrap { public: - nsXULSliderAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULSliderAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -90,7 +90,7 @@ private: class nsXULThumbAccessible : public nsAccessibleWrap { public: - nsXULThumbAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); diff --git a/accessible/src/xul/nsXULTabAccessible.cpp b/accessible/src/xul/nsXULTabAccessible.cpp index cd73a82fdac0..95367f872e9a 100644 --- a/accessible/src/xul/nsXULTabAccessible.cpp +++ b/accessible/src/xul/nsXULTabAccessible.cpp @@ -59,8 +59,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULTabAccessible:: - nsXULTabAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULTabAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -178,8 +178,8 @@ nsXULTabAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet, //////////////////////////////////////////////////////////////////////////////// nsXULTabsAccessible:: - nsXULTabsAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - XULSelectControlAccessible(aContent, aDoc) + nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + XULSelectControlAccessible(aContent, aShell) { } @@ -214,8 +214,8 @@ nsXULTabsAccessible::GetNameInternal(nsAString& aName) //////////////////////////////////////////////////////////////////////////////// nsXULTabpanelsAccessible:: - nsXULTabpanelsAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } @@ -231,8 +231,8 @@ nsXULTabpanelsAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsXULTabpanelAccessible:: - nsXULTabpanelAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULTabpanelAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/xul/nsXULTabAccessible.h b/accessible/src/xul/nsXULTabAccessible.h index dd8223f1d2a8..6407c9a56444 100644 --- a/accessible/src/xul/nsXULTabAccessible.h +++ b/accessible/src/xul/nsXULTabAccessible.h @@ -52,7 +52,7 @@ class nsXULTabAccessible : public nsAccessibleWrap public: enum { eAction_Switch = 0 }; - nsXULTabAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTabAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName); @@ -76,7 +76,7 @@ public: class nsXULTabsAccessible : public XULSelectControlAccessible { public: - nsXULTabsAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsIAccessible NS_IMETHOD GetValue(nsAString& _retval); @@ -96,7 +96,7 @@ public: class nsXULTabpanelsAccessible : public nsAccessibleWrap { public: - nsXULTabpanelsAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -116,7 +116,7 @@ public: class nsXULTabpanelAccessible : public nsAccessibleWrap { public: - nsXULTabpanelAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTabpanelAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); diff --git a/accessible/src/xul/nsXULTextAccessible.cpp b/accessible/src/xul/nsXULTextAccessible.cpp index 639acf004da6..2c1654dbf139 100644 --- a/accessible/src/xul/nsXULTextAccessible.cpp +++ b/accessible/src/xul/nsXULTextAccessible.cpp @@ -61,8 +61,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULTextAccessible:: - nsXULTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsXULTextAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } @@ -112,8 +112,8 @@ nsXULTextAccessible::RelationByType(PRUint32 aType) //////////////////////////////////////////////////////////////////////////////// nsXULTooltipAccessible:: - nsXULTooltipAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsLeafAccessible(aContent, aDoc) + nsXULTooltipAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsLeafAccessible(aContent, aShell) { } @@ -139,8 +139,8 @@ nsXULTooltipAccessible::NativeRole() //////////////////////////////////////////////////////////////////////////////// nsXULLinkAccessible:: - nsXULLinkAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsHyperTextAccessibleWrap(aContent, aDoc) + nsXULLinkAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsHyperTextAccessibleWrap(aContent, aShell) { } diff --git a/accessible/src/xul/nsXULTextAccessible.h b/accessible/src/xul/nsXULTextAccessible.h index 4d9a312ee014..36c114e80e6a 100644 --- a/accessible/src/xul/nsXULTextAccessible.h +++ b/accessible/src/xul/nsXULTextAccessible.h @@ -49,7 +49,7 @@ class nsXULTextAccessible : public nsHyperTextAccessibleWrap { public: - nsXULTextAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTextAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual nsresult GetNameInternal(nsAString& aName); @@ -65,7 +65,7 @@ class nsXULTooltipAccessible : public nsLeafAccessible { public: - nsXULTooltipAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTooltipAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsAccessible virtual mozilla::a11y::role NativeRole(); @@ -76,7 +76,7 @@ class nsXULLinkAccessible : public nsHyperTextAccessibleWrap { public: - nsXULLinkAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULLinkAccessible(nsIContent *aContent, nsIWeakReference *aShell); NS_DECL_ISUPPORTS_INHERITED diff --git a/accessible/src/xul/nsXULTreeAccessible.cpp b/accessible/src/xul/nsXULTreeAccessible.cpp index e2ae281f2378..6f3f475e0f62 100644 --- a/accessible/src/xul/nsXULTreeAccessible.cpp +++ b/accessible/src/xul/nsXULTreeAccessible.cpp @@ -65,8 +65,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULTreeAccessible:: - nsXULTreeAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsAccessibleWrap(aContent, aDoc) + nsXULTreeAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsAccessibleWrap(aContent, aShell) { mTree = nsCoreUtils::GetTreeBoxObject(aContent); if (mTree) @@ -685,7 +685,7 @@ already_AddRefed nsXULTreeAccessible::CreateTreeItemAccessible(PRInt32 aRow) { nsRefPtr accessible = - new nsXULTreeItemAccessible(mContent, mDoc, this, mTree, mTreeView, + new nsXULTreeItemAccessible(mContent, mWeakShell, this, mTree, mTreeView, aRow); return accessible.forget(); @@ -696,10 +696,10 @@ nsXULTreeAccessible::CreateTreeItemAccessible(PRInt32 aRow) //////////////////////////////////////////////////////////////////////////////// nsXULTreeItemAccessibleBase:: - nsXULTreeItemAccessibleBase(nsIContent* aContent, nsDocAccessible* aDoc, - nsAccessible* aParent, nsITreeBoxObject* aTree, - nsITreeView* aTreeView, PRInt32 aRow) : - nsAccessibleWrap(aContent, aDoc), + nsXULTreeItemAccessibleBase(nsIContent *aContent, nsIWeakReference *aShell, + nsAccessible *aParent, nsITreeBoxObject *aTree, + nsITreeView *aTreeView, PRInt32 aRow) : + nsAccessibleWrap(aContent, aShell), mTree(aTree), mTreeView(aTreeView), mRow(aRow) { mParent = aParent; @@ -1113,10 +1113,10 @@ nsXULTreeItemAccessibleBase::GetCellName(nsITreeColumn* aColumn, //////////////////////////////////////////////////////////////////////////////// nsXULTreeItemAccessible:: - nsXULTreeItemAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsAccessible* aParent, nsITreeBoxObject* aTree, - nsITreeView* aTreeView, PRInt32 aRow) : - nsXULTreeItemAccessibleBase(aContent, aDoc, aParent, aTree, aTreeView, aRow) + nsXULTreeItemAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsAccessible *aParent, nsITreeBoxObject *aTree, + nsITreeView *aTreeView, PRInt32 aRow) : + nsXULTreeItemAccessibleBase(aContent, aShell, aParent, aTree, aTreeView, aRow) { mColumn = nsCoreUtils::GetFirstSensibleColumn(mTree); } @@ -1231,8 +1231,8 @@ nsXULTreeItemAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsXULTreeColumnsAccessible:: - nsXULTreeColumnsAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULColumnsAccessible(aContent, aDoc) + nsXULTreeColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULColumnsAccessible(aContent, aShell) { } diff --git a/accessible/src/xul/nsXULTreeAccessible.h b/accessible/src/xul/nsXULTreeAccessible.h index 2b59389dd56c..9e6fec36b99b 100644 --- a/accessible/src/xul/nsXULTreeAccessible.h +++ b/accessible/src/xul/nsXULTreeAccessible.h @@ -67,7 +67,7 @@ public: using nsAccessible::GetChildCount; using nsAccessible::GetChildAt; - nsXULTreeAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTreeAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports and cycle collection NS_DECL_ISUPPORTS_INHERITED @@ -180,9 +180,9 @@ class nsXULTreeItemAccessibleBase : public nsAccessibleWrap public: using nsAccessible::GetParent; - nsXULTreeItemAccessibleBase(nsIContent* aContent, nsDocAccessible* aDoc, - nsAccessible* aParent, nsITreeBoxObject* aTree, - nsITreeView* aTreeView, PRInt32 aRow); + nsXULTreeItemAccessibleBase(nsIContent *aContent, nsIWeakReference *aShell, + nsAccessible *aParent, nsITreeBoxObject *aTree, + nsITreeView *aTreeView, PRInt32 aRow); // nsISupports and cycle collection NS_DECL_ISUPPORTS_INHERITED @@ -275,9 +275,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeItemAccessibleBase, class nsXULTreeItemAccessible : public nsXULTreeItemAccessibleBase { public: - nsXULTreeItemAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsAccessible* aParent, nsITreeBoxObject* aTree, - nsITreeView* aTreeView, PRInt32 aRow); + nsXULTreeItemAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsAccessible *aParent, nsITreeBoxObject *aTree, + nsITreeView *aTreeView, PRInt32 aRow); // nsISupports and cycle collection NS_DECL_ISUPPORTS_INHERITED @@ -314,7 +314,7 @@ protected: class nsXULTreeColumnsAccessible : public nsXULColumnsAccessible { public: - nsXULTreeColumnsAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTreeColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell); protected: diff --git a/accessible/src/xul/nsXULTreeGridAccessible.cpp b/accessible/src/xul/nsXULTreeGridAccessible.cpp index d42dc83f582d..dc661147e35b 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.cpp +++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp @@ -57,8 +57,8 @@ using namespace mozilla::a11y; //////////////////////////////////////////////////////////////////////////////// nsXULTreeGridAccessible:: - nsXULTreeGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) : - nsXULTreeAccessible(aContent, aDoc) + nsXULTreeGridAccessible(nsIContent *aContent, nsIWeakReference *aShell) : + nsXULTreeAccessible(aContent, aShell) { } @@ -605,7 +605,7 @@ already_AddRefed nsXULTreeGridAccessible::CreateTreeItemAccessible(PRInt32 aRow) { nsRefPtr accessible = - new nsXULTreeGridRowAccessible(mContent, mDoc, this, mTree, + new nsXULTreeGridRowAccessible(mContent, mWeakShell, this, mTree, mTreeView, aRow); return accessible.forget(); @@ -617,10 +617,10 @@ nsXULTreeGridAccessible::CreateTreeItemAccessible(PRInt32 aRow) //////////////////////////////////////////////////////////////////////////////// nsXULTreeGridRowAccessible:: - nsXULTreeGridRowAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsAccessible* aTreeAcc, nsITreeBoxObject* aTree, - nsITreeView* aTreeView, PRInt32 aRow) : - nsXULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow) + nsXULTreeGridRowAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsAccessible *aTreeAcc, nsITreeBoxObject* aTree, + nsITreeView *aTreeView, PRInt32 aRow) : + nsXULTreeItemAccessibleBase(aContent, aShell, aTreeAcc, aTree, aTreeView, aRow) { mAccessibleCache.Init(kDefaultTreeCacheSize); } @@ -761,7 +761,7 @@ nsXULTreeGridRowAccessible::GetCellAccessible(nsITreeColumn* aColumn) return cachedCell; nsRefPtr cell = - new nsXULTreeGridCellAccessibleWrap(mContent, mDoc, this, mTree, + new nsXULTreeGridCellAccessibleWrap(mContent, mWeakShell, this, mTree, mTreeView, mRow, aColumn); if (cell) { if (mAccessibleCache.Put(key, cell)) { @@ -811,11 +811,11 @@ nsXULTreeGridRowAccessible::CacheChildren() //////////////////////////////////////////////////////////////////////////////// nsXULTreeGridCellAccessible:: - nsXULTreeGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsXULTreeGridRowAccessible* aRowAcc, - nsITreeBoxObject* aTree, nsITreeView* aTreeView, - PRInt32 aRow, nsITreeColumn* aColumn) : - nsLeafAccessible(aContent, aDoc), mTree(aTree), +nsXULTreeGridCellAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsXULTreeGridRowAccessible *aRowAcc, + nsITreeBoxObject *aTree, nsITreeView *aTreeView, + PRInt32 aRow, nsITreeColumn* aColumn) : + nsLeafAccessible(aContent, aShell), mTree(aTree), mTreeView(aTreeView), mRow(aRow), mColumn(aColumn) { mParent = aRowAcc; @@ -1065,7 +1065,7 @@ nsXULTreeGridCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells) NS_ENSURE_ARG_POINTER(aHeaderCells); *aHeaderCells = nsnull; - if (IsDefunct() || !mDoc) + if (IsDefunct()) return NS_ERROR_FAILURE; nsresult rv = NS_OK; @@ -1077,7 +1077,8 @@ nsXULTreeGridCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells) mColumn->GetElement(getter_AddRefs(columnElm)); nsCOMPtr columnContent(do_QueryInterface(columnElm)); - nsAccessible *headerCell = mDoc->GetAccessible(columnContent); + nsAccessible *headerCell = + GetAccService()->GetAccessibleInWeakShell(columnContent, mWeakShell); if (headerCell) headerCells->AppendElement(static_cast(headerCell), diff --git a/accessible/src/xul/nsXULTreeGridAccessible.h b/accessible/src/xul/nsXULTreeGridAccessible.h index 0f3771373f83..63e58b82c806 100644 --- a/accessible/src/xul/nsXULTreeGridAccessible.h +++ b/accessible/src/xul/nsXULTreeGridAccessible.h @@ -50,7 +50,7 @@ class nsXULTreeGridAccessible : public nsXULTreeAccessible, public nsIAccessibleTable { public: - nsXULTreeGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc); + nsXULTreeGridAccessible(nsIContent *aContent, nsIWeakReference *aShell); // nsISupports NS_DECL_ISUPPORTS_INHERITED @@ -78,9 +78,9 @@ public: using nsAccessible::GetChildCount; using nsAccessible::GetChildAt; - nsXULTreeGridRowAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsAccessible* aParent, nsITreeBoxObject* aTree, - nsITreeView* aTreeView, PRInt32 aRow); + nsXULTreeGridRowAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsAccessible *aParent, nsITreeBoxObject *aTree, + nsITreeView *aTreeView, PRInt32 aRow); // nsISupports and cycle collection NS_DECL_ISUPPORTS_INHERITED @@ -132,9 +132,9 @@ class nsXULTreeGridCellAccessible : public nsLeafAccessible, public: using nsAccessible::GetParent; - nsXULTreeGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc, - nsXULTreeGridRowAccessible* aRowAcc, - nsITreeBoxObject* aTree, nsITreeView* aTreeView, + nsXULTreeGridCellAccessible(nsIContent *aContent, nsIWeakReference *aShell, + nsXULTreeGridRowAccessible *aRowAcc, + nsITreeBoxObject *aTree, nsITreeView *aTreeView, PRInt32 aRow, nsITreeColumn* aColumn); // nsISupports