Bug 195687 [ATK Accessibility] move nsIAccessibleEditableText support from nsHTMLTextFieldAccessible to nsAccessibleEditableText
r=bolian.yin Not in the default build git-svn-id: svn://10.0.0.236/trunk@140232 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
1ff094ba0d
commit
f8097b00a7
@ -564,7 +564,6 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
}
|
||||
#else
|
||||
AtkStateChange stateData;
|
||||
AtkTextChange textData;
|
||||
if (eventType.EqualsIgnoreCase("focus") || eventType.EqualsIgnoreCase("DOMMenuItemActive")) {
|
||||
if (treeItemAccessible) // use focused treeitem
|
||||
HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, treeItemAccessible, nsnull);
|
||||
@ -582,26 +581,11 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
||||
else
|
||||
FireAccessibleFocusEvent(accessible, targetNode);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("change")) {
|
||||
if (selectElement) // it's a HTML <select>
|
||||
HandleEvent(nsIAccessibleEventListener::EVENT_ATK_SELECTION_CHANGE, accessible, nsnull);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("select")) {
|
||||
if (selectControl) // it's a XUL <listbox>
|
||||
HandleEvent(nsIAccessibleEventListener::EVENT_ATK_SELECTION_CHANGE, accessible, nsnull);
|
||||
else if (treeBox && treeIndex >= 0) // it's a XUL <tree>
|
||||
if (treeBox && treeIndex >= 0) // it's a XUL <tree>
|
||||
// use EVENT_FOCUS instead of EVENT_ATK_SELECTION_CHANGE
|
||||
HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, treeItemAccessible, nsnull);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("input")) {
|
||||
// XXX kyle.yuan@sun.com future work, put correct values for text change data
|
||||
textData.start = 0;
|
||||
textData.length = 0;
|
||||
textData.add = PR_TRUE;
|
||||
nsAutoString accName;
|
||||
accessible->GetAccValue(accName);
|
||||
HandleEvent(nsIAccessibleEventListener::EVENT_ATK_TEXT_CHANGE, accessible, &textData);
|
||||
}
|
||||
else if (eventType.EqualsIgnoreCase("ListitemStateChange")) // it's a XUL <listbox>
|
||||
HandleEvent(nsIAccessibleEventListener::EVENT_FOCUS, accessible, nsnull);
|
||||
else if (eventType.EqualsIgnoreCase("CheckboxStateChange") || // it's a XUL <checkbox>
|
||||
@ -676,11 +660,7 @@ NS_IMETHODIMP nsRootAccessible::Change(nsIDOMEvent* aEvent)
|
||||
// this may be the event that we have the individual Accessible objects
|
||||
// handle themselves -- have list/combos figure out the change in selection
|
||||
// have textareas and inputs fire a change of state etc...
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
return HandleEvent(aEvent);
|
||||
#else
|
||||
return NS_OK; // Ignore form change events in MSAA
|
||||
#endif
|
||||
}
|
||||
|
||||
// gets Select events when text is selected in a textarea or input
|
||||
@ -692,11 +672,7 @@ NS_IMETHODIMP nsRootAccessible::Select(nsIDOMEvent* aEvent)
|
||||
// gets Input events when text is entered or deleted in a textarea or input
|
||||
NS_IMETHODIMP nsRootAccessible::Input(nsIDOMEvent* aEvent)
|
||||
{
|
||||
#ifndef MOZ_ACCESSIBILITY_ATK
|
||||
return NS_OK;
|
||||
#else
|
||||
return HandleEvent(aEvent);
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------- nsIDOMXULListener Methods (8) ---------------
|
||||
|
||||
@ -897,7 +897,7 @@ NS_IMETHODIMP nsAccessibleText::RemoveSelection(PRInt32 aSelectionNum)
|
||||
* nsAccessibleEditableText implements the nsIAccessibleText interface for editable text, such as HTML
|
||||
* <input>, <textarea> and XUL <editor>
|
||||
*/
|
||||
NS_IMPL_ISUPPORTS1(nsAccessibleEditableText, nsIAccessibleText)
|
||||
NS_IMPL_ISUPPORTS3(nsAccessibleEditableText, nsIAccessibleText, nsIAccessibleEditableText, nsIEditActionListener)
|
||||
|
||||
nsAccessibleEditableText::nsAccessibleEditableText()
|
||||
{
|
||||
@ -905,6 +905,8 @@ nsAccessibleEditableText::nsAccessibleEditableText()
|
||||
|
||||
nsAccessibleEditableText::~nsAccessibleEditableText()
|
||||
{
|
||||
if (mEditor)
|
||||
mEditor->RemoveEditActionListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -914,6 +916,8 @@ nsAccessibleEditableText::~nsAccessibleEditableText()
|
||||
void nsAccessibleEditableText::SetEditor(nsIEditor* aEditor)
|
||||
{
|
||||
mEditor = aEditor;
|
||||
if (mEditor)
|
||||
mEditor->AddEditActionListener(this);
|
||||
}
|
||||
|
||||
PRBool nsAccessibleEditableText::IsSingleLineTextControl(nsIDOMNode *aDomNode)
|
||||
@ -1070,6 +1074,201 @@ NS_IMETHODIMP nsAccessibleEditableText::GetTextAfterOffset(PRInt32 aOffset, nsAc
|
||||
return GetTextHelper(eGetAfter, aBoundaryType, aOffset, aStartOffset, aEndOffset, mEditor, aText);
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIAccessibleEditableText impl.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleEditableText::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos, nsISupports *aAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::SetTextContents(const nsAString &aText)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mTextNode));
|
||||
if (textArea)
|
||||
return textArea->SetValue(aText);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mTextNode));
|
||||
if (inputElement)
|
||||
return inputElement->SetValue(aText);
|
||||
|
||||
//XXX, editor doesn't support this method yet
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::InsertText(const nsAString &aText, PRInt32 aPosition)
|
||||
{
|
||||
if (NS_SUCCEEDED(SetSelectionRange(aPosition, aPosition))) {
|
||||
nsCOMPtr<nsIPlaintextEditor> peditor(do_QueryInterface(mEditor));
|
||||
return peditor->InsertText(aText);
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
if (NS_SUCCEEDED(SetSelectionRange(aStartPos, aEndPos)))
|
||||
return mEditor->Copy();
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
if (NS_SUCCEEDED(SetSelectionRange(aStartPos, aEndPos)))
|
||||
return mEditor->Cut();
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
if (NS_SUCCEEDED(SetSelectionRange(aStartPos, aEndPos)))
|
||||
return mEditor->DeleteSelection(nsIEditor::eNone);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::PasteText(PRInt32 aPosition)
|
||||
{
|
||||
if (NS_SUCCEEDED(SetSelectionRange(aPosition, aPosition)))
|
||||
return mEditor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/**
|
||||
* nsIEditActionListener impl.
|
||||
*/
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillCreateNode(const nsAString & aTag, nsIDOMNode *aParent, PRInt32 aPosition)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidCreateNode(const nsAString & aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aPosition, nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aPosition)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, PRInt32 aPosition, nsresult aResult)
|
||||
{
|
||||
AtkTextChange textData;
|
||||
|
||||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(aNode));
|
||||
if (textContent) {
|
||||
textData.add = PR_TRUE;
|
||||
textContent->GetTextLength((int *)&textData.length);
|
||||
DOMPointToOffset(mEditor, aNode, 0, &textData.start);
|
||||
FireTextChangeEvent(&textData);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillDeleteNode(nsIDOMNode *aChild)
|
||||
{
|
||||
AtkTextChange textData;
|
||||
|
||||
textData.add = PR_FALSE;
|
||||
nsCOMPtr<nsITextContent> textContent(do_QueryInterface(aChild));
|
||||
if (textContent) {
|
||||
textContent->GetTextLength((int *)&textData.length);
|
||||
}
|
||||
else {
|
||||
//XXX, don't fire event for the last br
|
||||
nsCOMPtr<nsIDOMHTMLBRElement> br(do_QueryInterface(aChild));
|
||||
if (br)
|
||||
textData.length = 1;
|
||||
else
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
DOMPointToOffset(mEditor, aChild, 0, &textData.start);
|
||||
return FireTextChangeEvent(&textData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidDeleteNode(nsIDOMNode *aChild, nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillSplitNode(nsIDOMNode *aExistingRightNode, PRInt32 aOffset)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidSplitNode(nsIDOMNode *aExistingRightNode, PRInt32 aOffset, nsIDOMNode *aNewLeftNode, nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent, nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillInsertText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, const nsAString & aString)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidInsertText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, const nsAString & aString, nsresult aResult)
|
||||
{
|
||||
AtkTextChange textData;
|
||||
|
||||
textData.add = PR_TRUE;
|
||||
textData.length = aString.Length();
|
||||
DOMPointToOffset(mEditor, aTextNode, aOffset, &textData.start);
|
||||
return FireTextChangeEvent(&textData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillDeleteText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, PRInt32 aLength)
|
||||
{
|
||||
AtkTextChange textData;
|
||||
|
||||
textData.add = PR_FALSE;
|
||||
textData.length = aLength;
|
||||
DOMPointToOffset(mEditor, aTextNode, aOffset, &textData.start);
|
||||
return FireTextChangeEvent(&textData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidDeleteText(nsIDOMCharacterData *aTextNode, PRInt32 aOffset, PRInt32 aLength, nsresult aResult)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::WillDeleteSelection(nsISelection *aSelection)
|
||||
// <input> & <textarea> fires this event while deleting text
|
||||
// <editor> fires WillDeleteText/WillDeleteNode instead
|
||||
{
|
||||
PRInt32 selectionStart, selectionEnd;
|
||||
nsresult rv = GetSelectionRange(&selectionStart, &selectionEnd);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AtkTextChange textData;
|
||||
|
||||
textData.add = PR_FALSE;
|
||||
textData.start = PR_MIN(selectionStart, selectionEnd);
|
||||
textData.length = PR_ABS(selectionEnd - selectionStart);
|
||||
return FireTextChangeEvent(&textData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessibleEditableText::DidDeleteSelection(nsISelection *aSelection)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif //MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
// ------------
|
||||
|
||||
@ -85,10 +85,14 @@ protected:
|
||||
friend class nsAccessibleHyperText;
|
||||
};
|
||||
|
||||
class nsAccessibleEditableText : public nsAccessibleText
|
||||
class nsAccessibleEditableText : public nsAccessibleText,
|
||||
public nsIAccessibleEditableText,
|
||||
public nsIEditActionListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIACCESSIBLEEDITABLETEXT
|
||||
NS_DECL_NSIEDITACTIONLISTENER
|
||||
|
||||
nsAccessibleEditableText();
|
||||
virtual ~nsAccessibleEditableText();
|
||||
|
||||
@ -40,9 +40,7 @@
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsHTMLAtoms.h"
|
||||
#include "nsHTMLFormControlAccessible.h"
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
@ -53,13 +51,7 @@
|
||||
#include "nsIDOMXULButtonElement.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMXULSelectCntrlEl.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
#include "nsISelectionController.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
// --- checkbox -----
|
||||
|
||||
@ -317,41 +309,28 @@ nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakR
|
||||
nsFormControlAccessible(aNode, aShell)
|
||||
{
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
// In nsHTMLTextFieldAccessible, mDOMNode is a nsHTMLInputElement. But we need
|
||||
// a *true* text node(nsTextNode) for the text operation. It's the first child
|
||||
// of our editor's root element
|
||||
SetTextNode(aNode);
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsITextControlFrame *tframe = nsnull;
|
||||
frame->QueryInterface(NS_GET_IID(nsITextControlFrame), (void**)&tframe);
|
||||
if (!tframe)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
tframe->GetEditor(getter_AddRefs(editor));
|
||||
if (!editor)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMElement> rootElement;
|
||||
editor->GetRootElement(getter_AddRefs(rootElement));
|
||||
nsCOMPtr<nsIDOMNode> rootNode(do_QueryInterface(rootElement));
|
||||
if (rootNode) {
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
rootNode->GetFirstChild(getter_AddRefs(domNode));
|
||||
SetTextNode(domNode);
|
||||
if (shell) {
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsITextControlFrame *textFrame;
|
||||
frame->QueryInterface(NS_GET_IID(nsITextControlFrame), (void**)&textFrame);
|
||||
if (textFrame) {
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
textFrame->GetEditor(getter_AddRefs(editor));
|
||||
SetEditor(editor);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif //MOZ_ACCESSIBILITY_ATK
|
||||
}
|
||||
|
||||
#ifndef MOZ_ACCESSIBILITY_ATK
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextFieldAccessible, nsFormControlAccessible)
|
||||
#else
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessible, nsFormControlAccessible, nsIAccessibleEditableText, nsAccessibleText)
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTextFieldAccessible, nsFormControlAccessible, nsIAccessibleEditableText, nsIAccessibleText)
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccRole(PRUint32 *_retval)
|
||||
@ -444,112 +423,6 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAccState(PRUint32 *_retval)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos, nsISupports *aAttributes)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::SetTextContents(const nsAString &aText)
|
||||
{
|
||||
nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mDOMNode));
|
||||
if (textArea)
|
||||
return textArea->SetValue(aText);
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mDOMNode));
|
||||
if (inputElement)
|
||||
return inputElement->SetValue(aText);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::MakeSelection(PRInt32 aStartPos, PRInt32 aEndPos, nsIEditor **aEditor)
|
||||
{
|
||||
nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mPresShell));
|
||||
if (!shell)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
AccTakeFocus();
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
|
||||
nsIFrame *frame = nsnull;
|
||||
shell->GetPrimaryFrameFor(content, &frame);
|
||||
nsITextControlFrame *tframe = nsnull;
|
||||
frame->QueryInterface(NS_GET_IID(nsITextControlFrame), (void**)&tframe);
|
||||
if (!tframe)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
tframe->SetSelectionRange(aStartPos, aEndPos);
|
||||
tframe->GetEditor(getter_AddRefs(editor));
|
||||
if (!editor)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aEditor = editor;
|
||||
NS_ADDREF(*aEditor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::InsertText(const nsAString &aText, PRInt32 aPosition)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aPosition, aPosition, getter_AddRefs(editor)))) {
|
||||
nsCOMPtr<nsIPlaintextEditor> peditor(do_QueryInterface(editor));
|
||||
peditor->InsertText(aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
|
||||
editor->Copy();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
|
||||
editor->Cut();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aStartPos, aEndPos, getter_AddRefs(editor)))) {
|
||||
editor->DeleteSelection(nsIEditor::eNone);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLTextFieldAccessible::PasteText(PRInt32 aPosition)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
if (NS_SUCCEEDED(MakeSelection(aPosition, aPosition, getter_AddRefs(editor)))) {
|
||||
editor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#endif //MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
// --- groupbox -----
|
||||
|
||||
/*
|
||||
|
||||
@ -42,7 +42,6 @@
|
||||
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
#include "nsFormControlAccessible.h"
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
#include "nsTextAccessible.h"
|
||||
|
||||
class nsICheckboxControlFrame;
|
||||
@ -94,31 +93,21 @@ public:
|
||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||
};
|
||||
|
||||
class nsIEditor;
|
||||
|
||||
#ifndef MOZ_ACCESSIBILITY_ATK
|
||||
class nsHTMLTextFieldAccessible : public nsFormControlAccessible
|
||||
#else
|
||||
class nsHTMLTextFieldAccessible : public nsFormControlAccessible,
|
||||
public nsIAccessibleEditableText,
|
||||
public nsAccessibleText
|
||||
public nsAccessibleEditableText
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
NS_DECL_NSIACCESSIBLEEDITABLETEXT
|
||||
#endif
|
||||
|
||||
nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
||||
NS_IMETHOD GetAccRole(PRUint32 *_retval);
|
||||
NS_IMETHOD GetAccValue(nsAString& _retval);
|
||||
NS_IMETHOD GetAccState(PRUint32 *_retval);
|
||||
|
||||
protected:
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
NS_IMETHOD MakeSelection(PRInt32 aStartPos, PRInt32 aEndPos, nsIEditor **aEditor);
|
||||
#endif
|
||||
};
|
||||
|
||||
class nsHTMLGroupboxAccessible : public nsAccessible
|
||||
|
||||
@ -52,7 +52,7 @@ nsBlockAccessible(aDomNode, aShell)
|
||||
|
||||
#else
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible, nsBlockAccessible, nsIAccessibleText)
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableCellAccessible, nsBlockAccessible, nsIAccessibleHyperText, nsIAccessibleText)
|
||||
|
||||
nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsBlockAccessible(aDomNode, aShell), nsAccessibleHyperText(aDomNode, aShell)
|
||||
|
||||
@ -75,7 +75,7 @@ NS_IMETHODIMP nsHTMLHRAccessible::GetAccState(PRUint32 *aState)
|
||||
|
||||
#ifdef MOZ_ACCESSIBILITY_ATK
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLBlockAccessible, nsBlockAccessible, nsIAccessibleText)
|
||||
NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLBlockAccessible, nsBlockAccessible, nsIAccessibleHyperText, nsIAccessibleText)
|
||||
|
||||
nsHTMLBlockAccessible::nsHTMLBlockAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
|
||||
nsBlockAccessible(aDomNode, aShell), nsAccessibleHyperText(aDomNode, aShell)
|
||||
@ -84,7 +84,10 @@ nsBlockAccessible(aDomNode, aShell), nsAccessibleHyperText(aDomNode, aShell)
|
||||
|
||||
NS_IMETHODIMP nsHTMLBlockAccessible::GetAccName(nsAString& aName)
|
||||
{
|
||||
return nsAccessible::GetAccName(aName);
|
||||
nsAutoString name(NS_LITERAL_STRING("Paragraph "));
|
||||
name.AppendInt(GetIndex());
|
||||
aName = name;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLBlockAccessible::GetAccRole(PRUint32 *aRole)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user