mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
2eb290e0d3
- Bug 1197954 - Extract GLXFBConfig selection code for X11 windows. r=lsalzman (2816a11bdd)
- Bug 1261439 - replace nsAccUtils::IsEmbeddedObject on a bit flag check, r=marcoz (16319b9295)
- bug 1262563 - add IsFromUserInput to show / hide event messages r=davidb (dc96903cfa)
- bug 1262563 - fire show / hide events for proxied accessibles r=davidb (9b1deb77c9)
- bug 1255009 - make AccShowEvent store the insertion index of the new child r=davidb (5b3d984446)
- bug 1261144 - remove filters::GetEmbeddedObj() because it is unused r=lsocks (837bb1777c)
- bug 1261144 - devirtualize AppendObject() because the base class impl is never called r=lsocks (a8fe470965)
- bug 1261144 - move Count() from AccCollector to EmbeddedObjCollector r=lsocks (11d9734561)
- bug 1261144 - move GetAccessibleAt to EmbeddedObjCollector r=lsocks (6ac2731ec1)
- bug 1261144 - devirtualize GetIndexAt() because the base class version is never called r=lsocks (54cc48712e)
- bug 1261144 - move EnsureNGetObject to EmbeddedObjCollector r=lsocks (225b123fb0)
- bug 1261144 - move EnsureNGetIndex() to EmbeddedObjCollector r=lsocks (81986c9a95)
- bug 1261144 - move the data members of AccCollector to EmbeddedObjCollector r=lsocks (5ba20f1c30)
- bug 1261144 - remove the AccCollector class r=lsocks (6f52909c58)
- bug 1261144 - use filters::GetEmbeddedObject() directly in EmbeddedObjCollector r=lsocks (cb86410837)
- bug 1261144 - devirtualize the dtor of EmbeddedObjCollector r=lsocks (b3d23cf341)
- Bug 1261144 - stop including Filters.h in EmbeddedObjCollector.h r=lsocks (2940a4dc3d)
- bug 1261144 - call Accessible::IsText() directly from EmbeddedObjCollector r=lsocks (b93a86aa2a)
- bug 1262233 - stop using a sync message to implement ProxyAccessible::EmbeddedChildCount() r=lsocks (e2d3b6d608)
- bug 1262233 - stop implementing ProxyAccessible::IndexOfEmbeddedChild() with a sync message r=lsocks (dcedecd9d4)
- bug 1262233 - add ProxyAccessible::IsEmbeddedObject() r=lsocks (084915a784)
- bug 1262233 - stop implementing ProxyAccessible::EmbeddedChildAt() with a sync message r=lsocks (2924d04c4a)
- bug 1241453 - fire nsIAccessibleStateChangeEvents for proxied accessibles r=davidb (e423829903)
- bug 1241453 - fire nsIAccessibleEvents for proxied accessibles r=davidb (6a02c2f8a3)
- bug 1241453 - fire nsIAccessibleCaretMoveEvents for proxies r=davidb (4fb1f5be4f)
- bug 1241453 - fire nsIAccessibleTextChangeEvents for proxies r=davidb (c53a5b5122)
- Bug 1264526 - process ARIA owns relocations for in-the-document accessibles only, r=yzen (e19887eee4)
- Bug 1261174 - more events logging, r=yzen (14b83c693d)
- Bug 1257350 - Use intptr_t to avoid C4312 on VS2015; r=tbsaunde (1fc3ee9b6d)
- bug 1250882 - make xpcAccessible::GetAttributes() work with proxied accessibles r=davidb (fa676531c2)
- bug 1210741 - make AccessibleWrap::get_accLocation work with proxied accessibles r=davidb (6600987ec8)
- bug 1219528 - make NAVDIR_{FIRST,LAST}CHILD and NAVDIR_{NEXT,PREVIOUS} cases of AccessibleWrap::accNavigate deal with proxies r=davidb (c011ebcd2b)
- bug 1219528 - make AccessibleWrap::accNavigate cases using relations work with proxies r=davidb (de20c76bcc)
- bug 1215657 - make AccessibleWrap::accHitTest() work with proxies r=davidb (25da22a733)
- bug 1215657 - make AccessibleWrap::accDoDefaultAction work with proxies r=davidb (029d34d135)
- bug 1208779 - null check aAccessible in GetChildIDFor() for 32 bit as well as 64 bit windows r=davidb (08319d45e7)
- bug 1207862 - refactor GetXPAccessibleFor() so proxies and non proxies are handle in the same place for each type of id r=davidb (3ff1646e02)
- bug 1207862 - make AccessibleWrap::GetXPAccessibleFor() return the AccessibleWrap for proxies r=davidb (1184a0efeb)
- bug 1218564 - remove check for password roles in AccessibleWrap::get_accValue r=surkov (477e0bb92b)
- bug 1219528 - don't bail out of AccessibleWrap::accNavigate if the accessible wraps a proxy r=davidb (9540866b5b)
- Bug 1257303 - Cast to intptr_t to avoid C4312 on VS2015; r=tbsaunde (93af27e0db)
- Bug 1210549 - Fix AccessibleWrap::GetXPAccessibleFor for proxied accessibles r=tbsaunde (b4ed017706)
256 lines
10 KiB
C++
256 lines
10 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "AccEvent.h"
|
|
|
|
#include "nsAccUtils.h"
|
|
#include "DocAccessible.h"
|
|
#include "xpcAccEvents.h"
|
|
#include "States.h"
|
|
#include "xpcAccessibleDocument.h"
|
|
|
|
#include "mozilla/EventStateManager.h"
|
|
#include "mozilla/dom/Selection.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::a11y;
|
|
|
|
static_assert(static_cast<bool>(eNoUserInput) == false &&
|
|
static_cast<bool>(eFromUserInput) == true,
|
|
"EIsFromUserInput cannot be casted to bool");
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccEvent constructors
|
|
|
|
AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
|
EIsFromUserInput aIsFromUserInput, EEventRule aEventRule) :
|
|
mEventType(aEventType), mEventRule(aEventRule), mAccessible(aAccessible)
|
|
{
|
|
if (aIsFromUserInput == eAutoDetect)
|
|
mIsFromUserInput = EventStateManager::IsHandlingUserInput();
|
|
else
|
|
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccEvent cycle collection
|
|
|
|
NS_IMPL_CYCLE_COLLECTION(AccEvent, mAccessible)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccTextChangeEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Note: we pass in eAllowDupes to the base class because we don't support text
|
|
// events coalescence. We fire delayed text change events in DocAccessible but
|
|
// we continue to base the event off the accessible object rather than just the
|
|
// node. This means we won't try to create an accessible based on the node when
|
|
// we are ready to fire the event and so we will no longer assert at that point
|
|
// if the node was removed from the document. Either way, the AT won't work with
|
|
// a defunct accessible so the behaviour should be equivalent.
|
|
AccTextChangeEvent::
|
|
AccTextChangeEvent(Accessible* aAccessible, int32_t aStart,
|
|
const nsAString& aModifiedText, bool aIsInserted,
|
|
EIsFromUserInput aIsFromUserInput)
|
|
: AccEvent(aIsInserted ?
|
|
static_cast<uint32_t>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
|
|
static_cast<uint32_t>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
|
|
aAccessible, aIsFromUserInput, eAllowDupes)
|
|
, mStart(aStart)
|
|
, mIsInserted(aIsInserted)
|
|
, mModifiedText(aModifiedText)
|
|
{
|
|
// XXX We should use IsFromUserInput here, but that isn't always correct
|
|
// when the text change isn't related to content insertion or removal.
|
|
mIsFromUserInput = mAccessible->State() &
|
|
(states::FOCUSED | states::EDITABLE);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccHideEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
AccHideEvent::
|
|
AccHideEvent(Accessible* aTarget, bool aNeedsShutdown) :
|
|
AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget),
|
|
mNeedsShutdown(aNeedsShutdown)
|
|
{
|
|
mNextSibling = mAccessible->NextSibling();
|
|
mPrevSibling = mAccessible->PrevSibling();
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccShowEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
AccShowEvent::
|
|
AccShowEvent(Accessible* aTarget) :
|
|
AccMutationEvent(::nsIAccessibleEvent::EVENT_SHOW, aTarget)
|
|
{
|
|
int32_t idx = aTarget->IndexInParent();
|
|
MOZ_ASSERT(idx >= 0);
|
|
mInsertionIndex = idx;
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccTextSelChangeEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
AccTextSelChangeEvent::AccTextSelChangeEvent(HyperTextAccessible* aTarget,
|
|
dom::Selection* aSelection,
|
|
int32_t aReason) :
|
|
AccEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED, aTarget,
|
|
eAutoDetect, eCoalesceTextSelChange),
|
|
mSel(aSelection), mReason(aReason) {}
|
|
|
|
AccTextSelChangeEvent::~AccTextSelChangeEvent() { }
|
|
|
|
bool
|
|
AccTextSelChangeEvent::IsCaretMoveOnly() const
|
|
{
|
|
return mSel->RangeCount() == 1 && mSel->IsCollapsed() &&
|
|
((mReason & (nsISelectionListener::COLLAPSETOSTART_REASON |
|
|
nsISelectionListener::COLLAPSETOEND_REASON)) == 0);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccSelChangeEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
AccSelChangeEvent::
|
|
AccSelChangeEvent(Accessible* aWidget, Accessible* aItem,
|
|
SelChangeType aSelChangeType) :
|
|
AccEvent(0, aItem, eAutoDetect, eCoalesceSelectionChange),
|
|
mWidget(aWidget), mItem(aItem), mSelChangeType(aSelChangeType),
|
|
mPreceedingCount(0), mPackedEvent(nullptr)
|
|
{
|
|
if (aSelChangeType == eSelectionAdd) {
|
|
if (mWidget->GetSelectedItem(1))
|
|
mEventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
|
|
else
|
|
mEventType = nsIAccessibleEvent::EVENT_SELECTION;
|
|
} else {
|
|
mEventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
|
|
}
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccTableChangeEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
AccTableChangeEvent::
|
|
AccTableChangeEvent(Accessible* aAccessible, uint32_t aEventType,
|
|
int32_t aRowOrColIndex, int32_t aNumRowsOrCols) :
|
|
AccEvent(aEventType, aAccessible),
|
|
mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols)
|
|
{
|
|
}
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AccVCChangeEvent
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
AccVCChangeEvent::
|
|
AccVCChangeEvent(Accessible* aAccessible,
|
|
Accessible* aOldAccessible,
|
|
int32_t aOldStart, int32_t aOldEnd,
|
|
int16_t aReason, EIsFromUserInput aIsFromUserInput) :
|
|
AccEvent(::nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, aAccessible,
|
|
aIsFromUserInput),
|
|
mOldAccessible(aOldAccessible), mOldStart(aOldStart), mOldEnd(aOldEnd),
|
|
mReason(aReason)
|
|
{
|
|
}
|
|
|
|
already_AddRefed<nsIAccessibleEvent>
|
|
a11y::MakeXPCEvent(AccEvent* aEvent)
|
|
{
|
|
DocAccessible* doc = aEvent->GetDocAccessible();
|
|
Accessible* acc = aEvent->GetAccessible();
|
|
nsINode* node = acc->GetNode();
|
|
nsIDOMNode* domNode = node ? node->AsDOMNode() : nullptr;
|
|
bool fromUser = aEvent->IsFromUserInput();
|
|
uint32_t type = aEvent->GetEventType();
|
|
uint32_t eventGroup = aEvent->GetEventGroups();
|
|
nsCOMPtr<nsIAccessibleEvent> xpEvent;
|
|
|
|
if (eventGroup & (1 << AccEvent::eStateChangeEvent)) {
|
|
AccStateChangeEvent* sc = downcast_accEvent(aEvent);
|
|
bool extra = false;
|
|
uint32_t state = nsAccUtils::To32States(sc->GetState(), &extra);
|
|
xpEvent = new xpcAccStateChangeEvent(type, ToXPC(acc), ToXPCDocument(doc),
|
|
domNode, fromUser,
|
|
state, extra, sc->IsStateEnabled());
|
|
return xpEvent.forget();
|
|
}
|
|
|
|
if (eventGroup & (1 << AccEvent::eTextChangeEvent)) {
|
|
AccTextChangeEvent* tc = downcast_accEvent(aEvent);
|
|
nsString text;
|
|
tc->GetModifiedText(text);
|
|
xpEvent = new xpcAccTextChangeEvent(type, ToXPC(acc), ToXPCDocument(doc),
|
|
domNode, fromUser,
|
|
tc->GetStartOffset(), tc->GetLength(),
|
|
tc->IsTextInserted(), text);
|
|
return xpEvent.forget();
|
|
}
|
|
|
|
if (eventGroup & (1 << AccEvent::eHideEvent)) {
|
|
AccHideEvent* hideEvent = downcast_accEvent(aEvent);
|
|
xpEvent = new xpcAccHideEvent(type, ToXPC(acc), ToXPCDocument(doc),
|
|
domNode, fromUser,
|
|
ToXPC(hideEvent->TargetParent()),
|
|
ToXPC(hideEvent->TargetNextSibling()),
|
|
ToXPC(hideEvent->TargetPrevSibling()));
|
|
return xpEvent.forget();
|
|
}
|
|
|
|
if (eventGroup & (1 << AccEvent::eCaretMoveEvent)) {
|
|
AccCaretMoveEvent* cm = downcast_accEvent(aEvent);
|
|
xpEvent = new xpcAccCaretMoveEvent(type, ToXPC(acc), ToXPCDocument(doc),
|
|
domNode, fromUser,
|
|
cm->GetCaretOffset());
|
|
return xpEvent.forget();
|
|
}
|
|
|
|
if (eventGroup & (1 << AccEvent::eVirtualCursorChangeEvent)) {
|
|
AccVCChangeEvent* vcc = downcast_accEvent(aEvent);
|
|
xpEvent = new xpcAccVirtualCursorChangeEvent(type,
|
|
ToXPC(acc), ToXPCDocument(doc),
|
|
domNode, fromUser,
|
|
ToXPC(vcc->OldAccessible()),
|
|
vcc->OldStartOffset(),
|
|
vcc->OldEndOffset(),
|
|
vcc->Reason());
|
|
return xpEvent.forget();
|
|
}
|
|
|
|
if (eventGroup & (1 << AccEvent::eObjectAttrChangedEvent)) {
|
|
AccObjectAttrChangedEvent* oac = downcast_accEvent(aEvent);
|
|
xpEvent = new xpcAccObjectAttributeChangedEvent(type,
|
|
ToXPC(acc),
|
|
ToXPCDocument(doc), domNode,
|
|
fromUser,
|
|
oac->GetAttribute());
|
|
return xpEvent.forget();
|
|
}
|
|
|
|
xpEvent = new xpcAccEvent(type, ToXPC(acc), ToXPCDocument(doc), domNode, fromUser);
|
|
return xpEvent.forget();
|
|
}
|