--HG--
rename : accessible/src/html/nsHyperTextAccessible.cpp => accessible/src/generic/HyperTextAccessible.cpp
rename : accessible/src/html/nsHyperTextAccessible.h => accessible/src/generic/HyperTextAccessible.h
rename : accessible/src/html/nsHTMLImageAccessible.cpp => accessible/src/generic/ImageAccessible.cpp
rename : accessible/src/html/nsHTMLImageAccessible.h => accessible/src/generic/ImageAccessible.h
rename : accessible/src/msaa/nsHyperTextAccessibleWrap.cpp => accessible/src/msaa/HyperTextAccessibleWrap.cpp
rename : accessible/src/msaa/nsHyperTextAccessibleWrap.h => accessible/src/msaa/HyperTextAccessibleWrap.h
This commit is contained in:
Sean Stangl 2012-06-04 13:30:29 -07:00
Родитель 843382b966 7fa7186c92
Коммит 4b4e7df6c1
1421 изменённых файлов: 66867 добавлений и 52382 удалений

2
.gitignore поставляемый
Просмотреть файл

@ -46,3 +46,5 @@ parser/html/java/javaparser/
.cproject
.settings/
# Python stuff installed at build-time
*.egg-info/

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

@ -45,3 +45,6 @@ _OPT\.OBJ/
\.project$
\.cproject$
\.settings/
# Python stuff installed at build-time
\.egg-info/

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

@ -80,3 +80,4 @@ bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
bbc7014db2de49e2301680d2a86be8a53108a88a AURORA_BASE_20120131
b6627f28b7ec17e1b46a594df0f780d3a40847e4 FIREFOX_AURORA_13_BASE
357da346ceb705d196a46574804c7c4ec44ac186 FIREFOX_AURORA_14_BASE
26dcd1b1a20893ad99341c61c6b1239ff1523858 FIREFOX_AURORA_15_BASE

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

@ -376,7 +376,7 @@ AccessibleWrap::CreateMaiInterfaces(void)
interfacesBits |= 1 << MAI_INTERFACE_ACTION;
// Text, Editabletext, and Hypertext interface.
nsHyperTextAccessible* hyperText = AsHyperText();
HyperTextAccessible* hyperText = AsHyperText();
if (hyperText && hyperText->IsTextRole()) {
interfacesBits |= 1 << MAI_INTERFACE_TEXT;
interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;

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

@ -4,12 +4,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHTMLIMAGEACCESSIBLEWRAP_H
#define _NSHTMLIMAGEACCESSIBLEWRAP_H
#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
#define mozilla_a11y_HyperTextAccessibleWrap_h__
#include "nsHTMLImageAccessible.h"
#include "HyperTextAccessible.h"
typedef class nsHTMLImageAccessible nsHTMLImageAccessibleWrap;
typedef class HyperTextAccessible HyperTextAccessibleWrap;
#endif

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

@ -4,12 +4,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHYPERTEXTACCESSIBLEWRAP_H
#define _NSHYPERTEXTACCESSIBLEWRAP_H
#ifndef mozilla_a11y_ImageAccessibleWrap_h__
#define mozilla_a11y_ImageAccessibleWrap_h__
#include "nsHyperTextAccessible.h"
#include "ImageAccessible.h"
typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
namespace mozilla {
namespace a11y {
typedef class ImageAccessible ImageAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif

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

@ -6,7 +6,7 @@
#include "InterfaceInitFuncs.h"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "nsMai.h"
#include "nsString.h"

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

@ -6,7 +6,7 @@
#include "InterfaceInitFuncs.h"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "nsMai.h"
#include "nsMaiHyperlink.h"
@ -19,7 +19,7 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
if (!accWrap)
return nsnull;
nsHyperTextAccessible* hyperText = accWrap->AsHyperText();
HyperTextAccessible* hyperText = accWrap->AsHyperText();
NS_ENSURE_TRUE(hyperText, nsnull);
Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
@ -42,7 +42,7 @@ getLinkCountCB(AtkHypertext *aText)
if (!accWrap)
return -1;
nsHyperTextAccessible* hyperText = accWrap->AsHyperText();
HyperTextAccessible* hyperText = accWrap->AsHyperText();
NS_ENSURE_TRUE(hyperText, -1);
return hyperText->GetLinkCount();
@ -55,7 +55,7 @@ getLinkIndexCB(AtkHypertext *aText, gint aCharIndex)
if (!accWrap)
return -1;
nsHyperTextAccessible* hyperText = accWrap->AsHyperText();
HyperTextAccessible* hyperText = accWrap->AsHyperText();
NS_ENSURE_TRUE(hyperText, -1);
PRInt32 index = -1;

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

@ -7,9 +7,12 @@
#include "InterfaceInitFuncs.h"
#include "AccessibleWrap.h"
#include "nsHTMLImageAccessible.h"
#include "ImageAccessible.h"
#include "nsMai.h"
using namespace mozilla;
using namespace mozilla::a11y;
extern "C" {
const gchar* getDescriptionCB(AtkObject* aAtkObj);
@ -21,7 +24,7 @@ getImagePositionCB(AtkImage* aImage, gint* aAccX, gint* aAccY,
if (!accWrap || !accWrap->IsImage())
return;
nsHTMLImageAccessible* image = accWrap->AsImage();
ImageAccessible* image = accWrap->AsImage();
PRUint32 geckoCoordType = (aCoordType == ATK_XY_WINDOW) ?
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;

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

@ -6,7 +6,7 @@
#include "InterfaceInitFuncs.h"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "nsMai.h"
#include "nsIPersistentProperties2.h"
@ -314,7 +314,7 @@ getCharacterCountCB(AtkText *aText)
if (!accWrap)
return 0;
nsHyperTextAccessible* textAcc = accWrap->AsHyperText();
HyperTextAccessible* textAcc = accWrap->AsHyperText();
return textAcc->IsDefunct() ?
0 : static_cast<gint>(textAcc->CharacterCount());
}

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

@ -5,6 +5,7 @@
#include "FocusManager.h"
#include "Accessible-inl.h"
#include "DocAccessible-inl.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "Role.h"

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

@ -7,13 +7,15 @@
#include "Logging.h"
#include "AccEvent.h"
#include "DocAccessible.h"
#include "nsAccessibilityService.h"
#include "nsCoreUtils.h"
#include "DocAccessible.h"
#include "OuterDocAccessible.h"
#include "nsDocShellLoadTypes.h"
#include "nsIChannel.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsISelectionPrivate.h"
#include "nsTraceRefcntImpl.h"
#include "nsIWebProgress.h"
#include "prenv.h"
@ -43,7 +45,17 @@ EnableLogging(const char* aModulesStr)
{ "doccreate", logging::eDocCreate },
{ "docdestroy", logging::eDocDestroy },
{ "doclifecycle", logging::eDocLifeCycle },
{ "platforms", logging::ePlatforms }
{ "events", logging::eEvents },
{ "platforms", logging::ePlatforms },
{ "stack", logging::eStack },
{ "text", logging::eText },
{ "tree", logging::eTree },
{ "DOMEvents", logging::eDOMEvents },
{ "focus", logging::eFocus },
{ "selection", logging::eSelection },
{ "notifications", logging::eNotifications }
};
const char* token = aModulesStr;
@ -182,8 +194,6 @@ LogDocParent(nsIDocument* aDocumentNode)
static void
LogDocInfo(nsIDocument* aDocumentNode, DocAccessible* aDocument)
{
printf(" {\n");
printf(" DOM id: %p, acc id: %p\n ",
static_cast<void*>(aDocumentNode), static_cast<void*>(aDocument));
@ -206,8 +216,6 @@ LogDocInfo(nsIDocument* aDocumentNode, DocAccessible* aDocument)
LogDocParent(aDocumentNode);
printf("\n");
}
printf(" }\n");
}
static void
@ -334,21 +342,30 @@ GetDocLoadEventType(AccEvent* aEvent, nsACString& aEventType)
////////////////////////////////////////////////////////////////////////////////
// namespace logging:: document life cycle logging methods
static const char* sDocLoadTitle = "DOCLOAD";
static const char* sDocCreateTitle = "DOCCREATE";
static const char* sDocDestroyTitle = "DOCDESTROY";
static const char* sDocEventTitle = "DOCEVENT";
void
logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
nsIRequest* aRequest, PRUint32 aStateFlags)
{
printf("\nA11Y DOCLOAD: %s\n", aMsg);
MsgBegin(sDocLoadTitle, aMsg);
nsCOMPtr<nsIDOMWindow> DOMWindow;
aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow));
if (!DOMWindow)
if (!DOMWindow) {
MsgEnd();
return;
}
nsCOMPtr<nsIDOMDocument> DOMDocument;
DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
if (!DOMDocument)
if (!DOMDocument) {
MsgEnd();
return;
}
nsCOMPtr<nsIDocument> documentNode(do_QueryInterface(DOMDocument));
DocAccessible* document =
@ -356,10 +373,9 @@ logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
LogDocInfo(documentNode, document);
printf(" {\n");
nsCOMPtr<nsIWebNavigation> webNav(do_GetInterface(DOMWindow));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(webNav));
printf(" ");
printf("\n ");
LogShellLoadType(docShell);
printf("\n");
LogRequest(aRequest);
@ -368,17 +384,20 @@ logging::DocLoad(const char* aMsg, nsIWebProgress* aWebProgress,
bool isDocLoading;
aWebProgress->GetIsLoadingDocument(&isDocLoading);
printf(", document is %sloading\n", (isDocLoading ? "" : "not "));
printf(" }\n");
MsgEnd();
}
void
logging::DocLoad(const char* aMsg, nsIDocument* aDocumentNode)
{
printf("\nA11Y DOCLOAD: %s\n", aMsg);
MsgBegin(sDocLoadTitle, aMsg);
DocAccessible* document =
GetAccService()->GetDocAccessibleFromCache(aDocumentNode);
LogDocInfo(aDocumentNode, document);
MsgEnd();
}
void
@ -395,18 +414,19 @@ logging::DocLoadEventHandled(AccEvent* aEvent)
{
nsCAutoString strEventType;
GetDocLoadEventType(aEvent, strEventType);
if (!strEventType.IsEmpty()) {
printf("\nA11Y DOCEVENT: handled '%s' event ", strEventType.get());
if (strEventType.IsEmpty())
return;
nsINode* node = aEvent->GetNode();
if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
nsIDocument* documentNode = static_cast<nsIDocument*>(node);
DocAccessible* document = aEvent->GetDocAccessible();
LogDocInfo(documentNode, document);
}
MsgBegin(sDocEventTitle, "handled '%s' event", strEventType.get());
printf("\n");
nsINode* node = aEvent->GetNode();
if (node->IsNodeOfType(nsINode::eDOCUMENT)) {
nsIDocument* documentNode = static_cast<nsIDocument*>(node);
DocAccessible* document = aEvent->GetDocAccessible();
LogDocInfo(documentNode, document);
}
MsgEnd();
}
void
@ -416,8 +436,9 @@ logging::DocCreate(const char* aMsg, nsIDocument* aDocumentNode,
DocAccessible* document = aDocument ?
aDocument : GetAccService()->GetDocAccessibleFromCache(aDocumentNode);
printf("\nA11Y DOCCREATE: %s\n", aMsg);
MsgBegin(sDocCreateTitle, aMsg);
LogDocInfo(aDocumentNode, document);
MsgEnd();
}
void
@ -427,42 +448,147 @@ logging::DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
DocAccessible* document = aDocument ?
aDocument : GetAccService()->GetDocAccessibleFromCache(aDocumentNode);
printf("\nA11Y DOCDESTROY: %s\n", aMsg);
MsgBegin(sDocDestroyTitle, aMsg);
LogDocInfo(aDocumentNode, document);
MsgEnd();
}
void
logging::Address(const char* aDescr, Accessible* aAcc)
logging::OuterDocDestroy(OuterDocAccessible* aOuterDoc)
{
nsINode* node = aAcc->GetNode();
nsIDocument* docNode = aAcc->GetDocumentNode();
DocAccessible* doc = GetAccService()->GetDocAccessibleFromCache(docNode);
printf(" %s accessible: %p, node: %p\n", aDescr,
static_cast<void*>(aAcc), static_cast<void*>(node));
printf(" docacc for %s accessible: %p, node: %p\n", aDescr,
static_cast<void*>(doc), static_cast<void*>(docNode));
printf(" ");
LogDocURI(docNode);
MsgBegin(sDocDestroyTitle, "outerdoc shutdown");
logging::Address("outerdoc", aOuterDoc);
MsgEnd();
}
void
logging::SelChange(nsISelection* aSelection, DocAccessible* aDocument)
{
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
PRInt16 type = 0;
privSel->GetType(&type);
const char* strType = 0;
if (type == nsISelectionController::SELECTION_NORMAL)
strType = "normal";
else if (type == nsISelectionController::SELECTION_SPELLCHECK)
strType = "spellcheck";
else
strType = "unknown";
bool isIgnored = !aDocument || !aDocument->IsContentLoaded();
printf("\nSelection changed, selection type: %s, notification %s\n",
strType, (isIgnored ? "ignored" : "pending"));
}
void
logging::MsgBegin(const char* aTitle, const char* aMsgText, ...)
{
printf("\nA11Y %s: ", aTitle);
va_list argptr;
va_start(argptr, aMsgText);
vprintf(aMsgText, argptr);
va_end(argptr);
printf("\n {\n");
}
void
logging::MsgEnd()
{
printf(" }\n");
}
void
logging::MsgEntry(const char* aEntryText, ...)
{
printf(" ");
va_list argptr;
va_start(argptr, aEntryText);
vprintf(aEntryText, argptr);
va_end(argptr);
printf("\n");
}
void
logging::Msg(const char* aMsg)
{
printf("\n%s\n", aMsg);
}
void
logging::Text(const char* aText)
{
printf(" %s\n", aText);
}
void
logging::Address(const char* aDescr, Accessible* aAcc)
{
if (!aAcc->IsDoc()) {
printf(" %s accessible: %p, node: %p\n", aDescr,
static_cast<void*>(aAcc), static_cast<void*>(aAcc->GetNode()));
}
DocAccessible* doc = aAcc->Document();
nsIDocument* docNode = aAcc->GetDocumentNode();
printf(" document: %p, node: %p\n",
static_cast<void*>(doc), static_cast<void*>(docNode));
printf(" ");
LogDocURI(docNode);
printf("\n");
}
void
logging::Node(const char* aDescr, nsINode* aNode)
{
printf(" ");
if (!aNode) {
printf("%s: null\n", aDescr);
return;
}
if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) {
printf("%s: %p, document\n", aDescr, static_cast<void*>(aNode));
return;
}
nsINode* parentNode = aNode->GetNodeParent();
PRInt32 idxInParent = parentNode ? parentNode->IndexOf(aNode) : - 1;
if (aNode->IsNodeOfType(nsINode::eTEXT)) {
printf("%s: %p, text node, idx in parent: %d\n",
aDescr, static_cast<void*>(aNode), idxInParent);
return;
}
if (!aNode->IsElement()) {
printf("%s: %p, not accessible node type, idx in parent: %d\n",
aDescr, static_cast<void*>(aNode), idxInParent);
return;
}
dom::Element* elm = aNode->AsElement();
nsCAutoString tag;
elm->Tag()->ToUTF8String(tag);
nsIAtom* idAtom = elm->GetID();
nsCAutoString id;
if (idAtom)
idAtom->ToUTF8String(id);
printf("%s: %p, %s@id='%s', idx in parent: %d\n",
aDescr, static_cast<void*>(elm), tag.get(), id.get(), idxInParent);
}
void
logging::Stack()
{
printf(" stack: \n");
nsTraceRefcntImpl::WalkTheStack(stdout);
if (IsEnabled(eStack)) {
printf(" stack: \n");
nsTraceRefcntImpl::WalkTheStack(stdout);
}
}
////////////////////////////////////////////////////////////////////////////////

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

@ -13,12 +13,18 @@
class AccEvent;
class Accessible;
class DocAccessible;
class nsIDocument;
class nsINode;
class nsIRequest;
class nsISelection;
class nsIWebProgress;
namespace mozilla {
namespace a11y {
class OuterDocAccessible;
namespace logging {
enum EModules {
@ -26,13 +32,23 @@ enum EModules {
eDocCreate = 1 << 1,
eDocDestroy = 1 << 2,
eDocLifeCycle = eDocLoad | eDocCreate | eDocDestroy,
ePlatforms = 1 << 3
eEvents = 1 << 3,
ePlatforms = 1 << 4,
eStack = 1 << 5,
eText = 1 << 6,
eTree = 1 << 7,
eDOMEvents = 1 << 8,
eFocus = 1 << 9,
eSelection = 1 << 10,
eNotifications = eDOMEvents | eSelection | eFocus
};
/**
* Return true if the given module is logged.
* Return true if any of the given modules is logged.
*/
bool IsEnabled(PRUint32 aModule);
bool IsEnabled(PRUint32 aModules);
/**
* Log the document loading progress.
@ -64,9 +80,27 @@ void DocDestroy(const char* aMsg, nsIDocument* aDocumentNode,
DocAccessible* aDocument = nsnull);
/**
* Log the message, a piece of text on own line, no offset.
* Log the outer document was destroyed.
*/
void Msg(const char* aMsg);
void OuterDocDestroy(OuterDocAccessible* OuterDoc);
/**
* Log the selection change.
*/
void SelChange(nsISelection* aSelection, DocAccessible* aDocument);
/**
* Log the message ('title: text' format) on new line. Print the start and end
* boundaries of the message body designated by '{' and '}' (2 spaces indent for
* body).
*/
void MsgBegin(const char* aTitle, const char* aMsgText, ...);
void MsgEnd();
/**
* Log the entry into message body (4 spaces indent).
*/
void MsgEntry(const char* aEntryText, ...);
/**
* Log the text, two spaces offset is used.
@ -74,10 +108,15 @@ void Msg(const char* aMsg);
void Text(const char* aText);
/**
* Log the accesisble object address, two spaces offset is used.
* Log the accessible object address as message entry (4 spaces indent).
*/
void Address(const char* aDescr, Accessible* aAcc);
/**
* Log the DOM node info as message entry.
*/
void Node(const char* aDescr, nsINode* aNode);
/**
* Log the call stack, two spaces offset is used.
*/

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

@ -16,6 +16,10 @@
#include "TextLeafAccessible.h"
#include "TextUpdater.h"
#ifdef DEBUG
#include "Logging.h"
#endif
#include "mozilla/dom/Element.h"
using namespace mozilla::a11y;
@ -190,9 +194,12 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
return;
}
#ifdef DEBUG_NOTIFICATIONS
printf("\ninitial tree created, document: %p, document node: %p\n",
mDocument.get(), mDocument->GetDocumentNode());
#ifdef DEBUG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "initial tree created");
logging::Address("document", mDocument);
logging::MsgEnd();
}
#endif
mDocument->DoInitialUpdate();
@ -292,6 +299,14 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
events.SwapElements(mEvents);
PRUint32 eventCount = events.Length();
#ifdef DEBUG
if (eventCount > 0 && logging::IsEnabled(logging::eEvents)) {
logging::MsgBegin("EVENTS", "events processing");
logging::Address("document", mDocument);
logging::MsgEnd();
}
#endif
for (PRUint32 idx = 0; idx < eventCount; idx++) {
AccEvent* accEvent = events[idx];
if (accEvent->mEventRule != AccEvent::eDoNotEmit) {
@ -646,7 +661,7 @@ NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent)
if (!container)
return;
nsHyperTextAccessible* textAccessible = container->AsHyperText();
HyperTextAccessible* textAccessible = container->AsHyperText();
if (!textAccessible)
return;
@ -709,20 +724,13 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey<nsIContent>* aEntry,
// Remove text accessible if rendered text is empty.
if (textAcc) {
if (text.IsEmpty()) {
#ifdef DEBUG_NOTIFICATIONS
PRUint32 index = containerNode->IndexOf(textNode);
nsCAutoString tag;
nsCAutoString id;
if (containerElm) {
containerElm->Tag()->ToUTF8String(tag);
nsIAtom* atomid = containerElm->GetID();
if (atomid)
atomid->ToUTF8String(id);
#ifdef DEBUG
if (logging::IsEnabled(logging::eTree | logging::eText)) {
logging::MsgBegin("TREE", "text node lost its content");
logging::Node("container", containerElm);
logging::Node("content", textNode);
logging::MsgEnd();
}
printf("\npending text node removal: container: %s@id='%s', index in container: %d\n\n",
tag.get(), id.get(), index);
#endif
document->ContentRemoved(containerElm, textNode);
@ -730,22 +738,17 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey<nsIContent>* aEntry,
}
// Update text of the accessible and fire text change events.
#ifdef DEBUG_TEXTCHANGE
PRUint32 index = containerNode->IndexOf(textNode);
nsCAutoString tag;
nsCAutoString id;
if (containerElm) {
containerElm->Tag()->ToUTF8String(tag);
nsIAtom* atomid = containerElm->GetID();
if (atomid)
atomid->ToUTF8String(id);
}
printf("\ntext may be changed: container: %s@id='%s', index in container: %d, old text '%s', new text: '%s'\n\n",
tag.get(), id.get(), index,
NS_ConvertUTF16toUTF8(textAcc->AsTextLeaf()->Text()).get(),
NS_ConvertUTF16toUTF8(text).get());
#ifdef DEBUG
if (logging::IsEnabled(logging::eText)) {
logging::MsgBegin("TEXT", "text may be changed");
logging::Node("container", containerElm);
logging::Node("content", textNode);
logging::MsgEntry("old text '%s'",
NS_ConvertUTF16toUTF8(textAcc->AsTextLeaf()->Text()).get());
logging::MsgEntry("new text: '%s'",
NS_ConvertUTF16toUTF8(text).get());
logging::MsgEnd();
}
#endif
TextUpdater::Run(document, textAcc->AsTextLeaf(), text);
@ -754,20 +757,13 @@ NotificationController::TextEnumerator(nsCOMPtrHashKey<nsIContent>* aEntry,
// Append an accessible if rendered text is not empty.
if (!text.IsEmpty()) {
#ifdef DEBUG_NOTIFICATIONS
PRUint32 index = containerNode->IndexOf(textNode);
nsCAutoString tag;
nsCAutoString id;
if (containerElm) {
containerElm->Tag()->ToUTF8String(tag);
nsIAtom* atomid = containerElm->GetID();
if (atomid)
atomid->ToUTF8String(id);
}
printf("\npending text node insertion: container: %s@id='%s', index in container: %d\n\n",
tag.get(), id.get(), index);
#ifdef DEBUG
if (logging::IsEnabled(logging::eTree | logging::eText)) {
logging::MsgBegin("TREE", "text node gains new content");
logging::Node("container", containerElm);
logging::Node("content", textNode);
logging::MsgEnd();
}
#endif
// Make sure the text node is in accessible document still.
@ -835,31 +831,6 @@ NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(NotificationController::ContentInsertion,
void
NotificationController::ContentInsertion::Process()
{
#ifdef DEBUG_NOTIFICATIONS
nsIContent* firstChildNode = mInsertedContent[0];
nsCAutoString tag;
firstChildNode->Tag()->ToUTF8String(tag);
nsIAtom* atomid = firstChildNode->GetID();
nsCAutoString id;
if (atomid)
atomid->ToUTF8String(id);
nsCAutoString ctag;
nsCAutoString cid;
nsIAtom* catomid = nsnull;
if (mContainer->IsContent()) {
mContainer->GetContent()->Tag()->ToUTF8String(ctag);
catomid = mContainer->GetContent()->GetID();
if (catomid)
catomid->ToUTF8String(cid);
}
printf("\npending content insertion: %s@id='%s', container: %s@id='%s', inserted content amount: %d\n\n",
tag.get(), id.get(), ctag.get(), cid.get(), mInsertedContent.Length());
#endif
mDocument->ProcessContentInserted(mContainer, &mInsertedContent);
mDocument = nsnull;

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

@ -10,18 +10,14 @@
#include "nsCycleCollectionParticipant.h"
#include "nsRefreshDriver.h"
#ifdef DEBUG
#include "Logging.h"
#endif
class Accessible;
class DocAccessible;
class nsIContent;
// Uncomment to log notifications processing.
//#define DEBUG_NOTIFICATIONS
#ifdef DEBUG_NOTIFICATIONS
#define DEBUG_CONTENTMUTATION
#define DEBUG_TEXTCHANGE
#endif
/**
* Notification interface.
*/
@ -140,8 +136,9 @@ public:
Arg* aArg)
{
if (!IsUpdatePending()) {
#ifdef DEBUG_NOTIFICATIONS
printf("\nsync notification processing\n");
#ifdef DEBUG
if (mozilla::a11y::logging::IsEnabled(mozilla::a11y::logging::eNotifications))
mozilla::a11y::logging::Text("sync notification processing");
#endif
(aInstance->*aMethod)(aArg);
return;

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

@ -5,9 +5,9 @@
#include "TextAttrs.h"
#include "HyperTextAccessibleWrap.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsHyperTextAccessibleWrap.h"
#include "StyleInfo.h"
#include "gfxFont.h"
@ -199,7 +199,7 @@ TextAttrsMgr::GetRange(TextAttr* aAttrArray[], PRUint32 aAttrArrayLen,
////////////////////////////////////////////////////////////////////////////////
TextAttrsMgr::LangTextAttr::
LangTextAttr(nsHyperTextAccessible* aRoot,
LangTextAttr(HyperTextAccessible* aRoot,
nsIContent* aRootElm, nsIContent* aElm) :
TTextAttr<nsString>(!aElm), mRootContent(aRootElm)
{

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

@ -11,17 +11,17 @@
#include "nsIPersistentProperties2.h"
#include "nsStyleConsts.h"
class nsHyperTextAccessible;
class HyperTextAccessible;
namespace mozilla {
namespace a11y {
/**
* Used to expose text attributes for the hyper text accessible (see
* nsHyperTextAccessible class).
* HyperTextAccessible class).
*
* @note "invalid: spelling" text attribute is implemented entirely in
* nsHyperTextAccessible class.
* HyperTextAccessible class.
*/
class TextAttrsMgr
{
@ -29,7 +29,7 @@ public:
/**
* Constructor. Used to expose default text attributes.
*/
TextAttrsMgr(nsHyperTextAccessible* aHyperTextAcc) :
TextAttrsMgr(HyperTextAccessible* aHyperTextAcc) :
mOffsetAcc(nsnull), mHyperTextAcc(aHyperTextAcc),
mOffsetAccIdx(-1), mIncludeDefAttrs(true) { }
@ -45,7 +45,7 @@ public:
* should be calculated for
* @param oOffsetAccIdx [optional] index in parent of offset accessible
*/
TextAttrsMgr(nsHyperTextAccessible* aHyperTextAcc,
TextAttrsMgr(HyperTextAccessible* aHyperTextAcc,
bool aIncludeDefAttrs,
Accessible* aOffsetAcc,
PRInt32 aOffsetAccIdx) :
@ -84,7 +84,7 @@ protected:
private:
Accessible* mOffsetAcc;
nsHyperTextAccessible* mHyperTextAcc;
HyperTextAccessible* mHyperTextAcc;
PRInt32 mOffsetAccIdx;
bool mIncludeDefAttrs;
@ -191,7 +191,7 @@ protected:
class LangTextAttr : public TTextAttr<nsString>
{
public:
LangTextAttr(nsHyperTextAccessible* aRoot, nsIContent* aRootElm,
LangTextAttr(HyperTextAccessible* aRoot, nsIContent* aRootElm,
nsIContent* aElm);
virtual ~LangTextAttr() { }

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

@ -7,7 +7,7 @@
#define TextUpdater_h_
#include "AccEvent.h"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
/**
* Used to find a difference between old and new text and fire text change
@ -85,7 +85,7 @@ private:
private:
DocAccessible* mDocument;
mozilla::a11y::TextLeafAccessible* mTextLeaf;
nsHyperTextAccessible* mHyperText;
HyperTextAccessible* mHyperText;
PRInt32 mTextOffset;
};

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

@ -20,7 +20,7 @@ filters::GetSelected(Accessible* aAccessible)
bool
filters::GetSelectable(Accessible* aAccessible)
{
return aAccessible->State() & states::SELECTABLE;
return aAccessible->InteractiveState() & states::SELECTABLE;
}
bool

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

@ -6,6 +6,7 @@
#include "nsAccDocManager.h"
#include "ApplicationAccessible.h"
#include "DocAccessible-inl.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsARIAMap.h"

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

@ -10,7 +10,7 @@
#include "nsARIAMap.h"
#include "nsCoreUtils.h"
#include "DocAccessible.h"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "nsIAccessibleTypes.h"
#include "Role.h"
#include "States.h"
@ -254,7 +254,7 @@ nsAccUtils::IsARIASelected(Accessible* aAccessible)
nsGkAtoms::_true, eCaseMatters);
}
nsHyperTextAccessible*
HyperTextAccessible*
nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection)
{
// Get accessible from selection's focus DOM point (the DOM point where
@ -283,7 +283,7 @@ nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection)
}
do {
nsHyperTextAccessible* textAcc = accessible->AsHyperText();
HyperTextAccessible* textAcc = accessible->AsHyperText();
if (textAcc)
return textAcc;

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

@ -23,7 +23,7 @@
class nsAccessNode;
class Accessible;
class nsHyperTextAccessible;
class HyperTextAccessible;
class nsHTMLTableAccessible;
class DocAccessible;
struct nsRoleMapEntry;
@ -157,7 +157,7 @@ public:
* @param aSelection [in] the given selection
* @return text accessible
*/
static nsHyperTextAccessible*
static HyperTextAccessible*
GetTextAccessibleFromSelection(nsISelection* aSelection);
/**

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

@ -12,8 +12,11 @@
#ifdef MOZ_ACCESSIBILITY_ATK
#include "AtkSocketAccessible.h"
#endif
#include "DocAccessible-inl.h"
#include "FocusManager.h"
#include "HTMLElementAccessibles.h"
#include "HTMLListAccessible.h"
#include "HyperTextAccessibleWrap.h"
#include "nsAccessiblePivot.h"
#include "nsAccUtils.h"
#include "nsARIAMap.h"
@ -23,8 +26,6 @@
#include "nsHTMLLinkAccessible.h"
#include "nsHTMLSelectAccessible.h"
#include "nsHTMLTableAccessibleWrap.h"
#include "nsHTMLTextAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
#include "nsXFormsFormControlsAccessible.h"
#include "nsXFormsWidgetsAccessible.h"
#include "OuterDocAccessible.h"
@ -205,7 +206,7 @@ nsAccessibilityService::CreateHyperTextAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new nsHyperTextAccessibleWrap(aContent, GetDocAccessible(aPresShell));
new HyperTextAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
@ -255,7 +256,7 @@ nsAccessibilityService::CreateHTMLImageAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new nsHTMLImageAccessibleWrap(aContent, GetDocAccessible(aPresShell));
new ImageAccessibleWrap(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
@ -434,7 +435,7 @@ nsAccessibilityService::CreateHTMLLabelAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new nsHTMLLabelAccessible(aContent, GetDocAccessible(aPresShell));
new HTMLLabelAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
@ -444,7 +445,7 @@ nsAccessibilityService::CreateHTMLHRAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new nsHTMLHRAccessible(aContent, GetDocAccessible(aPresShell));
new HTMLHRAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
@ -454,7 +455,7 @@ nsAccessibilityService::CreateHTMLBRAccessible(nsIContent* aContent,
nsIPresShell* aPresShell)
{
Accessible* accessible =
new nsHTMLBRAccessible(aContent, GetDocAccessible(aPresShell));
new HTMLBRAccessible(aContent, GetDocAccessible(aPresShell));
NS_ADDREF(accessible);
return accessible;
}
@ -475,28 +476,16 @@ nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell,
nsIContent* aStartChild,
nsIContent* aEndChild)
{
#ifdef DEBUG_CONTENTMUTATION
nsAutoString tag;
aStartChild->Tag()->ToString(tag);
nsIAtom* atomid = aStartChild->GetID();
nsCAutoString id;
if (atomid)
atomid->ToUTF8String(id);
nsAutoString ctag;
nsCAutoString cid;
nsIAtom* catomid = nsnull;
if (aContainer) {
aContainer->Tag()->ToString(ctag);
catomid = aContainer->GetID();
if (catomid)
catomid->ToUTF8String(cid);
#ifdef DEBUG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "content inserted");
logging::Node("container", aContainer);
for (nsIContent* child = aStartChild; child != aEndChild;
child = child->GetNextSibling()) {
logging::Node("content", child);
}
logging::MsgEnd();
}
printf("\ncontent inserted: %s@id='%s', container: %s@id='%s', end node: %p\n\n",
NS_ConvertUTF16toUTF8(tag).get(), id.get(),
NS_ConvertUTF16toUTF8(ctag).get(), cid.get(), aEndChild);
#endif
DocAccessible* docAccessible = GetDocAccessible(aPresShell);
@ -509,28 +498,13 @@ nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell,
nsIContent* aContainer,
nsIContent* aChild)
{
#ifdef DEBUG_CONTENTMUTATION
nsAutoString tag;
aChild->Tag()->ToString(tag);
nsIAtom* atomid = aChild->GetID();
nsCAutoString id;
if (atomid)
atomid->ToUTF8String(id);
nsAutoString ctag;
nsCAutoString cid;
nsIAtom* catomid = nsnull;
if (aContainer) {
aContainer->Tag()->ToString(ctag);
catomid = aContainer->GetID();
if (catomid)
catomid->ToUTF8String(cid);
#ifdef DEBUG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "content removed");
logging::Node("container", aContainer);
logging::Node("content", aChild);
logging::MsgEnd();
}
printf("\ncontent removed: %s@id='%s', container: %s@id='%s'\n\n",
NS_ConvertUTF16toUTF8(tag).get(), id.get(),
NS_ConvertUTF16toUTF8(ctag).get(), cid.get());
#endif
DocAccessible* docAccessible = GetDocAccessible(aPresShell);
@ -1043,7 +1017,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
// create any accessible for it and don't walk into it. The accessibles for
// HTML area (nsHTMLAreaAccessible) the map contains are attached as
// children of the appropriate accessible for HTML image
// (nsHTMLImageAccessible).
// (ImageAccessible).
if (nsLayoutUtils::GetAllInFlowRectsUnion(weakFrame,
weakFrame->GetParent()).IsEmpty()) {
if (aIsSubtreeHidden)
@ -1052,7 +1026,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
return nsnull;
}
newAcc = new nsHyperTextAccessibleWrap(content, docAcc);
newAcc = new HyperTextAccessibleWrap(content, docAcc);
if (docAcc->BindToDocument(newAcc, aria::GetRoleMap(aNode)))
return newAcc;
return nsnull;
@ -1227,7 +1201,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
// other accessibles can point to it, or so that it can hold a state, etc.
if (isHTML) {
// Interesting HTML container which may have selectable text and/or embedded objects
newAcc = new nsHyperTextAccessibleWrap(content, docAcc);
newAcc = new HyperTextAccessibleWrap(content, docAcc);
}
else { // XUL, SVG, MathML etc.
// Interesting generic non-HTML container
@ -1387,7 +1361,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
nsGkAtoms::tooltiptext))
return nsnull;
accessible = new nsHTMLImageAccessibleWrap(aContent, aDoc);
accessible = new ImageAccessibleWrap(aContent, aDoc);
break;
}
@ -1657,7 +1631,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aContent);
if (roleMapEntry && roleMapEntry->role != roles::NOTHING &&
roleMapEntry->role != roles::LINK) {
Accessible* accessible = new nsHyperTextAccessibleWrap(aContent, aDoc);
Accessible* accessible = new HyperTextAccessibleWrap(aContent, aDoc);
NS_IF_ADDREF(accessible);
return accessible;
}
@ -1690,7 +1664,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
tag == nsGkAtoms::h5 ||
tag == nsGkAtoms::h6 ||
tag == nsGkAtoms::q) {
Accessible* accessible = new nsHyperTextAccessibleWrap(aContent, aDoc);
Accessible* accessible = new HyperTextAccessibleWrap(aContent, aDoc);
NS_IF_ADDREF(accessible);
return accessible;
}
@ -1703,7 +1677,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
}
if (tag == nsGkAtoms::output) {
Accessible* accessible = new nsHTMLOutputAccessible(aContent, aDoc);
Accessible* accessible = new HTMLOutputAccessible(aContent, aDoc);
NS_IF_ADDREF(accessible);
return accessible;
}

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

@ -7,9 +7,9 @@
#include "nsAccessiblePivot.h"
#include "Accessible-inl.h"
#include "nsAccUtils.h"
#include "nsHyperTextAccessible.h"
#include "DocAccessible.h"
#include "HyperTextAccessible.h"
#include "nsAccUtils.h"
#include "States.h"
#include "nsArrayUtils.h"
@ -155,7 +155,7 @@ nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible,
(aStartOffset >= 0 || (aStartOffset != -1 && aEndOffset != -1)),
NS_ERROR_INVALID_ARG);
nsRefPtr<nsHyperTextAccessible> newPosition = do_QueryObject(aTextAccessible);
nsRefPtr<HyperTextAccessible> newPosition = do_QueryObject(aTextAccessible);
if (!newPosition || !IsRootDescendant(newPosition))
return NS_ERROR_INVALID_ARG;

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

@ -6,10 +6,10 @@
#include "nsBaseWidgetAccessible.h"
#include "Accessible-inl.h"
#include "HyperTextAccessibleWrap.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
#include "nsHyperTextAccessibleWrap.h"
#include "Role.h"
#include "States.h"

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

@ -7,7 +7,7 @@
#define _nsBaseWidgetAccessible_H_
#include "AccessibleWrap.h"
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "nsIContent.h"
/**

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

@ -5,6 +5,7 @@
#include "nsCaretAccessible.h"
#include "DocAccessible-inl.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
@ -180,27 +181,9 @@ nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
nsCOMPtr<nsIDocument> documentNode(do_QueryInterface(aDOMDocument));
DocAccessible* document = GetAccService()->GetDocAccessible(documentNode);
#ifdef DEBUG_NOTIFICATIONS
nsCOMPtr<nsISelectionPrivate> privSel(do_QueryInterface(aSelection));
PRInt16 type = 0;
privSel->GetType(&type);
if (type == nsISelectionController::SELECTION_NORMAL ||
type == nsISelectionController::SELECTION_SPELLCHECK) {
bool isNormalSelection =
(type == nsISelectionController::SELECTION_NORMAL);
bool isIgnored = !document || !document->IsContentLoaded();
printf("\nSelection changed, selection type: %s, notification %s\n",
(isNormalSelection ? "normal" : "spellcheck"),
(isIgnored ? "ignored" : "pending"));
} else {
bool isIgnored = !document || !document->IsContentLoaded();
printf("\nSelection changed, selection type: unknown, notification %s\n",
(isIgnored ? "ignored" : "pending"));
}
#ifdef DEBUG
if (logging::IsEnabled(logging::eSelection))
logging::SelChange(aSelection, document);
#endif
// Don't fire events until document is loaded.
@ -243,7 +226,7 @@ nsCaretAccessible::NormalSelectionChanged(nsISelection* aSelection)
return; // No selection
}
nsHyperTextAccessible* textAcc =
HyperTextAccessible* textAcc =
nsAccUtils::GetTextAccessibleFromSelection(aSelection);
if (!textAcc)
return;
@ -278,7 +261,7 @@ nsCaretAccessible::SpellcheckSelectionChanged(nsISelection* aSelection)
// misspelled word). If spellchecking is disabled (for example,
// @spellcheck="false" on html:body) then we won't fire any event.
nsHyperTextAccessible* textAcc =
HyperTextAccessible* textAcc =
nsAccUtils::GetTextAccessibleFromSelection(aSelection);
if (!textAcc)
return;

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

@ -6,8 +6,7 @@
#ifndef __nsCaretAccessible_h__
#define __nsCaretAccessible_h__
#include "NotificationController.h"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "nsISelectionListener.h"
@ -118,7 +117,7 @@ private:
// If it was on a control, then its control's selection. Otherwise, it's for
// a document where the selection changed.
nsCOMPtr<nsIWeakReference> mLastUsedSelection; // Weak ref to nsISelection
nsRefPtr<nsHyperTextAccessible> mLastTextAccessible;
nsRefPtr<HyperTextAccessible> mLastTextAccessible;
PRInt32 mLastCaretOffset;
mozilla::a11y::RootAccessible* mRootAccessible;

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

@ -774,7 +774,7 @@ ARIAGridAccessible::GetSelectedColumnsArray(PRUint32* aColumnCount,
ARIAGridCellAccessible::
ARIAGridCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -782,7 +782,7 @@ ARIAGridCellAccessible::
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridCellAccessible,
nsHyperTextAccessible,
HyperTextAccessible,
nsIAccessibleTableCell)
////////////////////////////////////////////////////////////////////////////////
@ -956,7 +956,7 @@ ARIAGridCellAccessible::IsSelected(bool* aIsSelected)
void
ARIAGridCellAccessible::ApplyARIAState(PRUint64* aState) const
{
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
HyperTextAccessibleWrap::ApplyARIAState(aState);
// Return if the gridcell has aria-selected="true".
if (*aState & states::SELECTED)
@ -982,7 +982,7 @@ ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttribut
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
// Expose "table-cell-index" attribute.

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

@ -8,7 +8,7 @@
#include "nsIAccessibleTable.h"
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "TableAccessible.h"
#include "xpcAccessibleTable.h"
@ -88,7 +88,7 @@ protected:
/**
* Accessible for ARIA gridcell and rowheader/columnheader.
*/
class ARIAGridCellAccessible : public nsHyperTextAccessibleWrap,
class ARIAGridCellAccessible : public HyperTextAccessibleWrap,
public nsIAccessibleTableCell
{
public:

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

@ -653,7 +653,6 @@ Accessible::NativeState()
if (!document || !document->IsInDocument(this))
state |= states::STALE;
bool disabled = false;
if (mContent->IsElement()) {
nsEventStates elementState = mContent->AsElement()->State();
@ -663,23 +662,7 @@ Accessible::NativeState()
if (elementState.HasState(NS_EVENT_STATE_REQUIRED))
state |= states::REQUIRED;
disabled = mContent->IsHTML() ?
(elementState.HasState(NS_EVENT_STATE_DISABLED)) :
(mContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::disabled,
nsGkAtoms::_true,
eCaseMatters));
}
// Set unavailable state based on disabled state, otherwise set focus states
if (disabled) {
state |= states::UNAVAILABLE;
}
else if (mContent->IsElement()) {
nsIFrame* frame = GetFrame();
if (frame && frame->IsFocusable())
state |= states::FOCUSABLE;
state |= NativeInteractiveState();
if (FocusMgr()->IsFocused(this))
state |= states::FOCUSED;
}
@ -704,6 +687,22 @@ Accessible::NativeState()
return state;
}
PRUint64
Accessible::NativeInteractiveState() const
{
if (!mContent->IsElement())
return 0;
if (NativelyUnavailable())
return states::UNAVAILABLE;
nsIFrame* frame = GetFrame();
if (frame && frame->IsFocusable())
return states::FOCUSABLE;
return 0;
}
PRUint64
Accessible::NativeLinkState() const
{
@ -711,6 +710,16 @@ Accessible::NativeLinkState() const
return nsCoreUtils::IsXLink(mContent) ? states::LINKED : 0;
}
bool
Accessible::NativelyUnavailable() const
{
if (mContent->IsHTML())
return mContent->AsElement()->State().HasState(NS_EVENT_STATE_DISABLED);
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
nsGkAtoms::_true, eCaseMatters);
}
/* readonly attribute boolean focusedChild; */
NS_IMETHODIMP
Accessible::GetFocusedChild(nsIAccessible** aChild)
@ -1838,7 +1847,7 @@ Accessible::GetActionCount(PRUint8* aActionCount)
PRUint8
Accessible::ActionCount()
{
return GetActionRule(State()) == eNoAction ? 0 : 1;
return GetActionRule() == eNoAction ? 0 : 1;
}
/* DOMString getAccActionName (in PRUint8 index); */
@ -1853,8 +1862,7 @@ Accessible::GetActionName(PRUint8 aIndex, nsAString& aName)
if (IsDefunct())
return NS_ERROR_FAILURE;
PRUint64 states = State();
PRUint32 actionRule = GetActionRule(states);
PRUint32 actionRule = GetActionRule();
switch (actionRule) {
case eActivateAction:
@ -1870,20 +1878,23 @@ Accessible::GetActionName(PRUint8 aIndex, nsAString& aName)
return NS_OK;
case eCheckUncheckAction:
if (states & states::CHECKED)
{
PRUint64 state = State();
if (state & states::CHECKED)
aName.AssignLiteral("uncheck");
else if (states & states::MIXED)
else if (state & states::MIXED)
aName.AssignLiteral("cycle");
else
aName.AssignLiteral("check");
return NS_OK;
}
case eJumpAction:
aName.AssignLiteral("jump");
return NS_OK;
case eOpenCloseAction:
if (states & states::COLLAPSED)
if (State() & states::COLLAPSED)
aName.AssignLiteral("open");
else
aName.AssignLiteral("close");
@ -1896,13 +1907,13 @@ Accessible::GetActionName(PRUint8 aIndex, nsAString& aName)
case eSwitchAction:
aName.AssignLiteral("switch");
return NS_OK;
case eSortAction:
aName.AssignLiteral("sort");
return NS_OK;
case eExpandAction:
if (states & states::COLLAPSED)
if (State() & states::COLLAPSED)
aName.AssignLiteral("expand");
else
aName.AssignLiteral("collapse");
@ -1935,7 +1946,7 @@ Accessible::DoAction(PRUint8 aIndex)
if (IsDefunct())
return NS_ERROR_FAILURE;
if (GetActionRule(State()) != eNoAction) {
if (GetActionRule() != eNoAction) {
DoCommand();
return NS_OK;
}
@ -2736,7 +2747,7 @@ Accessible::StartOffset()
{
NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
return hyperText ? hyperText->GetChildOffset(this) : 0;
}
@ -2745,7 +2756,7 @@ Accessible::EndOffset()
{
NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
nsHyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nsnull;
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
}
@ -3142,11 +3153,11 @@ Accessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
}
PRUint32
Accessible::GetActionRule(PRUint64 aStates)
Accessible::GetActionRule()
{
if (aStates & states::UNAVAILABLE)
if (InteractiveState() & states::UNAVAILABLE)
return eNoAction;
// Check if it's simple xlink.
if (nsCoreUtils::IsXLink(mContent))
return eJumpAction;

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

@ -26,8 +26,7 @@ class AccGroupInfo;
class EmbeddedObjCollector;
class KeyBinding;
class Accessible;
class nsHyperTextAccessible;
class nsHTMLImageAccessible;
class HyperTextAccessible;
class nsHTMLImageMapAccessible;
struct nsRoleMapEntry;
class Relation;
@ -36,6 +35,7 @@ namespace mozilla {
namespace a11y {
class HTMLLIAccessible;
class ImageAccessible;
class TableAccessible;
class TextLeafAccessible;
@ -207,6 +207,17 @@ public:
*/
virtual PRUint64 State();
/**
* Return interactive states present on the accessible
* (@see NativeInteractiveState).
*/
PRUint64 InteractiveState() const
{
PRUint64 state = NativeInteractiveState();
ApplyARIAState(&state);
return state;
}
/**
* Return link states present on the accessible.
*/
@ -223,6 +234,11 @@ public:
*/
virtual PRUint64 NativeState();
/**
* Return native interactice state (unavailable, focusable or selectable).
*/
virtual PRUint64 NativeInteractiveState() const;
/**
* Return native link states present on the accessible.
*/
@ -233,6 +249,11 @@ public:
*/
PRUint64 VisibilityState();
/**
* Return true if native unavailable state present.
*/
virtual bool NativelyUnavailable() const;
/**
* Returns attributes for accessible without explicitly setted ARIA
* attributes.
@ -244,7 +265,6 @@ public:
*/
virtual mozilla::a11y::GroupPos GroupPosition();
/**
/**
* Used by ChildAtPoint() method to get direct or deepest child at point.
*/
@ -473,7 +493,7 @@ public:
DocAccessible* AsDoc();
inline bool IsHyperText() const { return mFlags & eHyperTextAccessible; }
nsHyperTextAccessible* AsHyperText();
HyperTextAccessible* AsHyperText();
inline bool IsHTMLFileInput() const { return mFlags & eHTMLFileInputAccessible; }
@ -481,7 +501,7 @@ public:
mozilla::a11y::HTMLLIAccessible* AsHTMLListItem();
inline bool IsImage() const { return mFlags & eImageAccessible; }
nsHTMLImageAccessible* AsImage();
mozilla::a11y::ImageAccessible* AsImage();
bool IsImageMapAccessible() const { return mFlags & eImageMapAccessible; }
nsHTMLImageMapAccessible* AsImageMap();
@ -825,10 +845,8 @@ protected:
/**
* Return the action rule based on ARIA enum constants EActionRule
* (see nsARIAMap.h). Used by ActionCount() and GetActionName().
*
* @param aStates [in] states of the accessible
*/
PRUint32 GetActionRule(PRUint64 aStates);
PRUint32 GetActionRule();
/**
* Return group info.

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

@ -9,11 +9,34 @@
#include "DocAccessible.h"
#include "nsAccessibilityService.h"
#include "NotificationController.h"
inline DocAccessible*
DocAccessible::ParentDocument() const
inline void
DocAccessible::BindChildDocument(DocAccessible* aDocument)
{
return GetAccService()->GetDocAccessible(mDocument->GetParentDocument());
mNotificationController->ScheduleChildDocBinding(aDocument);
}
template<class Class, class Arg>
inline void
DocAccessible::HandleNotification(Class* aInstance,
typename TNotification<Class, Arg>::Callback aMethod,
Arg* aArg)
{
if (mNotificationController) {
mNotificationController->HandleNotification<Class, Arg>(aInstance,
aMethod, aArg);
}
}
inline void
DocAccessible::UpdateText(nsIContent* aTextNode)
{
NS_ASSERTION(mNotificationController, "The document was shut down!");
// Ignore the notification if initial tree construction hasn't been done yet.
if (mNotificationController && HasLoadState(eTreeConstructed))
mNotificationController->ScheduleTextUpdate(aTextNode);
}
#endif

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

@ -78,7 +78,7 @@ static const PRUint32 kRelationAttrsLen = NS_ARRAY_LENGTH(kRelationAttrs);
DocAccessible::
DocAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
nsIPresShell* aPresShell) :
nsHyperTextAccessibleWrap(aRootContent, this),
HyperTextAccessibleWrap(aRootContent, this),
mDocument(aDocument), mScrollPositionChangedTicks(0),
mLoadState(eTreeConstructionPending), mLoadEventType(0),
mVirtualCursor(nsnull),
@ -162,14 +162,13 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DocAccessible)
nsresult status;
if (!foundInterface) {
// HTML document accessible must inherit from nsHyperTextAccessible to get
// HTML document accessible must inherit from HyperTextAccessible to get
// support text interfaces. XUL document accessible doesn't need this.
// However at some point we may push <body> to implement the interfaces and
// return DocAccessible to inherit from AccessibleWrap.
status = IsHyperText() ?
nsHyperTextAccessible::QueryInterface(aIID,
(void**)&foundInterface) :
HyperTextAccessible::QueryInterface(aIID, (void**)&foundInterface) :
Accessible::QueryInterface(aIID, (void**)&foundInterface);
} else {
NS_ADDREF(foundInterface);
@ -180,8 +179,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(DocAccessible)
return status;
}
NS_IMPL_ADDREF_INHERITED(DocAccessible, nsHyperTextAccessible)
NS_IMPL_RELEASE_INHERITED(DocAccessible, nsHyperTextAccessible)
NS_IMPL_ADDREF_INHERITED(DocAccessible, HyperTextAccessible)
NS_IMPL_RELEASE_INHERITED(DocAccessible, HyperTextAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsIAccessible
@ -286,7 +285,7 @@ DocAccessible::NativeState()
0 : states::STALE;
// Document is always focusable.
state |= states::FOCUSABLE;
state |= states::FOCUSABLE; // keep in sync with NativeIteractiveState() impl
if (FocusMgr()->IsFocused(this))
state |= states::FOCUSED;
@ -312,6 +311,19 @@ DocAccessible::NativeState()
return state;
}
PRUint64
DocAccessible::NativeInteractiveState() const
{
// Document is always focusable.
return states::FOCUSABLE;
}
bool
DocAccessible::NativelyUnavailable() const
{
return false;
}
// Accessible public method
void
DocAccessible::ApplyARIAState(PRUint64* aState) const
@ -531,7 +543,7 @@ DocAccessible::GetVirtualCursor(nsIAccessiblePivot** aVirtualCursor)
return NS_OK;
}
// nsHyperTextAccessible method
// HyperTextAccessible method
already_AddRefed<nsIEditor>
DocAccessible::GetEditor() const
{
@ -632,7 +644,9 @@ DocAccessible::Shutdown()
RemoveEventListeners();
// Mark the document as shutdown before AT is notified about the document
// removal from its container (valid for root documents on ATK).
// removal from its container (valid for root documents on ATK and due to
// some reason for MSAA, refer to bug 757392 for details).
mFlags |= eIsDefunct;
nsCOMPtr<nsIDocument> kungFuDeathGripDoc = mDocument;
mDocument = nsnull;
@ -663,7 +677,7 @@ DocAccessible::Shutdown()
mNodeToAccessibleMap.Clear();
ClearCache(mAccessibleCache);
nsHyperTextAccessibleWrap::Shutdown();
HyperTextAccessibleWrap::Shutdown();
GetAccService()->NotifyOfDocumentShutdown(kungFuDeathGripDoc);
}
@ -1305,7 +1319,7 @@ DocAccessible::HandleAccEvent(AccEvent* aEvent)
if (logging::IsEnabled(logging::eDocLoad))
logging::DocLoadEventHandled(aEvent);
return nsHyperTextAccessible::HandleAccEvent(aEvent);
return HyperTextAccessible::HandleAccEvent(aEvent);
}
#endif
@ -1762,7 +1776,7 @@ DocAccessible::ProcessPendingEvent(AccEvent* aEvent)
{
PRUint32 eventType = aEvent->GetEventType();
if (eventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) {
nsHyperTextAccessible* hyperText = aEvent->GetAccessible()->AsHyperText();
HyperTextAccessible* hyperText = aEvent->GetAccessible()->AsHyperText();
PRInt32 caretOffset;
if (hyperText &&
NS_SUCCEEDED(hyperText->GetCaretOffset(&caretOffset))) {
@ -1837,6 +1851,21 @@ DocAccessible::UpdateTree(Accessible* aContainer, nsIContent* aChildNode,
// If child node is not accessible then look for its accessible children.
Accessible* child = GetAccessible(aChildNode);
#ifdef DEBUG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "process content %s",
(aIsInsert ? "insertion" : "removal"));
logging::Node("container", aContainer->GetNode());
logging::Node("child", aChildNode);
if (child)
logging::Address("child", child);
else
logging::MsgEntry("child accessible: null");
logging::MsgEnd();
}
#endif
if (child) {
updateFlags |= UpdateTreeInternal(child, aIsInsert);
@ -2029,8 +2058,12 @@ DocAccessible::IsLoadEventTarget() const
// Return true if it's not a root document (either tab document or
// frame/iframe document) and its parent document is not in loading state.
if (parentTreeItem)
return ParentDocument()->HasLoadState(eCompletelyLoaded);
// Note: we can get notifications while document is loading (and thus
// while there's no parent document yet).
if (parentTreeItem) {
DocAccessible* parentDoc = ParentDocument();
return parentDoc && parentDoc->HasLoadState(eCompletelyLoaded);
}
// It's content (not chrome) root document.
PRInt32 contentType;

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

@ -10,9 +10,8 @@
#include "nsIAccessibleDocument.h"
#include "nsIAccessiblePivot.h"
#include "HyperTextAccessibleWrap.h"
#include "nsEventShell.h"
#include "nsHyperTextAccessibleWrap.h"
#include "NotificationController.h"
#include "nsClassHashtable.h"
#include "nsDataHashtable.h"
@ -26,12 +25,16 @@
#include "nsCOMArray.h"
#include "nsIDocShellTreeNode.h"
template<class Class, class Arg>
class TNotification;
class NotificationController;
class nsIScrollableView;
class nsAccessiblePivot;
const PRUint32 kDefaultCacheSize = 256;
class DocAccessible : public nsHyperTextAccessibleWrap,
class DocAccessible : public HyperTextAccessibleWrap,
public nsIAccessibleDocument,
public nsIDocumentObserver,
public nsIObserver,
@ -81,6 +84,8 @@ public:
virtual Accessible* FocusedChild();
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
virtual bool NativelyUnavailable() const;
virtual void ApplyARIAState(PRUint64* aState) const;
virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
@ -91,7 +96,7 @@ public:
virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
// nsHyperTextAccessible
// HyperTextAccessible
virtual already_AddRefed<nsIEditor> GetEditor() const;
// DocAccessible
@ -149,7 +154,8 @@ public:
/**
* Return the parent document.
*/
DocAccessible* ParentDocument() const;
DocAccessible* ParentDocument() const
{ return mParent ? mParent->Document() : nsnull; }
/**
* Return the child document count.
@ -208,10 +214,7 @@ public:
/**
* Bind the child document to the tree.
*/
void BindChildDocument(DocAccessible* aDocument)
{
mNotificationController->ScheduleChildDocBinding(aDocument);
}
void BindChildDocument(DocAccessible* aDocument);
/**
* Process the generic notification.
@ -222,14 +225,8 @@ public:
*/
template<class Class, class Arg>
void HandleNotification(Class* aInstance,
typename TNotification<Class, Arg>::Callback aMethod,
Arg* aArg)
{
if (mNotificationController) {
mNotificationController->HandleNotification<Class, Arg>(aInstance,
aMethod, aArg);
}
}
typename TNotification<Class, Arg>::Callback aMethod,
Arg* aArg);
/**
* Return the cached accessible by the given DOM node if it's in subtree of
@ -329,14 +326,7 @@ public:
/**
* Updates accessible tree when rendered text is changed.
*/
void UpdateText(nsIContent* aTextNode)
{
NS_ASSERTION(mNotificationController, "The document was shut down!");
// Ignore the notification if initial tree construction hasn't been done yet.
if (mNotificationController && HasLoadState(eTreeConstructed))
mNotificationController->ScheduleTextUpdate(aTextNode);
}
void UpdateText(nsIContent* aTextNode);
/**
* Recreate an accessible, results in hide/show events pair.

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

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "Accessible-inl.h"
#include "nsAccessibilityService.h"
@ -37,25 +37,26 @@
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHyperTextAccessible
// HyperTextAccessible
////////////////////////////////////////////////////////////////////////////////
nsHyperTextAccessible::
nsHyperTextAccessible(nsIContent* aNode, DocAccessible* aDoc) :
HyperTextAccessible::
HyperTextAccessible(nsIContent* aNode, DocAccessible* aDoc) :
AccessibleWrap(aNode, aDoc)
{
mFlags |= eHyperTextAccessible;
}
NS_IMPL_ADDREF_INHERITED(nsHyperTextAccessible, AccessibleWrap)
NS_IMPL_RELEASE_INHERITED(nsHyperTextAccessible, AccessibleWrap)
NS_IMPL_ADDREF_INHERITED(HyperTextAccessible, AccessibleWrap)
NS_IMPL_RELEASE_INHERITED(HyperTextAccessible, AccessibleWrap)
nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult
HyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
*aInstancePtr = nsnull;
if (aIID.Equals(NS_GET_IID(nsHyperTextAccessible))) {
*aInstancePtr = static_cast<nsHyperTextAccessible*>(this);
if (aIID.Equals(NS_GET_IID(HyperTextAccessible))) {
*aInstancePtr = static_cast<HyperTextAccessible*>(this);
NS_ADDREF_THIS();
return NS_OK;
}
@ -86,7 +87,7 @@ nsresult nsHyperTextAccessible::QueryInterface(REFNSIID aIID, void** aInstancePt
}
role
nsHyperTextAccessible::NativeRole()
HyperTextAccessible::NativeRole()
{
nsIAtom *tag = mContent->Tag();
@ -127,7 +128,7 @@ nsHyperTextAccessible::NativeRole()
}
PRUint64
nsHyperTextAccessible::NativeState()
HyperTextAccessible::NativeState()
{
PRUint64 states = AccessibleWrap::NativeState();
@ -147,8 +148,9 @@ nsHyperTextAccessible::NativeState()
}
// Substring must be entirely within the same text node
nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 aStartRenderedOffset,
PRUint32 aEndRenderedOffset)
nsIntRect
HyperTextAccessible::GetBoundsForString(nsIFrame* aFrame, PRUint32 aStartRenderedOffset,
PRUint32 aEndRenderedOffset)
{
nsIntRect screenRect;
NS_ENSURE_TRUE(aFrame, screenRect);
@ -215,11 +217,11 @@ nsIntRect nsHyperTextAccessible::GetBoundsForString(nsIFrame *aFrame, PRUint32 a
* Gets the specified text.
*/
nsIFrame*
nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
nsAString *aText, nsIFrame **aEndFrame,
nsIntRect *aBoundsRect,
Accessible** aStartAcc,
Accessible** aEndAcc)
HyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
nsAString* aText, nsIFrame** aEndFrame,
nsIntRect* aBoundsRect,
Accessible** aStartAcc,
Accessible** aEndAcc)
{
if (aStartOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT) {
aStartOffset = CharacterCount();
@ -414,8 +416,8 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
}
NS_IMETHODIMP
nsHyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset,
nsAString &aText)
HyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset,
nsAString& aText)
{
aText.Truncate();
@ -469,7 +471,8 @@ nsHyperTextAccessible::GetText(PRInt32 aStartOffset, PRInt32 aEndOffset,
/*
* Gets the character count.
*/
NS_IMETHODIMP nsHyperTextAccessible::GetCharacterCount(PRInt32 *aCharacterCount)
NS_IMETHODIMP
HyperTextAccessible::GetCharacterCount(PRInt32* aCharacterCount)
{
NS_ENSURE_ARG_POINTER(aCharacterCount);
*aCharacterCount = 0;
@ -484,7 +487,8 @@ NS_IMETHODIMP nsHyperTextAccessible::GetCharacterCount(PRInt32 *aCharacterCount)
/*
* Gets the specified character.
*/
NS_IMETHODIMP nsHyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar *aCharacter)
NS_IMETHODIMP
HyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUnichar* aCharacter)
{
NS_ENSURE_ARG_POINTER(aCharacter);
*aCharacter = nsnull;
@ -502,10 +506,10 @@ NS_IMETHODIMP nsHyperTextAccessible::GetCharacterAtOffset(PRInt32 aOffset, PRUni
}
Accessible*
nsHyperTextAccessible::DOMPointToHypertextOffset(nsINode *aNode,
PRInt32 aNodeOffset,
PRInt32 *aHyperTextOffset,
bool aIsEndOffset)
HyperTextAccessible::DOMPointToHypertextOffset(nsINode* aNode,
PRInt32 aNodeOffset,
PRInt32* aHyperTextOffset,
bool aIsEndOffset)
{
if (!aHyperTextOffset)
return nsnull;
@ -637,9 +641,9 @@ nsHyperTextAccessible::DOMPointToHypertextOffset(nsINode *aNode,
}
nsresult
nsHyperTextAccessible::HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
nsIDOMNode **aNode,
PRInt32 *aOffset)
HyperTextAccessible::HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
nsIDOMNode** aNode,
PRInt32* aOffset)
{
nsCOMPtr<nsIDOMNode> endNode;
PRInt32 endOffset;
@ -649,12 +653,12 @@ nsHyperTextAccessible::HypertextOffsetToDOMPoint(PRInt32 aHTOffset,
}
nsresult
nsHyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
PRInt32 aEndHTOffset,
nsIDOMNode **aStartNode,
PRInt32 *aStartOffset,
nsIDOMNode **aEndNode,
PRInt32 *aEndOffset)
HyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
PRInt32 aEndHTOffset,
nsIDOMNode** aStartNode,
PRInt32* aStartOffset,
nsIDOMNode** aEndNode,
PRInt32* aEndOffset)
{
NS_ENSURE_ARG_POINTER(aStartNode);
*aStartNode = nsnull;
@ -725,13 +729,13 @@ nsHyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
}
PRInt32
nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
nsIFrame *aFromFrame,
PRInt32 aFromOffset,
Accessible* aFromAccessible,
nsSelectionAmount aAmount,
nsDirection aDirection,
bool aNeedsStart)
HyperTextAccessible::GetRelativeOffset(nsIPresShell* aPresShell,
nsIFrame* aFromFrame,
PRInt32 aFromOffset,
Accessible* aFromAccessible,
nsSelectionAmount aAmount,
nsDirection aDirection,
bool aNeedsStart)
{
const bool kIsJumpLinesOk = true; // okay to jump lines
const bool kIsScrollViewAStop = false; // do not stop at scroll views
@ -834,9 +838,9 @@ BOUNDARY_LINE_END From the line end before/at/after the offset to the ne
*/
nsresult
nsHyperTextAccessible::GetTextHelper(EGetTextType aType, AccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32 *aStartOffset, PRInt32 *aEndOffset,
nsAString &aText)
HyperTextAccessible::GetTextHelper(EGetTextType aType, AccessibleTextBoundary aBoundaryType,
PRInt32 aOffset, PRInt32* aStartOffset, PRInt32* aEndOffset,
nsAString& aText)
{
aText.Truncate();
@ -1017,8 +1021,10 @@ nsHyperTextAccessible::GetTextHelper(EGetTextType aType, AccessibleTextBoundary
* nsIAccessibleText impl.
*/
NS_IMETHODIMP
nsHyperTextAccessible::GetTextBeforeOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
HyperTextAccessible::GetTextBeforeOffset(PRInt32 aOffset,
AccessibleTextBoundary aBoundaryType,
PRInt32* aStartOffset,
PRInt32* aEndOffset, nsAString& aText)
{
if (aBoundaryType == BOUNDARY_CHAR) {
GetCharAt(aOffset, eGetBefore, aText, aStartOffset, aEndOffset);
@ -1029,8 +1035,10 @@ nsHyperTextAccessible::GetTextBeforeOffset(PRInt32 aOffset, AccessibleTextBounda
}
NS_IMETHODIMP
nsHyperTextAccessible::GetTextAtOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
HyperTextAccessible::GetTextAtOffset(PRInt32 aOffset,
AccessibleTextBoundary aBoundaryType,
PRInt32* aStartOffset,
PRInt32* aEndOffset, nsAString& aText)
{
if (aBoundaryType == BOUNDARY_CHAR) {
GetCharAt(aOffset, eGetAt, aText, aStartOffset, aEndOffset);
@ -1041,8 +1049,8 @@ nsHyperTextAccessible::GetTextAtOffset(PRInt32 aOffset, AccessibleTextBoundary a
}
NS_IMETHODIMP
nsHyperTextAccessible::GetTextAfterOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
PRInt32 *aStartOffset, PRInt32 *aEndOffset, nsAString & aText)
HyperTextAccessible::GetTextAfterOffset(PRInt32 aOffset, AccessibleTextBoundary aBoundaryType,
PRInt32* aStartOffset, PRInt32* aEndOffset, nsAString& aText)
{
if (aBoundaryType == BOUNDARY_CHAR) {
GetCharAt(aOffset, eGetAfter, aText, aStartOffset, aEndOffset);
@ -1058,11 +1066,11 @@ nsHyperTextAccessible::GetTextAfterOffset(PRInt32 aOffset, AccessibleTextBoundar
// out long rangeStartOffset,
// out long rangeEndOffset);
NS_IMETHODIMP
nsHyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
PRInt32 aOffset,
PRInt32 *aStartOffset,
PRInt32 *aEndOffset,
nsIPersistentProperties **aAttributes)
HyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
PRInt32 aOffset,
PRInt32* aStartOffset,
PRInt32* aEndOffset,
nsIPersistentProperties** aAttributes)
{
// 1. Get each attribute and its ranges one after another.
// 2. As we get each new attribute, we pass the current start and end offsets
@ -1134,7 +1142,7 @@ nsHyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
// nsIPersistentProperties
// nsIAccessibleText::defaultTextAttributes
NS_IMETHODIMP
nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttributes)
HyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties** aAttributes)
{
NS_ENSURE_ARG_POINTER(aAttributes);
*aAttributes = nsnull;
@ -1154,7 +1162,7 @@ nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttri
}
PRInt32
nsHyperTextAccessible::GetLevelInternal()
HyperTextAccessible::GetLevelInternal()
{
nsIAtom *tag = mContent->Tag();
if (tag == nsGkAtoms::h1)
@ -1174,7 +1182,7 @@ nsHyperTextAccessible::GetLevelInternal()
}
nsresult
nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
HyperTextAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
{
nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
@ -1223,9 +1231,10 @@ nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
/*
* Given an offset, the x, y, width, and height values are filled appropriately.
*/
NS_IMETHODIMP nsHyperTextAccessible::GetCharacterExtents(PRInt32 aOffset, PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight,
PRUint32 aCoordType)
NS_IMETHODIMP
HyperTextAccessible::GetCharacterExtents(PRInt32 aOffset, PRInt32* aX, PRInt32* aY,
PRInt32* aWidth, PRInt32* aHeight,
PRUint32 aCoordType)
{
return GetRangeExtents(aOffset, aOffset + 1, aX, aY, aWidth, aHeight, aCoordType);
}
@ -1233,10 +1242,11 @@ NS_IMETHODIMP nsHyperTextAccessible::GetCharacterExtents(PRInt32 aOffset, PRInt3
/*
* Given a start & end offset, the x, y, width, and height values are filled appropriately.
*/
NS_IMETHODIMP nsHyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight,
PRUint32 aCoordType)
NS_IMETHODIMP
HyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
PRInt32* aX, PRInt32* aY,
PRInt32* aWidth, PRInt32* aHeight,
PRUint32 aCoordType)
{
nsIntRect boundsRect;
nsIFrame *endFrameUnused;
@ -1258,8 +1268,8 @@ NS_IMETHODIMP nsHyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt
* the screen or this widget's window depending on coords.
*/
NS_IMETHODIMP
nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
PRUint32 aCoordType, PRInt32 *aOffset)
HyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
PRUint32 aCoordType, PRInt32* aOffset)
{
*aOffset = -1;
@ -1339,7 +1349,7 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
// nsIAccessibleHyperText
NS_IMETHODIMP
nsHyperTextAccessible::GetLinkCount(PRInt32 *aLinkCount)
HyperTextAccessible::GetLinkCount(PRInt32* aLinkCount)
{
NS_ENSURE_ARG_POINTER(aLinkCount);
*aLinkCount = 0;
@ -1352,7 +1362,7 @@ nsHyperTextAccessible::GetLinkCount(PRInt32 *aLinkCount)
}
NS_IMETHODIMP
nsHyperTextAccessible::GetLinkAt(PRInt32 aIndex, nsIAccessibleHyperLink** aLink)
HyperTextAccessible::GetLinkAt(PRInt32 aIndex, nsIAccessibleHyperLink** aLink)
{
NS_ENSURE_ARG_POINTER(aLink);
*aLink = nsnull;
@ -1368,8 +1378,8 @@ nsHyperTextAccessible::GetLinkAt(PRInt32 aIndex, nsIAccessibleHyperLink** aLink)
}
NS_IMETHODIMP
nsHyperTextAccessible::GetLinkIndex(nsIAccessibleHyperLink* aLink,
PRInt32* aIndex)
HyperTextAccessible::GetLinkIndex(nsIAccessibleHyperLink* aLink,
PRInt32* aIndex)
{
NS_ENSURE_ARG_POINTER(aLink);
@ -1382,8 +1392,7 @@ nsHyperTextAccessible::GetLinkIndex(nsIAccessibleHyperLink* aLink,
}
NS_IMETHODIMP
nsHyperTextAccessible::GetLinkIndexAtOffset(PRInt32 aOffset,
PRInt32* aLinkIndex)
HyperTextAccessible::GetLinkIndexAtOffset(PRInt32 aOffset, PRInt32* aLinkIndex)
{
NS_ENSURE_ARG_POINTER(aLinkIndex);
*aLinkIndex = -1; // API says this magic value means 'not found'
@ -1398,13 +1407,15 @@ nsHyperTextAccessible::GetLinkIndexAtOffset(PRInt32 aOffset,
/**
* nsIAccessibleEditableText impl.
*/
NS_IMETHODIMP nsHyperTextAccessible::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos,
nsISupports *aAttributes)
NS_IMETHODIMP
HyperTextAccessible::SetAttributes(PRInt32 aStartPos, PRInt32 aEndPos,
nsISupports* aAttributes)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsHyperTextAccessible::SetTextContents(const nsAString &aText)
NS_IMETHODIMP
HyperTextAccessible::SetTextContents(const nsAString& aText)
{
PRInt32 numChars = CharacterCount();
if (numChars == 0 || NS_SUCCEEDED(DeleteText(0, numChars))) {
@ -1414,7 +1425,7 @@ NS_IMETHODIMP nsHyperTextAccessible::SetTextContents(const nsAString &aText)
}
NS_IMETHODIMP
nsHyperTextAccessible::InsertText(const nsAString &aText, PRInt32 aPosition)
HyperTextAccessible::InsertText(const nsAString& aText, PRInt32 aPosition)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -1431,7 +1442,7 @@ nsHyperTextAccessible::InsertText(const nsAString &aText, PRInt32 aPosition)
}
NS_IMETHODIMP
nsHyperTextAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
HyperTextAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -1446,7 +1457,7 @@ nsHyperTextAccessible::CopyText(PRInt32 aStartPos, PRInt32 aEndPos)
}
NS_IMETHODIMP
nsHyperTextAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
HyperTextAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -1461,7 +1472,7 @@ nsHyperTextAccessible::CutText(PRInt32 aStartPos, PRInt32 aEndPos)
}
NS_IMETHODIMP
nsHyperTextAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
HyperTextAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -1476,7 +1487,7 @@ nsHyperTextAccessible::DeleteText(PRInt32 aStartPos, PRInt32 aEndPos)
}
NS_IMETHODIMP
nsHyperTextAccessible::PasteText(PRInt32 aPosition)
HyperTextAccessible::PasteText(PRInt32 aPosition)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -1491,13 +1502,13 @@ nsHyperTextAccessible::PasteText(PRInt32 aPosition)
}
already_AddRefed<nsIEditor>
nsHyperTextAccessible::GetEditor() const
HyperTextAccessible::GetEditor() const
{
if (!mContent->HasFlag(NODE_IS_EDITABLE)) {
// If we're inside an editable container, then return that container's editor
Accessible* ancestor = Parent();
while (ancestor) {
nsHyperTextAccessible* hyperText = ancestor->AsHyperText();
HyperTextAccessible* hyperText = ancestor->AsHyperText();
if (hyperText) {
// Recursion will stop at container doc because it has its own impl
// of GetEditor()
@ -1528,9 +1539,9 @@ nsHyperTextAccessible::GetEditor() const
*/
nsresult
nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
HyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
{
bool isFocusable = State() & states::FOCUSABLE;
bool isFocusable = InteractiveState() & states::FOCUSABLE;
// If accessible is focusable then focus it before setting the selection to
// neglect control's selection changes on focus if any (for example, inputs
@ -1581,7 +1592,7 @@ nsHyperTextAccessible::SetSelectionRange(PRInt32 aStartPos, PRInt32 aEndPos)
}
NS_IMETHODIMP
nsHyperTextAccessible::SetCaretOffset(PRInt32 aCaretOffset)
HyperTextAccessible::SetCaretOffset(PRInt32 aCaretOffset)
{
return SetSelectionRange(aCaretOffset, aCaretOffset);
}
@ -1590,7 +1601,7 @@ nsHyperTextAccessible::SetCaretOffset(PRInt32 aCaretOffset)
* Gets the offset position of the caret (cursor).
*/
NS_IMETHODIMP
nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
HyperTextAccessible::GetCaretOffset(PRInt32* aCaretOffset)
{
NS_ENSURE_ARG_POINTER(aCaretOffset);
*aCaretOffset = -1;
@ -1601,7 +1612,7 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
// Not focused focusable accessible except document accessible doesn't have
// a caret.
if (!IsDoc() && !FocusMgr()->IsFocused(this) &&
(State() & states::FOCUSABLE)) {
(InteractiveState() & states::FOCUSABLE)) {
return NS_OK;
}
@ -1647,7 +1658,7 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
}
PRInt32
nsHyperTextAccessible::CaretLineNumber()
HyperTextAccessible::CaretLineNumber()
{
// Provide the line number for the caret, relative to the
// currently focused node. Use a 1-based index
@ -1714,15 +1725,15 @@ nsHyperTextAccessible::CaretLineNumber()
}
already_AddRefed<nsFrameSelection>
nsHyperTextAccessible::FrameSelection()
HyperTextAccessible::FrameSelection()
{
nsIFrame* frame = GetFrame();
return frame ? frame->GetFrameSelection() : nsnull;
}
void
nsHyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
nsTArray<nsRange*>* aRanges)
HyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
nsTArray<nsRange*>* aRanges)
{
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
if (!frameSelection)
@ -1765,7 +1776,7 @@ nsHyperTextAccessible::GetSelectionDOMRanges(PRInt16 aType,
* Gets the number of selected regions.
*/
NS_IMETHODIMP
nsHyperTextAccessible::GetSelectionCount(PRInt32* aSelectionCount)
HyperTextAccessible::GetSelectionCount(PRInt32* aSelectionCount)
{
NS_ENSURE_ARG_POINTER(aSelectionCount);
*aSelectionCount = 0;
@ -1781,9 +1792,9 @@ nsHyperTextAccessible::GetSelectionCount(PRInt32* aSelectionCount)
* Gets the start and end offset of the specified selection.
*/
NS_IMETHODIMP
nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum,
PRInt32* aStartOffset,
PRInt32* aEndOffset)
HyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum,
PRInt32* aStartOffset,
PRInt32* aEndOffset)
{
NS_ENSURE_ARG_POINTER(aStartOffset);
NS_ENSURE_ARG_POINTER(aEndOffset);
@ -1830,9 +1841,9 @@ nsHyperTextAccessible::GetSelectionBounds(PRInt32 aSelectionNum,
* Changes the start and end offset of the specified selection.
*/
NS_IMETHODIMP
nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
PRInt32 aStartOffset,
PRInt32 aEndOffset)
HyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
PRInt32 aStartOffset,
PRInt32 aEndOffset)
{
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
@ -1887,7 +1898,7 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
* Adds a selection bounded by the specified offsets.
*/
NS_IMETHODIMP
nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
HyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
{
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
@ -1906,7 +1917,7 @@ nsHyperTextAccessible::AddSelection(PRInt32 aStartOffset, PRInt32 aEndOffset)
* Removes the specified selection.
*/
NS_IMETHODIMP
nsHyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
HyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
{
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
NS_ENSURE_STATE(frameSelection);
@ -1929,8 +1940,8 @@ nsHyperTextAccessible::RemoveSelection(PRInt32 aSelectionNum)
// scrollSubstringTo(in long startIndex, in long endIndex,
// in unsigned long scrollType);
NS_IMETHODIMP
nsHyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
PRUint32 aScrollType)
HyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
PRUint32 aScrollType)
{
PRInt32 startOffset, endOffset;
nsCOMPtr<nsIDOMNode> startNode, endNode;
@ -1951,10 +1962,10 @@ nsHyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
// in unsigned long coordinateType,
// in long x, in long y);
NS_IMETHODIMP
nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
PRInt32 aEndIndex,
PRUint32 aCoordinateType,
PRInt32 aX, PRInt32 aY)
HyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
PRInt32 aEndIndex,
PRUint32 aCoordinateType,
PRInt32 aX, PRInt32 aY)
{
nsIFrame *frame = GetFrame();
if (!frame)
@ -2023,7 +2034,7 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
// Accessible public
nsresult
nsHyperTextAccessible::GetNameInternal(nsAString& aName)
HyperTextAccessible::GetNameInternal(nsAString& aName)
{
nsresult rv = AccessibleWrap::GetNameInternal(aName);
NS_ENSURE_SUCCESS(rv, rv);
@ -2042,7 +2053,7 @@ nsHyperTextAccessible::GetNameInternal(nsAString& aName)
}
void
nsHyperTextAccessible::InvalidateChildren()
HyperTextAccessible::InvalidateChildren()
{
mOffsets.Clear();
@ -2050,7 +2061,7 @@ nsHyperTextAccessible::InvalidateChildren()
}
bool
nsHyperTextAccessible::RemoveChild(Accessible* aAccessible)
HyperTextAccessible::RemoveChild(Accessible* aAccessible)
{
PRInt32 childIndex = aAccessible->IndexInParent();
PRInt32 count = mOffsets.Length() - childIndex;
@ -2061,10 +2072,11 @@ nsHyperTextAccessible::RemoveChild(Accessible* aAccessible)
}
////////////////////////////////////////////////////////////////////////////////
// nsHyperTextAccessible public static
// HyperTextAccessible public static
nsresult nsHyperTextAccessible::ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
PRUint32 *aRenderedOffset)
nsresult
HyperTextAccessible::ContentToRenderedOffset(nsIFrame* aFrame, PRInt32 aContentOffset,
PRUint32* aRenderedOffset)
{
if (!aFrame) {
// Current frame not rendered -- this can happen if text is set on
@ -2092,8 +2104,9 @@ nsresult nsHyperTextAccessible::ContentToRenderedOffset(nsIFrame *aFrame, PRInt3
return NS_OK;
}
nsresult nsHyperTextAccessible::RenderedToContentOffset(nsIFrame *aFrame, PRUint32 aRenderedOffset,
PRInt32 *aContentOffset)
nsresult
HyperTextAccessible::RenderedToContentOffset(nsIFrame* aFrame, PRUint32 aRenderedOffset,
PRInt32* aContentOffset)
{
*aContentOffset = 0;
NS_ENSURE_TRUE(aFrame, NS_ERROR_FAILURE);
@ -2118,12 +2131,12 @@ nsresult nsHyperTextAccessible::RenderedToContentOffset(nsIFrame *aFrame, PRUint
}
////////////////////////////////////////////////////////////////////////////////
// nsHyperTextAccessible public
// HyperTextAccessible public
bool
nsHyperTextAccessible::GetCharAt(PRInt32 aOffset, EGetTextType aShift,
nsAString& aChar, PRInt32* aStartOffset,
PRInt32* aEndOffset)
HyperTextAccessible::GetCharAt(PRInt32 aOffset, EGetTextType aShift,
nsAString& aChar, PRInt32* aStartOffset,
PRInt32* aEndOffset)
{
aChar.Truncate();
@ -2144,8 +2157,8 @@ nsHyperTextAccessible::GetCharAt(PRInt32 aOffset, EGetTextType aShift,
}
PRInt32
nsHyperTextAccessible::GetChildOffset(PRUint32 aChildIndex,
bool aInvalidateAfter)
HyperTextAccessible::GetChildOffset(PRUint32 aChildIndex,
bool aInvalidateAfter)
{
if (aChildIndex == 0) {
if (aInvalidateAfter)
@ -2175,7 +2188,7 @@ nsHyperTextAccessible::GetChildOffset(PRUint32 aChildIndex,
}
PRInt32
nsHyperTextAccessible::GetChildIndexAtOffset(PRUint32 aOffset)
HyperTextAccessible::GetChildIndexAtOffset(PRUint32 aOffset)
{
PRUint32 lastOffset = 0;
PRUint32 offsetCount = mOffsets.Length();
@ -2216,14 +2229,14 @@ nsHyperTextAccessible::GetChildIndexAtOffset(PRUint32 aOffset)
}
////////////////////////////////////////////////////////////////////////////////
// nsHyperTextAccessible protected
// HyperTextAccessible protected
nsresult
nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
PRInt32 aOffset,
Accessible* aAccessible,
nsIDOMNode** aNode,
PRInt32* aNodeOffset)
HyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
PRInt32 aOffset,
Accessible* aAccessible,
nsIDOMNode** aNode,
PRInt32* aNodeOffset)
{
NS_ENSURE_ARG(aAccessible);
@ -2268,12 +2281,12 @@ nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame* aFrame,
return NS_OK;
}
// nsHyperTextAccessible
// HyperTextAccessible
nsresult
nsHyperTextAccessible::RangeBoundToHypertextOffset(nsRange *aRange,
bool aIsStartBound,
bool aIsStartHTOffset,
PRInt32 *aHTOffset)
HyperTextAccessible::RangeBoundToHypertextOffset(nsRange* aRange,
bool aIsStartBound,
bool aIsStartHTOffset,
PRInt32* aHTOffset)
{
nsINode* node = nsnull;
PRInt32 nodeOffset = 0;
@ -2295,13 +2308,13 @@ nsHyperTextAccessible::RangeBoundToHypertextOffset(nsRange *aRange,
return NS_OK;
}
// nsHyperTextAccessible
// HyperTextAccessible
nsresult
nsHyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
PRInt32 aNodeOffset,
PRInt32 *aHTStartOffset,
PRInt32 *aHTEndOffset,
nsIPersistentProperties *aAttributes)
HyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
PRInt32 aNodeOffset,
PRInt32* aHTStartOffset,
PRInt32* aHTEndOffset,
nsIPersistentProperties* aAttributes)
{
nsTArray<nsRange*> ranges;
GetSelectionDOMRanges(nsISelectionController::SELECTION_SPELLCHECK, &ranges);
@ -2372,7 +2385,7 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsINode* aNode,
}
bool
nsHyperTextAccessible::IsTextRole()
HyperTextAccessible::IsTextRole()
{
if (mRoleMapEntry &&
(mRoleMapEntry->role == roles::GRAPHIC ||

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

@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _nsHyperTextAccessible_H_
#define _nsHyperTextAccessible_H_
#ifndef mozilla_a11y_HyperTextAccessible_h__
#define mozilla_a11y_HyperTextAccessible_h__
#include "nsIAccessibleText.h"
#include "nsIAccessibleHyperText.h"
@ -35,14 +35,14 @@ const PRUnichar kForcedNewLineChar = '\n';
/**
* Special Accessible that knows how contain both text and embedded objects
*/
class nsHyperTextAccessible : public AccessibleWrap,
public nsIAccessibleText,
public nsIAccessibleHyperText,
public nsIAccessibleEditableText
class HyperTextAccessible : public AccessibleWrap,
public nsIAccessibleText,
public nsIAccessibleHyperText,
public nsIAccessibleEditableText
{
public:
nsHyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~nsHyperTextAccessible() { }
HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
virtual ~HyperTextAccessible() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETEXT
@ -60,7 +60,7 @@ public:
virtual void InvalidateChildren();
virtual bool RemoveChild(Accessible* aAccessible);
// nsHyperTextAccessible (static helper method)
// HyperTextAccessible (static helper method)
// Convert content offset to rendered text offset
static nsresult ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
@ -107,7 +107,7 @@ public:
}
//////////////////////////////////////////////////////////////////////////////
// nsHyperTextAccessible: DOM point to text offset conversions.
// HyperTextAccessible: DOM point to text offset conversions.
/**
* Turn a DOM Node and offset into a character offset into this hypertext.
@ -121,7 +121,7 @@ public:
* if >=0 and aNode is text, this represents a char offset
* if >=0 and aNode is not text, this represents a child node offset
* @param aResultOffset - the character offset into the current
* nsHyperTextAccessible
* HyperTextAccessible
* @param aIsEndOffset - if true, then then this offset is not inclusive. The character
* indicated by the offset returned is at [offset - 1]. This means
* if the passed-in offset is really in a descendant, then the offset returned
@ -131,7 +131,7 @@ public:
* descendant, then the returned offset will be on the relevant embedded object char.
*
* @return the accessible child which contained the offset, if
* it is within the current nsHyperTextAccessible,
* it is within the current HyperTextAccessible,
* otherwise nsnull
*/
Accessible* DOMPointToHypertextOffset(nsINode *aNode,
@ -261,7 +261,7 @@ public:
virtual already_AddRefed<nsIEditor> GetEditor() const;
protected:
// nsHyperTextAccessible
// HyperTextAccessible
/**
* Transform magic offset into text offset.
@ -410,19 +410,19 @@ private:
nsTArray<PRUint32> mOffsets;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsHyperTextAccessible,
NS_DEFINE_STATIC_IID_ACCESSOR(HyperTextAccessible,
NS_HYPERTEXTACCESSIBLE_IMPL_CID)
////////////////////////////////////////////////////////////////////////////////
// Accessible downcasting method
inline nsHyperTextAccessible*
inline HyperTextAccessible*
Accessible::AsHyperText()
{
return mFlags & eHyperTextAccessible ?
static_cast<nsHyperTextAccessible*>(this) : nsnull;
static_cast<HyperTextAccessible*>(this) : nsnull;
}
#endif // _nsHyperTextAccessible_H_
#endif

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

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHTMLImageAccessible.h"
#include "ImageAccessible.h"
#include "nsAccUtils.h"
#include "Role.h"
@ -25,24 +25,24 @@
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLImageAccessible
// ImageAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLImageAccessible::
nsHTMLImageAccessible(nsIContent* aContent, DocAccessible* aDoc) :
ImageAccessible::
ImageAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsLinkableAccessible(aContent, aDoc)
{
mFlags |= eImageAccessible;
}
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLImageAccessible, Accessible,
NS_IMPL_ISUPPORTS_INHERITED1(ImageAccessible, Accessible,
nsIAccessibleImage)
////////////////////////////////////////////////////////////////////////////////
// Accessible public
PRUint64
nsHTMLImageAccessible::NativeState()
ImageAccessible::NativeState()
{
// The state is a bitfield, get our inherited state, then logically OR it with
// states::ANIMATED if this is an animated image.
@ -71,7 +71,7 @@ nsHTMLImageAccessible::NativeState()
}
nsresult
nsHTMLImageAccessible::GetNameInternal(nsAString& aName)
ImageAccessible::GetNameInternal(nsAString& aName)
{
bool hasAltAttrib =
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
@ -93,7 +93,7 @@ nsHTMLImageAccessible::GetNameInternal(nsAString& aName)
}
role
nsHTMLImageAccessible::NativeRole()
ImageAccessible::NativeRole()
{
return roles::GRAPHIC;
}
@ -102,14 +102,14 @@ nsHTMLImageAccessible::NativeRole()
// nsIAccessible
PRUint8
nsHTMLImageAccessible::ActionCount()
ImageAccessible::ActionCount()
{
PRUint8 actionCount = nsLinkableAccessible::ActionCount();
return HasLongDesc() ? actionCount + 1 : actionCount;
}
NS_IMETHODIMP
nsHTMLImageAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
ImageAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
aName.Truncate();
@ -124,7 +124,7 @@ nsHTMLImageAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
}
NS_IMETHODIMP
nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
ImageAccessible::DoAction(PRUint8 aIndex)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -149,15 +149,13 @@ nsHTMLImageAccessible::DoAction(PRUint8 aIndex)
nsCOMPtr<nsIDOMWindow> tmp;
return win->Open(spec, EmptyString(), EmptyString(),
getter_AddRefs(tmp));
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleImage
NS_IMETHODIMP
nsHTMLImageAccessible::GetImagePosition(PRUint32 aCoordType,
PRInt32 *aX, PRInt32 *aY)
ImageAccessible::GetImagePosition(PRUint32 aCoordType, PRInt32* aX, PRInt32* aY)
{
PRInt32 width, height;
nsresult rv = GetBounds(aX, aY, &width, &height);
@ -168,7 +166,7 @@ nsHTMLImageAccessible::GetImagePosition(PRUint32 aCoordType,
}
NS_IMETHODIMP
nsHTMLImageAccessible::GetImageSize(PRInt32 *aWidth, PRInt32 *aHeight)
ImageAccessible::GetImageSize(PRInt32* aWidth, PRInt32* aHeight)
{
PRInt32 x, y;
return GetBounds(&x, &y, aWidth, aHeight);
@ -176,11 +174,11 @@ nsHTMLImageAccessible::GetImageSize(PRInt32 *aWidth, PRInt32 *aHeight)
// Accessible
nsresult
nsHTMLImageAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
ImageAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = nsLinkableAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
@ -196,10 +194,10 @@ nsHTMLImageAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
// Private methods
already_AddRefed<nsIURI>
nsHTMLImageAccessible::GetLongDescURI() const
ImageAccessible::GetLongDescURI() const
{
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc)) {
nsGenericHTMLElement* element =
nsGenericHTMLElement* element =
nsGenericHTMLElement::FromContent(mContent);
if (element) {
nsCOMPtr<nsIURI> uri;
@ -228,7 +226,7 @@ nsHTMLImageAccessible::GetLongDescURI() const
}
bool
nsHTMLImageAccessible::IsLongDescIndex(PRUint8 aIndex)
ImageAccessible::IsLongDescIndex(PRUint8 aIndex)
{
return aIndex == nsLinkableAccessible::ActionCount();
}

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

@ -3,24 +3,27 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _nsHTMLImageAccessible_H_
#define _nsHTMLImageAccessible_H_
#ifndef mozilla_a11y_ImageAccessible_h__
#define mozilla_a11y_ImageAccessible_h__
#include "nsBaseWidgetAccessible.h"
#include "nsIAccessibleImage.h"
class nsGenericHTMLElement;
namespace mozilla {
namespace a11y {
/* Accessible for supporting images
* supports:
* - gets name, role
* - support basic state
*/
class nsHTMLImageAccessible : public nsLinkableAccessible,
public nsIAccessibleImage
class ImageAccessible : public nsLinkableAccessible,
public nsIAccessibleImage
{
public:
nsHTMLImageAccessible(nsIContent* aContent, DocAccessible* aDoc);
ImageAccessible(nsIContent* aContent, DocAccessible* aDoc);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -34,7 +37,7 @@ public:
// Accessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
@ -71,14 +74,17 @@ private:
};
} // namespace a11y
} // namespace mozilla
////////////////////////////////////////////////////////////////////////////////
// Accessible downcasting method
inline nsHTMLImageAccessible*
inline mozilla::a11y::ImageAccessible*
Accessible::AsImage()
{
return IsImage() ?
static_cast<nsHTMLImageAccessible*>(this) : nsnull;
static_cast<mozilla::a11y::ImageAccessible*>(this) : nsnull;
}
#endif

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

@ -20,10 +20,13 @@ CPPSRCS = \
ARIAGridAccessible.cpp \
DocAccessible.cpp \
FormControlAccessible.cpp \
HyperTextAccessible.cpp \
ImageAccessible.cpp \
OuterDocAccessible.cpp \
RootAccessible.cpp \
TextLeafAccessible.cpp \
$(NULL)
EXPORTS_NAMESPACES = mozilla/a11y
EXPORTS_mozilla/a11y = \
@ -40,6 +43,8 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../base \
-I$(srcdir)/../html \
-I$(srcdir)/../xul \
-I$(srcdir)/../../../content/base/src \
-I$(srcdir)/../../../content/html/content/src \
-I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \
$(NULL)

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

@ -124,10 +124,8 @@ OuterDocAccessible::Shutdown()
// the document doesn't get pagehide events. Shutdown underlying document if
// any to avoid hanging document accessible.
#ifdef DEBUG
if (logging::IsEnabled(logging::eDocDestroy)) {
logging::Msg("A11y outerdoc shutdown");
logging::Address("outerdoc", this);
}
if (logging::IsEnabled(logging::eDocDestroy))
logging::OuterDocDestroy(this);
#endif
Accessible* childAcc = mChildren.SafeElementAt(0, nsnull);
@ -135,7 +133,7 @@ OuterDocAccessible::Shutdown()
#ifdef DEBUG
if (logging::IsEnabled(logging::eDocDestroy)) {
logging::DocDestroy("outerdoc's child document shutdown",
childAcc->GetDocumentNode());
childAcc->GetDocumentNode());
}
#endif
childAcc->Shutdown();
@ -179,7 +177,7 @@ OuterDocAccessible::AppendChild(Accessible* aAccessible)
#ifdef DEBUG
if (logging::IsEnabled(logging::eDocCreate)) {
logging::DocCreate("append document to outerdoc",
aAccessible->GetDocumentNode());
aAccessible->GetDocumentNode());
logging::Address("outerdoc", this);
}
#endif
@ -199,7 +197,7 @@ OuterDocAccessible::RemoveChild(Accessible* aAccessible)
#ifdef DEBUG
if (logging::IsEnabled(logging::eDocDestroy)) {
logging::DocDestroy("remove document from outerdoc", child->GetDocumentNode(),
child->AsDoc());
child->AsDoc());
logging::Address("outerdoc", this);
}
#endif

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

@ -11,6 +11,7 @@
#include "nsIDOMDocument.h"
#include "Accessible-inl.h"
#include "DocAccessible-inl.h"
#include "nsAccessibilityService.h"
#include "nsAccUtils.h"
#include "nsCoreUtils.h"
@ -272,24 +273,15 @@ RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
if (document) {
#ifdef DEBUG_NOTIFICATIONS
if (origTargetNode->IsElement()) {
nsIContent* elm = origTargetNode->AsElement();
nsAutoString tag;
elm->Tag()->ToString(tag);
nsIAtom* atomid = elm->GetID();
nsCAutoString id;
if (atomid)
atomid->ToUTF8String(id);
#ifdef DEBUG
if (logging::IsEnabled(logging::eDOMEvents)) {
nsAutoString eventType;
aDOMEvent->GetType(eventType);
printf("\nPend DOM event processing for %s@id='%s', type: %s\n\n",
NS_ConvertUTF16toUTF8(tag).get(), id.get(),
NS_ConvertUTF16toUTF8(eventType).get());
logging::MsgBegin("DOMEvents", "event '%s' handled",
NS_ConvertUTF16toUTF8(eventType).get());
logging::Node("target", origTargetNode);
logging::MsgEnd();
}
#endif

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

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHTMLTextAccessible.h"
#include "HTMLElementAccessibles.h"
#include "DocAccessible.h"
#include "nsAccUtils.h"
@ -16,71 +16,52 @@
using namespace mozilla::a11y;
////////////////////////////////////////////////////////////////////////////////
// nsHTMLHRAccessible
// HTMLHRAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLHRAccessible::
nsHTMLHRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsLeafAccessible(aContent, aDoc)
{
}
role
nsHTMLHRAccessible::NativeRole()
HTMLHRAccessible::NativeRole()
{
return roles::SEPARATOR;
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLBRAccessible
// HTMLBRAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLBRAccessible::
nsHTMLBRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsLeafAccessible(aContent, aDoc)
{
}
role
nsHTMLBRAccessible::NativeRole()
HTMLBRAccessible::NativeRole()
{
return roles::WHITESPACE;
}
PRUint64
nsHTMLBRAccessible::NativeState()
HTMLBRAccessible::NativeState()
{
return states::READONLY;
}
nsresult
nsHTMLBRAccessible::GetNameInternal(nsAString& aName)
HTMLBRAccessible::GetNameInternal(nsAString& aName)
{
aName = static_cast<PRUnichar>('\n'); // Newline char
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsHTMLLabelAccessible
// HTMLLabelAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLLabelAccessible::
nsHTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
{
}
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
NS_IMPL_ISUPPORTS_INHERITED0(HTMLLabelAccessible, HyperTextAccessible)
nsresult
nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
HTMLLabelAccessible::GetNameInternal(nsAString& aName)
{
return nsTextEquivUtils::GetNameFromSubtree(this, aName);
}
role
nsHTMLLabelAccessible::NativeRole()
HTMLLabelAccessible::NativeRole()
{
return roles::LABEL;
}
@ -89,16 +70,10 @@ nsHTMLLabelAccessible::NativeRole()
// nsHTMLOuputAccessible
////////////////////////////////////////////////////////////////////////////////
nsHTMLOutputAccessible::
nsHTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
{
}
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLOutputAccessible, nsHyperTextAccessible)
NS_IMPL_ISUPPORTS_INHERITED0(HTMLOutputAccessible, HyperTextAccessible)
Relation
nsHTMLOutputAccessible::RelationByType(PRUint32 aType)
HTMLOutputAccessible::RelationByType(PRUint32 aType)
{
Relation rel = AccessibleWrap::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_CONTROLLED_BY)
@ -108,20 +83,20 @@ nsHTMLOutputAccessible::RelationByType(PRUint32 aType)
}
role
nsHTMLOutputAccessible::NativeRole()
HTMLOutputAccessible::NativeRole()
{
return roles::SECTION;
}
nsresult
nsHTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
HTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
{
nsresult rv = AccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::live,
NS_LITERAL_STRING("polite"));
return NS_OK;
}

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

@ -0,0 +1,83 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_a11y_HTMLElementAccessibles_h__
#define mozilla_a11y_HTMLElementAccessibles_h__
#include "nsAutoPtr.h"
#include "nsBaseWidgetAccessible.h"
namespace mozilla {
namespace a11y {
/**
* Used for HTML hr element.
*/
class HTMLHRAccessible : public nsLeafAccessible
{
public:
HTMLHRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsLeafAccessible(aContent, aDoc) {};
// Accessible
virtual a11y::role NativeRole();
};
/**
* Used for HTML br element.
*/
class HTMLBRAccessible : public nsLeafAccessible
{
public:
HTMLBRAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsLeafAccessible(aContent, aDoc) {};
// Accessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual a11y::role NativeRole();
virtual PRUint64 NativeState();
};
/**
* Used for HTML label element.
*/
class HTMLLabelAccessible : public HyperTextAccessibleWrap
{
public:
HTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc) :
HyperTextAccessibleWrap(aContent, aDoc) {};
NS_DECL_ISUPPORTS_INHERITED
// Accessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual a11y::role NativeRole();
};
/**
* Used for HTML output element.
*/
class HTMLOutputAccessible : public HyperTextAccessibleWrap
{
public:
HTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
HyperTextAccessibleWrap(aContent, aDoc) {};
NS_DECL_ISUPPORTS_INHERITED
// Accessible
virtual a11y::role NativeRole();
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
virtual Relation RelationByType(PRUint32 aType);
};
} // namespace a11y
} // namespace mozilla
#endif

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

@ -204,7 +204,7 @@ HTMLRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32* aPosInSet,
HTMLButtonAccessible::
HTMLButtonAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -237,7 +237,7 @@ HTMLButtonAccessible::DoAction(PRUint8 aIndex)
PRUint64
HTMLButtonAccessible::State()
{
PRUint64 state = nsHyperTextAccessibleWrap::State();
PRUint64 state = HyperTextAccessibleWrap::State();
if (state == states::DEFUNCT)
return state;
@ -256,7 +256,7 @@ HTMLButtonAccessible::State()
PRUint64
HTMLButtonAccessible::NativeState()
{
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
PRUint64 state = HyperTextAccessibleWrap::NativeState();
nsEventStates elmState = mContent->AsElement()->State();
if (elmState.HasState(NS_EVENT_STATE_DEFAULT))
@ -320,13 +320,13 @@ HTMLButtonAccessible::IsWidget() const
HTMLTextFieldAccessible::
HTMLTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
NS_IMPL_ISUPPORTS_INHERITED3(HTMLTextFieldAccessible,
Accessible,
nsHyperTextAccessible,
HyperTextAccessible,
nsIAccessibleText,
nsIAccessibleEditableText)
@ -393,7 +393,7 @@ HTMLTextFieldAccessible::Value(nsString& aValue)
void
HTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState) const
{
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
HyperTextAccessibleWrap::ApplyARIAState(aState);
aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
}
@ -401,7 +401,7 @@ HTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState) const
PRUint64
HTMLTextFieldAccessible::State()
{
PRUint64 state = nsHyperTextAccessibleWrap::State();
PRUint64 state = HyperTextAccessibleWrap::State();
if (state & states::DEFUNCT)
return state;
@ -420,7 +420,7 @@ HTMLTextFieldAccessible::State()
PRUint64
HTMLTextFieldAccessible::NativeState()
{
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
PRUint64 state = HyperTextAccessibleWrap::NativeState();
// can be focusable, focused, protected. readonly, unavailable, selected
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
@ -557,7 +557,7 @@ HTMLTextFieldAccessible::ContainerWidget() const
HTMLFileInputAccessible::
HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
mFlags |= eHTMLFileInputAccessible;
}
@ -573,7 +573,7 @@ HTMLFileInputAccessible::NativeRole()
nsresult
HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
{
nsresult rv = nsHyperTextAccessibleWrap::HandleAccEvent(aEvent);
nsresult rv = HyperTextAccessibleWrap::HandleAccEvent(aEvent);
NS_ENSURE_SUCCESS(rv, rv);
// Redirect state change events for inherited states to child controls. Note,
@ -612,7 +612,7 @@ HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
HTMLGroupboxAccessible::
HTMLGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -658,7 +658,7 @@ HTMLGroupboxAccessible::GetNameInternal(nsAString& aName)
Relation
HTMLGroupboxAccessible::RelationByType(PRUint32 aType)
{
Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
// No override for label, so use <legend> for this <fieldset>
if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
rel.AppendTarget(mDoc, GetLegend());
@ -672,14 +672,14 @@ HTMLGroupboxAccessible::RelationByType(PRUint32 aType)
HTMLLegendAccessible::
HTMLLegendAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
Relation
HTMLLegendAccessible::RelationByType(PRUint32 aType)
{
Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
return rel;
@ -702,14 +702,14 @@ HTMLLegendAccessible::NativeRole()
HTMLFigureAccessible::
HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
nsresult
HTMLFigureAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
{
nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
// Expose figure xml-role.
@ -727,7 +727,7 @@ HTMLFigureAccessible::NativeRole()
nsresult
HTMLFigureAccessible::GetNameInternal(nsAString& aName)
{
nsresult rv = nsHyperTextAccessibleWrap::GetNameInternal(aName);
nsresult rv = HyperTextAccessibleWrap::GetNameInternal(aName);
NS_ENSURE_SUCCESS(rv, rv);
if (!aName.IsEmpty())
@ -745,7 +745,7 @@ HTMLFigureAccessible::GetNameInternal(nsAString& aName)
Relation
HTMLFigureAccessible::RelationByType(PRUint32 aType)
{
Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_LABELLED_BY)
rel.AppendTarget(mDoc, Caption());
@ -772,7 +772,7 @@ HTMLFigureAccessible::Caption() const
HTMLFigcaptionAccessible::
HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -785,7 +785,7 @@ HTMLFigcaptionAccessible::NativeRole()
Relation
HTMLFigcaptionAccessible::RelationByType(PRUint32 aType)
{
Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
Relation rel = HyperTextAccessibleWrap::RelationByType(aType);
if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
return rel;

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

@ -7,7 +7,7 @@
#define MOZILLA_A11Y_HTMLFormControlAccessible_H_
#include "FormControlAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
namespace mozilla {
namespace a11y {
@ -64,7 +64,7 @@ public:
* Accessible for HTML input@type="button", @type="submit", @type="image"
* and HTML button elements.
*/
class HTMLButtonAccessible : public nsHyperTextAccessibleWrap
class HTMLButtonAccessible : public HyperTextAccessibleWrap
{
public:
@ -93,7 +93,7 @@ public:
/**
* Accessible for HTML input@type="text" element.
*/
class HTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
class HTMLTextFieldAccessible : public HyperTextAccessibleWrap
{
public:
@ -107,7 +107,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
// nsHyperTextAccessible
// HyperTextAccessible
virtual already_AddRefed<nsIEditor> GetEditor() const;
// Accessible
@ -130,7 +130,7 @@ public:
/**
* Accessible for input@type="file" element.
*/
class HTMLFileInputAccessible : public nsHyperTextAccessibleWrap
class HTMLFileInputAccessible : public HyperTextAccessibleWrap
{
public:
HTMLFileInputAccessible(nsIContent* aContent, DocAccessible* aDoc);
@ -143,7 +143,7 @@ public:
/**
* Accessible for HTML fieldset element.
*/
class HTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
class HTMLGroupboxAccessible : public HyperTextAccessibleWrap
{
public:
HTMLGroupboxAccessible(nsIContent* aContent, DocAccessible* aDoc);
@ -161,7 +161,7 @@ protected:
/**
* Accessible for HTML legend element.
*/
class HTMLLegendAccessible : public nsHyperTextAccessibleWrap
class HTMLLegendAccessible : public HyperTextAccessibleWrap
{
public:
HTMLLegendAccessible(nsIContent* aContent, DocAccessible* aDoc);
@ -174,7 +174,7 @@ public:
/**
* Accessible for HTML5 figure element.
*/
class HTMLFigureAccessible : public nsHyperTextAccessibleWrap
class HTMLFigureAccessible : public HyperTextAccessibleWrap
{
public:
HTMLFigureAccessible(nsIContent* aContent, DocAccessible* aDoc);
@ -193,7 +193,7 @@ protected:
/**
* Accessible for HTML5 figcaption element.
*/
class HTMLFigcaptionAccessible : public nsHyperTextAccessibleWrap
class HTMLFigcaptionAccessible : public HyperTextAccessibleWrap
{
public:
HTMLFigcaptionAccessible(nsIContent* aContent, DocAccessible* aDoc);

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

@ -20,7 +20,7 @@ using namespace mozilla::a11y;
// HTMLListAccessible
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED0(HTMLListAccessible, nsHyperTextAccessible)
NS_IMPL_ISUPPORTS_INHERITED0(HTMLListAccessible, HyperTextAccessible)
role
HTMLListAccessible::NativeRole()
@ -34,7 +34,7 @@ HTMLListAccessible::NativeRole()
PRUint64
HTMLListAccessible::NativeState()
{
return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
return HyperTextAccessibleWrap::NativeState() | states::READONLY;
}
@ -44,7 +44,7 @@ HTMLListAccessible::NativeState()
HTMLLIAccessible::
HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc), mBullet(nsnull)
HyperTextAccessibleWrap(aContent, aDoc), mBullet(nsnull)
{
mFlags |= eHTMLListItemAccessible;
@ -56,14 +56,14 @@ HTMLLIAccessible::
}
}
NS_IMPL_ISUPPORTS_INHERITED0(HTMLLIAccessible, nsHyperTextAccessible)
NS_IMPL_ISUPPORTS_INHERITED0(HTMLLIAccessible, HyperTextAccessible)
void
HTMLLIAccessible::Shutdown()
{
mBullet = nsnull;
nsHyperTextAccessibleWrap::Shutdown();
HyperTextAccessibleWrap::Shutdown();
}
role
@ -78,7 +78,7 @@ HTMLLIAccessible::NativeRole()
PRUint64
HTMLLIAccessible::NativeState()
{
return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
return HyperTextAccessibleWrap::NativeState() | states::READONLY;
}
NS_IMETHODIMP
@ -188,11 +188,7 @@ HTMLListBulletAccessible::NativeRole()
PRUint64
HTMLListBulletAccessible::NativeState()
{
PRUint64 state = nsLeafAccessible::NativeState();
state &= ~states::FOCUSABLE;
state |= states::READONLY;
return state;
return nsLeafAccessible::NativeState() | states::READONLY;
}
void

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

@ -7,7 +7,7 @@
#ifndef mozilla_a11y_HTMLListAccessible_h__
#define mozilla_a11y_HTMLListAccessible_h__
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "nsBaseWidgetAccessible.h"
namespace mozilla {
@ -18,11 +18,11 @@ class HTMLListBulletAccessible;
/**
* Used for HTML list (like HTML ul).
*/
class HTMLListAccessible : public nsHyperTextAccessibleWrap
class HTMLListAccessible : public HyperTextAccessibleWrap
{
public:
HTMLListAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc) { }
HyperTextAccessibleWrap(aContent, aDoc) { }
virtual ~HTMLListAccessible() { }
// nsISupports
@ -37,7 +37,7 @@ public:
/**
* Used for HTML list item (e.g. HTML li).
*/
class HTMLLIAccessible : public nsHyperTextAccessibleWrap
class HTMLLIAccessible : public HyperTextAccessibleWrap
{
public:
HTMLLIAccessible(nsIContent* aContent, DocAccessible* aDoc);

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

@ -17,20 +17,14 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
nsHTMLCanvasAccessible.cpp \
HTMLElementAccessibles.cpp \
HTMLFormControlAccessible.cpp \
HTMLListAccessible.cpp \
nsHTMLImageAccessible.cpp \
nsHTMLCanvasAccessible.cpp \
nsHTMLImageMapAccessible.cpp \
nsHTMLLinkAccessible.cpp \
nsHTMLSelectAccessible.cpp \
nsHTMLTableAccessible.cpp \
nsHTMLTextAccessible.cpp \
nsHyperTextAccessible.cpp \
$(NULL)
EXPORTS = \
nsHyperTextAccessible.h \
$(NULL)
# we don't want the shared lib, but we want to force the creation of a static lib.
@ -42,7 +36,6 @@ LOCAL_INCLUDES = \
-I$(srcdir)/../base \
-I$(srcdir)/../generic \
-I$(srcdir)/../xpcom \
-I$(srcdir)/../../../content/base/src \
-I$(srcdir)/../../../content/html/content/src \
-I$(srcdir)/../../../layout/generic \
-I$(srcdir)/../../../layout/xul/base/src \

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

@ -11,7 +11,7 @@ using namespace mozilla::a11y;
nsHTMLCanvasAccessible::
nsHTMLCanvasAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessible(aContent, aDoc)
HyperTextAccessible(aContent, aDoc)
{
}

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

@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#ifndef _nsHTMLCanvasAccessible_H_
#define _nsHTMLCanvasAccessible_H_
@ -11,7 +11,7 @@
/**
* HTML canvas accessible (html:canvas).
*/
class nsHTMLCanvasAccessible : public nsHyperTextAccessible
class nsHTMLCanvasAccessible : public HyperTextAccessible
{
public:
nsHTMLCanvasAccessible(nsIContent* aContent, DocAccessible* aDoc);

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

@ -26,7 +26,7 @@ using namespace mozilla::a11y;
nsHTMLImageMapAccessible::
nsHTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHTMLImageAccessibleWrap(aContent, aDoc)
ImageAccessibleWrap(aContent, aDoc)
{
mFlags |= eImageMapAccessible;
}
@ -34,7 +34,7 @@ nsHTMLImageMapAccessible::
////////////////////////////////////////////////////////////////////////////////
// nsHTMLImageMapAccessible: nsISupports
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, nsHTMLImageAccessible)
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, ImageAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsHTMLImageMapAccessible: Accessible public
@ -179,7 +179,7 @@ nsHTMLAreaAccessible::Description(nsString& aDescription)
// Still to do - follow IE's standard here
nsCOMPtr<nsIDOMHTMLAreaElement> area(do_QueryInterface(mContent));
if (area)
if (area)
area->GetShape(aDescription);
}

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

@ -6,15 +6,15 @@
#ifndef _nsHTMLAreaAccessible_H_
#define _nsHTMLAreaAccessible_H_
#include "ImageAccessibleWrap.h"
#include "nsHTMLLinkAccessible.h"
#include "nsHTMLImageAccessibleWrap.h"
#include "nsIDOMHTMLMapElement.h"
/**
* Used for HTML image maps.
*/
class nsHTMLImageMapAccessible : public nsHTMLImageAccessibleWrap
class nsHTMLImageMapAccessible : public mozilla::a11y::ImageAccessibleWrap
{
public:
nsHTMLImageMapAccessible(nsIContent* aContent, DocAccessible* aDoc);
@ -82,4 +82,4 @@ protected:
virtual void CacheChildren();
};
#endif
#endif

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

@ -22,12 +22,12 @@ using namespace mozilla::a11y;
nsHTMLLinkAccessible::
nsHTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
// Expose nsIAccessibleHyperLink unconditionally
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, HyperTextAccessibleWrap,
nsIAccessibleHyperLink)
////////////////////////////////////////////////////////////////////////////////
@ -42,18 +42,7 @@ nsHTMLLinkAccessible::NativeRole()
PRUint64
nsHTMLLinkAccessible::NativeState()
{
PRUint64 states = nsHyperTextAccessibleWrap::NativeState();
states &= ~states::READONLY;
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::name)) {
// This is how we indicate it is a named anchor
// In other words, this anchor can be selected as a location :)
// There is no other better state to use to indicate this.
states |= states::SELECTABLE;
}
return states;
return HyperTextAccessibleWrap::NativeState() & ~states::READONLY;
}
PRUint64
@ -72,12 +61,26 @@ nsHTMLLinkAccessible::NativeLinkState() const
return nsCoreUtils::HasClickListener(mContent) ? states::LINKED : 0;
}
PRUint64
nsHTMLLinkAccessible::NativeInteractiveState() const
{
PRUint64 state = HyperTextAccessibleWrap::NativeInteractiveState();
// This is how we indicate it is a named anchor. In other words, this anchor
// can be selected as a location :) There is no other better state to use to
// indicate this.
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::name))
state |= states::SELECTABLE;
return state;
}
void
nsHTMLLinkAccessible::Value(nsString& aValue)
{
aValue.Truncate();
nsHyperTextAccessible::Value(aValue);
HyperTextAccessible::Value(aValue);
if (aValue.IsEmpty())
nsContentUtils::GetLinkLocation(mContent->AsElement(), aValue);
}
@ -85,7 +88,7 @@ nsHTMLLinkAccessible::Value(nsString& aValue)
PRUint8
nsHTMLLinkAccessible::ActionCount()
{
return IsLinked() ? 1 : nsHyperTextAccessible::ActionCount();
return IsLinked() ? 1 : HyperTextAccessible::ActionCount();
}
NS_IMETHODIMP
@ -94,7 +97,7 @@ nsHTMLLinkAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
aName.Truncate();
if (!IsLinked())
return nsHyperTextAccessible::GetActionName(aIndex, aName);
return HyperTextAccessible::GetActionName(aIndex, aName);
// Action 0 (default action): Jump to link
if (aIndex != eAction_Jump)
@ -108,7 +111,7 @@ NS_IMETHODIMP
nsHTMLLinkAccessible::DoAction(PRUint8 aIndex)
{
if (!IsLinked())
return nsHyperTextAccessible::DoAction(aIndex);
return HyperTextAccessible::DoAction(aIndex);
// Action 0 (default action): Jump to link
if (aIndex != eAction_Jump)

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

@ -6,9 +6,9 @@
#ifndef _nsHTMLLinkAccessible_H_
#define _nsHTMLLinkAccessible_H_
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
class nsHTMLLinkAccessible : public nsHyperTextAccessibleWrap
class nsHTMLLinkAccessible : public HyperTextAccessibleWrap
{
public:
nsHTMLLinkAccessible(nsIContent* aContent, DocAccessible* aDoc);
@ -24,6 +24,7 @@ public:
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeLinkState() const;
virtual PRUint64 NativeInteractiveState() const;
// ActionAccessible
virtual PRUint8 ActionCount();

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

@ -174,7 +174,7 @@ nsHTMLSelectListAccessible::CacheOptSiblings(nsIContent *aParentContent)
nsHTMLSelectOptionAccessible::
nsHTMLSelectOptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -225,7 +225,7 @@ nsHTMLSelectOptionAccessible::NativeState()
{
// As a nsHTMLSelectOptionAccessible we can have the following states:
// SELECTABLE, SELECTED, FOCUSED, FOCUSABLE, OFFSCREEN
// Upcall to Accessible, but skip nsHyperTextAccessible impl
// Upcall to Accessible, but skip HyperTextAccessible impl
// because we don't want EDITABLE or SELECTABLE_TEXT
PRUint64 state = Accessible::NativeState();
@ -237,10 +237,6 @@ nsHTMLSelectOptionAccessible::NativeState()
if (selectState & states::INVISIBLE)
return state;
// Focusable and selectable
if (!(state & states::UNAVAILABLE))
state |= (states::FOCUSABLE | states::SELECTABLE);
// Are we selected?
bool isSelected = false;
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mContent));
@ -285,6 +281,13 @@ nsHTMLSelectOptionAccessible::NativeState()
return state;
}
PRUint64
nsHTMLSelectOptionAccessible::NativeInteractiveState() const
{
return NativelyUnavailable() ?
states::UNAVAILABLE : states::FOCUSABLE | states::SELECTABLE;
}
PRInt32
nsHTMLSelectOptionAccessible::GetLevelInternal()
{
@ -307,7 +310,7 @@ nsHTMLSelectOptionAccessible::GetBoundsRect(nsRect& aTotalBounds,
if (combobox && (combobox->State() & states::COLLAPSED))
combobox->GetBoundsRect(aTotalBounds, aBoundingFrame);
else
nsHyperTextAccessibleWrap::GetBoundsRect(aTotalBounds, aBoundingFrame);
HyperTextAccessibleWrap::GetBoundsRect(aTotalBounds, aBoundingFrame);
}
/** select us! close combo box if necessary*/
@ -376,13 +379,9 @@ nsHTMLSelectOptGroupAccessible::NativeRole()
}
PRUint64
nsHTMLSelectOptGroupAccessible::NativeState()
nsHTMLSelectOptGroupAccessible::NativeInteractiveState() const
{
PRUint64 state = nsHTMLSelectOptionAccessible::NativeState();
state &= ~(states::FOCUSABLE | states::SELECTABLE);
return state;
return NativelyUnavailable() ? states::UNAVAILABLE : 0;
}
NS_IMETHODIMP nsHTMLSelectOptGroupAccessible::DoAction(PRUint8 index)

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

@ -69,7 +69,7 @@ protected:
/*
* Options inside the select, contained within the list
*/
class nsHTMLSelectOptionAccessible : public nsHyperTextAccessibleWrap
class nsHTMLSelectOptionAccessible : public HyperTextAccessibleWrap
{
public:
enum { eAction_Select = 0 };
@ -86,6 +86,7 @@ public:
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
virtual PRInt32 GetLevelInternal();
virtual void GetBoundsRect(nsRect& aTotalBounds, nsIFrame** aBoundingFrame);
@ -141,7 +142,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
// ActionAccessible
virtual PRUint8 ActionCount();

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

@ -44,7 +44,7 @@ using namespace mozilla::a11y;
nsHTMLTableCellAccessible::
nsHTMLTableCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -52,7 +52,7 @@ nsHTMLTableCellAccessible::
// nsHTMLTableCellAccessible: nsISupports implementation
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible,
nsHyperTextAccessible,
HyperTextAccessible,
nsIAccessibleTableCell)
////////////////////////////////////////////////////////////////////////////////
@ -67,27 +67,30 @@ nsHTMLTableCellAccessible::NativeRole()
PRUint64
nsHTMLTableCellAccessible::NativeState()
{
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
PRUint64 state = HyperTextAccessibleWrap::NativeState();
nsIFrame *frame = mContent->GetPrimaryFrame();
NS_ASSERTION(frame, "No frame for valid cell accessible!");
if (frame) {
state |= states::SELECTABLE;
if (frame->IsSelected())
state |= states::SELECTED;
}
if (frame && frame->IsSelected())
state |= states::SELECTED;
return state;
}
PRUint64
nsHTMLTableCellAccessible::NativeInteractiveState() const
{
return HyperTextAccessibleWrap::NativeInteractiveState() | states::SELECTABLE;
}
nsresult
nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
nsresult rv = HyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
// table-cell-index attribute
@ -1512,7 +1515,7 @@ nsHTMLTableAccessible::IsProbablyLayoutTable()
Relation
nsHTMLCaptionAccessible::RelationByType(PRUint32 aType)
{
Relation rel = nsHyperTextAccessible::RelationByType(aType);
Relation rel = HyperTextAccessible::RelationByType(aType);
if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR)
rel.AppendTarget(Parent());

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

@ -6,7 +6,7 @@
#ifndef _nsHTMLTableAccessible_H_
#define _nsHTMLTableAccessible_H_
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "nsIAccessibleTable.h"
#include "TableAccessible.h"
#include "xpcAccessibleTable.h"
@ -17,7 +17,7 @@ class nsITableCellLayout;
/**
* HTML table cell accessible (html:td).
*/
class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap,
class nsHTMLTableCellAccessible : public HyperTextAccessibleWrap,
public nsIAccessibleTableCell
{
public:
@ -32,6 +32,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
protected:
@ -178,11 +179,11 @@ protected:
/**
* HTML caption accessible (html:caption).
*/
class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
class nsHTMLCaptionAccessible : public HyperTextAccessibleWrap
{
public:
nsHTMLCaptionAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc) { }
HyperTextAccessibleWrap(aContent, aDoc) { }
virtual ~nsHTMLCaptionAccessible() { }
// nsIAccessible

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

@ -1,69 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _nsHTMLTextAccessible_H_
#define _nsHTMLTextAccessible_H_
#include "nsAutoPtr.h"
#include "nsBaseWidgetAccessible.h"
/**
* Used for HTML hr element.
*/
class nsHTMLHRAccessible : public nsLeafAccessible
{
public:
nsHTMLHRAccessible(nsIContent* aContent, DocAccessible* aDoc);
// Accessible
virtual mozilla::a11y::role NativeRole();
};
/**
* Used for HTML br element.
*/
class nsHTMLBRAccessible : public nsLeafAccessible
{
public:
nsHTMLBRAccessible(nsIContent* aContent, DocAccessible* aDoc);
// Accessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
};
/**
* Used for HTML label element.
*/
class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
{
public:
nsHTMLLabelAccessible(nsIContent* aContent, DocAccessible* aDoc);
NS_DECL_ISUPPORTS_INHERITED
// Accessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
};
/**
* Used for HTML output element.
*/
class nsHTMLOutputAccessible : public nsHyperTextAccessibleWrap
{
public:
nsHTMLOutputAccessible(nsIContent* aContent, DocAccessible* aDoc);
NS_DECL_ISUPPORTS_INHERITED
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
virtual Relation RelationByType(PRUint32 aType);
};
#endif

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

@ -351,6 +351,11 @@ var AccessFu = {
}
break;
}
case Ci.nsIAccessibleEvent.EVENT_SCROLLING_START:
{
VirtualCursorController.moveCursorToObject(aEvent.accessible);
break;
}
default:
break;
}

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

@ -165,6 +165,22 @@ var VirtualCursorController = {
QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
},
moveCursorToObject: function moveCursorToObject(aAccessible, aRule) {
let doc = aAccessible.document;
while (doc) {
let vc = null;
try {
vc = doc.QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
} catch (x) {
doc = doc.parentDocument;
continue;
}
if (vc)
vc.moveNext(aRule || this.SimpleTraversalRule, aAccessible, true);
break;
}
},
SimpleTraversalRule: {
getMatchRoles: function SimpleTraversalRule_getmatchRoles(aRules) {
aRules.value = this._matchRoles;

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

@ -3,12 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHYPERTEXTACCESSIBLEWRAP_H
#define _NSHYPERTEXTACCESSIBLEWRAP_H
#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
#define mozilla_a11y_HyperTextAccessibleWrap_h__
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
typedef class HyperTextAccessible HyperTextAccessibleWrap;
#endif

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

@ -5,12 +5,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHTMLIMAGEACCESSIBLEWRAP_H
#define _NSHTMLIMAGEACCESSIBLEWRAP_H
#ifndef mozilla_a11y_ImageAccessibleWrap_h__
#define mozilla_a11y_ImageAccessibleWrap_h__
#include "nsHTMLImageAccessible.h"
#include "ImageAccessible.h"
typedef class nsHTMLImageAccessible nsHTMLImageAccessibleWrap;
namespace mozilla {
namespace a11y {
typedef class ImageAccessible ImageAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif

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

@ -556,12 +556,12 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
- (BOOL)isFocused
{
return (mGeckoAccessible->State() & states::FOCUSED) != 0;
return FocusMgr()->IsFocused(mGeckoAccessible);
}
- (BOOL)canBeFocused
{
return mGeckoAccessible->State() & states::FOCUSABLE;
return mGeckoAccessible->InteractiveState() & states::FOCUSABLE;
}
- (BOOL)focus
@ -572,7 +572,7 @@ GetNativeFromGeckoAccessible(nsIAccessible *anAccessible)
- (BOOL)isEnabled
{
return (mGeckoAccessible->State() & states::UNAVAILABLE) == 0;
return (mGeckoAccessible->InteractiveState() & states::UNAVAILABLE) == 0;
}
// The root accessible calls this when the focused node was

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

@ -7,7 +7,7 @@
#import "mozHTMLAccessible.h"
#import "nsHyperTextAccessible.h"
#import "HyperTextAccessible.h"
#import "nsCocoaUtils.h"

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

@ -4,13 +4,13 @@
#import "mozAccessible.h"
#import "nsHyperTextAccessible.h"
#import "HyperTextAccessible.h"
@interface mozTextAccessible : mozAccessible
{
// both of these are the same old mGeckoAccessible, but already
// QI'd for us, to the right type, for convenience.
nsHyperTextAccessible *mGeckoTextAccessible; // strong
HyperTextAccessible *mGeckoTextAccessible; // strong
nsIAccessibleEditableText *mGeckoEditableTextAccessible; // strong
}
@end

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

@ -30,6 +30,6 @@ NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridCellAccessibleWrap,
ARIAGridCellAccessible)
IMPL_IUNKNOWN_INHERITED1(ARIAGridCellAccessibleWrap,
nsHyperTextAccessibleWrap,
HyperTextAccessibleWrap,
CAccessibleTableCell)

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

@ -8,7 +8,7 @@
#include "CAccessibleEditableText.h"
#include "AccessibleEditableText_i.c"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -38,7 +38,7 @@ STDMETHODIMP
CAccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -53,7 +53,7 @@ STDMETHODIMP
CAccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -68,7 +68,7 @@ STDMETHODIMP
CAccessibleEditableText::insertText(long aOffset, BSTR *aText)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -86,7 +86,7 @@ STDMETHODIMP
CAccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -101,7 +101,7 @@ STDMETHODIMP
CAccessibleEditableText::pasteText(long aOffset)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -117,7 +117,7 @@ CAccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
BSTR *aText)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;

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

@ -10,7 +10,7 @@
#include "Accessible2.h"
#include "AccessibleText_i.c"
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "nsIPersistentProperties2.h"
@ -40,7 +40,7 @@ STDMETHODIMP
CAccessibleText::addSelection(long aStartOffset, long aEndOffset)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -63,7 +63,7 @@ __try {
*aEndOffset = 0;
*aTextAttributes = NULL;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -95,7 +95,7 @@ CAccessibleText::get_caretOffset(long *aOffset)
__try {
*aOffset = -1;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -123,7 +123,7 @@ __try {
*aWidth = 0;
*aHeight = 0;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -153,7 +153,7 @@ CAccessibleText::get_nSelections(long *aNSelections)
__try {
*aNSelections = 0;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -177,7 +177,7 @@ CAccessibleText::get_offsetAtPoint(long aX, long aY,
__try {
*aOffset = 0;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -205,7 +205,7 @@ __try {
*aStartOffset = 0;
*aEndOffset = 0;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -229,7 +229,7 @@ CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
__try {
*aText = NULL;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -259,7 +259,7 @@ __try {
*aEndOffset = 0;
*aText = NULL;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -306,7 +306,7 @@ __try {
*aEndOffset = 0;
*aText = NULL;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -353,7 +353,7 @@ __try {
*aEndOffset = 0;
*aText = NULL;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -393,7 +393,7 @@ STDMETHODIMP
CAccessibleText::removeSelection(long aSelectionIndex)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -408,7 +408,7 @@ STDMETHODIMP
CAccessibleText::setCaretOffset(long aOffset)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -424,7 +424,7 @@ CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
long aEndOffset)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -442,7 +442,7 @@ CAccessibleText::get_nCharacters(long *aNCharacters)
__try {
*aNCharacters = 0;
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -458,7 +458,7 @@ CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
enum IA2ScrollType aScrollType)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -475,7 +475,7 @@ CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
long aX, long aY)
{
__try {
nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
nsRefPtr<HyperTextAccessible> textAcc(do_QueryObject(this));
if (textAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;

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

@ -67,7 +67,7 @@ DocAccessibleWrap::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_ISimpleDOMDocument != iid)
return nsHyperTextAccessibleWrap::QueryInterface(iid, ppv);
return HyperTextAccessibleWrap::QueryInterface(iid, ppv);
statistics::ISimpleDOMUsed();
*ppv = static_cast<ISimpleDOMDocument*>(this);

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

@ -5,20 +5,20 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "nsEventShell.h"
NS_IMPL_ISUPPORTS_INHERITED0(nsHyperTextAccessibleWrap,
nsHyperTextAccessible)
NS_IMPL_ISUPPORTS_INHERITED0(HyperTextAccessibleWrap,
HyperTextAccessible)
IMPL_IUNKNOWN_INHERITED2(nsHyperTextAccessibleWrap,
IMPL_IUNKNOWN_INHERITED2(HyperTextAccessibleWrap,
AccessibleWrap,
ia2AccessibleHypertext,
CAccessibleEditableText);
nsresult
nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
PRUint32 eventType = aEvent->GetEventType();
@ -41,14 +41,14 @@ nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
}
}
return nsHyperTextAccessible::HandleAccEvent(aEvent);
return HyperTextAccessible::HandleAccEvent(aEvent);
}
nsresult
nsHyperTextAccessibleWrap::GetModifiedText(bool aGetInsertedText,
nsAString& aText,
PRUint32 *aStartOffset,
PRUint32 *aEndOffset)
HyperTextAccessibleWrap::GetModifiedText(bool aGetInsertedText,
nsAString& aText,
PRUint32* aStartOffset,
PRUint32* aEndOffset)
{
aText.Truncate();
*aStartOffset = 0;

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

@ -5,21 +5,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHYPERTEXTACCESSIBLEWRAP_H
#define _NSHYPERTEXTACCESSIBLEWRAP_H
#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
#define mozilla_a11y_HyperTextAccessibleWrap_h__
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
#include "CAccessibleText.h"
#include "CAccessibleEditableText.h"
#include "ia2AccessibleHyperText.h"
class nsHyperTextAccessibleWrap : public nsHyperTextAccessible,
public ia2AccessibleHypertext,
public CAccessibleEditableText
class HyperTextAccessibleWrap : public HyperTextAccessible,
public ia2AccessibleHypertext,
public CAccessibleEditableText
{
public:
nsHyperTextAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessible(aContent, aDoc) {}
HyperTextAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
HyperTextAccessible(aContent, aDoc) {}
// IUnknown
DECL_IUNKNOWN_INHERITED

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

@ -5,12 +5,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsHTMLImageAccessibleWrap.h"
#include "ImageAccessibleWrap.h"
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageAccessibleWrap,
nsHTMLImageAccessible)
using namespace mozilla;
using namespace mozilla::a11y;
IMPL_IUNKNOWN_INHERITED1(nsHTMLImageAccessibleWrap,
NS_IMPL_ISUPPORTS_INHERITED0(ImageAccessibleWrap,
ImageAccessible)
IMPL_IUNKNOWN_INHERITED1(ImageAccessibleWrap,
AccessibleWrap,
ia2AccessibleImage);

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

@ -5,18 +5,21 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHTMLIMAGEACCESSIBLEWRAP_H
#define _NSHTMLIMAGEACCESSIBLEWRAP_H
#ifndef mozilla_a11y_ImageAccessibleWrap_h__
#define mozilla_a11y_ImageAccessibleWrap_h__
#include "nsHTMLImageAccessible.h"
#include "ImageAccessible.h"
#include "ia2AccessibleImage.h"
class nsHTMLImageAccessibleWrap : public nsHTMLImageAccessible,
public ia2AccessibleImage
namespace mozilla {
namespace a11y {
class ImageAccessibleWrap : public ImageAccessible,
public ia2AccessibleImage
{
public:
nsHTMLImageAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
nsHTMLImageAccessible(aContent, aDoc) {}
ImageAccessibleWrap(nsIContent* aContent, DocAccessible* aDoc) :
ImageAccessible(aContent, aDoc) {}
// IUnknown
DECL_IUNKNOWN_INHERITED
@ -25,5 +28,8 @@ public:
NS_DECL_ISUPPORTS_INHERITED
};
} // namespace a11y
} // namespace mozilla
#endif

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

@ -20,13 +20,13 @@ CPPSRCS = \
ApplicationAccessibleWrap.cpp \
ARIAGridAccessibleWrap.cpp \
DocAccessibleWrap.cpp \
HyperTextAccessibleWrap.cpp \
ImageAccessibleWrap.cpp \
nsAccessNodeWrap.cpp \
nsHTMLWin32ObjectAccessible.cpp \
nsXULMenuAccessibleWrap.cpp \
nsXULListboxAccessibleWrap.cpp \
nsXULTreeGridAccessibleWrap.cpp \
nsHyperTextAccessibleWrap.cpp \
nsHTMLImageAccessibleWrap.cpp \
nsHTMLTableAccessibleWrap.cpp \
nsWinUtils.cpp \
CAccessibleText.cpp \

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

@ -9,7 +9,7 @@
#include "AccessibleHypertext_i.c"
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
// IUnknown
@ -18,7 +18,7 @@ ia2AccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleHypertext == iid) {
nsHyperTextAccessibleWrap* hyperAcc = static_cast<nsHyperTextAccessibleWrap*>(this);
HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperAcc->IsTextRole()) {
*ppv = static_cast<IAccessibleHypertext*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
@ -38,7 +38,7 @@ ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
__try {
*aHyperlinkCount = 0;
nsHyperTextAccessibleWrap* hyperText = static_cast<nsHyperTextAccessibleWrap*>(this);
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -56,7 +56,7 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
__try {
*aHyperlink = NULL;
nsHyperTextAccessibleWrap* hyperText = static_cast<nsHyperTextAccessibleWrap*>(this);
HyperTextAccessibleWrap* hyperText = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperText->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -84,7 +84,7 @@ ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkInde
__try {
*aHyperlinkIndex = 0;
nsHyperTextAccessibleWrap* hyperAcc = static_cast<nsHyperTextAccessibleWrap*>(this);
HyperTextAccessibleWrap* hyperAcc = static_cast<HyperTextAccessibleWrap*>(this);
if (hyperAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;

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

@ -9,8 +9,7 @@
#include "AccessibleImage_i.c"
#include "nsHTMLImageAccessibleWrap.h"
#include "nsHTMLImageAccessible.h"
#include "ImageAccessibleWrap.h"
#include "nsIAccessible.h"
#include "nsIAccessibleImage.h"
@ -19,6 +18,9 @@
#include "nsString.h"
using namespace mozilla;
using namespace mozilla::a11y;
// IUnknown
STDMETHODIMP
@ -43,8 +45,7 @@ ia2AccessibleImage::get_description(BSTR* aDescription)
__try {
*aDescription = NULL;
nsHTMLImageAccessibleWrap* acc =
static_cast<nsHTMLImageAccessibleWrap*>(this);
ImageAccessibleWrap* acc = static_cast<ImageAccessibleWrap*>(this);
if (acc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -72,8 +73,7 @@ __try {
*aX = 0;
*aY = 0;
nsHTMLImageAccessibleWrap* imageAcc =
static_cast<nsHTMLImageAccessibleWrap*>(this);
ImageAccessibleWrap* imageAcc = static_cast<ImageAccessibleWrap*>(this);
if (imageAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;
@ -102,8 +102,7 @@ __try {
*aHeight = 0;
*aWidth = 0;
nsHTMLImageAccessibleWrap* imageAcc =
static_cast<nsHTMLImageAccessibleWrap*>(this);
ImageAccessibleWrap* imageAcc = static_cast<ImageAccessibleWrap*>(this);
if (imageAcc->IsDefunct())
return CO_E_OBJNOTCONNECTED;

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

@ -132,7 +132,7 @@ protected:
ISimpleDOMNode *MakeAccessNode(nsINode *aNode);
/**
* It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
* It is used in HyperTextAccessibleWrap for IA2::newText/oldText
* implementation.
*/
static AccTextChangeEvent* gTextEvent;

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

@ -27,7 +27,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableCellAccessibleWrap,
nsHTMLTableCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsHTMLTableCellAccessibleWrap,
nsHyperTextAccessibleWrap,
HyperTextAccessibleWrap,
CAccessibleTableCell)
@ -39,5 +39,5 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeaderCellAccessibleWrap,
nsHTMLTableHeaderCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsHTMLTableHeaderCellAccessibleWrap,
nsHyperTextAccessibleWrap,
HyperTextAccessibleWrap,
CAccessibleTableCell)

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

@ -42,12 +42,12 @@ nsHTMLWin32ObjectOwnerAccessible::NativeRole()
return roles::EMBEDDED_OBJECT;
}
PRUint64
nsHTMLWin32ObjectOwnerAccessible::NativeState()
bool
nsHTMLWin32ObjectOwnerAccessible::NativelyUnavailable() const
{
// XXX: No HWND means this is windowless plugin which is not accessible in
// the meantime.
return mHwnd ? AccessibleWrap::NativeState() : states::UNAVAILABLE;
return !mHwnd;
}
////////////////////////////////////////////////////////////////////////////////

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

@ -28,7 +28,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual bool NativelyUnavailable() const;
protected:

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

@ -38,5 +38,5 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsXULListCellAccessibleWrap,
nsXULListCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsXULListCellAccessibleWrap,
nsHyperTextAccessibleWrap,
HyperTextAccessibleWrap,
CAccessibleTableCell)

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

@ -3,12 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHYPERTEXTACCESSIBLEWRAP_H
#define _NSHYPERTEXTACCESSIBLEWRAP_H
#ifndef mozilla_a11y_HyperTextAccessibleWrap_h__
#define mozilla_a11y_HyperTextAccessibleWrap_h__
#include "nsHyperTextAccessible.h"
#include "HyperTextAccessible.h"
typedef class nsHyperTextAccessible nsHyperTextAccessibleWrap;
typedef class HyperTextAccessible HyperTextAccessibleWrap;
#endif

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

@ -5,12 +5,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef _NSHTMLIMAGEACCESSIBLEWRAP_H
#define _NSHTMLIMAGEACCESSIBLEWRAP_H
#ifndef mozilla_a11y_ImageAccessibleWrap_h__
#define mozilla_a11y_ImageAccessibleWrap_h__
#include "nsHTMLImageAccessible.h"
#include "ImageAccessible.h"
typedef class nsHTMLImageAccessible nsHTMLImageAccessibleWrap;
namespace mozilla {
namespace a11y {
typedef class ImageAccessible ImageAccessibleWrap;
} // namespace a11y
} // namespace mozilla
#endif

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

@ -48,7 +48,7 @@ nsXFormsAccessibleBase::nsXFormsAccessibleBase()
nsXFormsAccessible::
nsXFormsAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -119,12 +119,8 @@ nsXFormsAccessible::NativeState()
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
bool isRelevant = false;
nsresult rv = sXFormsService->IsRelevant(DOMNode, &isRelevant);
NS_ENSURE_SUCCESS(rv, 0);
bool isReadonly = false;
rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
nsresult rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
NS_ENSURE_SUCCESS(rv, 0);
bool isRequired = false;
@ -135,9 +131,9 @@ nsXFormsAccessible::NativeState()
rv = sXFormsService->IsValid(DOMNode, &isValid);
NS_ENSURE_SUCCESS(rv, 0);
PRUint64 states = nsHyperTextAccessibleWrap::NativeState();
PRUint64 states = HyperTextAccessibleWrap::NativeState();
if (!isRelevant)
if (NativelyUnavailable())
states |= states::UNAVAILABLE;
if (isReadonly)
@ -152,6 +148,16 @@ nsXFormsAccessible::NativeState()
return states;
}
bool
nsXFormsAccessible::NativelyUnavailable() const
{
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
bool isRelevant = false;
sXFormsService->IsRelevant(DOMNode, &isRelevant);
return !isRelevant;
}
nsresult
nsXFormsAccessible::GetNameInternal(nsAString& aName)
{

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

@ -6,7 +6,7 @@
#ifndef _nsXFormsAccessible_H_
#define _nsXFormsAccessible_H_
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "nsIXFormsUtilityService.h"
#define NS_NAMESPACE_XFORMS "http://www.w3.org/2002/xforms"
@ -33,7 +33,7 @@ protected:
* XForms hint and XForms label elements should have accessible object. This
* class is base class for accessible objects for these XForms elements.
*/
class nsXFormsAccessible : public nsHyperTextAccessibleWrap,
class nsXFormsAccessible : public HyperTextAccessibleWrap,
public nsXFormsAccessibleBase
{
public:
@ -52,6 +52,7 @@ public:
// Returns state of xforms element taking into account state of instance node
// that it is bound to.
virtual PRUint64 NativeState();
virtual bool NativelyUnavailable() const;
// Denies accessible nodes in anonymous content of xforms element by
// always returning false value.
@ -109,7 +110,7 @@ class nsXFormsEditableAccessible : public nsXFormsAccessible
public:
nsXFormsEditableAccessible(nsIContent* aContent, DocAccessible* aDoc);
// nsHyperTextAccessible
// HyperTextAccessible
virtual already_AddRefed<nsIEditor> GetEditor() const;
// Accessible

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

@ -119,7 +119,11 @@ nsXFormsInputAccessible::
{
}
NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, Accessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible,
Accessible,
HyperTextAccessible,
nsIAccessibleText,
nsIAccessibleEditableText)
role
nsXFormsInputAccessible::NativeRole()
@ -551,7 +555,13 @@ nsXFormsSelectComboboxAccessible::NativeState()
else
state |= states::COLLAPSED;
return state | states::HASPOPUP | states::FOCUSABLE;
return state | states::HASPOPUP;
}
PRUint64
nsXFormsSelectComboboxAccessible::NativeInteractiveState() const
{
return NativelyUnavailable() ? states::UNAVAILABLE : states::FOCUSABLE;
}
bool
@ -581,17 +591,19 @@ PRUint64
nsXFormsItemComboboxAccessible::NativeState()
{
PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
if (state & states::UNAVAILABLE)
return state;
state |= states::SELECTABLE;
if (IsSelected())
state |= states::SELECTED;
return state;
}
PRUint64
nsXFormsItemComboboxAccessible::NativeInteractiveState() const
{
return NativelyUnavailable() ?
states::UNAVAILABLE : states::FOCUSABLE | states::SELECTABLE;
}
NS_IMETHODIMP
nsXFormsItemComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{

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

@ -261,6 +261,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
virtual bool CanHaveAnonChildren();
};
@ -283,6 +284,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
};
#endif

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

@ -119,8 +119,6 @@ nsXFormsComboboxPopupWidgetAccessible::NativeState()
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
NS_ENSURE_SUCCESS(rv, state);
state |= states::FOCUSABLE;
if (isOpen)
state = states::FLOATING;
else
@ -129,6 +127,12 @@ nsXFormsComboboxPopupWidgetAccessible::NativeState()
return state;
}
PRUint64
nsXFormsComboboxPopupWidgetAccessible::NativeInteractiveState() const
{
return NativelyUnavailable() ? states::UNAVAILABLE : states::FOCUSABLE;
}
nsresult
nsXFormsComboboxPopupWidgetAccessible::GetNameInternal(nsAString& aName)
{

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

@ -64,6 +64,7 @@ public:
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
protected:
// Accessible

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

@ -95,16 +95,6 @@ XULButtonAccessible::NativeState()
// get focus and disable status from base class
PRUint64 state = Accessible::NativeState();
bool disabled = false;
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mContent));
if (xulFormElement) {
xulFormElement->GetDisabled(&disabled);
if (disabled)
state |= states::UNAVAILABLE;
else
state |= states::FOCUSABLE;
}
// Buttons can be checked -- they simply appear pressed in rather than checked
nsCOMPtr<nsIDOMXULButtonElement> xulButtonElement(do_QueryInterface(mContent));
if (xulButtonElement) {
@ -481,9 +471,6 @@ XULRadioButtonAccessible::NativeState()
PRUint64 state = nsLeafAccessible::NativeState();
state |= states::CHECKABLE;
if (!(state & states::UNAVAILABLE))
state |= states::FOCUSABLE;
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton =
do_QueryInterface(mContent);
if (radioButton) {
@ -497,6 +484,12 @@ XULRadioButtonAccessible::NativeState()
return state;
}
PRUint64
XULRadioButtonAccessible::NativeInteractiveState() const
{
return NativelyUnavailable() ? states::UNAVAILABLE : states::FOCUSABLE;
}
////////////////////////////////////////////////////////////////////////////////
// XULRadioButtonAccessible: Widgets
@ -533,12 +526,12 @@ XULRadioGroupAccessible::NativeRole()
}
PRUint64
XULRadioGroupAccessible::NativeState()
XULRadioGroupAccessible::NativeInteractiveState() const
{
// The radio group is not focusable. Sometimes the focus controller will
// report that it is focused. That means that the actual selected radio button
// should be considered focused.
return Accessible::NativeState() & ~(states::FOCUSABLE | states::FOCUSED);
return NativelyUnavailable() ? states::UNAVAILABLE : 0;
}
////////////////////////////////////////////////////////////////////////////////
@ -688,13 +681,13 @@ XULToolbarSeparatorAccessible::NativeState()
XULTextFieldAccessible::
XULTextFieldAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
NS_IMPL_ISUPPORTS_INHERITED3(XULTextFieldAccessible,
Accessible,
nsHyperTextAccessible,
HyperTextAccessible,
nsIAccessibleText,
nsIAccessibleEditableText)
@ -722,7 +715,7 @@ XULTextFieldAccessible::Value(nsString& aValue)
void
XULTextFieldAccessible::ApplyARIAState(PRUint64* aState) const
{
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
HyperTextAccessibleWrap::ApplyARIAState(aState);
aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
}
@ -730,7 +723,7 @@ XULTextFieldAccessible::ApplyARIAState(PRUint64* aState) const
PRUint64
XULTextFieldAccessible::NativeState()
{
PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
PRUint64 state = HyperTextAccessibleWrap::NativeState();
nsCOMPtr<nsIContent> inputField(GetInputField());
NS_ENSURE_TRUE(inputField, state);
@ -846,7 +839,7 @@ XULTextFieldAccessible::CacheChildren()
}
////////////////////////////////////////////////////////////////////////////////
// XULTextFieldAccessible: nsHyperTextAccessible protected
// XULTextFieldAccessible: HyperTextAccessible protected
already_AddRefed<nsFrameSelection>
XULTextFieldAccessible::FrameSelection()

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

@ -9,7 +9,7 @@
// NOTE: alphabetically ordered
#include "AccessibleWrap.h"
#include "FormControlAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "XULSelectControlAccessible.h"
namespace mozilla {
@ -132,6 +132,7 @@ public:
// Accessible
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
// Widgets
virtual Accessible* ContainerWidget() const;
@ -147,7 +148,7 @@ public:
// Accessible
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
// Widgets
virtual bool IsWidget() const;
@ -213,7 +214,7 @@ public:
/**
* Used for XUL textbox element.
*/
class XULTextFieldAccessible : public nsHyperTextAccessibleWrap
class XULTextFieldAccessible : public HyperTextAccessibleWrap
{
public:
enum { eAction_Click = 0 };
@ -226,7 +227,7 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 index);
// nsHyperTextAccessible
// HyperTextAccessible
virtual already_AddRefed<nsIEditor> GetEditor() const;
// Accessible
@ -243,7 +244,7 @@ protected:
// Accessible
virtual void CacheChildren();
// nsHyperTextAccessible
// HyperTextAccessible
virtual already_AddRefed<nsFrameSelection> FrameSelection();
// nsXULTextFieldAccessible

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

@ -52,15 +52,19 @@ PRUint64
nsXULColorPickerTileAccessible::NativeState()
{
PRUint64 state = AccessibleWrap::NativeState();
if (!(state & states::UNAVAILABLE))
state |= states::FOCUSABLE | states::SELECTABLE;
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::selected))
state |= states::SELECTED;
return state;
}
PRUint64
nsXULColorPickerTileAccessible::NativeInteractiveState() const
{
return NativelyUnavailable() ?
states::UNAVAILABLE : states::FOCUSABLE | states::SELECTABLE;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULColorPickerTileAccessible: Widgets
@ -93,14 +97,8 @@ nsXULColorPickerAccessible::
PRUint64
nsXULColorPickerAccessible::NativeState()
{
// Possible states: focused, focusable, unavailable(disabled).
// get focus and disable status from base class
PRUint64 states = AccessibleWrap::NativeState();
states |= states::FOCUSABLE | states::HASPOPUP;
return states;
PRUint64 state = AccessibleWrap::NativeState();
return state | states::HASPOPUP;
}
role

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

@ -21,6 +21,7 @@ public:
virtual void Value(nsString& aValue);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
// Widgets
virtual Accessible* ContainerWidget() const;

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

@ -50,23 +50,19 @@ nsXULComboboxAccessible::NativeState()
// STATE_COLLAPSED
// Get focus status from base class
PRUint64 states = Accessible::NativeState();
PRUint64 state = Accessible::NativeState();
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
if (menuList) {
bool isOpen;
bool isOpen = false;
menuList->GetOpen(&isOpen);
if (isOpen) {
states |= states::EXPANDED;
}
else {
states |= states::COLLAPSED;
}
if (isOpen)
state |= states::EXPANDED;
else
state |= states::COLLAPSED;
}
states |= states::HASPOPUP | states::FOCUSABLE;
return states;
return state | states::HASPOPUP;
}
void

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

@ -869,7 +869,7 @@ nsXULListitemAccessible::NativeState()
if (mIsCheckbox)
return nsXULMenuitemAccessible::NativeState();
PRUint64 states = states::FOCUSABLE | states::SELECTABLE;
PRUint64 states = NativeInteractiveState();
nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem =
do_QueryInterface(mContent);
@ -887,6 +887,13 @@ nsXULListitemAccessible::NativeState()
return states;
}
PRUint64
nsXULListitemAccessible::NativeInteractiveState() const
{
return NativelyUnavailable() || mParent->NativelyUnavailable() ?
states::UNAVAILABLE : states::FOCUSABLE | states::SELECTABLE;
}
NS_IMETHODIMP nsXULListitemAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (aIndex == eAction_Click && mIsCheckbox) {
@ -926,7 +933,7 @@ nsXULListitemAccessible::ContainerWidget() const
nsXULListCellAccessible::
nsXULListCellAccessible(nsIContent* aContent, DocAccessible* aDoc) :
nsHyperTextAccessibleWrap(aContent, aDoc)
HyperTextAccessibleWrap(aContent, aDoc)
{
}
@ -934,7 +941,7 @@ nsXULListCellAccessible::
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED1(nsXULListCellAccessible,
nsHyperTextAccessible,
HyperTextAccessible,
nsIAccessibleTableCell)
////////////////////////////////////////////////////////////////////////////////

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

@ -117,6 +117,7 @@ public:
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
virtual bool CanHaveAnonChildren();
// Widgets
@ -135,7 +136,7 @@ private:
/**
* Class represents xul:listcell.
*/
class nsXULListCellAccessible : public nsHyperTextAccessibleWrap,
class nsXULListCellAccessible : public HyperTextAccessibleWrap,
public nsIAccessibleTableCell
{
public:

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

@ -110,24 +110,28 @@ nsXULMenuitemAccessible::NativeState()
} // isSelected
} // ROLE_COMBOBOX_OPTION
// Set focusable and selectable for items that are available
// and whose metric setting does allow disabled items to be focused.
if (state & states::UNAVAILABLE) {
// Honour the LookAndFeel metric.
PRInt32 skipDisabledMenuItems =
LookAndFeel::GetInt(LookAndFeel::eIntID_SkipNavigatingDisabledMenuItem);
// We don't want the focusable and selectable states for combobox items,
// so exclude them here as well.
if (skipDisabledMenuItems || isComboboxOption) {
return state;
return state;
}
PRUint64
nsXULMenuitemAccessible::NativeInteractiveState() const
{
if (NativelyUnavailable()) {
// Note: keep in sinc with nsXULPopupManager::IsValidMenuItem() logic.
bool skipNavigatingDisabledMenuItem = true;
nsMenuFrame* menuFrame = do_QueryFrame(GetFrame());
if (!menuFrame->IsOnMenuBar()) {
skipNavigatingDisabledMenuItem = LookAndFeel::
GetInt(LookAndFeel::eIntID_SkipNavigatingDisabledMenuItem, 0) != 0;
}
if (skipNavigatingDisabledMenuItem)
return states::UNAVAILABLE;
return states::UNAVAILABLE | states::FOCUSABLE | states::SELECTABLE;
}
state |= (states::FOCUSABLE | states::SELECTABLE);
if (FocusMgr()->IsFocused(this))
state |= states::FOCUSED;
return state;
return states::FOCUSABLE | states::SELECTABLE;
}
nsresult
@ -555,17 +559,6 @@ nsXULMenubarAccessible::
{
}
PRUint64
nsXULMenubarAccessible::NativeState()
{
PRUint64 state = Accessible::NativeState();
// Menu bar itself is not actually focusable
state &= ~states::FOCUSABLE;
return state;
}
nsresult
nsXULMenubarAccessible::GetNameInternal(nsAString& aName)
{

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

@ -29,6 +29,7 @@ public:
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
virtual PRUint64 NativeInteractiveState() const;
virtual PRInt32 GetLevelInternal();
virtual bool CanHaveAnonChildren();
@ -98,7 +99,6 @@ public:
// Accessible
virtual nsresult GetNameInternal(nsAString& aName);
virtual mozilla::a11y::role NativeRole();
virtual PRUint64 NativeState();
// Widget
virtual bool IsActiveWidget() const;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше