XP part of accessibility landing

-r vidur, rods -sr hyatt


git-svn-id: svn://10.0.0.236/trunk@90971 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
evaughan%netscape.com 2001-04-01 01:01:33 +00:00
parent 4323130426
commit 94e72ae454
26 changed files with 598 additions and 55 deletions

View File

@ -10811,28 +10811,31 @@ keepLooking:
}
}
// We search the immediate children only, but if the child frame has
// the same content pointer as its parent then we need to search its
// child frames, too.
// We also need to search the child frame's children if the child frame
// is a "special" frame
// We also need to search if the child content is anonymous and scoped
// to the parent content.
nsCOMPtr<nsIContent> parentScope;
kidContent->GetBindingParent(getter_AddRefs(parentScope));
if (parentContent == kidContent || IsFrameSpecial(kidFrame) ||
(parentContent && (parentContent == parentScope)))
{
#ifdef NOISY_FINDFRAME
FFWC_recursions++;
printf(" recursing with new parent set to kidframe=%p, parentContent=%p\n",
kidFrame, parentContent.get());
#endif
nsIFrame* matchingFrame = FindFrameWithContent(aPresContext, kidFrame, parentContent,
aContent, nsnull);
// only do this if there is content
if (kidContent) {
// We search the immediate children only, but if the child frame has
// the same content pointer as its parent then we need to search its
// child frames, too.
// We also need to search the child frame's children if the child frame
// is a "special" frame
// We also need to search if the child content is anonymous and scoped
// to the parent content.
nsCOMPtr<nsIContent> parentScope;
kidContent->GetBindingParent(getter_AddRefs(parentScope));
if (parentContent == kidContent || IsFrameSpecial(kidFrame) ||
(parentContent && (parentContent == parentScope)))
{
#ifdef NOISY_FINDFRAME
FFWC_recursions++;
printf(" recursing with new parent set to kidframe=%p, parentContent=%p\n",
kidFrame, parentContent.get());
#endif
nsIFrame* matchingFrame = FindFrameWithContent(aPresContext, kidFrame, parentContent,
aContent, nsnull);
if (matchingFrame) {
return matchingFrame;
if (matchingFrame) {
return matchingFrame;
}
}
}
@ -12825,6 +12828,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
return PR_FALSE;
}
/*
* Recursively split an inline frame until we reach a block frame.
* Below is an example of how SplitToContainingBlock() works.

View File

@ -4938,6 +4938,10 @@ PresShell::HandleEvent(nsIView *aView,
return NS_OK;
}
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT)
return HandleEventInternal(aEvent, aView, NS_EVENT_FLAG_INIT, aEventStatus);
aView->GetClientData(clientData);
frame = (nsIFrame *)clientData;
@ -5085,6 +5089,14 @@ PresShell::HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent*
nsresult
PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView, PRUint32 aFlags, nsEventStatus* aStatus)
{
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT)
{
void* clientData;
aView->GetClientData(clientData);
nsIFrame* frame = (nsIFrame *)clientData;
return frame->HandleEvent(mPresContext, (nsGUIEvent*)aEvent, aStatus);
}
nsresult rv = NS_OK;
nsIEventStateManager *manager;

View File

@ -63,6 +63,11 @@
#include "nsListControlFrame.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
@ -301,7 +306,20 @@ nsComboboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
} else if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider))) {
*aInstancePtr = (void*)(nsIScrollableViewProvider*)this;
return NS_OK;
}
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIAccessible* acc = nsnull;
accService->CreateHTMLSelectAccessible(nsLayoutAtoms::popupList, node, mPresContext, &acc);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
}
@ -524,7 +542,6 @@ nsComboboxControlFrame::ScrollIntoView(nsIPresContext* aPresContext)
void
nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
{
nsIView* view = nsnull;
mDropdownFrame->GetView(mPresContext, &view);
nsCOMPtr<nsIViewManager> viewManager;
@ -543,6 +560,23 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
viewManager->ResizeView(view, 0, 0);
}
// fire a popup dom event
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event;
event.eventStructType = NS_EVENT;
event.message = aShowPopup ? NS_MENU_CREATE : NS_MENU_DESTROY;
event.isShift = PR_FALSE;
event.isControl = PR_FALSE;
event.isAlt = PR_FALSE;
event.isMeta = PR_FALSE;
event.clickCount = 0;
event.widget = nsnull;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = mPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell)
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
// Show the dropdown list

View File

@ -28,6 +28,11 @@
#include "nsISupportsArray.h"
#include "nsINameSpaceManager.h"
#include "nsContentCID.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
// Saving PresState
@ -468,7 +473,22 @@ nsGfxButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
} else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIStatefulFrame*, this);
} else {
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Push Button").get());
acc->SetRole(NS_LITERAL_STRING("push button").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
else {
return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -32,6 +32,11 @@
#include "nsINameSpaceManager.h"
#include "nsIPresState.h"
#include "nsCSSRendering.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
//------------------------------------------------------------
nsresult
@ -82,6 +87,23 @@ nsGfxCheckboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr
*aInstancePtr = (void*) ((nsICheckboxControlFrame*) this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Check Box").get());
acc->SetRole(NS_LITERAL_STRING("check box").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -32,6 +32,10 @@
#include "nsCSSRendering.h"
#include "nsIPresState.h"
#include "nsINameSpaceManager.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
nsresult
@ -77,7 +81,23 @@ nsGfxRadioControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = (void*) ((nsIStatefulFrame*) this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Radio Button").get());
acc->SetRole(NS_LITERAL_STRING("radio button").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -43,6 +43,8 @@
#include "nsIPtr.h"
#include "nsISizeOfHandler.h"
#include "nsIFrameManager.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessible.h"
#include "nsIDOMText.h"
#include "nsIDeviceContext.h"
@ -792,6 +794,22 @@ nsFrame::HandleEvent(nsIPresContext* aPresContext,
{
if (NS_SUCCEEDED(rv))
HandleRelease(aPresContext, aEvent, aEventStatus);
} break;
case NS_GETACCESSIBLE:
{
// get the accessible
// if(content) {
//nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
// get an accessible for the dom node
nsISupports* f = (nsISupports*)(nsIFrame*)this;
nsIAccessible* acc;
accService->CreateRootAccessible(aPresContext,mParent ? f : nsnull,&acc);
((nsAccessibleEvent*)aEvent)->accessible = acc;
}
//}
}
break;
default:

View File

@ -63,6 +63,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsIFrameManager.h"
#include "nsIScriptSecurityManager.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#ifdef DEBUG
@ -142,7 +147,21 @@ nsImageFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
return NS_OK;
}
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Image").get());
acc->SetRole(NS_LITERAL_STRING("graphic").get());
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_NOINTERFACE;
}

View File

@ -65,6 +65,10 @@
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nsIAccessible.h"
#include "nsINameSpaceManager.h"
#include "nsIAccessibilityService.h"
#include "nsIMutableAccessible.h"
#ifndef PR_ABS
#define PR_ABS(x) ((x) < 0 ? -(x) : (x))
@ -344,6 +348,9 @@ public:
nsTextFrame();
// nsIFrame
NS_IMETHOD QueryInterface(const nsIID& aIID,
void** aInstancePtrResult);
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
@ -731,6 +738,53 @@ protected:
};
//-----------------------------------------------------------------------------
NS_IMETHODIMP nsTextFrame::QueryInterface(const nsIID& aIID,
void** aInstancePtrResult)
{
NS_PRECONDITION(aInstancePtrResult, "null pointer");
if (!aInstancePtrResult)
return NS_ERROR_NULL_POINTER;
// create a new accessible only if we have a size.
if (aIID.Equals(NS_GET_IID(nsIAccessible)) && (mRect.width > 0 || mRect.height > 0)) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsIMutableAccessible* acc = nsnull;
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
accService->CreateMutableAccessible(mContent,&acc);
if (node)
acc->SetNameAsNodeValue();
else {
// see if it is text content
nsCOMPtr<nsITextContent> text = do_QueryInterface(mContent);
if (text) {
const nsTextFragment* frag = nsnull;
text->GetText(&frag);
if (frag->Is2b()) {
acc->SetName(frag->Get2b());
} else {
nsAutoString name;
name.AssignWithConversion(frag->Get1b());
acc->SetName(name.get());
}
}
}
acc->SetRole(NS_LITERAL_STRING("text").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtrResult = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
} else
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
}
class nsContinuingTextFrame : public nsTextFrame {
public:
NS_IMETHOD Init(nsIPresContext* aPresContext,

View File

@ -43,6 +43,8 @@
#include "nsIPtr.h"
#include "nsISizeOfHandler.h"
#include "nsIFrameManager.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessible.h"
#include "nsIDOMText.h"
#include "nsIDeviceContext.h"
@ -792,6 +794,22 @@ nsFrame::HandleEvent(nsIPresContext* aPresContext,
{
if (NS_SUCCEEDED(rv))
HandleRelease(aPresContext, aEvent, aEventStatus);
} break;
case NS_GETACCESSIBLE:
{
// get the accessible
// if(content) {
//nsCOMPtr<nsIDOMNode> node = do_QueryInterface(content);
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
// get an accessible for the dom node
nsISupports* f = (nsISupports*)(nsIFrame*)this;
nsIAccessible* acc;
accService->CreateRootAccessible(aPresContext,mParent ? f : nsnull,&acc);
((nsAccessibleEvent*)aEvent)->accessible = acc;
}
//}
}
break;
default:

View File

@ -63,6 +63,11 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
#include "nsIFrameManager.h"
#include "nsIScriptSecurityManager.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#ifdef DEBUG
@ -142,7 +147,21 @@ nsImageFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
} else if (aIID.Equals(NS_GET_IID(nsISupports))) {
*aInstancePtr = NS_STATIC_CAST(nsIImageFrame*,this);
return NS_OK;
}
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Image").get());
acc->SetRole(NS_LITERAL_STRING("graphic").get());
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return NS_NOINTERFACE;
}

View File

@ -4938,6 +4938,10 @@ PresShell::HandleEvent(nsIView *aView,
return NS_OK;
}
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT)
return HandleEventInternal(aEvent, aView, NS_EVENT_FLAG_INIT, aEventStatus);
aView->GetClientData(clientData);
frame = (nsIFrame *)clientData;
@ -5085,6 +5089,14 @@ PresShell::HandleEventWithTarget(nsEvent* aEvent, nsIFrame* aFrame, nsIContent*
nsresult
PresShell::HandleEventInternal(nsEvent* aEvent, nsIView *aView, PRUint32 aFlags, nsEventStatus* aStatus)
{
if (aEvent->eventStructType == NS_ACCESSIBLE_EVENT)
{
void* clientData;
aView->GetClientData(clientData);
nsIFrame* frame = (nsIFrame *)clientData;
return frame->HandleEvent(mPresContext, (nsGUIEvent*)aEvent, aStatus);
}
nsresult rv = NS_OK;
nsIEventStateManager *manager;

View File

@ -65,6 +65,10 @@
#include "nsIPref.h"
#include "nsIServiceManager.h"
#include "nsIAccessible.h"
#include "nsINameSpaceManager.h"
#include "nsIAccessibilityService.h"
#include "nsIMutableAccessible.h"
#ifndef PR_ABS
#define PR_ABS(x) ((x) < 0 ? -(x) : (x))
@ -344,6 +348,9 @@ public:
nsTextFrame();
// nsIFrame
NS_IMETHOD QueryInterface(const nsIID& aIID,
void** aInstancePtrResult);
NS_IMETHOD Paint(nsIPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
const nsRect& aDirtyRect,
@ -731,6 +738,53 @@ protected:
};
//-----------------------------------------------------------------------------
NS_IMETHODIMP nsTextFrame::QueryInterface(const nsIID& aIID,
void** aInstancePtrResult)
{
NS_PRECONDITION(aInstancePtrResult, "null pointer");
if (!aInstancePtrResult)
return NS_ERROR_NULL_POINTER;
// create a new accessible only if we have a size.
if (aIID.Equals(NS_GET_IID(nsIAccessible)) && (mRect.width > 0 || mRect.height > 0)) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsIMutableAccessible* acc = nsnull;
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
accService->CreateMutableAccessible(mContent,&acc);
if (node)
acc->SetNameAsNodeValue();
else {
// see if it is text content
nsCOMPtr<nsITextContent> text = do_QueryInterface(mContent);
if (text) {
const nsTextFragment* frag = nsnull;
text->GetText(&frag);
if (frag->Is2b()) {
acc->SetName(frag->Get2b());
} else {
nsAutoString name;
name.AssignWithConversion(frag->Get1b());
acc->SetName(name.get());
}
}
}
acc->SetRole(NS_LITERAL_STRING("text").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtrResult = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
} else
return nsFrame::QueryInterface(aIID, aInstancePtrResult);
}
class nsContinuingTextFrame : public nsTextFrame {
public:
NS_IMETHOD Init(nsIPresContext* aPresContext,

View File

@ -63,6 +63,11 @@
#include "nsListControlFrame.h"
#include "nsIElementFactory.h"
#include "nsContentCID.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
@ -301,7 +306,20 @@ nsComboboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
} else if (aIID.Equals(NS_GET_IID(nsIScrollableViewProvider))) {
*aInstancePtr = (void*)(nsIScrollableViewProvider*)this;
return NS_OK;
}
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIAccessible* acc = nsnull;
accService->CreateHTMLSelectAccessible(nsLayoutAtoms::popupList, node, mPresContext, &acc);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsAreaFrame::QueryInterface(aIID, aInstancePtr);
}
@ -524,7 +542,6 @@ nsComboboxControlFrame::ScrollIntoView(nsIPresContext* aPresContext)
void
nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
{
nsIView* view = nsnull;
mDropdownFrame->GetView(mPresContext, &view);
nsCOMPtr<nsIViewManager> viewManager;
@ -543,6 +560,23 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
viewManager->SetViewVisibility(view, nsViewVisibility_kHide);
viewManager->ResizeView(view, 0, 0);
}
// fire a popup dom event
nsEventStatus status = nsEventStatus_eIgnore;
nsMouseEvent event;
event.eventStructType = NS_EVENT;
event.message = aShowPopup ? NS_MENU_CREATE : NS_MENU_DESTROY;
event.isShift = PR_FALSE;
event.isControl = PR_FALSE;
event.isAlt = PR_FALSE;
event.isMeta = PR_FALSE;
event.clickCount = 0;
event.widget = nsnull;
nsCOMPtr<nsIPresShell> shell;
nsresult rv = mPresContext->GetShell(getter_AddRefs(shell));
if (NS_SUCCEEDED(rv) && shell)
rv = shell->HandleDOMEventWithTarget(mContent, &event, &status);
}
// Show the dropdown list

View File

@ -28,6 +28,11 @@
#include "nsISupportsArray.h"
#include "nsINameSpaceManager.h"
#include "nsContentCID.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
// Saving PresState
@ -468,7 +473,22 @@ nsGfxButtonControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = NS_STATIC_CAST(nsIAnonymousContentCreator*, this);
} else if (aIID.Equals(NS_GET_IID(nsIStatefulFrame))) {
*aInstancePtr = NS_STATIC_CAST(nsIStatefulFrame*, this);
} else {
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Push Button").get());
acc->SetRole(NS_LITERAL_STRING("push button").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
else {
return nsHTMLButtonControlFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -32,6 +32,11 @@
#include "nsINameSpaceManager.h"
#include "nsIPresState.h"
#include "nsCSSRendering.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
//------------------------------------------------------------
nsresult
@ -82,6 +87,23 @@ nsGfxCheckboxControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr
*aInstancePtr = (void*) ((nsICheckboxControlFrame*) this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Check Box").get());
acc->SetRole(NS_LITERAL_STRING("check box").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -32,6 +32,10 @@
#include "nsCSSRendering.h"
#include "nsIPresState.h"
#include "nsINameSpaceManager.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
nsresult
@ -77,7 +81,23 @@ nsGfxRadioControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = (void*) ((nsIStatefulFrame*) this);
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Radio Button").get());
acc->SetRole(NS_LITERAL_STRING("radio button").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -102,6 +102,10 @@
#include "nsIDOMNSHTMLTextAreaElement.h"
#include "nsIDOMNSHTMLInputElement.h"
#include "nsIDOMXULCommandDispatcher.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsINodeInfo.h"
@ -403,6 +407,22 @@ nsGfxTextControlFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = (void*)(nsIStatefulFrame*) this;
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Text Field").get());
acc->SetRole(NS_LITERAL_STRING("text").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsFormControlFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -92,6 +92,10 @@
#include "nsIScriptGlobalObject.h" //needed for notify selection changed to update the menus ect.
#include "nsIDOMWindowInternal.h" //needed for notify selection changed to update the menus ect.
#include "nsITextContent.h" //needed to create initial text control content
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsITransactionManager.h"
#include "nsITransactionListener.h"
@ -1077,7 +1081,6 @@ NS_IMETHODIMP nsTextInputSelectionImpl::GetFrameFromLevel(nsIPresContext *aPresC
}
#endif // IBMBIDI
// END nsTextInputSelectionImpl
@ -1127,6 +1130,22 @@ nsGfxTextControlFrame2::QueryInterface(const nsIID& aIID, void** aInstancePtr)
*aInstancePtr = (void*)(nsIScrollableViewProvider*) this;
return NS_OK;
}
if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Text Field").get());
acc->SetRole(NS_LITERAL_STRING("text").get());
acc->SetIsLeaf(PR_TRUE);
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
}
return nsBoxFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -10811,28 +10811,31 @@ keepLooking:
}
}
// We search the immediate children only, but if the child frame has
// the same content pointer as its parent then we need to search its
// child frames, too.
// We also need to search the child frame's children if the child frame
// is a "special" frame
// We also need to search if the child content is anonymous and scoped
// to the parent content.
nsCOMPtr<nsIContent> parentScope;
kidContent->GetBindingParent(getter_AddRefs(parentScope));
if (parentContent == kidContent || IsFrameSpecial(kidFrame) ||
(parentContent && (parentContent == parentScope)))
{
#ifdef NOISY_FINDFRAME
FFWC_recursions++;
printf(" recursing with new parent set to kidframe=%p, parentContent=%p\n",
kidFrame, parentContent.get());
#endif
nsIFrame* matchingFrame = FindFrameWithContent(aPresContext, kidFrame, parentContent,
aContent, nsnull);
// only do this if there is content
if (kidContent) {
// We search the immediate children only, but if the child frame has
// the same content pointer as its parent then we need to search its
// child frames, too.
// We also need to search the child frame's children if the child frame
// is a "special" frame
// We also need to search if the child content is anonymous and scoped
// to the parent content.
nsCOMPtr<nsIContent> parentScope;
kidContent->GetBindingParent(getter_AddRefs(parentScope));
if (parentContent == kidContent || IsFrameSpecial(kidFrame) ||
(parentContent && (parentContent == parentScope)))
{
#ifdef NOISY_FINDFRAME
FFWC_recursions++;
printf(" recursing with new parent set to kidframe=%p, parentContent=%p\n",
kidFrame, parentContent.get());
#endif
nsIFrame* matchingFrame = FindFrameWithContent(aPresContext, kidFrame, parentContent,
aContent, nsnull);
if (matchingFrame) {
return matchingFrame;
if (matchingFrame) {
return matchingFrame;
}
}
}
@ -12825,6 +12828,7 @@ nsCSSFrameConstructor::WipeContainingBlock(nsIPresContext* aPresContext,
return PR_FALSE;
}
/*
* Recursively split an inline frame until we reach a block frame.
* Below is an example of how SplitToContainingBlock() works.

View File

@ -46,6 +46,11 @@
#include "nsCOMPtr.h"
#include "nsIHTMLTableCellElement.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
//TABLECELL SELECTION
#include "nsIFrameSelection.h"
@ -417,6 +422,7 @@ PRBool nsTableCellFrame::ParentDisablesSelection() const //override default beha
// Align the cell's child frame within the cell
void nsTableCellFrame::VerticallyAlignChild(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nscoord aMaxAscent)
@ -1038,9 +1044,24 @@ nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(NS_GET_IID(nsITableCellLayout))) {
*aInstancePtr = (void*) (nsITableCellLayout *)this;
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
nsAutoString name;
acc->SetName(NS_LITERAL_STRING("Cell").get());
acc->SetRole(NS_LITERAL_STRING("cell").get());
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
} else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
@ -1127,7 +1148,6 @@ NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
/* ----- methods from CellLayoutData ----- */
void
nsTableCellFrame::GetCellBorder(nsMargin& aBorder,
nsTableFrame* aTableFrame)

View File

@ -36,6 +36,10 @@
#include "nsLayoutAtoms.h"
#include "nsHTMLParts.h"
#include "nsIPresShell.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsIPrintContext.h"
/* ----------- nsTableCaptionFrame ---------- */
@ -114,10 +118,24 @@ nsresult nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePt
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(NS_GET_IID(nsITableLayout)))
{ // note there is no addref here, frames are not addref'd
*aInstancePtr = (void*)(nsITableLayout*)this;
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Table").get());
acc->SetRole(NS_LITERAL_STRING("table").get());
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
} else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -46,6 +46,11 @@
#include "nsCOMPtr.h"
#include "nsIHTMLTableCellElement.h"
#include "nsIDOMHTMLTableCellElement.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
//TABLECELL SELECTION
#include "nsIFrameSelection.h"
@ -417,6 +422,7 @@ PRBool nsTableCellFrame::ParentDisablesSelection() const //override default beha
// Align the cell's child frame within the cell
void nsTableCellFrame::VerticallyAlignChild(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nscoord aMaxAscent)
@ -1038,9 +1044,24 @@ nsresult nsTableCellFrame::QueryInterface(const nsIID& aIID, void** aInstancePtr
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(NS_GET_IID(nsITableCellLayout))) {
*aInstancePtr = (void*) (nsITableCellLayout *)this;
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
nsAutoString name;
acc->SetName(NS_LITERAL_STRING("Cell").get());
acc->SetRole(NS_LITERAL_STRING("cell").get());
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
} else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}
@ -1127,7 +1148,6 @@ NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
/* ----- methods from CellLayoutData ----- */
void
nsTableCellFrame::GetCellBorder(nsMargin& aBorder,
nsTableFrame* aTableFrame)

View File

@ -36,6 +36,10 @@
#include "nsLayoutAtoms.h"
#include "nsHTMLParts.h"
#include "nsIPresShell.h"
#include "nsIMutableAccessible.h"
#include "nsIAccessibilityService.h"
#include "nsIServiceManager.h"
#include "nsIDOMNode.h"
#include "nsIPrintContext.h"
/* ----------- nsTableCaptionFrame ---------- */
@ -114,10 +118,24 @@ nsresult nsTableOuterFrame::QueryInterface(const nsIID& aIID, void** aInstancePt
if (NULL == aInstancePtr) {
return NS_ERROR_NULL_POINTER;
}
if (aIID.Equals(NS_GET_IID(nsITableLayout)))
{ // note there is no addref here, frames are not addref'd
*aInstancePtr = (void*)(nsITableLayout*)this;
return NS_OK;
} else if (aIID.Equals(NS_GET_IID(nsIAccessible))) {
nsresult rv = NS_OK;
NS_WITH_SERVICE(nsIAccessibilityService, accService, "@mozilla.org/accessibilityService;1", &rv);
if (accService) {
nsCOMPtr<nsIDOMNode> node = do_QueryInterface(mContent);
nsIMutableAccessible* acc = nsnull;
accService->CreateMutableAccessible(node,&acc);
acc->SetName(NS_LITERAL_STRING("Table").get());
acc->SetRole(NS_LITERAL_STRING("table").get());
*aInstancePtr = acc;
return NS_OK;
}
return NS_ERROR_FAILURE;
} else {
return nsHTMLContainerFrame::QueryInterface(aIID, aInstancePtr);
}

View File

@ -301,6 +301,7 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
nsEventStatus* aStatus, PRBool aForceHandle, PRBool& aHandled)
{
NS_ENSURE_ARG_POINTER(aStatus);
//printf(" %d %d %d %d (%d,%d) \n", this, event->widget, event->widgetSupports,
// event->message, event->point.x, event->point.y);
@ -311,6 +312,12 @@ NS_IMETHODIMP nsView :: HandleEvent(nsGUIEvent *event, PRUint32 aEventFlags,
if (NS_FAILED(mViewManager->GetViewObserver(obs)))
obs = nsnull;
// if accessible event pass directly to the view observer
if (event->eventStructType == NS_ACCESSIBLE_EVENT) {
if (obs)
obs->HandleEvent((nsIView *)this, event, aStatus, aForceHandle, aHandled);
}
*aStatus = nsEventStatus_eIgnore;
//see if any of this view's children can process the event

View File

@ -38,6 +38,7 @@ class nsIRenderingContext;
class nsIRegion;
class nsIWidget;
class nsIMenuItem;
class nsIAccessible;
/**
* Return status for event processors.
@ -193,6 +194,14 @@ struct nsMouseEvent : public nsInputEvent {
PRBool acceptActivation;
};
/**
* Accessible event
*/
struct nsAccessibleEvent : public nsInputEvent {
nsIAccessible* accessible;
};
/**
* Keyboard event
*/
@ -313,6 +322,7 @@ enum nsDragDropEventStatus {
#define NS_COMPOSITION_QUERY 17
#define NS_SCROLLPORT_EVENT 18
#define NS_RECONVERSION_QUERY 19
#define NS_ACCESSIBLE_EVENT 20
/**
* GUI MESSAGES
@ -455,6 +465,11 @@ enum nsDragDropEventStatus {
#define NS_SCROLLPORT_OVERFLOW (NS_SCROLLPORT_START+1)
#define NS_SCROLLPORT_OVERFLOWCHANGED (NS_SCROLLPORT_START+2)
// accessible events
#define NS_ACCESSIBLE_START 1800
#define NS_GETACCESSIBLE (NS_ACCESSIBLE_START)
#define NS_IS_MOUSE_EVENT(evnt) \
(((evnt)->message == NS_MOUSE_LEFT_BUTTON_DOWN) || \
((evnt)->message == NS_MOUSE_LEFT_BUTTON_UP) || \