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
|
|
|
/* -*- 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/. */
|
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
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
#include "XULMenuAccessible.h"
|
2010-04-27 10:52:03 +04:00
|
|
|
|
2012-04-13 18:17:03 +04:00
|
|
|
#include "Accessible-inl.h"
|
2010-04-27 10:52:03 +04:00
|
|
|
#include "nsAccessibilityService.h"
|
|
|
|
#include "nsAccUtils.h"
|
2012-05-27 13:01:40 +04:00
|
|
|
#include "DocAccessible.h"
|
2012-01-12 07:07:35 +04:00
|
|
|
#include "Role.h"
|
2011-04-10 03:38:06 +04:00
|
|
|
#include "States.h"
|
2012-04-12 15:11:40 +04:00
|
|
|
#include "XULFormControlAccessible.h"
|
2010-04-27 10:52:03 +04:00
|
|
|
|
2007-11-22 09:14:39 +03:00
|
|
|
#include "nsIDOMXULContainerElement.h"
|
2020-05-01 07:28:35 +03:00
|
|
|
#include "nsIDOMXULSelectCntrlEl.h"
|
2002-04-26 08:50:21 +04:00
|
|
|
#include "nsIDOMXULSelectCntrlItemEl.h"
|
2005-02-01 12:35:28 +03:00
|
|
|
#include "nsIContent.h"
|
2011-09-28 05:46:11 +04:00
|
|
|
#include "nsMenuBarFrame.h"
|
|
|
|
#include "nsMenuPopupFrame.h"
|
2002-05-09 00:43:49 +04:00
|
|
|
|
2011-06-02 05:05:12 +04:00
|
|
|
#include "mozilla/Preferences.h"
|
2011-09-09 06:27:12 +04:00
|
|
|
#include "mozilla/LookAndFeel.h"
|
2011-07-20 23:18:54 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2018-02-09 19:17:09 +03:00
|
|
|
#include "mozilla/dom/KeyboardEventBinding.h"
|
2011-06-02 05:05:12 +04:00
|
|
|
|
|
|
|
using namespace mozilla;
|
2011-07-27 16:43:01 +04:00
|
|
|
using namespace mozilla::a11y;
|
2007-02-09 05:03:08 +03:00
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-11 03:44:50 +04:00
|
|
|
// XULMenuitemAccessible
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
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
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
XULMenuitemAccessible::XULMenuitemAccessible(nsIContent* aContent,
|
|
|
|
DocAccessible* aDoc)
|
2012-05-29 05:18:45 +04:00
|
|
|
: AccessibleWrap(aContent, aDoc) {}
|
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
|
|
|
|
2018-05-15 21:04:50 +03:00
|
|
|
uint64_t XULMenuitemAccessible::NativeState() const {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t state = Accessible::NativeState();
|
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
|
|
|
|
2002-03-27 10:01:26 +03:00
|
|
|
// Has Popup?
|
2011-06-04 01:35:17 +04:00
|
|
|
if (mContent->NodeInfo()->Equals(nsGkAtoms::menu, kNameSpaceID_XUL)) {
|
2011-04-10 03:38:06 +04:00
|
|
|
state |= states::HASPOPUP;
|
2017-12-07 21:13:50 +03:00
|
|
|
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::open))
|
2011-04-10 03:38:06 +04:00
|
|
|
state |= states::EXPANDED;
|
2010-06-11 12:23:18 +04:00
|
|
|
else
|
2011-04-10 03:38:06 +04:00
|
|
|
state |= states::COLLAPSED;
|
2006-08-08 18:01:19 +04:00
|
|
|
}
|
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
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
// Checkable/checked?
|
2019-11-29 23:39:36 +03:00
|
|
|
static dom::Element::AttrValuesArray strings[] = {
|
|
|
|
nsGkAtoms::radio, nsGkAtoms::checkbox, nullptr};
|
2010-06-11 12:23:18 +04:00
|
|
|
|
2017-12-07 21:13:50 +03:00
|
|
|
if (mContent->AsElement()->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::type,
|
|
|
|
strings, eCaseMatters) >= 0) {
|
2005-07-07 21:10:08 +04:00
|
|
|
// Checkable?
|
2011-04-10 03:38:06 +04:00
|
|
|
state |= states::CHECKABLE;
|
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
|
|
|
|
|
|
|
// Checked?
|
2017-12-07 21:13:50 +03:00
|
|
|
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
|
|
|
nsGkAtoms::checked, nsGkAtoms::_true,
|
|
|
|
eCaseMatters))
|
2011-04-10 03:38:06 +04:00
|
|
|
state |= states::CHECKED;
|
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
|
|
|
}
|
|
|
|
|
2007-06-13 14:54:07 +04:00
|
|
|
// Combo box listitem
|
2012-01-12 07:07:35 +04:00
|
|
|
bool isComboboxOption = (Role() == roles::COMBOBOX_OPTION);
|
2008-01-17 09:30:15 +03:00
|
|
|
if (isComboboxOption) {
|
2007-06-13 14:54:07 +04:00
|
|
|
// Is selected?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isSelected = false;
|
2018-12-04 19:32:15 +03:00
|
|
|
nsCOMPtr<nsIDOMXULSelectControlItemElement> item =
|
|
|
|
Elm()->AsXULSelectControlItem();
|
2011-04-10 03:38:06 +04:00
|
|
|
NS_ENSURE_TRUE(item, state);
|
2007-06-13 14:54:07 +04:00
|
|
|
item->GetSelected(&isSelected);
|
|
|
|
|
|
|
|
// Is collapsed?
|
2011-09-29 10:19:26 +04:00
|
|
|
bool isCollapsed = false;
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible* parent = Parent();
|
2011-07-23 12:38:33 +04:00
|
|
|
if (parent && parent->State() & states::INVISIBLE) isCollapsed = true;
|
2010-01-11 17:14:06 +03:00
|
|
|
|
2007-06-13 14:54:07 +04:00
|
|
|
if (isSelected) {
|
2011-04-10 03:38:06 +04:00
|
|
|
state |= states::SELECTED;
|
2010-01-11 17:14:06 +03:00
|
|
|
|
2007-06-13 14:54:07 +04:00
|
|
|
// Selected and collapsed?
|
|
|
|
if (isCollapsed) {
|
|
|
|
// Set selected option offscreen/invisible according to combobox state
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible* grandParent = parent->Parent();
|
2011-07-23 12:38:33 +04:00
|
|
|
if (!grandParent) return state;
|
2017-07-11 12:16:00 +03:00
|
|
|
NS_ASSERTION(grandParent->IsCombobox(),
|
2007-06-13 14:54:07 +04:00
|
|
|
"grandparent of combobox listitem is not combobox");
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t grandParentState = grandParent->State();
|
2011-04-10 03:38:06 +04:00
|
|
|
state &= ~(states::OFFSCREEN | states::INVISIBLE);
|
|
|
|
state |= (grandParentState & states::OFFSCREEN) |
|
|
|
|
(grandParentState & states::INVISIBLE) |
|
|
|
|
(grandParentState & states::OPAQUE1);
|
2007-06-13 14:54:07 +04:00
|
|
|
} // isCollapsed
|
|
|
|
} // isSelected
|
2007-11-15 22:46:29 +03:00
|
|
|
} // ROLE_COMBOBOX_OPTION
|
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
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
uint64_t XULMenuitemAccessible::NativeInteractiveState() const {
|
2012-06-04 09:41:06 +04:00
|
|
|
if (NativelyUnavailable()) {
|
|
|
|
// Note: keep in sinc with nsXULPopupManager::IsValidMenuItem() logic.
|
|
|
|
bool skipNavigatingDisabledMenuItem = true;
|
|
|
|
nsMenuFrame* menuFrame = do_QueryFrame(GetFrame());
|
2012-06-11 03:44:50 +04:00
|
|
|
if (!menuFrame || !menuFrame->IsOnMenuBar()) {
|
2012-06-04 09:41:06 +04:00
|
|
|
skipNavigatingDisabledMenuItem =
|
|
|
|
LookAndFeel::GetInt(
|
2020-06-11 14:27:43 +03:00
|
|
|
LookAndFeel::IntID::SkipNavigatingDisabledMenuItem, 0) != 0;
|
2008-01-17 09:30:15 +03:00
|
|
|
}
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
if (skipNavigatingDisabledMenuItem) return states::UNAVAILABLE;
|
2008-01-17 09:30:15 +03:00
|
|
|
|
2012-06-04 09:41:06 +04:00
|
|
|
return states::UNAVAILABLE | states::FOCUSABLE | states::SELECTABLE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return states::FOCUSABLE | states::SELECTABLE;
|
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
|
|
|
}
|
|
|
|
|
2018-05-15 19:13:02 +03:00
|
|
|
ENameValueFlag XULMenuitemAccessible::NativeName(nsString& aName) const {
|
2017-12-07 21:13:50 +03:00
|
|
|
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
2012-10-14 08:18:39 +04:00
|
|
|
return eNameOK;
|
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
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
void XULMenuitemAccessible::Description(nsString& aDescription) {
|
2017-12-07 21:13:50 +03:00
|
|
|
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::description,
|
|
|
|
aDescription);
|
2006-04-19 19:11:51 +04:00
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
KeyBinding XULMenuitemAccessible::AccessKey() const {
|
2011-07-19 12:30:24 +04:00
|
|
|
// Return menu accesskey: N or Alt+F.
|
2012-08-22 19:56:38 +04:00
|
|
|
static int32_t gMenuAccesskeyModifier =
|
|
|
|
-1; // magic value of -1 indicates unitialized state
|
2002-05-09 00:43:49 +04:00
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
// We do not use nsCoreUtils::GetAccesskeyFor() because accesskeys for
|
2014-04-01 08:09:23 +04:00
|
|
|
// menu are't registered by EventStateManager.
|
2010-06-11 12:23:18 +04:00
|
|
|
nsAutoString accesskey;
|
2017-12-07 21:13:50 +03:00
|
|
|
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey,
|
|
|
|
accesskey);
|
2010-06-11 12:23:18 +04:00
|
|
|
if (accesskey.IsEmpty()) return KeyBinding();
|
2011-07-19 12:30:24 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t modifierKey = 0;
|
2002-05-09 00:43:49 +04:00
|
|
|
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible* parentAcc = Parent();
|
2010-06-11 12:23:18 +04:00
|
|
|
if (parentAcc) {
|
2012-01-12 07:07:35 +04:00
|
|
|
if (parentAcc->NativeRole() == roles::MENUBAR) {
|
2010-06-11 12:23:18 +04:00
|
|
|
// If top level menu item, add Alt+ or whatever modifier text to string
|
|
|
|
// No need to cache pref service, this happens rarely
|
|
|
|
if (gMenuAccesskeyModifier == -1) {
|
|
|
|
// Need to initialize cached global accesskey pref
|
2011-06-02 05:05:12 +04:00
|
|
|
gMenuAccesskeyModifier = Preferences::GetInt("ui.key.menuAccessKey", 0);
|
2002-05-09 00:43:49 +04:00
|
|
|
}
|
2010-06-11 12:23:18 +04:00
|
|
|
|
|
|
|
switch (gMenuAccesskeyModifier) {
|
2018-06-26 00:20:54 +03:00
|
|
|
case dom::KeyboardEvent_Binding::DOM_VK_CONTROL:
|
2011-07-19 12:30:24 +04:00
|
|
|
modifierKey = KeyBinding::kControl;
|
2010-06-11 12:23:18 +04:00
|
|
|
break;
|
2018-06-26 00:20:54 +03:00
|
|
|
case dom::KeyboardEvent_Binding::DOM_VK_ALT:
|
2011-07-19 12:30:24 +04:00
|
|
|
modifierKey = KeyBinding::kAlt;
|
2010-06-11 12:23:18 +04:00
|
|
|
break;
|
2018-06-26 00:20:54 +03:00
|
|
|
case dom::KeyboardEvent_Binding::DOM_VK_META:
|
2011-07-19 12:30:24 +04:00
|
|
|
modifierKey = KeyBinding::kMeta;
|
2010-06-11 12:23:18 +04:00
|
|
|
break;
|
2018-06-26 00:20:54 +03:00
|
|
|
case dom::KeyboardEvent_Binding::DOM_VK_WIN:
|
2012-07-19 05:28:16 +04:00
|
|
|
modifierKey = KeyBinding::kOS;
|
|
|
|
break;
|
2010-06-11 12:23:18 +04:00
|
|
|
}
|
2002-05-09 00:43:49 +04:00
|
|
|
}
|
|
|
|
}
|
2010-06-11 12:23:18 +04:00
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
return KeyBinding(accesskey[0], modifierKey);
|
2002-05-09 00:43:49 +04:00
|
|
|
}
|
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
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
KeyBinding XULMenuitemAccessible::KeyboardShortcut() const {
|
2011-07-19 12:30:24 +04:00
|
|
|
nsAutoString keyElmId;
|
2017-12-07 21:13:50 +03:00
|
|
|
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyElmId);
|
2011-07-19 12:30:24 +04:00
|
|
|
if (keyElmId.IsEmpty()) return KeyBinding();
|
|
|
|
|
2019-11-29 23:39:36 +03:00
|
|
|
dom::Element* keyElm = mContent->OwnerDoc()->GetElementById(keyElmId);
|
2011-07-19 12:30:24 +04:00
|
|
|
if (!keyElm) return KeyBinding();
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t key = 0;
|
2011-07-19 12:30:24 +04:00
|
|
|
|
|
|
|
nsAutoString keyStr;
|
|
|
|
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::key, keyStr);
|
|
|
|
if (keyStr.IsEmpty()) {
|
|
|
|
nsAutoString keyCodeStr;
|
|
|
|
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::keycode, keyCodeStr);
|
2012-07-27 17:59:29 +04:00
|
|
|
nsresult errorCode;
|
2017-12-08 05:54:13 +03:00
|
|
|
key = keyStr.ToInteger(&errorCode, /* aRadix = */ 10);
|
2017-01-24 00:29:57 +03:00
|
|
|
if (NS_FAILED(errorCode)) {
|
2017-12-08 05:54:13 +03:00
|
|
|
key = keyStr.ToInteger(&errorCode, /* aRadix = */ 16);
|
2017-01-24 00:29:57 +03:00
|
|
|
}
|
2011-07-19 12:30:24 +04:00
|
|
|
} else {
|
|
|
|
key = keyStr[0];
|
|
|
|
}
|
2003-01-13 09:26:11 +03:00
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
nsAutoString modifiersStr;
|
|
|
|
keyElm->GetAttr(kNameSpaceID_None, nsGkAtoms::modifiers, modifiersStr);
|
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t modifierMask = 0;
|
2011-07-19 12:30:24 +04:00
|
|
|
if (modifiersStr.Find("shift") != -1) modifierMask |= KeyBinding::kShift;
|
|
|
|
if (modifiersStr.Find("alt") != -1) modifierMask |= KeyBinding::kAlt;
|
|
|
|
if (modifiersStr.Find("meta") != -1) modifierMask |= KeyBinding::kMeta;
|
2012-07-19 05:28:16 +04:00
|
|
|
if (modifiersStr.Find("os") != -1) modifierMask |= KeyBinding::kOS;
|
2011-07-19 12:30:24 +04:00
|
|
|
if (modifiersStr.Find("control") != -1) modifierMask |= KeyBinding::kControl;
|
|
|
|
if (modifiersStr.Find("accel") != -1) {
|
2014-05-22 08:06:05 +04:00
|
|
|
modifierMask |= KeyBinding::AccelModifier();
|
2011-07-19 12:30:24 +04:00
|
|
|
}
|
2007-03-08 18:25:35 +03:00
|
|
|
|
2011-07-19 12:30:24 +04:00
|
|
|
return KeyBinding(key, modifierMask);
|
2003-01-13 09:26:11 +03:00
|
|
|
}
|
|
|
|
|
2018-05-07 22:05:50 +03:00
|
|
|
role XULMenuitemAccessible::NativeRole() const {
|
2018-12-04 19:32:15 +03:00
|
|
|
nsCOMPtr<nsIDOMXULContainerElement> xulContainer = Elm()->AsXULContainer();
|
2012-01-12 07:07:35 +04:00
|
|
|
if (xulContainer) return roles::PARENT_MENUITEM;
|
2007-11-22 09:14:39 +03:00
|
|
|
|
2019-10-16 09:10:32 +03:00
|
|
|
Accessible* widget = ContainerWidget();
|
|
|
|
if (widget && widget->Role() == roles::COMBOBOX_LIST) {
|
2012-01-12 07:07:35 +04:00
|
|
|
return roles::COMBOBOX_OPTION;
|
2019-10-16 09:10:32 +03:00
|
|
|
}
|
2007-11-22 09:14:39 +03:00
|
|
|
|
2017-12-07 21:13:50 +03:00
|
|
|
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
|
|
|
nsGkAtoms::radio, eCaseMatters))
|
2012-01-12 07:07:35 +04:00
|
|
|
return roles::RADIO_MENU_ITEM;
|
2006-08-02 18:40:32 +04:00
|
|
|
|
2017-12-07 21:13:50 +03:00
|
|
|
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
|
|
|
nsGkAtoms::checkbox, eCaseMatters))
|
2012-01-12 07:07:35 +04:00
|
|
|
return roles::CHECK_MENU_ITEM;
|
2010-06-11 12:23:18 +04:00
|
|
|
|
2012-01-12 07:07:35 +04:00
|
|
|
return roles::MENUITEM;
|
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
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
int32_t XULMenuitemAccessible::GetLevelInternal() {
|
2010-06-11 12:23:18 +04:00
|
|
|
return nsAccUtils::GetLevelForXULContainerItem(mContent);
|
2010-01-06 13:36:50 +03:00
|
|
|
}
|
2007-03-27 16:17:11 +04:00
|
|
|
|
2018-05-15 20:40:22 +03:00
|
|
|
bool XULMenuitemAccessible::DoAction(uint8_t index) const {
|
2007-01-31 22:43:04 +03:00
|
|
|
if (index == eAction_Click) { // default action
|
2005-02-01 12:40:36 +03:00
|
|
|
DoCommand();
|
2014-09-16 21:30:23 +04:00
|
|
|
return true;
|
2002-04-26 08:50:21 +04:00
|
|
|
}
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
return false;
|
2002-04-26 08:50:21 +04:00
|
|
|
}
|
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
void XULMenuitemAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|
|
|
if (aIndex == eAction_Click) aName.AssignLiteral("click");
|
2002-04-26 08:50:21 +04:00
|
|
|
}
|
|
|
|
|
2018-05-15 20:40:22 +03:00
|
|
|
uint8_t XULMenuitemAccessible::ActionCount() const { return 1; }
|
2002-04-26 08:50:21 +04:00
|
|
|
|
2011-09-28 05:46:11 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-11 03:44:50 +04:00
|
|
|
// XULMenuitemAccessible: Widgets
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
bool XULMenuitemAccessible::IsActiveWidget() const {
|
2011-09-28 05:46:11 +04:00
|
|
|
// Parent menu item is a widget, it's active when its popup is open.
|
2019-04-18 19:41:46 +03:00
|
|
|
// Typically the <menupopup> is included in the document markup, and
|
|
|
|
// <menu> prepends content in front of it.
|
|
|
|
nsIContent* menuPopupContent = mContent->GetLastChild();
|
2011-09-28 05:46:11 +04:00
|
|
|
if (menuPopupContent) {
|
|
|
|
nsMenuPopupFrame* menuPopupFrame =
|
|
|
|
do_QueryFrame(menuPopupContent->GetPrimaryFrame());
|
|
|
|
return menuPopupFrame && menuPopupFrame->IsOpen();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
bool XULMenuitemAccessible::AreItemsOperable() const {
|
2011-09-28 05:46:11 +04:00
|
|
|
// Parent menu item is a widget, its items are operable when its popup is
|
|
|
|
// open.
|
2019-04-18 19:41:46 +03:00
|
|
|
nsIContent* menuPopupContent = mContent->GetLastChild();
|
2011-09-28 05:46:11 +04:00
|
|
|
if (menuPopupContent) {
|
|
|
|
nsMenuPopupFrame* menuPopupFrame =
|
|
|
|
do_QueryFrame(menuPopupContent->GetPrimaryFrame());
|
|
|
|
return menuPopupFrame && menuPopupFrame->IsOpen();
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
Accessible* XULMenuitemAccessible::ContainerWidget() const {
|
2011-09-28 05:46:11 +04:00
|
|
|
nsMenuFrame* menuFrame = do_QueryFrame(GetFrame());
|
|
|
|
if (menuFrame) {
|
|
|
|
nsMenuParent* menuParent = menuFrame->GetMenuParent();
|
|
|
|
if (menuParent) {
|
2019-10-16 09:10:32 +03:00
|
|
|
nsBoxFrame* frame = nullptr;
|
|
|
|
if (menuParent->IsMenuBar()) { // menubar menu
|
|
|
|
frame = static_cast<nsMenuBarFrame*>(menuParent);
|
|
|
|
} else if (menuParent->IsMenu()) { // a menupopup or parent menu item
|
|
|
|
frame = static_cast<nsMenuPopupFrame*>(menuParent);
|
|
|
|
}
|
|
|
|
if (frame) {
|
|
|
|
nsIContent* content = frame->GetContent();
|
|
|
|
if (content) {
|
|
|
|
MOZ_ASSERT(mDoc);
|
|
|
|
// We use GetAccessibleOrContainer instead of just GetAccessible
|
|
|
|
// because we strip menupopups from the tree for ATK.
|
|
|
|
return mDoc->GetAccessibleOrContainer(content);
|
|
|
|
}
|
|
|
|
}
|
2011-09-28 05:46:11 +04:00
|
|
|
|
|
|
|
// otherwise it's different kind of popups (like panel or tooltip), it
|
|
|
|
// shouldn't be a real case.
|
|
|
|
}
|
|
|
|
}
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-28 05:46:11 +04:00
|
|
|
}
|
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-11 03:44:50 +04:00
|
|
|
// XULMenuSeparatorAccessible
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
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
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
XULMenuSeparatorAccessible::XULMenuSeparatorAccessible(nsIContent* aContent,
|
|
|
|
DocAccessible* aDoc)
|
|
|
|
: XULMenuitemAccessible(aContent, aDoc) {}
|
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
|
|
|
|
2018-05-15 21:04:50 +03:00
|
|
|
uint64_t XULMenuSeparatorAccessible::NativeState() const {
|
2007-06-13 14:54:07 +04:00
|
|
|
// Isn't focusable, but can be offscreen/invisible -- only copy those states
|
2012-06-11 03:44:50 +04:00
|
|
|
return XULMenuitemAccessible::NativeState() &
|
2011-04-10 03:38:06 +04:00
|
|
|
(states::OFFSCREEN | states::INVISIBLE);
|
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
|
|
|
}
|
|
|
|
|
2018-05-15 19:13:02 +03:00
|
|
|
ENameValueFlag XULMenuSeparatorAccessible::NativeName(nsString& aName) const {
|
2012-10-14 08:18:39 +04:00
|
|
|
return eNameOK;
|
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
|
|
|
}
|
|
|
|
|
2018-05-07 22:05:50 +03:00
|
|
|
role XULMenuSeparatorAccessible::NativeRole() const { return roles::SEPARATOR; }
|
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
|
|
|
|
2018-05-15 20:40:22 +03:00
|
|
|
bool XULMenuSeparatorAccessible::DoAction(uint8_t index) const { return false; }
|
2002-04-26 08:50:21 +04:00
|
|
|
|
2014-09-16 21:30:23 +04:00
|
|
|
void XULMenuSeparatorAccessible::ActionNameAt(uint8_t aIndex,
|
|
|
|
nsAString& aName) {
|
|
|
|
aName.Truncate();
|
2002-04-26 08:50:21 +04:00
|
|
|
}
|
|
|
|
|
2018-05-15 20:40:22 +03:00
|
|
|
uint8_t XULMenuSeparatorAccessible::ActionCount() const { return 0; }
|
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
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-11 03:44:50 +04:00
|
|
|
// XULMenupopupAccessible
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
XULMenupopupAccessible::XULMenupopupAccessible(nsIContent* aContent,
|
|
|
|
DocAccessible* aDoc)
|
2012-02-08 02:38:54 +04:00
|
|
|
: XULSelectControlAccessible(aContent, aDoc) {
|
2011-09-28 05:46:11 +04:00
|
|
|
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
|
|
|
|
if (menuPopupFrame && menuPopupFrame->IsMenu()) mType = eMenuPopupType;
|
|
|
|
|
2007-02-09 05:03:08 +03:00
|
|
|
// May be the anonymous <menupopup> inside <menulist> (a combobox)
|
2020-04-08 22:48:30 +03:00
|
|
|
auto* parent = mContent->GetParentElement();
|
2018-12-04 19:32:15 +03:00
|
|
|
nsCOMPtr<nsIDOMXULSelectControlElement> selectControl =
|
2020-04-08 22:48:30 +03:00
|
|
|
parent ? parent->AsXULSelectControl() : nullptr;
|
2018-12-04 19:32:15 +03:00
|
|
|
if (selectControl) {
|
2020-04-08 22:48:30 +03:00
|
|
|
mSelectControl = parent;
|
2018-12-04 19:32:15 +03:00
|
|
|
} else {
|
|
|
|
mSelectControl = nullptr;
|
|
|
|
mGenericTypes &= ~eSelect;
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
|
2018-05-15 21:04:50 +03:00
|
|
|
uint64_t XULMenupopupAccessible::NativeState() const {
|
2012-08-22 19:56:38 +04:00
|
|
|
uint64_t state = Accessible::NativeState();
|
2007-04-02 19:56:24 +04:00
|
|
|
|
2012-05-08 03:49:41 +04:00
|
|
|
#ifdef DEBUG
|
2007-06-13 14:54:07 +04:00
|
|
|
// We are onscreen if our parent is active
|
2017-12-07 21:13:50 +03:00
|
|
|
bool isActive =
|
|
|
|
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::menuactive);
|
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
|
|
|
if (!isActive) {
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible* parent = Parent();
|
2012-05-08 03:49:41 +04:00
|
|
|
if (parent) {
|
|
|
|
nsIContent* parentContent = parent->GetContent();
|
2017-12-07 21:13:50 +03:00
|
|
|
if (parentContent && parentContent->IsElement())
|
|
|
|
isActive = parentContent->AsElement()->HasAttr(kNameSpaceID_None,
|
|
|
|
nsGkAtoms::open);
|
2012-05-08 03:49:41 +04:00
|
|
|
}
|
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
|
|
|
}
|
2010-06-11 12:23:18 +04:00
|
|
|
|
2012-05-08 03:49:41 +04:00
|
|
|
NS_ASSERTION(isActive || (state & states::INVISIBLE),
|
2011-04-10 03:38:06 +04:00
|
|
|
"XULMenupopup doesn't have INVISIBLE when it's inactive");
|
2007-09-26 11:46:31 +04:00
|
|
|
#endif
|
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
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
if (state & states::INVISIBLE) state |= states::OFFSCREEN | states::COLLAPSED;
|
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
|
|
|
|
2011-04-10 03:38:06 +04:00
|
|
|
return state;
|
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
|
|
|
}
|
|
|
|
|
2018-05-15 19:13:02 +03:00
|
|
|
ENameValueFlag XULMenupopupAccessible::NativeName(nsString& aName) const {
|
2012-10-14 08:18:39 +04:00
|
|
|
nsIContent* content = mContent;
|
2007-08-22 12:05:33 +04:00
|
|
|
while (content && aName.IsEmpty()) {
|
2017-12-07 21:13:50 +03:00
|
|
|
if (content->IsElement()) {
|
|
|
|
content->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
|
|
|
|
}
|
2013-05-02 02:50:08 +04:00
|
|
|
content = content->GetFlattenedTreeParent();
|
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
|
|
|
}
|
|
|
|
|
2012-10-14 08:18:39 +04:00
|
|
|
return eNameOK;
|
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
|
|
|
}
|
|
|
|
|
2018-05-07 22:05:50 +03:00
|
|
|
role XULMenupopupAccessible::NativeRole() const {
|
2019-10-10 23:33:29 +03:00
|
|
|
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
|
|
|
|
if (menuPopupFrame && menuPopupFrame->IsContextMenu()) {
|
|
|
|
return roles::MENUPOPUP;
|
|
|
|
}
|
|
|
|
|
2010-09-04 04:32:13 +04:00
|
|
|
if (mParent) {
|
2017-07-11 12:16:00 +03:00
|
|
|
if (mParent->IsCombobox() || mParent->IsAutoComplete())
|
2012-01-12 07:07:35 +04:00
|
|
|
return roles::COMBOBOX_LIST;
|
2009-11-10 08:58:52 +03:00
|
|
|
|
2017-07-11 12:16:00 +03:00
|
|
|
if (mParent->Role() == roles::PUSHBUTTON) {
|
2009-11-10 08:58:52 +03:00
|
|
|
// Some widgets like the search bar have several popups, owned by buttons.
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible* grandParent = mParent->Parent();
|
2017-07-11 12:16:00 +03:00
|
|
|
if (grandParent && grandParent->IsAutoComplete())
|
2012-01-12 07:07:35 +04:00
|
|
|
return roles::COMBOBOX_LIST;
|
2008-01-24 02:49:10 +03:00
|
|
|
}
|
2007-01-11 23:07:36 +03:00
|
|
|
}
|
2009-11-10 08:58:52 +03:00
|
|
|
|
2019-10-10 23:33:29 +03:00
|
|
|
// If accessible is not bound to the tree (this happens while children are
|
|
|
|
// cached) return general role.
|
2012-01-12 07:07:35 +04:00
|
|
|
return roles::MENUPOPUP;
|
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
|
|
|
}
|
|
|
|
|
2011-09-28 05:46:11 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-11 03:44:50 +04:00
|
|
|
// XULMenupopupAccessible: Widgets
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
bool XULMenupopupAccessible::IsWidget() const { return true; }
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
bool XULMenupopupAccessible::IsActiveWidget() const {
|
2011-09-28 05:46:11 +04:00
|
|
|
// If menupopup is a widget (the case of context menus) then active when open.
|
|
|
|
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
|
|
|
|
return menuPopupFrame && menuPopupFrame->IsOpen();
|
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
bool XULMenupopupAccessible::AreItemsOperable() const {
|
2011-09-28 05:46:11 +04:00
|
|
|
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
|
|
|
|
return menuPopupFrame && menuPopupFrame->IsOpen();
|
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
Accessible* XULMenupopupAccessible::ContainerWidget() const {
|
2012-05-27 13:01:40 +04:00
|
|
|
DocAccessible* document = Document();
|
2011-09-28 05:46:11 +04:00
|
|
|
|
|
|
|
nsMenuPopupFrame* menuPopupFrame = do_QueryFrame(GetFrame());
|
|
|
|
while (menuPopupFrame) {
|
2012-05-29 05:18:45 +04:00
|
|
|
Accessible* menuPopup =
|
2011-09-28 05:46:11 +04:00
|
|
|
document->GetAccessible(menuPopupFrame->GetContent());
|
|
|
|
if (!menuPopup) // shouldn't be a real case
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-07-31 04:43:28 +04:00
|
|
|
nsMenuFrame* menuFrame = do_QueryFrame(menuPopupFrame->GetParent());
|
2011-09-28 05:46:11 +04:00
|
|
|
if (!menuFrame) // context menu or popups
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-28 05:46:11 +04:00
|
|
|
|
|
|
|
nsMenuParent* menuParent = menuFrame->GetMenuParent();
|
|
|
|
if (!menuParent) // menulist or menubutton
|
|
|
|
return menuPopup->Parent();
|
|
|
|
|
|
|
|
if (menuParent->IsMenuBar()) { // menubar menu
|
|
|
|
nsMenuBarFrame* menuBarFrame = static_cast<nsMenuBarFrame*>(menuParent);
|
|
|
|
return document->GetAccessible(menuBarFrame->GetContent());
|
|
|
|
}
|
|
|
|
|
|
|
|
// different kind of popups like panel or tooltip
|
|
|
|
if (!menuParent->IsMenu()) return nullptr;
|
|
|
|
|
|
|
|
menuPopupFrame = static_cast<nsMenuPopupFrame*>(menuParent);
|
|
|
|
}
|
|
|
|
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("Shouldn't be a real case.");
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-09-28 05:46:11 +04:00
|
|
|
}
|
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
|
|
|
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-11 03:44:50 +04:00
|
|
|
// XULMenubarAccessible
|
2010-06-11 12:23:18 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
XULMenubarAccessible::XULMenubarAccessible(nsIContent* aContent,
|
|
|
|
DocAccessible* aDoc)
|
2012-05-29 05:18:45 +04:00
|
|
|
: AccessibleWrap(aContent, aDoc) {}
|
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
|
|
|
|
2018-05-15 19:13:02 +03:00
|
|
|
ENameValueFlag XULMenubarAccessible::NativeName(nsString& aName) const {
|
2008-08-24 20:45:56 +04:00
|
|
|
aName.AssignLiteral("Application");
|
2012-10-14 08:18:39 +04:00
|
|
|
return eNameOK;
|
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
|
|
|
}
|
|
|
|
|
2018-05-07 22:05:50 +03:00
|
|
|
role XULMenubarAccessible::NativeRole() const { return roles::MENUBAR; }
|
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
|
|
|
|
2011-09-28 05:46:11 +04:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-06-11 03:44:50 +04:00
|
|
|
// XULMenubarAccessible: Widgets
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
bool XULMenubarAccessible::IsActiveWidget() const {
|
2011-09-28 05:46:11 +04:00
|
|
|
nsMenuBarFrame* menuBarFrame = do_QueryFrame(GetFrame());
|
|
|
|
return menuBarFrame && menuBarFrame->IsActive();
|
|
|
|
}
|
|
|
|
|
2012-06-11 03:44:50 +04:00
|
|
|
bool XULMenubarAccessible::AreItemsOperable() const { return true; }
|
2011-09-28 05:46:11 +04:00
|
|
|
|
2018-05-13 12:26:02 +03:00
|
|
|
Accessible* XULMenubarAccessible::CurrentItem() const {
|
2011-09-28 05:46:11 +04:00
|
|
|
nsMenuBarFrame* menuBarFrame = do_QueryFrame(GetFrame());
|
|
|
|
if (menuBarFrame) {
|
|
|
|
nsMenuFrame* menuFrame = menuBarFrame->GetCurrentMenuItem();
|
|
|
|
if (menuFrame) {
|
|
|
|
nsIContent* menuItemNode = menuFrame->GetContent();
|
2012-02-15 23:22:17 +04:00
|
|
|
return mDoc->GetAccessible(menuItemNode);
|
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
|
|
|
}
|
2011-12-08 16:20:15 +04:00
|
|
|
|
2018-05-13 13:14:55 +03:00
|
|
|
void XULMenubarAccessible::SetCurrentItem(const Accessible* aItem) {
|
2012-06-11 03:44:50 +04:00
|
|
|
NS_ERROR("XULMenubarAccessible::SetCurrentItem not implemented");
|
2011-12-08 16:20:15 +04:00
|
|
|
}
|