2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* 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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-03 23:09:22 -07:00
|
|
|
#include "RootAccessible.h"
|
|
|
|
|
2013-12-08 18:52:54 -08:00
|
|
|
#include "mozilla/ArrayUtils.h"
|
2011-10-10 22:50:08 -07:00
|
|
|
|
2011-05-23 09:46:36 -07:00
|
|
|
#define CreateEvent CreateEventA
|
|
|
|
#include "nsIDOMDocument.h"
|
|
|
|
|
2012-04-13 07:17:03 -07:00
|
|
|
#include "Accessible-inl.h"
|
2012-06-01 11:39:47 -07:00
|
|
|
#include "DocAccessible-inl.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsAccessibilityService.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
#include "nsAccUtils.h"
|
|
|
|
#include "nsCoreUtils.h"
|
2012-07-27 21:21:40 -07:00
|
|
|
#include "nsEventShell.h"
|
2011-08-09 18:44:00 -07:00
|
|
|
#include "Relation.h"
|
2012-01-11 19:07:35 -08:00
|
|
|
#include "Role.h"
|
2011-08-09 18:44:00 -07:00
|
|
|
#include "States.h"
|
2012-06-10 16:44:50 -07:00
|
|
|
#ifdef MOZ_XUL
|
|
|
|
#include "XULTreeAccessible.h"
|
|
|
|
#endif
|
2009-08-21 05:33:31 -07:00
|
|
|
|
2010-06-11 01:23:18 -07:00
|
|
|
#include "mozilla/dom/Element.h"
|
2012-06-06 03:27:46 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
2014-03-04 16:37:43 -08:00
|
|
|
#include "mozilla/dom/Event.h"
|
2013-04-05 17:44:15 -07:00
|
|
|
#include "mozilla/dom/EventTarget.h"
|
2014-03-20 20:59:59 -07:00
|
|
|
#include "nsIDOMCustomEvent.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIDOMXULMultSelectCntrlEl.h"
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsIInterfaceRequestorUtils.h"
|
2014-03-20 20:59:59 -07:00
|
|
|
#include "nsIPropertyBag2.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsIServiceManager.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsIWebBrowserChrome.h"
|
|
|
|
#include "nsReadableUtils.h"
|
Bug 178324, refactor focus by moving all focus handling into one place and simplifying it, add many tests, fixes many other bugs too numerous to mention in this small checkin comment, r=josh,smichaud,ere,dbaron,marco,neil,gavin,smaug,sr=smaug (CLOSED TREE)
2009-06-10 11:00:39 -07:00
|
|
|
#include "nsFocusManager.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef MOZ_XUL
|
|
|
|
#include "nsIXULDocument.h"
|
|
|
|
#include "nsIXULWindow.h"
|
|
|
|
#endif
|
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
using namespace mozilla;
|
2011-07-27 05:43:01 -07:00
|
|
|
using namespace mozilla::a11y;
|
2013-04-05 17:44:15 -07:00
|
|
|
using namespace mozilla::dom;
|
2010-04-30 06:12:05 -07:00
|
|
|
|
2009-12-10 11:12:19 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsISupports
|
|
|
|
|
2014-10-21 17:49:28 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED0(RootAccessible, DocAccessible)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2009-12-10 11:12:19 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-05-03 23:09:22 -07:00
|
|
|
// Constructor/destructor
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::
|
|
|
|
RootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
|
|
|
|
nsIPresShell* aPresShell) :
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessibleWrap(aDocument, aRootContent, aPresShell)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-12-17 21:22:26 -08:00
|
|
|
mType = eRootType;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::~RootAccessible()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-12-10 11:12:19 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-05-28 18:18:45 -07:00
|
|
|
// Accessible
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2012-04-30 20:08:31 -07:00
|
|
|
ENameValueFlag
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::Name(nsString& aName)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2008-08-24 09:45:56 -07:00
|
|
|
aName.Truncate();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
if (mRoleMapEntry) {
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible::Name(aName);
|
2012-04-30 20:08:31 -07:00
|
|
|
if (!aName.IsEmpty())
|
|
|
|
return eNameOK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2014-01-20 13:52:04 -08:00
|
|
|
mDocumentNode->GetTitle(aName);
|
2012-04-30 20:08:31 -07:00
|
|
|
return eNameOK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
role
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::NativeRole()
|
2010-09-04 19:14:01 -07:00
|
|
|
{
|
2012-01-11 19:07:35 -08:00
|
|
|
// If it's a <dialog> or <wizard>, use roles::DIALOG instead
|
2012-11-22 14:15:25 -08:00
|
|
|
dom::Element* rootElm = mDocumentNode->GetRootElement();
|
2015-03-03 03:08:59 -08:00
|
|
|
if (rootElm && rootElm->IsAnyOfXULElements(nsGkAtoms::dialog,
|
|
|
|
nsGkAtoms::wizard))
|
2012-05-22 08:36:38 -07:00
|
|
|
return roles::DIALOG;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
return DocAccessibleWrap::NativeRole();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-05-03 23:09:22 -07:00
|
|
|
// RootAccessible protected member
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef MOZ_XUL
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::GetChromeFlags()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
// Return the flag set for the top level window as defined
|
|
|
|
// by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
|
|
|
|
// Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
|
2013-02-12 14:02:51 -08:00
|
|
|
nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(mDocumentNode);
|
|
|
|
NS_ENSURE_TRUE(docShell, 0);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
|
2013-02-12 14:02:51 -08:00
|
|
|
docShell->GetTreeOwner(getter_AddRefs(treeOwner));
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_TRUE(treeOwner, 0);
|
|
|
|
nsCOMPtr<nsIXULWindow> xulWin(do_GetInterface(treeOwner));
|
|
|
|
if (!xulWin) {
|
|
|
|
return 0;
|
|
|
|
}
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t chromeFlags;
|
2007-03-22 10:30:00 -07:00
|
|
|
xulWin->GetChromeFlags(&chromeFlags);
|
|
|
|
return chromeFlags;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::NativeState()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t state = DocAccessibleWrap::NativeState();
|
2012-05-22 16:48:35 -07:00
|
|
|
if (state & states::DEFUNCT)
|
|
|
|
return state;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifdef MOZ_XUL
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t chromeFlags = GetChromeFlags();
|
2011-04-27 06:42:03 -07:00
|
|
|
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
|
2012-05-22 16:48:35 -07:00
|
|
|
state |= states::SIZEABLE;
|
2007-03-22 10:30:00 -07:00
|
|
|
// If it has a titlebar it's movable
|
|
|
|
// XXX unless it's minimized or maximized, but not sure
|
|
|
|
// how to detect that
|
2011-04-27 06:42:03 -07:00
|
|
|
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR)
|
2012-05-22 16:48:35 -07:00
|
|
|
state |= states::MOVEABLE;
|
2011-04-27 06:42:03 -07:00
|
|
|
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL)
|
2012-05-22 16:48:35 -07:00
|
|
|
state |= states::MODAL;
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
|
|
|
|
2012-02-11 18:34:00 -08:00
|
|
|
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
2012-11-22 14:15:25 -08:00
|
|
|
if (fm && fm->GetActiveWindow() == mDocumentNode->GetWindow())
|
2012-05-22 16:48:35 -07:00
|
|
|
state |= states::ACTIVE;
|
2010-05-20 01:00:37 -07:00
|
|
|
|
2012-05-22 16:48:35 -07:00
|
|
|
return state;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2012-11-20 07:33:30 -08:00
|
|
|
const char* const kEventTypes[] = {
|
2012-11-19 19:54:41 -08:00
|
|
|
#ifdef DEBUG_DRAGDROPSTART
|
|
|
|
// Capture mouse over events and fire fake DRAGDROPSTART event to simplify
|
2012-11-20 07:33:30 -08:00
|
|
|
// debugging a11y objects with event viewers.
|
2012-11-19 19:54:41 -08:00
|
|
|
"mouseover",
|
|
|
|
#endif
|
2012-11-20 07:33:30 -08:00
|
|
|
// Fired when list or tree selection changes.
|
2012-11-19 19:54:41 -08:00
|
|
|
"select",
|
2012-11-20 07:33:30 -08:00
|
|
|
// Fired when value changes immediately, wether or not focused changed.
|
2012-11-19 19:54:41 -08:00
|
|
|
"ValueChange",
|
|
|
|
"AlertActive",
|
|
|
|
"TreeRowCountChanged",
|
|
|
|
"TreeInvalidated",
|
|
|
|
// add ourself as a OpenStateChange listener (custom event fired in tree.xml)
|
|
|
|
"OpenStateChange",
|
2013-03-28 12:41:32 -07:00
|
|
|
// add ourself as a CheckboxStateChange listener (custom event fired in HTMLInputElement.cpp)
|
2012-11-19 19:54:41 -08:00
|
|
|
"CheckboxStateChange",
|
2013-03-28 12:41:32 -07:00
|
|
|
// add ourself as a RadioStateChange Listener ( custom event fired in in HTMLInputElement.cpp & radio.xml)
|
2012-11-19 19:54:41 -08:00
|
|
|
"RadioStateChange",
|
|
|
|
"popupshown",
|
|
|
|
"popuphiding",
|
|
|
|
"DOMMenuInactive",
|
|
|
|
"DOMMenuItemActive",
|
|
|
|
"DOMMenuItemInactive",
|
|
|
|
"DOMMenuBarActive",
|
|
|
|
"DOMMenuBarInactive"
|
|
|
|
};
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
RootAccessible::AddEventListeners()
|
|
|
|
{
|
2013-04-05 17:44:15 -07:00
|
|
|
// EventTarget interface allows to register event listeners to
|
2012-11-19 19:54:41 -08:00
|
|
|
// receive untrusted events (synthetic events generated by untrusted code).
|
|
|
|
// For example, XBL bindings implementations for elements that are hosted in
|
|
|
|
// non chrome document fire untrusted events.
|
2013-04-05 17:44:15 -07:00
|
|
|
nsCOMPtr<EventTarget> nstarget = mDocumentNode;
|
2012-11-19 19:54:41 -08:00
|
|
|
|
|
|
|
if (nstarget) {
|
2012-11-20 07:33:30 -08:00
|
|
|
for (const char* const* e = kEventTypes,
|
|
|
|
* const* e_end = ArrayEnd(kEventTypes);
|
2012-11-19 19:54:41 -08:00
|
|
|
e < e_end; ++e) {
|
|
|
|
nsresult rv = nstarget->AddEventListener(NS_ConvertASCIItoUTF16(*e),
|
|
|
|
this, true, true, 2);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return DocAccessible::AddEventListeners();
|
|
|
|
}
|
|
|
|
|
2012-05-03 23:09:22 -07:00
|
|
|
nsresult
|
|
|
|
RootAccessible::RemoveEventListeners()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-04-05 17:44:15 -07:00
|
|
|
nsCOMPtr<EventTarget> target = mDocumentNode;
|
2007-03-22 10:30:00 -07:00
|
|
|
if (target) {
|
2012-11-20 07:33:30 -08:00
|
|
|
for (const char* const* e = kEventTypes,
|
|
|
|
* const* e_end = ArrayEnd(kEventTypes);
|
2007-03-22 10:30:00 -07:00
|
|
|
e < e_end; ++e) {
|
2011-10-17 07:59:28 -07:00
|
|
|
nsresult rv = target->RemoveEventListener(NS_ConvertASCIItoUTF16(*e), this, true);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-11-27 10:08:50 -08:00
|
|
|
// Do this before removing clearing caret accessible, so that it can use
|
|
|
|
// shutdown the caret accessible's selection listener
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessible::RemoveEventListeners();
|
2007-11-27 10:08:50 -08:00
|
|
|
return NS_OK;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-03-02 06:41:42 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// public
|
|
|
|
|
|
|
|
void
|
2012-05-27 02:01:40 -07:00
|
|
|
RootAccessible::DocumentActivated(DocAccessible* aDocument)
|
2011-03-02 06:41:42 -08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2009-12-10 11:12:19 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIDOMEventListener
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-06-30 19:18:08 -07:00
|
|
|
NS_IMETHODIMP
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2012-08-04 00:44:00 -07:00
|
|
|
MOZ_ASSERT(aDOMEvent);
|
2014-03-04 16:37:43 -08:00
|
|
|
Event* event = aDOMEvent->InternalDOMEvent();
|
2013-04-05 17:44:15 -07:00
|
|
|
nsCOMPtr<nsINode> origTargetNode = do_QueryInterface(event->GetOriginalTarget());
|
2011-01-18 00:03:38 -08:00
|
|
|
if (!origTargetNode)
|
|
|
|
return NS_OK;
|
|
|
|
|
2012-10-05 06:00:28 -07:00
|
|
|
#ifdef A11Y_LOG
|
|
|
|
if (logging::IsEnabled(logging::eDOMEvents)) {
|
|
|
|
nsAutoString eventType;
|
|
|
|
aDOMEvent->GetType(eventType);
|
|
|
|
logging::DOMEvent("handled", origTargetNode, eventType);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessible* document =
|
2011-10-18 03:53:36 -07:00
|
|
|
GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
|
2011-01-18 00:03:38 -08:00
|
|
|
|
|
|
|
if (document) {
|
|
|
|
// Root accessible exists longer than any of its descendant documents so
|
|
|
|
// that we are guaranteed notification is processed before root accessible
|
|
|
|
// is destroyed.
|
2012-05-03 23:09:22 -07:00
|
|
|
document->HandleNotification<RootAccessible, nsIDOMEvent>
|
|
|
|
(this, &RootAccessible::ProcessDOMEvent, aDOMEvent);
|
2011-01-18 00:03:38 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2012-05-03 23:09:22 -07:00
|
|
|
// RootAccessible protected
|
2011-01-18 00:03:38 -08:00
|
|
|
void
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
2011-01-18 00:03:38 -08:00
|
|
|
{
|
2012-08-04 00:44:00 -07:00
|
|
|
MOZ_ASSERT(aDOMEvent);
|
2014-03-04 16:37:43 -08:00
|
|
|
Event* event = aDOMEvent->InternalDOMEvent();
|
2013-04-05 17:44:15 -07:00
|
|
|
nsCOMPtr<nsINode> origTargetNode = do_QueryInterface(event->GetOriginalTarget());
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAutoString eventType;
|
2011-01-18 00:03:38 -08:00
|
|
|
aDOMEvent->GetType(eventType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-10-05 06:00:28 -07:00
|
|
|
#ifdef A11Y_LOG
|
|
|
|
if (logging::IsEnabled(logging::eDOMEvents))
|
|
|
|
logging::DOMEvent("processed", origTargetNode, eventType);
|
|
|
|
#endif
|
|
|
|
|
2011-01-18 00:03:38 -08:00
|
|
|
if (eventType.EqualsLiteral("popuphiding")) {
|
2011-09-27 18:46:11 -07:00
|
|
|
HandlePopupHidingEvent(origTargetNode);
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
|
|
|
}
|
2008-12-03 01:04:02 -08:00
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessible* targetDocument = GetAccService()->
|
2012-02-07 14:38:54 -08:00
|
|
|
GetDocAccessible(origTargetNode->OwnerDoc());
|
|
|
|
NS_ASSERTION(targetDocument, "No document while accessible is in document?!");
|
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* accessible =
|
2012-02-07 14:38:54 -08:00
|
|
|
targetDocument->GetAccessibleOrContainer(origTargetNode);
|
2010-05-11 23:47:35 -07:00
|
|
|
if (!accessible)
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2008-01-23 15:49:10 -08:00
|
|
|
#ifdef MOZ_XUL
|
2012-06-10 16:44:50 -07:00
|
|
|
XULTreeAccessible* treeAcc = accessible->AsXULTree();
|
2012-04-03 02:54:01 -07:00
|
|
|
if (treeAcc) {
|
|
|
|
if (eventType.EqualsLiteral("TreeRowCountChanged")) {
|
|
|
|
HandleTreeRowCountChangedEvent(aDOMEvent, treeAcc);
|
|
|
|
return;
|
|
|
|
}
|
2011-12-01 12:43:07 -08:00
|
|
|
|
2012-04-03 02:54:01 -07:00
|
|
|
if (eventType.EqualsLiteral("TreeInvalidated")) {
|
|
|
|
HandleTreeInvalidatedEvent(aDOMEvent, treeAcc);
|
|
|
|
return;
|
2008-06-15 23:16:18 -07:00
|
|
|
}
|
|
|
|
}
|
2008-01-23 15:49:10 -08:00
|
|
|
#endif
|
2007-12-11 00:18:04 -08:00
|
|
|
|
2007-04-17 05:39:10 -07:00
|
|
|
if (eventType.EqualsLiteral("RadioStateChange")) {
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t state = accessible->State();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isEnabled = (state & (states::CHECKED | states::SELECTED)) != 0;
|
2007-04-17 05:39:10 -07:00
|
|
|
|
2013-08-02 09:42:36 -07:00
|
|
|
if (accessible->NeedsDOMUIEvent()) {
|
|
|
|
nsRefPtr<AccEvent> accEvent =
|
|
|
|
new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
|
|
|
|
nsEventShell::FireEvent(accEvent);
|
|
|
|
}
|
2007-04-17 05:39:10 -07:00
|
|
|
|
2011-09-27 18:46:11 -07:00
|
|
|
if (isEnabled) {
|
|
|
|
FocusMgr()->ActiveItemChanged(accessible);
|
2012-10-04 02:57:09 -07:00
|
|
|
#ifdef A11Y_LOG
|
2012-09-26 16:53:23 -07:00
|
|
|
if (logging::IsEnabled(logging::eFocus))
|
|
|
|
logging::ActiveItemChangeCausedBy("RadioStateChange", accessible);
|
|
|
|
#endif
|
2011-09-27 18:46:11 -07:00
|
|
|
}
|
2007-04-17 05:39:10 -07:00
|
|
|
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2007-04-17 05:39:10 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (eventType.EqualsLiteral("CheckboxStateChange")) {
|
2013-08-02 09:42:36 -07:00
|
|
|
if (accessible->NeedsDOMUIEvent()) {
|
|
|
|
uint64_t state = accessible->State();
|
|
|
|
bool isEnabled = !!(state & states::CHECKED);
|
2007-04-17 05:39:10 -07:00
|
|
|
|
2013-08-02 09:42:36 -07:00
|
|
|
nsRefPtr<AccEvent> accEvent =
|
|
|
|
new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
|
|
|
|
nsEventShell::FireEvent(accEvent);
|
|
|
|
}
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2007-04-17 05:39:10 -07:00
|
|
|
}
|
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
Accessible* treeItemAcc = nullptr;
|
2007-03-22 10:30:00 -07:00
|
|
|
#ifdef MOZ_XUL
|
2011-11-24 20:32:49 -08:00
|
|
|
// If it's a tree element, need the currently selected item.
|
|
|
|
if (treeAcc) {
|
|
|
|
treeItemAcc = accessible->CurrentItem();
|
|
|
|
if (treeItemAcc)
|
|
|
|
accessible = treeItemAcc;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-11-24 20:32:49 -08:00
|
|
|
if (treeItemAcc && eventType.EqualsLiteral("OpenStateChange")) {
|
2012-08-22 08:56:38 -07:00
|
|
|
uint64_t state = accessible->State();
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isEnabled = (state & states::EXPANDED) != 0;
|
2007-04-17 05:39:10 -07:00
|
|
|
|
2010-08-24 19:08:28 -07:00
|
|
|
nsRefPtr<AccEvent> accEvent =
|
2011-04-09 16:38:06 -07:00
|
|
|
new AccStateChangeEvent(accessible, states::EXPANDED, isEnabled);
|
2010-01-18 08:17:01 -08:00
|
|
|
nsEventShell::FireEvent(accEvent);
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2007-04-09 21:37:52 -07:00
|
|
|
}
|
2007-04-17 05:39:10 -07:00
|
|
|
|
2012-11-19 20:53:38 -08:00
|
|
|
nsINode* targetNode = accessible->GetNode();
|
2011-11-24 20:32:49 -08:00
|
|
|
if (treeItemAcc && eventType.EqualsLiteral("select")) {
|
2011-10-31 17:52:27 -07:00
|
|
|
// XXX: We shouldn't be based on DOM select event which doesn't provide us
|
|
|
|
// any context info. We should integrate into nsTreeSelection instead.
|
2007-04-09 21:37:52 -07:00
|
|
|
// If multiselect tree, we should fire selectionadd or selection removed
|
2011-09-27 18:46:11 -07:00
|
|
|
if (FocusMgr()->HasDOMFocus(targetNode)) {
|
2007-04-09 21:37:52 -07:00
|
|
|
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSel =
|
2010-06-30 19:18:08 -07:00
|
|
|
do_QueryInterface(targetNode);
|
2007-04-09 21:37:52 -07:00
|
|
|
nsAutoString selType;
|
|
|
|
multiSel->GetSelType(selType);
|
|
|
|
if (selType.IsEmpty() || !selType.EqualsLiteral("single")) {
|
|
|
|
// XXX: We need to fire EVENT_SELECTION_ADD and EVENT_SELECTION_REMOVE
|
|
|
|
// for each tree item. Perhaps each tree item will need to cache its
|
|
|
|
// selection state and fire an event after a DOM "select" event when
|
2012-06-10 16:44:50 -07:00
|
|
|
// that state changes. XULTreeAccessible::UpdateTreeSelection();
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
|
|
|
|
accessible);
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2007-04-09 21:37:52 -07:00
|
|
|
|
2011-11-24 20:32:49 -08:00
|
|
|
nsRefPtr<AccSelChangeEvent> selChangeEvent =
|
|
|
|
new AccSelChangeEvent(treeAcc, treeItemAcc,
|
|
|
|
AccSelChangeEvent::eSelectionAdd);
|
|
|
|
nsEventShell::FireEvent(selChangeEvent);
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
2007-04-09 21:37:52 -07:00
|
|
|
else
|
2007-03-22 10:30:00 -07:00
|
|
|
#endif
|
2011-09-27 18:46:11 -07:00
|
|
|
if (eventType.EqualsLiteral("AlertActive")) {
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2007-05-28 23:53:50 -07:00
|
|
|
else if (eventType.EqualsLiteral("popupshown")) {
|
2008-12-03 01:04:02 -08:00
|
|
|
HandlePopupShownEvent(accessible);
|
2007-05-21 06:53:57 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
|
2012-01-11 19:07:35 -08:00
|
|
|
if (accessible->Role() == roles::MENUPOPUP) {
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
|
|
|
|
accessible);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
2007-04-09 21:37:52 -07:00
|
|
|
else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
|
2011-09-27 18:46:11 -07:00
|
|
|
FocusMgr()->ActiveItemChanged(accessible);
|
2012-10-04 02:57:09 -07:00
|
|
|
#ifdef A11Y_LOG
|
2012-09-26 16:53:23 -07:00
|
|
|
if (logging::IsEnabled(logging::eFocus))
|
|
|
|
logging::ActiveItemChangeCausedBy("DOMMenuItemActive", accessible);
|
|
|
|
#endif
|
2011-09-27 18:46:11 -07:00
|
|
|
}
|
|
|
|
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.
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* widget =
|
2011-09-27 18:46:11 -07:00
|
|
|
accessible->IsWidget() ? accessible : accessible->ContainerWidget();
|
|
|
|
if (widget && widget->IsAutoCompletePopup()) {
|
2012-07-30 07:20:58 -07:00
|
|
|
FocusMgr()->ActiveItemChanged(nullptr);
|
2012-10-04 02:57:09 -07:00
|
|
|
#ifdef A11Y_LOG
|
2012-09-26 16:53:23 -07:00
|
|
|
if (logging::IsEnabled(logging::eFocus))
|
|
|
|
logging::ActiveItemChangeCausedBy("DOMMenuItemInactive", accessible);
|
|
|
|
#endif
|
2008-03-05 19:43:50 -08:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2010-10-20 21:16:10 -07:00
|
|
|
else if (eventType.EqualsLiteral("DOMMenuBarActive")) { // Always from user input
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_START,
|
2010-10-20 21:16:10 -07:00
|
|
|
accessible, eFromUserInput);
|
2011-09-27 18:46:11 -07:00
|
|
|
|
|
|
|
// 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.
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* activeItem = accessible->CurrentItem();
|
2011-09-27 18:46:11 -07:00
|
|
|
if (activeItem) {
|
|
|
|
FocusMgr()->ActiveItemChanged(activeItem);
|
2012-10-04 02:57:09 -07:00
|
|
|
#ifdef A11Y_LOG
|
2012-09-26 16:53:23 -07:00
|
|
|
if (logging::IsEnabled(logging::eFocus))
|
|
|
|
logging::ActiveItemChangeCausedBy("DOMMenuBarActive", accessible);
|
|
|
|
#endif
|
2011-09-27 18:46:11 -07:00
|
|
|
}
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2010-10-20 21:16:10 -07:00
|
|
|
else if (eventType.EqualsLiteral("DOMMenuBarInactive")) { // Always from user input
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END,
|
2010-10-20 21:16:10 -07:00
|
|
|
accessible, eFromUserInput);
|
2011-09-27 18:46:11 -07:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
FocusMgr()->ActiveItemChanged(nullptr);
|
2012-10-04 02:57:09 -07:00
|
|
|
#ifdef A11Y_LOG
|
2012-09-26 16:53:23 -07:00
|
|
|
if (logging::IsEnabled(logging::eFocus))
|
|
|
|
logging::ActiveItemChangeCausedBy("DOMMenuBarInactive", accessible);
|
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2013-08-02 09:42:36 -07:00
|
|
|
else if (accessible->NeedsDOMUIEvent() &&
|
|
|
|
eventType.EqualsLiteral("ValueChange")) {
|
|
|
|
targetDocument->FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
|
|
|
|
accessible);
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
2010-12-02 00:46:59 -08:00
|
|
|
#ifdef DEBUG_DRAGDROPSTART
|
2007-12-10 19:30:02 -08:00
|
|
|
else if (eventType.EqualsLiteral("mouseover")) {
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_DRAGDROP_START,
|
|
|
|
accessible);
|
2007-12-10 19:30:02 -08:00
|
|
|
}
|
|
|
|
#endif
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-12-10 11:12:19 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2013-10-28 20:30:55 -07:00
|
|
|
// Accessible
|
2009-12-10 11:12:19 -08:00
|
|
|
|
2010-06-11 21:04:35 -07:00
|
|
|
void
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::Shutdown()
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-10-28 20:30:55 -07:00
|
|
|
// Called manually or by Accessible::LastRelease()
|
2012-02-07 14:38:54 -08:00
|
|
|
if (!PresShell())
|
2010-06-11 21:04:35 -07:00
|
|
|
return; // Already shutdown
|
2007-10-10 09:51:45 -07:00
|
|
|
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessibleWrap::Shutdown();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
Relation
|
2013-10-19 11:19:50 -07:00
|
|
|
RootAccessible::RelationByType(RelationType aType)
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
2013-10-19 11:19:50 -07:00
|
|
|
if (!mDocumentNode || aType != RelationType::EMBEDS)
|
2012-05-27 02:01:40 -07:00
|
|
|
return DocAccessibleWrap::RelationByType(aType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-11-22 14:15:25 -08:00
|
|
|
nsIDOMWindow* rootWindow = mDocumentNode->GetWindow();
|
2012-01-30 22:40:06 -08:00
|
|
|
if (rootWindow) {
|
|
|
|
nsCOMPtr<nsIDOMWindow> contentWindow;
|
|
|
|
rootWindow->GetContent(getter_AddRefs(contentWindow));
|
|
|
|
if (contentWindow) {
|
|
|
|
nsCOMPtr<nsIDOMDocument> contentDOMDocument;
|
|
|
|
contentWindow->GetDocument(getter_AddRefs(contentDOMDocument));
|
|
|
|
nsCOMPtr<nsIDocument> contentDocumentNode =
|
|
|
|
do_QueryInterface(contentDOMDocument);
|
|
|
|
if (contentDocumentNode) {
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessible* contentDocument =
|
2012-01-30 22:40:06 -08:00
|
|
|
GetAccService()->GetDocAccessible(contentDocumentNode);
|
|
|
|
if (contentDocument)
|
|
|
|
return Relation(contentDocument);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-02-10 02:03:30 -08:00
|
|
|
|
2012-01-30 22:40:06 -08:00
|
|
|
return Relation();
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
|
2009-12-10 11:12:19 -08:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Protected members
|
|
|
|
|
2011-01-18 00:03:38 -08:00
|
|
|
void
|
2012-05-28 18:18:45 -07:00
|
|
|
RootAccessible::HandlePopupShownEvent(Accessible* aAccessible)
|
2008-12-03 01:04:02 -08:00
|
|
|
{
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::Role role = aAccessible->Role();
|
2008-12-03 01:04:02 -08:00
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
if (role == roles::MENUPOPUP) {
|
2008-12-03 01:04:02 -08:00
|
|
|
// Don't fire menupopup events for combobox and autocomplete lists.
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
|
|
|
|
aAccessible);
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2008-12-03 01:04:02 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
if (role == roles::TOOLTIP) {
|
2008-12-03 01:04:02 -08:00
|
|
|
// There is a single <xul:tooltip> node which Mozilla moves around.
|
|
|
|
// The accessible for it stays the same no matter where it moves.
|
|
|
|
// AT's expect to get an EVENT_SHOW for the tooltip.
|
|
|
|
// In event callback the tooltip's accessible will be ready.
|
2010-01-18 08:16:07 -08:00
|
|
|
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SHOW, aAccessible);
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2008-12-03 01:04:02 -08:00
|
|
|
}
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
if (role == roles::COMBOBOX_LIST) {
|
2008-12-03 01:04:02 -08:00
|
|
|
// Fire expanded state change event for comboboxes and autocompeletes.
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* combobox = aAccessible->Parent();
|
2011-01-18 00:03:38 -08:00
|
|
|
if (!combobox)
|
|
|
|
return;
|
2010-09-06 19:41:53 -07:00
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::Role comboboxRole = combobox->Role();
|
|
|
|
if (comboboxRole == roles::COMBOBOX ||
|
|
|
|
comboboxRole == roles::AUTOCOMPLETE) {
|
2010-08-24 19:08:28 -07:00
|
|
|
nsRefPtr<AccEvent> event =
|
2011-10-17 07:59:28 -07:00
|
|
|
new AccStateChangeEvent(combobox, states::EXPANDED, true);
|
2011-01-18 00:03:38 -08:00
|
|
|
if (event)
|
|
|
|
nsEventShell::FireEvent(event);
|
2008-12-03 01:04:02 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-01-18 00:03:38 -08:00
|
|
|
void
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
|
2008-12-03 01:04:02 -08:00
|
|
|
{
|
2011-09-27 18:46:11 -07:00
|
|
|
// 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.
|
2012-05-27 02:01:40 -07:00
|
|
|
DocAccessible* document = nsAccUtils::GetDocAccessibleFor(aPopupNode);
|
2011-09-27 18:46:11 -07:00
|
|
|
if (!document)
|
|
|
|
return;
|
2010-01-27 03:43:25 -08:00
|
|
|
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* popup = document->GetAccessible(aPopupNode);
|
2011-09-27 18:46:11 -07:00
|
|
|
if (!popup) {
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* popupContainer = document->GetContainerAccessible(aPopupNode);
|
2011-09-27 18:46:11 -07:00
|
|
|
if (!popupContainer)
|
|
|
|
return;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t childCount = popupContainer->ChildCount();
|
|
|
|
for (uint32_t idx = 0; idx < childCount; idx++) {
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* child = popupContainer->GetChildAt(idx);
|
2011-09-27 18:46:11 -07:00
|
|
|
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;
|
2008-12-03 01:04:02 -08:00
|
|
|
}
|
|
|
|
|
2011-09-27 18:46:11 -07:00
|
|
|
// 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.
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
static const uint32_t kNotifyOfFocus = 1;
|
|
|
|
static const uint32_t kNotifyOfState = 2;
|
|
|
|
uint32_t notifyOf = 0;
|
2011-09-27 18:46:11 -07:00
|
|
|
|
|
|
|
// 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.
|
2012-07-30 07:20:58 -07:00
|
|
|
Accessible* widget = nullptr;
|
2011-09-27 18:46:11 -07:00
|
|
|
if (popup->IsCombobox()) {
|
|
|
|
widget = popup;
|
|
|
|
} else {
|
|
|
|
widget = popup->ContainerWidget();
|
|
|
|
if (!widget) {
|
|
|
|
if (!popup->IsMenuPopup())
|
|
|
|
return;
|
2008-12-03 01:04:02 -08:00
|
|
|
|
2011-09-27 18:46:11 -07:00
|
|
|
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.
|
2012-05-28 18:18:45 -07:00
|
|
|
Accessible* compositeWidget = widget->ContainerWidget();
|
2011-09-27 18:46:11 -07:00
|
|
|
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) {
|
2012-07-30 07:20:58 -07:00
|
|
|
FocusMgr()->ActiveItemChanged(nullptr);
|
2012-10-04 02:57:09 -07:00
|
|
|
#ifdef A11Y_LOG
|
2012-09-26 16:53:23 -07:00
|
|
|
if (logging::IsEnabled(logging::eFocus))
|
|
|
|
logging::ActiveItemChangeCausedBy("popuphiding", popup);
|
|
|
|
#endif
|
2011-09-27 18:46:11 -07:00
|
|
|
}
|
2010-09-06 19:41:53 -07:00
|
|
|
|
2011-09-27 18:46:11 -07:00
|
|
|
// Fire expanded state change event.
|
|
|
|
if (notifyOf & kNotifyOfState) {
|
2010-08-24 19:08:28 -07:00
|
|
|
nsRefPtr<AccEvent> event =
|
2011-10-17 07:59:28 -07:00
|
|
|
new AccStateChangeEvent(widget, states::EXPANDED, false);
|
2012-11-19 20:53:38 -08:00
|
|
|
document->FireDelayedEvent(event);
|
2008-12-03 01:04:02 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-09-05 04:30:19 -07:00
|
|
|
#ifdef MOZ_XUL
|
2011-01-18 00:03:38 -08:00
|
|
|
void
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
|
2012-06-10 16:44:50 -07:00
|
|
|
XULTreeAccessible* aAccessible)
|
2008-02-08 04:55:57 -08:00
|
|
|
{
|
2014-03-20 20:59:59 -07:00
|
|
|
nsCOMPtr<nsIDOMCustomEvent> customEvent(do_QueryInterface(aEvent));
|
|
|
|
if (!customEvent)
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2014-03-20 20:59:59 -07:00
|
|
|
nsCOMPtr<nsIVariant> detailVariant;
|
|
|
|
customEvent->GetDetail(getter_AddRefs(detailVariant));
|
|
|
|
if (!detailVariant)
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2014-03-20 20:59:59 -07:00
|
|
|
nsCOMPtr<nsISupports> supports;
|
|
|
|
detailVariant->GetAsISupports(getter_AddRefs(supports));
|
|
|
|
nsCOMPtr<nsIPropertyBag2> propBag(do_QueryInterface(supports));
|
|
|
|
if (!propBag)
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2014-03-20 20:59:59 -07:00
|
|
|
nsresult rv;
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t index, count;
|
2014-03-20 20:59:59 -07:00
|
|
|
rv = propBag->GetPropertyAsInt32(NS_LITERAL_STRING("index"), &index);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return;
|
|
|
|
|
|
|
|
rv = propBag->GetPropertyAsInt32(NS_LITERAL_STRING("count"), &count);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return;
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2009-06-29 08:38:17 -07:00
|
|
|
aAccessible->InvalidateCache(index, count);
|
2008-02-08 04:55:57 -08:00
|
|
|
}
|
|
|
|
|
2011-01-18 00:03:38 -08:00
|
|
|
void
|
2012-05-03 23:09:22 -07:00
|
|
|
RootAccessible::HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
|
2012-06-10 16:44:50 -07:00
|
|
|
XULTreeAccessible* aAccessible)
|
2008-02-08 04:55:57 -08:00
|
|
|
{
|
2014-03-20 20:59:59 -07:00
|
|
|
nsCOMPtr<nsIDOMCustomEvent> customEvent(do_QueryInterface(aEvent));
|
|
|
|
if (!customEvent)
|
2011-01-18 00:03:38 -08:00
|
|
|
return;
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2014-03-20 20:59:59 -07:00
|
|
|
nsCOMPtr<nsIVariant> detailVariant;
|
|
|
|
customEvent->GetDetail(getter_AddRefs(detailVariant));
|
|
|
|
if (!detailVariant)
|
|
|
|
return;
|
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> supports;
|
|
|
|
detailVariant->GetAsISupports(getter_AddRefs(supports));
|
|
|
|
nsCOMPtr<nsIPropertyBag2> propBag(do_QueryInterface(supports));
|
|
|
|
if (!propBag)
|
|
|
|
return;
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2014-03-20 20:59:59 -07:00
|
|
|
int32_t startRow = 0, endRow = -1, startCol = 0, endCol = -1;
|
|
|
|
propBag->GetPropertyAsInt32(NS_LITERAL_STRING("startrow"),
|
|
|
|
&startRow);
|
|
|
|
propBag->GetPropertyAsInt32(NS_LITERAL_STRING("endrow"),
|
|
|
|
&endRow);
|
|
|
|
propBag->GetPropertyAsInt32(NS_LITERAL_STRING("startcolumn"),
|
|
|
|
&startCol);
|
|
|
|
propBag->GetPropertyAsInt32(NS_LITERAL_STRING("endcolumn"),
|
|
|
|
&endCol);
|
2008-02-08 04:55:57 -08:00
|
|
|
|
2009-06-29 08:38:17 -07:00
|
|
|
aAccessible->TreeViewInvalidated(startRow, endRow, startCol, endCol);
|
2008-02-08 04:55:57 -08:00
|
|
|
}
|
2008-09-05 04:30:19 -07:00
|
|
|
#endif
|