2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** 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
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2003
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
2010-08-24 19:08:28 -07:00
|
|
|
* Aaron Leventhal <aaronl@netscape.com> <original author>
|
|
|
|
* Alexander Surkov <surkov.alexander@gmail.com>
|
2007-03-22 10:30:00 -07:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of 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 ***** */
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
#include "AccEvent.h"
|
2010-03-17 00:10:52 -07:00
|
|
|
|
2010-04-26 23:52:03 -07:00
|
|
|
#include "nsAccessibilityService.h"
|
|
|
|
#include "nsAccUtils.h"
|
2009-08-21 05:33:31 -07:00
|
|
|
#include "nsApplicationAccessibleWrap.h"
|
2010-03-17 00:10:52 -07:00
|
|
|
#include "nsDocAccessible.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
#include "nsIAccessibleText.h"
|
|
|
|
#ifdef MOZ_XUL
|
|
|
|
#include "nsXULTreeAccessible.h"
|
|
|
|
#endif
|
2010-08-24 19:08:28 -07:00
|
|
|
#include "nsAccEvent.h"
|
2010-03-17 00:10:52 -07:00
|
|
|
|
2007-08-10 18:44:44 -07:00
|
|
|
#include "nsIDOMDocument.h"
|
2011-04-21 10:35:52 -07:00
|
|
|
#include "nsEventStateManager.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIServiceManager.h"
|
2007-07-05 23:53:18 -07:00
|
|
|
#ifdef MOZ_XUL
|
|
|
|
#include "nsIDOMXULMultSelectCntrlEl.h"
|
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccEvent
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2007-08-10 18:44:44 -07:00
|
|
|
|
2008-08-06 05:19:56 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccEvent constructors
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
AccEvent::AccEvent(PRUint32 aEventType, nsAccessible* aAccessible,
|
2010-10-20 21:16:10 -07:00
|
|
|
EIsFromUserInput aIsFromUserInput, EEventRule aEventRule) :
|
|
|
|
mEventType(aEventType), mEventRule(aEventRule), mAccessible(aAccessible)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-01-20 03:16:32 -08:00
|
|
|
CaptureIsFromUserInput(aIsFromUserInput);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
AccEvent::AccEvent(PRUint32 aEventType, nsINode* aNode,
|
2010-10-20 21:16:10 -07:00
|
|
|
EIsFromUserInput aIsFromUserInput, EEventRule aEventRule) :
|
|
|
|
mEventType(aEventType), mEventRule(aEventRule), mNode(aNode)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2010-01-20 03:16:32 -08:00
|
|
|
CaptureIsFromUserInput(aIsFromUserInput);
|
2007-08-10 18:44:44 -07:00
|
|
|
}
|
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccEvent public methods
|
2007-04-16 21:45:42 -07:00
|
|
|
|
2010-06-11 21:04:24 -07:00
|
|
|
nsAccessible *
|
2010-08-24 19:08:28 -07:00
|
|
|
AccEvent::GetAccessible()
|
2010-06-11 21:04:24 -07:00
|
|
|
{
|
|
|
|
if (!mAccessible)
|
|
|
|
mAccessible = GetAccessibleForNode();
|
|
|
|
|
|
|
|
return mAccessible;
|
|
|
|
}
|
|
|
|
|
2010-03-17 00:10:52 -07:00
|
|
|
nsINode*
|
2010-08-24 19:08:28 -07:00
|
|
|
AccEvent::GetNode()
|
2010-03-17 00:10:52 -07:00
|
|
|
{
|
2010-06-11 21:04:24 -07:00
|
|
|
if (!mNode && mAccessible)
|
|
|
|
mNode = mAccessible->GetNode();
|
2007-04-10 09:28:38 -07:00
|
|
|
|
2010-03-17 00:10:52 -07:00
|
|
|
return mNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDocAccessible*
|
2010-08-24 19:08:28 -07:00
|
|
|
AccEvent::GetDocAccessible()
|
2010-03-17 00:10:52 -07:00
|
|
|
{
|
|
|
|
nsINode *node = GetNode();
|
|
|
|
if (node)
|
2011-10-18 03:53:36 -07:00
|
|
|
return GetAccService()->GetDocAccessible(node->OwnerDoc());
|
2010-03-17 00:10:52 -07:00
|
|
|
|
|
|
|
return nsnull;
|
2007-04-10 09:28:38 -07:00
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
already_AddRefed<nsAccEvent>
|
|
|
|
AccEvent::CreateXPCOMObject()
|
|
|
|
{
|
|
|
|
nsAccEvent* event = new nsAccEvent(this);
|
|
|
|
NS_IF_ADDREF(event);
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// AccEvent cycle collection
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(AccEvent)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(AccEvent)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mAccessible)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(AccEvent)
|
|
|
|
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mAccessible");
|
|
|
|
cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mAccessible));
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)
|
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccEvent protected methods
|
2010-01-20 03:16:32 -08:00
|
|
|
|
2011-08-16 03:28:31 -07:00
|
|
|
nsAccessible*
|
2010-08-24 19:08:28 -07:00
|
|
|
AccEvent::GetAccessibleForNode() const
|
2007-05-09 10:48:11 -07:00
|
|
|
{
|
2012-02-09 08:49:17 -08:00
|
|
|
return mNode ? GetAccService()->GetAccessible(mNode, nsnull) : nsnull;
|
2007-05-09 10:48:11 -07:00
|
|
|
}
|
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
void
|
2010-08-24 19:08:28 -07:00
|
|
|
AccEvent::CaptureIsFromUserInput(EIsFromUserInput aIsFromUserInput)
|
2010-01-20 03:16:32 -08:00
|
|
|
{
|
2010-06-11 01:23:18 -07:00
|
|
|
nsINode *targetNode = GetNode();
|
2010-01-20 03:16:32 -08:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (!targetNode) {
|
|
|
|
// XXX: remove this hack during reorganization of 506907. Meanwhile we
|
|
|
|
// want to get rid an assertion for application accessible events which
|
|
|
|
// don't have DOM node (see bug 506206).
|
2010-03-18 11:49:39 -07:00
|
|
|
nsApplicationAccessible *applicationAcc =
|
2010-01-20 03:16:32 -08:00
|
|
|
nsAccessNode::GetApplicationAccessible();
|
|
|
|
|
2010-03-18 11:49:39 -07:00
|
|
|
if (mAccessible != static_cast<nsIAccessible*>(applicationAcc))
|
2010-01-20 03:16:32 -08:00
|
|
|
NS_ASSERTION(targetNode, "There should always be a DOM node for an event");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (aIsFromUserInput != eAutoDetect) {
|
2011-10-17 07:59:28 -07:00
|
|
|
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
|
2010-01-20 03:16:32 -08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!targetNode)
|
|
|
|
return;
|
|
|
|
|
2010-05-17 06:42:32 -07:00
|
|
|
nsIPresShell *presShell = nsCoreUtils::GetPresShellFor(targetNode);
|
2010-01-20 03:16:32 -08:00
|
|
|
if (!presShell) {
|
|
|
|
NS_NOTREACHED("Threre should always be an pres shell for an event");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-04-21 10:35:52 -07:00
|
|
|
nsEventStateManager *esm = presShell->GetPresContext()->EventStateManager();
|
2010-01-20 03:16:32 -08:00
|
|
|
if (!esm) {
|
|
|
|
NS_NOTREACHED("There should always be an ESM for an event");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
mIsFromUserInput = esm->IsHandlingUserInputExternal();
|
|
|
|
}
|
|
|
|
|
2009-02-04 22:23:18 -08:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccStateChangeEvent
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2009-02-04 22:23:18 -08:00
|
|
|
|
2010-06-02 05:30:08 -07:00
|
|
|
// Note: we pass in eAllowDupes to the base class because we don't currently
|
|
|
|
// support correct state change coalescence (XXX Bug 569356). Also we need to
|
|
|
|
// decide how to coalesce events created via accessible (instead of node).
|
2010-08-24 19:08:28 -07:00
|
|
|
AccStateChangeEvent::
|
2011-04-09 16:38:06 -07:00
|
|
|
AccStateChangeEvent(nsAccessible* aAccessible, PRUint64 aState,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aIsEnabled, EIsFromUserInput aIsFromUserInput):
|
2010-10-20 21:16:10 -07:00
|
|
|
AccEvent(nsIAccessibleEvent::EVENT_STATE_CHANGE, aAccessible,
|
2010-08-24 19:08:28 -07:00
|
|
|
aIsFromUserInput, eAllowDupes),
|
2011-04-09 16:38:06 -07:00
|
|
|
mState(aState), mIsEnabled(aIsEnabled)
|
2007-04-12 23:03:30 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
AccStateChangeEvent::
|
2011-09-28 23:19:26 -07:00
|
|
|
AccStateChangeEvent(nsINode* aNode, PRUint64 aState, bool aIsEnabled):
|
2011-08-11 04:45:36 -07:00
|
|
|
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode,
|
|
|
|
eAutoDetect, eAllowDupes),
|
2011-04-09 16:38:06 -07:00
|
|
|
mState(aState), mIsEnabled(aIsEnabled)
|
2007-04-16 21:45:42 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
AccStateChangeEvent::
|
2011-04-09 16:38:06 -07:00
|
|
|
AccStateChangeEvent(nsINode* aNode, PRUint64 aState) :
|
2011-08-11 04:45:36 -07:00
|
|
|
AccEvent(::nsIAccessibleEvent::EVENT_STATE_CHANGE, aNode,
|
|
|
|
eAutoDetect, eAllowDupes),
|
|
|
|
mState(aState)
|
2007-04-16 21:45:42 -07:00
|
|
|
{
|
2010-06-11 01:23:18 -07:00
|
|
|
// Use GetAccessibleForNode() because we do not want to store an accessible
|
2007-05-09 10:48:11 -07:00
|
|
|
// since it leads to problems with delayed events in the case when
|
|
|
|
// an accessible gets reorder event before delayed event is processed.
|
2010-06-11 01:23:18 -07:00
|
|
|
nsAccessible *accessible = GetAccessibleForNode();
|
2011-04-09 16:38:06 -07:00
|
|
|
mIsEnabled = accessible && ((accessible->State() & mState) != 0);
|
2007-04-16 21:45:42 -07:00
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
already_AddRefed<nsAccEvent>
|
|
|
|
AccStateChangeEvent::CreateXPCOMObject()
|
2007-04-12 23:03:30 -07:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
nsAccEvent* event = new nsAccStateChangeEvent(this);
|
|
|
|
NS_IF_ADDREF(event);
|
|
|
|
return event;
|
2007-04-12 23:03:30 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccTextChangeEvent
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-06-02 05:30:13 -07:00
|
|
|
// Note: we pass in eAllowDupes to the base class because we don't support text
|
|
|
|
// events coalescence. We fire delayed text change events in nsDocAccessible 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.
|
|
|
|
// XXX revisit this when coalescence is faster (eCoalesceFromSameSubtree)
|
2010-08-24 19:08:28 -07:00
|
|
|
AccTextChangeEvent::
|
|
|
|
AccTextChangeEvent(nsAccessible* aAccessible, PRInt32 aStart,
|
2011-09-28 23:19:26 -07:00
|
|
|
const nsAString& aModifiedText, bool aIsInserted,
|
2010-10-20 21:16:10 -07:00
|
|
|
EIsFromUserInput aIsFromUserInput)
|
2010-08-24 19:08:28 -07:00
|
|
|
: AccEvent(aIsInserted ?
|
|
|
|
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_INSERTED) :
|
|
|
|
static_cast<PRUint32>(nsIAccessibleEvent::EVENT_TEXT_REMOVED),
|
2010-10-20 21:16:10 -07:00
|
|
|
aAccessible, aIsFromUserInput, eAllowDupes)
|
2010-08-18 19:14:50 -07:00
|
|
|
, mStart(aStart)
|
|
|
|
, mIsInserted(aIsInserted)
|
|
|
|
, mModifiedText(aModifiedText)
|
2007-04-16 23:52:52 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
already_AddRefed<nsAccEvent>
|
|
|
|
AccTextChangeEvent::CreateXPCOMObject()
|
2007-08-28 14:57:53 -07:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
nsAccEvent* event = new nsAccTextChangeEvent(this);
|
|
|
|
NS_IF_ADDREF(event);
|
|
|
|
return event;
|
2007-08-28 14:57:53 -07:00
|
|
|
}
|
|
|
|
|
2010-07-01 18:49:42 -07:00
|
|
|
|
2010-10-20 21:16:10 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// AccMutationEvent
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
AccMutationEvent::
|
|
|
|
AccMutationEvent(PRUint32 aEventType, nsAccessible* aTarget,
|
2011-01-18 00:03:38 -08:00
|
|
|
nsINode* aTargetNode) :
|
|
|
|
AccEvent(aEventType, aTarget, eAutoDetect, eCoalesceFromSameSubtree)
|
2010-10-20 21:16:10 -07:00
|
|
|
{
|
|
|
|
mNode = aTargetNode;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-07-01 18:49:42 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// AccHideEvent
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
AccHideEvent::
|
2011-01-18 00:03:38 -08:00
|
|
|
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode) :
|
|
|
|
AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget, aTargetNode)
|
2010-07-01 18:49:42 -07:00
|
|
|
{
|
2011-07-23 01:38:33 -07:00
|
|
|
mParent = mAccessible->Parent();
|
2011-06-06 19:23:13 -07:00
|
|
|
mNextSibling = mAccessible->NextSibling();
|
|
|
|
mPrevSibling = mAccessible->PrevSibling();
|
2010-07-01 18:49:42 -07:00
|
|
|
}
|
|
|
|
|
2012-02-13 16:02:41 -08:00
|
|
|
already_AddRefed<nsAccEvent>
|
|
|
|
AccHideEvent::CreateXPCOMObject()
|
|
|
|
{
|
|
|
|
nsAccEvent* event = new nsAccHideEvent(this);
|
|
|
|
NS_ADDREF(event);
|
|
|
|
return event;
|
|
|
|
}
|
|
|
|
|
2010-07-01 18:49:42 -07:00
|
|
|
|
2010-10-20 21:16:10 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// AccShowEvent
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
AccShowEvent::
|
2011-01-18 00:03:38 -08:00
|
|
|
AccShowEvent(nsAccessible* aTarget, nsINode* aTargetNode) :
|
|
|
|
AccMutationEvent(::nsIAccessibleEvent::EVENT_SHOW, aTarget, aTargetNode)
|
2010-10-20 21:16:10 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccCaretMoveEvent
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
AccCaretMoveEvent::
|
|
|
|
AccCaretMoveEvent(nsAccessible* aAccessible, PRInt32 aCaretOffset) :
|
2010-10-20 21:16:10 -07:00
|
|
|
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aAccessible),
|
2007-06-22 02:27:22 -07:00
|
|
|
mCaretOffset(aCaretOffset)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
AccCaretMoveEvent::
|
|
|
|
AccCaretMoveEvent(nsINode* aNode) :
|
2010-10-20 21:16:10 -07:00
|
|
|
AccEvent(::nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED, aNode),
|
2007-06-22 02:27:22 -07:00
|
|
|
mCaretOffset(-1)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
already_AddRefed<nsAccEvent>
|
|
|
|
AccCaretMoveEvent::CreateXPCOMObject()
|
2007-06-22 02:27:22 -07:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
nsAccEvent* event = new nsAccCaretMoveEvent(this);
|
|
|
|
NS_IF_ADDREF(event);
|
|
|
|
return event;
|
2007-06-22 02:27:22 -07:00
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
|
2011-10-31 17:52:27 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// AccSelChangeEvent
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
AccSelChangeEvent::
|
|
|
|
AccSelChangeEvent(nsAccessible* aWidget, nsAccessible* aItem,
|
|
|
|
SelChangeType aSelChangeType) :
|
|
|
|
AccEvent(0, aItem, eAutoDetect, eCoalesceSelectionChange),
|
|
|
|
mWidget(aWidget), mItem(aItem), mSelChangeType(aSelChangeType),
|
|
|
|
mPreceedingCount(0), mPackedEvent(nsnull)
|
|
|
|
{
|
|
|
|
if (aSelChangeType == eSelectionAdd) {
|
|
|
|
if (mWidget->GetSelectedItem(1))
|
|
|
|
mEventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
|
|
|
|
else
|
|
|
|
mEventType = nsIAccessibleEvent::EVENT_SELECTION;
|
|
|
|
} else {
|
|
|
|
mEventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2010-08-24 19:08:28 -07:00
|
|
|
// AccTableChangeEvent
|
2010-01-20 03:16:32 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
AccTableChangeEvent::
|
|
|
|
AccTableChangeEvent(nsAccessible* aAccessible, PRUint32 aEventType,
|
2010-10-20 21:16:10 -07:00
|
|
|
PRInt32 aRowOrColIndex, PRInt32 aNumRowsOrCols) :
|
|
|
|
AccEvent(aEventType, aAccessible),
|
2008-01-17 18:56:38 -08:00
|
|
|
mRowOrColIndex(aRowOrColIndex), mNumRowsOrCols(aNumRowsOrCols)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
already_AddRefed<nsAccEvent>
|
|
|
|
AccTableChangeEvent::CreateXPCOMObject()
|
2008-01-17 18:56:38 -08:00
|
|
|
{
|
2010-08-24 19:08:28 -07:00
|
|
|
nsAccEvent* event = new nsAccTableChangeEvent(this);
|
|
|
|
NS_IF_ADDREF(event);
|
|
|
|
return event;
|
2008-01-17 18:56:38 -08:00
|
|
|
}
|
|
|
|
|
2012-03-09 17:52:13 -08:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// AccVCChangeEvent
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
AccVCChangeEvent::
|
|
|
|
AccVCChangeEvent(nsAccessible* aAccessible,
|
|
|
|
nsIAccessible* aOldAccessible,
|
|
|
|
PRInt32 aOldStart, PRInt32 aOldEnd) :
|
|
|
|
AccEvent(::nsIAccessibleEvent::EVENT_VIRTUALCURSOR_CHANGED, aAccessible),
|
|
|
|
mOldAccessible(aOldAccessible), mOldStart(aOldStart), mOldEnd(aOldEnd)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsAccEvent>
|
|
|
|
AccVCChangeEvent::CreateXPCOMObject()
|
|
|
|
{
|
|
|
|
nsAccEvent* event = new nsAccVirtualCursorChangeEvent(this);
|
|
|
|
NS_ADDREF(event);
|
|
|
|
return event;
|
|
|
|
}
|