o@zL=8lZjm8+21hA=KtZCz!z4+)KPjdF2^L_U_
zbLPz4{rr-B?hBiDdGjg`vlWKj=@3DP@(A
z8a8UxC@A{PP+}ph&RfV998NZ;g^IoQH=Qo*3RLvqQ%_ur2C#l0&X8!zGH1=~MtYPr
z@zxQ5?LyoP{gbfu3(djWjXPnXQV*MW;omSss%Zn^q}C2_|A=
z`-Zo&zT8>GhXwjrQ{DsYg}iG@1!j{XEdLZ?tp#4;*nW_(+e3$xOvJm{kz5aJ8?IK0
zFzZE)hkZ0Wt5ix2o67TulNVnkY<}cH(Q~O02W4jMqpt`27CA4n(PW}i9;S?1u;VfUM9z~8fRR;jFSs8&QQhMU-2Zz$I^k`VCEi?^>tQa!zagegJ`
zTvd6OkHpD~vDG9JW^P65-zAf-blp))%q9t&ss4_QoU94>oHZ>HGKb?h+dHcuFmR9hzQl$8X5=Gj3tSh+ke>#GCKM&4_~+@y2`c_;2|N)}tP~
zZYia87I#1cP@t*3Reqd!!hc)N$NbeY8s%0-5pf`oh5pM|l=FAXXa+s2@f-La?O5UK
zGOrlalb@h>satVML2KK==OL_d0B3%|C~f(L7y5BWxgC-Y^5L~j$PXL*(FFjD)6g~L
zAb!!n7bEaubs2c;B;q3mZvBDxV?B2g-Xz6g@IyEuDjP>TzQnIf-nN8Ep|M`rSICbA
zX|SH=cO{>V6NUqZzU>+0#|_@@NhMf8`Oh#i1$l=;M0E_P?j;CH~8W``t@ph
GjQ$1aV0xbb
diff --git a/mozilla/accessible/macbuild/accessibleIDL.mcp b/mozilla/accessible/macbuild/accessibleIDL.mcp
index 54b8313e8589d2d8b97daeb11842231f5a3870c3..6453b415ed078cf0456410b9c31e77a2a5d89c20 100644
GIT binary patch
delta 470
zcmX@LmgUr1mJNKILafIa7#Ko;7zkJ&0Ey6vj@^@2b5`&M137^}90bH6lQp=0tFi%E
z3XDJkh;@Nj9f&o6SPO`?fmjEKbteaKN2`Vc6(s--{KLS&0c0|SGW30$C_B+bKD76N
z)+9k*3C|V=$H^DC5AuS|WCAJyV&l#8cvP8KjX=!FC-^3^C;U70|NpeRn-lo8m>5|n
zcMB?TxOw`xf~?xC$jiw%F@SgTNueZmRvn-LA(JOaDzoZ>Yy+`2S4(m680HmwIwmKl
z78hqG<)pggCzs}?=9TDWrsOc7$ONb6q$Zan0@ZA8P~%~mT)@vV`Iv?n&;chI7@V~>
zU-bITIQgCySm6Kvod7iBKBkA_%axnyw%K
zVH((4%?*HwgJ@f;{)CB+zMJ0}J6p3F0R=$bQQ!at1&{;sk;3M>{KIn@CAK^9GG1b4
WGd2W@H%yljWGn}YO%i0ZUs-8py!F5H#6<>-WR}4pkN)M}ZMY0I@a@s{^qH5NkpC
z+CX8Z$pPHas=+`-2@DLZ#~2tmfJ}y9hMJulcx!eZ0pb_DHMtKS%j9DkVn9>oF)+j)+x*e=H{;}c
zT3~_y|2LNd1^zQmzEHuk`Javn+r$8c$v5
diff --git a/mozilla/accessible/public/nsIAccessibilityService.idl b/mozilla/accessible/public/nsIAccessibilityService.idl
index 5430f5e85b1..815476451ef 100644
--- a/mozilla/accessible/public/nsIAccessibilityService.idl
+++ b/mozilla/accessible/public/nsIAccessibilityService.idl
@@ -28,22 +28,28 @@
#include "domstubs.idl"
#include "nsIAccessible.idl"
+interface nsIWeakReference;
+
[scriptable, uuid(68D9720A-0984-42b6-A3F5-8237ED925727)]
interface nsIAccessibilityService : nsISupports
{
nsIAccessible createRootAccessible(in nsISupports aPresContext, in nsISupports aFrame);
- nsIAccessible createHTMLSelectAccessible(in nsIAtom aAccessible, in nsIDOMNode aNode, in nsISupports aPresShell);
+ nsIAccessible createHTMLSelectAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
+ nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsISupports aPresShell);
nsIAccessible createHTMLCheckboxAccessible(in nsISupports aFrame);
nsIAccessible createHTMLRadioButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTML4ButtonAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTextAccessible(in nsISupports aFrame);
nsIAccessible createHTMLImageAccessible(in nsISupports aFrame);
- nsIAccessible createHTMLAreaAccessible(in nsISupports aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
+ nsIAccessible createHTMLAreaAccessible(in nsIWeakReference aPresShell, in nsIDOMNode aDOMNode, in nsIAccessible aAccParent);
nsIAccessible createHTMLTableAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsISupports aFrame);
nsIAccessible createHTMLTextFieldAccessible(in nsISupports aFrame);
nsIAccessible createHTMLIFrameAccessible(in nsIDOMNode aNode, in nsISupports aPresContext);
+ nsIAccessible createHTMLBlockAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
+ nsIAccessible createAccessible(in nsIDOMNode aNode, in nsISupports aDocument);
+ nsIAccessible GetAccessibleFor(in nsIWeakReference aPresShell, in nsIDOMNode aNode);
};
diff --git a/mozilla/accessible/public/nsIAccessible.idl b/mozilla/accessible/public/nsIAccessible.idl
index 8e131ddf3c5..d98116d34cf 100644
--- a/mozilla/accessible/public/nsIAccessible.idl
+++ b/mozilla/accessible/public/nsIAccessible.idl
@@ -26,29 +26,28 @@
#include "nsISupports.idl"
#include "nsIDOMNode.idl"
+#include "domstubs.idl"
[scriptable, uuid(B26FBE47-9A5F-42a1-822B-082461AE4D6D)]
interface nsIAccessible : nsISupports
{
- nsIAccessible getAccParent();
- nsIAccessible getAccNextSibling();
- nsIAccessible getAccPreviousSibling();
- nsIAccessible getAccFirstChild();
- nsIAccessible getAccLastChild();
+ readonly attribute nsIAccessible accParent;
+ readonly attribute nsIAccessible accNextSibling;
+ readonly attribute nsIAccessible accPreviousSibling;
+ readonly attribute nsIAccessible accFirstChild;
+ readonly attribute nsIAccessible accLastChild;
- long getAccChildCount();
- wstring getAccName();
- wstring getAccValue();
- void setAccName(in wstring name);
- void setAccValue(in wstring value);
+ readonly attribute long accChildCount;
+ attribute DOMString accName;
+ readonly attribute DOMString accValue;
- wstring getAccDescription();
- unsigned long getAccRole();
- unsigned long getAccState();
- unsigned long getAccExtState();
+ readonly attribute DOMString accDescription;
+ readonly attribute unsigned long accRole;
+ readonly attribute unsigned long accState;
+ readonly attribute unsigned long accExtState;
- wstring getAccHelp();
- nsIAccessible getAccFocused();
+ readonly attribute DOMString accHelp;
+ readonly attribute nsIAccessible accFocused;
nsIAccessible accGetAt(in long x, in long y);
@@ -68,8 +67,8 @@ interface nsIAccessible : nsISupports
void accTakeSelection();
void accTakeFocus();
- PRUint8 getAccNumActions();
- wstring getAccActionName(in PRUint8 index);
+ readonly attribute PRUint8 accNumActions;
+ DOMString getAccActionName(in PRUint8 index);
void accDoAction(in PRUint8 index); // Action number 0 is the default action
nsIDOMNode accGetDOMNode();
diff --git a/mozilla/accessible/public/nsIAccessibleDocument.idl b/mozilla/accessible/public/nsIAccessibleDocument.idl
new file mode 100644
index 00000000000..f3b564a29a9
--- /dev/null
+++ b/mozilla/accessible/public/nsIAccessibleDocument.idl
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Original Author: Aaron Leventhal
+ *
+ * Contributor(s):
+ * John Gaunt
+ */
+
+#include "nsISupports.idl"
+#include "nsIAccessible.idl"
+#include "domstubs.idl"
+interface nsIDocument;
+
+[scriptable, uuid(8781FC88-355F-4439-881F-6504A0A1CEB6)]
+interface nsIAccessibleDocument : nsISupports
+{
+ readonly attribute DOMString URL;
+ readonly attribute DOMString title;
+ readonly attribute DOMString mimeType;
+ readonly attribute DOMString docType;
+ DOMString getNameSpaceURIForID(in short nameSpaceID);
+ [noscript] nsIDocument getDocument();
+
+};
diff --git a/mozilla/accessible/public/nsIAccessibleSelectable.idl b/mozilla/accessible/public/nsIAccessibleSelectable.idl
new file mode 100644
index 00000000000..45908df85c4
--- /dev/null
+++ b/mozilla/accessible/public/nsIAccessibleSelectable.idl
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is the Mozilla browser.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1999 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Original Author: John Gaunt (jgaunt@netscape.com)
+ *
+ * Contributor(s):
+ * John Gaunt
+ */
+
+#include "nsISupports.idl"
+#include "nsIAccessible.idl"
+#include "nsISupportsArray.idl"
+
+[scriptable, uuid(34d268d6-1dd2-11b2-9d63-83a5e0ada290)]
+interface nsIAccessibleSelectable : nsISupports
+{
+ nsISupportsArray GetSelectedChildren();
+};
diff --git a/mozilla/accessible/src/Makefile.in b/mozilla/accessible/src/Makefile.in
index 5aef2e157b7..f5d32c1b908 100644
--- a/mozilla/accessible/src/Makefile.in
+++ b/mozilla/accessible/src/Makefile.in
@@ -41,10 +41,14 @@ CPPSRCS = \
nsHTMLImageAccessible.cpp \
nsHTMLAreaAccessible.cpp \
nsHTMLLinkAccessible.cpp \
- nsSelectAccessible.cpp \
+ nsHTMLSelectAccessible.cpp \
nsGenericAccessible.cpp \
$(NULL)
+EXPORTS = \
+ nsRootAccessible.h \
+ $(NULL)
+
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
diff --git a/mozilla/accessible/src/base/nsAccessibilityService.cpp b/mozilla/accessible/src/base/nsAccessibilityService.cpp
index 6ca72a6265e..e52eadb581b 100644
--- a/mozilla/accessible/src/base/nsAccessibilityService.cpp
+++ b/mozilla/accessible/src/base/nsAccessibilityService.cpp
@@ -33,14 +33,18 @@
#include "nsIFrame.h"
#include "nsRootAccessible.h"
#include "nsINameSpaceManager.h"
-#include "nsHTMLFormControlAccessible.h"
#include "nsLayoutAtoms.h"
-#include "nsSelectAccessible.h"
+#include "nsIDOMNode.h"
#include "nsHTMLTextAccessible.h"
#include "nsHTMLTableAccessible.h"
#include "nsHTMLImageAccessible.h"
#include "nsHTMLAreaAccessible.h"
#include "nsHTMLLinkAccessible.h"
+#include "nsHTMLSelectAccessible.h"
+#include "nsIDOMHTMLAreaElement.h"
+#include "nsHTMLFormControlAccessible.h"
+#include "nsILink.h"
+#include "nsIDocShellTreeItem.h"
// IFrame
#include "nsIDocShell.h"
@@ -52,7 +56,6 @@
nsAccessibilityService::nsAccessibilityService()
{
NS_INIT_REFCNT();
- //printf("################################## nsAccessibilityService\n");
}
nsAccessibilityService::~nsAccessibilityService()
@@ -80,60 +83,76 @@ nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISuppo
NS_ASSERTION(s,"Error not presshell!!");
- nsCOMPtr wr (getter_AddRefs(NS_GetWeakReference(s)));
+ nsCOMPtr wr = do_GetWeakReference(s);
- //printf("################################## CreateRootAccessible\n");
*_retval = new nsRootAccessible(wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
-nsAccessibilityService::CreateHTMLSelectAccessible(nsIAtom* aPopupAtom, nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
+nsAccessibilityService::CreateHTMLSelectAccessible(nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
{
- /*
- nsCOMPtr n(do_QueryInterface(node));
- NS_ASSERTION(n,"Error non nsIContent passed to accessible factory!!!");
-
nsCOMPtr c(do_QueryInterface(aPresContext));
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr s;
c->GetShell(getter_AddRefs(s));
- nsCOMPtr wr = getter_AddRefs(NS_GetWeakReference(s));
+ nsCOMPtr wr = do_GetWeakReference(s);
- *_retval = new nsSelectAccessible(aPopupAtom, nsnull, node, wr);
+ *_retval = new nsHTMLSelectAccessible(node, wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
- */
-
- return NS_ERROR_FAILURE;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
+NS_IMETHODIMP
+nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* node, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
+{
+ nsCOMPtr c(do_QueryInterface(aPresContext));
+ NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
+
+ nsCOMPtr s;
+ c->GetShell(getter_AddRefs(s));
+
+ nsCOMPtr wr = do_GetWeakReference(s);
+
+ *_retval = new nsHTMLSelectOptionAccessible(aAccParent, node, wr);
+ if (*_retval) {
+ NS_ADDREF(*_retval);
+ return NS_OK;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
+}
+
+
/* nsIAccessible createHTMLCheckboxAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *aFrame, nsIAccessible **_retval)
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- *_retval = new nsHTMLCheckboxAccessible(shell,node);
+ *_retval = new nsHTMLCheckboxAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
/* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@@ -141,17 +160,18 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupport
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- *_retval = new nsHTMLRadioButtonAccessible(shell,node);
+ *_retval = new nsHTMLRadioButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
/* nsIAccessible createHTMLButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@@ -159,17 +179,18 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aF
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- *_retval = new nsHTMLButtonAccessible(shell,node);
+ *_retval = new nsHTMLButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
/* nsIAccessible createHTML4ButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@@ -177,17 +198,18 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *a
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- *_retval = new nsHTML4ButtonAccessible(shell,node);
+ *_retval = new nsHTML4ButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@@ -195,18 +217,18 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFra
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- //printf("################################## CreateHTMLTextAccessible\n");
- *_retval = new nsHTMLTextAccessible(shell, node);
+ *_retval = new nsHTMLTextAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
@@ -215,17 +237,18 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFr
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- *_retval = new nsHTMLTableAccessible(shell, node);
+ *_retval = new nsHTMLTableAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
/* nsIAccessible createHTMLTableCellAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@@ -233,17 +256,18 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- *_retval = new nsHTMLTableCellAccessible(shell, node);
+ *_retval = new nsHTMLTableCellAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
/* nsIAccessible createHTMLImageAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@@ -251,35 +275,39 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFr
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- nsCOMPtr imageFrame(do_QueryInterface(aFrame));
+ nsIImageFrame* imageFrame = nsnull;
+
+ // not using a nsCOMPtr frames don't support them.
+ aFrame->QueryInterface(NS_GET_IID(nsIImageFrame), (void**)&imageFrame);
+
if (!imageFrame)
return NS_ERROR_FAILURE;
- *_retval = new nsHTMLImageAccessible(shell, node, imageFrame);
+ *_retval = new nsHTMLImageAccessible(node, imageFrame, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
/* nsIAccessible createHTMLAreaAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
-NS_IMETHODIMP nsAccessibilityService::CreateHTMLAreaAccessible(nsISupports *aShell, nsIDOMNode *aDOMNode, nsIAccessible *aAccParent,
+NS_IMETHODIMP nsAccessibilityService::CreateHTMLAreaAccessible(nsIWeakReference *aShell, nsIDOMNode *aDOMNode, nsIAccessible *aAccParent,
nsIAccessible **_retval)
{
- nsCOMPtr shell(do_QueryInterface(aShell));
-
- *_retval = new nsHTMLAreaAccessible(shell, aDOMNode, aAccParent);
+ *_retval = new nsHTMLAreaAccessible(aDOMNode, aAccParent, aShell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
@@ -288,20 +316,21 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports
{
nsIFrame* frame;
nsCOMPtr node;
- nsCOMPtr shell;
+ nsCOMPtr shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
- *_retval = new nsHTMLTextFieldAccessible(shell, node);
+ *_retval = new nsHTMLTextFieldAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
- } else
- return NS_ERROR_OUT_OF_MEMORY;
+ }
+
+ return NS_ERROR_OUT_OF_MEMORY;
}
-NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIPresShell** aShell, nsIDOMNode** aNode)
+NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
{
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
nsCOMPtr content;
@@ -322,7 +351,66 @@ NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aR
NS_ASSERTION(shells > 0,"Error no shells!");
#endif
- return document->GetShellAt(0, aShell);
+ // do_GetWR only works into a |nsCOMPtr| :-(
+ nsCOMPtr tempShell;
+ nsCOMPtr weak;
+ document->GetShellAt(0, getter_AddRefs(tempShell));
+ weak = do_GetWeakReference(tempShell);
+ NS_IF_ADDREF(*aShell = weak);
+
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsAccessibilityService::CreateAccessible(nsIDOMNode* node, nsISupports* document, nsIAccessible **_retval)
+{
+ nsCOMPtr content (do_QueryInterface(node));
+
+ nsCOMPtr d (do_QueryInterface(document));
+ if (!d)
+ return NS_ERROR_FAILURE;
+
+#ifdef DEBUG
+ PRInt32 shells = d->GetNumberOfShells();
+ NS_ASSERTION(shells > 0,"Error no shells!");
+#endif
+
+ nsCOMPtr tempShell;
+ d->GetShellAt(0, getter_AddRefs(tempShell));
+ nsCOMPtr wr = do_GetWeakReference(tempShell);
+
+ *_retval = new nsAccessible(node, wr);
+ if ( *_retval ) {
+ NS_ADDREF(*_retval);
+ return NS_OK;
+ }
+ return NS_ERROR_OUT_OF_MEMORY;
+}
+
+NS_IMETHODIMP
+nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* node, nsISupports* document, nsIAccessible **_retval)
+{
+ nsCOMPtr content (do_QueryInterface(node));
+
+ nsCOMPtr d (do_QueryInterface(document));
+ if (!d)
+ return NS_ERROR_FAILURE;
+
+#ifdef DEBUG
+ PRInt32 shells = d->GetNumberOfShells();
+ NS_ASSERTION(shells > 0,"Error no shells!");
+#endif
+
+ nsCOMPtr tempShell;
+ d->GetShellAt(0, getter_AddRefs(tempShell));
+ nsCOMPtr wr = do_GetWeakReference(tempShell);
+
+ *_retval = new nsAccessible(node, wr);
+ if ( *_retval ) {
+ NS_ADDREF(*_retval);
+ return NS_OK;
+ }
+ return NS_ERROR_OUT_OF_MEMORY;
}
NS_IMETHODIMP
@@ -340,7 +428,7 @@ nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports
presContext->GetShell(getter_AddRefs(presShell));
NS_ASSERTION(presShell,"Error non PresShell passed to accessible factory!!!");
- nsCOMPtr weakRef (getter_AddRefs(NS_GetWeakReference(presShell)));
+ nsCOMPtr weakRef = do_GetWeakReference(presShell);
nsCOMPtr doc;
if (NS_SUCCEEDED(content->GetDocument(*getter_AddRefs(doc))) && doc) {
@@ -355,13 +443,22 @@ nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports
nsCOMPtr ps;
docShell->GetPresShell(getter_AddRefs(ps));
if (ps) {
- nsCOMPtr wr (getter_AddRefs(NS_GetWeakReference(ps)));
- //printf("################################## CreateHTMLIFrameAccessible\n");
-
- nsCOMPtr root = new nsHTMLIFrameRootAccessible(wr,node);
- *_retval = new nsHTMLIFrameAccessible(presShell, node, root);
- NS_ADDREF(*_retval);
- return NS_OK;
+ nsCOMPtr wr = do_GetWeakReference(ps);
+ nsCOMPtr innerDoc;
+ ps->GetDocument(getter_AddRefs(innerDoc));
+ if (innerDoc) {
+ nsCOMPtr root = new nsHTMLIFrameRootAccessible(node, wr);
+ if ( root ) {
+ nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(node, root, weakRef, innerDoc);
+ if ( frameAcc != nsnull ) {
+ *_retval = NS_STATIC_CAST(nsIAccessible*, frameAcc);
+ if ( *_retval ) {
+ NS_ADDREF(*_retval);
+ return NS_OK;
+ }
+ }
+ }
+ }
}
}
}
@@ -371,6 +468,155 @@ nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports
}
+//-----------------------------------------------------------------------
+ // This method finds the content node in the parent document
+ // corresponds to the docshell
+ // This code is copied and pasted from nsEventStateManager.cpp
+ // Is also inefficient - better solution should come along as part of
+ // Bug 85602: "FindContentForDocShell walks entire content tree"
+ // Hopefully there will be a better method soon, with a public interface
+
+ nsIContent*
+ nsAccessibilityService::FindContentForDocShell(nsIPresShell* aPresShell,
+ nsIContent* aContent,
+ nsIDocShell* aDocShell)
+ {
+ NS_ASSERTION(aPresShell, "Pointer is null!");
+ NS_ASSERTION(aDocShell, "Pointer is null!");
+ NS_ASSERTION(aContent, "Pointer is null!");
+
+ nsCOMPtr supps;
+ aPresShell->GetSubShellFor(aContent, getter_AddRefs(supps));
+ if (supps) {
+ nsCOMPtr docShell(do_QueryInterface(supps));
+ if (docShell.get() == aDocShell)
+ return aContent;
+ }
+
+ // walk children content
+ PRInt32 count;
+ aContent->ChildCount(count);
+ for (PRInt32 i=0;i child;
+ aContent->ChildAt(i, *getter_AddRefs(child));
+ nsIContent* foundContent = FindContentForDocShell(aPresShell, child, aDocShell);
+ if (foundContent != nsnull) {
+ return foundContent;
+ }
+ }
+ return nsnull;
+ }
+
+
+void nsAccessibilityService::GetOwnerFor(nsIPresShell *aPresShell, nsIPresShell **aOwnerShell, nsIContent **aOwnerContent)
+{
+ nsCOMPtr presContext;
+ aPresShell->GetPresContext(getter_AddRefs(presContext));
+ if (!presContext)
+ return;
+ nsCOMPtr pcContainer;
+ presContext->GetContainer(getter_AddRefs(pcContainer));
+ if (!pcContainer)
+ return;
+ nsCOMPtr docShell(do_QueryInterface(pcContainer));
+
+ nsCOMPtr treeItem(do_QueryInterface(docShell));
+ if (!treeItem)
+ return;
+
+ // Get Parent Doc
+ nsCOMPtr treeItemParent;
+ treeItem->GetParent(getter_AddRefs(treeItemParent));
+ if (!treeItemParent)
+ return;
+
+ nsCOMPtr parentDS(do_QueryInterface(treeItemParent));
+ if (!parentDS)
+ return;
+
+ nsCOMPtr parentPresShell;
+ parentDS->GetPresShell(getter_AddRefs(parentPresShell));
+ if (!parentPresShell)
+ return;
+
+ nsCOMPtr parentDoc;
+ parentPresShell->GetDocument(getter_AddRefs(parentDoc));
+ if (!parentDoc)
+ return;
+
+ nsCOMPtr rootContent;
+ parentDoc->GetRootContent(getter_AddRefs(rootContent));
+
+ nsIContent *tempContent;
+ tempContent = FindContentForDocShell(parentPresShell, rootContent, docShell);
+ if (tempContent) {
+ *aOwnerContent = tempContent;
+ *aOwnerShell = parentPresShell;
+ NS_ADDREF(*aOwnerShell);
+ NS_ADDREF(*aOwnerContent);
+ }
+}
+
+/* nsIAccessible GetAccessibleFor (in nsISupports aPresShell, in nsIDOMNode aNode); */
+NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIWeakReference *aPresShell, nsIDOMNode *aNode,
+ nsIAccessible **_retval)
+{
+ *_retval = nsnull;
+
+ nsCOMPtr shell(do_QueryReferent(aPresShell));
+
+ if (!shell)
+ return NS_ERROR_FAILURE;
+
+ nsCOMPtr areaContent(do_QueryInterface(aNode));
+ if (areaContent) // Area elements are implemented in nsHTMLImageAccessible as children of the image
+ return PR_FALSE; // Return, otherwise the image frame looks like an accessible object in the wrong place
+
+ nsCOMPtr content(do_QueryInterface(aNode));
+ nsCOMPtr doc(do_QueryInterface(aNode));
+ if (!content && doc) {
+ // This happens when we're on the document node, which will not QI to an nsIContent,
+ // When that happens, we try to get the outer, parent document node that contains the document
+ // For example, a or