From 99f7be27214bcc546e8829506b289076234d350c Mon Sep 17 00:00:00 2001 From: "jgaunt%netscape.com" Date: Sat, 30 Jun 2001 00:25:09 +0000 Subject: [PATCH] bug #86517 Landing of Accessible_052901_Branch4 sr=waterson r= lots, see bug git-svn-id: svn://10.0.0.236/trunk@98337 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/accessible/accessible-docs.html | 91 +- mozilla/accessible/build/Makefile.in | 13 +- mozilla/accessible/build/makefile.win | 20 +- mozilla/accessible/macbuild/accessible.mcp | Bin 141772 -> 153170 bytes mozilla/accessible/macbuild/accessibleIDL.mcp | Bin 71370 -> 71370 bytes mozilla/accessible/public/Makefile.in | 5 + mozilla/accessible/public/makefile.win | 5 + .../public/nsIAccessibilityService.idl | 10 +- mozilla/accessible/public/nsIAccessible.idl | 35 +- .../public/nsIAccessibleDocument.idl | 41 + .../public/nsIAccessibleSelectable.idl | 34 + mozilla/accessible/src/Makefile.in | 6 +- .../src/base/nsAccessibilityService.cpp | 392 +++++++-- .../src/base/nsAccessibilityService.h | 10 +- mozilla/accessible/src/base/nsAccessible.cpp | 721 ++++++++-------- mozilla/accessible/src/base/nsAccessible.h | 71 +- .../src/base/nsGenericAccessible.cpp | 384 +-------- .../accessible/src/base/nsGenericAccessible.h | 56 -- .../accessible/src/base/nsRootAccessible.cpp | 184 +++- .../accessible/src/base/nsRootAccessible.h | 41 +- .../src/base/nsSelectAccessible.cpp | 722 ---------------- .../accessible/src/base/nsSelectAccessible.h | 52 -- .../src/html/nsHTMLAreaAccessible.cpp | 88 +- .../src/html/nsHTMLAreaAccessible.h | 18 +- .../src/html/nsHTMLFormControlAccessible.cpp | 122 +-- .../src/html/nsHTMLFormControlAccessible.h | 34 +- .../src/html/nsHTMLIFrameRootAccessible.cpp | 121 ++- .../src/html/nsHTMLIFrameRootAccessible.h | 31 +- .../src/html/nsHTMLImageAccessible.cpp | 35 +- .../src/html/nsHTMLImageAccessible.h | 7 +- .../src/html/nsHTMLLinkAccessible.cpp | 31 +- .../src/html/nsHTMLLinkAccessible.h | 10 +- .../src/html/nsHTMLSelectAccessible.cpp | 792 ++++++++++++++++++ .../src/html/nsHTMLSelectAccessible.h | 72 ++ .../src/html/nsHTMLTableAccessible.cpp | 8 +- .../src/html/nsHTMLTableAccessible.h | 10 +- .../src/html/nsHTMLTextAccessible.cpp | 17 +- .../src/html/nsHTMLTextAccessible.h | 6 +- mozilla/accessible/src/makefile.win | 6 +- .../accessible/src/nsAccessibilityService.cpp | 392 +++++++-- .../accessible/src/nsAccessibilityService.h | 10 +- mozilla/accessible/src/nsAccessible.cpp | 721 ++++++++-------- mozilla/accessible/src/nsAccessible.h | 71 +- .../accessible/src/nsGenericAccessible.cpp | 384 +-------- mozilla/accessible/src/nsGenericAccessible.h | 56 -- .../accessible/src/nsHTMLAreaAccessible.cpp | 88 +- mozilla/accessible/src/nsHTMLAreaAccessible.h | 18 +- .../src/nsHTMLFormControlAccessible.cpp | 122 +-- .../src/nsHTMLFormControlAccessible.h | 34 +- .../src/nsHTMLIFrameRootAccessible.cpp | 121 ++- .../src/nsHTMLIFrameRootAccessible.h | 31 +- .../accessible/src/nsHTMLImageAccessible.cpp | 35 +- .../accessible/src/nsHTMLImageAccessible.h | 7 +- .../accessible/src/nsHTMLLinkAccessible.cpp | 31 +- mozilla/accessible/src/nsHTMLLinkAccessible.h | 10 +- .../accessible/src/nsHTMLSelectAccessible.cpp | 792 ++++++++++++++++++ .../accessible/src/nsHTMLSelectAccessible.h | 72 ++ .../accessible/src/nsHTMLTableAccessible.cpp | 8 +- .../accessible/src/nsHTMLTableAccessible.h | 10 +- .../accessible/src/nsHTMLTextAccessible.cpp | 17 +- mozilla/accessible/src/nsHTMLTextAccessible.h | 6 +- mozilla/accessible/src/nsRootAccessible.cpp | 184 +++- mozilla/accessible/src/nsRootAccessible.h | 41 +- mozilla/accessible/src/nsSelectAccessible.cpp | 722 ---------------- mozilla/accessible/src/nsSelectAccessible.h | 52 -- .../mac/build_scripts/MozillaBuildList.pm | 5 +- .../content/shared/public/nsLayoutAtomList.h | 1 + mozilla/dom/src/base/nsDOMClassInfo.cpp | 9 +- mozilla/dom/src/base/nsGlobalWindow.cpp | 6 + mozilla/layout/base/nsLayoutAtomList.h | 1 + .../layout/forms/nsComboboxControlFrame.cpp | 51 +- mozilla/layout/forms/nsComboboxControlFrame.h | 5 + .../layout/forms/nsGfxButtonControlFrame.cpp | 9 + .../layout/forms/nsGfxButtonControlFrame.h | 2 + mozilla/layout/forms/nsListControlFrame.cpp | 16 +- mozilla/layout/forms/nsListControlFrame.h | 3 + .../html/forms/src/nsComboboxControlFrame.cpp | 51 +- .../html/forms/src/nsComboboxControlFrame.h | 5 + .../forms/src/nsGfxButtonControlFrame.cpp | 9 + .../html/forms/src/nsGfxButtonControlFrame.h | 2 + .../html/forms/src/nsListControlFrame.cpp | 16 +- .../html/forms/src/nsListControlFrame.h | 3 + mozilla/widget/src/makefile.win | 2 +- mozilla/widget/src/windows/Accessible.cpp | 294 +++++-- mozilla/widget/src/windows/Accessible.h | 211 +++-- mozilla/widget/src/windows/SimpleDOMNode.cpp | 436 ++++++++++ mozilla/widget/src/windows/SimpleDOMNode.h | 107 +++ .../ISimpleDOMDocument/ISimpleDOMDocument.def | 7 + .../ISimpleDOMDocument/ISimpleDOMDocument.idl | 108 +++ .../expose/ISimpleDOMDocument/makefile.win | 72 ++ .../expose/ISimpleDOMNode/ISimpleDOMNode.def | 7 + .../expose/ISimpleDOMNode/ISimpleDOMNode.idl | 145 ++++ .../expose/ISimpleDOMNode/makefile.win | 72 ++ .../widget/src/windows/expose/makefile.win | 25 + mozilla/widget/src/windows/makefile.win | 8 +- mozilla/widget/src/windows/nsWindow.cpp | 21 +- .../browser/resources/content/navigator.js | 7 + .../browser/resources/content/navigator.xul | 1 + .../resources/content/bindings/button.xml | 48 -- .../resources/content/bindings/scrollbar.xml | 106 +-- mozilla/xpinstall/packager/packages-win | 4 + .../xpinstall/packager/windows/browser.jst | 11 +- 102 files changed, 5887 insertions(+), 4335 deletions(-) create mode 100644 mozilla/accessible/public/nsIAccessibleDocument.idl create mode 100644 mozilla/accessible/public/nsIAccessibleSelectable.idl delete mode 100644 mozilla/accessible/src/base/nsSelectAccessible.cpp delete mode 100644 mozilla/accessible/src/base/nsSelectAccessible.h create mode 100644 mozilla/accessible/src/html/nsHTMLSelectAccessible.cpp create mode 100644 mozilla/accessible/src/html/nsHTMLSelectAccessible.h create mode 100644 mozilla/accessible/src/nsHTMLSelectAccessible.cpp create mode 100644 mozilla/accessible/src/nsHTMLSelectAccessible.h delete mode 100644 mozilla/accessible/src/nsSelectAccessible.cpp delete mode 100644 mozilla/accessible/src/nsSelectAccessible.h create mode 100644 mozilla/widget/src/windows/SimpleDOMNode.cpp create mode 100644 mozilla/widget/src/windows/SimpleDOMNode.h create mode 100644 mozilla/widget/src/windows/expose/ISimpleDOMDocument/ISimpleDOMDocument.def create mode 100644 mozilla/widget/src/windows/expose/ISimpleDOMDocument/ISimpleDOMDocument.idl create mode 100755 mozilla/widget/src/windows/expose/ISimpleDOMDocument/makefile.win create mode 100644 mozilla/widget/src/windows/expose/ISimpleDOMNode/ISimpleDOMNode.def create mode 100644 mozilla/widget/src/windows/expose/ISimpleDOMNode/ISimpleDOMNode.idl create mode 100755 mozilla/widget/src/windows/expose/ISimpleDOMNode/makefile.win create mode 100755 mozilla/widget/src/windows/expose/makefile.win diff --git a/mozilla/accessible/accessible-docs.html b/mozilla/accessible/accessible-docs.html index 33b085d4ce7..e774cf23ee4 100644 --- a/mozilla/accessible/accessible-docs.html +++ b/mozilla/accessible/accessible-docs.html @@ -8,6 +8,10 @@

How the Accessible module (accessibility.dll) works

-

-Rather than directly implement IAccessible with an Accessible class, we have chosen to proxy to our own interface, -called nsIAccessible, which is more robust. It has the capability of supporting other new accessibility API's such -as Sun's Gnome Accessiblity API. Our nsIAccessible implementation can proxy further to a variety of classes, each specialized for a particular kind of -widget or data node. -

- +

The Basics

+ + +

How the IAccessible's are Created

+ +

The Real Power Behind IAccessible's

+ @@ -134,18 +155,22 @@ for the image if one exists).

When an accessibility-related event occurs within an application such as Mozilla, it must use NotifyWinEvent from the Win32 API. NotifyWinEvent is passed arguments for the window the event occured in, and the number of the child -within that window. Accessibility aids use a WIN32 call to register as a listener for these events. +within that window. Accessibility aids use the Win32 call SetWinEventHook() to register as a listener for these events.

-The accessibility aid is choose which events it is interested in learning more about by sending a window a WM_???? -event requesting the IAccessible to the node corresponding to the -child number that had been indicated from NotifyWinEvent. In Mozilla, this creates a problem. We cannot +The accessibility aid is choose which events it is interested in learning more about by using the Win32 API call +AccessibleObjectFromEvent, requesting the IAccessible to the node corresponding to the +child number that had been indicated from NotifyWinEvent(). This ends up asking our RootAccessible for the child +IAccessible that matches the window handle and child id we indicated through NotofyWinEvent(). +

+

+In Mozilla, this creates a problem. We cannot keep track of a child number for every important accessible node in a document. We deal with this by generating fake child IDs for the most recent accessibile events that we have generated, in a circular array.

Since there is a RootAccessible for each top level window that might generate MSAA events, that's where we do the bookkeeping -for these events and their nsIAccessible's. Whenever NotifyWinEvent is called, a new fake ID is generated (We use +for these events and their nsIAccessible's. Whenever NotifyWinEvent() is called, a new fake ID is generated (We use negative numbers for the fake IDs). When the callback comes to request the IAccessible for that child number, we check the circular array for that ID, and voila, we have the corresponding nsIAccessible to proxy.

diff --git a/mozilla/accessible/build/Makefile.in b/mozilla/accessible/build/Makefile.in index ca0f978b8d6..5f90c7549b7 100644 --- a/mozilla/accessible/build/Makefile.in +++ b/mozilla/accessible/build/Makefile.in @@ -39,14 +39,13 @@ CPPSRCS = nsAccessibilityFactory.cpp LOCAL_INCLUDES = -I$(srcdir)/../src SHARED_LIBRARY_LIBS = \ - $(DIST)/lib/libaccessibility_s.$(LIB_SUFFIX) \ - $(DIST)/lib/libchrome_s.$(LIB_SUFFIX) \ - $(NULL) + $(DIST)/lib/libaccessibility_s.$(LIB_SUFFIX) \ + $(NULL) -EXTRA_DSO_LDOPTS = \ - $(MOZ_COMPONENT_LIBS) \ - -lgkgfx \ - $(NULL) +EXTRA_DSO_LDOPTS = \ + $(MOZ_COMPONENT_LIBS) \ + -lgkgfx \ + $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/mozilla/accessible/build/makefile.win b/mozilla/accessible/build/makefile.win index 3a44c5c7a15..b6178fabecb 100644 --- a/mozilla/accessible/build/makefile.win +++ b/mozilla/accessible/build/makefile.win @@ -25,20 +25,22 @@ LIBRARY_NAME=accessibility MODULE_NAME=nsAccessibilityModule CPP_OBJS=\ - .\$(OBJDIR)\nsAccessibilityFactory.obj \ - $(NULL) + .\$(OBJDIR)\nsAccessibilityFactory.obj \ + $(NULL) LINCS = $(LINCS) -I..\src # for implementation headers -SUB_LIBRARIES=\ - $(DIST)\lib\accessibility_s.lib \ - $(NULL) +SHARED_LIBRARY_LIBS=\ + $(DIST)\lib\accessibility_s.lib \ + $(NULL) LLIBS=\ - $(DIST)\lib\xpcom.lib \ - $(DIST)\lib\timer_s.lib \ - $(DIST)\lib\gkgfx.lib \ - $(LIBNSPR) + $(DIST)\lib\xpcom.lib \ + $(DIST)\lib\timer_s.lib \ + $(DIST)\lib\gkgfx.lib \ + $(DIST)\lib\contentshared_s.lib \ + $(LIBNSPR) \ + $(NULL) include <$(DEPTH)\config\rules.mak> diff --git a/mozilla/accessible/macbuild/accessible.mcp b/mozilla/accessible/macbuild/accessible.mcp index be05252555f8164640b3de072edda60e132edcb6..ec680e8fd32cd5d1da7b7bb808501ed612175b27 100644 GIT binary patch delta 1811 zcma)6e@s(H9KXB1M_YJBlv1HlX)HgAk_u8w*2z!BfdVZf+X4<8lqw{&G}0Q~_6KvD z(L^VYTevyh!ZtOy31OZ|-4dlF{$ZS%i_36xA!E}eOUxz<+uUZ9ecyYqY4(qoeBRxC zKKK3J-S_)_cjZgNwbMqkzo(}gA*4eHI}q7O5UE=AvAGPFOaMELkTi!-3JlQ%stbgo zHIYEDD%95A9q2&#Vk7WiiKK--wr$pjP^G|sU%r&kX}v%%yIwX~K(-m+18AnzM!QAC zT0|06e^Ca4cFNtwjG0xLT5ylsIwJr(EwGmqInLtx)mV|Ays}U-u_-;BM z%eaN9W2HsEE#5yjH+g`|#eZRbd%sOb|JZzy&$#Na!-&vEfYPr5i|`NIzTKj4BAa2gt3Lyx%}Cgq?Cnw6d>_}bjpJrL-uTw?H)0=cCJU zD=VaU4Q^p=6lc?`Q7OIosi&WTN>ZCi+!$z&?m!~KW;U^ynCZ33!}Nl;l7GExE@_cg ze9GAq%Mr@u4af3@WiT@;CFSvW{5_#aAQbTg+x+d(uI>&GB>6Wye|#2`OiG zu?0qPS~_SKTVeEuI#N|WdgK6BLnNr_HI_rsL5K>4rH>Pxw4C`M?%2Njp#aLofBqN1 zTs43=kyUuGozKL-BmBWfsXA^tmt{667z z4vb}A2KWB(ZQsA_2P-&`>-moRg$XeT$=s>fbPnE^&rYP1wi?;3yh*{{$WC~Eeu4|n zx8+k%1AV~5i}o;|_Z-X>KJ+M$nKy$hwc_1S`uV|dZ`Y%8{`FX225C(o#Zfk$Ni0^~ zaoDIY7zy`657oTTge;a~BNn2+$s9J~v=09bZyJJi%F7D>!9pwhk%d7g?vmJ$jXWSk zaIqmfv1}IB!xC$FXJ9)r-GB^|Va;UkBwT2}$|tu3fj_13*B2v{VAj?LUBG{+@+AHE zU>2Oy@Fe`tdQIL3uE}Z5Y$}@-D0*QMT-2tywZ%an)pSP-dqL5KXJMYK>51@0lCgRH zDC<}C4w%nxfA1^M&uF@6W^qLqM_?{#`yY4}^s}1oTFquaC+nlkkWDs`l0(dw4RgnR z)(La#2*gbq((JCMg57z|?$fu~rEF5A!~Q&$k^=#({DhUO{aqH$A-k+6p&)R&c3@Wt o7+%&4qrVL1!g;*!!_=wCR>%ptqRH`5RscHjei5tAC9jcx0AZHh=l}o! delta 1447 zcmaJ>YfM~46h1S%cOP(}3*F_h6j>4J@(=;(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