mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Merge m-c to b-s.
This commit is contained in:
commit
9feabd77b1
1
.hgtags
1
.hgtags
@ -68,3 +68,4 @@ a95d426422816513477e5863add1b00ac7041dcb AURORA_BASE_20110412
|
||||
462c726144bc1fb45b61e774f64ac5d61b4e047c UPDATE_PACKAGING_R14
|
||||
5eb553dd2ceae5f88d80f27afc5ef3935c5d43b0 AURORA_BASE_20110705
|
||||
41b84b87c816403e1b74963d8094cff0406c989e AURORA_BASE_20110816
|
||||
c0983049bcaa9551e5f276d5a77ce154c151e0b0 AURORA_BASE_20110927
|
||||
|
@ -83,7 +83,7 @@ public:
|
||||
* should be returned from the cache or can be created
|
||||
*/
|
||||
virtual nsAccessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
||||
PRBool aCanCreate) = 0;
|
||||
bool aCanCreate) = 0;
|
||||
|
||||
/**
|
||||
* Creates accessible for the given DOM node or frame.
|
||||
|
@ -320,7 +320,7 @@ nsAccessibleWrap::Shutdown()
|
||||
nsAccessible::Shutdown();
|
||||
}
|
||||
|
||||
MaiHyperlink* nsAccessibleWrap::GetMaiHyperlink(PRBool aCreate /* = PR_TRUE */)
|
||||
MaiHyperlink* nsAccessibleWrap::GetMaiHyperlink(bool aCreate /* = true */)
|
||||
{
|
||||
// make sure mAtkObject is created
|
||||
GetAtkObject();
|
||||
@ -550,7 +550,7 @@ GetUniqueMaiAtkTypeName(PRUint16 interfacesBits)
|
||||
return name;
|
||||
}
|
||||
|
||||
PRBool nsAccessibleWrap::IsValidObject()
|
||||
bool nsAccessibleWrap::IsValidObject()
|
||||
{
|
||||
// to ensure we are not shut down
|
||||
return !IsDefunct();
|
||||
@ -768,7 +768,7 @@ ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes)
|
||||
nsresult rv = aAttributes->Enumerate(getter_AddRefs(propEnum));
|
||||
NS_ENSURE_SUCCESS(rv, nsnull);
|
||||
|
||||
PRBool hasMore;
|
||||
bool hasMore;
|
||||
while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> sup;
|
||||
rv = propEnum->GetNext(getter_AddRefs(sup));
|
||||
@ -909,7 +909,7 @@ TranslateStates(PRUint64 aState, AtkStateSet* aStateSet)
|
||||
PRUint64 bitMask = 1;
|
||||
while (gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState) {
|
||||
if (gAtkStateMap[stateIndex].atkState) { // There's potentially an ATK state for this
|
||||
PRBool isStateOn = (aState & bitMask) != 0;
|
||||
bool isStateOn = (aState & bitMask) != 0;
|
||||
if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite) {
|
||||
isStateOn = !isStateOn;
|
||||
}
|
||||
@ -1241,7 +1241,7 @@ nsAccessibleWrap::FirePlatformEvent(AccEvent* aEvent)
|
||||
g_signal_emit(atkObj, id, 0);
|
||||
|
||||
// Always fire a current focus event after activation.
|
||||
rootAcc->FireCurrentFocusEvent();
|
||||
FocusMgr()->ForceFocusEvent();
|
||||
} break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
|
||||
@ -1319,7 +1319,7 @@ nsAccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
||||
NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
|
||||
|
||||
PRBool isEnabled = event->IsStateEnabled();
|
||||
bool isEnabled = event->IsStateEnabled();
|
||||
PRInt32 stateIndex = AtkStateMap::GetStateIndexFor(event->GetState());
|
||||
if (stateIndex >= 0) {
|
||||
NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
|
||||
@ -1353,8 +1353,8 @@ nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
|
||||
|
||||
PRInt32 start = event->GetStartOffset();
|
||||
PRUint32 length = event->GetLength();
|
||||
PRBool isInserted = event->IsTextInserted();
|
||||
PRBool isFromUserInput = aEvent->IsFromUserInput();
|
||||
bool isInserted = event->IsTextInserted();
|
||||
bool isFromUserInput = aEvent->IsFromUserInput();
|
||||
char* signal_name = nsnull;
|
||||
|
||||
if (gAvailableAtkSignals == eUnknown)
|
||||
@ -1384,7 +1384,7 @@ nsAccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
|
||||
|
||||
nsresult
|
||||
nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
|
||||
AtkObject *aObject, PRBool aIsAdded)
|
||||
AtkObject *aObject, bool aIsAdded)
|
||||
{
|
||||
if (aIsAdded)
|
||||
MAI_LOG_DEBUG(("\n\nReceived: Show event\n"));
|
||||
@ -1395,7 +1395,7 @@ nsAccessibleWrap::FireAtkShowHideEvent(AccEvent* aEvent,
|
||||
AtkObject *parentObject = getParentCB(aObject);
|
||||
NS_ENSURE_STATE(parentObject);
|
||||
|
||||
PRBool isFromUserInput = aEvent->IsFromUserInput();
|
||||
bool isFromUserInput = aEvent->IsFromUserInput();
|
||||
char *signal_name = g_strconcat(aIsAdded ? "children_changed::add" : "children_changed::remove",
|
||||
isFromUserInput ? "" : kNonUserInputEvent, NULL);
|
||||
g_signal_emit_by_name(parentObject, signal_name, indexInParent, aObject, NULL);
|
||||
|
@ -104,10 +104,10 @@ public:
|
||||
AtkObject * GetAtkObject(void);
|
||||
static AtkObject * GetAtkObject(nsIAccessible * acc);
|
||||
|
||||
PRBool IsValidObject();
|
||||
bool IsValidObject();
|
||||
|
||||
// get/set the MaiHyperlink object for this nsAccessibleWrap
|
||||
MaiHyperlink* GetMaiHyperlink(PRBool aCreate = PR_TRUE);
|
||||
MaiHyperlink* GetMaiHyperlink(bool aCreate = true);
|
||||
void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
|
||||
|
||||
static const char * ReturnString(nsAString &aString) {
|
||||
@ -122,7 +122,7 @@ protected:
|
||||
nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
|
||||
nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
|
||||
nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
|
||||
PRBool aIsAdded);
|
||||
bool aIsAdded);
|
||||
|
||||
AtkObject *mAtkObject;
|
||||
|
||||
|
@ -611,7 +611,7 @@ toplevel_event_watcher(GSignalInvocationHint* ihint,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsApplicationAccessibleWrap::Init()
|
||||
{
|
||||
// XXX following code is copied from widget/src/gtk2/nsWindow.cpp
|
||||
@ -619,7 +619,7 @@ nsApplicationAccessibleWrap::Init()
|
||||
// see bug 390761
|
||||
|
||||
// check if accessibility enabled/disabled by environment variable
|
||||
PRBool isGnomeATEnabled = PR_FALSE;
|
||||
bool isGnomeATEnabled = false;
|
||||
const char *envValue = PR_GetEnv(sAccEnv);
|
||||
if (envValue) {
|
||||
isGnomeATEnabled = !!atoi(envValue);
|
||||
@ -752,7 +752,7 @@ gboolean fireRootAccessibleAddedCB(gpointer data)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
|
||||
{
|
||||
if (!nsApplicationAccessible::AppendChild(aChild))
|
||||
@ -779,7 +779,7 @@ nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsApplicationAccessibleWrap::RemoveChild(nsAccessible* aChild)
|
||||
{
|
||||
PRInt32 index = aChild->IndexInParent();
|
||||
|
@ -54,11 +54,11 @@ public:
|
||||
virtual ~nsApplicationAccessibleWrap();
|
||||
|
||||
// nsAccessNode
|
||||
virtual PRBool Init();
|
||||
virtual bool Init();
|
||||
|
||||
// nsAccessible
|
||||
virtual PRBool AppendChild(nsAccessible* aChild);
|
||||
virtual PRBool RemoveChild(nsAccessible* aChild);
|
||||
virtual bool AppendChild(nsAccessible* aChild);
|
||||
virtual bool RemoveChild(nsAccessible* aChild);
|
||||
|
||||
// return the atk object for app root accessible
|
||||
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
nsIWeakReference *aShell);
|
||||
virtual ~nsDocAccessibleWrap();
|
||||
|
||||
PRBool mActivated;
|
||||
bool mActivated;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -464,7 +464,7 @@ isColumnSelectedCB(AtkTable *aTable, gint aColumn)
|
||||
getter_AddRefs(accTable));
|
||||
NS_ENSURE_TRUE(accTable, FALSE);
|
||||
|
||||
PRBool outValue;
|
||||
bool outValue;
|
||||
nsresult rv = accTable->IsColumnSelected(aColumn, &outValue);
|
||||
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
|
||||
}
|
||||
@ -481,7 +481,7 @@ isRowSelectedCB(AtkTable *aTable, gint aRow)
|
||||
getter_AddRefs(accTable));
|
||||
NS_ENSURE_TRUE(accTable, FALSE);
|
||||
|
||||
PRBool outValue;
|
||||
bool outValue;
|
||||
nsresult rv = accTable->IsRowSelected(aRow, &outValue);
|
||||
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
|
||||
}
|
||||
@ -498,7 +498,7 @@ isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
|
||||
getter_AddRefs(accTable));
|
||||
NS_ENSURE_TRUE(accTable, FALSE);
|
||||
|
||||
PRBool outValue;
|
||||
bool outValue;
|
||||
nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
|
||||
return NS_FAILED(rv) ? FALSE : static_cast<gboolean>(outValue);
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
||||
// decide how to coalesce events created via accessible (instead of node).
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsAccessible* aAccessible, PRUint64 aState,
|
||||
PRBool aIsEnabled, EIsFromUserInput aIsFromUserInput):
|
||||
bool aIsEnabled, EIsFromUserInput aIsFromUserInput):
|
||||
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
||||
aIsFromUserInput, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
@ -201,7 +201,7 @@ AccStateChangeEvent::
|
||||
}
|
||||
|
||||
AccStateChangeEvent::
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState, PRBool aIsEnabled):
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState, bool aIsEnabled):
|
||||
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode,
|
||||
eAutoDetect, eAllowDupes),
|
||||
mState(aState), mIsEnabled(aIsEnabled)
|
||||
@ -244,7 +244,7 @@ AccStateChangeEvent::CreateXPCOMObject()
|
||||
// XXX revisit this when coalescence is faster (eCoalesceFromSameSubtree)
|
||||
AccTextChangeEvent::
|
||||
AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
|
||||
const nsAString& aModifiedText, PRBool aIsInserted,
|
||||
const nsAString& aModifiedText, bool aIsInserted,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
: AccEvent(aIsInserted ?
|
||||
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
|
||||
|
@ -78,9 +78,9 @@ public:
|
||||
// will be emitted.
|
||||
eCoalesceFromSameSubtree,
|
||||
|
||||
// eCoalesceFromSameDocument : For events of the same type from the same
|
||||
// document, only the newest event will be emitted.
|
||||
eCoalesceFromSameDocument,
|
||||
// eCoalesceOfSameType : For events of the same type, only the newest event
|
||||
// will be processed.
|
||||
eCoalesceOfSameType,
|
||||
|
||||
// eRemoveDupes : For repeat events, only the newest event in queue
|
||||
// will be emitted.
|
||||
@ -103,7 +103,7 @@ public:
|
||||
// AccEvent
|
||||
PRUint32 GetEventType() const { return mEventType; }
|
||||
EEventRule GetEventRule() const { return mEventRule; }
|
||||
PRBool IsFromUserInput() const { return mIsFromUserInput; }
|
||||
bool IsFromUserInput() const { return mIsFromUserInput; }
|
||||
|
||||
nsAccessible *GetAccessible();
|
||||
nsDocAccessible* GetDocAccessible();
|
||||
@ -152,7 +152,7 @@ protected:
|
||||
*/
|
||||
void CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput);
|
||||
|
||||
PRBool mIsFromUserInput;
|
||||
bool mIsFromUserInput;
|
||||
PRUint32 mEventType;
|
||||
EEventRule mEventRule;
|
||||
nsRefPtr<nsAccessible> mAccessible;
|
||||
@ -169,10 +169,10 @@ class AccStateChangeEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
AccStateChangeEvent(nsAccessible* aAccessible, PRUint64 aState,
|
||||
PRBool aIsEnabled,
|
||||
bool aIsEnabled,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState, PRBool aIsEnabled);
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState, bool aIsEnabled);
|
||||
|
||||
AccStateChangeEvent(nsINode* aNode, PRUint64 aState);
|
||||
|
||||
@ -187,11 +187,11 @@ public:
|
||||
|
||||
// AccStateChangeEvent
|
||||
PRUint64 GetState() const { return mState; }
|
||||
PRBool IsStateEnabled() const { return mIsEnabled; }
|
||||
bool IsStateEnabled() const { return mIsEnabled; }
|
||||
|
||||
private:
|
||||
PRUint64 mState;
|
||||
PRBool mIsEnabled;
|
||||
bool mIsEnabled;
|
||||
};
|
||||
|
||||
|
||||
@ -202,7 +202,7 @@ class AccTextChangeEvent: public AccEvent
|
||||
{
|
||||
public:
|
||||
AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
|
||||
const nsAString& aModifiedText, PRBool aIsInserted,
|
||||
const nsAString& aModifiedText, bool aIsInserted,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
// AccEvent
|
||||
@ -217,13 +217,13 @@ public:
|
||||
// AccTextChangeEvent
|
||||
PRInt32 GetStartOffset() const { return mStart; }
|
||||
PRUint32 GetLength() const { return mModifiedText.Length(); }
|
||||
PRBool IsTextInserted() const { return mIsInserted; }
|
||||
bool IsTextInserted() const { return mIsInserted; }
|
||||
void GetModifiedText(nsAString& aModifiedText)
|
||||
{ aModifiedText = mModifiedText; }
|
||||
|
||||
private:
|
||||
PRInt32 mStart;
|
||||
PRBool mIsInserted;
|
||||
bool mIsInserted;
|
||||
nsString mModifiedText;
|
||||
|
||||
friend class NotificationController;
|
||||
|
@ -76,7 +76,7 @@ AccIterator::Next()
|
||||
continue;
|
||||
}
|
||||
|
||||
PRBool isComplying = mFilterFunc(child);
|
||||
bool isComplying = mFilterFunc(child);
|
||||
if (isComplying)
|
||||
return child;
|
||||
|
||||
@ -152,10 +152,10 @@ RelatedAccIterator::Next()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
HTMLLabelIterator::
|
||||
HTMLLabelIterator(nsDocAccessible* aDocument, nsIContent* aElement,
|
||||
HTMLLabelIterator(nsDocAccessible* aDocument, const nsAccessible* aAccessible,
|
||||
LabelFilter aFilter) :
|
||||
mRelIter(aDocument, aElement, nsGkAtoms::_for),
|
||||
mElement(aElement), mLabelFilter(aFilter)
|
||||
mRelIter(aDocument, aAccessible->GetContent(), nsGkAtoms::_for),
|
||||
mAcc(aAccessible), mLabelFilter(aFilter)
|
||||
{
|
||||
}
|
||||
|
||||
@ -170,20 +170,25 @@ HTMLLabelIterator::Next()
|
||||
return label;
|
||||
}
|
||||
|
||||
if (mLabelFilter == eSkipAncestorLabel)
|
||||
// Ignore ancestor label on not widget accessible.
|
||||
if (mLabelFilter == eSkipAncestorLabel || !mAcc->IsWidget())
|
||||
return nsnull;
|
||||
|
||||
// Go up tree get name of ancestor label if there is one (an ancestor <label>
|
||||
// implicitly points to us). Don't go up farther than form or body element.
|
||||
nsIContent* walkUpContent = mElement;
|
||||
while ((walkUpContent = walkUpContent->GetParent()) &&
|
||||
walkUpContent->Tag() != nsGkAtoms::form &&
|
||||
walkUpContent->Tag() != nsGkAtoms::body) {
|
||||
if (walkUpContent->Tag() == nsGkAtoms::label) {
|
||||
// Prevent infinite loop.
|
||||
mLabelFilter = eSkipAncestorLabel;
|
||||
return GetAccService()->GetAccessible(walkUpContent);
|
||||
// Go up tree to get a name of ancestor label if there is one (an ancestor
|
||||
// <label> implicitly points to us). Don't go up farther than form or
|
||||
// document.
|
||||
nsAccessible* walkUp = mAcc->Parent();
|
||||
while (walkUp && !walkUp->IsDoc()) {
|
||||
nsIContent* walkUpElm = walkUp->GetContent();
|
||||
if (walkUpElm->Tag() == nsGkAtoms::label) {
|
||||
mLabelFilter = eSkipAncestorLabel; // prevent infinite loop
|
||||
return walkUp;
|
||||
}
|
||||
|
||||
if (walkUpElm->Tag() == nsGkAtoms::form)
|
||||
break;
|
||||
|
||||
walkUp = walkUp->Parent();
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
};
|
||||
|
||||
filters::FilterFuncPtr mFilterFunc;
|
||||
PRBool mIsDeep;
|
||||
bool mIsDeep;
|
||||
IteratorState *mState;
|
||||
};
|
||||
|
||||
@ -155,7 +155,7 @@ private:
|
||||
|
||||
|
||||
/**
|
||||
* Used to iterate through HTML labels associated with the given element.
|
||||
* Used to iterate through HTML labels associated with the given accessible.
|
||||
*/
|
||||
class HTMLLabelIterator : public AccIterable
|
||||
{
|
||||
@ -165,7 +165,7 @@ public:
|
||||
eSkipAncestorLabel
|
||||
};
|
||||
|
||||
HTMLLabelIterator(nsDocAccessible* aDocument, nsIContent* aElement,
|
||||
HTMLLabelIterator(nsDocAccessible* aDocument, const nsAccessible* aAccessible,
|
||||
LabelFilter aFilter = eAllLabels);
|
||||
|
||||
virtual ~HTMLLabelIterator() { }
|
||||
@ -181,7 +181,9 @@ private:
|
||||
HTMLLabelIterator& operator = (const HTMLLabelIterator&);
|
||||
|
||||
RelatedAccIterator mRelIter;
|
||||
nsIContent* mElement;
|
||||
// XXX: replace it on weak reference (bug 678429), it's safe to use raw
|
||||
// pointer now because iterators life cycle is short.
|
||||
const nsAccessible* mAcc;
|
||||
LabelFilter mLabelFilter;
|
||||
};
|
||||
|
||||
|
361
accessible/src/base/FocusManager.cpp
Normal file
361
accessible/src/base/FocusManager.cpp
Normal file
@ -0,0 +1,361 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "FocusManager.h"
|
||||
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsRootAccessible.h"
|
||||
|
||||
#include "nsFocusManager.h"
|
||||
|
||||
namespace dom = mozilla::dom;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
FocusManager::FocusManager()
|
||||
{
|
||||
}
|
||||
|
||||
FocusManager::~FocusManager()
|
||||
{
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
FocusManager::FocusedAccessible() const
|
||||
{
|
||||
if (mActiveItem)
|
||||
return mActiveItem;
|
||||
|
||||
nsINode* focusedNode = FocusedDOMNode();
|
||||
if (focusedNode)
|
||||
return GetAccService()->GetAccessibleOrContainer(focusedNode, nsnull);
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
bool
|
||||
FocusManager::IsFocused(const nsAccessible* aAccessible) const
|
||||
{
|
||||
if (mActiveItem)
|
||||
return mActiveItem == aAccessible;
|
||||
|
||||
nsINode* focusedNode = FocusedDOMNode();
|
||||
if (focusedNode) {
|
||||
// XXX: Before getting an accessible for node having a DOM focus make sure
|
||||
// they belong to the same document because it can trigger unwanted document
|
||||
// accessible creation for temporary about:blank document. Without this
|
||||
// peculiarity we would end up with plain implementation based on
|
||||
// FocusedAccessible() method call. Make sure this issue is fixed in
|
||||
// bug 638465.
|
||||
if (focusedNode->GetOwnerDoc() == aAccessible->GetNode()->GetOwnerDoc()) {
|
||||
return aAccessible ==
|
||||
GetAccService()->GetAccessibleOrContainer(focusedNode, nsnull);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
FocusManager::IsFocusWithin(const nsAccessible* aContainer) const
|
||||
{
|
||||
nsAccessible* child = FocusedAccessible();
|
||||
while (child) {
|
||||
if (child == aContainer)
|
||||
return true;
|
||||
|
||||
child = child->Parent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
FocusManager::FocusDisposition
|
||||
FocusManager::IsInOrContainsFocus(const nsAccessible* aAccessible) const
|
||||
{
|
||||
nsAccessible* focus = FocusedAccessible();
|
||||
if (!focus)
|
||||
return eNone;
|
||||
|
||||
// If focused.
|
||||
if (focus == aAccessible)
|
||||
return eFocused;
|
||||
|
||||
// If contains the focus.
|
||||
nsAccessible* child = focus->Parent();
|
||||
while (child) {
|
||||
if (child == aAccessible)
|
||||
return eContainsFocus;
|
||||
|
||||
child = child->Parent();
|
||||
}
|
||||
|
||||
// If contained by focus.
|
||||
child = aAccessible->Parent();
|
||||
while (child) {
|
||||
if (child == focus)
|
||||
return eContainedByFocus;
|
||||
|
||||
child = child->Parent();
|
||||
}
|
||||
|
||||
return eNone;
|
||||
}
|
||||
|
||||
void
|
||||
FocusManager::NotifyOfDOMFocus(nsISupports* aTarget)
|
||||
{
|
||||
A11YDEBUG_FOCUS_NOTIFICATION_SUPPORTSTARGET("DOM focus", "DOM focus target",
|
||||
aTarget)
|
||||
|
||||
mActiveItem = nsnull;
|
||||
|
||||
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
|
||||
if (targetNode) {
|
||||
nsDocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(targetNode->GetOwnerDoc());
|
||||
if (document) {
|
||||
// Set selection listener for focused element.
|
||||
if (targetNode->IsElement()) {
|
||||
nsRootAccessible* root = document->RootAccessible();
|
||||
nsCaretAccessible* caretAcc = root->GetCaretAccessible();
|
||||
caretAcc->SetControlSelectionListener(targetNode->AsElement());
|
||||
}
|
||||
|
||||
document->HandleNotification<FocusManager, nsINode>
|
||||
(this, &FocusManager::ProcessDOMFocus, targetNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FocusManager::NotifyOfDOMBlur(nsISupports* aTarget)
|
||||
{
|
||||
A11YDEBUG_FOCUS_NOTIFICATION_SUPPORTSTARGET("DOM blur", "DOM blur target",
|
||||
aTarget)
|
||||
|
||||
mActiveItem = nsnull;
|
||||
|
||||
// If DOM document stays focused then fire accessible focus event to process
|
||||
// the case when no element within this DOM document will be focused.
|
||||
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget));
|
||||
if (targetNode && targetNode->GetOwnerDoc() == FocusedDOMDocument()) {
|
||||
nsIDocument* DOMDoc = targetNode->GetOwnerDoc();
|
||||
nsDocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(DOMDoc);
|
||||
if (document) {
|
||||
document->HandleNotification<FocusManager, nsINode>
|
||||
(this, &FocusManager::ProcessDOMFocus, DOMDoc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FocusManager::ActiveItemChanged(nsAccessible* aItem, bool aCheckIfActive)
|
||||
{
|
||||
A11YDEBUG_FOCUS_NOTIFICATION_ACCTARGET("active item changed",
|
||||
"Active item", aItem)
|
||||
|
||||
// Nothing changed, happens for XUL trees and HTML selects.
|
||||
if (aItem && aItem == mActiveItem)
|
||||
return;
|
||||
|
||||
mActiveItem = nsnull;
|
||||
|
||||
if (aItem && aCheckIfActive) {
|
||||
nsAccessible* widget = aItem->ContainerWidget();
|
||||
A11YDEBUG_FOCUS_LOG_WIDGET("Active item widget", widget)
|
||||
if (!widget || !widget->IsActiveWidget() || !widget->AreItemsOperable())
|
||||
return;
|
||||
}
|
||||
mActiveItem = aItem;
|
||||
|
||||
// If active item is changed then fire accessible focus event on it, otherwise
|
||||
// if there's no an active item then fire focus event to accessible having
|
||||
// DOM focus.
|
||||
nsAccessible* target = FocusedAccessible();
|
||||
if (target)
|
||||
DispatchFocusEvent(target->GetDocAccessible(), target);
|
||||
}
|
||||
|
||||
void
|
||||
FocusManager::ForceFocusEvent()
|
||||
{
|
||||
nsINode* focusedNode = FocusedDOMNode();
|
||||
if (focusedNode) {
|
||||
nsDocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(focusedNode->GetOwnerDoc());
|
||||
if (document) {
|
||||
document->HandleNotification<FocusManager, nsINode>
|
||||
(this, &FocusManager::ProcessDOMFocus, focusedNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FocusManager::DispatchFocusEvent(nsDocAccessible* aDocument,
|
||||
nsAccessible* aTarget)
|
||||
{
|
||||
NS_PRECONDITION(aDocument, "No document for focused accessible!");
|
||||
if (aDocument) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
|
||||
eAutoDetect, AccEvent::eCoalesceOfSameType);
|
||||
aDocument->FireDelayedAccessibleEvent(event);
|
||||
|
||||
A11YDEBUG_FOCUS_LOG_ACCTARGET("Focus notification", aTarget)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FocusManager::ProcessDOMFocus(nsINode* aTarget)
|
||||
{
|
||||
A11YDEBUG_FOCUS_NOTIFICATION_DOMTARGET("Process DOM focus",
|
||||
"Notification target", aTarget)
|
||||
|
||||
nsDocAccessible* document =
|
||||
GetAccService()->GetDocAccessible(aTarget->GetOwnerDoc());
|
||||
|
||||
nsAccessible* target = document->GetAccessibleOrContainer(aTarget);
|
||||
if (target) {
|
||||
// Check if still focused. Otherwise we can end up with storing the active
|
||||
// item for control that isn't focused anymore.
|
||||
nsAccessible* DOMFocus =
|
||||
GetAccService()->GetAccessibleOrContainer(FocusedDOMNode(), nsnull);
|
||||
if (target != DOMFocus)
|
||||
return;
|
||||
|
||||
nsAccessible* activeItem = target->CurrentItem();
|
||||
if (activeItem) {
|
||||
mActiveItem = activeItem;
|
||||
target = activeItem;
|
||||
}
|
||||
|
||||
DispatchFocusEvent(document, target);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FocusManager::ProcessFocusEvent(AccEvent* aEvent)
|
||||
{
|
||||
NS_PRECONDITION(aEvent->GetEventType() == nsIAccessibleEvent::EVENT_FOCUS,
|
||||
"Focus event is expected!");
|
||||
|
||||
EIsFromUserInput fromUserInputFlag = aEvent->IsFromUserInput() ?
|
||||
eFromUserInput : eNoUserInput;
|
||||
|
||||
// Emit focus event if event target is the active item. Otherwise then check
|
||||
// if it's still focused and then update active item and emit focus event.
|
||||
nsAccessible* target = aEvent->GetAccessible();
|
||||
if (target != mActiveItem) {
|
||||
// Check if still focused. Otherwise we can end up with storing the active
|
||||
// item for control that isn't focused anymore.
|
||||
nsAccessible* DOMFocus =
|
||||
GetAccService()->GetAccessibleOrContainer(FocusedDOMNode(), nsnull);
|
||||
if (target != DOMFocus)
|
||||
return;
|
||||
|
||||
nsAccessible* activeItem = target->CurrentItem();
|
||||
if (activeItem) {
|
||||
mActiveItem = activeItem;
|
||||
target = activeItem;
|
||||
}
|
||||
}
|
||||
|
||||
// Fire menu start/end events for ARIA menus.
|
||||
if (target->ARIARole() == nsIAccessibleRole::ROLE_MENUITEM) {
|
||||
// The focus was moved into menu.
|
||||
nsAccessible* ARIAMenubar =
|
||||
nsAccUtils::GetAncestorWithRole(target, nsIAccessibleRole::ROLE_MENUBAR);
|
||||
|
||||
if (ARIAMenubar != mActiveARIAMenubar) {
|
||||
// Leaving ARIA menu. Fire menu_end event on current menubar.
|
||||
if (mActiveARIAMenubar) {
|
||||
nsRefPtr<AccEvent> menuEndEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
|
||||
fromUserInputFlag);
|
||||
nsEventShell::FireEvent(menuEndEvent);
|
||||
}
|
||||
|
||||
mActiveARIAMenubar = ARIAMenubar;
|
||||
|
||||
// Entering ARIA menu. Fire menu_start event.
|
||||
if (mActiveARIAMenubar) {
|
||||
nsRefPtr<AccEvent> menuStartEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
|
||||
mActiveARIAMenubar, fromUserInputFlag);
|
||||
nsEventShell::FireEvent(menuStartEvent);
|
||||
}
|
||||
}
|
||||
} else if (mActiveARIAMenubar) {
|
||||
// Focus left a menu. Fire menu_end event.
|
||||
nsRefPtr<AccEvent> menuEndEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
|
||||
fromUserInputFlag);
|
||||
nsEventShell::FireEvent(menuEndEvent);
|
||||
|
||||
mActiveARIAMenubar = nsnull;
|
||||
}
|
||||
|
||||
A11YDEBUG_FOCUS_NOTIFICATION_ACCTARGET("FIRE FOCUS EVENT", "Focus target",
|
||||
target)
|
||||
|
||||
nsRefPtr<AccEvent> focusEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, target, fromUserInputFlag);
|
||||
nsEventShell::FireEvent(focusEvent);
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
FocusManager::FocusedDOMElm() const
|
||||
{
|
||||
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
|
||||
return DOMFocusManager->GetFocusedContent();
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
FocusManager::FocusedDOMDocument() const
|
||||
{
|
||||
nsFocusManager* DOMFocusManager = nsFocusManager::GetFocusManager();
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> focusedWnd;
|
||||
DOMFocusManager->GetFocusedWindow(getter_AddRefs(focusedWnd));
|
||||
if (focusedWnd) {
|
||||
nsCOMPtr<nsIDOMDocument> DOMDoc;
|
||||
focusedWnd->GetDocument(getter_AddRefs(DOMDoc));
|
||||
nsCOMPtr<nsIDocument> DOMDocNode(do_QueryInterface(DOMDoc));
|
||||
return DOMDocNode;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
297
accessible/src/base/FocusManager.h
Normal file
297
accessible/src/base/FocusManager.h
Normal file
@ -0,0 +1,297 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2011
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef mozilla_a11y_FocusManager_h_
|
||||
#define mozilla_a11y_FocusManager_h_
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class AccEvent;
|
||||
class nsAccessible;
|
||||
class nsDocAccessible;
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Manage the accessible focus. Used to fire and process accessible events.
|
||||
*/
|
||||
class FocusManager
|
||||
{
|
||||
public:
|
||||
virtual ~FocusManager();
|
||||
|
||||
/**
|
||||
* Return a focused accessible.
|
||||
*/
|
||||
nsAccessible* FocusedAccessible() const;
|
||||
|
||||
/**
|
||||
* Return true if given accessible is focused.
|
||||
*/
|
||||
bool IsFocused(const nsAccessible* aAccessible) const;
|
||||
|
||||
/**
|
||||
* Return true if the given accessible is an active item, i.e. an item that
|
||||
* is current within the active widget.
|
||||
*/
|
||||
inline bool IsActiveItem(const nsAccessible* aAccessible)
|
||||
{ return aAccessible == mActiveItem; }
|
||||
|
||||
/**
|
||||
* Return true if given DOM node has DOM focus.
|
||||
*/
|
||||
inline bool HasDOMFocus(const nsINode* aNode) const
|
||||
{ return aNode == FocusedDOMNode(); }
|
||||
|
||||
/**
|
||||
* Return true if focused accessible is within the given container.
|
||||
*/
|
||||
bool IsFocusWithin(const nsAccessible* aContainer) const;
|
||||
|
||||
/**
|
||||
* Return whether the given accessible is focused or contains the focus or
|
||||
* contained by focused accessible.
|
||||
*/
|
||||
enum FocusDisposition {
|
||||
eNone,
|
||||
eFocused,
|
||||
eContainsFocus,
|
||||
eContainedByFocus
|
||||
};
|
||||
FocusDisposition IsInOrContainsFocus(const nsAccessible* aAccessible) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Focus notifications and processing (don't use until you know what you do).
|
||||
|
||||
/**
|
||||
* Called when DOM focus event is fired.
|
||||
*/
|
||||
void NotifyOfDOMFocus(nsISupports* aTarget);
|
||||
|
||||
/**
|
||||
* Called when DOM blur event is fired.
|
||||
*/
|
||||
void NotifyOfDOMBlur(nsISupports* aTarget);
|
||||
|
||||
/**
|
||||
* Called when active item is changed. Note: must be called when accessible
|
||||
* tree is up to date.
|
||||
*/
|
||||
void ActiveItemChanged(nsAccessible* aItem, bool aCheckIfActive = true);
|
||||
|
||||
/**
|
||||
* Dispatch delayed focus event for the current focus accessible.
|
||||
*/
|
||||
void ForceFocusEvent();
|
||||
|
||||
/**
|
||||
* Dispatch delayed focus event for the given target.
|
||||
*/
|
||||
void DispatchFocusEvent(nsDocAccessible* aDocument, nsAccessible* aTarget);
|
||||
|
||||
/**
|
||||
* Process DOM focus notification.
|
||||
*/
|
||||
void ProcessDOMFocus(nsINode* aTarget);
|
||||
|
||||
/**
|
||||
* Process the delayed accessible event.
|
||||
* do.
|
||||
*/
|
||||
void ProcessFocusEvent(AccEvent* aEvent);
|
||||
|
||||
protected:
|
||||
FocusManager();
|
||||
|
||||
private:
|
||||
FocusManager(const FocusManager&);
|
||||
FocusManager& operator =(const FocusManager&);
|
||||
|
||||
/**
|
||||
* Return DOM node having DOM focus.
|
||||
*/
|
||||
inline nsINode* FocusedDOMNode() const
|
||||
{
|
||||
nsINode* focusedNode = FocusedDOMElm();
|
||||
if (focusedNode)
|
||||
return focusedNode;
|
||||
return FocusedDOMDocument();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return DOM element having DOM focus.
|
||||
*/
|
||||
nsIContent* FocusedDOMElm() const;
|
||||
|
||||
/**
|
||||
* Return DOM document having DOM focus.
|
||||
*/
|
||||
nsIDocument* FocusedDOMDocument() const;
|
||||
|
||||
private:
|
||||
nsRefPtr<nsAccessible> mActiveItem;
|
||||
nsRefPtr<nsAccessible> mActiveARIAMenubar;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
|
||||
//#define A11YDEBUG_FOCUS
|
||||
|
||||
#ifdef A11YDEBUG_FOCUS
|
||||
|
||||
// Util macros (don't use them directly)
|
||||
#define A11YDEBUG_FOCUS_STARTBLOCK \
|
||||
printf(" {\n ");
|
||||
|
||||
#define A11YDEBUG_FOCUS_ENDBLOCK \
|
||||
printf("\n }\n");
|
||||
|
||||
#define A11YDEBUG_FOCUS_BLOCKOFFSET \
|
||||
printf(" ");
|
||||
|
||||
#define A11YDEBUG_FOCUS_LOG_TIME \
|
||||
{ \
|
||||
PRIntervalTime time = PR_IntervalNow(); \
|
||||
PRUint32 mins = (PR_IntervalToSeconds(time) / 60) % 60; \
|
||||
PRUint32 secs = PR_IntervalToSeconds(time) % 60; \
|
||||
PRUint32 msecs = PR_IntervalToMilliseconds(time) % 1000; \
|
||||
printf("Time: %2d:%2d.%3d\n", mins, secs, msecs); \
|
||||
}
|
||||
|
||||
#define A11YDEBUG_FOCUS_LOG_DOMNODE(aNode) \
|
||||
if (aNode) { \
|
||||
if (aNode->IsElement()) { \
|
||||
dom::Element* targetElm = aNode->AsElement(); \
|
||||
nsCAutoString tag; \
|
||||
targetElm->Tag()->ToUTF8String(tag); \
|
||||
nsCAutoString id; \
|
||||
nsIAtom* atomid = targetElm->GetID(); \
|
||||
if (atomid) \
|
||||
atomid->ToUTF8String(id); \
|
||||
printf("element %s@id='%s': %p", tag.get(), id.get(), (void*)aNode); \
|
||||
} else if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) { \
|
||||
nsCOMPtr<nsIDocument> document = do_QueryInterface(aNode); \
|
||||
nsIURI* uri = document->GetDocumentURI(); \
|
||||
nsCAutoString spec; \
|
||||
uri->GetSpec(spec); \
|
||||
printf("document: %p; uri: %s", (void*)aNode, spec.get()); \
|
||||
} \
|
||||
}
|
||||
|
||||
#define A11YDEBUG_FOCUS_LOG_ACCESSIBLE(aAccessible) \
|
||||
printf("accessible: %p; ", (void*)aAccessible); \
|
||||
if (aAccessible) { \
|
||||
nsAutoString role; \
|
||||
GetAccService()->GetStringRole(aAccessible->Role(), role); \
|
||||
nsAutoString name; \
|
||||
aAccessible->GetName(name); \
|
||||
printf(" role: %s, name: %s; ", NS_ConvertUTF16toUTF8(role).get(), \
|
||||
NS_ConvertUTF16toUTF8(name).get()); \
|
||||
A11YDEBUG_FOCUS_LOG_DOMNODE(aAccessible->GetNode()) \
|
||||
}
|
||||
|
||||
// Public macros
|
||||
#define A11YDEBUG_FOCUS_LOG_DOMTARGET(aMsg, aTarget) \
|
||||
A11YDEBUG_FOCUS_STARTBLOCK \
|
||||
printf(aMsg "\n"); \
|
||||
if (aTarget) { \
|
||||
A11YDEBUG_FOCUS_BLOCKOFFSET \
|
||||
A11YDEBUG_FOCUS_LOG_DOMNODE(aTarget) \
|
||||
} \
|
||||
A11YDEBUG_FOCUS_ENDBLOCK
|
||||
|
||||
#define A11YDEBUG_FOCUS_LOG_ACCTARGET(aMsg, aTarget) \
|
||||
A11YDEBUG_FOCUS_STARTBLOCK \
|
||||
printf(aMsg "\n"); \
|
||||
A11YDEBUG_FOCUS_BLOCKOFFSET \
|
||||
A11YDEBUG_FOCUS_LOG_ACCESSIBLE(aTarget) \
|
||||
A11YDEBUG_FOCUS_ENDBLOCK
|
||||
|
||||
#define A11YDEBUG_FOCUS_LOG_WIDGET(aMsg, aWidget) \
|
||||
A11YDEBUG_FOCUS_STARTBLOCK \
|
||||
printf(aMsg "\n"); \
|
||||
A11YDEBUG_FOCUS_BLOCKOFFSET \
|
||||
A11YDEBUG_FOCUS_LOG_ACCESSIBLE(aWidget) \
|
||||
printf("; widget is active: %s, has operable items: %s", \
|
||||
(aWidget && aWidget->IsActiveWidget() ? "true" : "false"), \
|
||||
(aWidget && aWidget->AreItemsOperable() ? "true" : "false")); \
|
||||
A11YDEBUG_FOCUS_ENDBLOCK
|
||||
|
||||
#define A11YDEBUG_FOCUS_NOTIFICATION_SUPPORTSTARGET(aMsg, aTargetMsg, aTarget) \
|
||||
printf("\nA11Y FOCUS: " aMsg ". "); \
|
||||
A11YDEBUG_FOCUS_LOG_TIME \
|
||||
if (aTarget) { \
|
||||
A11YDEBUG_FOCUS_STARTBLOCK \
|
||||
printf(aTargetMsg "\n"); \
|
||||
A11YDEBUG_FOCUS_BLOCKOFFSET \
|
||||
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTarget)); \
|
||||
if (targetNode) { \
|
||||
A11YDEBUG_FOCUS_LOG_DOMNODE(targetNode) \
|
||||
} else { \
|
||||
printf("window: %p", (void*)aTarget); \
|
||||
} \
|
||||
A11YDEBUG_FOCUS_ENDBLOCK \
|
||||
}
|
||||
|
||||
#define A11YDEBUG_FOCUS_NOTIFICATION_DOMTARGET(aMsg, aTargetMsg, aTarget) \
|
||||
printf("\nA11Y FOCUS: " aMsg ". "); \
|
||||
A11YDEBUG_FOCUS_LOG_TIME \
|
||||
A11YDEBUG_FOCUS_LOG_DOMTARGET(aTargetMsg, aTarget)
|
||||
|
||||
#define A11YDEBUG_FOCUS_NOTIFICATION_ACCTARGET(aMsg, aTargetMsg, aTarget) \
|
||||
printf("\nA11Y FOCUS: " aMsg ". "); \
|
||||
A11YDEBUG_FOCUS_LOG_TIME \
|
||||
A11YDEBUG_FOCUS_LOG_ACCTARGET(aTargetMsg, aTarget)
|
||||
|
||||
#define A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE(aMsg, aTarget) \
|
||||
A11YDEBUG_FOCUS_LOG_ACCTARGET("Caused by: " aMsg, aTarget)
|
||||
|
||||
#else
|
||||
#define A11YDEBUG_FOCUS_LOG_DOMTARGET(aMsg, aTarget)
|
||||
#define A11YDEBUG_FOCUS_LOG_ACCTARGET(aMsg, aTarget)
|
||||
#define A11YDEBUG_FOCUS_LOG_WIDGET(aMsg, aWidget)
|
||||
#define A11YDEBUG_FOCUS_NOTIFICATION_SUPPORTSTARGET(aMsg, aTargetMsg, aTarget)
|
||||
#define A11YDEBUG_FOCUS_NOTIFICATION_DOMTARGET(aMsg, aTargetMsg, aTarget)
|
||||
#define A11YDEBUG_FOCUS_NOTIFICATION_ACCTARGET(aMsg, aTargetMsg, aTarget)
|
||||
#define A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE(aMsg, aTarget)
|
||||
#endif
|
||||
|
||||
#endif
|
@ -53,6 +53,7 @@ CPPSRCS = \
|
||||
AccGroupInfo.cpp \
|
||||
AccIterator.cpp \
|
||||
filters.cpp \
|
||||
FocusManager.cpp \
|
||||
NotificationController.cpp \
|
||||
nsAccDocManager.cpp \
|
||||
nsAccessNode.cpp \
|
||||
@ -89,6 +90,7 @@ EXPORTS = \
|
||||
EXPORTS_NAMESPACES = mozilla/a11y
|
||||
|
||||
EXPORTS_mozilla/a11y = \
|
||||
FocusManager.h \
|
||||
States.h \
|
||||
$(NULL)
|
||||
|
||||
|
@ -44,9 +44,12 @@
|
||||
#include "nsDocAccessible.h"
|
||||
#include "nsEventShell.h"
|
||||
#include "nsTextAccessible.h"
|
||||
#include "FocusManager.h"
|
||||
#include "TextUpdater.h"
|
||||
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NotificationCollector
|
||||
@ -182,7 +185,8 @@ NotificationController::IsUpdatePending()
|
||||
return mPresShell->IsLayoutFlushObserver() ||
|
||||
mObservingState == eRefreshProcessingForUpdate ||
|
||||
mContentInsertions.Length() != 0 || mNotifications.Length() != 0 ||
|
||||
mTextHash.Count() != 0;
|
||||
mTextHash.Count() != 0 ||
|
||||
!mDocument->HasLoadState(nsDocAccessible::eTreeConstructed);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -312,8 +316,15 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
|
||||
for (PRUint32 idx = 0; idx < eventCount; idx++) {
|
||||
AccEvent* accEvent = events[idx];
|
||||
if (accEvent->mEventRule != AccEvent::eDoNotEmit) {
|
||||
// Dispatch the focus event if target is still focused.
|
||||
if (accEvent->mEventType == nsIAccessibleEvent::EVENT_FOCUS) {
|
||||
FocusMgr()->ProcessFocusEvent(accEvent);
|
||||
continue;
|
||||
}
|
||||
|
||||
mDocument->ProcessPendingEvent(accEvent);
|
||||
|
||||
// Fire text change event caused by tree mutation.
|
||||
AccMutationEvent* showOrHideEvent = downcast_accEvent(accEvent);
|
||||
if (showOrHideEvent) {
|
||||
if (showOrHideEvent->mTextChangeEvent)
|
||||
@ -345,14 +356,14 @@ NotificationController::CoalesceEvents()
|
||||
PRInt32 tail = numQueuedEvents - 1;
|
||||
AccEvent* tailEvent = mEvents[tail];
|
||||
|
||||
// No node means this is application accessible (which can be a subject
|
||||
// of reorder events), we do not coalesce events for it currently.
|
||||
if (!tailEvent->mNode)
|
||||
return;
|
||||
|
||||
switch(tailEvent->mEventRule) {
|
||||
case AccEvent::eCoalesceFromSameSubtree:
|
||||
{
|
||||
// No node means this is application accessible (which is a subject of
|
||||
// reorder events), we do not coalesce events for it currently.
|
||||
if (!tailEvent->mNode)
|
||||
return;
|
||||
|
||||
for (PRInt32 index = tail - 1; index >= 0; index--) {
|
||||
AccEvent* thisEvent = mEvents[index];
|
||||
|
||||
@ -446,21 +457,18 @@ NotificationController::CoalesceEvents()
|
||||
|
||||
} break; // case eCoalesceFromSameSubtree
|
||||
|
||||
case AccEvent::eCoalesceFromSameDocument:
|
||||
case AccEvent::eCoalesceOfSameType:
|
||||
{
|
||||
// Used for focus event, coalesce more older event since focus event
|
||||
// for accessible can be duplicated by event for its document, we are
|
||||
// interested in focus event for accessible.
|
||||
// Coalesce old events by newer event.
|
||||
for (PRInt32 index = tail - 1; index >= 0; index--) {
|
||||
AccEvent* thisEvent = mEvents[index];
|
||||
if (thisEvent->mEventType == tailEvent->mEventType &&
|
||||
thisEvent->mEventRule == tailEvent->mEventRule &&
|
||||
thisEvent->GetDocAccessible() == tailEvent->GetDocAccessible()) {
|
||||
thisEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
AccEvent* accEvent = mEvents[index];
|
||||
if (accEvent->mEventType == tailEvent->mEventType &&
|
||||
accEvent->mEventRule == tailEvent->mEventRule) {
|
||||
accEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} break; // case eCoalesceFromSameDocument
|
||||
} break; // case eCoalesceOfSameType
|
||||
|
||||
case AccEvent::eRemoveDupes:
|
||||
{
|
||||
@ -565,7 +573,7 @@ NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent)
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
|
||||
if (editor) {
|
||||
PRBool isEmpty = PR_FALSE;
|
||||
bool isEmpty = false;
|
||||
editor->GetDocumentIsEmpty(&isEmpty);
|
||||
if (isEmpty)
|
||||
return;
|
||||
|
@ -344,7 +344,7 @@ private:
|
||||
~nsCOMPtrHashKey() { }
|
||||
|
||||
KeyType GetKey() const { return mKey; }
|
||||
PRBool KeyEquals(KeyTypePointer aKey) const { return aKey == mKey; }
|
||||
bool KeyEquals(KeyTypePointer aKey) const { return aKey == mKey; }
|
||||
|
||||
static KeyTypePointer KeyToPointer(KeyType aKey) { return aKey; }
|
||||
static PLDHashNumber HashKey(KeyTypePointer aKey)
|
||||
|
@ -316,7 +316,7 @@ nsARIAGridAccessible::GetRowDescription(PRInt32 aRow, nsAString& aDescription)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
||||
nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -347,7 +347,7 @@ nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
||||
nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -373,7 +373,7 @@ nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
|
||||
PRBool *aIsSelected)
|
||||
bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -458,7 +458,7 @@ nsARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
|
||||
if (!cell)
|
||||
continue;
|
||||
|
||||
PRBool isRowSelected = PR_TRUE;
|
||||
bool isRowSelected = true;
|
||||
do {
|
||||
if (!nsAccUtils::IsARIASelected(cell)) {
|
||||
isRowSelected = PR_FALSE;
|
||||
@ -605,7 +605,7 @@ nsARIAGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
|
||||
if (!cell)
|
||||
continue;
|
||||
|
||||
PRBool isRowSelected = PR_TRUE;
|
||||
bool isRowSelected = true;
|
||||
do {
|
||||
if (!nsAccUtils::IsARIASelected(cell)) {
|
||||
isRowSelected = PR_FALSE;
|
||||
@ -710,7 +710,7 @@ nsARIAGridAccessible::UnselectColumn(PRInt32 aColumn)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsARIAGridAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
nsARIAGridAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
|
||||
*aIsProbablyForLayout = PR_FALSE;
|
||||
@ -721,7 +721,7 @@ nsARIAGridAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsARIAGridAccessible::IsValidRow(PRInt32 aRow)
|
||||
{
|
||||
if (aRow < 0)
|
||||
@ -732,7 +732,7 @@ nsARIAGridAccessible::IsValidRow(PRInt32 aRow)
|
||||
return aRow < rowCount;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsARIAGridAccessible::IsValidColumn(PRInt32 aColumn)
|
||||
{
|
||||
if (aColumn < 0)
|
||||
@ -743,7 +743,7 @@ nsARIAGridAccessible::IsValidColumn(PRInt32 aColumn)
|
||||
return aColumn < colCount;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsARIAGridAccessible::IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn)
|
||||
{
|
||||
if (aRow < 0 || aColumn < 0)
|
||||
@ -788,7 +788,7 @@ nsARIAGridAccessible::GetCellInRowAt(nsAccessible *aRow, PRInt32 aColumn)
|
||||
|
||||
nsresult
|
||||
nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
|
||||
PRBool aIsSelected, PRBool aNotify)
|
||||
bool aIsSelected, bool aNotify)
|
||||
{
|
||||
nsIContent *content = aAccessible->GetContent();
|
||||
NS_ENSURE_STATE(content);
|
||||
@ -879,7 +879,7 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
|
||||
|
||||
PRInt32 selColCount = colCount;
|
||||
|
||||
nsTArray<PRBool> isColSelArray(selColCount);
|
||||
nsTArray<bool> isColSelArray(selColCount);
|
||||
isColSelArray.AppendElements(selColCount);
|
||||
for (PRInt32 i = 0; i < selColCount; i++)
|
||||
isColSelArray[i] = PR_TRUE;
|
||||
@ -1092,7 +1092,7 @@ nsARIAGridCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsARIAGridCellAccessible::IsSelected(PRBool *aIsSelected)
|
||||
nsARIAGridCellAccessible::IsSelected(bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
|
@ -62,17 +62,17 @@ protected:
|
||||
/**
|
||||
* Return true if the given row index is valid.
|
||||
*/
|
||||
PRBool IsValidRow(PRInt32 aRow);
|
||||
bool IsValidRow(PRInt32 aRow);
|
||||
|
||||
/**
|
||||
* Retrn true if the given column index is valid.
|
||||
*/
|
||||
PRBool IsValidColumn(PRInt32 aColumn);
|
||||
bool IsValidColumn(PRInt32 aColumn);
|
||||
|
||||
/**
|
||||
* Retrun true if given row and column indexes are valid.
|
||||
*/
|
||||
PRBool IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn);
|
||||
bool IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn);
|
||||
|
||||
/**
|
||||
* Return row accessible at the given row index.
|
||||
@ -92,8 +92,8 @@ protected:
|
||||
* @param aNotify [in, optional] specifies if DOM should be notified
|
||||
* about attribute change (used internally).
|
||||
*/
|
||||
nsresult SetARIASelected(nsAccessible *aAccessible, PRBool aIsSelected,
|
||||
PRBool aNotify = PR_TRUE);
|
||||
nsresult SetARIASelected(nsAccessible *aAccessible, bool aIsSelected,
|
||||
bool aNotify = true);
|
||||
|
||||
/**
|
||||
* Helper method for GetSelectedColumnCount and GetSelectedColumns.
|
||||
|
@ -755,7 +755,7 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName, eStateValueType aType,
|
||||
PRUint64 aPermanentState,
|
||||
PRUint64 aTrueState,
|
||||
PRUint64 aFalseState,
|
||||
PRBool aDefinedIfAbsent) :
|
||||
bool aDefinedIfAbsent) :
|
||||
mAttributeName(aAttrName),
|
||||
mIsToken(PR_TRUE),
|
||||
mPermanentState(aPermanentState),
|
||||
@ -801,7 +801,7 @@ nsStateMapEntry::nsStateMapEntry(nsIAtom** aAttrName,
|
||||
mDefaultState = aState1;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
|
||||
eStateMapEntryID aStateMapEntryID)
|
||||
{
|
||||
@ -814,7 +814,7 @@ nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
|
||||
if (entry.mIsToken) {
|
||||
// If attribute is considered as defined when it's absent then let's act
|
||||
// attribute value is "false" supposedly.
|
||||
PRBool hasAttr = aContent->HasAttr(kNameSpaceID_None, *entry.mAttributeName);
|
||||
bool hasAttr = aContent->HasAttr(kNameSpaceID_None, *entry.mAttributeName);
|
||||
if (entry.mDefinedIfAbsent && !hasAttr) {
|
||||
if (entry.mPermanentState)
|
||||
*aState |= entry.mPermanentState;
|
||||
@ -851,7 +851,7 @@ nsStateMapEntry::MapToStates(nsIContent* aContent, PRUint64* aState,
|
||||
|
||||
// Apply states for matched value. If no values was matched then apply default
|
||||
// states.
|
||||
PRBool applyDefaultStates = PR_TRUE;
|
||||
bool applyDefaultStates = true;
|
||||
if (entry.mValue1) {
|
||||
if (attrValue.EqualsASCII(entry.mValue1)) {
|
||||
applyDefaultStates = PR_FALSE;
|
||||
|
@ -107,12 +107,12 @@ enum ELiveAttrRule
|
||||
/**
|
||||
* ARIA role overrides role from native markup.
|
||||
*/
|
||||
const PRBool kUseMapRole = PR_TRUE;
|
||||
const bool kUseMapRole = true;
|
||||
|
||||
/**
|
||||
* ARIA role doesn't override the role from native markup.
|
||||
*/
|
||||
const PRBool kUseNativeRole = PR_FALSE;
|
||||
const bool kUseNativeRole = false;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -203,7 +203,7 @@ public:
|
||||
PRUint64 aPermanentState,
|
||||
PRUint64 aTrueState,
|
||||
PRUint64 aFalseState = 0,
|
||||
PRBool aDefinedIfAbsent = PR_FALSE);
|
||||
bool aDefinedIfAbsent = false);
|
||||
|
||||
/**
|
||||
* Used for ARIA attributes having enumerated values.
|
||||
@ -230,7 +230,7 @@ public:
|
||||
* @param aStateMapEntryID [in] state map entry ID
|
||||
* @return true if state map entry ID is valid
|
||||
*/
|
||||
static PRBool MapToStates(nsIContent* aContent, PRUint64* aState,
|
||||
static bool MapToStates(nsIContent* aContent, PRUint64* aState,
|
||||
eStateMapEntryID aStateMapEntryID);
|
||||
|
||||
private:
|
||||
@ -238,7 +238,7 @@ private:
|
||||
nsIAtom** mAttributeName;
|
||||
|
||||
// Indicates if attribute is token (can be undefined)
|
||||
PRBool mIsToken;
|
||||
bool mIsToken;
|
||||
|
||||
// State applied always if attribute is defined
|
||||
PRUint64 mPermanentState;
|
||||
@ -257,7 +257,7 @@ private:
|
||||
PRUint64 mDefaultState;
|
||||
|
||||
// Permanent and false states are applied if attribute is absent
|
||||
PRBool mDefinedIfAbsent;
|
||||
bool mDefinedIfAbsent;
|
||||
};
|
||||
|
||||
|
||||
@ -276,7 +276,7 @@ struct nsRoleMapEntry
|
||||
PRUint32 role;
|
||||
|
||||
// Role rule: whether to use mapped role or native semantics
|
||||
PRBool roleRule;
|
||||
bool roleRule;
|
||||
|
||||
// Value mapping rule: how to compute nsIAccessible value
|
||||
EValueRule valueRule;
|
||||
|
@ -98,7 +98,7 @@ nsAccDocManager::FindAccessibleInCache(nsINode* aNode) const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccDocManager protected
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccDocManager::Init()
|
||||
{
|
||||
mDocAccessibleCache.Init(4);
|
||||
@ -325,7 +325,7 @@ nsAccDocManager::HandleDOMDocumentLoad(nsIDocument *aDocument,
|
||||
|
||||
void
|
||||
nsAccDocManager::AddListeners(nsIDocument *aDocument,
|
||||
PRBool aAddDOMContentLoadedListener)
|
||||
bool aAddDOMContentLoadedListener)
|
||||
{
|
||||
nsPIDOMWindow *window = aDocument->GetWindow();
|
||||
nsIDOMEventTarget *target = window->GetChromeEventHandler();
|
||||
@ -362,7 +362,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
||||
if (!rootElm)
|
||||
return nsnull;
|
||||
|
||||
PRBool isRootDoc = nsCoreUtils::IsRootDocument(aDocument);
|
||||
bool isRootDoc = nsCoreUtils::IsRootDocument(aDocument);
|
||||
|
||||
nsDocAccessible* parentDocAcc = nsnull;
|
||||
if (!isRootDoc) {
|
||||
@ -418,6 +418,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
|
||||
}
|
||||
|
||||
NS_LOG_ACCDOCCREATE("document creation finished", aDocument)
|
||||
NS_LOG_ACCDOCCREATE_STACK
|
||||
|
||||
AddListeners(aDocument, isRootDoc);
|
||||
return docAcc;
|
||||
|
@ -97,7 +97,7 @@ protected:
|
||||
/**
|
||||
* Initialize the manager.
|
||||
*/
|
||||
PRBool Init();
|
||||
bool Init();
|
||||
|
||||
/**
|
||||
* Shutdown the manager.
|
||||
@ -123,7 +123,7 @@ private:
|
||||
/**
|
||||
* Add 'pagehide' and 'DOMContentLoaded' event listeners.
|
||||
*/
|
||||
void AddListeners(nsIDocument *aDocument, PRBool aAddPageShowListener);
|
||||
void AddListeners(nsIDocument *aDocument, bool aAddPageShowListener);
|
||||
|
||||
/**
|
||||
* Create document or root accessible.
|
||||
@ -165,6 +165,8 @@ private:
|
||||
*/
|
||||
#ifdef DEBUG_ACCDOCMGR
|
||||
|
||||
#include "nsTraceRefcntImpl.h"
|
||||
|
||||
// Enable these to log accessible document loading, creation or destruction.
|
||||
#define DEBUG_ACCDOCMGR_DOCLOAD
|
||||
#define DEBUG_ACCDOCMGR_DOCCREATE
|
||||
@ -182,7 +184,7 @@ private:
|
||||
|
||||
#define NS_LOG_ACCDOC_TYPE(aDocument) \
|
||||
if (aDocument->IsActive()) { \
|
||||
PRBool isContent = nsCoreUtils::IsContentDocument(aDocument); \
|
||||
bool isContent = nsCoreUtils::IsContentDocument(aDocument); \
|
||||
printf("%s document", (isContent ? "content" : "chrome")); \
|
||||
} else { \
|
||||
printf("document type: [failed]"); \
|
||||
@ -405,6 +407,10 @@ private:
|
||||
#define NS_LOG_ACCDOC_TEXT(aMsg) \
|
||||
printf(" " aMsg "\n");
|
||||
|
||||
#define NS_LOG_ACCDOC_STACK \
|
||||
printf(" stack: \n"); \
|
||||
nsTraceRefcntImpl::WalkTheStack(stdout);
|
||||
|
||||
// Accessible document loading macros.
|
||||
#ifdef DEBUG_ACCDOCMGR_DOCLOAD
|
||||
|
||||
@ -458,7 +464,7 @@ private:
|
||||
NS_LOG_ACCDOCLOAD_REQUEST(aRequest) \
|
||||
printf("\n"); \
|
||||
printf(" state flags: %x", aStateFlags); \
|
||||
PRBool isDocLoading; \
|
||||
bool isDocLoading; \
|
||||
aWebProgress->GetIsLoadingDocument(&isDocLoading); \
|
||||
printf(", document is %sloading\n", (isDocLoading ? "" : "not ")); \
|
||||
printf(" }\n"); \
|
||||
@ -515,7 +521,10 @@ private:
|
||||
NS_LOG_ACCDOC_ACCADDRESS(aName, aAcc)
|
||||
|
||||
#define NS_LOG_ACCDOCCREATE_TEXT(aMsg) \
|
||||
NS_LOG_ACCDOC_TEXT(aMsg)
|
||||
NS_LOG_ACCDOC_TEXT(aMsg)
|
||||
|
||||
#define NS_LOG_ACCDOCCREATE_STACK \
|
||||
NS_LOG_ACCDOC_STACK
|
||||
|
||||
#endif // DEBUG_ACCDOCMGR_DOCCREATE
|
||||
|
||||
@ -559,6 +568,7 @@ private:
|
||||
#define NS_LOG_ACCDOCCREATE(aMsg, aDocument)
|
||||
#define NS_LOG_ACCDOCCREATE_ACCADDRESS(aName, aAcc)
|
||||
#define NS_LOG_ACCDOCCREATE_TEXT(aMsg)
|
||||
#define NS_LOG_ACCDOCCREATE_STACK
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_ACCDOCMGR_DOCDESTROY
|
||||
|
@ -66,7 +66,7 @@ struct WalkState
|
||||
|
||||
nsAccTreeWalker::
|
||||
nsAccTreeWalker(nsIWeakReference* aShell, nsIContent* aContent,
|
||||
PRBool aWalkAnonContent, bool aWalkCache) :
|
||||
bool aWalkAnonContent, bool aWalkCache) :
|
||||
mWeakShell(aShell), mWalkCache(aWalkCache), mState(nsnull)
|
||||
{
|
||||
NS_ASSERTION(aContent, "No node for the accessible tree walker!");
|
||||
@ -147,7 +147,7 @@ nsAccTreeWalker::PopState()
|
||||
mState = prevToLastState;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccTreeWalker::PushState(nsIContent* aContent)
|
||||
{
|
||||
WalkState* nextToLastState = new WalkState(aContent);
|
||||
|
@ -54,7 +54,7 @@ class nsAccTreeWalker
|
||||
{
|
||||
public:
|
||||
nsAccTreeWalker(nsIWeakReference *aShell, nsIContent *aNode,
|
||||
PRBool aWalkAnonymousContent, bool aWalkCache = false);
|
||||
bool aWalkAnonymousContent, bool aWalkCache = false);
|
||||
virtual ~nsAccTreeWalker();
|
||||
|
||||
/**
|
||||
@ -86,7 +86,7 @@ private:
|
||||
* @note State stack is used to navigate up/down the DOM subtree during
|
||||
* accessible children search.
|
||||
*/
|
||||
PRBool PushState(nsIContent *aNode);
|
||||
bool PushState(nsIContent *aNode);
|
||||
|
||||
/**
|
||||
* Pop state from stack.
|
||||
|
@ -320,7 +320,7 @@ nsAccUtils::SetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccUtils::HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom)
|
||||
{
|
||||
NS_ASSERTION(aContent, "aContent is null in call to HasDefinedARIAToken!");
|
||||
@ -400,7 +400,7 @@ nsAccUtils::GetMultiSelectableContainer(nsINode* aNode)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccUtils::IsARIASelected(nsAccessible *aAccessible)
|
||||
{
|
||||
return aAccessible->GetContent()->
|
||||
@ -587,7 +587,7 @@ nsAccUtils::GetAttributeCharacteristics(nsIAtom* aAtom)
|
||||
return 0;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccUtils::GetLiveAttrValue(PRUint32 aRule, nsAString& aValue)
|
||||
{
|
||||
switch (aRule) {
|
||||
@ -604,10 +604,10 @@ nsAccUtils::GetLiveAttrValue(PRUint32 aRule, nsAString& aValue)
|
||||
|
||||
#ifdef DEBUG_A11Y
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccUtils::IsTextInterfaceSupportCorrect(nsAccessible *aAccessible)
|
||||
{
|
||||
PRBool foundText = PR_FALSE;
|
||||
bool foundText = false;
|
||||
|
||||
nsCOMPtr<nsIAccessibleDocument> accDoc = do_QueryObject(aAccessible);
|
||||
if (accDoc) {
|
||||
@ -655,7 +655,7 @@ nsAccUtils::TextLength(nsAccessible *aAccessible)
|
||||
return text.Length();
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccUtils::MustPrune(nsIAccessible *aAccessible)
|
||||
{
|
||||
PRUint32 role = nsAccUtils::Role(aAccessible);
|
||||
@ -693,7 +693,7 @@ nsAccUtils::GetHeaderCellsFor(nsIAccessibleTable *aTable,
|
||||
rv = aCell->GetColumnIndex(&colIdx);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool moveToLeft = aRowOrColHeaderCells == eRowHeaderCells;
|
||||
bool moveToLeft = aRowOrColHeaderCells == eRowHeaderCells;
|
||||
|
||||
// Move to the left or top to find row header cells or column header cells.
|
||||
PRInt32 index = (moveToLeft ? colIdx : rowIdx) - 1;
|
||||
@ -721,7 +721,7 @@ nsAccUtils::GetHeaderCellsFor(nsIAccessibleTable *aTable,
|
||||
if (origIdx == index) {
|
||||
// Append original header cells only.
|
||||
PRUint32 role = Role(cell);
|
||||
PRBool isHeader = moveToLeft ?
|
||||
bool isHeader = moveToLeft ?
|
||||
role == nsIAccessibleRole::ROLE_ROWHEADER :
|
||||
role == nsIAccessibleRole::ROLE_COLUMNHEADER;
|
||||
|
||||
|
@ -148,7 +148,7 @@ public:
|
||||
*
|
||||
* Return PR_TRUE if the ARIA property is defined, otherwise PR_FALSE
|
||||
*/
|
||||
static PRBool HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom);
|
||||
static bool HasDefinedARIAToken(nsIContent *aContent, nsIAtom *aAtom);
|
||||
|
||||
/**
|
||||
* Return atomic value of ARIA attribute of boolean or NMTOKEN type.
|
||||
@ -216,7 +216,7 @@ public:
|
||||
* Return true if the DOM node of given accessible has aria-selected="true"
|
||||
* attribute.
|
||||
*/
|
||||
static PRBool IsARIASelected(nsAccessible *aAccessible);
|
||||
static bool IsARIASelected(nsAccessible *aAccessible);
|
||||
|
||||
/**
|
||||
* Return text accessible containing focus point of the given selection.
|
||||
@ -313,20 +313,20 @@ public:
|
||||
*
|
||||
* @return true if object attribute should be exposed
|
||||
*/
|
||||
static PRBool GetLiveAttrValue(PRUint32 aRule, nsAString& aValue);
|
||||
static bool GetLiveAttrValue(PRUint32 aRule, nsAString& aValue);
|
||||
|
||||
#ifdef DEBUG_A11Y
|
||||
/**
|
||||
* Detect whether the given accessible object implements nsIAccessibleText,
|
||||
* when it is text or has text child node.
|
||||
*/
|
||||
static PRBool IsTextInterfaceSupportCorrect(nsAccessible *aAccessible);
|
||||
static bool IsTextInterfaceSupportCorrect(nsAccessible *aAccessible);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Return true if the given accessible has text role.
|
||||
*/
|
||||
static PRBool IsText(nsIAccessible *aAcc)
|
||||
static bool IsText(nsIAccessible *aAcc)
|
||||
{
|
||||
PRUint32 role = Role(aAcc);
|
||||
return role == nsIAccessibleRole::ROLE_TEXT_LEAF ||
|
||||
@ -341,7 +341,7 @@ public:
|
||||
/**
|
||||
* Return true if the given accessible is embedded object.
|
||||
*/
|
||||
static PRBool IsEmbeddedObject(nsIAccessible *aAcc)
|
||||
static bool IsEmbeddedObject(nsIAccessible *aAcc)
|
||||
{
|
||||
PRUint32 role = Role(aAcc);
|
||||
return role != nsIAccessibleRole::ROLE_TEXT_LEAF &&
|
||||
@ -373,7 +373,7 @@ public:
|
||||
* Return true if the given accessible can't have children. Used when exposing
|
||||
* to platform accessibility APIs, should the children be pruned off?
|
||||
*/
|
||||
static PRBool MustPrune(nsIAccessible *aAccessible);
|
||||
static bool MustPrune(nsIAccessible *aAccessible);
|
||||
|
||||
/**
|
||||
* Search hint enum constants. Used by GetHeaderCellsFor() method.
|
||||
|
@ -75,9 +75,8 @@
|
||||
*/
|
||||
|
||||
nsIStringBundle *nsAccessNode::gStringBundle = 0;
|
||||
nsINode *nsAccessNode::gLastFocusedNode = nsnull;
|
||||
|
||||
PRBool nsAccessNode::gIsFormFillEnabled = PR_FALSE;
|
||||
bool nsAccessNode::gIsFormFillEnabled = false;
|
||||
|
||||
nsApplicationAccessible *nsAccessNode::gApplicationAccessible = nsnull;
|
||||
|
||||
@ -136,7 +135,7 @@ nsAccessNode::IsDefunct() const
|
||||
return !mContent;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessNode::Init()
|
||||
{
|
||||
return PR_TRUE;
|
||||
@ -206,7 +205,7 @@ void nsAccessNode::InitXPAccessibility()
|
||||
}
|
||||
|
||||
// nsAccessNode protected static
|
||||
void nsAccessNode::NotifyA11yInitOrShutdown(PRBool aIsInit)
|
||||
void nsAccessNode::NotifyA11yInitOrShutdown(bool aIsInit)
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> obsService =
|
||||
mozilla::services::GetObserverService();
|
||||
@ -227,7 +226,6 @@ void nsAccessNode::ShutdownXPAccessibility()
|
||||
// at exit of program
|
||||
|
||||
NS_IF_RELEASE(gStringBundle);
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
|
||||
// Release gApplicationAccessible after everything else is shutdown
|
||||
// so we don't accidently create it again while tearing down root accessibles
|
||||
|
@ -107,11 +107,6 @@ public:
|
||||
*/
|
||||
nsRootAccessible* RootAccessible() const;
|
||||
|
||||
/**
|
||||
* Reference to a node of focused accessible.
|
||||
*/
|
||||
static nsINode *gLastFocusedNode;
|
||||
|
||||
/**
|
||||
* Return focused node within accessible window.
|
||||
*
|
||||
@ -123,7 +118,7 @@ public:
|
||||
/**
|
||||
* Initialize the access node object, add it to the cache.
|
||||
*/
|
||||
virtual PRBool Init();
|
||||
virtual bool Init();
|
||||
|
||||
/**
|
||||
* Shutdown the access node object.
|
||||
@ -162,7 +157,7 @@ public:
|
||||
/**
|
||||
* Return node type information of DOM node associated with the accessible.
|
||||
*/
|
||||
PRBool IsContent() const
|
||||
bool IsContent() const
|
||||
{
|
||||
return GetNode() && GetNode()->IsNodeOfType(nsINode::eCONTENT);
|
||||
}
|
||||
@ -211,12 +206,12 @@ protected:
|
||||
/**
|
||||
* Notify global nsIObserver's that a11y is getting init'd or shutdown
|
||||
*/
|
||||
static void NotifyA11yInitOrShutdown(PRBool aIsInit);
|
||||
static void NotifyA11yInitOrShutdown(bool aIsInit);
|
||||
|
||||
// Static data, we do our own refcounting for our static data
|
||||
static nsIStringBundle *gStringBundle;
|
||||
|
||||
static PRBool gIsFormFillEnabled;
|
||||
static bool gIsFormFillEnabled;
|
||||
|
||||
private:
|
||||
static nsApplicationAccessible *gApplicationAccessible;
|
||||
|
@ -43,6 +43,8 @@
|
||||
#include "nsApplicationAccessibleWrap.h"
|
||||
#include "nsARIAGridAccessibleWrap.h"
|
||||
#include "nsARIAMap.h"
|
||||
#include "FocusManager.h"
|
||||
|
||||
#include "nsIContentViewer.h"
|
||||
#include "nsCURILoader.h"
|
||||
#include "nsDocAccessible.h"
|
||||
@ -115,9 +117,10 @@ using namespace mozilla::a11y;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
|
||||
PRBool nsAccessibilityService::gIsShutdown = PR_TRUE;
|
||||
bool nsAccessibilityService::gIsShutdown = true;
|
||||
|
||||
nsAccessibilityService::nsAccessibilityService() : nsAccDocManager()
|
||||
nsAccessibilityService::nsAccessibilityService() :
|
||||
nsAccDocManager(), FocusManager()
|
||||
{
|
||||
NS_TIME_FUNCTION;
|
||||
}
|
||||
@ -175,7 +178,7 @@ nsAccessibilityService::FireAccessibleEvent(PRUint32 aEvent,
|
||||
|
||||
nsAccessible*
|
||||
nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
||||
PRBool aCanCreate)
|
||||
bool aCanCreate)
|
||||
{
|
||||
nsIDocument* documentNode = aPresShell->GetDocument();
|
||||
if (documentNode) {
|
||||
@ -873,7 +876,7 @@ nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode,
|
||||
return document ? document->GetAccessibleOrContainer(aNode) : nsnull;
|
||||
}
|
||||
|
||||
static PRBool HasRelatedContent(nsIContent *aContent)
|
||||
static bool HasRelatedContent(nsIContent *aContent)
|
||||
{
|
||||
nsAutoString id;
|
||||
if (!aContent || !nsCoreUtils::GetID(aContent, id) || id.IsEmpty()) {
|
||||
@ -992,7 +995,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
PRBool isHTML = content->IsHTML();
|
||||
bool isHTML = content->IsHTML();
|
||||
if (isHTML && content->Tag() == nsGkAtoms::map) {
|
||||
// Create hyper text accessible for HTML map if it is used to group links
|
||||
// (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML
|
||||
@ -1028,11 +1031,11 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
}
|
||||
|
||||
if (weakFrame.IsAlive() && !newAcc && isHTML) { // HTML accessibles
|
||||
PRBool tryTagNameOrFrame = PR_TRUE;
|
||||
bool tryTagNameOrFrame = true;
|
||||
|
||||
nsIAtom *frameType = weakFrame.GetFrame()->GetType();
|
||||
|
||||
PRBool partOfHTMLTable =
|
||||
bool partOfHTMLTable =
|
||||
frameType == nsGkAtoms::tableCaptionFrame ||
|
||||
frameType == nsGkAtoms::tableCellFrame ||
|
||||
frameType == nsGkAtoms::tableRowGroupFrame ||
|
||||
@ -1206,7 +1209,7 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessibilityService private
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessibilityService::Init()
|
||||
{
|
||||
// Initialize accessible document manager.
|
||||
@ -1252,7 +1255,7 @@ nsAccessibilityService::Shutdown()
|
||||
nsAccessNodeWrap::ShutdownAccessibility();
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessibilityService::HasUniversalAriaProperty(nsIContent *aContent)
|
||||
{
|
||||
// ARIA attributes that take token values (NMTOKEN, bool) are special cased
|
||||
@ -1852,3 +1855,13 @@ nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
|
||||
return accessible;
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Services
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
mozilla::a11y::FocusManager*
|
||||
mozilla::a11y::FocusMgr()
|
||||
{
|
||||
return nsAccessibilityService::gAccessibilityService;
|
||||
}
|
||||
|
@ -44,9 +44,23 @@
|
||||
#include "a11yGeneric.h"
|
||||
#include "nsAccDocManager.h"
|
||||
|
||||
#include "mozilla/a11y/FocusManager.h"
|
||||
|
||||
#include "nsIObserver.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Return focus manager.
|
||||
*/
|
||||
FocusManager* FocusMgr();
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
class nsAccessibilityService : public nsAccDocManager,
|
||||
public mozilla::a11y::FocusManager,
|
||||
public nsIAccessibilityService,
|
||||
public nsIObserver
|
||||
{
|
||||
@ -61,7 +75,7 @@ public:
|
||||
virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
|
||||
nsIPresShell* aPresShell);
|
||||
virtual nsAccessible* GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
||||
PRBool aCanCreate);
|
||||
bool aCanCreate);
|
||||
|
||||
virtual already_AddRefed<nsAccessible>
|
||||
CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
|
||||
@ -146,7 +160,7 @@ public:
|
||||
/**
|
||||
* Return true if accessibility service has been shutdown.
|
||||
*/
|
||||
static PRBool IsShutdown() { return gIsShutdown; }
|
||||
static bool IsShutdown() { return gIsShutdown; }
|
||||
|
||||
/**
|
||||
* Return an accessible for the given DOM node from the cache or create new
|
||||
@ -208,7 +222,7 @@ private:
|
||||
/**
|
||||
* Initialize accessibility service.
|
||||
*/
|
||||
PRBool Init();
|
||||
bool Init();
|
||||
|
||||
/**
|
||||
* Shutdowns accessibility service.
|
||||
@ -257,14 +271,14 @@ private:
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Reference for accessibility service.
|
||||
* Reference for accessibility service instance.
|
||||
*/
|
||||
static nsAccessibilityService *gAccessibilityService;
|
||||
static nsAccessibilityService* gAccessibilityService;
|
||||
|
||||
/**
|
||||
* Indicates whether accessibility service was shutdown.
|
||||
*/
|
||||
static PRBool gIsShutdown;
|
||||
static bool gIsShutdown;
|
||||
|
||||
/**
|
||||
* Does this content node have a universal ARIA property set on it?
|
||||
@ -273,9 +287,10 @@ private:
|
||||
* @param aContent The content node to test
|
||||
* @return PR_TRUE if there is a universal ARIA property set on the node
|
||||
*/
|
||||
PRBool HasUniversalAriaProperty(nsIContent *aContent);
|
||||
bool HasUniversalAriaProperty(nsIContent *aContent);
|
||||
|
||||
friend nsAccessibilityService* GetAccService();
|
||||
friend mozilla::a11y::FocusManager* mozilla::a11y::FocusMgr();
|
||||
|
||||
friend nsresult NS_GetAccessibilityService(nsIAccessibilityService** aResult);
|
||||
};
|
||||
|
@ -307,7 +307,7 @@ nsAccessible::Description(nsString& aDescription)
|
||||
aDescription);
|
||||
|
||||
if (aDescription.IsEmpty()) {
|
||||
PRBool isXUL = mContent->IsXUL();
|
||||
bool isXUL = mContent->IsXUL();
|
||||
if (isXUL) {
|
||||
// Try XUL <description control="[id]">description text</description>
|
||||
XULDescriptionIterator iter(GetDocAccessible(), mContent);
|
||||
@ -356,7 +356,7 @@ nsAccessible::AccessKey() const
|
||||
if (mContent->IsHTML()) {
|
||||
// Unless it is labeled via an ancestor <label>, in which case that would
|
||||
// be redundant.
|
||||
HTMLLabelIterator iter(GetDocAccessible(), mContent,
|
||||
HTMLLabelIterator iter(GetDocAccessible(), this,
|
||||
HTMLLabelIterator::eSkipAncestorLabel);
|
||||
label = iter.Next();
|
||||
|
||||
@ -549,7 +549,7 @@ nsAccessible::GetChildren(nsIArray **aOutChildren)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
return PR_TRUE;
|
||||
@ -590,8 +590,8 @@ nsresult nsAccessible::GetTranslatedString(const nsAString& aKey, nsAString& aSt
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsAccessible::IsVisible(PRBool* aIsOffscreen)
|
||||
bool
|
||||
nsAccessible::IsVisible(bool* aIsOffscreen)
|
||||
{
|
||||
// We need to know if at least a kMinPixels around the object is visible,
|
||||
// otherwise it will be marked states::OFFSCREEN. The states::INVISIBLE flag
|
||||
@ -627,7 +627,7 @@ nsAccessible::IsVisible(PRBool* aIsOffscreen)
|
||||
nsPresContext::CSSPixelsToAppUnits(kMinPixels));
|
||||
|
||||
if (frame->GetRect().IsEmpty()) {
|
||||
PRBool isEmpty = PR_TRUE;
|
||||
bool isEmpty = true;
|
||||
|
||||
nsIAtom *frameType = frame->GetType();
|
||||
if (frameType == nsGkAtoms::textFrame) {
|
||||
@ -670,7 +670,7 @@ nsAccessible::NativeState()
|
||||
if (!document || !document->IsInDocument(this))
|
||||
state |= states::STALE;
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
bool disabled = false;
|
||||
if (mContent->IsElement()) {
|
||||
nsEventStates elementState = mContent->AsElement()->State();
|
||||
|
||||
@ -693,19 +693,17 @@ nsAccessible::NativeState()
|
||||
state |= states::UNAVAILABLE;
|
||||
}
|
||||
else if (mContent->IsElement()) {
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (frame && frame->IsFocusable()) {
|
||||
nsIFrame* frame = GetFrame();
|
||||
if (frame && frame->IsFocusable())
|
||||
state |= states::FOCUSABLE;
|
||||
}
|
||||
|
||||
if (gLastFocusedNode == mContent) {
|
||||
if (FocusMgr()->IsFocused(this))
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if states::INVISIBLE and
|
||||
// states::OFFSCREEN flags should be turned on for this object.
|
||||
PRBool isOffscreen;
|
||||
bool isOffscreen;
|
||||
if (!IsVisible(&isOffscreen)) {
|
||||
state |= states::INVISIBLE;
|
||||
}
|
||||
@ -746,16 +744,11 @@ nsAccessible::GetFocusedChild(nsIAccessible** aChild)
|
||||
nsAccessible*
|
||||
nsAccessible::FocusedChild()
|
||||
{
|
||||
if (!gLastFocusedNode)
|
||||
return nsnull;
|
||||
if (gLastFocusedNode == mContent)
|
||||
return this;
|
||||
nsAccessible* focus = FocusMgr()->FocusedAccessible();
|
||||
if (focus && (focus == this || focus->Parent() == this))
|
||||
return focus;
|
||||
|
||||
nsAccessible* focusedChild = GetDocAccessible()->GetAccessible(gLastFocusedNode);
|
||||
if (!focusedChild || focusedChild->Parent() != this)
|
||||
return nsnull;
|
||||
|
||||
return focusedChild;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// nsAccessible::ChildAtPoint()
|
||||
@ -1026,7 +1019,7 @@ nsIFrame* nsAccessible::GetBoundsFrame()
|
||||
}
|
||||
|
||||
/* void removeSelection (); */
|
||||
NS_IMETHODIMP nsAccessible::SetSelected(PRBool aSelect)
|
||||
NS_IMETHODIMP nsAccessible::SetSelected(bool aSelect)
|
||||
{
|
||||
// Add or remove selection
|
||||
if (IsDefunct())
|
||||
@ -1127,7 +1120,7 @@ nsAccessible::GetHTMLName(nsAString& aLabel)
|
||||
nsAutoString label;
|
||||
|
||||
nsAccessible* labelAcc = nsnull;
|
||||
HTMLLabelIterator iter(GetDocAccessible(), mContent);
|
||||
HTMLLabelIterator iter(GetDocAccessible(), this);
|
||||
while ((labelAcc = iter.Next())) {
|
||||
nsresult rv = nsTextEquivUtils::
|
||||
AppendTextEquivFromContent(this, labelAcc->GetContent(), &label);
|
||||
@ -1242,7 +1235,7 @@ nsAccessible::HandleAccEvent(AccEvent* aEvent)
|
||||
|
||||
NS_ENSURE_STATE(observers);
|
||||
|
||||
PRBool hasObservers = PR_FALSE;
|
||||
bool hasObservers = false;
|
||||
observers->HasMoreElements(&hasObservers);
|
||||
if (hasObservers) {
|
||||
nsRefPtr<nsAccEvent> evnt(aEvent->CreateXPCOMObject());
|
||||
@ -1433,7 +1426,7 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
// Expose draggable object attribute?
|
||||
nsCOMPtr<nsIDOMNSHTMLElement> htmlElement = do_QueryInterface(mContent);
|
||||
if (htmlElement) {
|
||||
PRBool draggable = PR_FALSE;
|
||||
bool draggable = false;
|
||||
htmlElement->GetDraggable(&draggable);
|
||||
if (draggable) {
|
||||
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::draggable,
|
||||
@ -1531,7 +1524,7 @@ nsAccessible::State()
|
||||
nsAccessible* relTarget = nsnull;
|
||||
while ((relTarget = rel.Next())) {
|
||||
if (relTarget->Role() == nsIAccessibleRole::ROLE_PROPERTYPAGE &&
|
||||
nsCoreUtils::IsAncestorOf(relTarget->GetNode(), gLastFocusedNode))
|
||||
FocusMgr()->IsFocusWithin(relTarget))
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
}
|
||||
@ -2015,7 +2008,7 @@ nsAccessible::RelationByType(PRUint32 aType)
|
||||
Relation rel(new IDRefsIterator(mContent,
|
||||
nsGkAtoms::aria_labelledby));
|
||||
if (mContent->IsHTML()) {
|
||||
rel.AppendIter(new HTMLLabelIterator(GetDocAccessible(), mContent));
|
||||
rel.AppendIter(new HTMLLabelIterator(GetDocAccessible(), this));
|
||||
} else if (mContent->IsXUL()) {
|
||||
rel.AppendIter(new XULLabelIterator(GetDocAccessible(), mContent));
|
||||
}
|
||||
@ -2226,7 +2219,7 @@ nsAccessible::DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex)
|
||||
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
|
||||
|
||||
// Fire mouse down and mouse up events.
|
||||
PRBool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,
|
||||
bool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,
|
||||
aContent);
|
||||
if (!res)
|
||||
return;
|
||||
@ -2306,7 +2299,7 @@ NS_IMETHODIMP nsAccessible::RemoveChildFromSelection(PRInt32 aIndex)
|
||||
NS_OK : NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAccessible::IsChildSelected(PRInt32 aIndex, PRBool *aIsSelected)
|
||||
NS_IMETHODIMP nsAccessible::IsChildSelected(PRInt32 aIndex, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -2331,7 +2324,7 @@ nsAccessible::ClearSelection()
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::SelectAllSelection(PRBool* aIsMultiSelect)
|
||||
nsAccessible::SelectAllSelection(bool* aIsMultiSelect)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsMultiSelect);
|
||||
*aIsMultiSelect = PR_FALSE;
|
||||
@ -2424,7 +2417,7 @@ nsAccessible::GetAnchor(PRInt32 aIndex, nsIAccessible** aAccessible)
|
||||
|
||||
// readonly attribute boolean nsIAccessibleHyperLink::valid
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetValid(PRBool *aValid)
|
||||
nsAccessible::GetValid(bool *aValid)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValid);
|
||||
*aValid = PR_FALSE;
|
||||
@ -2438,7 +2431,7 @@ nsAccessible::GetValid(PRBool *aValid)
|
||||
|
||||
// readonly attribute boolean nsIAccessibleHyperLink::selected
|
||||
NS_IMETHODIMP
|
||||
nsAccessible::GetSelected(PRBool *aSelected)
|
||||
nsAccessible::GetSelected(bool *aSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelected);
|
||||
*aSelected = PR_FALSE;
|
||||
@ -2572,7 +2565,7 @@ nsAccessible::InvalidateChildren()
|
||||
SetChildrenFlag(eChildrenUninitialized);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessible::AppendChild(nsAccessible* aChild)
|
||||
{
|
||||
if (!aChild)
|
||||
@ -2588,7 +2581,7 @@ nsAccessible::AppendChild(nsAccessible* aChild)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessible::InsertChildAt(PRUint32 aIndex, nsAccessible* aChild)
|
||||
{
|
||||
if (!aChild)
|
||||
@ -2611,7 +2604,7 @@ nsAccessible::InsertChildAt(PRUint32 aIndex, nsAccessible* aChild)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessible::RemoveChild(nsAccessible* aChild)
|
||||
{
|
||||
if (!aChild)
|
||||
@ -2740,6 +2733,14 @@ nsAccessible::EndOffset()
|
||||
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccessible::IsLinkSelected()
|
||||
{
|
||||
NS_PRECONDITION(IsLink(),
|
||||
"IsLinkSelected() called on something that is not a hyper link!");
|
||||
return FocusMgr()->IsFocused(this);
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsAccessible::AnchorCount()
|
||||
{
|
||||
@ -2910,6 +2911,67 @@ nsAccessible::UnselectAll()
|
||||
return success;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Widgets
|
||||
|
||||
bool
|
||||
nsAccessible::IsWidget() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccessible::IsActiveWidget() const
|
||||
{
|
||||
return FocusMgr()->IsFocused(this);
|
||||
}
|
||||
|
||||
bool
|
||||
nsAccessible::AreItemsOperable() const
|
||||
{
|
||||
return mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant);
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsAccessible::CurrentItem()
|
||||
{
|
||||
// Check for aria-activedescendant, which changes which element has focus.
|
||||
// For activedescendant, the ARIA spec does not require that the user agent
|
||||
// checks whether pointed node is actually a DOM descendant of the element
|
||||
// with the aria-activedescendant attribute.
|
||||
nsAutoString id;
|
||||
if (mContent->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant, id)) {
|
||||
nsIDocument* DOMDoc = mContent->GetOwnerDoc();
|
||||
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
|
||||
if (activeDescendantElm) {
|
||||
nsDocAccessible* document = GetDocAccessible();
|
||||
if (document)
|
||||
return document->GetAccessible(activeDescendantElm);
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsAccessible::ContainerWidget() const
|
||||
{
|
||||
nsIAtom* idAttribute = mContent->GetIDAttributeName();
|
||||
if (idAttribute) {
|
||||
if (mContent->HasAttr(kNameSpaceID_None, idAttribute)) {
|
||||
nsAccessible* parent = Parent();
|
||||
do {
|
||||
nsIContent* parentContent = parent->GetContent();
|
||||
if (parentContent &&
|
||||
parentContent->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant)) {
|
||||
return parent;
|
||||
}
|
||||
} while ((parent = parent->Parent()));
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible protected methods
|
||||
@ -3065,7 +3127,7 @@ nsAccessible::GetActionRule(PRUint64 aStates)
|
||||
return eClickAction;
|
||||
|
||||
// Has registered 'click' event handler.
|
||||
PRBool isOnclick = nsCoreUtils::HasClickListener(mContent);
|
||||
bool isOnclick = nsCoreUtils::HasClickListener(mContent);
|
||||
|
||||
if (isOnclick)
|
||||
return eClickAction;
|
||||
|
@ -280,9 +280,9 @@ public:
|
||||
/**
|
||||
* Append/insert/remove a child. Return true if operation was successful.
|
||||
*/
|
||||
virtual PRBool AppendChild(nsAccessible* aChild);
|
||||
virtual PRBool InsertChildAt(PRUint32 aIndex, nsAccessible* aChild);
|
||||
virtual PRBool RemoveChild(nsAccessible* aChild);
|
||||
virtual bool AppendChild(nsAccessible* aChild);
|
||||
virtual bool InsertChildAt(PRUint32 aIndex, nsAccessible* aChild);
|
||||
virtual bool RemoveChild(nsAccessible* aChild);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Accessible tree traverse methods
|
||||
@ -315,7 +315,7 @@ public:
|
||||
/**
|
||||
* Return true if accessible has children;
|
||||
*/
|
||||
PRBool HasChildren() { return !!GetChildAt(0); }
|
||||
bool HasChildren() { return !!GetChildAt(0); }
|
||||
|
||||
/**
|
||||
* Return first/last/next/previous sibling of the accessible.
|
||||
@ -380,7 +380,7 @@ public:
|
||||
/**
|
||||
* Return true if there are accessible children in anonymous content
|
||||
*/
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
|
||||
/**
|
||||
* Returns text of accessible if accessible has text role otherwise empty
|
||||
@ -402,10 +402,16 @@ public:
|
||||
void TestChildCache(nsAccessible* aCachedChild) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Downcasting
|
||||
// Downcasting and types
|
||||
|
||||
inline bool IsApplication() const { return mFlags & eApplicationAccessible; }
|
||||
|
||||
bool IsAutoComplete() const { return mFlags & eAutoCompleteAccessible; }
|
||||
|
||||
inline bool IsAutoCompletePopup() const { return mFlags & eAutoCompletePopupAccessible; }
|
||||
|
||||
inline bool IsCombobox() const { return mFlags & eComboboxAccessible; }
|
||||
|
||||
inline bool IsDoc() const { return mFlags & eDocAccessible; }
|
||||
nsDocAccessible* AsDoc();
|
||||
|
||||
@ -415,6 +421,12 @@ public:
|
||||
inline bool IsHTMLListItem() const { return mFlags & eHTMLListItemAccessible; }
|
||||
nsHTMLLIAccessible* AsHTMLListItem();
|
||||
|
||||
inline bool IsListControl() const { return mFlags & eListControlAccessible; }
|
||||
|
||||
inline bool IsMenuButton() const { return mFlags & eMenuButtonAccessible; }
|
||||
|
||||
inline bool IsMenuPopup() const { return mFlags & eMenuPopupAccessible; }
|
||||
|
||||
inline bool IsRoot() const { return mFlags & eRootAccessible; }
|
||||
nsRootAccessible* AsRoot();
|
||||
|
||||
@ -475,12 +487,7 @@ public:
|
||||
/**
|
||||
* Return true if the link currently has the focus.
|
||||
*/
|
||||
inline bool IsLinkSelected()
|
||||
{
|
||||
NS_PRECONDITION(IsLink(),
|
||||
"IsLinkSelected() called on something that is not a hyper link!");
|
||||
return gLastFocusedNode == GetNode();
|
||||
}
|
||||
bool IsLinkSelected();
|
||||
|
||||
/**
|
||||
* Return the number of anchors within the link.
|
||||
@ -546,6 +553,38 @@ public:
|
||||
*/
|
||||
virtual bool UnselectAll();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Widgets
|
||||
|
||||
/**
|
||||
* Return true if accessible is a widget, i.e. control or accessible that
|
||||
* manages its items. Note, being a widget the accessible may be a part of
|
||||
* composite widget.
|
||||
*/
|
||||
virtual bool IsWidget() const;
|
||||
|
||||
/**
|
||||
* Return true if the widget is active, i.e. has a focus within it.
|
||||
*/
|
||||
virtual bool IsActiveWidget() const;
|
||||
|
||||
/**
|
||||
* Return true if the widget has items and items are operable by user and
|
||||
* can be activated.
|
||||
*/
|
||||
virtual bool AreItemsOperable() const;
|
||||
|
||||
/**
|
||||
* Return the current item of the widget, i.e. an item that has or will have
|
||||
* keyboard focus when widget gets active.
|
||||
*/
|
||||
virtual nsAccessible* CurrentItem();
|
||||
|
||||
/**
|
||||
* Return container widget this accessible belongs to.
|
||||
*/
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
|
||||
protected:
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -595,11 +634,17 @@ protected:
|
||||
*/
|
||||
enum AccessibleTypes {
|
||||
eApplicationAccessible = 1 << 2,
|
||||
eDocAccessible = 1 << 3,
|
||||
eHyperTextAccessible = 1 << 4,
|
||||
eHTMLListItemAccessible = 1 << 5,
|
||||
eRootAccessible = 1 << 6,
|
||||
eTextLeafAccessible = 1 << 7
|
||||
eAutoCompleteAccessible = 1 << 3,
|
||||
eAutoCompletePopupAccessible = 1 << 4,
|
||||
eComboboxAccessible = 1 << 5,
|
||||
eDocAccessible = 1 << 6,
|
||||
eHyperTextAccessible = 1 << 7,
|
||||
eHTMLListItemAccessible = 1 << 8,
|
||||
eListControlAccessible = 1 << 9,
|
||||
eMenuButtonAccessible = 1 << 10,
|
||||
eMenuPopupAccessible = 1 << 11,
|
||||
eRootAccessible = 1 << 12,
|
||||
eTextLeafAccessible = 1 << 13
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
@ -612,7 +657,7 @@ protected:
|
||||
|
||||
virtual nsIFrame* GetBoundsFrame();
|
||||
virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
|
||||
PRBool IsVisible(PRBool *aIsOffscreen);
|
||||
bool IsVisible(bool *aIsOffscreen);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Name helpers
|
||||
|
@ -174,12 +174,10 @@ nsApplicationAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
nsAccessible*
|
||||
nsApplicationAccessible::FocusedChild()
|
||||
{
|
||||
if (gLastFocusedNode) {
|
||||
nsAccessible* focusedChild =
|
||||
GetAccService()->GetAccessible(gLastFocusedNode);
|
||||
if (focusedChild && focusedChild->Parent() == this)
|
||||
return focusedChild;
|
||||
}
|
||||
nsAccessible* focus = FocusMgr()->FocusedAccessible();
|
||||
if (focus && focus->Parent() == this)
|
||||
return focus;
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
@ -205,7 +203,7 @@ nsApplicationAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsApplicationAccessible::SetSelected(PRBool aIsSelected)
|
||||
nsApplicationAccessible::SetSelected(bool aIsSelected)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
@ -316,7 +314,7 @@ nsApplicationAccessible::IsDefunct() const
|
||||
return nsAccessibilityService::IsShutdown();
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsApplicationAccessible::Init()
|
||||
{
|
||||
mAppInfo = do_GetService("@mozilla.org/xre/app-info;1");
|
||||
@ -393,7 +391,7 @@ nsApplicationAccessible::CacheChildren()
|
||||
if (NS_FAILED(rv))
|
||||
return;
|
||||
|
||||
PRBool hasMore = PR_FALSE;
|
||||
bool hasMore = false;
|
||||
windowEnumerator->HasMoreElements(&hasMore);
|
||||
while (hasMore) {
|
||||
nsCOMPtr<nsISupports> window;
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
PRInt32 *aPositionInGroup);
|
||||
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
PRInt32 *aWidth, PRInt32 *aHeight);
|
||||
NS_IMETHOD SetSelected(PRBool aIsSelected);
|
||||
NS_IMETHOD SetSelected(bool aIsSelected);
|
||||
NS_IMETHOD TakeSelection();
|
||||
NS_IMETHOD TakeFocus();
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString &aName);
|
||||
@ -107,7 +107,7 @@ public:
|
||||
|
||||
// nsAccessNode
|
||||
virtual bool IsDefunct() const;
|
||||
virtual PRBool Init();
|
||||
virtual bool Init();
|
||||
virtual void Shutdown();
|
||||
virtual bool IsPrimaryForNode() const;
|
||||
|
||||
|
@ -113,8 +113,8 @@ protected:
|
||||
* Parent accessible that provides an action for this linkable accessible.
|
||||
*/
|
||||
nsAccessible* mActionAcc;
|
||||
PRPackedBool mIsLink;
|
||||
PRPackedBool mIsOnclick;
|
||||
bool mIsLink;
|
||||
bool mIsOnclick;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -339,7 +339,7 @@ nsCaretAccessible::GetCaretRect(nsIWidget **aOutWidget)
|
||||
nsCOMPtr<nsISelection> caretSelection(do_QueryReferent(mLastUsedSelection));
|
||||
NS_ENSURE_TRUE(caretSelection, caretRect);
|
||||
|
||||
PRBool isVisible;
|
||||
bool isVisible;
|
||||
caret->GetCaretVisible(&isVisible);
|
||||
if (!isVisible) {
|
||||
return nsIntRect(); // Return empty rect
|
||||
|
@ -74,7 +74,7 @@ static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
|
||||
// nsCoreUtils
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::HasClickListener(nsIContent *aContent)
|
||||
{
|
||||
NS_ENSURE_TRUE(aContent, PR_FALSE);
|
||||
@ -150,7 +150,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
|
||||
tcContent, tcFrame, presShell, rootWidget);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
|
||||
nsIPresShell *aPresShell,
|
||||
nsIContent *aContent)
|
||||
@ -280,7 +280,7 @@ nsCoreUtils::GetRoleContent(nsINode *aNode)
|
||||
return content;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::IsAncestorOf(nsINode *aPossibleAncestorNode,
|
||||
nsINode *aPossibleDescendantNode,
|
||||
nsINode *aRootNode)
|
||||
@ -451,7 +451,7 @@ nsCoreUtils::GetDocShellTreeItemFor(nsINode *aNode)
|
||||
return docShellTreeItem;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
|
||||
@ -465,7 +465,7 @@ nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
|
||||
return !parentTreeItem;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::IsContentDocument(nsIDocument *aDocument)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
|
||||
@ -498,11 +498,11 @@ nsCoreUtils::IsTabDocument(nsIDocument* aDocumentNode)
|
||||
return parentTreeItem == rootTreeItem;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
|
||||
{
|
||||
nsIURI *uri = aDocument->GetDocumentURI();
|
||||
PRBool isAboutScheme = PR_FALSE;
|
||||
bool isAboutScheme = false;
|
||||
uri->SchemeIs("about", &isAboutScheme);
|
||||
if (!isAboutScheme)
|
||||
return PR_FALSE;
|
||||
@ -516,7 +516,7 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument)
|
||||
return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::IsCorrectFrameType(nsIFrame *aFrame, nsIAtom *aAtom)
|
||||
{
|
||||
NS_ASSERTION(aFrame != nsnull,
|
||||
@ -547,14 +547,14 @@ nsCoreUtils::GetDOMNodeForContainer(nsIDocShellTreeItem *aContainer)
|
||||
return node;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
|
||||
{
|
||||
nsIAtom *idAttribute = aContent->GetIDAttributeName();
|
||||
return idAttribute ? aContent->GetAttr(kNameSpaceID_None, idAttribute, aID) : PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr, PRInt32 *aUInt)
|
||||
{
|
||||
nsAutoString value;
|
||||
@ -571,7 +571,7 @@ nsCoreUtils::GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr, PRInt32 *aUInt)
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::IsXLink(nsIContent *aContent)
|
||||
{
|
||||
if (!aContent)
|
||||
@ -759,7 +759,7 @@ nsCoreUtils::GetPreviousSensibleColumn(nsITreeColumn *aColumn)
|
||||
return prevColumn.forget();
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCoreUtils::IsColumnHidden(nsITreeColumn *aColumn)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> element;
|
||||
@ -820,7 +820,7 @@ nsAccessibleDOMStringList::GetLength(PRUint32 *aLength)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessibleDOMStringList::Contains(const nsAString& aString, PRBool *aResult)
|
||||
nsAccessibleDOMStringList::Contains(const nsAString& aString, bool *aResult)
|
||||
{
|
||||
*aResult = mNames.Contains(aString);
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
* Return true if the given node has registered click, mousedown or mouseup
|
||||
* event listeners.
|
||||
*/
|
||||
static PRBool HasClickListener(nsIContent *aContent);
|
||||
static bool HasClickListener(nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Dispatch click event to XUL tree cell.
|
||||
@ -86,7 +86,7 @@ public:
|
||||
* @param aPresShell [in] the presshell for the given element
|
||||
* @param aContent [in] the element
|
||||
*/
|
||||
static PRBool DispatchMouseEvent(PRUint32 aEventType,
|
||||
static bool DispatchMouseEvent(PRUint32 aEventType,
|
||||
nsIPresShell *aPresShell,
|
||||
nsIContent *aContent);
|
||||
|
||||
@ -153,7 +153,7 @@ public:
|
||||
* @return PR_TRUE if aPossibleAncestorNode is an ancestor of
|
||||
* aPossibleDescendantNode
|
||||
*/
|
||||
static PRBool IsAncestorOf(nsINode *aPossibleAncestorNode,
|
||||
static bool IsAncestorOf(nsINode *aPossibleAncestorNode,
|
||||
nsINode *aPossibleDescendantNode,
|
||||
nsINode *aRootNode = nsnull);
|
||||
|
||||
@ -224,12 +224,12 @@ public:
|
||||
/**
|
||||
* Return true if the given document is root document.
|
||||
*/
|
||||
static PRBool IsRootDocument(nsIDocument *aDocument);
|
||||
static bool IsRootDocument(nsIDocument *aDocument);
|
||||
|
||||
/**
|
||||
* Return true if the given document is content document (not chrome).
|
||||
*/
|
||||
static PRBool IsContentDocument(nsIDocument *aDocument);
|
||||
static bool IsContentDocument(nsIDocument *aDocument);
|
||||
|
||||
/**
|
||||
* Return true if the given document node is for tab document accessible.
|
||||
@ -239,7 +239,7 @@ public:
|
||||
/**
|
||||
* Return true if the given document is an error page.
|
||||
*/
|
||||
static PRBool IsErrorPage(nsIDocument *aDocument);
|
||||
static bool IsErrorPage(nsIDocument *aDocument);
|
||||
|
||||
/**
|
||||
* Retrun true if the type of given frame equals to the given frame type.
|
||||
@ -247,7 +247,7 @@ public:
|
||||
* @param aFrame the frame
|
||||
* @param aAtom the frame type
|
||||
*/
|
||||
static PRBool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
static bool IsCorrectFrameType(nsIFrame* aFrame, nsIAtom* aAtom);
|
||||
|
||||
/**
|
||||
* Return presShell for the document containing the given DOM node.
|
||||
@ -276,13 +276,13 @@ public:
|
||||
* @param aID Where to put ID string
|
||||
* @return PR_TRUE if there is an ID set for this node
|
||||
*/
|
||||
static PRBool GetID(nsIContent *aContent, nsAString& aID);
|
||||
static bool GetID(nsIContent *aContent, nsAString& aID);
|
||||
|
||||
/**
|
||||
* Convert attribute value of the given node to positive integer. If no
|
||||
* attribute or wrong value then false is returned.
|
||||
*/
|
||||
static PRBool GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr,
|
||||
static bool GetUIntAttr(nsIContent *aContent, nsIAtom *aAttr,
|
||||
PRInt32 *aUInt);
|
||||
|
||||
/**
|
||||
@ -291,7 +291,7 @@ public:
|
||||
* @param aContent the given element
|
||||
* @return PR_TRUE if the given element is XLink
|
||||
*/
|
||||
static PRBool IsXLink(nsIContent *aContent);
|
||||
static bool IsXLink(nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Returns language for the given node.
|
||||
@ -360,12 +360,12 @@ public:
|
||||
/**
|
||||
* Return true if the given column is hidden (i.e. not sensible).
|
||||
*/
|
||||
static PRBool IsColumnHidden(nsITreeColumn *aColumn);
|
||||
static bool IsColumnHidden(nsITreeColumn *aColumn);
|
||||
|
||||
/**
|
||||
* Return true if the given node is table header element.
|
||||
*/
|
||||
static PRBool IsHTMLTableHeader(nsIContent *aContent)
|
||||
static bool IsHTMLTableHeader(nsIContent *aContent)
|
||||
{
|
||||
return aContent->NodeInfo()->Equals(nsGkAtoms::th) ||
|
||||
aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scope);
|
||||
@ -391,7 +391,7 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDOMDOMSTRINGLIST
|
||||
|
||||
PRBool Add(const nsAString& aName) {
|
||||
bool Add(const nsAString& aName) {
|
||||
return mNames.AppendElement(aName) != nsnull;
|
||||
}
|
||||
|
||||
|
@ -295,18 +295,10 @@ nsDocAccessible::NativeState()
|
||||
PRUint64 state = (mContent->GetCurrentDoc() == mDocument) ?
|
||||
0 : states::STALE;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
|
||||
if (!xulDoc)
|
||||
#endif
|
||||
{
|
||||
// XXX Need to invent better check to see if doc is focusable,
|
||||
// which it should be if it is scrollable. A XUL document could be focusable.
|
||||
// See bug 376803.
|
||||
state |= states::FOCUSABLE;
|
||||
if (gLastFocusedNode == mDocument)
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
// Document is always focusable.
|
||||
state |= states::FOCUSABLE;
|
||||
if (FocusMgr()->IsFocused(this))
|
||||
state |= states::FOCUSED;
|
||||
|
||||
// Expose stale state until the document is ready (DOM is loaded and tree is
|
||||
// constructed).
|
||||
@ -357,12 +349,9 @@ nsDocAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
|
||||
nsAccessible*
|
||||
nsDocAccessible::FocusedChild()
|
||||
{
|
||||
// XXXndeakin P3 accessibility shouldn't be caching the focus
|
||||
|
||||
// Return an accessible for the current global focus, which does not have to
|
||||
// be contained within the current document.
|
||||
return gLastFocusedNode ? GetAccService()->GetAccessible(gLastFocusedNode) :
|
||||
nsnull;
|
||||
return FocusMgr()->FocusedAccessible();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
||||
@ -370,11 +359,6 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
PRUint64 state = NativeState();
|
||||
if (0 == (state & states::FOCUSABLE)) {
|
||||
return NS_ERROR_FAILURE; // Not focusable
|
||||
}
|
||||
|
||||
// Focus the document.
|
||||
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
|
||||
NS_ENSURE_STATE(fm);
|
||||
@ -555,7 +539,7 @@ NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
|
||||
if (!editor) {
|
||||
return NS_OK;
|
||||
}
|
||||
PRBool isEditable;
|
||||
bool isEditable;
|
||||
editor->GetIsDocumentEditable(&isEditable);
|
||||
if (isEditable) {
|
||||
NS_ADDREF(*aEditor = editor);
|
||||
@ -594,7 +578,7 @@ nsDocAccessible::GetAccessible(nsINode* aNode) const
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessNode
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsDocAccessible::Init()
|
||||
{
|
||||
NS_LOG_ACCDOCCREATE_FOR("document initialize", mDocument, this)
|
||||
@ -739,7 +723,7 @@ nsresult nsDocAccessible::AddEventListeners()
|
||||
PRInt32 itemType;
|
||||
docShellTreeItem->GetItemType(&itemType);
|
||||
|
||||
PRBool isContent = (itemType == nsIDocShellTreeItem::typeContent);
|
||||
bool isContent = (itemType == nsIDocShellTreeItem::typeContent);
|
||||
|
||||
if (isContent) {
|
||||
// We're not an editor yet, but we might become one
|
||||
@ -1050,7 +1034,7 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_busy) {
|
||||
PRBool isOn = aContent->AttrValueIs(aNameSpaceID, aAttribute,
|
||||
bool isOn = aContent->AttrValueIs(aNameSpaceID, aAttribute,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
nsRefPtr<AccEvent> event = new AccStateChangeEvent(aContent, states::BUSY, isOn);
|
||||
FireDelayedAccessibleEvent(event);
|
||||
@ -1063,11 +1047,7 @@ nsDocAccessible::AttributeChangedImpl(nsIContent* aContent, PRInt32 aNameSpaceID
|
||||
|
||||
nsAccessible *multiSelect =
|
||||
nsAccUtils::GetMultiSelectableContainer(aContent);
|
||||
// Multi selects use selection_add and selection_remove
|
||||
// Single select widgets just mirror event_selection for
|
||||
// whatever gets event_focus, which is done in
|
||||
// nsRootAccessible::FireAccessibleFocusEvent()
|
||||
// So right here we make sure only to deal with multi selects
|
||||
// XXX: Multi selects are handled here only (bug 414302).
|
||||
if (multiSelect) {
|
||||
// Need to find the right event to use here, SELECTION_WITHIN would
|
||||
// seem right but we had started using it for something else
|
||||
@ -1118,17 +1098,13 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
return;
|
||||
}
|
||||
|
||||
// The activedescendant universal property redirects accessible focus events
|
||||
// to the element with the id that activedescendant points to. Make sure
|
||||
// the tree up to date before processing.
|
||||
if (aAttribute == nsGkAtoms::aria_activedescendant) {
|
||||
// The activedescendant universal property redirects accessible focus events
|
||||
// to the element with the id that activedescendant points to
|
||||
nsCOMPtr<nsINode> focusedNode = GetCurrentFocus();
|
||||
if (nsCoreUtils::GetRoleContent(focusedNode) == aContent) {
|
||||
nsAccessible* focusedAcc = GetAccService()->GetAccessible(focusedNode);
|
||||
nsRootAccessible* rootAcc = RootAccessible();
|
||||
if (rootAcc && focusedAcc) {
|
||||
rootAcc->FireAccessibleFocusEvent(focusedAcc, nsnull, PR_TRUE);
|
||||
}
|
||||
}
|
||||
mNotificationController->HandleNotification<nsDocAccessible, nsIContent>
|
||||
(this, &nsDocAccessible::ARIAActiveDescendantChanged, aContent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1200,6 +1176,26 @@ nsDocAccessible::ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsDocAccessible::ARIAActiveDescendantChanged(nsIContent* aElm)
|
||||
{
|
||||
if (FocusMgr()->HasDOMFocus(aElm)) {
|
||||
nsAutoString id;
|
||||
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant, id)) {
|
||||
nsIDocument* DOMDoc = aElm->GetOwnerDoc();
|
||||
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
|
||||
if (activeDescendantElm) {
|
||||
nsAccessible* activeDescendant = GetAccessible(activeDescendantElm);
|
||||
if (activeDescendant) {
|
||||
FocusMgr()->ActiveItemChanged(activeDescendant, false);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("ARIA activedescedant changed",
|
||||
activeDescendant)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nsDocAccessible::ContentAppended(nsIDocument *aDocument,
|
||||
nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent,
|
||||
@ -1362,6 +1358,13 @@ nsDocAccessible::UnbindFromDocument(nsAccessible* aAccessible)
|
||||
NS_ASSERTION(mAccessibleCache.GetWeak(aAccessible->UniqueID()),
|
||||
"Unbinding the unbound accessible!");
|
||||
|
||||
// Fire focus event on accessible having DOM focus if active item was removed
|
||||
// from the tree.
|
||||
if (FocusMgr()->IsActiveItem(aAccessible)) {
|
||||
FocusMgr()->ActiveItemChanged(nsnull);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("tree shutdown", aAccessible)
|
||||
}
|
||||
|
||||
// Remove an accessible from node-to-accessible map if it exists there.
|
||||
if (aAccessible->IsPrimaryForNode() &&
|
||||
mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible)
|
||||
@ -1732,7 +1735,6 @@ nsDocAccessible::ProcessPendingEvent(AccEvent* aEvent)
|
||||
return;
|
||||
|
||||
PRUint32 eventType = aEvent->GetEventType();
|
||||
|
||||
if (eventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) {
|
||||
nsCOMPtr<nsIAccessibleText> accessibleText = do_QueryObject(accessible);
|
||||
PRInt32 caretOffset;
|
||||
@ -1742,13 +1744,6 @@ nsDocAccessible::ProcessPendingEvent(AccEvent* aEvent)
|
||||
PRUnichar chAtOffset;
|
||||
accessibleText->GetCharacterAtOffset(caretOffset, &chAtOffset);
|
||||
printf("\nCaret moved to %d with char %c", caretOffset, chAtOffset);
|
||||
#endif
|
||||
#ifdef DEBUG_CARET
|
||||
// Test caret line # -- fire an EVENT_ALERT on the focused node so we can watch the
|
||||
// line-number object attribute on it
|
||||
nsAccessible* focusedAcc =
|
||||
GetAccService()->GetAccessible(gLastFocusedNode);
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, focusedAcc);
|
||||
#endif
|
||||
nsRefPtr<AccEvent> caretMoveEvent =
|
||||
new AccCaretMoveEvent(accessible, caretOffset);
|
||||
@ -1948,10 +1943,11 @@ nsDocAccessible::UpdateTreeInternal(nsAccessible* aChild, bool aIsInsert)
|
||||
// while it's focused. Fire focus event on new focused accessible. If
|
||||
// the queue contains focus event for this node then it's suppressed by
|
||||
// this one.
|
||||
if (node == gLastFocusedNode) {
|
||||
FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_FOCUS,
|
||||
node, AccEvent::eCoalesceFromSameDocument);
|
||||
}
|
||||
// XXX: do we really want to send focus to focused DOM node not taking into
|
||||
// account active item?
|
||||
if (FocusMgr()->IsFocused(aChild))
|
||||
FocusMgr()->DispatchFocusEvent(this, aChild);
|
||||
|
||||
} else {
|
||||
// Update the tree for content removal.
|
||||
// The accessible parent may differ from container accessible if
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
NS_DECL_NSIDOCUMENTOBSERVER
|
||||
|
||||
// nsAccessNode
|
||||
virtual PRBool Init();
|
||||
virtual bool Init();
|
||||
virtual void Shutdown();
|
||||
virtual nsIFrame* GetFrame() const;
|
||||
virtual bool IsDefunct() const;
|
||||
@ -132,7 +132,7 @@ public:
|
||||
/**
|
||||
* Return true if associated DOM document was loaded and isn't unloading.
|
||||
*/
|
||||
PRBool IsContentLoaded() const
|
||||
bool IsContentLoaded() const
|
||||
{
|
||||
// eDOMLoaded flag check is used for error pages as workaround to make this
|
||||
// method return correct result since error pages do not receive 'pageshow'
|
||||
@ -305,7 +305,7 @@ public:
|
||||
* XBL bindings. Be careful the result of this method may be senseless
|
||||
* while it's called for XUL elements (where XBL is used widely).
|
||||
*/
|
||||
PRBool IsDependentID(const nsAString& aID) const
|
||||
bool IsDependentID(const nsAString& aID) const
|
||||
{ return mDependentIDsHash.Get(aID, nsnull); }
|
||||
|
||||
/**
|
||||
@ -456,6 +456,11 @@ protected:
|
||||
*/
|
||||
void ARIAAttributeChanged(nsIContent* aContent, nsIAtom* aAttribute);
|
||||
|
||||
/**
|
||||
* Process ARIA active-descendant attribute change.
|
||||
*/
|
||||
void ARIAActiveDescendantChanged(nsIContent* aElm);
|
||||
|
||||
/**
|
||||
* Process the event when the queue of pending events is untwisted. Fire
|
||||
* accessible events as result of the processing.
|
||||
|
@ -92,5 +92,5 @@ nsEventShell::GetEventAttributes(nsINode *aNode,
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsEventShell: private
|
||||
|
||||
PRBool nsEventShell::sEventFromUserInput = PR_FALSE;
|
||||
bool nsEventShell::sEventFromUserInput = false;
|
||||
nsCOMPtr<nsINode> nsEventShell::sEventTargetNode;
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
|
||||
private:
|
||||
static nsCOMPtr<nsINode> sEventTargetNode;
|
||||
static PRBool sEventFromUserInput;
|
||||
static bool sEventFromUserInput;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -75,6 +75,16 @@ ProgressMeterAccessible<Max>::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_PROGRESSBAR;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// ProgressMeterAccessible<Max>: Widgets
|
||||
|
||||
template<int Max>
|
||||
bool
|
||||
ProgressMeterAccessible<Max>::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleValue
|
||||
|
||||
@ -222,3 +232,11 @@ nsRadioButtonAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_RADIOBUTTON;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsRadioButtonAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsRadioButtonAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -63,6 +63,9 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -85,6 +88,9 @@ public:
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -69,12 +69,6 @@ nsOuterDocAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_INTERNAL_FRAME;
|
||||
}
|
||||
|
||||
PRUint64
|
||||
nsOuterDocAccessible::NativeState()
|
||||
{
|
||||
return nsAccessible::NativeState() & ~states::FOCUSABLE;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
@ -182,7 +176,7 @@ nsOuterDocAccessible::InvalidateChildren()
|
||||
SetChildrenFlag(eChildrenUninitialized);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
|
||||
{
|
||||
// We keep showing the old document for a bit after creating the new one,
|
||||
@ -203,7 +197,7 @@ nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible)
|
||||
{
|
||||
nsAccessible *child = mChildren.SafeElementAt(0, nsnull);
|
||||
@ -216,7 +210,7 @@ nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible)
|
||||
child->GetDocumentNode(), child)
|
||||
NS_LOG_ACCDOCDESTROY_ACCADDRESS("outerdoc", this)
|
||||
|
||||
PRBool wasRemoved = nsAccessible::RemoveChild(child);
|
||||
bool wasRemoved = nsAccessible::RemoveChild(child);
|
||||
|
||||
NS_ASSERTION(!mChildren.Length(),
|
||||
"This child document of outerdoc accessible wasn't removed!");
|
||||
|
@ -67,14 +67,13 @@ public:
|
||||
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
|
||||
virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild);
|
||||
|
||||
virtual void InvalidateChildren();
|
||||
virtual PRBool AppendChild(nsAccessible *aAccessible);
|
||||
virtual PRBool RemoveChild(nsAccessible *aAccessible);
|
||||
virtual bool AppendChild(nsAccessible *aAccessible);
|
||||
virtual bool RemoveChild(nsAccessible *aAccessible);
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
@ -61,14 +61,11 @@
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMDataContainerEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsMenuFrame.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
@ -86,7 +83,7 @@
|
||||
#include "nsIXULWindow.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
namespace dom = mozilla::dom;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -223,9 +220,6 @@ const char* const docEvents[] = {
|
||||
// debugging a11y objects with event viewers
|
||||
"mouseover",
|
||||
#endif
|
||||
// capture DOM focus and DOM blur events
|
||||
"focus",
|
||||
"blur",
|
||||
// capture Form change events
|
||||
"select",
|
||||
// capture ValueChange events (fired whenever value changes, immediately after, whether focus moves or not)
|
||||
@ -246,6 +240,7 @@ const char* const docEvents[] = {
|
||||
"popuphiding",
|
||||
"DOMMenuInactive",
|
||||
"DOMMenuItemActive",
|
||||
"DOMMenuItemInactive",
|
||||
"DOMMenuBarActive",
|
||||
"DOMMenuBarInactive"
|
||||
};
|
||||
@ -308,125 +303,6 @@ nsRootAccessible::GetCaretAccessible()
|
||||
return mCaretAccessible;
|
||||
}
|
||||
|
||||
void
|
||||
nsRootAccessible::FireAccessibleFocusEvent(nsAccessible* aFocusAccessible,
|
||||
nsIContent* aRealFocusContent,
|
||||
PRBool aForceEvent,
|
||||
EIsFromUserInput aIsFromUserInput)
|
||||
{
|
||||
// Implementors: only fire delayed/async events from this method.
|
||||
|
||||
// Set selection listener for focused element.
|
||||
if (mCaretAccessible && aRealFocusContent)
|
||||
mCaretAccessible->SetControlSelectionListener(aRealFocusContent);
|
||||
|
||||
nsAccessible* focusAccessible = aFocusAccessible;
|
||||
|
||||
// Check for aria-activedescendant, which changes which element has focus.
|
||||
// For activedescendant, the ARIA spec does not require that the user agent
|
||||
// checks whether pointed node is actually a DOM descendant of the element
|
||||
// with the aria-activedescendant attribute.
|
||||
nsIContent* content = focusAccessible->GetContent();
|
||||
if (content) {
|
||||
nsAutoString id;
|
||||
if (content->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_activedescendant, id)) {
|
||||
nsIDocument* DOMDoc = content->GetOwnerDoc();
|
||||
nsIContent* activeDescendantContent = DOMDoc->GetElementById(id);
|
||||
|
||||
// If aria-activedescendant is set to nonexistant ID, then treat as focus
|
||||
// on the activedescendant container (which has real DOM focus).
|
||||
if (activeDescendantContent) {
|
||||
nsAccessible* activeDescendant =
|
||||
GetAccService()->GetAccessible(activeDescendantContent);
|
||||
if (activeDescendant) {
|
||||
focusAccessible = activeDescendant;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fire focus only if it changes, but always fire focus events when
|
||||
// aForceEvent == PR_TRUE
|
||||
nsINode* focusNode = focusAccessible->GetNode();
|
||||
if (gLastFocusedNode == focusNode && !aForceEvent)
|
||||
return;
|
||||
|
||||
nsDocAccessible* focusDocument = focusAccessible->GetDocAccessible();
|
||||
NS_ASSERTION(focusDocument, "No document while accessible is in document?!");
|
||||
|
||||
// Fire menu start/end events for ARIA menus.
|
||||
if (focusAccessible->ARIARole() == nsIAccessibleRole::ROLE_MENUITEM) {
|
||||
// The focus is inside a menu.
|
||||
if (!mCurrentARIAMenubar) {
|
||||
// Entering ARIA menu. Fire menu start event.
|
||||
nsAccessible* menuBarAccessible =
|
||||
nsAccUtils::GetAncestorWithRole(focusAccessible,
|
||||
nsIAccessibleRole::ROLE_MENUBAR);
|
||||
if (menuBarAccessible) {
|
||||
mCurrentARIAMenubar = menuBarAccessible->GetNode();
|
||||
if (mCurrentARIAMenubar) {
|
||||
nsRefPtr<AccEvent> menuStartEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
|
||||
menuBarAccessible, aIsFromUserInput,
|
||||
AccEvent::eAllowDupes);
|
||||
if (menuStartEvent)
|
||||
focusDocument->FireDelayedAccessibleEvent(menuStartEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mCurrentARIAMenubar) {
|
||||
// Focus left a menu. Fire menu end event.
|
||||
nsRefPtr<AccEvent> menuEndEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
|
||||
aIsFromUserInput, AccEvent::eAllowDupes);
|
||||
if (menuEndEvent) {
|
||||
focusDocument->FireDelayedAccessibleEvent(menuEndEvent);
|
||||
}
|
||||
mCurrentARIAMenubar = nsnull;
|
||||
}
|
||||
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
gLastFocusedNode = focusNode;
|
||||
NS_IF_ADDREF(gLastFocusedNode);
|
||||
|
||||
// Coalesce focus events from the same document, because DOM focus event might
|
||||
// be fired for the document node and then for the focused DOM element.
|
||||
nsRefPtr<AccEvent> focusEvent =
|
||||
new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, focusAccessible,
|
||||
aIsFromUserInput, AccEvent::eCoalesceFromSameDocument);
|
||||
focusDocument->FireDelayedAccessibleEvent(focusEvent);
|
||||
}
|
||||
|
||||
void
|
||||
nsRootAccessible::FireCurrentFocusEvent()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return;
|
||||
|
||||
// Simulate a focus event so that we can reuse code that fires focus for
|
||||
// container children like treeitems.
|
||||
nsCOMPtr<nsINode> focusedNode = GetCurrentFocus();
|
||||
if (!focusedNode) {
|
||||
return; // No current focus
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(mDocument);
|
||||
if (domDoc) {
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
if (NS_SUCCEEDED(domDoc->CreateEvent(NS_LITERAL_STRING("Events"),
|
||||
getter_AddRefs(event))) &&
|
||||
NS_SUCCEEDED(event->InitEvent(NS_LITERAL_STRING("focus"), PR_TRUE, PR_TRUE))) {
|
||||
|
||||
nsCOMPtr<nsIPrivateDOMEvent> privateEvent(do_QueryInterface(event));
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(focusedNode));
|
||||
privateEvent->SetTarget(target);
|
||||
HandleEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsRootAccessible::DocumentActivated(nsDocAccessible* aDocument)
|
||||
{
|
||||
@ -497,14 +373,13 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
if (!weakShell)
|
||||
return;
|
||||
|
||||
nsAccessible* accessible =
|
||||
GetAccService()->GetAccessibleOrContainer(origTargetNode, weakShell);
|
||||
|
||||
if (eventType.EqualsLiteral("popuphiding")) {
|
||||
HandlePopupHidingEvent(origTargetNode, accessible);
|
||||
HandlePopupHidingEvent(origTargetNode);
|
||||
return;
|
||||
}
|
||||
|
||||
nsAccessible* accessible =
|
||||
GetAccService()->GetAccessibleOrContainer(origTargetNode, weakShell);
|
||||
if (!accessible)
|
||||
return;
|
||||
|
||||
@ -518,7 +393,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
origTargetNode->AsElement() : nsnull;
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
PRBool isTree = targetContent ?
|
||||
bool isTree = targetContent ?
|
||||
targetContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) :
|
||||
PR_FALSE;
|
||||
|
||||
@ -553,14 +428,16 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
// and panebutton is exposed as XULListitem in A11y.
|
||||
// nsXULListitemAccessible::GetStateInternal uses STATE_SELECTED in this case,
|
||||
// so we need to check states::SELECTED also.
|
||||
PRBool isEnabled = (state & (states::CHECKED | states::SELECTED)) != 0;
|
||||
bool isEnabled = (state & (states::CHECKED | states::SELECTED)) != 0;
|
||||
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
|
||||
nsEventShell::FireEvent(accEvent);
|
||||
|
||||
if (isEnabled)
|
||||
FireAccessibleFocusEvent(accessible, origTargetContent);
|
||||
if (isEnabled) {
|
||||
FocusMgr()->ActiveItemChanged(accessible);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("RadioStateChange", accessible)
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
@ -568,7 +445,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
if (eventType.EqualsLiteral("CheckboxStateChange")) {
|
||||
PRUint64 state = accessible->State();
|
||||
|
||||
PRBool isEnabled = !!(state & states::CHECKED);
|
||||
bool isEnabled = !!(state & states::CHECKED);
|
||||
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
|
||||
@ -581,27 +458,16 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
#ifdef MOZ_XUL
|
||||
// If it's a tree element, need the currently selected item
|
||||
if (isTree) {
|
||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
|
||||
do_QueryInterface(targetNode);
|
||||
if (multiSelect) {
|
||||
PRInt32 treeIndex = -1;
|
||||
multiSelect->GetCurrentIndex(&treeIndex);
|
||||
if (treeIndex >= 0) {
|
||||
nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
|
||||
if (treeAcc) {
|
||||
treeItemAccessible = treeAcc->GetTreeItemAccessible(treeIndex);
|
||||
if (treeItemAccessible)
|
||||
accessible = treeItemAccessible;
|
||||
}
|
||||
}
|
||||
}
|
||||
treeItemAccessible = accessible->CurrentItem();
|
||||
if (treeItemAccessible)
|
||||
accessible = treeItemAccessible;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
if (treeItemAccessible && eventType.EqualsLiteral("OpenStateChange")) {
|
||||
PRUint64 state = accessible->State();
|
||||
PRBool isEnabled = (state & states::EXPANDED) != 0;
|
||||
bool isEnabled = (state & states::EXPANDED) != 0;
|
||||
|
||||
nsRefPtr<AccEvent> accEvent =
|
||||
new AccStateChangeEvent(accessible, states::EXPANDED, isEnabled);
|
||||
@ -611,7 +477,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
|
||||
if (treeItemAccessible && eventType.EqualsLiteral("select")) {
|
||||
// If multiselect tree, we should fire selectionadd or selection removed
|
||||
if (gLastFocusedNode == targetNode) {
|
||||
if (FocusMgr()->HasDOMFocus(targetNode)) {
|
||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSel =
|
||||
do_QueryInterface(targetNode);
|
||||
nsAutoString selType;
|
||||
@ -633,41 +499,7 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
}
|
||||
else
|
||||
#endif
|
||||
if (eventType.EqualsLiteral("focus")) {
|
||||
// Keep a reference to the target node. We might want to change
|
||||
// it to the individual radio button or selected item, and send
|
||||
// the focus event to that.
|
||||
nsCOMPtr<nsINode> focusedItem = targetNode;
|
||||
if (!treeItemAccessible) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> selectControl =
|
||||
do_QueryInterface(targetNode);
|
||||
if (selectControl) {
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menuList =
|
||||
do_QueryInterface(targetNode);
|
||||
if (!menuList) {
|
||||
// Don't do this for menu lists, the items only get focused
|
||||
// when the list is open, based on DOMMenuitemActive events
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
|
||||
selectControl->GetSelectedItem(getter_AddRefs(selectedItem));
|
||||
if (selectedItem)
|
||||
focusedItem = do_QueryInterface(selectedItem);
|
||||
|
||||
if (!focusedItem)
|
||||
return;
|
||||
|
||||
accessible = GetAccService()->GetAccessibleInWeakShell(focusedItem,
|
||||
weakShell);
|
||||
if (!accessible)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
FireAccessibleFocusEvent(accessible, origTargetContent);
|
||||
}
|
||||
else if (eventType.EqualsLiteral("blur")) {
|
||||
NS_IF_RELEASE(gLastFocusedNode);
|
||||
}
|
||||
else if (eventType.EqualsLiteral("AlertActive")) {
|
||||
if (eventType.EqualsLiteral("AlertActive")) {
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
|
||||
}
|
||||
else if (eventType.EqualsLiteral("popupshown")) {
|
||||
@ -680,70 +512,43 @@ nsRootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
}
|
||||
}
|
||||
else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
|
||||
PRBool fireFocus = PR_FALSE;
|
||||
if (!treeItemAccessible) {
|
||||
#ifdef MOZ_XUL
|
||||
if (isTree) {
|
||||
return; // Tree with nothing selected
|
||||
}
|
||||
#endif
|
||||
|
||||
nsMenuFrame* menuFrame = do_QueryFrame(accessible->GetFrame());
|
||||
if (menuFrame)
|
||||
fireFocus = PR_TRUE;
|
||||
// QI failed for nsMenuFrame means it's not on menu bar
|
||||
if (menuFrame && menuFrame->IsOnMenuBar() &&
|
||||
!menuFrame->IsOnActiveMenuBar()) {
|
||||
// It is a top level menuitem. Only fire a focus event when the menu bar
|
||||
// is active.
|
||||
return;
|
||||
} else {
|
||||
nsAccessible* container = accessible->Parent();
|
||||
if (!container)
|
||||
return;
|
||||
// It is not top level menuitem
|
||||
// Only fire focus event if it is not inside collapsed popup
|
||||
// and not a listitem of a combo box
|
||||
if (container->State() & states::COLLAPSED) {
|
||||
nsAccessible* containerParent = container->Parent();
|
||||
if (!containerParent)
|
||||
return;
|
||||
if (containerParent->Role() != nsIAccessibleRole::ROLE_COMBOBOX) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!fireFocus) {
|
||||
nsCOMPtr<nsINode> realFocusedNode = GetCurrentFocus();
|
||||
nsIContent* realFocusedContent =
|
||||
realFocusedNode->IsElement() ? realFocusedNode->AsElement() : nsnull;
|
||||
nsIContent* containerContent = targetContent;
|
||||
while (containerContent) {
|
||||
nsCOMPtr<nsIDOMXULPopupElement> popup = do_QueryInterface(containerContent);
|
||||
if (popup || containerContent == realFocusedContent) {
|
||||
// If we're inside the focus or a popup we can fire focus events
|
||||
// for the changed active item
|
||||
fireFocus = PR_TRUE;
|
||||
break;
|
||||
}
|
||||
containerContent = containerContent->GetParent();
|
||||
}
|
||||
}
|
||||
if (fireFocus) {
|
||||
// Always asynch, always from user input.
|
||||
FireAccessibleFocusEvent(accessible, origTargetContent, PR_TRUE,
|
||||
eFromUserInput);
|
||||
FocusMgr()->ActiveItemChanged(accessible);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuItemActive", accessible)
|
||||
}
|
||||
else if (eventType.EqualsLiteral("DOMMenuItemInactive")) {
|
||||
// Process DOMMenuItemInactive event for autocomplete only because this is
|
||||
// unique widget that may acquire focus from autocomplete popup while popup
|
||||
// stays open and has no active item. In case of XUL tree autocomplete
|
||||
// popup this event is fired for tree accessible.
|
||||
nsAccessible* widget =
|
||||
accessible->IsWidget() ? accessible : accessible->ContainerWidget();
|
||||
if (widget && widget->IsAutoCompletePopup()) {
|
||||
FocusMgr()->ActiveItemChanged(nsnull);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuItemInactive", accessible)
|
||||
}
|
||||
}
|
||||
else if (eventType.EqualsLiteral("DOMMenuBarActive")) { // Always from user input
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_START,
|
||||
accessible, eFromUserInput);
|
||||
|
||||
// Notify of active item change when menubar gets active and if it has
|
||||
// current item. This is a case of mouseover (set current menuitem) and
|
||||
// mouse click (activate the menubar). If menubar doesn't have current item
|
||||
// (can be a case of menubar activation from keyboard) then ignore this
|
||||
// notification because later we'll receive DOMMenuItemActive event after
|
||||
// current menuitem is set.
|
||||
nsAccessible* activeItem = accessible->CurrentItem();
|
||||
if (activeItem) {
|
||||
FocusMgr()->ActiveItemChanged(activeItem);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuBarActive", accessible)
|
||||
}
|
||||
}
|
||||
else if (eventType.EqualsLiteral("DOMMenuBarInactive")) { // Always from user input
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END,
|
||||
accessible, eFromUserInput);
|
||||
FireCurrentFocusEvent();
|
||||
|
||||
FocusMgr()->ActiveItemChanged(nsnull);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuBarInactive", accessible)
|
||||
}
|
||||
else if (eventType.EqualsLiteral("ValueChange")) {
|
||||
targetDocument->
|
||||
@ -769,8 +574,6 @@ nsRootAccessible::Shutdown()
|
||||
if (!mWeakShell)
|
||||
return; // Already shutdown
|
||||
|
||||
mCurrentARIAMenubar = nsnull;
|
||||
|
||||
nsDocAccessibleWrap::Shutdown();
|
||||
}
|
||||
|
||||
@ -886,37 +689,106 @@ nsRootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
|
||||
}
|
||||
|
||||
void
|
||||
nsRootAccessible::HandlePopupHidingEvent(nsINode* aNode,
|
||||
nsAccessible* aAccessible)
|
||||
nsRootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
|
||||
{
|
||||
// If accessible focus was on or inside popup that closes, then restore it
|
||||
// to true current focus. This is the case when we've been getting
|
||||
// DOMMenuItemActive events inside of a combo box that closes. The real focus
|
||||
// is on the combo box. It's also the case when a popup gets focus in ATK --
|
||||
// when it closes we need to fire an event to restore focus to where it was.
|
||||
// Get popup accessible. There are cases when popup element isn't accessible
|
||||
// but an underlying widget is and behaves like popup, an example is
|
||||
// autocomplete popups.
|
||||
nsDocAccessible* document = nsAccUtils::GetDocAccessibleFor(aPopupNode);
|
||||
if (!document)
|
||||
return;
|
||||
|
||||
if (gLastFocusedNode &&
|
||||
nsCoreUtils::IsAncestorOf(aNode, gLastFocusedNode)) {
|
||||
// Focus was on or inside of a popup that's being hidden
|
||||
FireCurrentFocusEvent();
|
||||
nsAccessible* popup = document->GetAccessible(aPopupNode);
|
||||
if (!popup) {
|
||||
nsAccessible* popupContainer = document->GetContainerAccessible(aPopupNode);
|
||||
if (!popupContainer)
|
||||
return;
|
||||
|
||||
PRInt32 childCount = popupContainer->GetChildCount();
|
||||
for (PRInt32 idx = 0; idx < childCount; idx++) {
|
||||
nsAccessible* child = popupContainer->GetChildAt(idx);
|
||||
if (child->IsAutoCompletePopup()) {
|
||||
popup = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// No popup no events. Focus is managed by DOM. This is a case for
|
||||
// menupopups of menus on Linux since there are no accessible for popups.
|
||||
if (!popup)
|
||||
return;
|
||||
}
|
||||
|
||||
// Fire expanded state change event for comboboxes and autocompletes.
|
||||
if (!aAccessible ||
|
||||
aAccessible->Role() != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
|
||||
return;
|
||||
// In case of autocompletes and comboboxes fire state change event for
|
||||
// expanded state. Note, HTML form autocomplete isn't a subject of state
|
||||
// change event because they aren't autocompletes strictly speaking.
|
||||
// When popup closes (except nested popups and menus) then fire focus event to
|
||||
// where it was. The focus event is expected even if popup didn't take a focus.
|
||||
|
||||
nsAccessible* combobox = aAccessible->Parent();
|
||||
if (!combobox)
|
||||
return;
|
||||
static const PRUint32 kNotifyOfFocus = 1;
|
||||
static const PRUint32 kNotifyOfState = 2;
|
||||
PRUint32 notifyOf = 0;
|
||||
|
||||
PRUint32 comboboxRole = combobox->Role();
|
||||
if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
|
||||
comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
|
||||
// HTML select is target of popuphidding event. Otherwise get container
|
||||
// widget. No container widget means this is either tooltip or menupopup.
|
||||
// No events in the former case.
|
||||
nsAccessible* widget = nsnull;
|
||||
if (popup->IsCombobox()) {
|
||||
widget = popup;
|
||||
} else {
|
||||
widget = popup->ContainerWidget();
|
||||
if (!widget) {
|
||||
if (!popup->IsMenuPopup())
|
||||
return;
|
||||
|
||||
widget = popup;
|
||||
}
|
||||
}
|
||||
|
||||
if (popup->IsAutoCompletePopup()) {
|
||||
// No focus event for autocomplete because it's managed by
|
||||
// DOMMenuItemInactive events.
|
||||
if (widget->IsAutoComplete())
|
||||
notifyOf = kNotifyOfState;
|
||||
|
||||
} else if (widget->IsCombobox()) {
|
||||
// Fire focus for active combobox, otherwise the focus is managed by DOM
|
||||
// focus notifications. Always fire state change event.
|
||||
if (widget->IsActiveWidget())
|
||||
notifyOf = kNotifyOfFocus;
|
||||
notifyOf |= kNotifyOfState;
|
||||
|
||||
} else if (widget->IsMenuButton()) {
|
||||
// Can be a part of autocomplete.
|
||||
nsAccessible* compositeWidget = widget->ContainerWidget();
|
||||
if (compositeWidget && compositeWidget->IsAutoComplete()) {
|
||||
widget = compositeWidget;
|
||||
notifyOf = kNotifyOfState;
|
||||
}
|
||||
|
||||
// Autocomplete (like searchbar) can be inactive when popup hiddens
|
||||
notifyOf |= kNotifyOfFocus;
|
||||
|
||||
} else if (widget == popup) {
|
||||
// Top level context menus and alerts.
|
||||
// Ignore submenus and menubar. When submenu is closed then sumbenu
|
||||
// container menuitem takes a focus via DOMMenuItemActive notification.
|
||||
// For menubars processing we listen DOMMenubarActive/Inactive
|
||||
// notifications.
|
||||
notifyOf = kNotifyOfFocus;
|
||||
}
|
||||
|
||||
// Restore focus to where it was.
|
||||
if (notifyOf & kNotifyOfFocus) {
|
||||
FocusMgr()->ActiveItemChanged(nsnull);
|
||||
A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("popuphiding", popup)
|
||||
}
|
||||
|
||||
// Fire expanded state change event.
|
||||
if (notifyOf & kNotifyOfState) {
|
||||
nsRefPtr<AccEvent> event =
|
||||
new AccStateChangeEvent(combobox, states::EXPANDED, PR_FALSE);
|
||||
if (event)
|
||||
nsEventShell::FireEvent(event);
|
||||
new AccStateChangeEvent(widget, states::EXPANDED, PR_FALSE);
|
||||
document->FireDelayedAccessibleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -90,38 +90,6 @@ public:
|
||||
// nsRootAccessible
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
|
||||
|
||||
/**
|
||||
* Fire an accessible focus event for the focused accessible and attach a new
|
||||
* selection listener to real focused element, if necessary.
|
||||
*
|
||||
* @param aFocusAccessible [in] the accessible which has received focus
|
||||
* @param aRealFocusContent [in] the actual DOM element which has received
|
||||
* focus (see @note section)
|
||||
* @param aForceEvent [in, optional] fire a focus event even if
|
||||
* the last focused item was the same
|
||||
* @param aIsFromUserInput [in, optional] specifies whether the event is
|
||||
* from user input
|
||||
*
|
||||
* @note Use the originally focused node where the selection lives as real
|
||||
* focus node. For example, use the anonymous HTML:input instead of
|
||||
* the containing XUL:textbox. In this case, sometimes it is a later
|
||||
* focus event which points to the actual anonymous child with focus,
|
||||
* so to be safe we need to reset the selection listener every time.
|
||||
* This happens because when some bindings handle focus, they
|
||||
* retarget focus to the appropriate child inside of themselves, but
|
||||
* DOM focus stays outside on that binding parent.
|
||||
*/
|
||||
void FireAccessibleFocusEvent(nsAccessible* aFocusAccessible,
|
||||
nsIContent* aRealFocusContent,
|
||||
PRBool aForceEvent = PR_FALSE,
|
||||
EIsFromUserInput aIsFromUserInput = eAutoDetect);
|
||||
|
||||
/**
|
||||
* Fire an accessible focus event for the current focused node,
|
||||
* if there is a focus.
|
||||
*/
|
||||
void FireCurrentFocusEvent();
|
||||
|
||||
nsCaretAccessible *GetCaretAccessible();
|
||||
|
||||
/**
|
||||
@ -130,7 +98,6 @@ public:
|
||||
virtual void DocumentActivated(nsDocAccessible* aDocument);
|
||||
|
||||
protected:
|
||||
NS_DECL_RUNNABLEMETHOD(nsRootAccessible, FireCurrentFocusEvent)
|
||||
|
||||
/**
|
||||
* Add/remove DOM event listeners.
|
||||
@ -151,7 +118,7 @@ protected:
|
||||
/*
|
||||
* Process "popuphiding" event. Used by HandleEvent().
|
||||
*/
|
||||
void HandlePopupHidingEvent(nsINode* aNode, nsAccessible* aAccessible);
|
||||
void HandlePopupHidingEvent(nsINode* aNode);
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
|
||||
@ -164,7 +131,6 @@ protected:
|
||||
already_AddRefed<nsIDocShellTreeItem>
|
||||
GetContentDocShell(nsIDocShellTreeItem *aStart);
|
||||
nsRefPtr<nsCaretAccessible> mCaretAccessible;
|
||||
nsCOMPtr<nsINode> mCurrentARIAMenubar;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsRootAccessible, NS_ROOTACCESSIBLE_IMPL_CID)
|
||||
|
@ -82,7 +82,7 @@ static nsCSSTextAttrMapItem gCSSTextAttrsMap[] =
|
||||
// nsTextAttrs
|
||||
|
||||
nsTextAttrsMgr::nsTextAttrsMgr(nsHyperTextAccessible *aHyperTextAcc,
|
||||
PRBool aIncludeDefAttrs,
|
||||
bool aIncludeDefAttrs,
|
||||
nsAccessible *aOffsetAcc,
|
||||
PRInt32 aOffsetAccIdx) :
|
||||
mHyperTextAcc(aHyperTextAcc), mIncludeDefAttrs(aIncludeDefAttrs),
|
||||
@ -230,7 +230,7 @@ nsTextAttrsMgr::GetRange(const nsTArray<nsITextAttr*>& aTextAttrArray,
|
||||
nsIContent *currElm = nsCoreUtils::GetDOMElementFor(currAcc->GetContent());
|
||||
NS_ENSURE_STATE(currElm);
|
||||
|
||||
PRBool offsetFound = PR_FALSE;
|
||||
bool offsetFound = false;
|
||||
for (PRUint32 attrIdx = 0; attrIdx < attrLen; attrIdx++) {
|
||||
nsITextAttr *textAttr = aTextAttrArray[attrIdx];
|
||||
if (!textAttr->Equal(currElm)) {
|
||||
@ -255,7 +255,7 @@ nsTextAttrsMgr::GetRange(const nsTArray<nsITextAttr*>& aTextAttrArray,
|
||||
nsIContent *currElm = nsCoreUtils::GetDOMElementFor(currAcc->GetContent());
|
||||
NS_ENSURE_STATE(currElm);
|
||||
|
||||
PRBool offsetFound = PR_FALSE;
|
||||
bool offsetFound = false;
|
||||
for (PRUint32 attrIdx = 0; attrIdx < attrLen; attrIdx++) {
|
||||
nsITextAttr *textAttr = aTextAttrArray[attrIdx];
|
||||
|
||||
@ -290,7 +290,7 @@ nsLangTextAttr::nsLangTextAttr(nsHyperTextAccessible *aRootAcc,
|
||||
mIsDefined = GetLang(aContent, mNativeValue);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsLangTextAttr::GetValueFor(nsIContent *aElm, nsAutoString *aValue)
|
||||
{
|
||||
return GetLang(aElm, *aValue);
|
||||
@ -302,7 +302,7 @@ nsLangTextAttr::Format(const nsAutoString& aValue, nsAString& aFormattedValue)
|
||||
aFormattedValue = aValue;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsLangTextAttr::GetLang(nsIContent *aContent, nsAString& aLang)
|
||||
{
|
||||
nsCoreUtils::GetLanguageFor(aContent, mRootContent, aLang);
|
||||
@ -330,7 +330,7 @@ nsCSSTextAttr::GetName() const
|
||||
return *gCSSTextAttrsMap[mIndex].mAttrName;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsCSSTextAttr::GetValueFor(nsIContent *aContent, nsAutoString *aValue)
|
||||
{
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> currStyleDecl =
|
||||
@ -374,7 +374,7 @@ nsBGColorTextAttr::nsBGColorTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
|
||||
mIsDefined = GetColor(aFrame, &mNativeValue);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsBGColorTextAttr::GetValueFor(nsIContent *aContent, nscolor *aValue)
|
||||
{
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
@ -400,7 +400,7 @@ nsBGColorTextAttr::Format(const nscolor& aValue, nsAString& aFormattedValue)
|
||||
aFormattedValue = value;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsBGColorTextAttr::GetColor(nsIFrame *aFrame, nscolor *aColor)
|
||||
{
|
||||
const nsStyleBackground *styleBackground = aFrame->GetStyleBackground();
|
||||
@ -444,7 +444,7 @@ nsFontSizeTextAttr::nsFontSizeTextAttr(nsIFrame *aRootFrame, nsIFrame *aFrame) :
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsFontSizeTextAttr::GetValueFor(nsIContent *aContent, nscoord *aValue)
|
||||
{
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
@ -501,7 +501,7 @@ nsFontWeightTextAttr::nsFontWeightTextAttr(nsIFrame *aRootFrame,
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsFontWeightTextAttr::GetValueFor(nsIContent *aContent, PRInt32 *aValue)
|
||||
{
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
|
@ -80,7 +80,7 @@ public:
|
||||
* inside hyper text accessible
|
||||
*/
|
||||
nsTextAttrsMgr(nsHyperTextAccessible *aHyperTextAcc,
|
||||
PRBool aIncludeDefAttrs = PR_TRUE,
|
||||
bool aIncludeDefAttrs = true,
|
||||
nsAccessible *aOffsetAcc = nsnull,
|
||||
PRInt32 aOffsetAccIdx = -1);
|
||||
|
||||
@ -116,7 +116,7 @@ protected:
|
||||
private:
|
||||
nsRefPtr<nsHyperTextAccessible> mHyperTextAcc;
|
||||
|
||||
PRBool mIncludeDefAttrs;
|
||||
bool mIncludeDefAttrs;
|
||||
|
||||
nsRefPtr<nsAccessible> mOffsetAcc;
|
||||
PRInt32 mOffsetAccIdx;
|
||||
@ -148,13 +148,13 @@ public:
|
||||
* default or include default attribute value
|
||||
* flag is applied
|
||||
*/
|
||||
virtual PRBool GetValue(nsAString& aValue, PRBool aIncludeDefAttrValue) = 0;
|
||||
virtual bool GetValue(nsAString& aValue, bool aIncludeDefAttrValue) = 0;
|
||||
|
||||
/**
|
||||
* Return true if the text attribute value on the given element equals with
|
||||
* predefined attribute value.
|
||||
*/
|
||||
virtual PRBool Equal(nsIContent *aContent) = 0;
|
||||
virtual bool Equal(nsIContent *aContent) = 0;
|
||||
};
|
||||
|
||||
|
||||
@ -165,17 +165,17 @@ template<class T>
|
||||
class nsTextAttr : public nsITextAttr
|
||||
{
|
||||
public:
|
||||
nsTextAttr(PRBool aGetRootValue) : mGetRootValue(aGetRootValue) {}
|
||||
nsTextAttr(bool aGetRootValue) : mGetRootValue(aGetRootValue) {}
|
||||
|
||||
// nsITextAttr
|
||||
virtual PRBool GetValue(nsAString& aValue, PRBool aIncludeDefAttrValue)
|
||||
virtual bool GetValue(nsAString& aValue, bool aIncludeDefAttrValue)
|
||||
{
|
||||
if (mGetRootValue) {
|
||||
Format(mRootNativeValue, aValue);
|
||||
return mIsRootDefined;
|
||||
}
|
||||
|
||||
PRBool isDefined = mIsDefined;
|
||||
bool isDefined = mIsDefined;
|
||||
T* nativeValue = &mNativeValue;
|
||||
|
||||
if (!isDefined) {
|
||||
@ -194,10 +194,10 @@ public:
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
virtual PRBool Equal(nsIContent *aContent)
|
||||
virtual bool Equal(nsIContent *aContent)
|
||||
{
|
||||
T nativeValue;
|
||||
PRBool isDefined = GetValueFor(aContent, &nativeValue);
|
||||
bool isDefined = GetValueFor(aContent, &nativeValue);
|
||||
|
||||
if (!mIsDefined && !isDefined)
|
||||
return PR_TRUE;
|
||||
@ -214,24 +214,24 @@ public:
|
||||
protected:
|
||||
|
||||
// Return native value for the given DOM element.
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, T *aValue) = 0;
|
||||
virtual bool GetValueFor(nsIContent *aContent, T *aValue) = 0;
|
||||
|
||||
// Format native value to text attribute value.
|
||||
virtual void Format(const T& aValue, nsAString& aFormattedValue) = 0;
|
||||
|
||||
// Indicates if root value should be exposed.
|
||||
PRBool mGetRootValue;
|
||||
bool mGetRootValue;
|
||||
|
||||
// Native value and flag indicating if the value is defined (initialized in
|
||||
// derived classes). Note, undefined native value means it is inherited
|
||||
// from root.
|
||||
T mNativeValue;
|
||||
PRBool mIsDefined;
|
||||
bool mIsDefined;
|
||||
|
||||
// Native root value and flag indicating if the value is defined (initialized
|
||||
// in derived classes).
|
||||
T mRootNativeValue;
|
||||
PRBool mIsRootDefined;
|
||||
bool mIsRootDefined;
|
||||
};
|
||||
|
||||
|
||||
@ -251,11 +251,11 @@ public:
|
||||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIContent *aElm, nsAutoString *aValue);
|
||||
virtual bool GetValueFor(nsIContent *aElm, nsAutoString *aValue);
|
||||
virtual void Format(const nsAutoString& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
PRBool GetLang(nsIContent *aContent, nsAString& aLang);
|
||||
bool GetLang(nsIContent *aContent, nsAString& aLang);
|
||||
nsCOMPtr<nsIContent> mRootContent;
|
||||
};
|
||||
|
||||
@ -276,7 +276,7 @@ public:
|
||||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, nsAutoString *aValue);
|
||||
virtual bool GetValueFor(nsIContent *aContent, nsAutoString *aValue);
|
||||
virtual void Format(const nsAutoString& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
@ -298,11 +298,11 @@ public:
|
||||
|
||||
protected:
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, nscolor *aValue);
|
||||
virtual bool GetValueFor(nsIContent *aContent, nscolor *aValue);
|
||||
virtual void Format(const nscolor& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
PRBool GetColor(nsIFrame *aFrame, nscolor *aColor);
|
||||
bool GetColor(nsIFrame *aFrame, nscolor *aColor);
|
||||
nsIFrame *mRootFrame;
|
||||
};
|
||||
|
||||
@ -322,7 +322,7 @@ public:
|
||||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIContent *aContent, nscoord *aValue);
|
||||
virtual bool GetValueFor(nsIContent *aContent, nscoord *aValue);
|
||||
virtual void Format(const nscoord& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
@ -354,7 +354,7 @@ public:
|
||||
protected:
|
||||
|
||||
// nsTextAttr
|
||||
virtual PRBool GetValueFor(nsIContent *aElm, PRInt32 *aValue);
|
||||
virtual bool GetValueFor(nsIContent *aElm, PRInt32 *aValue);
|
||||
virtual void Format(const PRInt32& aValue, nsAString& aFormattedValue);
|
||||
|
||||
private:
|
||||
|
@ -129,10 +129,10 @@ nsTextEquivUtils::AppendTextEquivFromContent(nsAccessible *aInitiatorAcc,
|
||||
// through the DOM subtree otherwise go down through accessible subtree and
|
||||
// calculate the flat string.
|
||||
nsIFrame *frame = aContent->GetPrimaryFrame();
|
||||
PRBool isVisible = frame && frame->GetStyleVisibility()->IsVisible();
|
||||
bool isVisible = frame && frame->GetStyleVisibility()->IsVisible();
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
PRBool goThroughDOMSubtree = PR_TRUE;
|
||||
bool goThroughDOMSubtree = true;
|
||||
|
||||
if (isVisible) {
|
||||
nsAccessible *accessible =
|
||||
@ -155,7 +155,7 @@ nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent *aContent,
|
||||
nsAString *aString)
|
||||
{
|
||||
if (aContent->IsNodeOfType(nsINode::eTEXT)) {
|
||||
PRBool isHTMLBlock = PR_FALSE;
|
||||
bool isHTMLBlock = false;
|
||||
|
||||
nsIContent *parentContent = aContent->GetParent();
|
||||
if (parentContent) {
|
||||
@ -238,7 +238,7 @@ nsTextEquivUtils::AppendFromAccessible(nsAccessible *aAccessible,
|
||||
nsresult rv = aAccessible->GetName(text);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool isEmptyTextEquiv = PR_TRUE;
|
||||
bool isEmptyTextEquiv = true;
|
||||
|
||||
// If the name is from tooltip then append it to result string in the end
|
||||
// (see h. step of name computation guide).
|
||||
@ -376,7 +376,7 @@ nsTextEquivUtils::AppendFromDOMNode(nsIContent *aContent, nsAString *aString)
|
||||
return AppendFromDOMChildren(aContent, aString);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsTextEquivUtils::AppendString(nsAString *aString,
|
||||
const nsAString& aTextEquivalent)
|
||||
{
|
||||
@ -391,7 +391,7 @@ nsTextEquivUtils::AppendString(nsAString *aString,
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsTextEquivUtils::IsWhitespaceString(const nsSubstring& aString)
|
||||
{
|
||||
nsSubstring::const_char_iterator iterBegin, iterEnd;
|
||||
@ -405,7 +405,7 @@ nsTextEquivUtils::IsWhitespaceString(const nsSubstring& aString)
|
||||
return iterBegin == iterEnd;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsTextEquivUtils::IsWhitespace(PRUnichar aChar)
|
||||
{
|
||||
return aChar == ' ' || aChar == '\n' ||
|
||||
|
@ -156,7 +156,7 @@ private:
|
||||
* Concatenates strings and appends space between them. Returns true if
|
||||
* text equivalent string was appended.
|
||||
*/
|
||||
static PRBool AppendString(nsAString *aString,
|
||||
static bool AppendString(nsAString *aString,
|
||||
const nsAString& aTextEquivalent);
|
||||
|
||||
/**
|
||||
@ -164,12 +164,12 @@ private:
|
||||
* only. In contrast to nsWhitespaceTokenizer class it takes into account
|
||||
* non-breaking space (0xa0).
|
||||
*/
|
||||
static PRBool IsWhitespaceString(const nsSubstring& aString);
|
||||
static bool IsWhitespaceString(const nsSubstring& aString);
|
||||
|
||||
/**
|
||||
* Returns true if the given character is whitespace symbol.
|
||||
*/
|
||||
static PRBool IsWhitespace(PRUnichar aChar);
|
||||
static bool IsWhitespace(PRUnichar aChar);
|
||||
|
||||
/**
|
||||
* Map array from roles to name rules (constants of ETextEquivRule).
|
||||
|
@ -119,7 +119,7 @@ nsHTMLCheckboxAccessible::NativeState()
|
||||
PRUint64 state = nsFormControlAccessible::NativeState();
|
||||
|
||||
state |= states::CHECKABLE;
|
||||
PRBool checkState = PR_FALSE; // Radio buttons and check boxes can be checked or mixed
|
||||
bool checkState = false; // Radio buttons and check boxes can be checked or mixed
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlCheckboxElement =
|
||||
do_QueryInterface(mContent);
|
||||
@ -139,6 +139,16 @@ nsHTMLCheckboxAccessible::NativeState()
|
||||
return state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLCheckboxAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsHTMLCheckboxAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLRadioButtonAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -156,7 +166,7 @@ nsHTMLRadioButtonAccessible::NativeState()
|
||||
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
PRBool checked = PR_FALSE; // Radio buttons and check boxes can be checked
|
||||
bool checked = false; // Radio buttons and check boxes can be checked
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlRadioElement =
|
||||
do_QueryInterface(mContent);
|
||||
@ -314,6 +324,15 @@ nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLButtonAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsHTMLButtonAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTML4ButtonAccessible
|
||||
@ -370,6 +389,15 @@ nsHTML4ButtonAccessible::NativeState()
|
||||
return state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTML4ButtonAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsHTML4ButtonAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLTextFieldAccessible
|
||||
@ -463,40 +491,29 @@ nsHTMLTextFieldAccessible::NativeState()
|
||||
nsGkAtoms::password, eIgnoreCase)) {
|
||||
state |= states::PROTECTED;
|
||||
}
|
||||
else {
|
||||
nsAccessible* parent = Parent();
|
||||
if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
|
||||
state |= states::HASPOPUP;
|
||||
}
|
||||
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::readonly)) {
|
||||
state |= states::READONLY;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mContent));
|
||||
// Is it an <input> or a <textarea> ?
|
||||
if (htmlInput) {
|
||||
state |= states::SINGLE_LINE;
|
||||
}
|
||||
else {
|
||||
state |= states::MULTI_LINE;
|
||||
}
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> htmlInput(do_QueryInterface(mContent));
|
||||
state |= htmlInput ? states::SINGLE_LINE : states::MULTI_LINE;
|
||||
|
||||
if (!(state & states::EDITABLE))
|
||||
if (!(state & states::EDITABLE) ||
|
||||
(state & (states::PROTECTED | states::MULTI_LINE)))
|
||||
return state;
|
||||
|
||||
nsCOMPtr<nsIContent> bindingContent = mContent->GetBindingParent();
|
||||
if (bindingContent &&
|
||||
bindingContent->NodeInfo()->Equals(nsGkAtoms::textbox,
|
||||
kNameSpaceID_XUL)) {
|
||||
if (bindingContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::autocomplete,
|
||||
eIgnoreCase)) {
|
||||
// If parent is XUL textbox and value of @type attribute is "autocomplete",
|
||||
// then this accessible supports autocompletion.
|
||||
state |= states::SUPPORTS_AUTOCOMPLETION;
|
||||
}
|
||||
} else if (gIsFormFillEnabled && htmlInput && !(state & states::PROTECTED)) {
|
||||
// Expose autocomplete states if this input is part of autocomplete widget.
|
||||
nsAccessible* widget = ContainerWidget();
|
||||
if (widget && widget-IsAutoComplete()) {
|
||||
state |= states::HASPOPUP | states::SUPPORTS_AUTOCOMPLETION;
|
||||
return state;
|
||||
}
|
||||
|
||||
// No parent can mean a fake widget created for XUL textbox. If accessible
|
||||
// is unattached from tree then we don't care.
|
||||
if (mParent && gIsFormFillEnabled) {
|
||||
// Check to see if autocompletion is allowed on this input. We don't expose
|
||||
// it for password fields even though the entire password can be remembered
|
||||
// for a page if the user asks it to be. However, the kind of autocomplete
|
||||
@ -561,7 +578,7 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor
|
||||
// whatever script is currently running.
|
||||
nsCOMPtr<nsIJSContextStack> stack =
|
||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||
PRBool pushed = stack && NS_SUCCEEDED(stack->Push(nsnull));
|
||||
bool pushed = stack && NS_SUCCEEDED(stack->Push(nsnull));
|
||||
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
nsresult rv = editableElt->GetEditor(aEditor);
|
||||
@ -575,6 +592,23 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetAssociatedEditor(nsIEditor **aEditor
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLTextFieldAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsHTMLTextFieldAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsHTMLTextFieldAccessible::ContainerWidget() const
|
||||
{
|
||||
return mParent && mParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE ?
|
||||
mParent : nsnull;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLGroupboxAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
};
|
||||
|
||||
|
||||
@ -110,6 +113,9 @@ public:
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
};
|
||||
|
||||
|
||||
@ -134,6 +140,9 @@ public:
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
};
|
||||
|
||||
|
||||
@ -166,6 +175,10 @@ public:
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ nsHTMLImageAccessible::NativeState()
|
||||
imageRequest->GetImage(getter_AddRefs(imgContainer));
|
||||
|
||||
if (imgContainer) {
|
||||
PRBool animated;
|
||||
bool animated;
|
||||
imgContainer->GetAnimated(&animated);
|
||||
if (animated)
|
||||
state |= states::ANIMATED;
|
||||
@ -102,7 +102,7 @@ nsHTMLImageAccessible::NativeState()
|
||||
nsresult
|
||||
nsHTMLImageAccessible::GetNameInternal(nsAString& aName)
|
||||
{
|
||||
PRBool hasAltAttrib =
|
||||
bool hasAltAttrib =
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName);
|
||||
if (!aName.IsEmpty())
|
||||
return NS_OK;
|
||||
@ -221,7 +221,7 @@ nsHTMLImageAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Private methods
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsHTMLImageAccessible::HasLongDesc()
|
||||
{
|
||||
if (IsDefunct())
|
||||
@ -230,7 +230,7 @@ nsHTMLImageAccessible::HasLongDesc()
|
||||
return mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::longdesc);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsHTMLImageAccessible::IsValidLongDescIndex(PRUint8 aIndex)
|
||||
{
|
||||
if (!HasLongDesc())
|
||||
|
@ -78,7 +78,7 @@ private:
|
||||
*
|
||||
* @returns true if the longdesc attribute is present.
|
||||
*/
|
||||
PRBool HasLongDesc();
|
||||
bool HasLongDesc();
|
||||
|
||||
/**
|
||||
* Used by GetActionName and DoAction to ensure the index for opening the
|
||||
@ -89,7 +89,7 @@ private:
|
||||
*
|
||||
* @returns true if index is valid for longdesc action.
|
||||
*/
|
||||
PRBool IsValidLongDescIndex(PRUint8 aIndex);
|
||||
bool IsValidLongDescIndex(PRUint8 aIndex);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -201,7 +201,7 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 *aX, PRInt32 *aY,
|
||||
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
||||
nsImageFrame *imageFrame = do_QueryFrame(frame);
|
||||
|
||||
nsImageMap* map = imageFrame->GetImageMap(presContext);
|
||||
nsImageMap* map = imageFrame->GetImageMap();
|
||||
NS_ENSURE_TRUE(map, NS_ERROR_FAILURE);
|
||||
|
||||
nsRect rect;
|
||||
|
@ -178,7 +178,7 @@ nsHTMLLinkAccessible::AnchorURIAt(PRUint32 aAnchorIndex)
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected members
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsHTMLLinkAccessible::IsLinked()
|
||||
{
|
||||
if (IsDefunct())
|
||||
|
@ -72,7 +72,7 @@ protected:
|
||||
/**
|
||||
* Returns true if the link has href attribute.
|
||||
*/
|
||||
PRBool IsLinked();
|
||||
bool IsLinked();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -67,6 +67,7 @@ nsHTMLSelectListAccessible::
|
||||
nsHTMLSelectListAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
mFlags |= eListControlAccessible;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -76,19 +77,6 @@ PRUint64
|
||||
nsHTMLSelectListAccessible::NativeState()
|
||||
{
|
||||
PRUint64 state = nsAccessibleWrap::NativeState();
|
||||
|
||||
// As a nsHTMLSelectListAccessible we can have the following states:
|
||||
// states::MULTISELECTABLE, states::EXTSELECTABLE
|
||||
|
||||
if (state & states::FOCUSED) {
|
||||
// Treat first focusable option node as actual focus, in order
|
||||
// to avoid confusing JAWS, which needs focus on the option
|
||||
nsCOMPtr<nsIContent> focusedOption =
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOption(mContent);
|
||||
if (focusedOption) { // Clear focused state since it is on option
|
||||
state &= ~states::FOCUSED;
|
||||
}
|
||||
}
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple))
|
||||
state |= states::MULTISELECTABLE | states::EXTSELECTABLE;
|
||||
|
||||
@ -127,6 +115,42 @@ nsHTMLSelectListAccessible::UnselectAll()
|
||||
nsAccessibleWrap::UnselectAll() : false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsHTMLSelectListAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLSelectListAccessible::IsActiveWidget() const
|
||||
{
|
||||
return FocusMgr()->HasDOMFocus(mContent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLSelectListAccessible::AreItemsOperable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsHTMLSelectListAccessible::CurrentItem()
|
||||
{
|
||||
nsIListControlFrame* listControlFrame = do_QueryFrame(GetFrame());
|
||||
if (listControlFrame) {
|
||||
nsCOMPtr<nsIContent> activeOptionNode = listControlFrame->GetCurrentOption();
|
||||
if (activeOptionNode) {
|
||||
nsDocAccessible* document = GetDocAccessible();
|
||||
if (document)
|
||||
return document->GetAccessible(activeOptionNode);
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectListAccessible: nsAccessible protected
|
||||
|
||||
@ -252,34 +276,20 @@ nsHTMLSelectOptionAccessible::NativeState()
|
||||
|
||||
PRUint64 selectState = 0;
|
||||
nsIContent* selectContent = GetSelectState(&selectState);
|
||||
if (selectState & states::INVISIBLE)
|
||||
if (!selectContent || selectState & states::INVISIBLE)
|
||||
return state;
|
||||
|
||||
NS_ENSURE_TRUE(selectContent, NS_ERROR_FAILURE);
|
||||
|
||||
// Is disabled?
|
||||
if (0 == (state & states::UNAVAILABLE)) {
|
||||
// Focusable and selectable
|
||||
if (!(state & states::UNAVAILABLE))
|
||||
state |= (states::FOCUSABLE | states::SELECTABLE);
|
||||
// When the list is focused but no option is actually focused,
|
||||
// Firefox draws a focus ring around the first non-disabled option.
|
||||
// We need to indicate states::FOCUSED in that case, because it
|
||||
// prevents JAWS from ignoring the list
|
||||
// GetFocusedOption() ensures that an option node is
|
||||
// returned in this case, as long as some focusable option exists
|
||||
// in the listbox
|
||||
nsCOMPtr<nsIContent> focusedOption = GetFocusedOption(selectContent);
|
||||
if (focusedOption == mContent)
|
||||
state |= states::FOCUSED;
|
||||
}
|
||||
|
||||
// Are we selected?
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mContent));
|
||||
if (option) {
|
||||
option->GetSelected(&isSelected);
|
||||
if (isSelected)
|
||||
state |= states::SELECTED;
|
||||
|
||||
}
|
||||
|
||||
if (selectState & states::OFFSCREEN) {
|
||||
@ -338,7 +348,7 @@ nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
nsIContent *parentContent = mContent->GetParent();
|
||||
|
||||
PRInt32 posInSet = 0, setSize = 0;
|
||||
PRBool isContentFound = PR_FALSE;
|
||||
bool isContentFound = false;
|
||||
|
||||
PRUint32 childCount = parentContent->GetChildCount();
|
||||
for (PRUint32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
@ -377,66 +387,21 @@ nsHTMLSelectOptionAccessible::ActionCount()
|
||||
return 1;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsHTMLSelectOptionAccessible::DoAction(PRUint8 index)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLSelectOptionAccessible::DoAction(PRUint8 aIndex)
|
||||
{
|
||||
if (index == eAction_Select) { // default action
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> newHTMLOption(do_QueryInterface(mContent));
|
||||
if (!newHTMLOption)
|
||||
return NS_ERROR_FAILURE;
|
||||
// Clear old selection
|
||||
nsAccessible* parent = Parent();
|
||||
if (!parent)
|
||||
return NS_OK;
|
||||
if (aIndex != eAction_Select)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsCOMPtr<nsIContent> oldHTMLOptionContent =
|
||||
GetFocusedOption(parent->GetContent());
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> oldHTMLOption =
|
||||
do_QueryInterface(oldHTMLOptionContent);
|
||||
if (oldHTMLOption)
|
||||
oldHTMLOption->SetSelected(PR_FALSE);
|
||||
// Set new selection
|
||||
newHTMLOption->SetSelected(PR_TRUE);
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// If combo box, and open, close it
|
||||
// First, get the <select> widgets list control frame
|
||||
nsIContent *selectContent = mContent;
|
||||
do {
|
||||
selectContent = selectContent->GetParent();
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectControl =
|
||||
do_QueryInterface(selectContent);
|
||||
if (selectControl)
|
||||
break;
|
||||
|
||||
} while (selectContent);
|
||||
|
||||
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> option(do_QueryInterface(mContent));
|
||||
|
||||
if (!selectContent || !presShell || !option)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIFrame *selectFrame = selectContent->GetPrimaryFrame();
|
||||
nsIComboboxControlFrame *comboBoxFrame = do_QueryFrame(selectFrame);
|
||||
if (comboBoxFrame) {
|
||||
nsIFrame *listFrame = comboBoxFrame->GetDropDown();
|
||||
if (comboBoxFrame->IsDroppedDown() && listFrame) {
|
||||
// use this list control frame to roll up the list
|
||||
nsIListControlFrame *listControlFrame = do_QueryFrame(listFrame);
|
||||
if (listControlFrame) {
|
||||
PRInt32 newIndex = 0;
|
||||
option->GetIndex(&newIndex);
|
||||
listControlFrame->ComboboxFinish(newIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
DoCommand();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLSelectOptionAccessible::SetSelected(PRBool aSelect)
|
||||
nsHTMLSelectOptionAccessible::SetSelected(bool aSelect)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
@ -446,73 +411,24 @@ nsHTMLSelectOptionAccessible::SetSelected(PRBool aSelect)
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: static methods
|
||||
// nsHTMLSelectOptionAccessible: Widgets
|
||||
|
||||
/**
|
||||
* Helper method for getting the focused DOM Node from our parent(list) node. We
|
||||
* need to use the frame to get the focused option because for some reason we
|
||||
* weren't getting the proper notification when the focus changed using the DOM
|
||||
*/
|
||||
already_AddRefed<nsIContent>
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOption(nsIContent *aListNode)
|
||||
nsAccessible*
|
||||
nsHTMLSelectOptionAccessible::ContainerWidget() const
|
||||
{
|
||||
NS_ASSERTION(aListNode, "Called GetFocusedOptionNode without a valid list node");
|
||||
if (mParent && mParent->IsListControl()) {
|
||||
nsAccessible* grandParent = mParent->Parent();
|
||||
if (grandParent && grandParent->IsCombobox())
|
||||
return grandParent;
|
||||
|
||||
nsIFrame *frame = aListNode->GetPrimaryFrame();
|
||||
if (!frame)
|
||||
return nsnull;
|
||||
|
||||
PRInt32 focusedOptionIndex = 0;
|
||||
|
||||
// Get options
|
||||
nsCOMPtr<nsIDOMHTMLSelectElement> selectElement(do_QueryInterface(aListNode));
|
||||
NS_ASSERTION(selectElement, "No select element where it should be");
|
||||
|
||||
nsCOMPtr<nsIDOMHTMLOptionsCollection> options;
|
||||
nsresult rv = selectElement->GetOptions(getter_AddRefs(options));
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
nsIListControlFrame *listFrame = do_QueryFrame(frame);
|
||||
if (listFrame) {
|
||||
// Get what's focused in listbox by asking frame for "selected item".
|
||||
// Can't use dom interface for this, because it will always return the first selected item
|
||||
// when there is more than 1 item selected. We need the focused item, not
|
||||
// the first selected item.
|
||||
focusedOptionIndex = listFrame->GetSelectedIndex();
|
||||
if (focusedOptionIndex == -1) {
|
||||
nsCOMPtr<nsIDOMNode> nextOption;
|
||||
while (PR_TRUE) {
|
||||
++ focusedOptionIndex;
|
||||
options->Item(focusedOptionIndex, getter_AddRefs(nextOption));
|
||||
nsCOMPtr<nsIDOMHTMLOptionElement> optionElement = do_QueryInterface(nextOption);
|
||||
if (!optionElement) {
|
||||
break;
|
||||
}
|
||||
PRBool disabled;
|
||||
optionElement->GetDisabled(&disabled);
|
||||
if (!disabled) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Combo boxes can only have 1 selected option, so they can use the dom interface for this
|
||||
rv = selectElement->GetSelectedIndex(&focusedOptionIndex);
|
||||
return mParent;
|
||||
}
|
||||
|
||||
// Either use options and focused index, or default return null
|
||||
if (NS_SUCCEEDED(rv) && options && focusedOptionIndex >= 0) { // Something is focused
|
||||
nsCOMPtr<nsIDOMNode> focusedOptionNode;
|
||||
options->Item(focusedOptionIndex, getter_AddRefs(focusedOptionNode));
|
||||
nsIContent *focusedOption = nsnull;
|
||||
if (focusedOptionNode)
|
||||
CallQueryInterface(focusedOptionNode, &focusedOption);
|
||||
return focusedOption;
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLSelectOptionAccessible: static methods
|
||||
|
||||
void
|
||||
nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibleOptionNode)
|
||||
{
|
||||
@ -644,6 +560,7 @@ nsHTMLComboboxAccessible::
|
||||
nsHTMLComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
mFlags |= eComboboxAccessible;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -718,16 +635,12 @@ nsHTMLComboboxAccessible::NativeState()
|
||||
|
||||
nsIFrame *frame = GetBoundsFrame();
|
||||
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
|
||||
if (comboFrame && comboFrame->IsDroppedDown()) {
|
||||
if (comboFrame && comboFrame->IsDroppedDown())
|
||||
state |= states::EXPANDED;
|
||||
}
|
||||
else {
|
||||
state &= ~states::FOCUSED; // Focus is on an option
|
||||
else
|
||||
state |= states::COLLAPSED;
|
||||
}
|
||||
|
||||
state |= states::HASPOPUP | states::FOCUSABLE;
|
||||
|
||||
state |= states::HASPOPUP;
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -740,37 +653,17 @@ nsHTMLComboboxAccessible::Description(nsString& aDescription)
|
||||
nsAccessible::Description(aDescription);
|
||||
if (!aDescription.IsEmpty())
|
||||
return;
|
||||
// Use description of currently focused option
|
||||
nsAccessible *option = GetFocusedOptionAccessible();
|
||||
|
||||
// Otherwise use description of selected option.
|
||||
nsAccessible* option = SelectedOption();
|
||||
if (option)
|
||||
option->Description(aDescription);
|
||||
}
|
||||
|
||||
nsAccessible *
|
||||
nsHTMLComboboxAccessible::GetFocusedOptionAccessible()
|
||||
{
|
||||
if (IsDefunct())
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIContent> focusedOption =
|
||||
nsHTMLSelectOptionAccessible::GetFocusedOption(mContent);
|
||||
if (!focusedOption) {
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
return GetAccService()->GetAccessibleInWeakShell(focusedOption,
|
||||
mWeakShell);
|
||||
}
|
||||
|
||||
/**
|
||||
* MSAA/ATK accessible value != HTML value, especially not in combo boxes.
|
||||
* Our accessible value is the text label for of our ( first ) selected child.
|
||||
* The easiest way to get this is from the first child which is the readonly textfield.
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::GetValue(nsAString& aValue)
|
||||
{
|
||||
// Use accessible name of currently focused option.
|
||||
nsAccessible *option = GetFocusedOptionAccessible();
|
||||
// Use accessible name of selected option.
|
||||
nsAccessible* option = SelectedOption();
|
||||
return option ? option->GetName(aValue) : NS_OK;
|
||||
}
|
||||
|
||||
@ -780,25 +673,16 @@ nsHTMLComboboxAccessible::ActionCount()
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Programmaticaly toggle the combo box
|
||||
*/
|
||||
NS_IMETHODIMP nsHTMLComboboxAccessible::DoAction(PRUint8 aIndex)
|
||||
NS_IMETHODIMP
|
||||
nsHTMLComboboxAccessible::DoAction(PRUint8 aIndex)
|
||||
{
|
||||
if (aIndex != nsHTMLComboboxAccessible::eAction_Click) {
|
||||
if (aIndex != eAction_Click)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
nsIFrame *frame = GetFrame();
|
||||
if (!frame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsIComboboxControlFrame *comboFrame = do_QueryFrame(frame);
|
||||
if (!comboFrame) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
// Reverse whether it's dropped down or not
|
||||
comboFrame->ShowDropDown(!comboFrame->IsDroppedDown());
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
DoCommand();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -829,6 +713,63 @@ NS_IMETHODIMP nsHTMLComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLComboboxAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsHTMLComboboxAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLComboboxAccessible::IsActiveWidget() const
|
||||
{
|
||||
return FocusMgr()->HasDOMFocus(mContent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsHTMLComboboxAccessible::AreItemsOperable() const
|
||||
{
|
||||
nsIComboboxControlFrame* comboboxFrame = do_QueryFrame(GetFrame());
|
||||
return comboboxFrame && comboboxFrame->IsDroppedDown();
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsHTMLComboboxAccessible::CurrentItem()
|
||||
{
|
||||
// No current item for collapsed combobox.
|
||||
return SelectedOption(true);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLComboboxAccessible: protected
|
||||
|
||||
nsAccessible*
|
||||
nsHTMLComboboxAccessible::SelectedOption(bool aIgnoreIfCollapsed) const
|
||||
{
|
||||
nsIFrame* frame = GetFrame();
|
||||
nsIComboboxControlFrame* comboboxFrame = do_QueryFrame(frame);
|
||||
if (comboboxFrame) {
|
||||
if (aIgnoreIfCollapsed && !comboboxFrame->IsDroppedDown())
|
||||
return nsnull;
|
||||
|
||||
frame = comboboxFrame->GetDropDown();
|
||||
}
|
||||
|
||||
nsIListControlFrame* listControlFrame = do_QueryFrame(frame);
|
||||
if (listControlFrame) {
|
||||
nsCOMPtr<nsIContent> activeOptionNode = listControlFrame->GetCurrentOption();
|
||||
if (activeOptionNode) {
|
||||
nsDocAccessible* document = GetDocAccessible();
|
||||
if (document)
|
||||
return document->GetAccessible(activeOptionNode);
|
||||
}
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsHTMLComboboxListAccessible
|
||||
|
@ -80,6 +80,12 @@ public:
|
||||
virtual bool SelectAll();
|
||||
virtual bool UnselectAll();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
virtual bool IsActiveWidget() const;
|
||||
virtual bool AreItemsOperable() const;
|
||||
virtual nsAccessible* CurrentItem();
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
@ -107,7 +113,7 @@ public:
|
||||
// nsIAccessible
|
||||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
|
||||
NS_IMETHOD SetSelected(PRBool aSelect);
|
||||
NS_IMETHOD SetSelected(bool aSelect);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
@ -121,10 +127,8 @@ public:
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
/**
|
||||
* Return focused option if any.
|
||||
*/
|
||||
static already_AddRefed<nsIContent> GetFocusedOption(nsIContent *aListNode);
|
||||
// Widgets
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
|
||||
static void SelectionChangedIfOption(nsIContent *aPossibleOption);
|
||||
|
||||
@ -202,16 +206,20 @@ public:
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
virtual bool IsActiveWidget() const;
|
||||
virtual bool AreItemsOperable() const;
|
||||
virtual nsAccessible* CurrentItem();
|
||||
|
||||
protected:
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsHTMLComboboxAccessible
|
||||
|
||||
/**
|
||||
* Return focused option accessible.
|
||||
* Return selected option.
|
||||
*/
|
||||
nsAccessible *GetFocusedOptionAccessible();
|
||||
nsAccessible* SelectedOption(bool aIgnoreIfCollapsed = false) const;
|
||||
|
||||
private:
|
||||
nsRefPtr<nsHTMLComboboxListAccessible> mListAccessible;
|
||||
|
@ -106,7 +106,7 @@ nsHTMLTableCellAccessible::NativeState()
|
||||
|
||||
if (frame) {
|
||||
state |= states::SELECTABLE;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
frame->GetSelected(&isSelected);
|
||||
if (isSelected)
|
||||
state |= states::SELECTED;
|
||||
@ -245,7 +245,7 @@ nsHTMLTableCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableCellAccessible::IsSelected(PRBool *aIsSelected)
|
||||
nsHTMLTableCellAccessible::IsSelected(bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -492,7 +492,7 @@ nsHTMLTableAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
||||
nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool isProbablyForLayout;
|
||||
bool isProbablyForLayout;
|
||||
IsProbablyForLayout(&isProbablyForLayout);
|
||||
if (isProbablyForLayout) {
|
||||
nsAutoString oldValueUnused;
|
||||
@ -589,7 +589,7 @@ nsHTMLTableAccessible::GetSelectedCellCount(PRUint32* aCount)
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
|
||||
PRInt32 rowIndex;
|
||||
for (rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
||||
@ -624,7 +624,7 @@ nsHTMLTableAccessible::GetSelectedColumnCount(PRUint32* aCount)
|
||||
|
||||
PRInt32 index;
|
||||
for (index = 0; index < count; index++) {
|
||||
PRBool state = PR_FALSE;
|
||||
bool state = false;
|
||||
rv = IsColumnSelected(index, &state);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -647,7 +647,7 @@ nsHTMLTableAccessible::GetSelectedRowCount(PRUint32* aCount)
|
||||
|
||||
PRInt32 index;
|
||||
for (index = 0; index < count; index++) {
|
||||
PRBool state = PR_FALSE;
|
||||
bool state = false;
|
||||
rv = IsRowSelected(index, &state);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
@ -682,7 +682,7 @@ nsHTMLTableAccessible::GetSelectedCells(nsIArray **aCells)
|
||||
nsCOMPtr<nsIDOMElement> cellElement;
|
||||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
|
||||
PRInt32 rowIndex, index;
|
||||
for (rowIndex = 0, index = 0; rowIndex < rowCount; rowIndex++) {
|
||||
@ -732,10 +732,10 @@ nsHTMLTableAccessible::GetSelectedCellIndices(PRUint32 *aNumCells,
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
|
||||
PRInt32 cellsCount = columnCount * rowCount;
|
||||
nsAutoArrayPtr<PRBool> states(new PRBool[cellsCount]);
|
||||
nsAutoArrayPtr<bool> states(new bool[cellsCount]);
|
||||
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
PRInt32 rowIndex, index;
|
||||
@ -789,7 +789,7 @@ nsHTMLTableAccessible::GetSelectedColumnIndices(PRUint32 *aNumColumns,
|
||||
rv = GetColumnCount(&columnCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool *states = new PRBool[columnCount];
|
||||
bool *states = new bool[columnCount];
|
||||
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*aNumColumns = 0;
|
||||
@ -831,7 +831,7 @@ nsHTMLTableAccessible::GetSelectedRowIndices(PRUint32 *aNumRows,
|
||||
rv = GetRowCount(&rowCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
PRBool *states = new PRBool[rowCount];
|
||||
bool *states = new bool[rowCount];
|
||||
NS_ENSURE_TRUE(states, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
*aNumRows = 0;
|
||||
@ -970,7 +970,7 @@ nsHTMLTableAccessible::GetColumnExtentAt(PRInt32 aRowIndex,
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualRowSpan;
|
||||
PRBool isSelected;
|
||||
bool isSelected;
|
||||
|
||||
nsresult rv = tableLayout->
|
||||
GetCellDataAt(aRowIndex, aColumnIndex, *getter_AddRefs(domElement),
|
||||
@ -989,7 +989,7 @@ nsHTMLTableAccessible::GetRowExtentAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement;
|
||||
PRInt32 startRowIndex, startColIndex, rowSpan, colSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
bool isSelected;
|
||||
|
||||
nsresult rv = tableLayout->
|
||||
GetCellDataAt(aRowIndex, aColumnIndex, *getter_AddRefs(domElement),
|
||||
@ -1012,7 +1012,7 @@ nsHTMLTableAccessible::GetRowDescription(PRInt32 aRow, nsAString &_retval)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
||||
nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -1029,7 +1029,7 @@ nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRInt32 rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
rv = IsCellSelected(rowIdx, aColumn, &isSelected);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aIsSelected = isSelected;
|
||||
@ -1042,7 +1042,7 @@ nsHTMLTableAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
||||
nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -1059,7 +1059,7 @@ nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (PRInt32 colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
rv = IsCellSelected(aRow, colIdx, &isSelected);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aIsSelected = isSelected;
|
||||
@ -1073,7 +1073,7 @@ nsHTMLTableAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
|
||||
PRBool *aIsSelected)
|
||||
bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -1155,7 +1155,7 @@ nsresult
|
||||
nsHTMLTableAccessible::AddRowOrColumnToSelection(PRInt32 aIndex,
|
||||
PRUint32 aTarget)
|
||||
{
|
||||
PRBool doSelectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
|
||||
bool doSelectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
@ -1163,7 +1163,7 @@ nsHTMLTableAccessible::AddRowOrColumnToSelection(PRInt32 aIndex,
|
||||
nsCOMPtr<nsIDOMElement> cellElm;
|
||||
PRInt32 startRowIdx, startColIdx, rowSpan, colSpan,
|
||||
actualRowSpan, actualColSpan;
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
PRInt32 count = 0;
|
||||
@ -1201,7 +1201,7 @@ nsHTMLTableAccessible::AddRowOrColumnToSelection(PRInt32 aIndex,
|
||||
nsresult
|
||||
nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
|
||||
PRUint32 aTarget,
|
||||
PRBool aIsOuter)
|
||||
bool aIsOuter)
|
||||
{
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
@ -1210,7 +1210,7 @@ nsHTMLTableAccessible::RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
|
||||
nsRefPtr<nsFrameSelection> tableSelection =
|
||||
const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
|
||||
|
||||
PRBool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
|
||||
bool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
|
||||
PRInt32 count = 0;
|
||||
nsresult rv = doUnselectRow ? GetColumnCount(&count) : GetRowCount(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -1248,7 +1248,7 @@ nsHTMLTableAccessible::GetCellAt(PRInt32 aRowIndex,
|
||||
{
|
||||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||
PRBool isSelected;
|
||||
bool isSelected;
|
||||
|
||||
nsITableLayout *tableLayout = GetTableLayout();
|
||||
NS_ENSURE_STATE(tableLayout);
|
||||
@ -1290,7 +1290,7 @@ nsHTMLTableAccessible::Description(nsString& aDescription)
|
||||
|
||||
#ifdef SHOW_LAYOUT_HEURISTIC
|
||||
if (aDescription.IsEmpty()) {
|
||||
PRBool isProbablyForLayout;
|
||||
bool isProbablyForLayout;
|
||||
IsProbablyForLayout(&isProbablyForLayout);
|
||||
aDescription = mLayoutHeuristic;
|
||||
}
|
||||
@ -1300,9 +1300,9 @@ nsHTMLTableAccessible::Description(nsString& aDescription)
|
||||
#endif
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsHTMLTableAccessible::HasDescendant(const nsAString& aTagName,
|
||||
PRBool aAllowEmpty)
|
||||
bool aAllowEmpty)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElement> tableElt(do_QueryInterface(mContent));
|
||||
NS_ENSURE_TRUE(tableElt, PR_FALSE);
|
||||
@ -1341,7 +1341,7 @@ nsHTMLTableAccessible::HasDescendant(const nsAString& aTagName,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
nsHTMLTableAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
|
||||
{
|
||||
// Implement a heuristic to determine if table is most likely used for layout
|
||||
// XXX do we want to look for rowspan or colspan, especialy that span all but a couple cells
|
||||
@ -1375,7 +1375,7 @@ nsHTMLTableAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
|
||||
// Check to see if an ARIA role overrides the role from native markup,
|
||||
// but for which we still expose table semantics (treegrid, for example).
|
||||
PRBool hasNonTableRole = (Role() != nsIAccessibleRole::ROLE_TABLE);
|
||||
bool hasNonTableRole = (Role() != nsIAccessibleRole::ROLE_TABLE);
|
||||
if (hasNonTableRole) {
|
||||
RETURN_LAYOUT_ANSWER(PR_FALSE, "Has role attribute");
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ protected:
|
||||
*/
|
||||
nsresult RemoveRowsOrColumnsFromSelection(PRInt32 aIndex,
|
||||
PRUint32 aTarget,
|
||||
PRBool aIsOuter);
|
||||
bool aIsOuter);
|
||||
|
||||
/**
|
||||
* Return true if table has an element with the given tag name.
|
||||
@ -195,7 +195,7 @@ protected:
|
||||
* @param aAllowEmpty [in, optional] points if found element can be empty
|
||||
* or contain whitespace text only.
|
||||
*/
|
||||
PRBool HasDescendant(const nsAString& aTagName, PRBool aAllowEmpty = PR_TRUE);
|
||||
bool HasDescendant(const nsAString& aTagName, bool aAllowEmpty = true);
|
||||
|
||||
#ifdef SHOW_LAYOUT_HEURISTIC
|
||||
nsString mLayoutHeuristic;
|
||||
|
@ -287,7 +287,7 @@ nsHyperTextAccessible::GetPosAndText(PRInt32& aStartOffset, PRInt32& aEndOffset,
|
||||
PRInt32 startOffset = aStartOffset;
|
||||
PRInt32 endOffset = aEndOffset;
|
||||
// XXX this prevents text interface usage on <input type="password">
|
||||
PRBool isPassword = (Role() == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
|
||||
bool isPassword = (Role() == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
|
||||
|
||||
// Clear out parameters and set up loop
|
||||
if (aText) {
|
||||
@ -552,7 +552,7 @@ nsAccessible*
|
||||
nsHyperTextAccessible::DOMPointToHypertextOffset(nsINode *aNode,
|
||||
PRInt32 aNodeOffset,
|
||||
PRInt32 *aHyperTextOffset,
|
||||
PRBool aIsEndOffset)
|
||||
bool aIsEndOffset)
|
||||
{
|
||||
if (!aHyperTextOffset)
|
||||
return nsnull;
|
||||
@ -721,7 +721,7 @@ nsHyperTextAccessible::HypertextOffsetsToDOMRange(PRInt32 aStartHTOffset,
|
||||
nsCOMPtr<nsIEditor> editor;
|
||||
GetAssociatedEditor(getter_AddRefs(editor));
|
||||
if (editor) {
|
||||
PRBool isEmpty = PR_FALSE;
|
||||
bool isEmpty = false;
|
||||
editor->GetDocumentIsEmpty(&isEmpty);
|
||||
if (isEmpty) {
|
||||
nsCOMPtr<nsIDOMElement> editorRootElm;
|
||||
@ -779,12 +779,12 @@ nsHyperTextAccessible::GetRelativeOffset(nsIPresShell *aPresShell,
|
||||
nsAccessible *aFromAccessible,
|
||||
nsSelectionAmount aAmount,
|
||||
nsDirection aDirection,
|
||||
PRBool aNeedsStart)
|
||||
bool aNeedsStart)
|
||||
{
|
||||
const PRBool kIsJumpLinesOk = PR_TRUE; // okay to jump lines
|
||||
const PRBool kIsScrollViewAStop = PR_FALSE; // do not stop at scroll views
|
||||
const PRBool kIsKeyboardSelect = PR_TRUE; // is keyboard selection
|
||||
const PRBool kIsVisualBidi = PR_FALSE; // use visual order for bidi text
|
||||
const bool kIsJumpLinesOk = true; // okay to jump lines
|
||||
const bool kIsScrollViewAStop = false; // do not stop at scroll views
|
||||
const bool kIsKeyboardSelect = true; // is keyboard selection
|
||||
const bool kIsVisualBidi = false; // use visual order for bidi text
|
||||
|
||||
EWordMovementType wordMovementType = aNeedsStart ? eStartWord : eEndWord;
|
||||
if (aAmount == eSelectLine) {
|
||||
@ -928,7 +928,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe
|
||||
}
|
||||
|
||||
nsSelectionAmount amount;
|
||||
PRBool needsStart = PR_FALSE;
|
||||
bool needsStart = false;
|
||||
switch (aBoundaryType) {
|
||||
case BOUNDARY_CHAR:
|
||||
amount = eSelectCluster;
|
||||
@ -1108,7 +1108,7 @@ NS_IMETHODIMP nsHyperTextAccessible::GetTextAfterOffset(PRInt32 aOffset, nsAcces
|
||||
// out long rangeStartOffset,
|
||||
// out long rangeEndOffset);
|
||||
NS_IMETHODIMP
|
||||
nsHyperTextAccessible::GetTextAttributes(PRBool aIncludeDefAttrs,
|
||||
nsHyperTextAccessible::GetTextAttributes(bool aIncludeDefAttrs,
|
||||
PRInt32 aOffset,
|
||||
PRInt32 *aStartOffset,
|
||||
PRInt32 *aEndOffset,
|
||||
@ -1242,7 +1242,7 @@ nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
|
||||
oldValueUnused);
|
||||
}
|
||||
|
||||
if (gLastFocusedNode == GetNode()) {
|
||||
if (FocusMgr()->IsFocused(this)) {
|
||||
PRInt32 lineNumber = GetCaretLineNumber();
|
||||
if (lineNumber >= 1) {
|
||||
nsAutoString strLineNumber;
|
||||
@ -1628,13 +1628,9 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
|
||||
|
||||
// No caret if the focused node is not inside this DOM node and this DOM node
|
||||
// is not inside of focused node.
|
||||
|
||||
nsINode* thisNode = GetNode();
|
||||
PRBool isInsideOfFocusedNode =
|
||||
nsCoreUtils::IsAncestorOf(gLastFocusedNode, thisNode);
|
||||
|
||||
if (!isInsideOfFocusedNode && thisNode != gLastFocusedNode &&
|
||||
!nsCoreUtils::IsAncestorOf(thisNode, gLastFocusedNode))
|
||||
FocusManager::FocusDisposition focusDisp =
|
||||
FocusMgr()->IsInOrContainsFocus(this);
|
||||
if (focusDisp == FocusManager::eNone)
|
||||
return NS_OK;
|
||||
|
||||
// Turn the focus node and offset of the selection into caret hypretext
|
||||
@ -1655,10 +1651,11 @@ nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
|
||||
// No caret if this DOM node is inside of focused node but the selection's
|
||||
// focus point is not inside of this DOM node.
|
||||
nsCOMPtr<nsINode> focusNode(do_QueryInterface(focusDOMNode));
|
||||
if (isInsideOfFocusedNode) {
|
||||
if (focusDisp == FocusManager::eContainedByFocus) {
|
||||
nsINode *resultNode =
|
||||
nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset);
|
||||
|
||||
nsINode* thisNode = GetNode();
|
||||
if (resultNode != thisNode &&
|
||||
!nsCoreUtils::IsAncestorOf(thisNode, resultNode))
|
||||
return NS_OK;
|
||||
@ -1808,7 +1805,7 @@ nsHyperTextAccessible::GetSelections(PRInt16 aType,
|
||||
// Remove collapsed ranges
|
||||
PRInt32 numRanges = aRanges->Count();
|
||||
for (PRInt32 count = 0; count < numRanges; count ++) {
|
||||
PRBool isCollapsed;
|
||||
bool isCollapsed;
|
||||
(*aRanges)[count]->GetCollapsed(&isCollapsed);
|
||||
if (isCollapsed) {
|
||||
aRanges->RemoveObjectAt(count);
|
||||
@ -1907,7 +1904,7 @@ nsHyperTextAccessible::SetSelectionBounds(PRInt32 aSelectionNum,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Caret is a collapsed selection
|
||||
PRBool isOnlyCaret = (aStartOffset == aEndOffset);
|
||||
bool isOnlyCaret = (aStartOffset == aEndOffset);
|
||||
|
||||
PRInt32 rangeCount;
|
||||
domSel->GetRangeCount(&rangeCount);
|
||||
@ -2031,7 +2028,7 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
|
||||
|
||||
nsPresContext *presContext = frame->PresContext();
|
||||
|
||||
PRBool initialScrolled = PR_FALSE;
|
||||
bool initialScrolled = false;
|
||||
nsIFrame *parentFrame = frame;
|
||||
while ((parentFrame = parentFrame->GetParent())) {
|
||||
nsIScrollableFrame *scrollableFrame = do_QueryFrame(parentFrame);
|
||||
@ -2086,7 +2083,7 @@ nsHyperTextAccessible::InvalidateChildren()
|
||||
nsAccessibleWrap::InvalidateChildren();
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsHyperTextAccessible::RemoveChild(nsAccessible* aAccessible)
|
||||
{
|
||||
PRInt32 childIndex = aAccessible->IndexInParent();
|
||||
@ -2182,7 +2179,7 @@ nsHyperTextAccessible::GetCharAt(PRInt32 aOffset, EGetTextType aShift,
|
||||
|
||||
PRInt32
|
||||
nsHyperTextAccessible::GetChildOffset(PRUint32 aChildIndex,
|
||||
PRBool aInvalidateAfter)
|
||||
bool aInvalidateAfter)
|
||||
{
|
||||
if (aChildIndex == 0) {
|
||||
if (aInvalidateAfter)
|
||||
@ -2310,8 +2307,8 @@ nsHyperTextAccessible::GetDOMPointByFrameOffset(nsIFrame *aFrame,
|
||||
// nsHyperTextAccessible
|
||||
nsresult
|
||||
nsHyperTextAccessible::DOMRangeBoundToHypertextOffset(nsIDOMRange *aRange,
|
||||
PRBool aIsStartBound,
|
||||
PRBool aIsStartHTOffset,
|
||||
bool aIsStartBound,
|
||||
bool aIsStartHTOffset,
|
||||
PRInt32 *aHTOffset)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> DOMNode;
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
virtual void InvalidateChildren();
|
||||
virtual PRBool RemoveChild(nsAccessible* aAccessible);
|
||||
virtual bool RemoveChild(nsAccessible* aAccessible);
|
||||
|
||||
// nsHyperTextAccessible (static helper method)
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
nsAccessible *DOMPointToHypertextOffset(nsINode *aNode,
|
||||
PRInt32 aNodeOffset,
|
||||
PRInt32 *aHypertextOffset,
|
||||
PRBool aIsEndOffset = PR_FALSE);
|
||||
bool aIsEndOffset = false);
|
||||
|
||||
/**
|
||||
* Turn a hypertext offsets into DOM point.
|
||||
@ -233,7 +233,7 @@ public:
|
||||
* cached offsets for next siblings of the child
|
||||
*/
|
||||
PRInt32 GetChildOffset(nsAccessible* aChild,
|
||||
PRBool aInvalidateAfter = PR_FALSE)
|
||||
bool aInvalidateAfter = false)
|
||||
{
|
||||
PRInt32 index = GetIndexOf(aChild);
|
||||
return index == -1 ? -1 : GetChildOffset(index, aInvalidateAfter);
|
||||
@ -243,7 +243,7 @@ public:
|
||||
* Return text offset for the child accessible index.
|
||||
*/
|
||||
PRInt32 GetChildOffset(PRUint32 aChildIndex,
|
||||
PRBool aInvalidateAfter = PR_FALSE);
|
||||
bool aInvalidateAfter = false);
|
||||
|
||||
/**
|
||||
* Return child accessible at the given text offset.
|
||||
@ -313,7 +313,7 @@ protected:
|
||||
PRInt32 GetRelativeOffset(nsIPresShell *aPresShell, nsIFrame *aFromFrame,
|
||||
PRInt32 aFromOffset, nsAccessible *aFromAccessible,
|
||||
nsSelectionAmount aAmount, nsDirection aDirection,
|
||||
PRBool aNeedsStart);
|
||||
bool aNeedsStart);
|
||||
|
||||
/**
|
||||
* Provides information for substring that is defined by the given start
|
||||
@ -397,8 +397,8 @@ protected:
|
||||
* @param aHTOffset [out] the result offset
|
||||
*/
|
||||
nsresult DOMRangeBoundToHypertextOffset(nsIDOMRange *aRange,
|
||||
PRBool aIsStartBound,
|
||||
PRBool aIsStartOffset,
|
||||
bool aIsStartBound,
|
||||
bool aIsStartOffset,
|
||||
PRInt32 *aHTOffset);
|
||||
|
||||
/**
|
||||
|
@ -81,10 +81,10 @@ struct AccessibleWrapper {
|
||||
return object;
|
||||
}
|
||||
|
||||
PRBool isIgnored () {
|
||||
bool isIgnored () {
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
return (PRBool)[object accessibilityIsIgnored];
|
||||
return (bool)[object accessibilityIsIgnored];
|
||||
|
||||
NS_OBJC_END_TRY_ABORT_BLOCK_RETURN(PR_FALSE);
|
||||
}
|
||||
|
@ -82,7 +82,11 @@ extern const NSString *kTopLevelUIElementAttribute; // NSAccessibilityTopLevel
|
||||
return [self selectedTextRange];
|
||||
if ([attribute isEqualToString:NSAccessibilitySelectedTextAttribute])
|
||||
return [self selectedText];
|
||||
|
||||
// Apple's SpeechSynthesisServer expects AXValue to return an AXStaticText
|
||||
// object's AXSelectedText attribute. See bug 674612.
|
||||
if ([attribute isEqualToString:NSAccessibilityValueAttribute])
|
||||
return [self selectedText];
|
||||
|
||||
// let mozAccessible handle all other attributes
|
||||
return [super accessibilityAttributeValue:attribute];
|
||||
|
||||
|
@ -64,7 +64,7 @@ class nsAccessibleWrap : public nsAccessible
|
||||
virtual ~nsAccessibleWrap();
|
||||
|
||||
// creates the native accessible connected to this one.
|
||||
virtual PRBool Init ();
|
||||
virtual bool Init ();
|
||||
|
||||
// get the native obj-c object (mozAccessible)
|
||||
NS_IMETHOD GetNativeInterface (void **aOutAccessible);
|
||||
@ -81,11 +81,11 @@ class nsAccessibleWrap : public nsAccessible
|
||||
|
||||
// ignored means that the accessible might still have children, but is not displayed
|
||||
// to the user. it also has no native accessible object represented for it.
|
||||
PRBool IsIgnored();
|
||||
bool IsIgnored();
|
||||
|
||||
PRInt32 GetUnignoredChildCount(PRBool aDeepCount);
|
||||
PRInt32 GetUnignoredChildCount(bool aDeepCount);
|
||||
|
||||
PRBool HasPopup () {
|
||||
bool HasPopup () {
|
||||
return (NativeState() & mozilla::a11y::states::HASPOPUP);
|
||||
}
|
||||
|
||||
@ -100,7 +100,7 @@ class nsAccessibleWrap : public nsAccessible
|
||||
/**
|
||||
* Return true if the parent doesn't have children to expose to AT.
|
||||
*/
|
||||
PRBool AncestorIsFlat();
|
||||
bool AncestorIsFlat();
|
||||
|
||||
// Wrapper around our native object.
|
||||
AccessibleWrapper *mNativeWrapper;
|
||||
|
@ -60,7 +60,7 @@ nsAccessibleWrap::~nsAccessibleWrap()
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessibleWrap::Init ()
|
||||
{
|
||||
if (!nsAccessible::Init())
|
||||
@ -211,7 +211,7 @@ nsAccessibleWrap::InvalidateChildren()
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccessibleWrap::GetUnignoredChildCount(PRBool aDeepCount)
|
||||
nsAccessibleWrap::GetUnignoredChildCount(bool aDeepCount)
|
||||
{
|
||||
// if we're flat, we have no children.
|
||||
if (nsAccUtils::MustPrune(this))
|
||||
@ -248,7 +248,7 @@ nsAccessibleWrap::GetUnignoredChildCount(PRBool aDeepCount)
|
||||
|
||||
// if we for some reason have no native accessible, we should be skipped over (and traversed)
|
||||
// when fetching all unignored children, etc. when counting unignored children, we will not be counted.
|
||||
PRBool
|
||||
bool
|
||||
nsAccessibleWrap::IsIgnored()
|
||||
{
|
||||
return (mNativeWrapper == nsnull) || mNativeWrapper->isIgnored();
|
||||
@ -302,7 +302,7 @@ nsAccessibleWrap::GetUnignoredParent()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessibleWrap protected
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsAccessibleWrap::AncestorIsFlat()
|
||||
{
|
||||
// We don't create a native object if we're child of a "flat" accessible;
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
/**
|
||||
* Creates the native accessible connected to this one.
|
||||
*/
|
||||
virtual PRBool Init();
|
||||
virtual bool Init();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -50,7 +50,7 @@ nsDocAccessibleWrap::~nsDocAccessibleWrap()
|
||||
{
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsDocAccessibleWrap::Init ()
|
||||
{
|
||||
if (!nsDocAccessible::Init())
|
||||
|
@ -525,7 +525,7 @@ __try {
|
||||
if (!tableAcc)
|
||||
return E_FAIL;
|
||||
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
nsresult rv = tableAcc->IsColumnSelected(aColumn, &isSelected);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
@ -548,7 +548,7 @@ __try {
|
||||
if (!tableAcc)
|
||||
return E_FAIL;
|
||||
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
nsresult rv = tableAcc->IsRowSelected(aRow, &isSelected);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
@ -571,7 +571,7 @@ __try {
|
||||
if (!tableAcc)
|
||||
return E_FAIL;
|
||||
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
nsresult rv = tableAcc->IsCellSelected(aRow, aColumn, &isSelected);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
@ -681,7 +681,7 @@ __try {
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
rv = tableAcc->IsCellSelected(rowIdx, columnIdx, &isSelected);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
@ -297,7 +297,7 @@ __try {
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
PRBool isSel = PR_FALSE;
|
||||
bool isSel = false;
|
||||
rv = tableCell->IsSelected(&isSel);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
@ -325,7 +325,7 @@ __try {
|
||||
if (!tableCell)
|
||||
return E_FAIL;
|
||||
|
||||
PRBool isSel = PR_FALSE;
|
||||
bool isSel = false;
|
||||
nsresult rv = tableCell->IsSelected(&isSel);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*isSelected = isSel;
|
||||
|
@ -518,7 +518,7 @@ __try {
|
||||
// CAccessibleText
|
||||
|
||||
HRESULT
|
||||
CAccessibleText::GetModifiedText(PRBool aGetInsertedText,
|
||||
CAccessibleText::GetModifiedText(bool aGetInsertedText,
|
||||
IA2TextSegment *aText)
|
||||
{
|
||||
PRUint32 startOffset = 0, endOffset = 0;
|
||||
|
@ -151,12 +151,12 @@ public:
|
||||
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
|
||||
|
||||
protected:
|
||||
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
|
||||
virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
|
||||
PRUint32 *aStartOffset,
|
||||
PRUint32 *aEndOffset) = 0;
|
||||
|
||||
private:
|
||||
HRESULT GetModifiedText(PRBool aGetInsertedText, IA2TextSegment *aNewText);
|
||||
HRESULT GetModifiedText(bool aGetInsertedText, IA2TextSegment *aNewText);
|
||||
nsAccessibleTextBoundary GetGeckoTextBoundary(enum IA2TextBoundaryType coordinateType);
|
||||
};
|
||||
|
||||
|
@ -69,7 +69,7 @@ LPFNNOTIFYWINEVENT nsAccessNodeWrap::gmNotifyWinEvent = nsnull;
|
||||
LPFNGETGUITHREADINFO nsAccessNodeWrap::gmGetGUIThreadInfo = nsnull;
|
||||
|
||||
// Used to determine whether an IAccessible2 compatible screen reader is loaded.
|
||||
PRBool nsAccessNodeWrap::gIsIA2Disabled = PR_FALSE;
|
||||
bool nsAccessNodeWrap::gIsIA2Disabled = false;
|
||||
|
||||
AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
|
||||
|
||||
@ -666,7 +666,7 @@ GetHRESULT(nsresult aResult)
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
|
||||
bool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
|
||||
{
|
||||
HMODULE jhookhandle = ::GetModuleHandleW(kJAWSModuleHandle);
|
||||
if (!jhookhandle)
|
||||
|
@ -159,7 +159,7 @@ public: // construction, destruction
|
||||
|
||||
static int FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo);
|
||||
|
||||
static PRBool IsOnlyMsaaCompatibleJawsPresent();
|
||||
static bool IsOnlyMsaaCompatibleJawsPresent();
|
||||
|
||||
static void TurnOffNewTabSwitchingForJawsAndWE();
|
||||
|
||||
@ -186,7 +186,7 @@ protected:
|
||||
* Used to determine whether an IAccessible2 compatible screen reader is
|
||||
* loaded. Currently used for JAWS versions older than 8.0.2173.
|
||||
*/
|
||||
static PRBool gIsIA2Disabled;
|
||||
static bool gIsIA2Disabled;
|
||||
|
||||
/**
|
||||
* It is used in nsHyperTextAccessibleWrap for IA2::newText/oldText
|
||||
|
@ -1617,7 +1617,7 @@ nsAccessibleWrap::GetHWNDFor(nsAccessible *aAccessible)
|
||||
nsIFrame* frame = aAccessible->GetFrame();
|
||||
if (frame) {
|
||||
nsIWidget* widget = frame->GetNearestWidget();
|
||||
PRBool isVisible = PR_FALSE;
|
||||
bool isVisible = false;
|
||||
widget->IsVisible(isVisible);
|
||||
if (isVisible) {
|
||||
nsCOMPtr<nsIPresShell> shell(aAccessible->GetPresShell());
|
||||
@ -1662,7 +1662,7 @@ nsAccessibleWrap::ConvertToIA2Attributes(nsIPersistentProperties *aAttributes,
|
||||
|
||||
const char kCharsToEscape[] = ":;=,\\";
|
||||
|
||||
PRBool hasMore = PR_FALSE;
|
||||
bool hasMore = false;
|
||||
while (NS_SUCCEEDED(propEnum->HasMoreElements(&hasMore)) && hasMore) {
|
||||
nsCOMPtr<nsISupports> propSupports;
|
||||
propEnum->GetNext(getter_AddRefs(propSupports));
|
||||
|
@ -287,7 +287,7 @@ nsDocAccessibleWrap::DoInitialUpdate()
|
||||
nativeData = reinterpret_cast<mozilla::WindowsHandle>(
|
||||
rootDocument->GetNativeWindow());
|
||||
|
||||
PRBool isActive = PR_TRUE;
|
||||
bool isActive = true;
|
||||
PRInt32 x = CW_USEDEFAULT, y = CW_USEDEFAULT, width = 0, height = 0;
|
||||
if (nsWinUtils::IsWindowEmulationFor(kDolphinModuleHandle)) {
|
||||
GetBounds(&x, &y, &width, &height);
|
||||
|
@ -78,7 +78,7 @@ nsHyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHyperTextAccessibleWrap::GetModifiedText(PRBool aGetInsertedText,
|
||||
nsHyperTextAccessibleWrap::GetModifiedText(bool aGetInsertedText,
|
||||
nsAString& aText,
|
||||
PRUint32 *aStartOffset,
|
||||
PRUint32 *aEndOffset)
|
||||
@ -90,7 +90,7 @@ nsHyperTextAccessibleWrap::GetModifiedText(PRBool aGetInsertedText,
|
||||
if (!gTextEvent)
|
||||
return NS_OK;
|
||||
|
||||
PRBool isInserted = gTextEvent->IsTextInserted();
|
||||
bool isInserted = gTextEvent->IsTextInserted();
|
||||
if (aGetInsertedText != isInserted)
|
||||
return NS_OK;
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
virtual nsresult HandleAccEvent(AccEvent* aEvent);
|
||||
|
||||
protected:
|
||||
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
|
||||
virtual nsresult GetModifiedText(bool aGetInsertedText, nsAString& aText,
|
||||
PRUint32 *aStartOffset,
|
||||
PRUint32 *aEndOffset);
|
||||
};
|
||||
|
@ -189,7 +189,7 @@ __try {
|
||||
|
||||
nsIFrame* nsTextAccessibleWrap::GetPointFromOffset(nsIFrame *aContainingFrame,
|
||||
PRInt32 aOffset,
|
||||
PRBool aPreferNext,
|
||||
bool aPreferNext,
|
||||
nsPoint& aOutPoint)
|
||||
{
|
||||
nsIFrame *textFrame = nsnull;
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
|
||||
// Return child frame containing offset on success
|
||||
nsIFrame* GetPointFromOffset(nsIFrame *aContainingFrame,
|
||||
PRInt32 aOffset, PRBool aPreferNext, nsPoint& aOutPoint);
|
||||
PRInt32 aOffset, bool aPreferNext, nsPoint& aOutPoint);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -160,19 +160,19 @@ nsXFormsAccessible::NativeState()
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
PRBool isRelevant = PR_FALSE;
|
||||
bool isRelevant = false;
|
||||
nsresult rv = sXFormsService->IsRelevant(DOMNode, &isRelevant);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
PRBool isReadonly = PR_FALSE;
|
||||
bool isReadonly = false;
|
||||
rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
PRBool isRequired = PR_FALSE;
|
||||
bool isRequired = false;
|
||||
rv = sXFormsService->IsRequired(DOMNode, &isRequired);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
PRBool isValid = PR_FALSE;
|
||||
bool isValid = false;
|
||||
rv = sXFormsService->IsValid(DOMNode, &isValid);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
@ -211,7 +211,7 @@ nsXFormsAccessible::Description(nsString& aDescription)
|
||||
GetBoundChildElementValue(NS_LITERAL_STRING("hint"), aDescription);
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXFormsAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
return PR_FALSE;
|
||||
@ -234,7 +234,7 @@ nsXFormsContainerAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_GROUPING;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
return PR_TRUE;
|
||||
@ -258,12 +258,12 @@ nsXFormsEditableAccessible::NativeState()
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
|
||||
PRBool isReadonly = PR_FALSE;
|
||||
bool isReadonly = false;
|
||||
nsresult rv = sXFormsService->IsReadonly(DOMNode, &isReadonly);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
||||
if (!isReadonly) {
|
||||
PRBool isRelevant = PR_FALSE;
|
||||
bool isRelevant = false;
|
||||
rv = sXFormsService->IsRelevant(DOMNode, &isRelevant);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
if (isRelevant) {
|
||||
@ -473,7 +473,7 @@ nsXFormsSelectableAccessible::IsItemSelected(PRUint32 aIndex)
|
||||
return selItemDOMNode == itemDOMNode;
|
||||
}
|
||||
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
sXFormsService->IsSelectItemSelected(DOMNode, itemDOMNode, &isSelected);
|
||||
return isSelected;
|
||||
}
|
||||
@ -583,7 +583,7 @@ nsXFormsSelectableItemAccessible::IsSelected()
|
||||
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
if (nodeinfo->Equals(nsGkAtoms::select)) {
|
||||
PRBool isSelected = PR_FALSE;
|
||||
bool isSelected = false;
|
||||
rv = sXFormsService->IsSelectItemSelected(select, DOMNode, &isSelected);
|
||||
return NS_SUCCEEDED(rv) && isSelected;
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
|
||||
// Denies accessible nodes in anonymous content of xforms element by
|
||||
// always returning PR_FALSE value.
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
|
||||
protected:
|
||||
// Returns value of first child xforms element by tagname that is bound to
|
||||
@ -131,7 +131,7 @@ public:
|
||||
|
||||
// Allows accessible nodes in anonymous content of xforms element by
|
||||
// always returning PR_TRUE value.
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ protected:
|
||||
nsIContent* GetItemByIndex(PRUint32* aIndex,
|
||||
nsAccessible* aAccessible = nsnull);
|
||||
|
||||
PRBool mIsSelect1Element;
|
||||
bool mIsSelect1Element;
|
||||
};
|
||||
|
||||
|
||||
|
@ -575,7 +575,7 @@ nsXFormsSelectComboboxAccessible::NativeState()
|
||||
{
|
||||
PRUint64 state = nsXFormsSelectableAccessible::NativeState();
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
bool isOpen = false;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
@ -588,7 +588,7 @@ nsXFormsSelectComboboxAccessible::NativeState()
|
||||
return state | states::HASPOPUP | states::FOCUSABLE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXFormsSelectComboboxAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
return PR_TRUE;
|
||||
|
@ -297,7 +297,7 @@ public:
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
};
|
||||
|
||||
|
||||
|
@ -62,7 +62,7 @@ nsXFormsDropmarkerWidgetAccessible::NativeRole()
|
||||
PRUint64
|
||||
nsXFormsDropmarkerWidgetAccessible::NativeState()
|
||||
{
|
||||
PRBool isOpen = PR_FALSE;
|
||||
bool isOpen = false;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
@ -83,7 +83,7 @@ nsXFormsDropmarkerWidgetAccessible::GetActionName(PRUint8 aIndex,
|
||||
if (aIndex != eAction_Click)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
bool isOpen = false;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
@ -146,7 +146,7 @@ nsXFormsComboboxPopupWidgetAccessible::NativeState()
|
||||
{
|
||||
PRUint64 state = nsXFormsAccessible::NativeState();
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
bool isOpen = false;
|
||||
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, state);
|
||||
|
@ -47,7 +47,7 @@
|
||||
NS_IMPL_ISUPPORTS1(nsAccEvent, nsIAccessibleEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccEvent::GetIsFromUserInput(PRBool* aIsFromUserInput)
|
||||
nsAccEvent::GetIsFromUserInput(bool* aIsFromUserInput)
|
||||
{
|
||||
*aIsFromUserInput = mEvent->IsFromUserInput();
|
||||
return NS_OK;
|
||||
@ -114,7 +114,7 @@ nsAccStateChangeEvent::GetState(PRUint32* aState)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsExtraState(PRBool* aIsExtraState)
|
||||
nsAccStateChangeEvent::IsExtraState(bool* aIsExtraState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsExtraState);
|
||||
|
||||
@ -127,7 +127,7 @@ nsAccStateChangeEvent::IsExtraState(PRBool* aIsExtraState)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccStateChangeEvent::IsEnabled(PRBool* aIsEnabled)
|
||||
nsAccStateChangeEvent::IsEnabled(bool* aIsEnabled)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsEnabled);
|
||||
*aIsEnabled = static_cast<AccStateChangeEvent*>(mEvent.get())->IsStateEnabled();
|
||||
@ -158,7 +158,7 @@ nsAccTextChangeEvent::GetLength(PRUint32* aLength)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccTextChangeEvent::IsInserted(PRBool* aIsInserted)
|
||||
nsAccTextChangeEvent::IsInserted(bool* aIsInserted)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsInserted);
|
||||
*aIsInserted = static_cast<AccTextChangeEvent*>(mEvent.get())->IsTextInserted();
|
||||
|
@ -72,4 +72,6 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../base \
|
||||
-I$(srcdir)/../html \
|
||||
-I$(srcdir)/../../../layout/generic \
|
||||
-I$(srcdir)/../../../layout/xul/base/src \
|
||||
$(NULL)
|
||||
|
@ -73,3 +73,21 @@ nsXULAlertAccessible::GetName(nsAString& aName)
|
||||
aName.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Widgets
|
||||
|
||||
bool
|
||||
nsXULAlertAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsXULAlertAccessible::ContainerWidget() const
|
||||
{
|
||||
// If a part of colorpicker widget.
|
||||
if (mParent && mParent->IsMenuButton())
|
||||
return mParent;
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -57,6 +57,10 @@ public:
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "nsDocAccessible.h"
|
||||
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsMenuPopupFrame.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
@ -85,27 +86,30 @@ nsXULColorPickerTileAccessible::NativeRole()
|
||||
PRUint64
|
||||
nsXULColorPickerTileAccessible::NativeState()
|
||||
{
|
||||
// Possible states: focused, focusable, selected.
|
||||
PRUint64 state = nsAccessibleWrap::NativeState();
|
||||
if (!(state & states::UNAVAILABLE))
|
||||
state |= states::FOCUSABLE | states::SELECTABLE;
|
||||
|
||||
// get focus and disable status from base class
|
||||
PRUint64 states = nsAccessibleWrap::NativeState();
|
||||
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::selected))
|
||||
state |= states::SELECTED;
|
||||
|
||||
states |= states::FOCUSABLE;
|
||||
|
||||
// Focused?
|
||||
PRBool isFocused = mContent->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::hover);
|
||||
if (isFocused)
|
||||
states |= states::FOCUSED;
|
||||
|
||||
PRBool isSelected = mContent->HasAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::selected);
|
||||
if (isSelected)
|
||||
states |= states::SELECTED;
|
||||
|
||||
return states;
|
||||
return state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULColorPickerTileAccessible: Widgets
|
||||
|
||||
nsAccessible*
|
||||
nsXULColorPickerTileAccessible::ContainerWidget() const
|
||||
{
|
||||
nsAccessible* parent = Parent();
|
||||
if (parent) {
|
||||
nsAccessible* grandParent = parent->Parent();
|
||||
if (grandParent && grandParent->IsMenuButton())
|
||||
return grandParent;
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULColorPickerAccessible
|
||||
@ -115,6 +119,7 @@ nsXULColorPickerAccessible::
|
||||
nsXULColorPickerAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXULColorPickerTileAccessible(aContent, aShell)
|
||||
{
|
||||
mFlags |= eMenuButtonAccessible;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -139,6 +144,32 @@ nsXULColorPickerAccessible::NativeRole()
|
||||
return nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULColorPickerAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsXULColorPickerAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULColorPickerAccessible::IsActiveWidget() const
|
||||
{
|
||||
return FocusMgr()->HasDOMFocus(mContent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULColorPickerAccessible::AreItemsOperable() const
|
||||
{
|
||||
nsAccessible* menuPopup = mChildren.SafeElementAt(0, nsnull);
|
||||
if (menuPopup) {
|
||||
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(menuPopup->GetFrame());
|
||||
return menuPopupFrame && menuPopupFrame->IsOpen();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULColorPickerAccessible: protected nsAccessible
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
#ifndef _nsXULColorPickerAccessible_H_
|
||||
#define _nsXULColorPickerAccessible_H_
|
||||
|
||||
// NOTE: alphabetically ordered
|
||||
#include "nsAccessibleWrap.h"
|
||||
|
||||
/**
|
||||
@ -57,6 +56,9 @@ public:
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// Widgets
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
};
|
||||
|
||||
|
||||
@ -72,6 +74,11 @@ public:
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
virtual bool IsActiveWidget() const;
|
||||
virtual bool AreItemsOperable() const;
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsCoreUtils.h"
|
||||
|
||||
#include "nsIAutoCompleteInput.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
|
||||
@ -57,13 +58,17 @@ nsXULComboboxAccessible::
|
||||
nsXULComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::autocomplete, eIgnoreCase))
|
||||
mFlags |= eAutoCompleteAccessible;
|
||||
else
|
||||
mFlags |= eComboboxAccessible;
|
||||
}
|
||||
|
||||
PRUint32
|
||||
nsXULComboboxAccessible::NativeRole()
|
||||
{
|
||||
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::autocomplete, eIgnoreCase))
|
||||
if (IsAutoComplete())
|
||||
return nsIAccessibleRole::ROLE_AUTOCOMPLETE;
|
||||
return nsIAccessibleRole::ROLE_COMBOBOX;
|
||||
}
|
||||
@ -83,7 +88,7 @@ nsXULComboboxAccessible::NativeState()
|
||||
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
|
||||
if (menuList) {
|
||||
PRBool isOpen;
|
||||
bool isOpen;
|
||||
menuList->GetOpen(&isOpen);
|
||||
if (isOpen) {
|
||||
states |= states::EXPANDED;
|
||||
@ -135,7 +140,7 @@ nsXULComboboxAccessible::Description(nsString& aDescription)
|
||||
}
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXULComboboxAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
if (mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) ||
|
||||
@ -173,7 +178,7 @@ nsXULComboboxAccessible::DoAction(PRUint8 aIndex)
|
||||
if (!menuList) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRBool isDroppedDown;
|
||||
bool isDroppedDown;
|
||||
menuList->GetOpen(&isDroppedDown);
|
||||
return menuList->SetOpen(!isDroppedDown);
|
||||
}
|
||||
@ -197,7 +202,7 @@ nsXULComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
if (!menuList) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
PRBool isDroppedDown;
|
||||
bool isDroppedDown;
|
||||
menuList->GetOpen(&isDroppedDown);
|
||||
if (isDroppedDown)
|
||||
aName.AssignLiteral("close");
|
||||
@ -206,3 +211,48 @@ nsXULComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Widgets
|
||||
|
||||
bool
|
||||
nsXULComboboxAccessible::IsActiveWidget() const
|
||||
{
|
||||
if (IsAutoComplete() ||
|
||||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
|
||||
nsGkAtoms::_true, eIgnoreCase)) {
|
||||
PRInt32 childCount = mChildren.Length();
|
||||
for (PRInt32 idx = 0; idx < childCount; idx++) {
|
||||
nsAccessible* child = mChildren[idx];
|
||||
if (child->Role() == nsIAccessibleRole::ROLE_ENTRY)
|
||||
return FocusMgr()->HasDOMFocus(child->GetContent());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return FocusMgr()->HasDOMFocus(mContent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULComboboxAccessible::AreItemsOperable() const
|
||||
{
|
||||
if (IsAutoComplete()) {
|
||||
nsCOMPtr<nsIAutoCompleteInput> autoCompleteInputElm =
|
||||
do_QueryInterface(mContent);
|
||||
if (autoCompleteInputElm) {
|
||||
bool isOpen = false;
|
||||
autoCompleteInputElm->GetPopupOpen(&isOpen);
|
||||
return isOpen;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menuListElm = do_QueryInterface(mContent);
|
||||
if (menuListElm) {
|
||||
bool isOpen = false;
|
||||
menuListElm->GetOpen(&isOpen);
|
||||
return isOpen;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -40,7 +40,6 @@
|
||||
#ifndef __nsXULComboboxAccessible_h__
|
||||
#define __nsXULComboboxAccessible_h__
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXULMenuAccessible.h"
|
||||
|
||||
/**
|
||||
@ -62,10 +61,14 @@ public:
|
||||
virtual void Description(nsString& aDescription);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsActiveWidget() const;
|
||||
virtual bool AreItemsOperable() const;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -61,6 +61,7 @@
|
||||
#include "nsIFrame.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsMenuPopupFrame.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
@ -72,6 +73,8 @@ nsXULButtonAccessible::
|
||||
nsXULButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsAccessibleWrap(aContent, aShell)
|
||||
{
|
||||
if (ContainsMenu())
|
||||
mFlags |= eMenuButtonAccessible;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -125,7 +128,7 @@ nsXULButtonAccessible::NativeState()
|
||||
// get focus and disable status from base class
|
||||
PRUint64 state = nsAccessible::NativeState();
|
||||
|
||||
PRBool disabled = PR_FALSE;
|
||||
bool disabled = false;
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulFormElement(do_QueryInterface(mContent));
|
||||
if (xulFormElement) {
|
||||
xulFormElement->GetDisabled(&disabled);
|
||||
@ -142,7 +145,7 @@ nsXULButtonAccessible::NativeState()
|
||||
xulButtonElement->GetType(type);
|
||||
if (type.EqualsLiteral("checkbox") || type.EqualsLiteral("radio")) {
|
||||
state |= states::CHECKABLE;
|
||||
PRBool checked = PR_FALSE;
|
||||
bool checked = false;
|
||||
PRInt32 checkState = 0;
|
||||
xulButtonElement->GetChecked(&checked);
|
||||
if (checked) {
|
||||
@ -164,6 +167,42 @@ nsXULButtonAccessible::NativeState()
|
||||
return state;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULButtonAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsXULButtonAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULButtonAccessible::IsActiveWidget() const
|
||||
{
|
||||
return FocusMgr()->HasDOMFocus(mContent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULButtonAccessible::AreItemsOperable() const
|
||||
{
|
||||
if (IsMenuButton()) {
|
||||
nsAccessible* menuPopup = mChildren.SafeElementAt(0, nsnull);
|
||||
if (menuPopup) {
|
||||
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(menuPopup->GetFrame());
|
||||
return menuPopupFrame->IsOpen();
|
||||
}
|
||||
}
|
||||
return false; // no items
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsXULButtonAccessible::ContainerWidget() const
|
||||
{
|
||||
if (IsMenuButton() && mParent && mParent->IsAutoComplete())
|
||||
return mParent;
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULButtonAccessible: nsAccessible protected
|
||||
|
||||
@ -176,12 +215,12 @@ nsXULButtonAccessible::CacheChildren()
|
||||
|
||||
// XXX: no children until the button is menu button. Probably it's not
|
||||
// totally correct but in general AT wants to have leaf buttons.
|
||||
PRBool isMenu = mContent->AttrValueIs(kNameSpaceID_None,
|
||||
bool isMenu = mContent->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::type,
|
||||
nsGkAtoms::menu,
|
||||
eCaseMatters);
|
||||
|
||||
PRBool isMenuButton = isMenu ?
|
||||
bool isMenuButton = isMenu ?
|
||||
PR_FALSE :
|
||||
mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::menuButton, eCaseMatters);
|
||||
@ -225,7 +264,7 @@ nsXULButtonAccessible::CacheChildren()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULButtonAccessible protected
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXULButtonAccessible::ContainsMenu()
|
||||
{
|
||||
static nsIContent::AttrValuesArray strings[] =
|
||||
@ -252,9 +291,9 @@ nsXULDropmarkerAccessible::ActionCount()
|
||||
return 1;
|
||||
}
|
||||
|
||||
PRBool nsXULDropmarkerAccessible::DropmarkerOpen(PRBool aToggleOpen)
|
||||
bool nsXULDropmarkerAccessible::DropmarkerOpen(bool aToggleOpen)
|
||||
{
|
||||
PRBool isOpen = PR_FALSE;
|
||||
bool isOpen = false;
|
||||
|
||||
nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement =
|
||||
do_QueryInterface(mContent->GetParent());
|
||||
@ -383,7 +422,7 @@ nsXULCheckboxAccessible::NativeState()
|
||||
nsCOMPtr<nsIDOMXULCheckboxElement> xulCheckboxElement =
|
||||
do_QueryInterface(mContent);
|
||||
if (xulCheckboxElement) {
|
||||
PRBool checked = PR_FALSE;
|
||||
bool checked = false;
|
||||
xulCheckboxElement->GetChecked(&checked);
|
||||
if (checked) {
|
||||
state |= states::CHECKED;
|
||||
@ -464,19 +503,19 @@ nsXULRadioButtonAccessible::
|
||||
{
|
||||
}
|
||||
|
||||
/** We are Focusable and can be Checked and focused */
|
||||
PRUint64
|
||||
nsXULRadioButtonAccessible::NativeState()
|
||||
{
|
||||
PRUint64 state = nsFormControlAccessible::NativeState();
|
||||
|
||||
state |= states::CHECKABLE;
|
||||
|
||||
PRBool selected = PR_FALSE; // Radio buttons can be selected
|
||||
|
||||
if (!(state & states::UNAVAILABLE))
|
||||
state |= states::FOCUSABLE;
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> radioButton =
|
||||
do_QueryInterface(mContent);
|
||||
if (radioButton) {
|
||||
bool selected = false; // Radio buttons can be selected
|
||||
radioButton->GetSelected(&selected);
|
||||
if (selected) {
|
||||
state |= states::CHECKED;
|
||||
@ -494,6 +533,15 @@ nsXULRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULRadioButtonAccessible: Widgets
|
||||
|
||||
nsAccessible*
|
||||
nsXULRadioButtonAccessible::ContainerWidget() const
|
||||
{
|
||||
return mParent;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULRadioGroupAccessible
|
||||
@ -529,7 +577,28 @@ nsXULRadioGroupAccessible::NativeState()
|
||||
return nsAccessible::NativeState() & ~(states::FOCUSABLE | states::FOCUSED);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULRadioGroupAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsXULRadioGroupAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULRadioGroupAccessible::IsActiveWidget() const
|
||||
{
|
||||
return FocusMgr()->HasDOMFocus(mContent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULRadioGroupAccessible::AreItemsOperable() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULStatusBarAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -589,7 +658,7 @@ nsXULToolbarButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
*aSetSize = setSize;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXULToolbarButtonAccessible::IsSeparator(nsAccessible *aAccessible)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> domNode;
|
||||
@ -719,9 +788,6 @@ nsXULTextFieldAccessible::NativeState()
|
||||
|
||||
state |= tempAccessible->NativeState();
|
||||
|
||||
if (gLastFocusedNode == mContent)
|
||||
state |= states::FOCUSED;
|
||||
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
|
||||
if (menuList) {
|
||||
// <xul:menulist droppable="false">
|
||||
@ -782,7 +848,7 @@ NS_IMETHODIMP nsXULTextFieldAccessible::DoAction(PRUint8 index)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXULTextFieldAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
return PR_FALSE;
|
||||
|
@ -77,13 +77,19 @@ public:
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
virtual bool IsActiveWidget() const;
|
||||
virtual bool AreItemsOperable() const;
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
|
||||
protected:
|
||||
|
||||
// nsAccessible
|
||||
virtual void CacheChildren();
|
||||
|
||||
// nsXULButtonAccessible
|
||||
PRBool ContainsMenu();
|
||||
bool ContainsMenu();
|
||||
};
|
||||
|
||||
|
||||
@ -129,7 +135,7 @@ public:
|
||||
virtual PRUint8 ActionCount();
|
||||
|
||||
private:
|
||||
PRBool DropmarkerOpen(PRBool aToggleOpen);
|
||||
bool DropmarkerOpen(bool aToggleOpen);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -159,6 +165,9 @@ public:
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// Widgets
|
||||
virtual nsAccessible* ContainerWidget() const;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -172,6 +181,11 @@ public:
|
||||
// nsAccessible
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
virtual bool IsActiveWidget() const;
|
||||
virtual bool AreItemsOperable() const;
|
||||
};
|
||||
|
||||
/**
|
||||
@ -199,7 +213,7 @@ public:
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
// nsXULToolbarButtonAccessible
|
||||
static PRBool IsSeparator(nsAccessible *aAccessible);
|
||||
static bool IsSeparator(nsAccessible *aAccessible);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -253,7 +267,7 @@ public:
|
||||
virtual void ApplyARIAState(PRUint64* aState);
|
||||
virtual PRUint32 NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRBool GetAllowsAnonChildAccessibles();
|
||||
virtual bool GetAllowsAnonChildAccessibles();
|
||||
|
||||
// ActionAccessible
|
||||
virtual PRUint8 ActionCount();
|
||||
|
@ -44,11 +44,14 @@
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIAutoCompleteInput.h"
|
||||
#include "nsIAutoCompletePopup.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
@ -131,6 +134,13 @@ nsXULListboxAccessible::
|
||||
nsXULListboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
|
||||
nsXULSelectableAccessible(aContent, aShell)
|
||||
{
|
||||
nsIContent* parentContent = mContent->GetParent();
|
||||
if (parentContent) {
|
||||
nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
|
||||
do_QueryInterface(parentContent);
|
||||
if (autoCompletePopupElm)
|
||||
mFlags |= eAutoCompletePopupAccessible;
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsXULListboxAccessible, nsXULSelectableAccessible)
|
||||
@ -152,7 +162,7 @@ nsXULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXULListboxAccessible::IsMulticolumn()
|
||||
{
|
||||
PRInt32 numColumns = 0;
|
||||
@ -430,7 +440,7 @@ nsXULListboxAccessible::GetRowDescription(PRInt32 aRow, nsAString& aDescription)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListboxAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
||||
nsXULListboxAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -456,7 +466,7 @@ nsXULListboxAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListboxAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
||||
nsXULListboxAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
@ -478,7 +488,7 @@ nsXULListboxAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListboxAccessible::IsCellSelected(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
||||
PRBool *aIsSelected)
|
||||
bool *aIsSelected)
|
||||
{
|
||||
return IsRowSelected(aRowIndex, aIsSelected);
|
||||
}
|
||||
@ -817,7 +827,7 @@ nsXULListboxAccessible::UnselectColumn(PRInt32 aColumn)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListboxAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
nsXULListboxAccessible::IsProbablyForLayout(bool *aIsProbablyForLayout)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsProbablyForLayout);
|
||||
*aIsProbablyForLayout = PR_FALSE;
|
||||
@ -825,6 +835,72 @@ nsXULListboxAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULListboxAccessible: Widgets
|
||||
|
||||
bool
|
||||
nsXULListboxAccessible::IsWidget() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULListboxAccessible::IsActiveWidget() const
|
||||
{
|
||||
if (IsAutoCompletePopup()) {
|
||||
nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
|
||||
do_QueryInterface(mContent->GetParent());
|
||||
|
||||
if (autoCompletePopupElm) {
|
||||
bool isOpen = false;
|
||||
autoCompletePopupElm->GetPopupOpen(&isOpen);
|
||||
return isOpen;
|
||||
}
|
||||
}
|
||||
return FocusMgr()->HasDOMFocus(mContent);
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULListboxAccessible::AreItemsOperable() const
|
||||
{
|
||||
if (IsAutoCompletePopup()) {
|
||||
nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
|
||||
do_QueryInterface(mContent->GetParent());
|
||||
|
||||
if (autoCompletePopupElm) {
|
||||
bool isOpen = false;
|
||||
autoCompletePopupElm->GetPopupOpen(&isOpen);
|
||||
return isOpen;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsXULListboxAccessible::ContainerWidget() const
|
||||
{
|
||||
if (IsAutoCompletePopup()) {
|
||||
// This works for XUL autocompletes. It doesn't work for HTML forms
|
||||
// autocomplete because of potential crossprocess calls (when autocomplete
|
||||
// lives in content process while popup lives in chrome process). If that's
|
||||
// a problem then rethink Widgets interface.
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menuListElm =
|
||||
do_QueryInterface(mContent->GetParent());
|
||||
if (menuListElm) {
|
||||
nsCOMPtr<nsIDOMNode> inputElm;
|
||||
menuListElm->GetInputField(getter_AddRefs(inputElm));
|
||||
if (inputElm) {
|
||||
nsCOMPtr<nsINode> inputNode = do_QueryInterface(inputElm);
|
||||
if (inputNode) {
|
||||
nsAccessible* input = GetAccService()->GetAccessible(inputNode);
|
||||
return input ? input->ContainerWidget() : nsnull;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULListitemAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -925,14 +1001,13 @@ nsXULListitemAccessible::NativeState()
|
||||
do_QueryInterface(mContent);
|
||||
|
||||
if (listItem) {
|
||||
PRBool isSelected;
|
||||
bool isSelected;
|
||||
listItem->GetSelected(&isSelected);
|
||||
if (isSelected)
|
||||
states |= states::SELECTED;
|
||||
|
||||
if (gLastFocusedNode == mContent)
|
||||
if (FocusMgr()->IsFocused(this))
|
||||
states |= states::FOCUSED;
|
||||
|
||||
}
|
||||
|
||||
return states;
|
||||
@ -954,7 +1029,7 @@ NS_IMETHODIMP nsXULListitemAccessible::GetActionName(PRUint8 aIndex, nsAString&
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
PRBool
|
||||
bool
|
||||
nsXULListitemAccessible::GetAllowsAnonChildAccessibles()
|
||||
{
|
||||
// That indicates we should walk anonymous children for listitems
|
||||
@ -969,6 +1044,15 @@ nsXULListitemAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULListitemAccessible: Widgets
|
||||
|
||||
nsAccessible*
|
||||
nsXULListitemAccessible::ContainerWidget() const
|
||||
{
|
||||
return Parent();
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULListCellAccessible
|
||||
@ -1164,7 +1248,7 @@ nsXULListCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULListCellAccessible::IsSelected(PRBool *aIsSelected)
|
||||
nsXULListCellAccessible::IsSelected(bool *aIsSelected)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsSelected);
|
||||
*aIsSelected = PR_FALSE;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user