2001-09-25 04:48:50 +04:00
|
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
2001-02-14 23:51:33 +03:00
|
|
|
|
|
2012-04-13 18:17:03 +04:00
|
|
|
|
#include "Accessible-inl.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
|
2009-05-14 09:29:33 +04:00
|
|
|
|
#include "nsIXBLAccessible.h"
|
2010-03-17 09:02:28 +03:00
|
|
|
|
|
2016-03-31 00:55:56 +03:00
|
|
|
|
#include "EmbeddedObjCollector.h"
|
2010-07-03 07:11:35 +04:00
|
|
|
|
#include "AccGroupInfo.h"
|
2010-06-21 17:08:27 +04:00
|
|
|
|
#include "AccIterator.h"
|
2010-04-27 10:52:03 +04:00
|
|
|
|
#include "nsAccUtils.h"
|
|
|
|
|
#include "nsAccessibilityService.h"
|
2013-10-25 19:14:32 +04:00
|
|
|
|
#include "ApplicationAccessible.h"
|
2016-04-07 16:30:22 +03:00
|
|
|
|
#include "NotificationController.h"
|
2012-02-20 19:45:29 +04:00
|
|
|
|
#include "nsEventShell.h"
|
2010-04-27 10:52:03 +04:00
|
|
|
|
#include "nsTextEquivUtils.h"
|
2015-06-04 18:32:51 +03:00
|
|
|
|
#include "DocAccessibleChild.h"
|
2016-04-07 16:30:22 +03:00
|
|
|
|
#include "EventTree.h"
|
2011-08-10 05:44:00 +04:00
|
|
|
|
#include "Relation.h"
|
2012-01-12 07:07:35 +04:00
|
|
|
|
#include "Role.h"
|
2012-05-04 10:09:22 +04:00
|
|
|
|
#include "RootAccessible.h"
|
2011-04-10 03:38:06 +04:00
|
|
|
|
#include "States.h"
|
2012-02-20 19:45:29 +04:00
|
|
|
|
#include "StyleInfo.h"
|
2013-02-14 14:57:35 +04:00
|
|
|
|
#include "TableAccessible.h"
|
|
|
|
|
#include "TableCellAccessible.h"
|
2012-11-19 13:20:09 +04:00
|
|
|
|
#include "TreeWalker.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
|
2001-05-12 01:11:38 +04:00
|
|
|
|
#include "nsIDOMElement.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "nsIDOMNodeFilter.h"
|
2011-10-30 00:03:55 +04:00
|
|
|
|
#include "nsIDOMHTMLElement.h"
|
2013-10-22 17:27:36 +04:00
|
|
|
|
#include "nsIDOMKeyEvent.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "nsIDOMTreeWalker.h"
|
|
|
|
|
#include "nsIDOMXULButtonElement.h"
|
2005-06-24 20:29:15 +04:00
|
|
|
|
#include "nsIDOMXULDocument.h"
|
2001-11-07 03:12:16 +03:00
|
|
|
|
#include "nsIDOMXULElement.h"
|
|
|
|
|
#include "nsIDOMXULLabelElement.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "nsIDOMXULSelectCntrlEl.h"
|
|
|
|
|
#include "nsIDOMXULSelectCntrlItemEl.h"
|
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
|
|
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
|
#include "nsIContent.h"
|
2005-06-24 20:29:15 +04:00
|
|
|
|
#include "nsIForm.h"
|
|
|
|
|
#include "nsIFormControl.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
|
2012-09-14 06:55:18 +04:00
|
|
|
|
#include "nsDeckFrame.h"
|
2011-05-30 22:23:36 +04:00
|
|
|
|
#include "nsLayoutUtils.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "nsIPresShell.h"
|
2012-05-10 17:43:04 +04:00
|
|
|
|
#include "nsIStringBundle.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "nsPresContext.h"
|
|
|
|
|
#include "nsIFrame.h"
|
2013-01-03 17:23:11 +04:00
|
|
|
|
#include "nsView.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
2008-03-06 06:45:43 +03:00
|
|
|
|
#include "nsIScrollableFrame.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 22:00:39 +04:00
|
|
|
|
#include "nsFocusManager.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
|
|
|
|
|
#include "nsXPIDLString.h"
|
|
|
|
|
#include "nsUnicharUtils.h"
|
2007-09-25 05:19:03 +04:00
|
|
|
|
#include "nsReadableUtils.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "prdtoa.h"
|
|
|
|
|
#include "nsIAtom.h"
|
2004-06-05 21:57:00 +04:00
|
|
|
|
#include "nsIURI.h"
|
2009-02-10 13:03:30 +03:00
|
|
|
|
#include "nsArrayUtils.h"
|
2006-04-12 19:43:32 +04:00
|
|
|
|
#include "nsIMutableArray.h"
|
2007-04-13 10:03:30 +04:00
|
|
|
|
#include "nsIObserverService.h"
|
2007-08-10 17:03:52 +04:00
|
|
|
|
#include "nsIServiceManager.h"
|
2007-11-12 04:05:37 +03:00
|
|
|
|
#include "nsWhitespaceTokenizer.h"
|
2008-03-13 20:39:18 +03:00
|
|
|
|
#include "nsAttrName.h"
|
2001-05-12 01:11:38 +04:00
|
|
|
|
|
2012-06-25 23:59:42 +04:00
|
|
|
|
#ifdef DEBUG
|
2001-05-12 01:11:38 +04:00
|
|
|
|
#include "nsIDOMCharacterData.h"
|
|
|
|
|
#endif
|
2001-02-14 23:51:33 +03:00
|
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
|
#include "mozilla/Assertions.h"
|
2014-05-22 08:06:05 +04:00
|
|
|
|
#include "mozilla/BasicEvents.h"
|
2014-04-03 08:18:36 +04:00
|
|
|
|
#include "mozilla/EventStates.h"
|
2013-11-20 01:01:15 +04:00
|
|
|
|
#include "mozilla/FloatingPoint.h"
|
2013-09-25 15:21:18 +04:00
|
|
|
|
#include "mozilla/MouseEvents.h"
|
2010-08-19 06:14:50 +04:00
|
|
|
|
#include "mozilla/unused.h"
|
2011-06-03 10:01:02 +04:00
|
|
|
|
#include "mozilla/Preferences.h"
|
2014-05-19 03:43:00 +04:00
|
|
|
|
#include "mozilla/dom/CanvasRenderingContext2D.h"
|
2011-07-20 23:18:54 +04:00
|
|
|
|
#include "mozilla/dom/Element.h"
|
2014-05-19 03:43:00 +04:00
|
|
|
|
#include "mozilla/dom/HTMLCanvasElement.h"
|
2016-03-04 18:36:18 +03:00
|
|
|
|
#include "mozilla/dom/HTMLBodyElement.h"
|
2014-01-21 01:52:04 +04:00
|
|
|
|
#include "mozilla/dom/TreeWalker.h"
|
2011-06-03 10:01:02 +04:00
|
|
|
|
|
|
|
|
|
using namespace mozilla;
|
2011-07-27 16:43:01 +04:00
|
|
|
|
using namespace mozilla::a11y;
|
2010-08-19 06:14:50 +04:00
|
|
|
|
|
2001-02-14 23:51:33 +03:00
|
|
|
|
|
2008-08-06 16:19:56 +04:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2013-10-29 07:30:55 +04:00
|
|
|
|
// Accessible: nsISupports and cycle collection
|
2008-08-06 16:19:56 +04:00
|
|
|
|
|
2016-04-12 18:20:56 +03:00
|
|
|
|
NS_IMPL_CYCLE_COLLECTION(Accessible, mContent)
|
2008-08-06 16:19:56 +04:00
|
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(Accessible)
|
|
|
|
|
if (aIID.Equals(NS_GET_IID(Accessible)))
|
2014-10-22 04:49:28 +04:00
|
|
|
|
foundInterface = this;
|
2013-10-29 07:30:55 +04:00
|
|
|
|
else
|
2014-10-22 04:49:28 +04:00
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, Accessible)
|
2013-10-29 07:30:55 +04:00
|
|
|
|
NS_INTERFACE_MAP_END
|
2005-07-14 18:20:21 +04:00
|
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(Accessible)
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(Accessible, LastRelease())
|
2003-04-02 00:02:51 +04:00
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::Accessible(nsIContent* aContent, DocAccessible* aDoc) :
|
2013-10-29 07:30:55 +04:00
|
|
|
|
mContent(aContent), mDoc(aDoc),
|
2016-04-06 00:34:00 +03:00
|
|
|
|
mParent(nullptr), mIndexInParent(-1),
|
2016-07-18 19:40:53 +03:00
|
|
|
|
mRoleMapEntryIndex(aria::NO_ROLE_MAP_ENTRY_INDEX),
|
|
|
|
|
mStateFlags(0), mContextFlags(0), mType(0), mGenericTypes(0)
|
2001-02-14 23:51:33 +03:00
|
|
|
|
{
|
2015-01-20 00:34:14 +03:00
|
|
|
|
mBits.groupInfo = nullptr;
|
2015-10-08 21:40:31 +03:00
|
|
|
|
mInt.mIndexOfEmbeddedChild = -1;
|
2001-02-14 23:51:33 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::~Accessible()
|
2001-02-14 23:51:33 +03:00
|
|
|
|
{
|
2013-10-29 07:30:55 +04:00
|
|
|
|
NS_ASSERTION(!mDoc, "LastRelease was never called!?!");
|
2001-02-14 23:51:33 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-01 07:08:31 +04:00
|
|
|
|
ENameValueFlag
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::Name(nsString& aName)
|
2012-05-01 07:08:31 +04:00
|
|
|
|
{
|
|
|
|
|
aName.Truncate();
|
|
|
|
|
|
2012-10-13 10:34:21 +04:00
|
|
|
|
if (!HasOwnContent())
|
|
|
|
|
return eNameOK;
|
|
|
|
|
|
|
|
|
|
ARIAName(aName);
|
2008-10-10 16:26:55 +04:00
|
|
|
|
if (!aName.IsEmpty())
|
2012-05-01 07:08:31 +04:00
|
|
|
|
return eNameOK;
|
2005-04-04 21:28:27 +04:00
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
nsCOMPtr<nsIXBLAccessible> xblAccessible(do_QueryInterface(mContent));
|
2009-05-14 09:29:33 +04:00
|
|
|
|
if (xblAccessible) {
|
2009-06-25 03:18:46 +04:00
|
|
|
|
xblAccessible->GetAccessibleName(aName);
|
2009-05-14 09:29:33 +04:00
|
|
|
|
if (!aName.IsEmpty())
|
2012-05-01 07:08:31 +04:00
|
|
|
|
return eNameOK;
|
2009-05-14 09:29:33 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
|
ENameValueFlag nameFlag = NativeName(aName);
|
2008-12-03 10:21:08 +03:00
|
|
|
|
if (!aName.IsEmpty())
|
2012-10-17 10:38:16 +04:00
|
|
|
|
return nameFlag;
|
2008-12-03 10:21:08 +03:00
|
|
|
|
|
|
|
|
|
// In the end get the name from tooltip.
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsHTMLElement()) {
|
2012-05-01 07:08:31 +04:00
|
|
|
|
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
|
|
|
|
aName.CompressWhitespace();
|
|
|
|
|
return eNameFromTooltip;
|
|
|
|
|
}
|
2015-03-03 14:08:59 +03:00
|
|
|
|
} else if (mContent->IsXULElement()) {
|
2012-05-01 07:08:31 +04:00
|
|
|
|
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
|
|
|
|
aName.CompressWhitespace();
|
|
|
|
|
return eNameFromTooltip;
|
|
|
|
|
}
|
2015-03-03 14:08:59 +03:00
|
|
|
|
} else if (mContent->IsSVGElement()) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
// If user agents need to choose among multiple ‘desc’ or ‘title’ elements
|
|
|
|
|
// for processing, the user agent shall choose the first one.
|
|
|
|
|
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
|
|
|
|
childElm = childElm->GetNextSibling()) {
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (childElm->IsSVGElement(nsGkAtoms::desc)) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
|
|
|
|
|
return eNameFromTooltip;
|
|
|
|
|
}
|
|
|
|
|
}
|
2008-12-03 10:21:08 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
|
if (nameFlag != eNoNameOnPurpose)
|
2011-10-17 18:59:28 +04:00
|
|
|
|
aName.SetIsVoid(true);
|
2009-02-27 13:54:39 +03:00
|
|
|
|
|
2012-10-17 10:38:16 +04:00
|
|
|
|
return nameFlag;
|
2001-08-09 08:58:01 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-23 17:14:05 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::Description(nsString& aDescription)
|
2011-04-23 17:14:05 +04:00
|
|
|
|
{
|
2005-06-01 18:03:38 +04:00
|
|
|
|
// There are 4 conditions that make an accessible have no accDescription:
|
2002-08-10 11:46:31 +04:00
|
|
|
|
// 1. it's a text node; or
|
2005-06-01 18:03:38 +04:00
|
|
|
|
// 2. It has no DHTML describedby property
|
|
|
|
|
// 3. it doesn't have an accName; or
|
2014-05-23 04:10:19 +04:00
|
|
|
|
// 4. its title attribute already equals to its accName nsAutoString name;
|
2009-04-24 18:40:18 +04:00
|
|
|
|
|
2012-10-13 10:34:21 +04:00
|
|
|
|
if (!HasOwnContent() || mContent->IsNodeOfType(nsINode::eTEXT))
|
2011-04-23 17:14:05 +04:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
nsTextEquivUtils::
|
2011-06-04 01:35:17 +04:00
|
|
|
|
GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby,
|
2011-04-23 17:14:05 +04:00
|
|
|
|
aDescription);
|
|
|
|
|
|
|
|
|
|
if (aDescription.IsEmpty()) {
|
2016-05-23 01:12:54 +03:00
|
|
|
|
NativeDescription(aDescription);
|
2011-04-23 17:14:05 +04:00
|
|
|
|
|
2012-12-31 12:04:08 +04:00
|
|
|
|
if (aDescription.IsEmpty()) {
|
|
|
|
|
// Keep the Name() method logic.
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsHTMLElement()) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, aDescription);
|
2015-03-03 14:08:59 +03:00
|
|
|
|
} else if (mContent->IsXULElement()) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aDescription);
|
2015-03-03 14:08:59 +03:00
|
|
|
|
} else if (mContent->IsSVGElement()) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
|
|
|
|
childElm = childElm->GetNextSibling()) {
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (childElm->IsSVGElement(nsGkAtoms::desc)) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
nsTextEquivUtils::AppendTextEquivFromContent(this, childElm,
|
|
|
|
|
&aDescription);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2005-06-01 18:03:38 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2002-08-10 11:46:31 +04:00
|
|
|
|
}
|
2012-12-31 12:04:08 +04:00
|
|
|
|
}
|
2014-09-18 16:52:05 +04:00
|
|
|
|
|
|
|
|
|
if (!aDescription.IsEmpty()) {
|
|
|
|
|
aDescription.CompressWhitespace();
|
|
|
|
|
nsAutoString name;
|
2014-09-29 22:28:48 +04:00
|
|
|
|
Name(name);
|
2014-09-18 16:52:05 +04:00
|
|
|
|
// Don't expose a description if it is the same as the name.
|
|
|
|
|
if (aDescription.Equals(name))
|
|
|
|
|
aDescription.Truncate();
|
|
|
|
|
}
|
2002-08-10 11:46:31 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
|
KeyBinding
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::AccessKey() const
|
2011-07-19 12:30:24 +04:00
|
|
|
|
{
|
2012-10-13 10:34:21 +04:00
|
|
|
|
if (!HasOwnContent())
|
|
|
|
|
return KeyBinding();
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t key = nsCoreUtils::GetAccessKeyFor(mContent);
|
2010-06-11 12:23:18 +04:00
|
|
|
|
if (!key && mContent->IsElement()) {
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* label = nullptr;
|
2010-11-20 05:37:18 +03:00
|
|
|
|
|
|
|
|
|
// Copy access key from label node.
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsHTMLElement()) {
|
2010-11-20 05:37:18 +03:00
|
|
|
|
// Unless it is labeled via an ancestor <label>, in which case that would
|
|
|
|
|
// be redundant.
|
2011-11-10 02:52:00 +04:00
|
|
|
|
HTMLLabelIterator iter(Document(), this,
|
2010-11-20 05:37:18 +03:00
|
|
|
|
HTMLLabelIterator::eSkipAncestorLabel);
|
|
|
|
|
label = iter.Next();
|
|
|
|
|
|
2015-03-03 14:08:59 +03:00
|
|
|
|
} else if (mContent->IsXULElement()) {
|
2011-11-10 02:52:00 +04:00
|
|
|
|
XULLabelIterator iter(Document(), mContent);
|
2010-11-20 05:37:18 +03:00
|
|
|
|
label = iter.Next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (label)
|
|
|
|
|
key = nsCoreUtils::GetAccessKeyFor(label->GetContent());
|
2007-08-29 10:52:46 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!key)
|
2011-07-19 12:30:24 +04:00
|
|
|
|
return KeyBinding();
|
2007-08-29 10:52:46 +04:00
|
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
|
// Get modifier mask. Use ui.key.generalAccessKey (unless it is -1).
|
|
|
|
|
switch (Preferences::GetInt("ui.key.generalAccessKey", -1)) {
|
|
|
|
|
case -1:
|
|
|
|
|
break;
|
|
|
|
|
case nsIDOMKeyEvent::DOM_VK_SHIFT:
|
|
|
|
|
return KeyBinding(key, KeyBinding::kShift);
|
|
|
|
|
case nsIDOMKeyEvent::DOM_VK_CONTROL:
|
|
|
|
|
return KeyBinding(key, KeyBinding::kControl);
|
|
|
|
|
case nsIDOMKeyEvent::DOM_VK_ALT:
|
|
|
|
|
return KeyBinding(key, KeyBinding::kAlt);
|
|
|
|
|
case nsIDOMKeyEvent::DOM_VK_META:
|
|
|
|
|
return KeyBinding(key, KeyBinding::kMeta);
|
|
|
|
|
default:
|
|
|
|
|
return KeyBinding();
|
2007-08-29 10:52:46 +04:00
|
|
|
|
}
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
|
|
// Determine the access modifier used in this context.
|
2016-03-31 14:46:32 +03:00
|
|
|
|
nsIDocument* document = mContent->GetUncomposedDoc();
|
2011-07-19 12:30:24 +04:00
|
|
|
|
if (!document)
|
|
|
|
|
return KeyBinding();
|
2013-11-15 20:32:12 +04:00
|
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> treeItem(document->GetDocShell());
|
2011-07-19 12:30:24 +04:00
|
|
|
|
if (!treeItem)
|
|
|
|
|
return KeyBinding();
|
|
|
|
|
|
|
|
|
|
nsresult rv = NS_ERROR_FAILURE;
|
2014-01-20 11:58:26 +04:00
|
|
|
|
int32_t modifierMask = 0;
|
|
|
|
|
switch (treeItem->ItemType()) {
|
2011-07-19 12:30:24 +04:00
|
|
|
|
case nsIDocShellTreeItem::typeChrome:
|
|
|
|
|
rv = Preferences::GetInt("ui.key.chromeAccess", &modifierMask);
|
|
|
|
|
break;
|
|
|
|
|
case nsIDocShellTreeItem::typeContent:
|
|
|
|
|
rv = Preferences::GetInt("ui.key.contentAccess", &modifierMask);
|
|
|
|
|
break;
|
2007-08-29 10:52:46 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
|
return NS_SUCCEEDED(rv) ? KeyBinding(key, modifierMask) : KeyBinding();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
KeyBinding
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::KeyboardShortcut() const
|
2011-07-19 12:30:24 +04:00
|
|
|
|
{
|
|
|
|
|
return KeyBinding();
|
2002-05-09 00:43:49 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-23 04:10:19 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::TranslateString(const nsString& aKey, nsAString& aStringOut)
|
2001-05-12 01:11:38 +04:00
|
|
|
|
{
|
2012-05-10 17:43:04 +04:00
|
|
|
|
nsCOMPtr<nsIStringBundleService> stringBundleService =
|
|
|
|
|
services::GetStringBundleService();
|
|
|
|
|
if (!stringBundleService)
|
|
|
|
|
return;
|
2002-05-09 00:43:49 +04:00
|
|
|
|
|
2012-05-10 17:43:04 +04:00
|
|
|
|
nsCOMPtr<nsIStringBundle> stringBundle;
|
|
|
|
|
stringBundleService->CreateBundle(
|
2014-05-23 04:10:19 +04:00
|
|
|
|
"chrome://global-platform/locale/accessible.properties",
|
2012-05-10 17:43:04 +04:00
|
|
|
|
getter_AddRefs(stringBundle));
|
|
|
|
|
if (!stringBundle)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
nsXPIDLString xsValue;
|
|
|
|
|
nsresult rv = stringBundle->GetStringFromName(aKey.get(), getter_Copies(xsValue));
|
|
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
|
aStringOut.Assign(xsValue);
|
2001-05-12 01:11:38 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::VisibilityState()
|
2001-10-03 04:18:48 +04:00
|
|
|
|
{
|
2012-01-06 07:45:11 +04:00
|
|
|
|
nsIFrame* frame = GetFrame();
|
2012-01-23 22:24:13 +04:00
|
|
|
|
if (!frame)
|
2012-09-14 06:55:18 +04:00
|
|
|
|
return states::INVISIBLE;
|
|
|
|
|
|
|
|
|
|
// Walk the parent frame chain to see if there's invisible parent or the frame
|
|
|
|
|
// is in background tab.
|
2013-02-17 01:51:02 +04:00
|
|
|
|
if (!frame->StyleVisibility()->IsVisible())
|
2012-09-14 06:55:18 +04:00
|
|
|
|
return states::INVISIBLE;
|
|
|
|
|
|
|
|
|
|
nsIFrame* curFrame = frame;
|
|
|
|
|
do {
|
2013-01-03 17:23:11 +04:00
|
|
|
|
nsView* view = curFrame->GetView();
|
2012-09-14 06:55:18 +04:00
|
|
|
|
if (view && view->GetVisibility() == nsViewVisibility_kHide)
|
|
|
|
|
return states::INVISIBLE;
|
|
|
|
|
|
2013-05-14 09:02:48 +04:00
|
|
|
|
if (nsLayoutUtils::IsPopup(curFrame))
|
|
|
|
|
return 0;
|
|
|
|
|
|
2012-11-16 14:12:45 +04:00
|
|
|
|
// Offscreen state for background tab content and invisible for not selected
|
|
|
|
|
// deck panel.
|
2012-09-14 06:55:18 +04:00
|
|
|
|
nsIFrame* parentFrame = curFrame->GetParent();
|
|
|
|
|
nsDeckFrame* deckFrame = do_QueryFrame(parentFrame);
|
2012-11-16 14:12:45 +04:00
|
|
|
|
if (deckFrame && deckFrame->GetSelectedBox() != curFrame) {
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (deckFrame->GetContent()->IsXULElement(nsGkAtoms::tabpanels))
|
2012-11-16 14:12:45 +04:00
|
|
|
|
return states::OFFSCREEN;
|
|
|
|
|
|
2012-12-28 12:15:02 +04:00
|
|
|
|
NS_NOTREACHED("Children of not selected deck panel are not accessible.");
|
2012-11-16 14:12:45 +04:00
|
|
|
|
return states::INVISIBLE;
|
|
|
|
|
}
|
2012-09-14 06:55:18 +04:00
|
|
|
|
|
2012-09-27 07:55:34 +04:00
|
|
|
|
// If contained by scrollable frame then check that at least 12 pixels
|
|
|
|
|
// around the object is visible, otherwise the object is offscreen.
|
|
|
|
|
nsIScrollableFrame* scrollableFrame = do_QueryFrame(parentFrame);
|
|
|
|
|
if (scrollableFrame) {
|
|
|
|
|
nsRect scrollPortRect = scrollableFrame->GetScrollPortRect();
|
2014-01-28 21:10:28 +04:00
|
|
|
|
nsRect frameRect = nsLayoutUtils::TransformFrameRectToAncestor(
|
|
|
|
|
frame, frame->GetRectRelativeToSelf(), parentFrame);
|
2012-09-27 07:55:34 +04:00
|
|
|
|
if (!scrollPortRect.Contains(frameRect)) {
|
|
|
|
|
const nscoord kMinPixels = nsPresContext::CSSPixelsToAppUnits(12);
|
|
|
|
|
scrollPortRect.Deflate(kMinPixels, kMinPixels);
|
|
|
|
|
if (!scrollPortRect.Intersects(frameRect))
|
|
|
|
|
return states::OFFSCREEN;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-09-14 06:55:18 +04:00
|
|
|
|
if (!parentFrame) {
|
|
|
|
|
parentFrame = nsLayoutUtils::GetCrossDocParentFrame(curFrame);
|
2013-02-17 01:51:02 +04:00
|
|
|
|
if (parentFrame && !parentFrame->StyleVisibility()->IsVisible())
|
2012-09-14 06:55:18 +04:00
|
|
|
|
return states::INVISIBLE;
|
|
|
|
|
}
|
2003-04-15 12:45:55 +04:00
|
|
|
|
|
2012-09-14 06:55:18 +04:00
|
|
|
|
curFrame = parentFrame;
|
|
|
|
|
} while (curFrame);
|
2012-01-06 07:45:11 +04:00
|
|
|
|
|
|
|
|
|
// Zero area rects can occur in the first frame of a multi-frame text flow,
|
|
|
|
|
// in which case the rendered text is not empty and the frame should not be
|
|
|
|
|
// marked invisible.
|
|
|
|
|
// XXX Can we just remove this check? Why do we need to mark empty
|
|
|
|
|
// text invisible?
|
|
|
|
|
if (frame->GetType() == nsGkAtoms::textFrame &&
|
|
|
|
|
!(frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
|
|
|
|
|
frame->GetRect().IsEmpty()) {
|
2015-11-30 16:21:25 +03:00
|
|
|
|
nsIFrame::RenderedText text = frame->GetRenderedText(0,
|
|
|
|
|
UINT32_MAX, nsIFrame::TextOffsetType::OFFSETS_IN_CONTENT_TEXT,
|
|
|
|
|
nsIFrame::TrailingWhitespace::DONT_TRIM_TRAILING_WHITESPACE);
|
2015-10-30 09:23:10 +03:00
|
|
|
|
if (text.mString.IsEmpty()) {
|
2012-09-14 06:55:18 +04:00
|
|
|
|
return states::INVISIBLE;
|
2015-10-30 09:23:10 +03:00
|
|
|
|
}
|
2007-04-23 19:41:26 +04:00
|
|
|
|
}
|
2009-09-09 09:40:02 +04:00
|
|
|
|
|
2012-09-14 06:55:18 +04:00
|
|
|
|
return 0;
|
2001-10-03 04:18:48 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::NativeState()
|
2007-04-02 19:56:24 +04:00
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t state = 0;
|
2011-08-04 13:54:06 +04:00
|
|
|
|
|
2012-06-12 18:30:59 +04:00
|
|
|
|
if (!IsInDocument())
|
2011-08-04 13:54:06 +04:00
|
|
|
|
state |= states::STALE;
|
|
|
|
|
|
2012-10-13 10:34:21 +04:00
|
|
|
|
if (HasOwnContent() && mContent->IsElement()) {
|
2014-04-03 08:18:36 +04:00
|
|
|
|
EventStates elementState = mContent->AsElement()->State();
|
2011-06-01 05:46:56 +04:00
|
|
|
|
|
2011-06-01 05:46:57 +04:00
|
|
|
|
if (elementState.HasState(NS_EVENT_STATE_INVALID))
|
2011-06-01 05:46:56 +04:00
|
|
|
|
state |= states::INVALID;
|
|
|
|
|
|
2011-06-01 05:46:57 +04:00
|
|
|
|
if (elementState.HasState(NS_EVENT_STATE_REQUIRED))
|
2011-06-01 05:46:56 +04:00
|
|
|
|
state |= states::REQUIRED;
|
|
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
|
state |= NativeInteractiveState();
|
2011-09-28 05:46:11 +04:00
|
|
|
|
if (FocusMgr()->IsFocused(this))
|
2011-04-10 03:38:06 +04:00
|
|
|
|
state |= states::FOCUSED;
|
2001-05-12 01:11:38 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-01-06 07:45:11 +04:00
|
|
|
|
// Gather states::INVISIBLE and states::OFFSCREEN flags for this object.
|
|
|
|
|
state |= VisibilityState();
|
2001-09-18 07:09:01 +04:00
|
|
|
|
|
2007-09-05 20:45:48 +04:00
|
|
|
|
nsIFrame *frame = GetFrame();
|
2012-07-23 21:59:36 +04:00
|
|
|
|
if (frame) {
|
|
|
|
|
if (frame->GetStateBits() & NS_FRAME_OUT_OF_FLOW)
|
|
|
|
|
state |= states::FLOATING;
|
|
|
|
|
|
|
|
|
|
// XXX we should look at layout for non XUL box frames, but need to decide
|
|
|
|
|
// how that interacts with ARIA.
|
2016-04-21 07:28:30 +03:00
|
|
|
|
if (HasOwnContent() && mContent->IsXULElement() && frame->IsXULBoxFrame()) {
|
2013-02-17 01:51:02 +04:00
|
|
|
|
const nsStyleXUL* xulStyle = frame->StyleXUL();
|
2016-04-21 07:28:30 +03:00
|
|
|
|
if (xulStyle && frame->IsXULBoxFrame()) {
|
2012-07-23 21:59:36 +04:00
|
|
|
|
// In XUL all boxes are either vertical or horizontal
|
|
|
|
|
if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL)
|
|
|
|
|
state |= states::VERTICAL;
|
|
|
|
|
else
|
|
|
|
|
state |= states::HORIZONTAL;
|
|
|
|
|
}
|
2012-07-17 18:41:59 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-07-23 21:59:36 +04:00
|
|
|
|
// Check if a XUL element has the popup attribute (an attached popup menu).
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (HasOwnContent() && mContent->IsXULElement() &&
|
2012-10-13 10:34:21 +04:00
|
|
|
|
mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
|
|
|
|
state |= states::HASPOPUP;
|
2012-07-23 21:59:36 +04:00
|
|
|
|
|
2012-05-17 13:37:37 +04:00
|
|
|
|
// Bypass the link states specialization for non links.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (!roleMapEntry || roleMapEntry->roleRule == kUseNativeRole ||
|
|
|
|
|
roleMapEntry->role == roles::LINK)
|
2012-05-17 13:37:37 +04:00
|
|
|
|
state |= NativeLinkState();
|
2008-03-31 10:21:35 +04:00
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
|
return state;
|
2001-04-06 05:42:48 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t
|
2012-06-04 09:41:06 +04:00
|
|
|
|
Accessible::NativeInteractiveState() const
|
|
|
|
|
{
|
|
|
|
|
if (!mContent->IsElement())
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
if (NativelyUnavailable())
|
|
|
|
|
return states::UNAVAILABLE;
|
|
|
|
|
|
|
|
|
|
nsIFrame* frame = GetFrame();
|
|
|
|
|
if (frame && frame->IsFocusable())
|
|
|
|
|
return states::FOCUSABLE;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::NativeLinkState() const
|
2012-05-17 13:37:37 +04:00
|
|
|
|
{
|
2012-11-10 12:39:44 +04:00
|
|
|
|
return 0;
|
2012-05-17 13:37:37 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
|
bool
|
|
|
|
|
Accessible::NativelyUnavailable() const
|
|
|
|
|
{
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsHTMLElement())
|
2012-06-04 09:41:06 +04:00
|
|
|
|
return mContent->AsElement()->State().HasState(NS_EVENT_STATE_DISABLED);
|
|
|
|
|
|
|
|
|
|
return mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::disabled,
|
|
|
|
|
nsGkAtoms::_true, eCaseMatters);
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
|
|
|
|
Accessible::FocusedChild()
|
2011-07-16 02:58:49 +04:00
|
|
|
|
{
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* focus = FocusMgr()->FocusedAccessible();
|
2011-09-28 05:46:11 +04:00
|
|
|
|
if (focus && (focus == this || focus->Parent() == this))
|
|
|
|
|
return focus;
|
2011-07-16 02:58:49 +04:00
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return nullptr;
|
2011-07-16 02:58:49 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::ChildAtPoint(int32_t aX, int32_t aY,
|
2012-05-29 05:18:45 +04:00
|
|
|
|
EWhichChildAtPoint aWhichChild)
|
2004-05-18 19:39:57 +04:00
|
|
|
|
{
|
2007-09-19 01:44:43 +04:00
|
|
|
|
// If we can't find the point in a child, we will return the fallback answer:
|
2012-07-30 18:20:58 +04:00
|
|
|
|
// we return |this| if the point is within it, otherwise nullptr.
|
|
|
|
|
Accessible* fallbackAnswer = nullptr;
|
2015-01-26 21:30:17 +03:00
|
|
|
|
nsIntRect rect = Bounds();
|
2014-09-16 21:30:23 +04:00
|
|
|
|
if (aX >= rect.x && aX < rect.x + rect.width &&
|
|
|
|
|
aY >= rect.y && aY < rect.y + rect.height)
|
2007-09-19 01:44:43 +04:00
|
|
|
|
fallbackAnswer = this;
|
2009-05-11 14:57:28 +04:00
|
|
|
|
|
2011-03-29 08:44:20 +04:00
|
|
|
|
if (nsAccUtils::MustPrune(this)) // Do not dig any further
|
|
|
|
|
return fallbackAnswer;
|
2007-09-19 01:44:43 +04:00
|
|
|
|
|
2007-09-05 12:00:40 +04:00
|
|
|
|
// Search an accessible at the given point starting from accessible document
|
|
|
|
|
// because containing block (see CSS2) for out of flow element (for example,
|
|
|
|
|
// absolutely positioned element) may be different from its DOM parent and
|
|
|
|
|
// therefore accessible for containing block may be different from accessible
|
|
|
|
|
// for DOM parent but GetFrameForPoint() should be called for containing block
|
|
|
|
|
// to get an out of flow element.
|
2012-05-27 13:01:40 +04:00
|
|
|
|
DocAccessible* accDocument = Document();
|
2012-07-30 18:20:58 +04:00
|
|
|
|
NS_ENSURE_TRUE(accDocument, nullptr);
|
Bug 109851, bug 108629, bug 109921, bug 109977, bug 109153, bug 109187, bug 109213, bug 109221. Check in latest XUL accessibility support - menus, <colorpicker>, <progressmeter>, <groupbox>, mixed states for checkboxes, buttons that can be 'checked' ie pressed down, fixes extra MSAA events being generated, couldn't see HTML content
2001-11-20 05:05:26 +03:00
|
|
|
|
|
2013-06-27 19:03:58 +04:00
|
|
|
|
nsIFrame* rootFrame = accDocument->GetFrame();
|
|
|
|
|
NS_ENSURE_TRUE(rootFrame, nullptr);
|
|
|
|
|
|
|
|
|
|
nsIFrame* startFrame = rootFrame;
|
|
|
|
|
|
|
|
|
|
// Check whether the point is at popup content.
|
|
|
|
|
nsIWidget* rootWidget = rootFrame->GetView()->GetNearestWidget(nullptr);
|
|
|
|
|
NS_ENSURE_TRUE(rootWidget, nullptr);
|
|
|
|
|
|
2015-11-10 08:37:32 +03:00
|
|
|
|
LayoutDeviceIntRect rootRect;
|
2013-06-27 19:03:58 +04:00
|
|
|
|
rootWidget->GetScreenBounds(rootRect);
|
|
|
|
|
|
2015-08-29 02:58:29 +03:00
|
|
|
|
WidgetMouseEvent dummyEvent(true, eMouseMove, rootWidget,
|
2013-10-02 10:38:27 +04:00
|
|
|
|
WidgetMouseEvent::eSynthesized);
|
2016-04-18 17:09:02 +03:00
|
|
|
|
dummyEvent.mRefPoint = LayoutDeviceIntPoint(aX - rootRect.x, aY - rootRect.y);
|
2013-06-27 19:03:58 +04:00
|
|
|
|
|
|
|
|
|
nsIFrame* popupFrame = nsLayoutUtils::
|
|
|
|
|
GetPopupFrameForEventCoordinates(accDocument->PresContext()->GetRootPresContext(),
|
|
|
|
|
&dummyEvent);
|
|
|
|
|
if (popupFrame) {
|
|
|
|
|
// If 'this' accessible is not inside the popup then ignore the popup when
|
|
|
|
|
// searching an accessible at point.
|
|
|
|
|
DocAccessible* popupDoc =
|
|
|
|
|
GetAccService()->GetDocAccessible(popupFrame->GetContent()->OwnerDoc());
|
|
|
|
|
Accessible* popupAcc =
|
|
|
|
|
popupDoc->GetAccessibleOrContainer(popupFrame->GetContent());
|
|
|
|
|
Accessible* popupChild = this;
|
|
|
|
|
while (popupChild && !popupChild->IsDoc() && popupChild != popupAcc)
|
|
|
|
|
popupChild = popupChild->Parent();
|
|
|
|
|
|
|
|
|
|
if (popupChild == popupAcc)
|
|
|
|
|
startFrame = popupFrame;
|
|
|
|
|
}
|
2007-09-05 12:00:40 +04:00
|
|
|
|
|
2013-06-27 19:03:58 +04:00
|
|
|
|
nsPresContext* presContext = startFrame->PresContext();
|
|
|
|
|
nsRect screenRect = startFrame->GetScreenRectInAppUnits();
|
|
|
|
|
nsPoint offset(presContext->DevPixelsToAppUnits(aX) - screenRect.x,
|
|
|
|
|
presContext->DevPixelsToAppUnits(aY) - screenRect.y);
|
|
|
|
|
nsIFrame* foundFrame = nsLayoutUtils::GetFrameForPoint(startFrame, offset);
|
2009-05-11 14:57:28 +04:00
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
|
nsIContent* content = nullptr;
|
2011-03-29 08:44:20 +04:00
|
|
|
|
if (!foundFrame || !(content = foundFrame->GetContent()))
|
|
|
|
|
return fallbackAnswer;
|
2007-09-05 12:00:40 +04:00
|
|
|
|
|
2010-07-01 06:18:08 +04:00
|
|
|
|
// Get accessible for the node with the point or the first accessible in
|
|
|
|
|
// the DOM parent chain.
|
2012-05-27 13:01:40 +04:00
|
|
|
|
DocAccessible* contentDocAcc = GetAccService()->
|
2012-02-16 01:51:04 +04:00
|
|
|
|
GetDocAccessible(content->OwnerDoc());
|
2012-02-24 11:31:24 +04:00
|
|
|
|
|
2013-04-03 04:33:43 +04:00
|
|
|
|
// contentDocAcc in some circumstances can be nullptr. See bug 729861
|
2012-02-25 00:36:01 +04:00
|
|
|
|
NS_ASSERTION(contentDocAcc, "could not get the document accessible");
|
|
|
|
|
if (!contentDocAcc)
|
|
|
|
|
return fallbackAnswer;
|
2012-02-24 11:31:24 +04:00
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* accessible = contentDocAcc->GetAccessibleOrContainer(content);
|
2011-03-29 08:44:20 +04:00
|
|
|
|
if (!accessible)
|
|
|
|
|
return fallbackAnswer;
|
2007-09-05 12:00:40 +04:00
|
|
|
|
|
2012-06-25 21:34:52 +04:00
|
|
|
|
// Hurray! We have an accessible for the frame that layout gave us.
|
2009-05-11 14:57:28 +04:00
|
|
|
|
// Since DOM node of obtained accessible may be out of flow then we should
|
|
|
|
|
// ensure obtained accessible is a child of this accessible.
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* child = accessible;
|
2012-06-25 21:34:52 +04:00
|
|
|
|
while (child != this) {
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* parent = child->Parent();
|
2008-09-17 17:11:39 +04:00
|
|
|
|
if (!parent) {
|
|
|
|
|
// Reached the top of the hierarchy. These bounds were inside an
|
|
|
|
|
// accessible that is not a descendant of this one.
|
2011-03-29 08:44:20 +04:00
|
|
|
|
return fallbackAnswer;
|
2008-09-17 17:11:39 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-06-25 21:34:52 +04:00
|
|
|
|
// If we landed on a legitimate child of |this|, and we want the direct
|
|
|
|
|
// child, return it here.
|
|
|
|
|
if (parent == this && aWhichChild == eDirectChild)
|
|
|
|
|
return child;
|
2011-03-29 08:44:20 +04:00
|
|
|
|
|
|
|
|
|
child = parent;
|
2007-09-19 01:44:43 +04:00
|
|
|
|
}
|
2007-09-05 12:00:40 +04:00
|
|
|
|
|
2012-06-25 21:34:52 +04:00
|
|
|
|
// Manually walk through accessible children and see if the are within this
|
|
|
|
|
// point. Skip offscreen or invisible accessibles. This takes care of cases
|
|
|
|
|
// where layout won't walk into things for us, such as image map areas and
|
|
|
|
|
// sub documents (XXX: subdocuments should be handled by methods of
|
|
|
|
|
// OuterDocAccessibles).
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t childCount = accessible->ChildCount();
|
|
|
|
|
for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) {
|
2012-06-25 21:34:52 +04:00
|
|
|
|
Accessible* child = accessible->GetChildAt(childIdx);
|
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsIntRect childRect = child->Bounds();
|
|
|
|
|
if (aX >= childRect.x && aX < childRect.x + childRect.width &&
|
|
|
|
|
aY >= childRect.y && aY < childRect.y + childRect.height &&
|
2012-06-25 21:34:52 +04:00
|
|
|
|
(child->State() & states::INVISIBLE) == 0) {
|
|
|
|
|
|
|
|
|
|
if (aWhichChild == eDeepestChild)
|
|
|
|
|
return child->ChildAtPoint(aX, aY, eDeepestChild);
|
|
|
|
|
|
|
|
|
|
return child;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return accessible;
|
2001-02-14 23:51:33 +03:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsRect
|
|
|
|
|
Accessible::RelativeBounds(nsIFrame** aBoundingFrame) const
|
2001-05-12 01:11:38 +04:00
|
|
|
|
{
|
2012-06-10 17:31:27 +04:00
|
|
|
|
nsIFrame* frame = GetFrame();
|
2014-02-21 17:36:58 +04:00
|
|
|
|
if (frame && mContent) {
|
2014-05-19 03:43:00 +04:00
|
|
|
|
bool* hasHitRegionRect = static_cast<bool*>(mContent->GetProperty(nsGkAtoms::hitregion));
|
2014-02-21 17:36:58 +04:00
|
|
|
|
|
2014-05-19 03:43:00 +04:00
|
|
|
|
if (hasHitRegionRect && mContent->IsElement()) {
|
2014-02-21 17:36:58 +04:00
|
|
|
|
// This is for canvas fallback content
|
|
|
|
|
// Find a canvas frame the found hit region is relative to.
|
|
|
|
|
nsIFrame* canvasFrame = frame->GetParent();
|
2014-05-19 03:43:00 +04:00
|
|
|
|
if (canvasFrame) {
|
|
|
|
|
canvasFrame = nsLayoutUtils::GetClosestFrameOfType(canvasFrame, nsGkAtoms::HTMLCanvasFrame);
|
|
|
|
|
}
|
2014-02-21 17:36:58 +04:00
|
|
|
|
|
|
|
|
|
// make the canvas the bounding frame
|
|
|
|
|
if (canvasFrame) {
|
|
|
|
|
*aBoundingFrame = canvasFrame;
|
2014-05-19 03:43:00 +04:00
|
|
|
|
dom::HTMLCanvasElement *canvas =
|
|
|
|
|
dom::HTMLCanvasElement::FromContent(canvasFrame->GetContent());
|
2014-02-21 17:36:58 +04:00
|
|
|
|
|
2014-05-19 03:43:00 +04:00
|
|
|
|
// get the bounding rect of the hit region
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsRect bounds;
|
2014-05-19 03:43:00 +04:00
|
|
|
|
if (canvas && canvas->CountContexts() &&
|
2014-09-16 21:30:23 +04:00
|
|
|
|
canvas->GetContextAtIndex(0)->GetHitRegionRect(mContent->AsElement(), bounds)) {
|
|
|
|
|
return bounds;
|
2014-05-19 03:43:00 +04:00
|
|
|
|
}
|
2014-02-21 17:36:58 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-06-10 17:31:27 +04:00
|
|
|
|
*aBoundingFrame = nsLayoutUtils::GetContainingBlockForClientRect(frame);
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return nsLayoutUtils::
|
2012-06-10 17:31:27 +04:00
|
|
|
|
GetAllInFlowRectsUnion(frame, *aBoundingFrame,
|
|
|
|
|
nsLayoutUtils::RECTS_ACCOUNT_FOR_TRANSFORMS);
|
2001-07-14 06:53:42 +04:00
|
|
|
|
}
|
2014-09-16 21:30:23 +04:00
|
|
|
|
|
|
|
|
|
return nsRect();
|
2001-05-12 01:11:38 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsIntRect
|
|
|
|
|
Accessible::Bounds() const
|
2001-05-12 01:11:38 +04:00
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
|
nsIFrame* boundingFrame = nullptr;
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsRect unionRectTwips = RelativeBounds(&boundingFrame);
|
|
|
|
|
if (!boundingFrame)
|
|
|
|
|
return nsIntRect();
|
2001-02-14 23:51:33 +03:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsIntRect screenRect;
|
2012-10-13 10:34:21 +04:00
|
|
|
|
nsPresContext* presContext = mDoc->PresContext();
|
2014-09-16 21:30:23 +04:00
|
|
|
|
screenRect.x = presContext->AppUnitsToDevPixels(unionRectTwips.x);
|
|
|
|
|
screenRect.y = presContext->AppUnitsToDevPixels(unionRectTwips.y);
|
|
|
|
|
screenRect.width = presContext->AppUnitsToDevPixels(unionRectTwips.width);
|
|
|
|
|
screenRect.height = presContext->AppUnitsToDevPixels(unionRectTwips.height);
|
2001-05-12 01:11:38 +04:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
// We have the union of the rectangle, now we need to put it in absolute
|
|
|
|
|
// screen coords.
|
2012-02-22 06:07:43 +04:00
|
|
|
|
nsIntRect orgRectPixels = boundingFrame->GetScreenRectInAppUnits().
|
|
|
|
|
ToNearestPixels(presContext->AppUnitsPerDevPixel());
|
2014-09-16 21:30:23 +04:00
|
|
|
|
screenRect.x += orgRectPixels.x;
|
|
|
|
|
screenRect.y += orgRectPixels.y;
|
2001-02-14 23:51:33 +03:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return screenRect;
|
2001-02-14 23:51:33 +03:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::SetSelected(bool aSelect)
|
2001-03-04 05:31:28 +03:00
|
|
|
|
{
|
2012-10-13 10:34:21 +04:00
|
|
|
|
if (!HasOwnContent())
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2012-10-13 10:34:21 +04:00
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* select = nsAccUtils::GetSelectableContainer(this, State());
|
2012-03-16 06:13:44 +04:00
|
|
|
|
if (select) {
|
|
|
|
|
if (select->State() & states::MULTISELECTABLE) {
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (ARIARoleMap()) {
|
2012-03-16 06:13:44 +04:00
|
|
|
|
if (aSelect) {
|
2014-09-16 21:30:23 +04:00
|
|
|
|
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_selected,
|
|
|
|
|
NS_LITERAL_STRING("true"), true);
|
|
|
|
|
} else {
|
|
|
|
|
mContent->UnsetAttr(kNameSpaceID_None, nsGkAtoms::aria_selected, true);
|
2012-03-16 06:13:44 +04:00
|
|
|
|
}
|
2007-09-25 05:19:03 +04:00
|
|
|
|
}
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2006-06-15 22:29:44 +04:00
|
|
|
|
}
|
2012-03-16 06:13:44 +04:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
if (aSelect)
|
|
|
|
|
TakeFocus();
|
2001-06-30 04:25:09 +04:00
|
|
|
|
}
|
2001-03-28 04:49:05 +04:00
|
|
|
|
}
|
2001-03-04 05:31:28 +03:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::TakeSelection()
|
2001-03-28 04:49:05 +04:00
|
|
|
|
{
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* select = nsAccUtils::GetSelectableContainer(this, State());
|
2012-03-16 06:13:44 +04:00
|
|
|
|
if (select) {
|
|
|
|
|
if (select->State() & states::MULTISELECTABLE)
|
2013-11-03 05:56:59 +04:00
|
|
|
|
select->UnselectAll();
|
2014-09-16 21:30:23 +04:00
|
|
|
|
SetSelected(true);
|
2001-06-30 04:25:09 +04:00
|
|
|
|
}
|
2001-03-28 04:49:05 +04:00
|
|
|
|
}
|
2001-03-04 05:31:28 +03:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::TakeFocus()
|
2008-04-23 10:04:53 +04:00
|
|
|
|
{
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsIFrame* frame = GetFrame();
|
|
|
|
|
if (!frame)
|
|
|
|
|
return;
|
2008-04-23 10:04:53 +04:00
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
nsIContent* focusContent = mContent;
|
|
|
|
|
|
2011-12-08 16:20:15 +04:00
|
|
|
|
// If the accessible focus is managed by container widget then focus the
|
|
|
|
|
// widget and set the accessible as its current item.
|
2008-04-23 10:04:53 +04:00
|
|
|
|
if (!frame->IsFocusable()) {
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* widget = ContainerWidget();
|
2011-12-08 16:20:15 +04:00
|
|
|
|
if (widget && widget->AreItemsOperable()) {
|
|
|
|
|
nsIContent* widgetElm = widget->GetContent();
|
|
|
|
|
nsIFrame* widgetFrame = widgetElm->GetPrimaryFrame();
|
|
|
|
|
if (widgetFrame && widgetFrame->IsFocusable()) {
|
|
|
|
|
focusContent = widgetElm;
|
|
|
|
|
widget->SetCurrentItem(this);
|
2008-04-23 10:04:53 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(focusContent));
|
2012-02-12 06:34:00 +04:00
|
|
|
|
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
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 22:00:39 +04:00
|
|
|
|
if (fm)
|
|
|
|
|
fm->SetFocus(element, 0);
|
2001-03-04 05:31:28 +03:00
|
|
|
|
}
|
|
|
|
|
|
2013-12-08 01:37:04 +04:00
|
|
|
|
void
|
|
|
|
|
Accessible::XULElmName(DocAccessible* aDocument,
|
|
|
|
|
nsIContent* aElm, nsString& aName)
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* 3 main cases for XUL Controls to be labeled
|
|
|
|
|
* 1 - control contains label="foo"
|
|
|
|
|
* 2 - control has, as a child, a label element
|
|
|
|
|
* - label has either value="foo" or children
|
|
|
|
|
* 3 - non-child label contains control="controlID"
|
|
|
|
|
* - label has either value="foo" or children
|
|
|
|
|
* Once a label is found, the search is discontinued, so a control
|
|
|
|
|
* that has a label child as well as having a label external to
|
|
|
|
|
* the control that uses the control="controlID" syntax will use
|
|
|
|
|
* the child label for its Name.
|
|
|
|
|
*/
|
2012-10-17 10:38:16 +04:00
|
|
|
|
|
2008-10-10 16:26:55 +04:00
|
|
|
|
// CASE #1 (via label attribute) -- great majority of the cases
|
2013-12-08 01:37:04 +04:00
|
|
|
|
nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl = do_QueryInterface(aElm);
|
2004-06-02 08:06:28 +04:00
|
|
|
|
if (labeledEl) {
|
2012-10-14 08:18:39 +04:00
|
|
|
|
labeledEl->GetLabel(aName);
|
|
|
|
|
} else {
|
2013-12-08 01:37:04 +04:00
|
|
|
|
nsCOMPtr<nsIDOMXULSelectControlItemElement> itemEl = do_QueryInterface(aElm);
|
2004-06-02 08:06:28 +04:00
|
|
|
|
if (itemEl) {
|
2012-10-14 08:18:39 +04:00
|
|
|
|
itemEl->GetLabel(aName);
|
|
|
|
|
} else {
|
2013-12-08 01:37:04 +04:00
|
|
|
|
nsCOMPtr<nsIDOMXULSelectControlElement> select = do_QueryInterface(aElm);
|
2014-05-23 04:10:19 +04:00
|
|
|
|
// Use label if this is not a select control element which
|
2005-06-01 18:03:38 +04:00
|
|
|
|
// uses label attribute to indicate which option is selected
|
|
|
|
|
if (!select) {
|
2013-12-08 01:37:04 +04:00
|
|
|
|
nsCOMPtr<nsIDOMXULElement> xulEl(do_QueryInterface(aElm));
|
2012-10-14 08:18:39 +04:00
|
|
|
|
if (xulEl)
|
|
|
|
|
xulEl->GetAttribute(NS_LITERAL_STRING("label"), aName);
|
2005-04-05 15:11:57 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2004-06-02 08:06:28 +04:00
|
|
|
|
}
|
2001-11-07 03:12:16 +03:00
|
|
|
|
|
2004-07-06 17:00:40 +04:00
|
|
|
|
// CASES #2 and #3 ------ label as a child or <label control="id" ... > </label>
|
2012-10-14 08:18:39 +04:00
|
|
|
|
if (aName.IsEmpty()) {
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* labelAcc = nullptr;
|
2013-12-08 01:37:04 +04:00
|
|
|
|
XULLabelIterator iter(aDocument, aElm);
|
2010-11-20 05:37:18 +03:00
|
|
|
|
while ((labelAcc = iter.Next())) {
|
|
|
|
|
nsCOMPtr<nsIDOMXULLabelElement> xulLabel =
|
|
|
|
|
do_QueryInterface(labelAcc->GetContent());
|
|
|
|
|
// Check if label's value attribute is used
|
2012-10-14 08:18:39 +04:00
|
|
|
|
if (xulLabel && NS_SUCCEEDED(xulLabel->GetValue(aName)) && aName.IsEmpty()) {
|
2010-11-20 05:37:18 +03:00
|
|
|
|
// If no value attribute, a non-empty label must contain
|
|
|
|
|
// children that define its text -- possibly using HTML
|
|
|
|
|
nsTextEquivUtils::
|
2013-12-08 01:37:04 +04:00
|
|
|
|
AppendTextEquivFromContent(labelAcc, labelAcc->GetContent(), &aName);
|
2010-11-20 05:37:18 +03:00
|
|
|
|
}
|
2001-11-07 03:12:16 +03:00
|
|
|
|
}
|
2004-07-06 17:00:40 +04:00
|
|
|
|
}
|
2001-11-07 03:12:16 +03:00
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
|
aName.CompressWhitespace();
|
|
|
|
|
if (!aName.IsEmpty())
|
2013-12-08 01:37:04 +04:00
|
|
|
|
return;
|
2005-02-11 16:17:18 +03:00
|
|
|
|
|
|
|
|
|
// Can get text from title of <toolbaritem> if we're a child of a <toolbaritem>
|
2013-12-08 01:37:04 +04:00
|
|
|
|
nsIContent *bindingParent = aElm->GetBindingParent();
|
|
|
|
|
nsIContent* parent =
|
|
|
|
|
bindingParent? bindingParent->GetParent() : aElm->GetParent();
|
2016-01-20 16:47:42 +03:00
|
|
|
|
nsAutoString ancestorTitle;
|
2006-09-10 21:54:32 +04:00
|
|
|
|
while (parent) {
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (parent->IsXULElement(nsGkAtoms::toolbaritem) &&
|
2016-01-20 16:47:42 +03:00
|
|
|
|
parent->GetAttr(kNameSpaceID_None, nsGkAtoms::title, ancestorTitle)) {
|
|
|
|
|
// Before returning this, check if the element itself has a tooltip:
|
|
|
|
|
if (aElm->GetAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext, aName)) {
|
|
|
|
|
aName.CompressWhitespace();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
aName.Assign(ancestorTitle);
|
2012-10-14 08:18:39 +04:00
|
|
|
|
aName.CompressWhitespace();
|
2013-12-08 01:37:04 +04:00
|
|
|
|
return;
|
2006-09-10 21:54:32 +04:00
|
|
|
|
}
|
|
|
|
|
parent = parent->GetParent();
|
2005-02-08 02:11:30 +03:00
|
|
|
|
}
|
2001-11-07 03:12:16 +03:00
|
|
|
|
}
|
2003-03-05 05:10:57 +03:00
|
|
|
|
|
2009-06-18 11:37:38 +04:00
|
|
|
|
nsresult
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::HandleAccEvent(AccEvent* aEvent)
|
2007-04-13 10:03:30 +04:00
|
|
|
|
{
|
2007-04-24 22:20:52 +04:00
|
|
|
|
NS_ENSURE_ARG_POINTER(aEvent);
|
|
|
|
|
|
2015-06-04 18:32:51 +03:00
|
|
|
|
if (IPCAccessibilityActive() && Document()) {
|
|
|
|
|
DocAccessibleChild* ipcDoc = mDoc->IPCDoc();
|
2015-07-20 22:04:22 +03:00
|
|
|
|
MOZ_ASSERT(ipcDoc);
|
|
|
|
|
if (ipcDoc) {
|
|
|
|
|
uint64_t id = aEvent->GetAccessible()->IsDoc() ? 0 :
|
|
|
|
|
reinterpret_cast<uintptr_t>(aEvent->GetAccessible());
|
|
|
|
|
|
|
|
|
|
switch(aEvent->GetEventType()) {
|
|
|
|
|
case nsIAccessibleEvent::EVENT_SHOW:
|
|
|
|
|
ipcDoc->ShowEvent(downcast_accEvent(aEvent));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_HIDE:
|
2016-04-06 03:44:38 +03:00
|
|
|
|
ipcDoc->SendHideEvent(id, aEvent->IsFromUserInput());
|
2015-07-20 22:04:22 +03:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case nsIAccessibleEvent::EVENT_REORDER:
|
|
|
|
|
// reorder events on the application acc aren't necessary to tell the parent
|
|
|
|
|
// about new top level documents.
|
|
|
|
|
if (!aEvent->GetAccessible()->IsApplication())
|
|
|
|
|
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
|
|
|
|
break;
|
|
|
|
|
case nsIAccessibleEvent::EVENT_STATE_CHANGE: {
|
2016-08-16 01:58:45 +03:00
|
|
|
|
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
|
|
|
|
ipcDoc->SendStateChangeEvent(id, event->GetState(),
|
|
|
|
|
event->IsStateEnabled());
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-07-20 22:04:22 +03:00
|
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED: {
|
2015-06-05 22:58:03 +03:00
|
|
|
|
AccCaretMoveEvent* event = downcast_accEvent(aEvent);
|
|
|
|
|
ipcDoc->SendCaretMoveEvent(id, event->GetCaretOffset());
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-07-20 22:04:22 +03:00
|
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
|
|
|
|
|
case nsIAccessibleEvent::EVENT_TEXT_REMOVED: {
|
|
|
|
|
AccTextChangeEvent* event = downcast_accEvent(aEvent);
|
|
|
|
|
ipcDoc->SendTextChangeEvent(id, event->ModifiedText(),
|
|
|
|
|
event->GetStartOffset(),
|
|
|
|
|
event->GetLength(),
|
|
|
|
|
event->IsTextInserted(),
|
|
|
|
|
event->IsFromUserInput());
|
|
|
|
|
break;
|
2016-08-16 01:58:45 +03:00
|
|
|
|
}
|
2016-04-21 22:06:57 +03:00
|
|
|
|
case nsIAccessibleEvent::EVENT_SELECTION:
|
|
|
|
|
case nsIAccessibleEvent::EVENT_SELECTION_ADD:
|
|
|
|
|
case nsIAccessibleEvent::EVENT_SELECTION_REMOVE: {
|
|
|
|
|
AccSelChangeEvent* selEvent = downcast_accEvent(aEvent);
|
|
|
|
|
uint64_t widgetID = selEvent->Widget()->IsDoc() ? 0 :
|
|
|
|
|
reinterpret_cast<uintptr_t>(selEvent->Widget());
|
|
|
|
|
ipcDoc->SendSelectionEvent(id, widgetID, aEvent->GetEventType());
|
|
|
|
|
break;
|
2016-08-16 01:58:45 +03:00
|
|
|
|
}
|
2015-07-20 22:04:22 +03:00
|
|
|
|
default:
|
2016-08-16 01:58:45 +03:00
|
|
|
|
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
2015-07-20 22:04:22 +03:00
|
|
|
|
}
|
2015-06-04 18:32:51 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2016-01-21 04:52:43 +03:00
|
|
|
|
if (nsCoreUtils::AccEventObserversExist()) {
|
|
|
|
|
nsCoreUtils::DispatchAccEvent(MakeXPCEvent(aEvent));
|
2010-08-25 06:08:28 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NS_OK;
|
2003-03-05 05:10:57 +03:00
|
|
|
|
}
|
2003-03-20 11:27:31 +03:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
already_AddRefed<nsIPersistentProperties>
|
|
|
|
|
Accessible::Attributes()
|
|
|
|
|
{
|
|
|
|
|
nsCOMPtr<nsIPersistentProperties> attributes = NativeAttributes();
|
|
|
|
|
if (!HasOwnContent() || !mContent->IsElement())
|
|
|
|
|
return attributes.forget();
|
2008-03-13 20:39:18 +03:00
|
|
|
|
|
2015-03-01 01:25:06 +03:00
|
|
|
|
// 'xml-roles' attribute for landmark.
|
|
|
|
|
nsIAtom* landmark = LandmarkRole();
|
|
|
|
|
if (landmark) {
|
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles, landmark);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
// 'xml-roles' attribute coming from ARIA.
|
|
|
|
|
nsAutoString xmlRoles;
|
|
|
|
|
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::role, xmlRoles))
|
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::xmlroles, xmlRoles);
|
2012-10-17 10:38:16 +04:00
|
|
|
|
}
|
|
|
|
|
|
2009-02-19 09:56:19 +03:00
|
|
|
|
// Expose object attributes from ARIA attributes.
|
2015-03-01 01:25:06 +03:00
|
|
|
|
nsAutoString unused;
|
2012-08-11 00:10:18 +04:00
|
|
|
|
aria::AttrIterator attribIter(mContent);
|
|
|
|
|
nsAutoString name, value;
|
2012-10-19 11:15:23 +04:00
|
|
|
|
while(attribIter.Next(name, value))
|
|
|
|
|
attributes->SetStringProperty(NS_ConvertUTF16toUTF8(name), value, unused);
|
2008-03-13 20:39:18 +03:00
|
|
|
|
|
2015-02-05 02:33:33 +03:00
|
|
|
|
if (IsARIAHidden()) {
|
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::hidden,
|
|
|
|
|
NS_LITERAL_STRING("true"));
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-19 09:56:19 +03:00
|
|
|
|
// If there is no aria-live attribute then expose default value of 'live'
|
|
|
|
|
// object attribute used for ARIA role of this accessible.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (roleMapEntry) {
|
|
|
|
|
if (roleMapEntry->Is(nsGkAtoms::searchbox)) {
|
2015-02-27 17:41:57 +03:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textInputType,
|
|
|
|
|
NS_LITERAL_STRING("search"));
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-19 09:56:19 +03:00
|
|
|
|
nsAutoString live;
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsAccUtils::GetAccAttr(attributes, nsGkAtoms::live, live);
|
2009-02-19 09:56:19 +03:00
|
|
|
|
if (live.IsEmpty()) {
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (nsAccUtils::GetLiveAttrValue(roleMapEntry->liveAttRule, live))
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::live, live);
|
2009-02-19 09:56:19 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
return attributes.forget();
|
2006-09-01 01:07:41 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
already_AddRefed<nsIPersistentProperties>
|
|
|
|
|
Accessible::NativeAttributes()
|
2007-04-07 13:07:24 +04:00
|
|
|
|
{
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsCOMPtr<nsIPersistentProperties> attributes =
|
|
|
|
|
do_CreateInstance(NS_PERSISTENTPROPERTIES_CONTRACTID);
|
|
|
|
|
|
|
|
|
|
nsAutoString unused;
|
|
|
|
|
|
|
|
|
|
// We support values, so expose the string value as well, via the valuetext
|
|
|
|
|
// object attribute. We test for the value interface because we don't want
|
|
|
|
|
// to expose traditional Value() information such as URL's on links and
|
|
|
|
|
// documents, or text in an input.
|
|
|
|
|
if (HasNumericValue()) {
|
|
|
|
|
nsAutoString valuetext;
|
2014-10-22 04:49:28 +04:00
|
|
|
|
Value(valuetext);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
attributes->SetStringProperty(NS_LITERAL_CSTRING("valuetext"), valuetext,
|
|
|
|
|
unused);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Expose checkable object attribute if the accessible has checkable state
|
|
|
|
|
if (State() & states::CHECKABLE) {
|
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::checkable,
|
|
|
|
|
NS_LITERAL_STRING("true"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Expose 'explicit-name' attribute.
|
2012-10-26 16:38:29 +04:00
|
|
|
|
nsAutoString name;
|
|
|
|
|
if (Name(name) != eNameFromSubtree && !name.IsVoid()) {
|
2012-10-19 11:15:23 +04:00
|
|
|
|
attributes->SetStringProperty(NS_LITERAL_CSTRING("explicit-name"),
|
|
|
|
|
NS_LITERAL_STRING("true"), unused);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Group attributes (level/setsize/posinset)
|
|
|
|
|
GroupPos groupPos = GroupPosition();
|
|
|
|
|
nsAccUtils::SetAccGroupAttrs(attributes, groupPos.level,
|
|
|
|
|
groupPos.setSize, groupPos.posInSet);
|
|
|
|
|
|
|
|
|
|
// If the accessible doesn't have own content (such as list item bullet or
|
|
|
|
|
// xul tree item) then don't calculate content based attributes.
|
2012-10-13 10:34:21 +04:00
|
|
|
|
if (!HasOwnContent())
|
2012-10-19 11:15:23 +04:00
|
|
|
|
return attributes.forget();
|
2012-03-26 08:37:07 +04:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsEventShell::GetEventAttributes(GetNode(), attributes);
|
2007-04-07 13:07:24 +04:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
// Get container-foo computed live region properties based on the closest
|
|
|
|
|
// container with the live region attribute. Inner nodes override outer nodes
|
|
|
|
|
// within the same document. The inner nodes can be used to override live
|
|
|
|
|
// region behavior on more general outer nodes. However, nodes in outer
|
|
|
|
|
// documents override nodes in inner documents: outer doc author may want to
|
|
|
|
|
// override properties on a widget they used in an iframe.
|
2012-03-26 08:37:07 +04:00
|
|
|
|
nsIContent* startContent = mContent;
|
|
|
|
|
while (startContent) {
|
2014-08-23 00:11:27 +04:00
|
|
|
|
nsIDocument* doc = startContent->GetComposedDoc();
|
2012-10-19 11:15:23 +04:00
|
|
|
|
if (!doc)
|
|
|
|
|
break;
|
2012-03-26 08:37:07 +04:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetLiveContainerAttributes(attributes, startContent,
|
2016-03-04 18:36:18 +03:00
|
|
|
|
doc->GetRootElement());
|
2008-11-01 06:58:07 +03:00
|
|
|
|
|
2008-03-14 23:49:38 +03:00
|
|
|
|
// Allow ARIA live region markup from outer documents to override
|
2013-11-15 20:32:12 +04:00
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = doc->GetDocShell();
|
2008-03-20 04:55:26 +03:00
|
|
|
|
if (!docShellTreeItem)
|
|
|
|
|
break;
|
2008-11-01 06:58:07 +03:00
|
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
|
|
|
|
|
docShellTreeItem->GetSameTypeParent(getter_AddRefs(sameTypeParent));
|
2008-03-14 23:49:38 +03:00
|
|
|
|
if (!sameTypeParent || sameTypeParent == docShellTreeItem)
|
|
|
|
|
break;
|
2008-11-01 06:58:07 +03:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsIDocument* parentDoc = doc->GetParentDocument();
|
2008-03-21 05:34:29 +03:00
|
|
|
|
if (!parentDoc)
|
|
|
|
|
break;
|
2008-11-01 06:58:07 +03:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
startContent = parentDoc->FindContentForSubDocument(doc);
|
2008-03-14 23:49:38 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-20 19:45:29 +04:00
|
|
|
|
if (!mContent->IsElement())
|
2012-10-19 11:15:23 +04:00
|
|
|
|
return attributes.forget();
|
|
|
|
|
|
|
|
|
|
nsAutoString id;
|
|
|
|
|
if (nsCoreUtils::GetID(mContent, id))
|
|
|
|
|
attributes->SetStringProperty(NS_LITERAL_CSTRING("id"), id, unused);
|
|
|
|
|
|
|
|
|
|
// Expose class because it may have useful microformat information.
|
|
|
|
|
nsAutoString _class;
|
|
|
|
|
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::_class, _class))
|
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::_class, _class);
|
2012-02-20 19:45:29 +04:00
|
|
|
|
|
2012-03-26 08:37:07 +04:00
|
|
|
|
// Expose tag.
|
|
|
|
|
nsAutoString tagName;
|
|
|
|
|
mContent->NodeInfo()->GetName(tagName);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tag, tagName);
|
2012-03-26 08:37:07 +04:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
// Expose draggable object attribute.
|
2012-03-09 18:20:17 +04:00
|
|
|
|
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mContent);
|
|
|
|
|
if (htmlElement) {
|
|
|
|
|
bool draggable = false;
|
|
|
|
|
htmlElement->GetDraggable(&draggable);
|
|
|
|
|
if (draggable) {
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::draggable,
|
2012-03-09 18:20:17 +04:00
|
|
|
|
NS_LITERAL_STRING("true"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Don't calculate CSS-based object attributes when no frame (i.e.
|
2012-03-26 08:42:28 +04:00
|
|
|
|
// the accessible is unattached from the tree).
|
2012-03-26 08:37:07 +04:00
|
|
|
|
if (!mContent->GetPrimaryFrame())
|
2012-10-19 11:15:23 +04:00
|
|
|
|
return attributes.forget();
|
2012-03-09 18:20:17 +04:00
|
|
|
|
|
2012-02-20 19:45:29 +04:00
|
|
|
|
// CSS style based object attributes.
|
2008-10-28 14:54:57 +03:00
|
|
|
|
nsAutoString value;
|
2012-02-20 19:45:29 +04:00
|
|
|
|
StyleInfo styleInfo(mContent->AsElement(), mDoc->PresShell());
|
|
|
|
|
|
|
|
|
|
// Expose 'display' attribute.
|
|
|
|
|
styleInfo.Display(value);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::display, value);
|
2008-10-28 14:54:57 +03:00
|
|
|
|
|
|
|
|
|
// Expose 'text-align' attribute.
|
2012-02-20 19:45:29 +04:00
|
|
|
|
styleInfo.TextAlign(value);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textAlign, value);
|
2008-10-28 14:54:57 +03:00
|
|
|
|
|
|
|
|
|
// Expose 'text-indent' attribute.
|
2012-02-20 19:45:29 +04:00
|
|
|
|
styleInfo.TextIndent(value);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::textIndent, value);
|
2008-10-28 14:54:57 +03:00
|
|
|
|
|
2012-02-06 21:18:25 +04:00
|
|
|
|
// Expose 'margin-left' attribute.
|
2012-02-20 19:45:29 +04:00
|
|
|
|
styleInfo.MarginLeft(value);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginLeft, value);
|
2012-02-06 21:18:25 +04:00
|
|
|
|
|
|
|
|
|
// Expose 'margin-right' attribute.
|
2012-02-20 19:45:29 +04:00
|
|
|
|
styleInfo.MarginRight(value);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginRight, value);
|
2012-02-06 21:18:25 +04:00
|
|
|
|
|
|
|
|
|
// Expose 'margin-top' attribute.
|
2012-02-20 19:45:29 +04:00
|
|
|
|
styleInfo.MarginTop(value);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginTop, value);
|
2012-02-06 21:18:25 +04:00
|
|
|
|
|
|
|
|
|
// Expose 'margin-bottom' attribute.
|
2012-02-20 19:45:29 +04:00
|
|
|
|
styleInfo.MarginBottom(value);
|
2012-10-19 11:15:23 +04:00
|
|
|
|
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::marginBottom, value);
|
2012-02-06 21:18:25 +04:00
|
|
|
|
|
2012-10-19 11:15:23 +04:00
|
|
|
|
return attributes.forget();
|
2007-04-07 13:07:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-30 04:51:00 +04:00
|
|
|
|
GroupPos
|
|
|
|
|
Accessible::GroupPosition()
|
2007-03-27 16:17:11 +04:00
|
|
|
|
{
|
2012-05-30 04:51:00 +04:00
|
|
|
|
GroupPos groupPos;
|
2012-10-31 06:25:17 +04:00
|
|
|
|
if (!HasOwnContent())
|
|
|
|
|
return groupPos;
|
2010-01-06 13:36:50 +03:00
|
|
|
|
|
|
|
|
|
// Get group position from ARIA attributes.
|
2012-05-30 04:51:00 +04:00
|
|
|
|
nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_level, &groupPos.level);
|
|
|
|
|
nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_setsize, &groupPos.setSize);
|
|
|
|
|
nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_posinset, &groupPos.posInSet);
|
2010-01-06 13:36:50 +03:00
|
|
|
|
|
|
|
|
|
// If ARIA is missed and the accessible is visible then calculate group
|
|
|
|
|
// position from hierarchy.
|
2011-04-10 03:38:06 +04:00
|
|
|
|
if (State() & states::INVISIBLE)
|
2012-05-30 04:51:00 +04:00
|
|
|
|
return groupPos;
|
2007-03-27 16:17:11 +04:00
|
|
|
|
|
2010-01-06 13:36:50 +03:00
|
|
|
|
// Calculate group level if ARIA is missed.
|
2012-05-30 04:51:00 +04:00
|
|
|
|
if (groupPos.level == 0) {
|
2012-08-22 19:56:38 +04:00
|
|
|
|
int32_t level = GetLevelInternal();
|
2010-01-06 13:36:50 +03:00
|
|
|
|
if (level != 0)
|
2012-05-30 04:51:00 +04:00
|
|
|
|
groupPos.level = level;
|
2010-01-06 13:36:50 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Calculate position in group and group size if ARIA is missed.
|
2012-05-30 04:51:00 +04:00
|
|
|
|
if (groupPos.posInSet == 0 || groupPos.setSize == 0) {
|
2012-08-22 19:56:38 +04:00
|
|
|
|
int32_t posInSet = 0, setSize = 0;
|
2010-01-06 13:36:50 +03:00
|
|
|
|
GetPositionAndSizeInternal(&posInSet, &setSize);
|
|
|
|
|
if (posInSet != 0 && setSize != 0) {
|
2012-05-30 04:51:00 +04:00
|
|
|
|
if (groupPos.posInSet == 0)
|
|
|
|
|
groupPos.posInSet = posInSet;
|
2007-03-27 16:17:11 +04:00
|
|
|
|
|
2012-05-30 04:51:00 +04:00
|
|
|
|
if (groupPos.setSize == 0)
|
|
|
|
|
groupPos.setSize = setSize;
|
2010-01-06 13:36:50 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2007-03-27 16:17:11 +04:00
|
|
|
|
|
2012-05-30 04:51:00 +04:00
|
|
|
|
return groupPos;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::State()
|
2011-04-10 03:38:06 +04:00
|
|
|
|
{
|
2011-04-12 10:18:42 +04:00
|
|
|
|
if (IsDefunct())
|
|
|
|
|
return states::DEFUNCT;
|
2007-04-02 19:56:24 +04:00
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t state = NativeState();
|
2011-05-24 18:02:44 +04:00
|
|
|
|
// Apply ARIA states to be sure accessible states will be overridden.
|
2011-04-10 03:38:06 +04:00
|
|
|
|
ApplyARIAState(&state);
|
2007-08-08 17:46:38 +04:00
|
|
|
|
|
2012-01-21 15:06:26 +04:00
|
|
|
|
// If this is an ARIA item of the selectable widget and if it's focused and
|
|
|
|
|
// not marked unselected explicitly (i.e. aria-selected="false") then expose
|
|
|
|
|
// it as selected to make ARIA widget authors life easier.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (roleMapEntry && !(state & states::SELECTED) &&
|
2011-05-24 18:02:44 +04:00
|
|
|
|
!mContent->AttrValueIs(kNameSpaceID_None,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_selected,
|
|
|
|
|
nsGkAtoms::_false, eCaseMatters)) {
|
2012-01-21 15:06:26 +04:00
|
|
|
|
// Special case for tabs: focused tab or focus inside related tab panel
|
|
|
|
|
// implies selected state.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (roleMapEntry->role == roles::PAGETAB) {
|
2012-01-21 15:06:26 +04:00
|
|
|
|
if (state & states::FOCUSED) {
|
|
|
|
|
state |= states::SELECTED;
|
|
|
|
|
} else {
|
|
|
|
|
// If focus is in a child of the tab panel surely the tab is selected!
|
2013-10-19 22:19:50 +04:00
|
|
|
|
Relation rel = RelationByType(RelationType::LABEL_FOR);
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* relTarget = nullptr;
|
2012-01-21 15:06:26 +04:00
|
|
|
|
while ((relTarget = rel.Next())) {
|
|
|
|
|
if (relTarget->Role() == roles::PROPERTYPAGE &&
|
|
|
|
|
FocusMgr()->IsFocusWithin(relTarget))
|
|
|
|
|
state |= states::SELECTED;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (state & states::FOCUSED) {
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* container = nsAccUtils::GetSelectableContainer(this, state);
|
2012-01-21 15:06:26 +04:00
|
|
|
|
if (container &&
|
|
|
|
|
!nsAccUtils::HasDefinedARIAToken(container->GetContent(),
|
|
|
|
|
nsGkAtoms::aria_multiselectable)) {
|
|
|
|
|
state |= states::SELECTED;
|
2007-10-03 13:31:41 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
const uint32_t kExpandCollapseStates = states::COLLAPSED | states::EXPANDED;
|
2011-04-10 03:38:06 +04:00
|
|
|
|
if ((state & kExpandCollapseStates) == kExpandCollapseStates) {
|
2008-10-08 09:27:24 +04:00
|
|
|
|
// Cannot be both expanded and collapsed -- this happens in ARIA expanded
|
2013-04-25 07:48:26 +04:00
|
|
|
|
// combobox because of limitation of ARIAMap.
|
2008-10-08 09:27:24 +04:00
|
|
|
|
// XXX: Perhaps we will be able to make this less hacky if we support
|
2013-04-25 07:48:26 +04:00
|
|
|
|
// extended states in ARIAMap, e.g. derive COLLAPSED from
|
2008-10-08 09:27:24 +04:00
|
|
|
|
// EXPANDABLE && !EXPANDED.
|
2011-04-10 03:38:06 +04:00
|
|
|
|
state &= ~states::COLLAPSED;
|
2008-10-08 09:27:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
|
if (!(state & states::UNAVAILABLE)) {
|
|
|
|
|
state |= states::ENABLED | states::SENSITIVE;
|
2011-12-07 13:10:22 +04:00
|
|
|
|
|
|
|
|
|
// If the object is a current item of container widget then mark it as
|
|
|
|
|
// ACTIVE. This allows screen reader virtual buffer modes to know which
|
|
|
|
|
// descendant is the current one that would get focus if the user navigates
|
|
|
|
|
// to the container widget.
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* widget = ContainerWidget();
|
2011-12-07 13:10:22 +04:00
|
|
|
|
if (widget && widget->CurrentItem() == this)
|
|
|
|
|
state |= states::ACTIVE;
|
2007-09-21 06:58:29 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
|
if ((state & states::COLLAPSED) || (state & states::EXPANDED))
|
|
|
|
|
state |= states::EXPANDABLE;
|
2007-08-29 17:36:07 +04:00
|
|
|
|
|
2007-09-21 06:58:29 +04:00
|
|
|
|
// For some reasons DOM node may have not a frame. We tract such accessibles
|
|
|
|
|
// as invisible.
|
|
|
|
|
nsIFrame *frame = GetFrame();
|
|
|
|
|
if (!frame)
|
2011-04-10 03:38:06 +04:00
|
|
|
|
return state;
|
2007-09-21 06:58:29 +04:00
|
|
|
|
|
2016-04-12 08:52:43 +03:00
|
|
|
|
if (frame->StyleEffects()->mOpacity == 1.0f &&
|
2011-04-10 03:38:06 +04:00
|
|
|
|
!(state & states::INVISIBLE)) {
|
|
|
|
|
state |= states::OPAQUE1;
|
2007-09-21 06:58:29 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
|
return state;
|
2007-04-02 19:56:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::ApplyARIAState(uint64_t* aState) const
|
2007-04-02 19:56:24 +04:00
|
|
|
|
{
|
2012-04-05 20:23:30 +04:00
|
|
|
|
if (!mContent->IsElement())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dom::Element* element = mContent->AsElement();
|
|
|
|
|
|
2006-07-01 07:52:29 +04:00
|
|
|
|
// Test for universal states first
|
2012-07-11 05:00:30 +04:00
|
|
|
|
*aState |= aria::UniversalStatesFor(element);
|
2005-01-28 05:35:26 +03:00
|
|
|
|
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (roleMapEntry) {
|
2009-08-31 17:12:08 +04:00
|
|
|
|
|
|
|
|
|
// We only force the readonly bit off if we have a real mapping for the aria
|
|
|
|
|
// role. This preserves the ability for screen readers to use readonly
|
|
|
|
|
// (primarily on the document) as the hint for creating a virtual buffer.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (roleMapEntry->role != roles::NOTHING)
|
2011-04-10 03:38:06 +04:00
|
|
|
|
*aState &= ~states::READONLY;
|
2007-04-02 19:56:24 +04:00
|
|
|
|
|
2014-05-30 11:36:53 +04:00
|
|
|
|
if (mContent->HasID()) {
|
2015-11-03 19:03:34 +03:00
|
|
|
|
// If has a role & ID and aria-activedescendant on the container, assume
|
|
|
|
|
// focusable.
|
|
|
|
|
const Accessible* ancestor = this;
|
|
|
|
|
while ((ancestor = ancestor->Parent()) && !ancestor->IsDoc()) {
|
|
|
|
|
dom::Element* el = ancestor->Elm();
|
|
|
|
|
if (el &&
|
|
|
|
|
el->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant)) {
|
2011-04-10 03:38:06 +04:00
|
|
|
|
*aState |= states::FOCUSABLE;
|
2008-06-16 09:45:58 +04:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-04-04 05:51:50 +04:00
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
|
if (*aState & states::FOCUSABLE) {
|
2015-11-03 19:03:34 +03:00
|
|
|
|
// Propogate aria-disabled from ancestors down to any focusable descendant.
|
|
|
|
|
const Accessible* ancestor = this;
|
|
|
|
|
while ((ancestor = ancestor->Parent()) && !ancestor->IsDoc()) {
|
|
|
|
|
dom::Element* el = ancestor->Elm();
|
|
|
|
|
if (el && el->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_disabled,
|
|
|
|
|
nsGkAtoms::_true, eCaseMatters)) {
|
2011-04-10 03:38:06 +04:00
|
|
|
|
*aState |= states::UNAVAILABLE;
|
2008-03-30 01:04:04 +03:00
|
|
|
|
break;
|
|
|
|
|
}
|
2014-05-23 04:10:19 +04:00
|
|
|
|
}
|
2008-03-30 01:04:04 +03:00
|
|
|
|
}
|
|
|
|
|
|
2014-04-04 12:01:19 +04:00
|
|
|
|
// special case: A native button element whose role got transformed by ARIA to a toggle button
|
2014-07-04 11:51:54 +04:00
|
|
|
|
// Also applies to togglable button menus, like in the Dev Tools Web Console.
|
|
|
|
|
if (IsButton() || IsMenuButton())
|
2014-04-04 12:01:19 +04:00
|
|
|
|
aria::MapToState(aria::eARIAPressed, element, aState);
|
|
|
|
|
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (!roleMapEntry)
|
2011-04-10 03:38:06 +04:00
|
|
|
|
return;
|
2008-06-16 09:45:58 +04:00
|
|
|
|
|
2016-07-12 22:34:13 +03:00
|
|
|
|
*aState |= roleMapEntry->state;
|
2005-01-28 05:35:26 +03:00
|
|
|
|
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (aria::MapToState(roleMapEntry->attributeMap1, element, aState) &&
|
|
|
|
|
aria::MapToState(roleMapEntry->attributeMap2, element, aState) &&
|
|
|
|
|
aria::MapToState(roleMapEntry->attributeMap3, element, aState))
|
|
|
|
|
aria::MapToState(roleMapEntry->attributeMap4, element, aState);
|
2013-02-14 14:57:35 +04:00
|
|
|
|
|
|
|
|
|
// ARIA gridcell inherits editable/readonly states from the grid until it's
|
|
|
|
|
// overridden.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if ((roleMapEntry->Is(nsGkAtoms::gridcell) ||
|
|
|
|
|
roleMapEntry->Is(nsGkAtoms::columnheader) ||
|
|
|
|
|
roleMapEntry->Is(nsGkAtoms::rowheader)) &&
|
2013-02-14 14:57:35 +04:00
|
|
|
|
!(*aState & (states::READONLY | states::EDITABLE))) {
|
|
|
|
|
const TableCellAccessible* cell = AsTableCell();
|
|
|
|
|
if (cell) {
|
|
|
|
|
TableAccessible* table = cell->Table();
|
|
|
|
|
if (table) {
|
|
|
|
|
Accessible* grid = table->AsAccessible();
|
|
|
|
|
uint64_t gridState = 0;
|
|
|
|
|
grid->ApplyARIAState(&gridState);
|
|
|
|
|
*aState |= (gridState & (states::READONLY | states::EDITABLE));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-04-05 20:23:30 +04:00
|
|
|
|
}
|
2006-06-15 20:55:32 +04:00
|
|
|
|
|
2012-04-09 13:48:41 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::Value(nsString& aValue)
|
2012-04-09 13:48:41 +04:00
|
|
|
|
{
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (!roleMapEntry)
|
2012-12-23 04:54:13 +04:00
|
|
|
|
return;
|
2008-03-31 10:21:35 +04:00
|
|
|
|
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (roleMapEntry->valueRule != eNoValue) {
|
2012-12-23 04:54:13 +04:00
|
|
|
|
// aria-valuenow is a number, and aria-valuetext is the optional text
|
|
|
|
|
// equivalent. For the string value, we will try the optional text
|
|
|
|
|
// equivalent first.
|
2010-06-11 12:23:18 +04:00
|
|
|
|
if (!mContent->GetAttr(kNameSpaceID_None,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_valuetext, aValue)) {
|
|
|
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow,
|
2010-06-11 12:23:18 +04:00
|
|
|
|
aValue);
|
2005-01-28 05:35:26 +03:00
|
|
|
|
}
|
2012-12-23 04:54:13 +04:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-23 20:06:52 +04:00
|
|
|
|
// Value of textbox is a textified subtree.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (roleMapEntry->Is(nsGkAtoms::textbox)) {
|
2013-07-23 20:06:52 +04:00
|
|
|
|
nsTextEquivUtils::GetTextEquivFromSubtree(this, aValue);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-23 04:54:13 +04:00
|
|
|
|
// Value of combobox is a text of current or selected item.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (roleMapEntry->Is(nsGkAtoms::combobox)) {
|
2012-12-23 04:54:13 +04:00
|
|
|
|
Accessible* option = CurrentItem();
|
|
|
|
|
if (!option) {
|
2015-10-05 18:28:35 +03:00
|
|
|
|
uint32_t childCount = ChildCount();
|
|
|
|
|
for (uint32_t idx = 0; idx < childCount; idx++) {
|
|
|
|
|
Accessible* child = mChildren.ElementAt(idx);
|
|
|
|
|
if (child->IsListControl()) {
|
|
|
|
|
option = child->GetSelectedItem(0);
|
|
|
|
|
break;
|
2012-12-23 04:54:13 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (option)
|
2013-02-15 13:54:06 +04:00
|
|
|
|
nsTextEquivUtils::GetTextEquivFromSubtree(option, aValue);
|
2005-01-28 05:35:26 +03:00
|
|
|
|
}
|
2006-06-15 18:55:02 +04:00
|
|
|
|
}
|
2003-04-02 00:02:51 +04:00
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
double
|
|
|
|
|
Accessible::MaxValue() const
|
2006-06-15 20:55:32 +04:00
|
|
|
|
{
|
2013-11-20 01:01:15 +04:00
|
|
|
|
return AttrNumericValue(nsGkAtoms::aria_valuemax);
|
2006-06-15 20:55:32 +04:00
|
|
|
|
}
|
2006-06-15 18:55:02 +04:00
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
double
|
|
|
|
|
Accessible::MinValue() const
|
2006-06-15 18:55:02 +04:00
|
|
|
|
{
|
2013-11-20 01:01:15 +04:00
|
|
|
|
return AttrNumericValue(nsGkAtoms::aria_valuemin);
|
2006-06-15 20:55:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
double
|
|
|
|
|
Accessible::Step() const
|
2006-06-15 20:55:32 +04:00
|
|
|
|
{
|
2014-02-27 19:23:16 +04:00
|
|
|
|
return UnspecifiedNaN<double>(); // no mimimum increment (step) in ARIA.
|
2006-06-15 20:55:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
double
|
|
|
|
|
Accessible::CurValue() const
|
2006-06-15 20:55:32 +04:00
|
|
|
|
{
|
2013-11-20 01:01:15 +04:00
|
|
|
|
return AttrNumericValue(nsGkAtoms::aria_valuenow);
|
2006-06-15 20:55:32 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
bool
|
|
|
|
|
Accessible::SetCurValue(double aValue)
|
2006-06-15 20:55:32 +04:00
|
|
|
|
{
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (!roleMapEntry || roleMapEntry->valueRule == eNoValue)
|
2013-11-20 01:01:15 +04:00
|
|
|
|
return false;
|
2007-08-04 09:27:27 +04:00
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
const uint32_t kValueCannotChange = states::READONLY | states::UNAVAILABLE;
|
2011-04-10 03:38:06 +04:00
|
|
|
|
if (State() & kValueCannotChange)
|
2013-11-20 01:01:15 +04:00
|
|
|
|
return false;
|
2007-08-04 09:27:27 +04:00
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
double checkValue = MinValue();
|
|
|
|
|
if (!IsNaN(checkValue) && aValue < checkValue)
|
|
|
|
|
return false;
|
2007-08-04 09:27:27 +04:00
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
checkValue = MaxValue();
|
|
|
|
|
if (!IsNaN(checkValue) && aValue > checkValue)
|
|
|
|
|
return false;
|
2007-08-04 09:27:27 +04:00
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
nsAutoString strValue;
|
|
|
|
|
strValue.AppendFloat(aValue);
|
|
|
|
|
|
|
|
|
|
return NS_SUCCEEDED(
|
|
|
|
|
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow, strValue, true));
|
2003-04-02 00:02:51 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-01-12 07:07:35 +04:00
|
|
|
|
role
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::ARIATransformRole(role aRole)
|
2010-09-06 07:33:29 +04:00
|
|
|
|
{
|
|
|
|
|
// XXX: these unfortunate exceptions don't fit into the ARIA table. This is
|
|
|
|
|
// where the accessible role depends on both the role and ARIA state.
|
2012-03-30 04:04:06 +04:00
|
|
|
|
if (aRole == roles::PUSHBUTTON) {
|
2011-06-04 01:35:17 +04:00
|
|
|
|
if (nsAccUtils::HasDefinedARIAToken(mContent, nsGkAtoms::aria_pressed)) {
|
2010-09-06 07:33:29 +04:00
|
|
|
|
// For simplicity, any existing pressed attribute except "" or "undefined"
|
|
|
|
|
// indicates a toggle.
|
2012-01-12 07:07:35 +04:00
|
|
|
|
return roles::TOGGLE_BUTTON;
|
2010-09-06 07:33:29 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mContent->AttrValueIs(kNameSpaceID_None,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_haspopup,
|
|
|
|
|
nsGkAtoms::_true,
|
2010-09-06 07:33:29 +04:00
|
|
|
|
eCaseMatters)) {
|
|
|
|
|
// For button with aria-haspopup="true".
|
2012-01-12 07:07:35 +04:00
|
|
|
|
return roles::BUTTONMENU;
|
2010-09-06 07:33:29 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-30 04:04:06 +04:00
|
|
|
|
} else if (aRole == roles::LISTBOX) {
|
2010-09-06 07:33:29 +04:00
|
|
|
|
// A listbox inside of a combobox needs a special role because of ATK
|
|
|
|
|
// mapping to menu.
|
2012-01-12 07:07:35 +04:00
|
|
|
|
if (mParent && mParent->Role() == roles::COMBOBOX) {
|
|
|
|
|
return roles::COMBOBOX_LIST;
|
2014-10-30 18:05:26 +03:00
|
|
|
|
} else {
|
|
|
|
|
// Listbox is owned by a combobox
|
2013-10-19 22:19:50 +04:00
|
|
|
|
Relation rel = RelationByType(RelationType::NODE_CHILD_OF);
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* targetAcc = nullptr;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((targetAcc = rel.Next()))
|
2012-01-12 07:07:35 +04:00
|
|
|
|
if (targetAcc->Role() == roles::COMBOBOX)
|
|
|
|
|
return roles::COMBOBOX_LIST;
|
2010-09-06 07:33:29 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-30 04:04:06 +04:00
|
|
|
|
} else if (aRole == roles::OPTION) {
|
2012-01-12 07:07:35 +04:00
|
|
|
|
if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
|
|
|
|
|
return roles::COMBOBOX_OPTION;
|
2012-11-08 03:58:22 +04:00
|
|
|
|
|
|
|
|
|
} else if (aRole == roles::MENUITEM) {
|
|
|
|
|
// Menuitem has a submenu.
|
|
|
|
|
if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_haspopup,
|
|
|
|
|
nsGkAtoms::_true, eCaseMatters)) {
|
|
|
|
|
return roles::PARENT_MENUITEM;
|
|
|
|
|
}
|
2010-09-06 07:33:29 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-03-30 04:04:06 +04:00
|
|
|
|
return aRole;
|
2010-09-06 07:33:29 +04:00
|
|
|
|
}
|
|
|
|
|
|
2015-03-01 01:25:06 +03:00
|
|
|
|
nsIAtom*
|
|
|
|
|
Accessible::LandmarkRole() const
|
|
|
|
|
{
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
return roleMapEntry && roleMapEntry->IsOfType(eLandmark) ?
|
|
|
|
|
*(roleMapEntry->roleAtom) : nullptr;
|
2015-03-01 01:25:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-01-12 07:07:35 +04:00
|
|
|
|
role
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::NativeRole()
|
2003-04-02 00:02:51 +04:00
|
|
|
|
{
|
2012-11-10 12:39:44 +04:00
|
|
|
|
return roles::NOTHING;
|
2003-04-02 00:02:51 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint8_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::ActionCount()
|
2011-06-05 23:35:43 +04:00
|
|
|
|
{
|
2012-06-04 09:41:06 +04:00
|
|
|
|
return GetActionRule() == eNoAction ? 0 : 1;
|
2011-06-05 23:35:43 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
void
|
|
|
|
|
Accessible::ActionNameAt(uint8_t aIndex, nsAString& aName)
|
2003-04-02 00:02:51 +04:00
|
|
|
|
{
|
2008-03-16 04:23:41 +03:00
|
|
|
|
aName.Truncate();
|
|
|
|
|
|
|
|
|
|
if (aIndex != 0)
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2008-03-16 04:23:41 +03:00
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t actionRule = GetActionRule();
|
2008-03-31 10:21:35 +04:00
|
|
|
|
|
2008-10-08 16:54:58 +04:00
|
|
|
|
switch (actionRule) {
|
|
|
|
|
case eActivateAction:
|
|
|
|
|
aName.AssignLiteral("activate");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
|
|
|
|
case eClickAction:
|
|
|
|
|
aName.AssignLiteral("click");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
2012-02-02 05:13:09 +04:00
|
|
|
|
case ePressAction:
|
|
|
|
|
aName.AssignLiteral("press");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2012-02-02 05:13:09 +04:00
|
|
|
|
|
2008-10-08 16:54:58 +04:00
|
|
|
|
case eCheckUncheckAction:
|
2012-06-04 09:41:06 +04:00
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint64_t state = State();
|
2012-06-04 09:41:06 +04:00
|
|
|
|
if (state & states::CHECKED)
|
2008-10-08 16:54:58 +04:00
|
|
|
|
aName.AssignLiteral("uncheck");
|
2012-06-04 09:41:06 +04:00
|
|
|
|
else if (state & states::MIXED)
|
2009-03-10 09:03:21 +03:00
|
|
|
|
aName.AssignLiteral("cycle");
|
2008-10-08 16:54:58 +04:00
|
|
|
|
else
|
|
|
|
|
aName.AssignLiteral("check");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2012-06-04 09:41:06 +04:00
|
|
|
|
}
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
|
|
|
|
case eJumpAction:
|
|
|
|
|
aName.AssignLiteral("jump");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
|
|
|
|
case eOpenCloseAction:
|
2012-06-04 09:41:06 +04:00
|
|
|
|
if (State() & states::COLLAPSED)
|
2008-10-08 16:54:58 +04:00
|
|
|
|
aName.AssignLiteral("open");
|
|
|
|
|
else
|
|
|
|
|
aName.AssignLiteral("close");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
|
|
|
|
case eSelectAction:
|
|
|
|
|
aName.AssignLiteral("select");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
|
|
|
|
case eSwitchAction:
|
|
|
|
|
aName.AssignLiteral("switch");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2012-06-04 09:41:06 +04:00
|
|
|
|
|
2009-04-20 10:06:19 +04:00
|
|
|
|
case eSortAction:
|
|
|
|
|
aName.AssignLiteral("sort");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2012-06-04 09:41:06 +04:00
|
|
|
|
|
2009-04-20 10:06:19 +04:00
|
|
|
|
case eExpandAction:
|
2012-06-04 09:41:06 +04:00
|
|
|
|
if (State() & states::COLLAPSED)
|
2009-04-20 10:06:19 +04:00
|
|
|
|
aName.AssignLiteral("expand");
|
|
|
|
|
else
|
|
|
|
|
aName.AssignLiteral("collapse");
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2008-03-16 04:23:41 +03:00
|
|
|
|
}
|
2003-04-02 00:02:51 +04:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
bool
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::DoAction(uint8_t aIndex)
|
2003-04-02 00:02:51 +04:00
|
|
|
|
{
|
2008-03-16 04:23:41 +03:00
|
|
|
|
if (aIndex != 0)
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return false;
|
2008-03-16 04:23:41 +03:00
|
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
|
if (GetActionRule() != eNoAction) {
|
2010-01-25 18:09:25 +03:00
|
|
|
|
DoCommand();
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return true;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
}
|
2008-03-16 04:23:41 +03:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return false;
|
2003-04-02 00:02:51 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
nsIContent*
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::GetAtomicRegion() const
|
2007-09-19 01:40:04 +04:00
|
|
|
|
{
|
2010-06-11 12:23:18 +04:00
|
|
|
|
nsIContent *loopContent = mContent;
|
2007-09-19 01:40:04 +04:00
|
|
|
|
nsAutoString atomic;
|
2011-06-04 01:35:17 +04:00
|
|
|
|
while (loopContent && !loopContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_atomic, atomic))
|
2007-09-19 01:40:04 +04:00
|
|
|
|
loopContent = loopContent->GetParent();
|
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return atomic.EqualsLiteral("true") ? loopContent : nullptr;
|
2007-09-19 01:40:04 +04:00
|
|
|
|
}
|
2006-07-21 01:08:57 +04:00
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
Relation
|
2013-10-19 22:19:50 +04:00
|
|
|
|
Accessible::RelationByType(RelationType aType)
|
2011-08-10 05:44:00 +04:00
|
|
|
|
{
|
2012-10-31 06:25:17 +04:00
|
|
|
|
if (!HasOwnContent())
|
|
|
|
|
return Relation();
|
|
|
|
|
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
|
2009-02-10 13:03:30 +03:00
|
|
|
|
// Relationships are defined on the same content node that the role would be
|
|
|
|
|
// defined on.
|
2011-08-10 05:44:00 +04:00
|
|
|
|
switch (aType) {
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::LABELLED_BY: {
|
2012-03-23 09:26:52 +04:00
|
|
|
|
Relation rel(new IDRefsIterator(mDoc, mContent,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_labelledby));
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsHTMLElement()) {
|
2011-11-10 02:52:00 +04:00
|
|
|
|
rel.AppendIter(new HTMLLabelIterator(Document(), this));
|
2015-03-03 14:08:59 +03:00
|
|
|
|
} else if (mContent->IsXULElement()) {
|
2011-11-10 02:52:00 +04:00
|
|
|
|
rel.AppendIter(new XULLabelIterator(Document(), mContent));
|
2010-11-20 05:37:18 +03:00
|
|
|
|
}
|
2009-02-10 13:03:30 +03:00
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
return rel;
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::LABEL_FOR: {
|
2013-02-26 11:17:10 +04:00
|
|
|
|
Relation rel(new RelatedAccIterator(Document(), mContent,
|
|
|
|
|
nsGkAtoms::aria_labelledby));
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsXULElement(nsGkAtoms::label))
|
2013-09-20 01:51:58 +04:00
|
|
|
|
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::control));
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
|
|
|
|
return rel;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::DESCRIBED_BY: {
|
2012-03-23 09:26:52 +04:00
|
|
|
|
Relation rel(new IDRefsIterator(mDoc, mContent,
|
|
|
|
|
nsGkAtoms::aria_describedby));
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsXULElement())
|
2011-11-10 02:52:00 +04:00
|
|
|
|
rel.AppendIter(new XULDescriptionIterator(Document(), mContent));
|
2009-02-10 13:03:30 +03:00
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
return rel;
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::DESCRIPTION_FOR: {
|
2011-11-10 02:52:00 +04:00
|
|
|
|
Relation rel(new RelatedAccIterator(Document(), mContent,
|
|
|
|
|
nsGkAtoms::aria_describedby));
|
2009-02-10 13:03:30 +03:00
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
// This affectively adds an optional control attribute to xul:description,
|
|
|
|
|
// which only affects accessibility, by allowing the description to be
|
|
|
|
|
// tied to a control.
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsXULElement(nsGkAtoms::description))
|
2012-03-23 09:26:52 +04:00
|
|
|
|
rel.AppendIter(new IDRefsIterator(mDoc, mContent,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::control));
|
2009-02-10 13:03:30 +03:00
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
return rel;
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::NODE_CHILD_OF: {
|
2015-11-02 20:42:27 +03:00
|
|
|
|
Relation rel;
|
2009-10-20 11:53:49 +04:00
|
|
|
|
// This is an ARIA tree or treegrid that doesn't use owns, so we need to
|
|
|
|
|
// get the parent the hard way.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (roleMapEntry && (roleMapEntry->role == roles::OUTLINEITEM ||
|
|
|
|
|
roleMapEntry->role == roles::LISTITEM ||
|
|
|
|
|
roleMapEntry->role == roles::ROW)) {
|
2013-02-26 11:17:10 +04:00
|
|
|
|
rel.AppendTarget(GetGroupInfo()->ConceptualParent());
|
2008-02-09 05:14:03 +03:00
|
|
|
|
}
|
2009-02-10 13:03:30 +03:00
|
|
|
|
|
2009-07-22 04:45:04 +04:00
|
|
|
|
// If accessible is in its own Window, or is the root of a document,
|
|
|
|
|
// then we should provide NODE_CHILD_OF relation so that MSAA clients
|
|
|
|
|
// can easily get to true parent instead of getting to oleacc's
|
|
|
|
|
// ROLE_WINDOW accessible which will prevent us from going up further
|
|
|
|
|
// (because it is system generated and has no idea about the hierarchy
|
|
|
|
|
// above it).
|
2008-03-06 06:45:43 +03:00
|
|
|
|
nsIFrame *frame = GetFrame();
|
|
|
|
|
if (frame) {
|
2016-04-16 02:37:35 +03:00
|
|
|
|
nsView *view = frame->GetView();
|
2008-03-06 06:45:43 +03:00
|
|
|
|
if (view) {
|
2009-01-12 22:20:59 +03:00
|
|
|
|
nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
|
2011-07-23 12:38:33 +04:00
|
|
|
|
if (scrollFrame || view->GetWidget() || !frame->GetParent())
|
2011-08-10 05:44:00 +04:00
|
|
|
|
rel.AppendTarget(Parent());
|
2008-03-06 06:45:43 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-02-10 13:03:30 +03:00
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
return rel;
|
2007-03-16 19:03:30 +03:00
|
|
|
|
}
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::NODE_PARENT_OF: {
|
2013-02-26 11:17:10 +04:00
|
|
|
|
// ARIA tree or treegrid can do the hierarchy by @aria-level, ARIA trees
|
|
|
|
|
// also can be organized by groups.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
if (roleMapEntry &&
|
|
|
|
|
(roleMapEntry->role == roles::OUTLINEITEM ||
|
|
|
|
|
roleMapEntry->role == roles::LISTITEM ||
|
|
|
|
|
roleMapEntry->role == roles::ROW ||
|
|
|
|
|
roleMapEntry->role == roles::OUTLINE ||
|
|
|
|
|
roleMapEntry->role == roles::LIST ||
|
|
|
|
|
roleMapEntry->role == roles::TREE_TABLE)) {
|
2015-11-02 20:42:27 +03:00
|
|
|
|
return Relation(new ItemIterator(this));
|
2013-02-26 11:17:10 +04:00
|
|
|
|
}
|
|
|
|
|
|
2015-11-02 20:42:27 +03:00
|
|
|
|
return Relation();
|
2013-02-26 11:17:10 +04:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::CONTROLLED_BY:
|
2011-11-10 02:52:00 +04:00
|
|
|
|
return Relation(new RelatedAccIterator(Document(), mContent,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_controls));
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::CONTROLLER_FOR: {
|
2012-03-23 09:26:52 +04:00
|
|
|
|
Relation rel(new IDRefsIterator(mDoc, mContent,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_controls));
|
2011-11-10 02:52:00 +04:00
|
|
|
|
rel.AppendIter(new HTMLOutputIterator(Document(), mContent));
|
2011-08-10 05:44:00 +04:00
|
|
|
|
return rel;
|
2006-07-21 01:08:57 +04:00
|
|
|
|
}
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::FLOWS_TO:
|
2012-03-23 09:26:52 +04:00
|
|
|
|
return Relation(new IDRefsIterator(mDoc, mContent,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_flowto));
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::FLOWS_FROM:
|
2011-11-10 02:52:00 +04:00
|
|
|
|
return Relation(new RelatedAccIterator(Document(), mContent,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_flowto));
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::MEMBER_OF:
|
2013-02-26 11:17:10 +04:00
|
|
|
|
return Relation(mDoc, GetAtomicRegion());
|
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::SUBWINDOW_OF:
|
|
|
|
|
case RelationType::EMBEDS:
|
|
|
|
|
case RelationType::EMBEDDED_BY:
|
|
|
|
|
case RelationType::POPUP_FOR:
|
|
|
|
|
case RelationType::PARENT_WINDOW_OF:
|
2013-02-26 11:17:10 +04:00
|
|
|
|
return Relation();
|
|
|
|
|
|
2013-10-19 22:19:50 +04:00
|
|
|
|
case RelationType::DEFAULT_BUTTON: {
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsHTMLElement()) {
|
2007-08-10 17:03:52 +04:00
|
|
|
|
// HTML form controls implements nsIFormControl interface.
|
2010-06-11 12:23:18 +04:00
|
|
|
|
nsCOMPtr<nsIFormControl> control(do_QueryInterface(mContent));
|
2007-08-10 17:03:52 +04:00
|
|
|
|
if (control) {
|
2010-05-09 23:33:00 +04:00
|
|
|
|
nsCOMPtr<nsIForm> form(do_QueryInterface(control->GetFormElement()));
|
2009-02-10 13:03:30 +03:00
|
|
|
|
if (form) {
|
|
|
|
|
nsCOMPtr<nsIContent> formContent =
|
|
|
|
|
do_QueryInterface(form->GetDefaultSubmitElement());
|
2012-05-08 04:00:29 +04:00
|
|
|
|
return Relation(mDoc, formContent);
|
2009-02-10 13:03:30 +03:00
|
|
|
|
}
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
2011-08-10 05:44:00 +04:00
|
|
|
|
} else {
|
2005-06-24 20:29:15 +04:00
|
|
|
|
// In XUL, use first <button default="true" .../> in the document
|
2010-06-11 12:23:18 +04:00
|
|
|
|
nsCOMPtr<nsIDOMXULDocument> xulDoc =
|
2011-10-18 14:53:36 +04:00
|
|
|
|
do_QueryInterface(mContent->OwnerDoc());
|
2005-06-24 20:29:15 +04:00
|
|
|
|
nsCOMPtr<nsIDOMXULButtonElement> buttonEl;
|
|
|
|
|
if (xulDoc) {
|
|
|
|
|
nsCOMPtr<nsIDOMNodeList> possibleDefaultButtons;
|
|
|
|
|
xulDoc->GetElementsByAttribute(NS_LITERAL_STRING("default"),
|
|
|
|
|
NS_LITERAL_STRING("true"),
|
|
|
|
|
getter_AddRefs(possibleDefaultButtons));
|
|
|
|
|
if (possibleDefaultButtons) {
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t length;
|
2005-06-24 20:29:15 +04:00
|
|
|
|
possibleDefaultButtons->GetLength(&length);
|
|
|
|
|
nsCOMPtr<nsIDOMNode> possibleButton;
|
|
|
|
|
// Check for button in list of default="true" elements
|
2012-08-22 19:56:38 +04:00
|
|
|
|
for (uint32_t count = 0; count < length && !buttonEl; count ++) {
|
2005-06-24 20:29:15 +04:00
|
|
|
|
possibleDefaultButtons->Item(count, getter_AddRefs(possibleButton));
|
|
|
|
|
buttonEl = do_QueryInterface(possibleButton);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (!buttonEl) { // Check for anonymous accept button in <dialog>
|
2012-05-28 08:52:53 +04:00
|
|
|
|
dom::Element* rootElm = mContent->OwnerDoc()->GetRootElement();
|
|
|
|
|
if (rootElm) {
|
|
|
|
|
nsIContent* possibleButtonEl = rootElm->OwnerDoc()->
|
|
|
|
|
GetAnonymousElementByAttribute(rootElm, nsGkAtoms::_default,
|
|
|
|
|
NS_LITERAL_STRING("true"));
|
|
|
|
|
buttonEl = do_QueryInterface(possibleButtonEl);
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2009-02-10 13:03:30 +03:00
|
|
|
|
nsCOMPtr<nsIContent> relatedContent(do_QueryInterface(buttonEl));
|
2012-05-08 04:00:29 +04:00
|
|
|
|
return Relation(mDoc, relatedContent);
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2011-08-10 05:44:00 +04:00
|
|
|
|
return Relation();
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
2013-02-26 11:17:10 +04:00
|
|
|
|
|
2013-10-25 19:14:32 +04:00
|
|
|
|
case RelationType::CONTAINING_DOCUMENT:
|
|
|
|
|
return Relation(mDoc);
|
|
|
|
|
|
|
|
|
|
case RelationType::CONTAINING_TAB_PANE: {
|
|
|
|
|
nsCOMPtr<nsIDocShell> docShell =
|
|
|
|
|
nsCoreUtils::GetDocShellFor(GetNode());
|
|
|
|
|
if (docShell) {
|
|
|
|
|
// Walk up the parent chain without crossing the boundary at which item
|
|
|
|
|
// types change, preventing us from walking up out of tab content.
|
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> root;
|
|
|
|
|
docShell->GetSameTypeRootTreeItem(getter_AddRefs(root));
|
|
|
|
|
if (root) {
|
|
|
|
|
// If the item type is typeContent, we assume we are in browser tab
|
|
|
|
|
// content. Note, this includes content such as about:addons,
|
|
|
|
|
// for consistency.
|
2014-01-20 11:58:26 +04:00
|
|
|
|
if (root->ItemType() == nsIDocShellTreeItem::typeContent) {
|
2013-10-25 19:14:32 +04:00
|
|
|
|
return Relation(nsAccUtils::GetDocAccessibleFor(root));
|
2014-01-20 11:58:26 +04:00
|
|
|
|
}
|
2013-10-25 19:14:32 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return Relation();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case RelationType::CONTAINING_APPLICATION:
|
|
|
|
|
return Relation(ApplicationAcc());
|
|
|
|
|
|
2011-08-10 05:44:00 +04:00
|
|
|
|
default:
|
2013-02-26 11:17:10 +04:00
|
|
|
|
return Relation();
|
2005-06-24 20:29:15 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-10-22 04:49:28 +04:00
|
|
|
|
void
|
|
|
|
|
Accessible::GetNativeInterface(void** aNativeAccessible)
|
2003-04-02 00:02:51 +04:00
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-25 18:09:25 +03:00
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::DoCommand(nsIContent *aContent, uint32_t aActionIndex)
|
2009-08-20 10:45:19 +04:00
|
|
|
|
{
|
2016-04-26 03:23:21 +03:00
|
|
|
|
class Runnable final : public mozilla::Runnable
|
2012-11-03 02:06:27 +04:00
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Runnable(Accessible* aAcc, nsIContent* aContent, uint32_t aIdx) :
|
|
|
|
|
mAcc(aAcc), mContent(aContent), mIdx(aIdx) { }
|
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
|
NS_IMETHOD Run() override
|
2012-11-03 02:06:27 +04:00
|
|
|
|
{
|
|
|
|
|
if (mAcc)
|
|
|
|
|
mAcc->DispatchClickEvent(mContent, mIdx);
|
|
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Revoke()
|
|
|
|
|
{
|
|
|
|
|
mAcc = nullptr;
|
|
|
|
|
mContent = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
|
RefPtr<Accessible> mAcc;
|
2012-11-03 02:06:27 +04:00
|
|
|
|
nsCOMPtr<nsIContent> mContent;
|
|
|
|
|
uint32_t mIdx;
|
|
|
|
|
};
|
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
|
nsIContent* content = aContent ? aContent : mContent.get();
|
2012-11-03 02:06:27 +04:00
|
|
|
|
nsCOMPtr<nsIRunnable> runnable = new Runnable(this, content, aActionIndex);
|
|
|
|
|
NS_DispatchToMainThread(runnable);
|
2009-08-20 10:45:19 +04:00
|
|
|
|
}
|
2008-08-06 16:16:54 +04:00
|
|
|
|
|
2009-08-20 10:45:19 +04:00
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::DispatchClickEvent(nsIContent *aContent, uint32_t aActionIndex)
|
2009-08-20 10:45:19 +04:00
|
|
|
|
{
|
|
|
|
|
if (IsDefunct())
|
2008-08-06 16:16:54 +04:00
|
|
|
|
return;
|
|
|
|
|
|
2013-08-05 08:00:08 +04:00
|
|
|
|
nsCOMPtr<nsIPresShell> presShell = mDoc->PresShell();
|
2008-08-06 16:16:54 +04:00
|
|
|
|
|
|
|
|
|
// Scroll into view.
|
2012-03-20 06:09:50 +04:00
|
|
|
|
presShell->ScrollContentIntoView(aContent,
|
|
|
|
|
nsIPresShell::ScrollAxis(),
|
|
|
|
|
nsIPresShell::ScrollAxis(),
|
2010-10-28 20:01:37 +04:00
|
|
|
|
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
|
2008-08-06 16:16:54 +04:00
|
|
|
|
|
2013-08-05 08:00:08 +04:00
|
|
|
|
nsWeakFrame frame = aContent->GetPrimaryFrame();
|
2013-07-25 19:59:08 +04:00
|
|
|
|
if (!frame)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Compute x and y coordinates.
|
|
|
|
|
nsPoint point;
|
|
|
|
|
nsCOMPtr<nsIWidget> widget = frame->GetNearestWidget(point);
|
|
|
|
|
if (!widget)
|
2008-08-06 16:16:54 +04:00
|
|
|
|
return;
|
|
|
|
|
|
2013-07-25 19:59:08 +04:00
|
|
|
|
nsSize size = frame->GetSize();
|
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
|
RefPtr<nsPresContext> presContext = presShell->GetPresContext();
|
2013-07-25 19:59:08 +04:00
|
|
|
|
int32_t x = presContext->AppUnitsToDevPixels(point.x + size.width / 2);
|
|
|
|
|
int32_t y = presContext->AppUnitsToDevPixels(point.y + size.height / 2);
|
|
|
|
|
|
|
|
|
|
// Simulate a touch interaction by dispatching touch events with mouse events.
|
2015-09-14 18:14:34 +03:00
|
|
|
|
nsCoreUtils::DispatchTouchEvent(eTouchStart, x, y, aContent, frame,
|
|
|
|
|
presShell, widget);
|
2015-08-29 02:58:30 +03:00
|
|
|
|
nsCoreUtils::DispatchMouseEvent(eMouseDown, x, y, aContent, frame,
|
|
|
|
|
presShell, widget);
|
2015-09-14 18:14:35 +03:00
|
|
|
|
nsCoreUtils::DispatchTouchEvent(eTouchEnd, x, y, aContent, frame,
|
|
|
|
|
presShell, widget);
|
2015-08-29 02:58:30 +03:00
|
|
|
|
nsCoreUtils::DispatchMouseEvent(eMouseUp, x, y, aContent, frame,
|
|
|
|
|
presShell, widget);
|
2005-02-01 12:40:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::ScrollToPoint(uint32_t aCoordinateType, int32_t aX, int32_t aY)
|
2012-02-07 17:18:33 +04:00
|
|
|
|
{
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsIFrame* frame = GetFrame();
|
2012-02-07 17:18:33 +04:00
|
|
|
|
if (!frame)
|
2014-09-16 21:30:23 +04:00
|
|
|
|
return;
|
2012-02-07 17:18:33 +04:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsIntPoint coords =
|
|
|
|
|
nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, this);
|
2012-02-07 17:18:33 +04:00
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
|
nsIFrame* parentFrame = frame;
|
2012-02-07 17:18:33 +04:00
|
|
|
|
while ((parentFrame = parentFrame->GetParent()))
|
|
|
|
|
nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords);
|
2006-06-21 17:29:10 +04:00
|
|
|
|
}
|
2003-03-20 11:27:31 +03:00
|
|
|
|
|
2011-02-01 06:00:24 +03:00
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
|
|
|
|
|
uint32_t aLength)
|
2007-04-11 08:17:33 +04:00
|
|
|
|
{
|
2010-06-10 07:29:56 +04:00
|
|
|
|
// Return text representation of non-text accessible within hypertext
|
|
|
|
|
// accessible. Text accessible overrides this method to return enclosed text.
|
2011-02-01 06:00:24 +03:00
|
|
|
|
if (aStartOffset != 0 || aLength == 0)
|
|
|
|
|
return;
|
2010-06-10 07:29:56 +04:00
|
|
|
|
|
|
|
|
|
nsIFrame *frame = GetFrame();
|
2011-02-01 06:00:24 +03:00
|
|
|
|
if (!frame)
|
|
|
|
|
return;
|
2010-06-10 07:29:56 +04:00
|
|
|
|
|
2012-05-29 21:15:49 +04:00
|
|
|
|
NS_ASSERTION(mParent,
|
|
|
|
|
"Called on accessible unbound from tree. Result can be wrong.");
|
|
|
|
|
|
2011-06-04 01:35:17 +04:00
|
|
|
|
if (frame->GetType() == nsGkAtoms::brFrame) {
|
2010-06-10 07:29:56 +04:00
|
|
|
|
aText += kForcedNewLineChar;
|
2012-05-29 21:15:49 +04:00
|
|
|
|
} else if (mParent && nsAccUtils::MustPrune(mParent)) {
|
2011-02-03 17:29:05 +03:00
|
|
|
|
// Expose the embedded object accessible as imaginary embedded object
|
|
|
|
|
// character if its parent hypertext accessible doesn't expose children to
|
|
|
|
|
// AT.
|
2010-06-10 07:29:56 +04:00
|
|
|
|
aText += kImaginaryEmbeddedObjectChar;
|
|
|
|
|
} else {
|
|
|
|
|
aText += kEmbeddedObjectChar;
|
|
|
|
|
}
|
2006-08-17 17:21:41 +04:00
|
|
|
|
}
|
2007-03-06 16:44:42 +03:00
|
|
|
|
|
2010-06-12 08:04:35 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::Shutdown()
|
2010-06-12 08:04:35 +04:00
|
|
|
|
{
|
2014-05-23 04:10:19 +04:00
|
|
|
|
// Mark the accessible as defunct, invalidate the child count and pointers to
|
2012-03-28 19:59:01 +04:00
|
|
|
|
// other accessibles, also make sure none of its children point to this parent
|
2012-12-11 07:31:42 +04:00
|
|
|
|
mStateFlags |= eIsDefunct;
|
2012-03-28 19:59:01 +04:00
|
|
|
|
|
2016-04-01 03:46:58 +03:00
|
|
|
|
int32_t childCount = mChildren.Length();
|
|
|
|
|
for (int32_t childIdx = 0; childIdx < childCount; childIdx++) {
|
|
|
|
|
mChildren.ElementAt(childIdx)->UnbindFromParent();
|
|
|
|
|
}
|
|
|
|
|
mChildren.Clear();
|
|
|
|
|
|
|
|
|
|
mEmbeddedObjCollector = nullptr;
|
|
|
|
|
|
2010-10-21 08:16:10 +04:00
|
|
|
|
if (mParent)
|
|
|
|
|
mParent->RemoveChild(this);
|
2010-06-12 08:04:35 +04:00
|
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
|
mContent = nullptr;
|
|
|
|
|
mDoc = nullptr;
|
2014-05-23 21:15:07 +04:00
|
|
|
|
if (SelectionMgr() && SelectionMgr()->AccessibleWithCaret(nullptr) == this)
|
2014-05-01 19:45:40 +04:00
|
|
|
|
SelectionMgr()->ResetCaretOffset();
|
2010-06-12 08:04:35 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-13 10:34:21 +04:00
|
|
|
|
// Accessible protected
|
|
|
|
|
void
|
2012-10-17 10:38:16 +04:00
|
|
|
|
Accessible::ARIAName(nsString& aName)
|
2008-10-10 16:26:55 +04:00
|
|
|
|
{
|
2010-08-06 17:58:15 +04:00
|
|
|
|
// aria-labelledby now takes precedence over aria-label
|
2009-02-19 10:06:14 +03:00
|
|
|
|
nsresult rv = nsTextEquivUtils::
|
2012-10-17 10:38:16 +04:00
|
|
|
|
GetTextEquivFromIDRefs(this, nsGkAtoms::aria_labelledby, aName);
|
2009-02-19 10:06:14 +03:00
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2012-10-17 10:38:16 +04:00
|
|
|
|
aName.CompressWhitespace();
|
2009-02-19 10:06:14 +03:00
|
|
|
|
}
|
2008-10-10 16:26:55 +04:00
|
|
|
|
|
2012-10-17 10:38:16 +04:00
|
|
|
|
if (aName.IsEmpty() &&
|
|
|
|
|
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_label, aName)) {
|
|
|
|
|
aName.CompressWhitespace();
|
2010-08-06 17:58:15 +04:00
|
|
|
|
}
|
2008-10-10 16:26:55 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
|
// Accessible protected
|
|
|
|
|
ENameValueFlag
|
|
|
|
|
Accessible::NativeName(nsString& aName)
|
2008-10-10 16:26:55 +04:00
|
|
|
|
{
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsHTMLElement()) {
|
2013-12-08 01:37:04 +04:00
|
|
|
|
Accessible* label = nullptr;
|
|
|
|
|
HTMLLabelIterator iter(Document(), this);
|
|
|
|
|
while ((label = iter.Next())) {
|
|
|
|
|
nsTextEquivUtils::AppendTextEquivFromContent(this, label->GetContent(),
|
|
|
|
|
&aName);
|
|
|
|
|
aName.CompressWhitespace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!aName.IsEmpty())
|
|
|
|
|
return eNameOK;
|
2012-10-17 10:38:16 +04:00
|
|
|
|
|
2013-12-08 01:37:04 +04:00
|
|
|
|
nsTextEquivUtils::GetNameFromSubtree(this, aName);
|
|
|
|
|
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
|
|
|
|
|
}
|
|
|
|
|
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsXULElement()) {
|
2013-12-08 01:37:04 +04:00
|
|
|
|
XULElmName(mDoc, mContent, aName);
|
|
|
|
|
if (!aName.IsEmpty())
|
|
|
|
|
return eNameOK;
|
|
|
|
|
|
|
|
|
|
nsTextEquivUtils::GetNameFromSubtree(this, aName);
|
|
|
|
|
return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
|
|
|
|
|
}
|
2008-10-10 16:26:55 +04:00
|
|
|
|
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsSVGElement()) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
// If user agents need to choose among multiple ‘desc’ or ‘title’ elements
|
|
|
|
|
// for processing, the user agent shall choose the first one.
|
|
|
|
|
for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
|
|
|
|
|
childElm = childElm->GetNextSibling()) {
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (childElm->IsSVGElement(nsGkAtoms::title)) {
|
2012-12-31 12:04:08 +04:00
|
|
|
|
nsTextEquivUtils::AppendTextEquivFromContent(this, childElm, &aName);
|
|
|
|
|
return eNameOK;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
|
return eNameOK;
|
2008-10-10 16:26:55 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
// Accessible protected
|
2016-05-23 01:12:54 +03:00
|
|
|
|
void
|
|
|
|
|
Accessible::NativeDescription(nsString& aDescription)
|
|
|
|
|
{
|
|
|
|
|
bool isXUL = mContent->IsXULElement();
|
|
|
|
|
if (isXUL) {
|
|
|
|
|
// Try XUL <description control="[id]">description text</description>
|
|
|
|
|
XULDescriptionIterator iter(Document(), mContent);
|
|
|
|
|
Accessible* descr = nullptr;
|
|
|
|
|
while ((descr = iter.Next())) {
|
|
|
|
|
nsTextEquivUtils::AppendTextEquivFromContent(this, descr->GetContent(),
|
|
|
|
|
&aDescription);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Accessible protected
|
2009-12-10 22:12:19 +03:00
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::BindToParent(Accessible* aParent, uint32_t aIndexInParent)
|
2009-12-10 22:12:19 +03:00
|
|
|
|
{
|
2016-04-01 18:07:57 +03:00
|
|
|
|
MOZ_ASSERT(aParent, "This method isn't used to set null parent");
|
|
|
|
|
MOZ_ASSERT(!mParent, "The child was expected to be moved");
|
2009-12-10 22:12:19 +03:00
|
|
|
|
|
2016-03-28 20:40:21 +03:00
|
|
|
|
#ifdef A11Y_LOG
|
2016-04-01 18:07:57 +03:00
|
|
|
|
if (mParent) {
|
|
|
|
|
logging::TreeInfo("BindToParent: stealing accessible", 0,
|
2016-04-12 18:20:56 +03:00
|
|
|
|
"old parent", mParent,
|
2016-04-01 18:07:57 +03:00
|
|
|
|
"new parent", aParent,
|
|
|
|
|
"child", this, nullptr);
|
2009-12-10 22:12:19 +03:00
|
|
|
|
}
|
2016-04-01 18:07:57 +03:00
|
|
|
|
#endif
|
2009-12-10 22:12:19 +03:00
|
|
|
|
|
|
|
|
|
mParent = aParent;
|
2010-07-02 05:22:41 +04:00
|
|
|
|
mIndexInParent = aIndexInParent;
|
2014-03-28 18:01:06 +04:00
|
|
|
|
|
2014-03-31 18:30:46 +04:00
|
|
|
|
// Note: this is currently only used for richlistitems and their children.
|
|
|
|
|
if (mParent->HasNameDependentParent() || mParent->IsXULListItem())
|
|
|
|
|
mContextFlags |= eHasNameDependentParent;
|
|
|
|
|
else
|
|
|
|
|
mContextFlags &= ~eHasNameDependentParent;
|
2015-02-05 02:33:33 +03:00
|
|
|
|
|
|
|
|
|
if (mParent->IsARIAHidden() || aria::HasDefinedARIAHidden(mContent))
|
|
|
|
|
SetARIAHidden(true);
|
2016-02-29 18:08:40 +03:00
|
|
|
|
|
|
|
|
|
mContextFlags |=
|
|
|
|
|
static_cast<uint32_t>((mParent->IsAlert() ||
|
|
|
|
|
mParent->IsInsideAlert())) & eInsideAlert;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
|
// Accessible protected
|
2010-07-16 18:15:03 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::UnbindFromParent()
|
2010-07-16 18:15:03 +04:00
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
|
mParent = nullptr;
|
2010-07-16 18:15:03 +04:00
|
|
|
|
mIndexInParent = -1;
|
2015-10-08 21:40:31 +03:00
|
|
|
|
mInt.mIndexOfEmbeddedChild = -1;
|
2015-01-20 00:34:14 +03:00
|
|
|
|
if (IsProxy())
|
|
|
|
|
MOZ_CRASH("this should never be called on proxy wrappers");
|
|
|
|
|
|
|
|
|
|
delete mBits.groupInfo;
|
|
|
|
|
mBits.groupInfo = nullptr;
|
2016-02-29 18:08:40 +03:00
|
|
|
|
mContextFlags &= ~eHasNameDependentParent & ~eInsideAlert;
|
2010-07-16 18:15:03 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Accessible public methods
|
|
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
|
RootAccessible*
|
|
|
|
|
Accessible::RootAccessible() const
|
|
|
|
|
{
|
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = nsCoreUtils::GetDocShellFor(GetNode());
|
|
|
|
|
NS_ASSERTION(docShell, "No docshell for mContent");
|
|
|
|
|
if (!docShell) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> root;
|
|
|
|
|
docShell->GetRootTreeItem(getter_AddRefs(root));
|
|
|
|
|
NS_ASSERTION(root, "No root content tree item");
|
|
|
|
|
if (!root) {
|
|
|
|
|
return nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DocAccessible* docAcc = nsAccUtils::GetDocAccessibleFor(root);
|
|
|
|
|
return docAcc ? docAcc->AsRoot() : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nsIFrame*
|
|
|
|
|
Accessible::GetFrame() const
|
|
|
|
|
{
|
|
|
|
|
return mContent ? mContent->GetPrimaryFrame() : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nsINode*
|
|
|
|
|
Accessible::GetNode() const
|
|
|
|
|
{
|
|
|
|
|
return mContent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Accessible::Language(nsAString& aLanguage)
|
|
|
|
|
{
|
|
|
|
|
aLanguage.Truncate();
|
|
|
|
|
|
|
|
|
|
if (!mDoc)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
nsCoreUtils::GetLanguageFor(mContent, nullptr, aLanguage);
|
|
|
|
|
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
|
|
|
|
|
mDoc->DocumentNode()->GetHeaderData(nsGkAtoms::headerContentLanguage,
|
|
|
|
|
aLanguage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
|
bool
|
2013-03-14 08:53:28 +04:00
|
|
|
|
Accessible::InsertChildAt(uint32_t aIndex, Accessible* aChild)
|
2010-07-02 05:22:41 +04:00
|
|
|
|
{
|
2010-11-09 13:21:56 +03:00
|
|
|
|
if (!aChild)
|
2011-10-17 18:59:28 +04:00
|
|
|
|
return false;
|
2010-11-09 13:21:56 +03:00
|
|
|
|
|
2013-03-14 08:53:28 +04:00
|
|
|
|
if (aIndex == mChildren.Length()) {
|
|
|
|
|
if (!mChildren.AppendElement(aChild))
|
|
|
|
|
return false;
|
2010-08-15 15:28:49 +04:00
|
|
|
|
|
2013-03-14 08:53:28 +04:00
|
|
|
|
} else {
|
|
|
|
|
if (!mChildren.InsertElementAt(aIndex, aChild))
|
|
|
|
|
return false;
|
2010-11-09 13:21:56 +03:00
|
|
|
|
|
2016-04-01 17:53:52 +03:00
|
|
|
|
MOZ_ASSERT(mStateFlags & eKidsMutating, "Illicit children change");
|
2016-05-05 17:42:00 +03:00
|
|
|
|
|
|
|
|
|
for (uint32_t idx = aIndex + 1; idx < mChildren.Length(); idx++) {
|
|
|
|
|
mChildren[idx]->mIndexInParent = idx;
|
|
|
|
|
}
|
2010-11-09 13:21:56 +03:00
|
|
|
|
}
|
2010-07-02 05:22:41 +04:00
|
|
|
|
|
2016-04-08 15:35:11 +03:00
|
|
|
|
if (aChild->IsText()) {
|
2016-04-06 00:34:00 +03:00
|
|
|
|
mStateFlags |= eHasTextKids;
|
|
|
|
|
}
|
2010-08-15 15:28:49 +04:00
|
|
|
|
|
2010-07-02 05:22:41 +04:00
|
|
|
|
aChild->BindToParent(this, aIndex);
|
2011-10-17 18:59:28 +04:00
|
|
|
|
return true;
|
2010-07-02 05:22:41 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
|
bool
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::RemoveChild(Accessible* aChild)
|
2010-07-02 05:22:41 +04:00
|
|
|
|
{
|
2010-11-09 13:21:56 +03:00
|
|
|
|
if (!aChild)
|
2011-10-17 18:59:28 +04:00
|
|
|
|
return false;
|
2010-11-09 13:21:56 +03:00
|
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
|
if (aChild->mParent != this || aChild->mIndexInParent == -1)
|
2011-10-17 18:59:28 +04:00
|
|
|
|
return false;
|
2010-07-02 05:22:41 +04:00
|
|
|
|
|
2016-04-01 17:53:52 +03:00
|
|
|
|
MOZ_ASSERT((mStateFlags & eKidsMutating) || aChild->IsDefunct() || aChild->IsDoc(),
|
|
|
|
|
"Illicit children change");
|
2010-10-25 17:01:30 +04:00
|
|
|
|
|
2016-04-01 17:53:52 +03:00
|
|
|
|
int32_t index = static_cast<uint32_t>(aChild->mIndexInParent);
|
2016-05-05 17:42:00 +03:00
|
|
|
|
MOZ_ASSERT(mChildren.SafeElementAt(index) == aChild,
|
|
|
|
|
"A wrong child index");
|
2010-07-02 05:22:41 +04:00
|
|
|
|
|
2010-11-09 13:21:56 +03:00
|
|
|
|
aChild->UnbindFromParent();
|
|
|
|
|
mChildren.RemoveElementAt(index);
|
2016-05-05 17:42:00 +03:00
|
|
|
|
|
|
|
|
|
for (uint32_t idx = index; idx < mChildren.Length(); idx++) {
|
|
|
|
|
mChildren[idx]->mIndexInParent = idx;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
|
return true;
|
2010-07-02 05:22:41 +04:00
|
|
|
|
}
|
|
|
|
|
|
2016-02-19 21:11:33 +03:00
|
|
|
|
void
|
|
|
|
|
Accessible::MoveChild(uint32_t aNewIndex, Accessible* aChild)
|
|
|
|
|
{
|
|
|
|
|
MOZ_ASSERT(aChild, "No child was given");
|
|
|
|
|
MOZ_ASSERT(aChild->mParent == this, "A child from different subtree was given");
|
|
|
|
|
MOZ_ASSERT(aChild->mIndexInParent != -1, "Unbound child was given");
|
|
|
|
|
MOZ_ASSERT(static_cast<uint32_t>(aChild->mIndexInParent) != aNewIndex,
|
|
|
|
|
"No move, same index");
|
|
|
|
|
MOZ_ASSERT(aNewIndex <= mChildren.Length(), "Wrong new index was given");
|
|
|
|
|
|
2016-04-07 16:30:22 +03:00
|
|
|
|
EventTree* eventTree = mDoc->Controller()->QueueMutation(this);
|
|
|
|
|
if (eventTree) {
|
|
|
|
|
eventTree->Hidden(aChild, false);
|
|
|
|
|
}
|
|
|
|
|
|
2016-02-19 21:11:33 +03:00
|
|
|
|
mEmbeddedObjCollector = nullptr;
|
|
|
|
|
mChildren.RemoveElementAt(aChild->mIndexInParent);
|
|
|
|
|
|
|
|
|
|
uint32_t startIdx = aNewIndex, endIdx = aChild->mIndexInParent;
|
|
|
|
|
|
|
|
|
|
// If the child is moved after its current position.
|
|
|
|
|
if (static_cast<uint32_t>(aChild->mIndexInParent) < aNewIndex) {
|
|
|
|
|
startIdx = aChild->mIndexInParent;
|
|
|
|
|
if (aNewIndex == mChildren.Length() + 1) {
|
|
|
|
|
// The child is moved to the end.
|
|
|
|
|
mChildren.AppendElement(aChild);
|
|
|
|
|
endIdx = mChildren.Length() - 1;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
mChildren.InsertElementAt(aNewIndex - 1, aChild);
|
|
|
|
|
endIdx = aNewIndex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// The child is moved prior its current position.
|
|
|
|
|
mChildren.InsertElementAt(aNewIndex, aChild);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (uint32_t idx = startIdx; idx <= endIdx; idx++) {
|
|
|
|
|
mChildren[idx]->mIndexInParent = idx;
|
2016-04-01 17:53:52 +03:00
|
|
|
|
mChildren[idx]->mStateFlags |= eGroupInfoDirty;
|
2016-02-19 21:11:33 +03:00
|
|
|
|
mChildren[idx]->mInt.mIndexOfEmbeddedChild = -1;
|
|
|
|
|
}
|
2016-04-07 16:30:22 +03:00
|
|
|
|
|
|
|
|
|
if (eventTree) {
|
|
|
|
|
eventTree->Shown(aChild);
|
|
|
|
|
mDoc->Controller()->QueueNameChange(aChild);
|
|
|
|
|
}
|
2016-02-19 21:11:33 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
2014-01-25 07:08:17 +04:00
|
|
|
|
Accessible::GetChildAt(uint32_t aIndex) const
|
2009-12-10 22:12:19 +03:00
|
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* child = mChildren.SafeElementAt(aIndex, nullptr);
|
2009-12-10 22:12:19 +03:00
|
|
|
|
if (!child)
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return nullptr;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* realParent = child->mParent;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
NS_ASSERTION(!realParent || realParent == this,
|
|
|
|
|
"Two accessibles have the same first child accessible!");
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
return child;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::ChildCount() const
|
2009-12-10 22:12:19 +03:00
|
|
|
|
{
|
2011-04-07 09:17:54 +04:00
|
|
|
|
return mChildren.Length();
|
2009-12-10 22:12:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
int32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::IndexInParent() const
|
2009-12-10 22:12:19 +03:00
|
|
|
|
{
|
2010-07-02 05:22:41 +04:00
|
|
|
|
return mIndexInParent;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::EmbeddedChildCount()
|
2010-08-15 15:28:49 +04:00
|
|
|
|
{
|
2016-04-06 00:34:00 +03:00
|
|
|
|
if (mStateFlags & eHasTextKids) {
|
2010-08-15 15:28:49 +04:00
|
|
|
|
if (!mEmbeddedObjCollector)
|
2016-06-29 13:57:00 +03:00
|
|
|
|
mEmbeddedObjCollector.reset(new EmbeddedObjCollector(this));
|
2012-05-25 14:53:45 +04:00
|
|
|
|
return mEmbeddedObjCollector->Count();
|
2010-08-15 15:28:49 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-25 14:53:45 +04:00
|
|
|
|
return ChildCount();
|
2010-08-15 15:28:49 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::GetEmbeddedChildAt(uint32_t aIndex)
|
2010-08-15 15:28:49 +04:00
|
|
|
|
{
|
2016-04-06 00:34:00 +03:00
|
|
|
|
if (mStateFlags & eHasTextKids) {
|
2010-08-15 15:28:49 +04:00
|
|
|
|
if (!mEmbeddedObjCollector)
|
2016-06-29 13:57:00 +03:00
|
|
|
|
mEmbeddedObjCollector.reset(new EmbeddedObjCollector(this));
|
|
|
|
|
return mEmbeddedObjCollector.get() ?
|
2012-07-30 18:20:58 +04:00
|
|
|
|
mEmbeddedObjCollector->GetAccessibleAt(aIndex) : nullptr;
|
2010-08-15 15:28:49 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return GetChildAt(aIndex);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
int32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::GetIndexOfEmbeddedChild(Accessible* aChild)
|
2010-08-15 15:28:49 +04:00
|
|
|
|
{
|
2016-04-06 00:34:00 +03:00
|
|
|
|
if (mStateFlags & eHasTextKids) {
|
2010-08-15 15:28:49 +04:00
|
|
|
|
if (!mEmbeddedObjCollector)
|
2016-06-29 13:57:00 +03:00
|
|
|
|
mEmbeddedObjCollector.reset(new EmbeddedObjCollector(this));
|
|
|
|
|
return mEmbeddedObjCollector.get() ?
|
2010-08-15 15:28:49 +04:00
|
|
|
|
mEmbeddedObjCollector->GetIndexAt(aChild) : -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return GetIndexOf(aChild);
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-01 07:26:13 +04:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// HyperLinkAccessible methods
|
|
|
|
|
|
|
|
|
|
bool
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::IsLink()
|
2010-09-01 07:26:13 +04:00
|
|
|
|
{
|
|
|
|
|
// Every embedded accessible within hypertext accessible implements
|
|
|
|
|
// hyperlink interface.
|
2016-04-08 15:35:11 +03:00
|
|
|
|
return mParent && mParent->IsHyperText() && !IsText();
|
2010-09-01 07:26:13 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::StartOffset()
|
2010-09-01 07:26:13 +04:00
|
|
|
|
{
|
2011-06-24 08:29:43 +04:00
|
|
|
|
NS_PRECONDITION(IsLink(), "StartOffset is called not on hyper link!");
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
|
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
|
2010-09-01 07:26:13 +04:00
|
|
|
|
return hyperText ? hyperText->GetChildOffset(this) : 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::EndOffset()
|
2010-09-01 07:26:13 +04:00
|
|
|
|
{
|
2011-06-24 08:29:43 +04:00
|
|
|
|
NS_PRECONDITION(IsLink(), "EndOffset is called on not hyper link!");
|
2010-09-01 07:26:13 +04:00
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
|
HyperTextAccessible* hyperText = mParent ? mParent->AsHyperText() : nullptr;
|
2010-09-01 07:26:13 +04:00
|
|
|
|
return hyperText ? (hyperText->GetChildOffset(this) + 1) : 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::AnchorCount()
|
2010-09-01 07:26:13 +04:00
|
|
|
|
{
|
2011-06-24 08:29:43 +04:00
|
|
|
|
NS_PRECONDITION(IsLink(), "AnchorCount is called on not hyper link!");
|
2010-09-01 07:26:13 +04:00
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::AnchorAt(uint32_t aAnchorIndex)
|
2010-09-01 07:26:13 +04:00
|
|
|
|
{
|
2011-06-24 08:29:43 +04:00
|
|
|
|
NS_PRECONDITION(IsLink(), "GetAnchor is called on not hyper link!");
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return aAnchorIndex == 0 ? this : nullptr;
|
2010-09-01 07:26:13 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
already_AddRefed<nsIURI>
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::AnchorURIAt(uint32_t aAnchorIndex)
|
2010-09-01 07:26:13 +04:00
|
|
|
|
{
|
2011-06-24 08:29:43 +04:00
|
|
|
|
NS_PRECONDITION(IsLink(), "AnchorURIAt is called on not hyper link!");
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return nullptr;
|
2010-09-01 07:26:13 +04:00
|
|
|
|
}
|
|
|
|
|
|
2016-01-20 20:53:03 +03:00
|
|
|
|
void
|
|
|
|
|
Accessible::ToTextPoint(HyperTextAccessible** aContainer, int32_t* aOffset,
|
|
|
|
|
bool aIsBefore) const
|
|
|
|
|
{
|
|
|
|
|
if (IsHyperText()) {
|
|
|
|
|
*aContainer = const_cast<Accessible*>(this)->AsHyperText();
|
|
|
|
|
*aOffset = aIsBefore ? 0 : (*aContainer)->CharacterCount();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const Accessible* child = nullptr;
|
|
|
|
|
const Accessible* parent = this;
|
|
|
|
|
do {
|
|
|
|
|
child = parent;
|
|
|
|
|
parent = parent->Parent();
|
|
|
|
|
} while (parent && !parent->IsHyperText());
|
|
|
|
|
|
|
|
|
|
if (parent) {
|
|
|
|
|
*aContainer = const_cast<Accessible*>(parent)->AsHyperText();
|
|
|
|
|
*aOffset = (*aContainer)->GetChildOffset(
|
|
|
|
|
child->IndexInParent() + static_cast<int32_t>(!aIsBefore));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// SelectAccessible
|
|
|
|
|
|
2014-10-22 04:49:28 +04:00
|
|
|
|
void
|
|
|
|
|
Accessible::SelectedItems(nsTArray<Accessible*>* aItems)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelected);
|
2014-10-22 04:49:28 +04:00
|
|
|
|
Accessible* selected = nullptr;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((selected = iter.Next()))
|
2014-10-22 04:49:28 +04:00
|
|
|
|
aItems->AppendElement(selected);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::SelectedItemCount()
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t count = 0;
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelected);
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* selected = nullptr;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((selected = iter.Next()))
|
2010-09-02 04:46:59 +04:00
|
|
|
|
++count;
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::GetSelectedItem(uint32_t aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelected);
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* selected = nullptr;
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t index = 0;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((selected = iter.Next()) && index < aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
return selected;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::IsItemSelected(uint32_t aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t index = 0;
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelectable);
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* selected = nullptr;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((selected = iter.Next()) && index < aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
return selected &&
|
2011-04-10 03:38:06 +04:00
|
|
|
|
selected->State() & states::SELECTED;
|
2010-09-02 04:46:59 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::AddItemToSelection(uint32_t aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t index = 0;
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelectable);
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* selected = nullptr;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((selected = iter.Next()) && index < aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
if (selected)
|
2011-10-17 18:59:28 +04:00
|
|
|
|
selected->SetSelected(true);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
|
|
return static_cast<bool>(selected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::RemoveItemFromSelection(uint32_t aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t index = 0;
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelectable);
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* selected = nullptr;
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((selected = iter.Next()) && index < aIndex)
|
2010-09-02 04:46:59 +04:00
|
|
|
|
index++;
|
|
|
|
|
|
|
|
|
|
if (selected)
|
2011-10-17 18:59:28 +04:00
|
|
|
|
selected->SetSelected(false);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
|
|
|
|
return static_cast<bool>(selected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::SelectAll()
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
|
|
|
|
bool success = false;
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* selectable = nullptr;
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelectable);
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while((selectable = iter.Next())) {
|
2010-09-02 04:46:59 +04:00
|
|
|
|
success = true;
|
2011-10-17 18:59:28 +04:00
|
|
|
|
selectable->SetSelected(true);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
}
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::UnselectAll()
|
2010-09-02 04:46:59 +04:00
|
|
|
|
{
|
|
|
|
|
bool success = false;
|
2012-07-30 18:20:58 +04:00
|
|
|
|
Accessible* selected = nullptr;
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
2012-08-28 17:13:59 +04:00
|
|
|
|
AccIterator iter(this, filters::GetSelected);
|
2011-08-10 05:44:00 +04:00
|
|
|
|
while ((selected = iter.Next())) {
|
2010-09-02 04:46:59 +04:00
|
|
|
|
success = true;
|
2011-10-17 18:59:28 +04:00
|
|
|
|
selected->SetSelected(false);
|
2010-09-02 04:46:59 +04:00
|
|
|
|
}
|
|
|
|
|
return success;
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-28 05:46:11 +04:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Widgets
|
|
|
|
|
|
|
|
|
|
bool
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::IsWidget() const
|
2011-09-28 05:46:11 +04:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::IsActiveWidget() const
|
2011-09-28 05:46:11 +04:00
|
|
|
|
{
|
2012-09-05 15:03:39 +04:00
|
|
|
|
if (FocusMgr()->HasDOMFocus(mContent))
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
// If text entry of combobox widget has a focus then the combobox widget is
|
|
|
|
|
// active.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (roleMapEntry && roleMapEntry->Is(nsGkAtoms::combobox)) {
|
2012-09-06 18:11:28 +04:00
|
|
|
|
uint32_t childCount = ChildCount();
|
|
|
|
|
for (uint32_t idx = 0; idx < childCount; idx++) {
|
2012-09-05 15:03:39 +04:00
|
|
|
|
Accessible* child = mChildren.ElementAt(idx);
|
|
|
|
|
if (child->Role() == roles::ENTRY)
|
|
|
|
|
return FocusMgr()->HasDOMFocus(child->GetContent());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::AreItemsOperable() const
|
2011-09-28 05:46:11 +04:00
|
|
|
|
{
|
2012-10-31 06:25:17 +04:00
|
|
|
|
return HasOwnContent() &&
|
|
|
|
|
mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant);
|
2011-09-28 05:46:11 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
|
|
|
|
Accessible::CurrentItem()
|
2011-09-28 05:46:11 +04:00
|
|
|
|
{
|
|
|
|
|
// 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;
|
2012-10-31 06:25:17 +04:00
|
|
|
|
if (HasOwnContent() &&
|
|
|
|
|
mContent->GetAttr(kNameSpaceID_None,
|
2011-09-28 05:46:11 +04:00
|
|
|
|
nsGkAtoms::aria_activedescendant, id)) {
|
2011-10-18 14:53:36 +04:00
|
|
|
|
nsIDocument* DOMDoc = mContent->OwnerDoc();
|
2011-09-28 05:46:11 +04:00
|
|
|
|
dom::Element* activeDescendantElm = DOMDoc->GetElementById(id);
|
|
|
|
|
if (activeDescendantElm) {
|
2012-05-27 13:01:40 +04:00
|
|
|
|
DocAccessible* document = Document();
|
2011-09-28 05:46:11 +04:00
|
|
|
|
if (document)
|
|
|
|
|
return document->GetAccessible(activeDescendantElm);
|
|
|
|
|
}
|
|
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return nullptr;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-12-08 16:20:15 +04:00
|
|
|
|
void
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::SetCurrentItem(Accessible* aItem)
|
2011-12-08 16:20:15 +04:00
|
|
|
|
{
|
|
|
|
|
nsIAtom* id = aItem->GetContent()->GetID();
|
|
|
|
|
if (id) {
|
|
|
|
|
nsAutoString idStr;
|
|
|
|
|
id->ToString(idStr);
|
|
|
|
|
mContent->SetAttr(kNameSpaceID_None,
|
|
|
|
|
nsGkAtoms::aria_activedescendant, idStr, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
|
|
|
|
Accessible::ContainerWidget() const
|
2011-09-28 05:46:11 +04:00
|
|
|
|
{
|
2012-01-20 19:22:31 +04:00
|
|
|
|
if (HasARIARole() && mContent->HasID()) {
|
2012-05-29 05:18:45 +04:00
|
|
|
|
for (Accessible* parent = Parent(); parent; parent = parent->Parent()) {
|
2012-01-20 19:22:31 +04:00
|
|
|
|
nsIContent* parentContent = parent->GetContent();
|
|
|
|
|
if (parentContent &&
|
|
|
|
|
parentContent->HasAttr(kNameSpaceID_None,
|
|
|
|
|
nsGkAtoms::aria_activedescendant)) {
|
|
|
|
|
return parent;
|
2011-12-07 13:10:22 +04:00
|
|
|
|
}
|
2012-01-20 19:22:31 +04:00
|
|
|
|
|
|
|
|
|
// Don't cross DOM document boundaries.
|
2013-03-14 09:33:37 +04:00
|
|
|
|
if (parent->IsDoc())
|
2012-01-20 19:22:31 +04:00
|
|
|
|
break;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return nullptr;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
}
|
2010-09-02 04:46:59 +04:00
|
|
|
|
|
2015-02-05 02:33:33 +03:00
|
|
|
|
void
|
|
|
|
|
Accessible::SetARIAHidden(bool aIsDefined)
|
|
|
|
|
{
|
|
|
|
|
if (aIsDefined)
|
|
|
|
|
mContextFlags |= eARIAHidden;
|
|
|
|
|
else
|
|
|
|
|
mContextFlags &= ~eARIAHidden;
|
|
|
|
|
|
|
|
|
|
uint32_t length = mChildren.Length();
|
|
|
|
|
for (uint32_t i = 0; i < length; i++) {
|
|
|
|
|
mChildren[i]->SetARIAHidden(aIsDefined);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-10-10 16:26:55 +04:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-05-29 05:18:45 +04:00
|
|
|
|
// Accessible protected methods
|
2009-12-10 22:12:19 +03:00
|
|
|
|
|
2013-10-29 07:30:55 +04:00
|
|
|
|
void
|
|
|
|
|
Accessible::LastRelease()
|
|
|
|
|
{
|
|
|
|
|
// First cleanup if needed...
|
|
|
|
|
if (mDoc) {
|
|
|
|
|
Shutdown();
|
|
|
|
|
NS_ASSERTION(!mDoc,
|
|
|
|
|
"A Shutdown() impl forgot to call its parent's Shutdown?");
|
|
|
|
|
}
|
|
|
|
|
// ... then die.
|
|
|
|
|
delete this;
|
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible*
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::GetSiblingAtOffset(int32_t aOffset, nsresult* aError) const
|
2009-12-10 22:12:19 +03:00
|
|
|
|
{
|
2011-06-07 06:23:13 +04:00
|
|
|
|
if (!mParent || mIndexInParent == -1) {
|
2009-12-10 22:12:19 +03:00
|
|
|
|
if (aError)
|
|
|
|
|
*aError = NS_ERROR_UNEXPECTED;
|
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return nullptr;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-25 14:53:45 +04:00
|
|
|
|
if (aError &&
|
2012-08-22 19:56:38 +04:00
|
|
|
|
mIndexInParent + aOffset >= static_cast<int32_t>(mParent->ChildCount())) {
|
2011-06-07 06:23:13 +04:00
|
|
|
|
*aError = NS_OK; // fail peacefully
|
2012-07-30 18:20:58 +04:00
|
|
|
|
return nullptr;
|
2009-12-10 22:12:19 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* child = mParent->GetChildAt(mIndexInParent + aOffset);
|
2009-12-10 22:12:19 +03:00
|
|
|
|
if (aError && !child)
|
|
|
|
|
*aError = NS_ERROR_UNEXPECTED;
|
|
|
|
|
|
|
|
|
|
return child;
|
|
|
|
|
}
|
2008-10-10 16:26:55 +04:00
|
|
|
|
|
2013-11-20 01:01:15 +04:00
|
|
|
|
double
|
|
|
|
|
Accessible::AttrNumericValue(nsIAtom* aAttr) const
|
2007-08-04 09:27:27 +04:00
|
|
|
|
{
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (!roleMapEntry || roleMapEntry->valueRule == eNoValue)
|
2014-02-27 19:23:16 +04:00
|
|
|
|
return UnspecifiedNaN<double>();
|
2007-08-04 09:27:27 +04:00
|
|
|
|
|
2009-05-06 07:16:36 +04:00
|
|
|
|
nsAutoString attrValue;
|
2013-11-20 01:01:15 +04:00
|
|
|
|
if (!mContent->GetAttr(kNameSpaceID_None, aAttr, attrValue))
|
2014-02-27 19:23:16 +04:00
|
|
|
|
return UnspecifiedNaN<double>();
|
2009-05-06 07:16:36 +04:00
|
|
|
|
|
2012-07-27 17:59:29 +04:00
|
|
|
|
nsresult error = NS_OK;
|
2011-03-25 14:14:19 +03:00
|
|
|
|
double value = attrValue.ToDouble(&error);
|
2014-02-27 19:23:16 +04:00
|
|
|
|
return NS_FAILED(error) ? UnspecifiedNaN<double>() : value;
|
2007-08-04 09:27:27 +04:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t
|
2014-09-16 21:30:23 +04:00
|
|
|
|
Accessible::GetActionRule() const
|
2008-10-08 16:54:58 +04:00
|
|
|
|
{
|
2012-11-01 20:05:33 +04:00
|
|
|
|
if (!HasOwnContent() || (InteractiveState() & states::UNAVAILABLE))
|
2008-10-08 16:54:58 +04:00
|
|
|
|
return eNoAction;
|
2012-06-04 09:41:06 +04:00
|
|
|
|
|
2009-08-24 09:13:05 +04:00
|
|
|
|
// Return "click" action on elements that have an attached popup menu.
|
2015-03-03 14:08:59 +03:00
|
|
|
|
if (mContent->IsXULElement())
|
2011-06-04 01:35:17 +04:00
|
|
|
|
if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
2009-08-24 09:13:05 +04:00
|
|
|
|
return eClickAction;
|
|
|
|
|
|
2008-10-08 16:54:58 +04:00
|
|
|
|
// Has registered 'click' event handler.
|
2011-09-29 10:19:26 +04:00
|
|
|
|
bool isOnclick = nsCoreUtils::HasClickListener(mContent);
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
|
|
|
|
if (isOnclick)
|
|
|
|
|
return eClickAction;
|
2014-05-23 04:10:19 +04:00
|
|
|
|
|
2008-10-08 16:54:58 +04:00
|
|
|
|
// Get an action based on ARIA role.
|
2016-07-12 22:34:13 +03:00
|
|
|
|
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
|
|
|
|
if (roleMapEntry &&
|
|
|
|
|
roleMapEntry->actionRule != eNoAction)
|
|
|
|
|
return roleMapEntry->actionRule;
|
2008-10-08 16:54:58 +04:00
|
|
|
|
|
2009-04-20 10:06:19 +04:00
|
|
|
|
// Get an action based on ARIA attribute.
|
2010-06-11 12:23:18 +04:00
|
|
|
|
if (nsAccUtils::HasDefinedARIAToken(mContent,
|
2011-06-04 01:35:17 +04:00
|
|
|
|
nsGkAtoms::aria_expanded))
|
2009-04-20 10:06:19 +04:00
|
|
|
|
return eExpandAction;
|
|
|
|
|
|
2008-10-08 16:54:58 +04:00
|
|
|
|
return eNoAction;
|
|
|
|
|
}
|
2009-01-05 10:41:30 +03:00
|
|
|
|
|
2010-07-03 07:11:35 +04:00
|
|
|
|
AccGroupInfo*
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::GetGroupInfo()
|
2010-01-06 13:36:50 +03:00
|
|
|
|
{
|
2015-01-20 00:34:14 +03:00
|
|
|
|
if (IsProxy())
|
|
|
|
|
MOZ_CRASH("This should never be called on proxy wrappers");
|
|
|
|
|
|
|
|
|
|
if (mBits.groupInfo){
|
2014-03-28 18:01:06 +04:00
|
|
|
|
if (HasDirtyGroupInfo()) {
|
2015-01-20 00:34:14 +03:00
|
|
|
|
mBits.groupInfo->Update();
|
2016-04-01 17:53:52 +03:00
|
|
|
|
mStateFlags &= ~eGroupInfoDirty;
|
2014-03-28 18:01:06 +04:00
|
|
|
|
}
|
|
|
|
|
|
2015-01-20 00:34:14 +03:00
|
|
|
|
return mBits.groupInfo;
|
2014-03-28 18:01:06 +04:00
|
|
|
|
}
|
2010-01-12 22:07:38 +03:00
|
|
|
|
|
2015-01-20 00:34:14 +03:00
|
|
|
|
mBits.groupInfo = AccGroupInfo::CreateGroupInfo(this);
|
|
|
|
|
return mBits.groupInfo;
|
2010-07-03 07:11:35 +04:00
|
|
|
|
}
|
2010-01-12 22:07:38 +03:00
|
|
|
|
|
2010-07-03 07:11:35 +04:00
|
|
|
|
void
|
2012-08-22 19:56:38 +04:00
|
|
|
|
Accessible::GetPositionAndSizeInternal(int32_t *aPosInSet, int32_t *aSetSize)
|
2010-07-03 07:11:35 +04:00
|
|
|
|
{
|
|
|
|
|
AccGroupInfo* groupInfo = GetGroupInfo();
|
|
|
|
|
if (groupInfo) {
|
|
|
|
|
*aPosInSet = groupInfo->PosInSet();
|
|
|
|
|
*aSetSize = groupInfo->SetSize();
|
2009-01-05 10:41:30 +03:00
|
|
|
|
}
|
2010-01-06 13:36:50 +03:00
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
|
int32_t
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible::GetLevelInternal()
|
2010-01-06 13:36:50 +03:00
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
|
int32_t level = nsAccUtils::GetDefaultLevel(this);
|
2010-01-12 22:07:38 +03:00
|
|
|
|
|
2011-07-23 12:38:33 +04:00
|
|
|
|
if (!IsBoundToParent())
|
|
|
|
|
return level;
|
2010-01-06 13:36:50 +03:00
|
|
|
|
|
2012-01-12 07:07:35 +04:00
|
|
|
|
roles::Role role = Role();
|
|
|
|
|
if (role == roles::OUTLINEITEM) {
|
2009-01-05 10:41:30 +03:00
|
|
|
|
// Always expose 'level' attribute for 'outlineitem' accessible. The number
|
|
|
|
|
// of nested 'grouping' accessibles containing 'outlineitem' accessible is
|
|
|
|
|
// its level.
|
2010-01-12 22:07:38 +03:00
|
|
|
|
level = 1;
|
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* parent = this;
|
2011-07-23 12:38:33 +04:00
|
|
|
|
while ((parent = parent->Parent())) {
|
2012-01-12 07:07:35 +04:00
|
|
|
|
roles::Role parentRole = parent->Role();
|
2009-01-05 10:41:30 +03:00
|
|
|
|
|
2012-01-12 07:07:35 +04:00
|
|
|
|
if (parentRole == roles::OUTLINE)
|
2009-01-05 10:41:30 +03:00
|
|
|
|
break;
|
2012-01-12 07:07:35 +04:00
|
|
|
|
if (parentRole == roles::GROUPING)
|
2010-01-06 13:36:50 +03:00
|
|
|
|
++ level;
|
2009-01-05 10:41:30 +03:00
|
|
|
|
|
|
|
|
|
}
|
2010-01-06 13:36:50 +03:00
|
|
|
|
|
2012-01-12 07:07:35 +04:00
|
|
|
|
} else if (role == roles::LISTITEM) {
|
2013-05-16 10:38:17 +04:00
|
|
|
|
// Expose 'level' attribute on nested lists. We support two hierarchies:
|
|
|
|
|
// a) list -> listitem -> list -> listitem (nested list is a last child
|
|
|
|
|
// of listitem of the parent list);
|
|
|
|
|
// b) list -> listitem -> group -> listitem (nested listitems are contained
|
|
|
|
|
// by group that is a last child of the parent listitem).
|
2009-01-05 10:41:30 +03:00
|
|
|
|
|
|
|
|
|
// Calculate 'level' attribute based on number of parent listitems.
|
2010-01-12 22:07:38 +03:00
|
|
|
|
level = 0;
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* parent = this;
|
2011-07-23 12:38:33 +04:00
|
|
|
|
while ((parent = parent->Parent())) {
|
2012-01-12 07:07:35 +04:00
|
|
|
|
roles::Role parentRole = parent->Role();
|
2009-01-05 10:41:30 +03:00
|
|
|
|
|
2012-01-12 07:07:35 +04:00
|
|
|
|
if (parentRole == roles::LISTITEM)
|
2010-01-06 13:36:50 +03:00
|
|
|
|
++ level;
|
2013-05-16 10:38:17 +04:00
|
|
|
|
else if (parentRole != roles::LIST && parentRole != roles::GROUPING)
|
2009-01-05 10:41:30 +03:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2010-01-06 13:36:50 +03:00
|
|
|
|
if (level == 0) {
|
2009-01-05 10:41:30 +03:00
|
|
|
|
// If this listitem is on top of nested lists then expose 'level'
|
|
|
|
|
// attribute.
|
2011-07-23 12:38:33 +04:00
|
|
|
|
parent = Parent();
|
2012-08-22 19:56:38 +04:00
|
|
|
|
uint32_t siblingCount = parent->ChildCount();
|
|
|
|
|
for (uint32_t siblingIdx = 0; siblingIdx < siblingCount; siblingIdx++) {
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* sibling = parent->GetChildAt(siblingIdx);
|
2009-01-05 10:41:30 +03:00
|
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
|
Accessible* siblingChild = sibling->LastChild();
|
2013-05-16 10:38:17 +04:00
|
|
|
|
if (siblingChild) {
|
|
|
|
|
roles::Role lastChildRole = siblingChild->Role();
|
|
|
|
|
if (lastChildRole == roles::LIST || lastChildRole == roles::GROUPING)
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2009-01-05 10:41:30 +03:00
|
|
|
|
}
|
2010-01-06 13:36:50 +03:00
|
|
|
|
} else {
|
|
|
|
|
++ level; // level is 1-index based
|
|
|
|
|
}
|
2009-01-05 10:41:30 +03:00
|
|
|
|
}
|
|
|
|
|
|
2010-01-12 22:07:38 +03:00
|
|
|
|
return level;
|
2009-01-05 10:41:30 +03:00
|
|
|
|
}
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
2012-12-18 09:22:26 +04:00
|
|
|
|
void
|
|
|
|
|
Accessible::StaticAsserts() const
|
|
|
|
|
{
|
2014-03-28 18:01:06 +04:00
|
|
|
|
static_assert(eLastStateFlag <= (1 << kStateFlagsBits) - 1,
|
2013-07-18 21:59:53 +04:00
|
|
|
|
"Accessible::mStateFlags was oversized by eLastStateFlag!");
|
2014-03-28 18:01:06 +04:00
|
|
|
|
static_assert(eLastAccType <= (1 << kTypeBits) - 1,
|
2013-07-18 21:59:53 +04:00
|
|
|
|
"Accessible::mType was oversized by eLastAccType!");
|
2014-03-31 18:30:46 +04:00
|
|
|
|
static_assert(eLastContextFlag <= (1 << kContextFlagsBits) - 1,
|
|
|
|
|
"Accessible::mContextFlags was oversized by eLastContextFlag!");
|
2014-03-28 18:01:06 +04:00
|
|
|
|
static_assert(eLastAccGenericType <= (1 << kGenericTypesBits) - 1,
|
2013-07-18 21:59:53 +04:00
|
|
|
|
"Accessible::mGenericType was oversized by eLastAccGenericType!");
|
2012-12-18 09:22:26 +04:00
|
|
|
|
}
|
|
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// KeyBinding class
|
|
|
|
|
|
2014-05-22 08:06:05 +04:00
|
|
|
|
// static
|
|
|
|
|
uint32_t
|
|
|
|
|
KeyBinding::AccelModifier()
|
|
|
|
|
{
|
|
|
|
|
switch (WidgetInputEvent::AccelModifier()) {
|
|
|
|
|
case MODIFIER_ALT:
|
|
|
|
|
return kAlt;
|
|
|
|
|
case MODIFIER_CONTROL:
|
|
|
|
|
return kControl;
|
|
|
|
|
case MODIFIER_META:
|
|
|
|
|
return kMeta;
|
|
|
|
|
case MODIFIER_OS:
|
|
|
|
|
return kOS;
|
|
|
|
|
default:
|
|
|
|
|
MOZ_CRASH("Handle the new result of WidgetInputEvent::AccelModifier()");
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
|
void
|
|
|
|
|
KeyBinding::ToPlatformFormat(nsAString& aValue) const
|
|
|
|
|
{
|
|
|
|
|
nsCOMPtr<nsIStringBundle> keyStringBundle;
|
|
|
|
|
nsCOMPtr<nsIStringBundleService> stringBundleService =
|
|
|
|
|
mozilla::services::GetStringBundleService();
|
|
|
|
|
if (stringBundleService)
|
2012-05-10 17:43:04 +04:00
|
|
|
|
stringBundleService->CreateBundle(
|
|
|
|
|
"chrome://global-platform/locale/platformKeys.properties",
|
|
|
|
|
getter_AddRefs(keyStringBundle));
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
|
|
if (!keyStringBundle)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
nsAutoString separator;
|
2016-07-21 08:03:25 +03:00
|
|
|
|
keyStringBundle->GetStringFromName(u"MODIFIER_SEPARATOR",
|
2011-07-19 12:30:24 +04:00
|
|
|
|
getter_Copies(separator));
|
|
|
|
|
|
|
|
|
|
nsAutoString modifierName;
|
|
|
|
|
if (mModifierMask & kControl) {
|
2016-07-21 08:03:25 +03:00
|
|
|
|
keyStringBundle->GetStringFromName(u"VK_CONTROL",
|
2011-07-19 12:30:24 +04:00
|
|
|
|
getter_Copies(modifierName));
|
|
|
|
|
|
|
|
|
|
aValue.Append(modifierName);
|
|
|
|
|
aValue.Append(separator);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mModifierMask & kAlt) {
|
2016-07-21 08:03:25 +03:00
|
|
|
|
keyStringBundle->GetStringFromName(u"VK_ALT",
|
2011-07-19 12:30:24 +04:00
|
|
|
|
getter_Copies(modifierName));
|
|
|
|
|
|
|
|
|
|
aValue.Append(modifierName);
|
|
|
|
|
aValue.Append(separator);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mModifierMask & kShift) {
|
2016-07-21 08:03:25 +03:00
|
|
|
|
keyStringBundle->GetStringFromName(u"VK_SHIFT",
|
2011-07-19 12:30:24 +04:00
|
|
|
|
getter_Copies(modifierName));
|
|
|
|
|
|
|
|
|
|
aValue.Append(modifierName);
|
|
|
|
|
aValue.Append(separator);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mModifierMask & kMeta) {
|
2016-07-21 08:03:25 +03:00
|
|
|
|
keyStringBundle->GetStringFromName(u"VK_META",
|
2011-07-19 12:30:24 +04:00
|
|
|
|
getter_Copies(modifierName));
|
|
|
|
|
|
|
|
|
|
aValue.Append(modifierName);
|
|
|
|
|
aValue.Append(separator);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
aValue.Append(mKey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
KeyBinding::ToAtkFormat(nsAString& aValue) const
|
|
|
|
|
{
|
|
|
|
|
nsAutoString modifierName;
|
|
|
|
|
if (mModifierMask & kControl)
|
2014-05-22 07:48:50 +04:00
|
|
|
|
aValue.AppendLiteral("<Control>");
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
|
|
if (mModifierMask & kAlt)
|
2014-05-22 07:48:50 +04:00
|
|
|
|
aValue.AppendLiteral("<Alt>");
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
|
|
if (mModifierMask & kShift)
|
2014-05-22 07:48:50 +04:00
|
|
|
|
aValue.AppendLiteral("<Shift>");
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
|
|
if (mModifierMask & kMeta)
|
2014-05-22 07:48:50 +04:00
|
|
|
|
aValue.AppendLiteral("<Meta>");
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
|
|
aValue.Append(mKey);
|
|
|
|
|
}
|