bug 90182 fixing accessible support for html selects

r=aaronl@netscape.com
sr=waterson@netscape.com
This commit is contained in:
jgaunt%netscape.com 2001-07-20 22:17:31 +00:00
Родитель 9033daa50b
Коммит 59fb2feee1
15 изменённых файлов: 1787 добавлений и 345 удалений

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

@ -34,7 +34,8 @@ interface nsIWeakReference;
interface nsIAccessibilityService : nsISupports
{
nsIAccessible createRootAccessible(in nsISupports aPresContext, in nsISupports aFrame);
nsIAccessible createHTMLSelectAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
nsIAccessible createHTMLComboboxAccessible(in nsIDOMNode aNode, in nsISupports aPresShell);
nsIAccessible createHTMLListboxAccessible(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);

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

@ -41,7 +41,9 @@ CPPSRCS = \
nsHTMLImageAccessible.cpp \
nsHTMLAreaAccessible.cpp \
nsHTMLLinkAccessible.cpp \
nsHTMLSelectAccessible.cpp \
nsHTMLSelectListAccessible.cpp \
nsHTMLComboboxAccessible.cpp \
nsHTMLListboxAccessible.cpp \
nsGenericAccessible.cpp \
$(NULL)

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

@ -40,7 +40,9 @@
#include "nsHTMLImageAccessible.h"
#include "nsHTMLAreaAccessible.h"
#include "nsHTMLLinkAccessible.h"
#include "nsHTMLSelectAccessible.h"
#include "nsHTMLSelectListAccessible.h"
#include "nsHTMLComboboxAccessible.h"
#include "nsHTMLListboxAccessible.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsHTMLFormControlAccessible.h"
#include "nsILink.h"
@ -73,66 +75,83 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsAccessibilityService, nsIAccessibilityService);
NS_IMETHODIMP
nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISupports* aFrame, nsIAccessible **_retval)
{
nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
// XXX - jgaunt - looks like we aren't using this
//nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
nsCOMPtr<nsIPresContext> c(do_QueryInterface(aPresContext));
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> s;
c->GetShell(getter_AddRefs(s));
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
NS_ASSERTION(s,"Error not presshell!!");
NS_ASSERTION(presShell,"Error not presshell!!");
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(s);
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsRootAccessible(wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
*_retval = new nsRootAccessible(weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLSelectAccessible(nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
{
nsCOMPtr<nsIPresContext> c(do_QueryInterface(aPresContext));
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> s;
c->GetShell(getter_AddRefs(s));
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(s);
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsHTMLSelectAccessible(node, wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLComboboxAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* node, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
{
nsCOMPtr<nsIPresContext> c(do_QueryInterface(aPresContext));
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> s;
c->GetShell(getter_AddRefs(s));
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(s);
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsHTMLSelectOptionAccessible(aAccParent, node, wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
*_retval = new nsHTMLListboxAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
{
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsHTMLSelectOptionAccessible(aAccParent, aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
@ -141,18 +160,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLCheckboxAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
*_retval = new nsHTMLCheckboxAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -160,18 +178,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupport
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLRadioButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLRadioButtonAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -179,18 +196,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aF
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLButtonAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTML4ButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -198,18 +214,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *a
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTML4ButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTML4ButtonAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -217,18 +232,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFra
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTextAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTextAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
@ -237,18 +251,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFr
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTableAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTableAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLTableCellAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -256,18 +269,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTableCellAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTableCellAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLImageAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -275,8 +287,8 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFr
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
nsIImageFrame* imageFrame = nsnull;
@ -287,13 +299,12 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFr
if (!imageFrame)
return NS_ERROR_FAILURE;
*_retval = new nsHTMLImageAccessible(node, imageFrame, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLImageAccessible(node, imageFrame, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLAreaAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -302,13 +313,11 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLAreaAccessible(nsIWeakReference
{
*_retval = new nsHTMLAreaAccessible(aDOMNode, aAccParent, aShell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLTextFieldAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -316,35 +325,33 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTextFieldAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTextFieldAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
{
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
nsCOMPtr<nsIContent> content;
(*aRealFrame)->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
*aNode = node;
NS_ADDREF(*aNode);
NS_IF_ADDREF(*aNode);
nsCOMPtr<nsIDocument> document;
content->GetDocument(*getter_AddRefs(document));
if (!document)
return NS_ERROR_FAILURE;
if (!document)
return NS_ERROR_FAILURE;
#ifdef DEBUG
PRInt32 shells = document->GetNumberOfShells();
@ -353,72 +360,68 @@ NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aR
// do_GetWR only works into a |nsCOMPtr| :-(
nsCOMPtr<nsIPresShell> tempShell;
nsCOMPtr<nsIWeakReference> weak;
nsCOMPtr<nsIWeakReference> weakShell;
document->GetShellAt(0, getter_AddRefs(tempShell));
weak = do_GetWeakReference(tempShell);
NS_IF_ADDREF(*aShell = weak);
weakShell = do_GetWeakReference(tempShell);
NS_IF_ADDREF(*aShell = weakShell);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateAccessible(nsIDOMNode* node, nsISupports* document, nsIAccessible **_retval)
nsAccessibilityService::CreateAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
{
nsCOMPtr<nsIContent> content (do_QueryInterface(node));
nsCOMPtr<nsIDocument> d (do_QueryInterface(document));
if (!d)
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
if (!document)
return NS_ERROR_FAILURE;
#ifdef DEBUG
PRInt32 shells = d->GetNumberOfShells();
PRInt32 shells = document->GetNumberOfShells();
NS_ASSERTION(shells > 0,"Error no shells!");
#endif
nsCOMPtr<nsIPresShell> tempShell;
d->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(tempShell);
document->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
*_retval = new nsAccessible(node, wr);
if ( *_retval ) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* node, nsISupports* document, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
{
nsCOMPtr<nsIContent> content (do_QueryInterface(node));
nsCOMPtr<nsIDocument> d (do_QueryInterface(document));
if (!d)
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
if (!document)
return NS_ERROR_FAILURE;
#ifdef DEBUG
PRInt32 shells = d->GetNumberOfShells();
PRInt32 shells = document->GetNumberOfShells();
NS_ASSERTION(shells > 0,"Error no shells!");
#endif
nsCOMPtr<nsIPresShell> tempShell;
d->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(tempShell);
document->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
*_retval = new nsAccessible(node, wr);
if ( *_retval ) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
NS_ASSERTION(content,"Error non nsIContent passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
@ -447,9 +450,9 @@ nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports
nsCOMPtr<nsIDocument> innerDoc;
ps->GetDocument(getter_AddRefs(innerDoc));
if (innerDoc) {
nsCOMPtr<nsIAccessible> root = new nsHTMLIFrameRootAccessible(node, wr);
nsCOMPtr<nsIAccessible> root = new nsHTMLIFrameRootAccessible(aDOMNode, wr);
if ( root ) {
nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(node, root, weakRef, innerDoc);
nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(aDOMNode, root, weakRef, innerDoc);
if ( frameAcc != nsnull ) {
*_retval = NS_STATIC_CAST(nsIAccessible*, frameAcc);
if ( *_retval ) {
@ -615,8 +618,6 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIWeakReference *aPresSh
return NS_OK;
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
@ -627,11 +628,11 @@ NS_NewAccessibilityService(nsIAccessibilityService** aResult)
if (! aResult)
return NS_ERROR_NULL_POINTER;
nsAccessibilityService* a = new nsAccessibilityService();
if (a == nsnull)
nsAccessibilityService* accService = new nsAccessibilityService();
if (!accService)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(a);
*aResult = a;
NS_ADDREF(accService);
*aResult = accService;
return NS_OK;
}

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

@ -28,7 +28,7 @@ CPP_OBJS=\
.\$(OBJDIR)\nsRootAccessible.obj \
.\$(OBJDIR)\nsHTMLIFrameRootAccessible.obj \
.\$(OBJDIR)\nsAccessibilityService.obj \
.\$(OBJDIR)\nsHTMLSelectAccessible.obj \
.\$(OBJDIR)\nsHTMLSelectListAccessible.obj \
.\$(OBJDIR)\nsGenericAccessible.obj \
.\$(OBJDIR)\nsHTMLFormControlAccessible.obj \
.\$(OBJDIR)\nsHTMLTextAccessible.obj \
@ -36,6 +36,8 @@ CPP_OBJS=\
.\$(OBJDIR)\nsHTMLAreaAccessible.obj \
.\$(OBJDIR)\nsHTMLTableAccessible.obj \
.\$(OBJDIR)\nsHTMLLinkAccessible.obj \
.\$(OBJDIR)\nsHTMLComboboxAccessible.obj \
.\$(OBJDIR)\nsHTMLListboxAccessible.obj \
$(NULL)
EXPORTS = \

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

@ -40,7 +40,9 @@
#include "nsHTMLImageAccessible.h"
#include "nsHTMLAreaAccessible.h"
#include "nsHTMLLinkAccessible.h"
#include "nsHTMLSelectAccessible.h"
#include "nsHTMLSelectListAccessible.h"
#include "nsHTMLComboboxAccessible.h"
#include "nsHTMLListboxAccessible.h"
#include "nsIDOMHTMLAreaElement.h"
#include "nsHTMLFormControlAccessible.h"
#include "nsILink.h"
@ -73,66 +75,83 @@ NS_IMPL_THREADSAFE_ISUPPORTS1(nsAccessibilityService, nsIAccessibilityService);
NS_IMETHODIMP
nsAccessibilityService::CreateRootAccessible(nsISupports* aPresContext, nsISupports* aFrame, nsIAccessible **_retval)
{
nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
// XXX - jgaunt - looks like we aren't using this
//nsIFrame* f = NS_STATIC_CAST(nsIFrame*, aFrame);
nsCOMPtr<nsIPresContext> c(do_QueryInterface(aPresContext));
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> s;
c->GetShell(getter_AddRefs(s));
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
NS_ASSERTION(s,"Error not presshell!!");
NS_ASSERTION(presShell,"Error not presshell!!");
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(s);
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsRootAccessible(wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
*_retval = new nsRootAccessible(weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLSelectAccessible(nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
{
nsCOMPtr<nsIPresContext> c(do_QueryInterface(aPresContext));
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> s;
c->GetShell(getter_AddRefs(s));
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(s);
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsHTMLSelectAccessible(node, wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLComboboxAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* node, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
{
nsCOMPtr<nsIPresContext> c(do_QueryInterface(aPresContext));
NS_ASSERTION(c,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> s;
c->GetShell(getter_AddRefs(s));
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(s);
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsHTMLSelectOptionAccessible(aAccParent, node, wr);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
*_retval = new nsHTMLListboxAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIAccessible *aAccParent, nsISupports* aPresContext, nsIAccessible **_retval)
{
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
NS_ASSERTION(presContext,"Error non prescontext passed to accessible factory!!!");
nsCOMPtr<nsIPresShell> presShell;
presContext->GetShell(getter_AddRefs(presShell));
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(presShell);
*_retval = new nsHTMLSelectOptionAccessible(aAccParent, aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
@ -141,18 +160,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLCheckboxAccessible(nsISupports *
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLCheckboxAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
*_retval = new nsHTMLCheckboxAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMRadioButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -160,18 +178,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLRadioButtonAccessible(nsISupport
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLRadioButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLRadioButtonAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -179,18 +196,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLButtonAccessible(nsISupports *aF
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLButtonAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTML4ButtonAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -198,18 +214,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTML4ButtonAccessible(nsISupports *a
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTML4ButtonAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTML4ButtonAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLTextAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -217,18 +232,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextAccessible(nsISupports *aFra
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTextAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTextAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
@ -237,18 +251,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableAccessible(nsISupports *aFr
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTableAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTableAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLTableCellAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -256,18 +269,17 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTableCellAccessible(nsISupports
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTableCellAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTableCellAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLImageAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -275,8 +287,8 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFr
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
nsIImageFrame* imageFrame = nsnull;
@ -287,13 +299,12 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLImageAccessible(nsISupports *aFr
if (!imageFrame)
return NS_ERROR_FAILURE;
*_retval = new nsHTMLImageAccessible(node, imageFrame, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLImageAccessible(node, imageFrame, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLAreaAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -302,13 +313,11 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLAreaAccessible(nsIWeakReference
{
*_retval = new nsHTMLAreaAccessible(aDOMNode, aAccParent, aShell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/* nsIAccessible createHTMLTextFieldAccessible (in nsISupports aPresShell, in nsISupports aFrame); */
@ -316,35 +325,33 @@ NS_IMETHODIMP nsAccessibilityService::CreateHTMLTextFieldAccessible(nsISupports
{
nsIFrame* frame;
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> shell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(shell), getter_AddRefs(node));
nsCOMPtr<nsIWeakReference> weakShell;
nsresult rv = GetInfo(aFrame, &frame, getter_AddRefs(weakShell), getter_AddRefs(node));
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTextFieldAccessible(node, shell);
if (*_retval) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsHTMLTextFieldAccessible(node, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aRealFrame, nsIWeakReference** aShell, nsIDOMNode** aNode)
{
NS_ASSERTION(aFrame,"Error -- 1st argument (aFrame) is null!!");
*aRealFrame = NS_STATIC_CAST(nsIFrame*, aFrame);
nsCOMPtr<nsIContent> content;
(*aRealFrame)->GetContent(getter_AddRefs(content));
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content));
*aNode = node;
NS_ADDREF(*aNode);
NS_IF_ADDREF(*aNode);
nsCOMPtr<nsIDocument> document;
content->GetDocument(*getter_AddRefs(document));
if (!document)
return NS_ERROR_FAILURE;
if (!document)
return NS_ERROR_FAILURE;
#ifdef DEBUG
PRInt32 shells = document->GetNumberOfShells();
@ -353,72 +360,68 @@ NS_IMETHODIMP nsAccessibilityService::GetInfo(nsISupports* aFrame, nsIFrame** aR
// do_GetWR only works into a |nsCOMPtr| :-(
nsCOMPtr<nsIPresShell> tempShell;
nsCOMPtr<nsIWeakReference> weak;
nsCOMPtr<nsIWeakReference> weakShell;
document->GetShellAt(0, getter_AddRefs(tempShell));
weak = do_GetWeakReference(tempShell);
NS_IF_ADDREF(*aShell = weak);
weakShell = do_GetWeakReference(tempShell);
NS_IF_ADDREF(*aShell = weakShell);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateAccessible(nsIDOMNode* node, nsISupports* document, nsIAccessible **_retval)
nsAccessibilityService::CreateAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
{
nsCOMPtr<nsIContent> content (do_QueryInterface(node));
nsCOMPtr<nsIDocument> d (do_QueryInterface(document));
if (!d)
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
if (!document)
return NS_ERROR_FAILURE;
#ifdef DEBUG
PRInt32 shells = d->GetNumberOfShells();
PRInt32 shells = document->GetNumberOfShells();
NS_ASSERTION(shells > 0,"Error no shells!");
#endif
nsCOMPtr<nsIPresShell> tempShell;
d->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(tempShell);
document->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
*_retval = new nsAccessible(node, wr);
if ( *_retval ) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* node, nsISupports* document, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLBlockAccessible(nsIDOMNode* aDOMNode, nsISupports* aDocument, nsIAccessible **_retval)
{
nsCOMPtr<nsIContent> content (do_QueryInterface(node));
nsCOMPtr<nsIDocument> d (do_QueryInterface(document));
if (!d)
nsCOMPtr<nsIDocument> document (do_QueryInterface(aDocument));
if (!document)
return NS_ERROR_FAILURE;
#ifdef DEBUG
PRInt32 shells = d->GetNumberOfShells();
PRInt32 shells = document->GetNumberOfShells();
NS_ASSERTION(shells > 0,"Error no shells!");
#endif
nsCOMPtr<nsIPresShell> tempShell;
d->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> wr = do_GetWeakReference(tempShell);
document->GetShellAt(0, getter_AddRefs(tempShell));
nsCOMPtr<nsIWeakReference> weakShell = do_GetWeakReference(tempShell);
*_retval = new nsAccessible(node, wr);
if ( *_retval ) {
NS_ADDREF(*_retval);
return NS_OK;
}
return NS_ERROR_OUT_OF_MEMORY;
*_retval = new nsAccessible(aDOMNode, weakShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports* aPresContext, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* aDOMNode, nsISupports* aPresContext, nsIAccessible **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
nsCOMPtr<nsIContent> content(do_QueryInterface(aDOMNode));
NS_ASSERTION(content,"Error non nsIContent passed to accessible factory!!!");
nsCOMPtr<nsIPresContext> presContext(do_QueryInterface(aPresContext));
@ -447,9 +450,9 @@ nsAccessibilityService::CreateHTMLIFrameAccessible(nsIDOMNode* node, nsISupports
nsCOMPtr<nsIDocument> innerDoc;
ps->GetDocument(getter_AddRefs(innerDoc));
if (innerDoc) {
nsCOMPtr<nsIAccessible> root = new nsHTMLIFrameRootAccessible(node, wr);
nsCOMPtr<nsIAccessible> root = new nsHTMLIFrameRootAccessible(aDOMNode, wr);
if ( root ) {
nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(node, root, weakRef, innerDoc);
nsHTMLIFrameAccessible* frameAcc = new nsHTMLIFrameAccessible(aDOMNode, root, weakRef, innerDoc);
if ( frameAcc != nsnull ) {
*_retval = NS_STATIC_CAST(nsIAccessible*, frameAcc);
if ( *_retval ) {
@ -615,8 +618,6 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessibleFor(nsIWeakReference *aPresSh
return NS_OK;
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
@ -627,11 +628,11 @@ NS_NewAccessibilityService(nsIAccessibilityService** aResult)
if (! aResult)
return NS_ERROR_NULL_POINTER;
nsAccessibilityService* a = new nsAccessibilityService();
if (a == nsnull)
nsAccessibilityService* accService = new nsAccessibilityService();
if (!accService)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(a);
*aResult = a;
NS_ADDREF(accService);
*aResult = accService;
return NS_OK;
}

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

@ -0,0 +1,741 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
*/
#include "nsHTMLComboboxAccessible.h"
#include "nsCOMPtr.h"
#include "nsIComboboxControlFrame.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIFrame.h"
#include "nsLayoutAtoms.h"
/** ----- nsHTMLComboboxAccessible ----- */
/**
* Constructor -- create the nsHTMLAccessible and set initial state
* closed and not registered
*/
nsHTMLComboboxAccessible::nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsAccessible(aDOMNode, aShell)
{
mRegistered = PR_FALSE;
mOpen = PR_FALSE;
SetupMenuListener();
}
/**
* Destructor -- If we are registered, remove ourselves as a listener.
*/
nsHTMLComboboxAccessible::~nsHTMLComboboxAccessible()
{
if (mRegistered) {
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
if (eventReceiver)
eventReceiver->RemoveEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE);
}
}
/** Inherit the ISupports impl from nsAccessible -- handle nsIDOMMenuListener ourself */
NS_IMPL_ISUPPORTS_INHERITED(nsHTMLComboboxAccessible, nsAccessible, nsIDOMMenuListener)
/**
* Tell our caller we are a combobox
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_COMBOBOX;
return NS_OK;
}
/**
* Through the arg, pass back our last child, a nsHTMLComboboxWindowAccessible object
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = new nsHTMLComboboxWindowAccessible(this, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* Through the arg, pass back our first child, a nsHTMLComboboxTextFieldAccessible object
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = new nsHTMLComboboxTextFieldAccessible(this, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* We always have 3 children: TextField, Button, Window. In that order
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 3;
return NS_OK;
}
/**
* nsIAccessibleSelectable method. No-op because our selection is returned through
* GetValue(). This _may_ change just to provide additional info for the vendors
* and another option for them to get at stuff.
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetSelectedChildren(nsISupportsArray **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* Our value is the value of our ( first ) selected child. SelectElement
* returns this by default with GetValue().
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccValue(nsAWritableString& _retval)
{
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
if (select) {
select->GetValue(_retval);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/**
* As a nsHTMLComboboxAccessible we can have the following states:
* STATE_FOCUSED
* STATE_READONLY
* STATE_FOCUSABLE
* STATE_HASPOPUP
* STATE_EXPANDED
* STATE_COLLAPSED
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::GetAccState(PRUint32 *_retval)
{
// this sets either STATE_FOCUSED or 0
nsAccessible::GetAccState(_retval);
if (mOpen)
*_retval |= STATE_EXPANDED;
else
*_retval |= STATE_COLLAPSED;
*_retval |= STATE_HASPOPUP | STATE_READONLY | STATE_FOCUSABLE;
return NS_OK;
}
/**
* Set our state to open and (TBD) fire an event to MSAA saying our state
* has changed.
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::Create(nsIDOMEvent* aEvent)
{
mOpen = PR_TRUE;
/* TBD send state change event */
return NS_OK;
}
/**
* Set our state to not open and (TDB) fire an event to MSAA saying
* our state has changed.
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::Destroy(nsIDOMEvent* aEvent)
{
mOpen = PR_FALSE;
/* TBD send state change event */
return NS_OK;
}
/**
* Set our state to not open and (TDB) fire an event to MSAA saying
* our state has changed.
*/
NS_IMETHODIMP nsHTMLComboboxAccessible::Close(nsIDOMEvent* aEvent)
{
mOpen = PR_FALSE;
/* TBD send state change event */
return NS_OK;
}
/**
* If we aren't already registered, register ourselves as a
* listener to "create" events on our DOM node. Set our
* state to registered, but don't notify MSAA as they
* don't need to know about this state.
*/
void
nsHTMLComboboxAccessible::SetupMenuListener()
{
// if not already registered as a popup listener, register ourself
if (!mRegistered) {
nsCOMPtr<nsIDOMEventReceiver> eventReceiver(do_QueryInterface(mDOMNode));
if (eventReceiver && NS_SUCCEEDED(eventReceiver->AddEventListener(NS_LITERAL_STRING("create"), this, PR_TRUE)))
mRegistered = PR_TRUE;
}
}
/** ----- nsHTMLComboboxTextFieldAccessible ----- */
/**
* Constructor -- create the nsLeafAccessible and set our parent
*/
nsHTMLComboboxTextFieldAccessible::nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsLeafAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/**
* Currently gets the text from the first option, needs to check for selection
* and then return that text.
* Walks the Frame tree and checks for proper frames.
*/
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccValue(nsAWritableString& _retval)
{
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsCOMPtr<nsIPresContext> context;
GetPresContext(context);
if (!frame || !context)
return NS_ERROR_FAILURE;
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return NS_ERROR_FAILURE;
#endif
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::textFrame))
return NS_ERROR_FAILURE;
#endif
nsCOMPtr<nsIContent> content;
frame->GetContent(getter_AddRefs(content));
if (!content)
return NS_ERROR_FAILURE;
AppendFlatStringFromSubtree(content, &_retval);
return NS_OK;
}
/**
* Gets the bounds for the AreaFrame around the BlockFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsHTMLComboboxTextFieldAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
{
// get our first child's frame
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsCOMPtr<nsIPresContext> context;
GetPresContext(context);
if (!frame || !context)
return;
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return;
#endif
frame->GetParent(aRelativeFrame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(*aRelativeFrame, nsLayoutAtoms::areaFrame))
return;
#endif
frame->GetRect(aBounds);
}
/**
* Getter for our parent
*/
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
* Through the arg, pass back our next sibling, a
* nsHTMLComboboxButtonAccessible object
*/
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
nsCOMPtr<nsIAccessible> parent;
GetAccParent(getter_AddRefs(parent));
*_retval = new nsHTMLComboboxButtonAccessible(parent, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* We are the first child of our parent, no previous sibling
*/
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* Our role is currently only static text, but we should be able to have
* editable text here and we need to check that case.
*/
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_STATICTEXT;
return NS_OK;
}
/**
* As a nsHTMLComboboxTextFieldAccessible we can have the following states:
* STATE_READONLY
* STATE_FOCUSED
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsHTMLComboboxTextFieldAccessible::GetAccState(PRUint32 *_retval)
{
// this sets either STATE_FOCUSED or 0
nsAccessible::GetAccState(_retval);
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
return NS_OK;
}
/** -----SelectButtonAccessible ----- */
/**
* Constructor -- create the nsMenuListenerAccessible and set our parent
*/
nsHTMLComboboxButtonAccessible::nsHTMLComboboxButtonAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/**
* Programmaticaly click on the button, causing either the display or
* the hiding of the drop down box ( window ).
* Walks the Frame tree and checks for proper frames.
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::AccDoAction(PRUint8 index)
{
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsCOMPtr<nsIPresContext> context;
GetPresContext(context);
if (!context)
return NS_ERROR_FAILURE;
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return NS_ERROR_FAILURE;
#endif
frame->GetNextSibling(&frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
return NS_ERROR_FAILURE;
#endif
nsCOMPtr<nsIContent> content;
frame->GetContent(getter_AddRefs(content));
// We only have one action, click. Any other index is meaningless(wrong)
if (index == eAction_Click) {
nsCOMPtr<nsIDOMHTMLInputElement> element(do_QueryInterface(content));
if (element)
{
element->Click();
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_ERROR_NOT_IMPLEMENTED;
}
/**
* Just one action ( click ).
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccNumActions(PRUint8 *_retval)
{
*_retval = 1;
return NS_OK;
}
/**
* Gets the bounds for the AreaFrame around the gfxButtonControlFrame.
* Walks the Frame tree and checks for proper frames.
*/
void nsHTMLComboboxButtonAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
{
// get our second child's frame
nsIFrame* frame = nsAccessible::GetBoundsFrame();
nsCOMPtr<nsIPresContext> context;
GetPresContext(context);
if (!context)
return;
frame->FirstChild(context, nsnull, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return;
#endif
frame->GetNextSibling(&frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::gfxButtonControlFrame))
return;
#endif
frame->GetParent(aRelativeFrame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(*aRelativeFrame, nsLayoutAtoms::areaFrame))
return;
#endif
frame->GetRect(aBounds);
}
/**
* Tell our caller we are a button.
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_PUSHBUTTON;
return NS_OK;
}
/**
* Getter for our parent
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
* Gets the name from GetAccActionName()
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccName(nsAWritableString& _retval)
{
return GetAccActionName(eAction_Click, _retval);
}
/**
* Our action name is the reverse of our state:
* if we are closed -> open is our name.
* if we are open -> closed is our name.
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccActionName(PRUint8 index, nsAWritableString& _retval)
{
// we are open or closed
PRBool isOpen = PR_FALSE;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame;
nsresult rv = QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
comboFrame->IsDroppedDown(&isOpen);
if (isOpen)
_retval = NS_LITERAL_STRING("Close");
else
_retval = NS_LITERAL_STRING("Open");
return NS_OK;
}
/**
* Through the arg, pass back our next sibling, a
* nsHTMLComboboxWindowAccessible object
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
nsCOMPtr<nsIAccessible> parent;
GetAccParent(getter_AddRefs(parent));
*_retval = new nsHTMLComboboxWindowAccessible(parent, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* Through the arg, pass back our previous sibling, a
* nsHTMLComboboxTextFieldAccessible object
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
nsCOMPtr<nsIAccessible> parent;
GetAccParent(getter_AddRefs(parent));
*_retval = new nsHTMLComboboxTextFieldAccessible(parent, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* No Children. Just a button ( over-riding nsAccessible )
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children. Just a button ( over-riding nsAccessible )
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* No Children. Just a button ( over-riding nsAccessible )
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 0;
return NS_OK;
}
/**
* As a nsHTMLComboboxButtonAccessible we can have the following states:
* STATE_PRESSED
* STATE_FOCUSED
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetAccState(PRUint32 *_retval)
{
// this sets either STATE_FOCUSED or 0
nsAccessible::GetAccState(_retval);
// we are open or closed
PRBool isOpen = PR_FALSE;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame;
nsresult rv = QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
comboFrame->IsDroppedDown(&isOpen);
if (isOpen)
*_retval |= STATE_PRESSED;
*_retval |= STATE_FOCUSABLE;
return NS_OK;
}
/** ----- nsHTMLComboboxWindowAccessible ----- */
/**
* Constructor -- create the nsMenuListener and set our parent
*/
nsHTMLComboboxWindowAccessible::nsHTMLComboboxWindowAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/**
* As a nsHTMLComboboxWindowAccessible we can have the following states:
* STATE_FOCUSED
* STATE_FOCUSABLE
* STATE_INVISIBLE
* STATE_FLOATING
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccState(PRUint32 *_retval)
{
// this sets either STATE_FOCUSED or 0
nsAccessible::GetAccState(_retval);
// we are open or closed
PRBool isOpen = PR_FALSE;
nsIFrame *boundsFrame = GetBoundsFrame();
nsIComboboxControlFrame* comboFrame;
nsresult rv = QueryInterface(NS_GET_IID(nsIComboboxControlFrame), (void**)&comboFrame);
if (NS_FAILED(rv))
return NS_ERROR_FAILURE;
comboFrame->IsDroppedDown(&isOpen);
if (! isOpen)
*_retval |= STATE_INVISIBLE;
*_retval |= STATE_FOCUSABLE | STATE_FLOATING;
return NS_OK;
}
/**
* Tell our caller we are a window
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_WINDOW;
return NS_OK;
}
/**
* Getter for our parent
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
* Through the arg, pass back our previous sibling, a
* nsHTMLComboboxButtonAccessible object
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
nsCOMPtr<nsIAccessible> parent;
GetAccParent(getter_AddRefs(parent));
*_retval = new nsHTMLComboboxButtonAccessible(parent, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* We are the last sibling of our parent.
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
* We only have one child, a list
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* We only have one child, a list
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
if (! *_retval)
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* We only have one child, a list
*/
NS_IMETHODIMP nsHTMLComboboxWindowAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 1;
return NS_OK;
}
/**
* Find the bounds of the window, the window may be invisible.
*/
void nsHTMLComboboxWindowAccessible::GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame)
{
// get our first option
nsCOMPtr<nsIDOMNode> child;
mDOMNode->GetFirstChild(getter_AddRefs(child));
// now get its frame
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
if (!shell) {
*aRelativeFrame = nsnull;
return;
}
nsIFrame* frame = nsnull;
nsCOMPtr<nsIContent> content(do_QueryInterface(child));
shell->GetPrimaryFrameFor(content, &frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::blockFrame))
return;
#endif
frame->GetParent(&frame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(frame, nsLayoutAtoms::areaFrame))
return;
#endif
frame->GetParent(aRelativeFrame);
#ifdef DEBUG
if (! nsAccessible::IsCorrectFrameType(*aRelativeFrame, nsLayoutAtoms::listControlFrame))
return;
#endif
frame->GetRect(aBounds);
}

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

@ -0,0 +1,161 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: John Gaunt (jgaunt@netscape.com)
*
* Contributor(s):
*/
#ifndef __nsHTMLComboboxAccessible_h__
#define __nsHTMLComboboxAccessible_h__
#include "nsAccessible.h"
#include "nsIAccessibleSelectable.h"
#include "nsCOMPtr.h"
#include "nsHTMLSelectListAccessible.h"
#include "nsIDOMMenuListener.h"
/*
* A class the represents the HTML Combobox widget.
*/
class nsHTMLComboboxAccessible : public nsAccessible,
public nsIAccessibleSelectable,
public nsIDOMMenuListener
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESELECTABLE
nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLComboboxAccessible();
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
// popup listener
NS_IMETHOD Create(nsIDOMEvent* aEvent);
NS_IMETHOD Close(nsIDOMEvent* aEvent);
NS_IMETHOD Destroy(nsIDOMEvent* aEvent);
NS_IMETHOD Action(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD Broadcast(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD CommandUpdate(nsIDOMEvent* aEvent) { return NS_OK; }
NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
virtual void SetupMenuListener();
protected:
PRBool mRegistered;
PRBool mOpen;
};
/*
* A class the represents the text field in the Select to the left
* of the drop down button
*/
class nsHTMLComboboxTextFieldAccessible : public nsLeafAccessible
{
public:
nsHTMLComboboxTextFieldAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
/**
* A class that represents the button inside the Select to the
* right of the text field
*/
class nsHTMLComboboxButtonAccessible : public nsAccessible
{
public:
enum { eAction_Click=0 };
nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccName(nsAWritableString& _retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccNumActions(PRUint8 *_retval);
NS_IMETHOD GetAccActionName(PRUint8 index, nsAWritableString& _retval);
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD GetAccState(PRUint32 *_retval);
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
/*
* A class that represents the window that lives to the right
* of the drop down button inside the Select. This is the window
* that is made visible when the button is pressed.
*/
class nsHTMLComboboxWindowAccessible : public nsAccessible
{
public:
nsHTMLComboboxWindowAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
virtual void GetBounds(nsRect& aBounds, nsIFrame** aRelativeFrame);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
#endif

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

@ -0,0 +1,132 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
*/
#include "nsHTMLListboxAccessible.h"
#include "nsCOMPtr.h"
#include "nsIDOMHTMLInputElement.h"
#include "nsIDOMHTMLSelectElement.h"
#include "nsIFrame.h"
#include "nsLayoutAtoms.h"
/** ----- nsHTMLListboxAccessible ----- */
/**
* Constructor -- create the nsHTMLAccessible
*/
nsHTMLListboxAccessible::nsHTMLListboxAccessible(nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsAccessible(aDOMNode, aShell)
{
}
/** Inherit the ISupports impl from nsAccessible */
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLListboxAccessible, nsAccessible)
/**
* Tell our caller we are a list ( there isn't a listbox value )
*/
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LIST;
return NS_OK;
}
/**
* Through the arg, pass back our last child, a nsHTMLListboxWindowAccessible object
*/
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccLastChild(nsIAccessible **_retval)
{
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
if ( ! *_retval )
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* Through the arg, pass back our first child, a nsHTMLListboxWindowAccessible object
*/
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
*_retval = new nsHTMLSelectListAccessible(this, mDOMNode, mPresShell);
if ( ! *_retval )
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* We always have 1 child: SelectList.
*/
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccChildCount(PRInt32 *_retval)
{
*_retval = 1;
return NS_OK;
}
/**
* nsIAccessibleSelectable method. This needs to get from the select the list
* of select options and then iterate through that pulling out the selected
* items and creating IAccessible objects for them. Put the IAccessibles in
* the nsISupportsArray and return them.
*/
NS_IMETHODIMP nsHTMLListboxAccessible::GetSelectedChildren(nsISupportsArray **_retval)
{
*_retval = nsnull;
return NS_ERROR_NOT_IMPLEMENTED;
}
/**
* Our value is the value of our ( first ) selected child. SelectElement
* returns this by default with GetValue().
*/
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccValue(nsAWritableString& _retval)
{
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
if ( select ) {
select->GetValue(_retval);
return NS_OK;
}
return NS_ERROR_FAILURE;
}
/**
* As a nsHTMLListboxAccessible we can have the following states:
* STATE_FOCUSED
* STATE_READONLY
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsHTMLListboxAccessible::GetAccState(PRUint32 *_retval)
{
// this sets either STATE_FOCUSED or 0
nsAccessible::GetAccState(_retval);
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
return NS_OK;
}

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

@ -0,0 +1,57 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: John Gaunt (jgaunt@netscape.com)
*
* Contributor(s):
*/
#ifndef __nsHTMLListboxAccessible_h__
#define __nsHTMLListboxAccessible_h__
#include "nsAccessible.h"
#include "nsIAccessibleSelectable.h"
#include "nsCOMPtr.h"
#include "nsHTMLSelectListAccessible.h"
/*
* A class the represents the HTML Combobox widget.
*/
class nsHTMLListboxAccessible : public nsAccessible,
public nsIAccessibleSelectable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLESELECTABLE
nsHTMLListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLListboxAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccChildCount(PRInt32 *_retval);
NS_IMETHOD GetAccValue(nsAWritableString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
};
#endif

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

@ -0,0 +1,266 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s): John Gaunt (jgaunt@netscape.com)
*/
#include "nsHTMLSelectListAccessible.h"
#include "nsRootAccessible.h"
#include "nsCOMPtr.h"
#include "nsLayoutAtoms.h"
#include "nsIAtom.h"
#include "nsIFrame.h"
#include "nsISelectControlFrame.h"
#include "nsIDOMHTMLOptionElement.h"
#include "nsIDOMHTMLSelectElement.h"
/** ----- nsHTMLSelectListAccessible ----- */
/**
*
*/
nsHTMLSelectListAccessible::nsHTMLSelectListAccessible(nsIAccessible* aParent,
nsIDOMNode* aDOMNode,
nsIWeakReference* aShell)
:nsAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height)
{
return mParent->AccGetBounds(x,y,width,height);
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LIST;
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccLastChild(nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> last;
mDOMNode->GetLastChild(getter_AddRefs(last));
*_retval = new nsHTMLSelectOptionAccessible(this, last, mPresShell);
if ( ! *_retval )
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccFirstChild(nsIAccessible **_retval)
{
nsCOMPtr<nsIDOMNode> first;
mDOMNode->GetFirstChild(getter_AddRefs(first));
*_retval = new nsHTMLSelectOptionAccessible(this, first, mPresShell);
if ( ! *_retval )
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
return NS_OK;
}
/**
* As a nsHTMLSelectListAccessible we can have the following states:
* STATE_MULTISELECTABLE
* STATE_EXTSELECTABLE
* STATE_FOCUSED
* STATE_FOCUSABLE
*/
NS_IMETHODIMP nsHTMLSelectListAccessible::GetAccState(PRUint32 *_retval)
{
// this sets either STATE_FOCUSED or 0
nsAccessible::GetAccState(_retval);
nsCOMPtr<nsIDOMHTMLSelectElement> select (do_QueryInterface(mDOMNode));
if ( select ) {
PRBool multiple;
select->GetMultiple(&multiple);
if ( multiple )
*_retval |= STATE_MULTISELECTABLE | STATE_EXTSELECTABLE;
}
*_retval |= STATE_FOCUSABLE;
return NS_OK;
}
/** ----- nsHTMLSelectOptionAccessible ----- */
/**
*
*/
nsHTMLSelectOptionAccessible::nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsLeafAccessible(aDOMNode, aShell)
{
mParent = aParent;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccRole(PRUint32 *_retval)
{
*_retval = ROLE_LISTITEM;
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccParent(nsIAccessible **_retval)
{
*_retval = mParent;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccNextSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsIDOMNode> next;
mDOMNode->GetNextSibling(getter_AddRefs(next));
if (next) {
*_retval = new nsHTMLSelectOptionAccessible(mParent, next, mPresShell);
if ( ! *_retval )
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
}
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccPreviousSibling(nsIAccessible **_retval)
{
*_retval = nsnull;
nsCOMPtr<nsIDOMNode> prev;
mDOMNode->GetPreviousSibling(getter_AddRefs(prev));
if (prev) {
*_retval = new nsHTMLSelectOptionAccessible(mParent, prev, mPresShell);
if ( ! *_retval )
return NS_ERROR_FAILURE;
NS_ADDREF(*_retval);
}
return NS_OK;
}
/**
*
*/
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccName(nsAWritableString& _retval)
{
nsCOMPtr<nsIContent> content (do_QueryInterface(mDOMNode));
if (!content) {
return NS_ERROR_FAILURE;
}
nsAutoString option;
nsresult rv = AppendFlatStringFromSubtree(content, &option);
if (NS_SUCCEEDED(rv)) {
// Temp var needed until CompressWhitespace built for nsAWritableString
option.CompressWhitespace();
_retval.Assign(option);
}
return rv;
}
/**
* As a nsHTMLSelectOptionAccessible we can have the following states:
* STATE_SELECTABLE
* STATE_SELECTED
* STATE_FOCUSED
* STATE_FOCUSABLE
* STATE_INVISIBLE // not implemented yet
*/
NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetAccState(PRUint32 *_retval)
{
// this sets either STATE_FOCUSED or 0
nsAccessible::GetAccState(_retval);
// Are we selected?
nsCOMPtr<nsIDOMHTMLOptionElement> option (do_QueryInterface(mDOMNode));
if ( option ) {
PRBool isSelected = PR_FALSE;
option->GetSelected(&isSelected);
if ( isSelected )
*_retval |= STATE_SELECTED;
}
*_retval |= STATE_SELECTABLE | STATE_FOCUSABLE;
return NS_OK;
}

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

@ -0,0 +1,78 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape 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/NPL/
*
* 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 mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Original Author: Eric Vaughan (evaughan@netscape.com)
*
* Contributor(s):
*/
#ifndef __nsHTMLSelectListAccessible_h__
#define __nsHTMLSelectListAccessible_h__
#include "nsAccessible.h"
#include "nsCOMPtr.h"
/*
* The list that contains all the options in the select.
*/
class nsHTMLSelectListAccessible : public nsAccessible
{
public:
nsHTMLSelectListAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsHTMLSelectListAccessible() {}
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD GetAccLastChild(nsIAccessible **_retval);
NS_IMETHOD GetAccFirstChild(nsIAccessible **_retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
/*
* Options inside the select, contained within the list
*/
class nsHTMLSelectOptionAccessible : public nsLeafAccessible
{
public:
nsHTMLSelectOptionAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
/* ----- nsIAccessible ----- */
NS_IMETHOD GetAccParent(nsIAccessible **_retval);
NS_IMETHOD GetAccRole(PRUint32 *_retval);
NS_IMETHOD GetAccNextSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval);
NS_IMETHOD GetAccName(nsAWritableString& _retval);
NS_IMETHOD GetAccState(PRUint32 *_retval);
protected:
nsCOMPtr<nsIAccessible> mParent;
};
#endif

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

@ -354,7 +354,7 @@ NS_IMETHODIMP nsComboboxControlFrame::GetAccessible(nsIAccessible** aAccessible)
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
return accService->CreateHTMLSelectAccessible(node, mPresContext, aAccessible);
return accService->CreateHTMLComboboxAccessible(node, mPresContext, aAccessible);
}
return NS_ERROR_FAILURE;

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

@ -552,7 +552,7 @@ NS_IMETHODIMP nsListControlFrame::GetAccessible(nsIAccessible** aAccessible)
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
return accService->CreateHTMLSelectAccessible(node, mPresContext, aAccessible);
return accService->CreateHTMLListboxAccessible(node, mPresContext, aAccessible);
}
return NS_ERROR_FAILURE;

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

@ -354,7 +354,7 @@ NS_IMETHODIMP nsComboboxControlFrame::GetAccessible(nsIAccessible** aAccessible)
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
return accService->CreateHTMLSelectAccessible(node, mPresContext, aAccessible);
return accService->CreateHTMLComboboxAccessible(node, mPresContext, aAccessible);
}
return NS_ERROR_FAILURE;

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

@ -552,7 +552,7 @@ NS_IMETHODIMP nsListControlFrame::GetAccessible(nsIAccessible** aAccessible)
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
return accService->CreateHTMLSelectAccessible(node, mPresContext, aAccessible);
return accService->CreateHTMLListboxAccessible(node, mPresContext, aAccessible);
}
return NS_ERROR_FAILURE;