зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1693607 - [Linux] Add braces around statements. r=morgan
This is a collaboration between clang-tidy and clang-format. clang-tidy uses compiled code paths, so this patch is linux specific. Differential Revision: https://phabricator.services.mozilla.com/D105669
This commit is contained in:
Родитель
a16fdc090e
Коммит
f48f468cb7
|
@ -321,8 +321,9 @@ uint16_t AccessibleWrap::CreateMaiInterfaces(void) {
|
|||
if (hyperText && hyperText->IsTextRole()) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_TEXT;
|
||||
interfacesBits |= 1 << MAI_INTERFACE_EDITABLE_TEXT;
|
||||
if (!nsAccUtils::MustPrune(this))
|
||||
if (!nsAccUtils::MustPrune(this)) {
|
||||
interfacesBits |= 1 << MAI_INTERFACE_HYPERTEXT;
|
||||
}
|
||||
}
|
||||
|
||||
// Value interface.
|
||||
|
@ -493,8 +494,9 @@ void initializeCB(AtkObject* aAtkObj, gpointer aData) {
|
|||
* maybe it has later
|
||||
*/
|
||||
|
||||
if (ATK_OBJECT_CLASS(parent_class)->initialize)
|
||||
if (ATK_OBJECT_CLASS(parent_class)->initialize) {
|
||||
ATK_OBJECT_CLASS(parent_class)->initialize(aAtkObj, aData);
|
||||
}
|
||||
|
||||
/* initialize object */
|
||||
MAI_ATK_OBJECT(aAtkObj)->accWrap.SetBits(reinterpret_cast<uintptr_t>(aData));
|
||||
|
@ -506,19 +508,21 @@ void finalizeCB(GObject* aObj) {
|
|||
|
||||
// call parent finalize function
|
||||
// finalize of GObjectClass will unref the accessible parent if has
|
||||
if (G_OBJECT_CLASS(parent_class)->finalize)
|
||||
if (G_OBJECT_CLASS(parent_class)->finalize) {
|
||||
G_OBJECT_CLASS(parent_class)->finalize(aObj);
|
||||
}
|
||||
}
|
||||
|
||||
const gchar* getNameCB(AtkObject* aAtkObj) {
|
||||
nsAutoString name;
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||
if (accWrap)
|
||||
if (accWrap) {
|
||||
accWrap->Name(name);
|
||||
else if (ProxyAccessible* proxy = GetProxy(aAtkObj))
|
||||
} else if (ProxyAccessible* proxy = GetProxy(aAtkObj)) {
|
||||
proxy->Name(name);
|
||||
else
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// XXX Firing an event from here does not seem right
|
||||
MaybeFireNameChange(aAtkObj, name);
|
||||
|
@ -562,8 +566,9 @@ const gchar* getDescriptionCB(AtkObject* aAtkObj) {
|
|||
}
|
||||
|
||||
NS_ConvertUTF8toUTF16 objDesc(aAtkObj->description);
|
||||
if (!uniDesc.Equals(objDesc))
|
||||
if (!uniDesc.Equals(objDesc)) {
|
||||
atk_object_set_description(aAtkObj, NS_ConvertUTF16toUTF8(uniDesc).get());
|
||||
}
|
||||
|
||||
return aAtkObj->description;
|
||||
}
|
||||
|
@ -597,25 +602,28 @@ AtkRole getRoleCB(AtkObject* aAtkObj) {
|
|||
|
||||
#undef ROLE
|
||||
|
||||
if (aAtkObj->role == ATK_ROLE_LIST_BOX && !IsAtkVersionAtLeast(2, 1))
|
||||
if (aAtkObj->role == ATK_ROLE_LIST_BOX && !IsAtkVersionAtLeast(2, 1)) {
|
||||
aAtkObj->role = ATK_ROLE_LIST;
|
||||
else if (aAtkObj->role == ATK_ROLE_TABLE_ROW && !IsAtkVersionAtLeast(2, 1))
|
||||
} else if (aAtkObj->role == ATK_ROLE_TABLE_ROW &&
|
||||
!IsAtkVersionAtLeast(2, 1)) {
|
||||
aAtkObj->role = ATK_ROLE_LIST_ITEM;
|
||||
else if (aAtkObj->role == ATK_ROLE_MATH && !IsAtkVersionAtLeast(2, 12))
|
||||
} else if (aAtkObj->role == ATK_ROLE_MATH && !IsAtkVersionAtLeast(2, 12)) {
|
||||
aAtkObj->role = ATK_ROLE_SECTION;
|
||||
else if (aAtkObj->role == ATK_ROLE_COMMENT && !IsAtkVersionAtLeast(2, 12))
|
||||
} else if (aAtkObj->role == ATK_ROLE_COMMENT && !IsAtkVersionAtLeast(2, 12)) {
|
||||
aAtkObj->role = ATK_ROLE_SECTION;
|
||||
else if (aAtkObj->role == ATK_ROLE_LANDMARK && !IsAtkVersionAtLeast(2, 12))
|
||||
} else if (aAtkObj->role == ATK_ROLE_LANDMARK &&
|
||||
!IsAtkVersionAtLeast(2, 12)) {
|
||||
aAtkObj->role = ATK_ROLE_SECTION;
|
||||
else if (aAtkObj->role == ATK_ROLE_FOOTNOTE && !IsAtkVersionAtLeast(2, 25, 2))
|
||||
} else if (aAtkObj->role == ATK_ROLE_FOOTNOTE &&
|
||||
!IsAtkVersionAtLeast(2, 25, 2)) {
|
||||
aAtkObj->role = ATK_ROLE_SECTION;
|
||||
else if (aAtkObj->role == ATK_ROLE_STATIC && !IsAtkVersionAtLeast(2, 16))
|
||||
} else if (aAtkObj->role == ATK_ROLE_STATIC && !IsAtkVersionAtLeast(2, 16)) {
|
||||
aAtkObj->role = ATK_ROLE_TEXT;
|
||||
else if ((aAtkObj->role == ATK_ROLE_MATH_FRACTION ||
|
||||
aAtkObj->role == ATK_ROLE_MATH_ROOT) &&
|
||||
!IsAtkVersionAtLeast(2, 16))
|
||||
} else if ((aAtkObj->role == ATK_ROLE_MATH_FRACTION ||
|
||||
aAtkObj->role == ATK_ROLE_MATH_ROOT) &&
|
||||
!IsAtkVersionAtLeast(2, 16)) {
|
||||
aAtkObj->role = ATK_ROLE_SECTION;
|
||||
else if (aAtkObj->role == ATK_ROLE_MARK && !IsAtkVersionAtLeast(2, 36)) {
|
||||
} else if (aAtkObj->role == ATK_ROLE_MARK && !IsAtkVersionAtLeast(2, 36)) {
|
||||
aAtkObj->role = ATK_ROLE_TEXT;
|
||||
} else if (aAtkObj->role == ATK_ROLE_SUGGESTION &&
|
||||
!IsAtkVersionAtLeast(2, 36)) {
|
||||
|
@ -789,8 +797,9 @@ AtkObject* refChildCB(AtkObject* aAtkObj, gint aChildIndex) {
|
|||
|
||||
g_object_ref(childAtkObj);
|
||||
|
||||
if (aAtkObj != childAtkObj->accessible_parent)
|
||||
if (aAtkObj != childAtkObj->accessible_parent) {
|
||||
atk_object_set_parent(childAtkObj, aAtkObj);
|
||||
}
|
||||
|
||||
return childAtkObj;
|
||||
}
|
||||
|
@ -875,8 +884,9 @@ static void UpdateAtkRelation(RelationType aType, Accessible* aAcc,
|
|||
Relation rel(aAcc->RelationByType(aType));
|
||||
nsTArray<AtkObject*> targets;
|
||||
Accessible* tempAcc = nullptr;
|
||||
while ((tempAcc = rel.Next()))
|
||||
while ((tempAcc = rel.Next())) {
|
||||
targets.AppendElement(AccessibleWrap::GetAtkObject(tempAcc));
|
||||
}
|
||||
|
||||
if (aType == RelationType::EMBEDS && aAcc->IsRoot()) {
|
||||
if (ProxyAccessible* proxyDoc =
|
||||
|
@ -910,13 +920,15 @@ AtkRelationSet* refRelationSetCB(AtkObject* aAtkObj) {
|
|||
|
||||
size_t relationCount = types.Length();
|
||||
for (size_t i = 0; i < relationCount; i++) {
|
||||
if (typeMap[static_cast<uint32_t>(types[i])] == ATK_RELATION_NULL)
|
||||
if (typeMap[static_cast<uint32_t>(types[i])] == ATK_RELATION_NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t targetCount = targetSets[i].Length();
|
||||
AutoTArray<AtkObject*, 5> wrappers;
|
||||
for (size_t j = 0; j < targetCount; j++)
|
||||
for (size_t j = 0; j < targetCount; j++) {
|
||||
wrappers.AppendElement(GetWrapperFor(targetSets[i][j]));
|
||||
}
|
||||
|
||||
AtkRelationType atkType = typeMap[static_cast<uint32_t>(types[i])];
|
||||
AtkRelation* atkRelation =
|
||||
|
@ -993,24 +1005,28 @@ AtkObject* GetWrapperFor(AccessibleOrProxy aObj) {
|
|||
static uint16_t GetInterfacesForProxy(ProxyAccessible* aProxy,
|
||||
uint32_t aInterfaces) {
|
||||
uint16_t interfaces = 1 << MAI_INTERFACE_COMPONENT;
|
||||
if (aInterfaces & Interfaces::HYPERTEXT)
|
||||
if (aInterfaces & Interfaces::HYPERTEXT) {
|
||||
interfaces |= (1 << MAI_INTERFACE_HYPERTEXT) | (1 << MAI_INTERFACE_TEXT) |
|
||||
(1 << MAI_INTERFACE_EDITABLE_TEXT);
|
||||
}
|
||||
|
||||
if (aInterfaces & Interfaces::HYPERLINK)
|
||||
if (aInterfaces & Interfaces::HYPERLINK) {
|
||||
interfaces |= 1 << MAI_INTERFACE_HYPERLINK_IMPL;
|
||||
}
|
||||
|
||||
if (aInterfaces & Interfaces::VALUE) interfaces |= 1 << MAI_INTERFACE_VALUE;
|
||||
|
||||
if (aInterfaces & Interfaces::TABLE) interfaces |= 1 << MAI_INTERFACE_TABLE;
|
||||
|
||||
if (aInterfaces & Interfaces::TABLECELL)
|
||||
if (aInterfaces & Interfaces::TABLECELL) {
|
||||
interfaces |= 1 << MAI_INTERFACE_TABLE_CELL;
|
||||
}
|
||||
|
||||
if (aInterfaces & Interfaces::IMAGE) interfaces |= 1 << MAI_INTERFACE_IMAGE;
|
||||
|
||||
if (aInterfaces & Interfaces::DOCUMENT)
|
||||
if (aInterfaces & Interfaces::DOCUMENT) {
|
||||
interfaces |= 1 << MAI_INTERFACE_DOCUMENT;
|
||||
}
|
||||
|
||||
if (aInterfaces & Interfaces::SELECTION) {
|
||||
interfaces |= 1 << MAI_INTERFACE_SELECTION;
|
||||
|
@ -1433,10 +1449,11 @@ static const char* textChangedStrings[2][2] = {
|
|||
void MaiAtkObject::FireTextChangeEvent(const nsString& aStr, int32_t aStart,
|
||||
uint32_t aLen, bool aIsInsert,
|
||||
bool aFromUser) {
|
||||
if (gAvailableAtkSignals == eUnknown)
|
||||
if (gAvailableAtkSignals == eUnknown) {
|
||||
gAvailableAtkSignals = g_signal_lookup("text-insert", G_OBJECT_TYPE(this))
|
||||
? eHaveNewAtkTextSignals
|
||||
: eNoNewAtkSignals;
|
||||
}
|
||||
|
||||
if (gAvailableAtkSignals == eNoNewAtkSignals) {
|
||||
// XXX remove this code and the gHaveNewTextSignals check when we can
|
||||
|
|
|
@ -30,8 +30,9 @@ gboolean toplevel_event_watcher(GSignalInvocationHint* ihint,
|
|||
const GValue* param_values, gpointer data) {
|
||||
static GQuark sQuark_gecko_acc_obj = 0;
|
||||
|
||||
if (!sQuark_gecko_acc_obj)
|
||||
if (!sQuark_gecko_acc_obj) {
|
||||
sQuark_gecko_acc_obj = g_quark_from_static_string("GeckoAccObj");
|
||||
}
|
||||
|
||||
if (nsAccessibilityService::IsShutdown()) return TRUE;
|
||||
|
||||
|
|
|
@ -96,8 +96,9 @@ void AtkSocketAccessible::GetNativeInterface(void** aOutAccessible) {
|
|||
|
||||
void AtkSocketAccessible::Shutdown() {
|
||||
if (mAtkObject) {
|
||||
if (MAI_IS_ATK_SOCKET(mAtkObject))
|
||||
if (MAI_IS_ATK_SOCKET(mAtkObject)) {
|
||||
MAI_ATK_SOCKET(mAtkObject)->accWrap = nullptr;
|
||||
}
|
||||
g_object_unref(mAtkObject);
|
||||
mAtkObject = nullptr;
|
||||
}
|
||||
|
|
|
@ -128,8 +128,9 @@ gchar* NewATKString(AccessibleOrProxy* aAccessible, gint aStartOffset,
|
|||
return g_strdup("");
|
||||
}
|
||||
|
||||
if (aFlags & AtkStringConvertFlags::ConvertTextToAsterisks)
|
||||
if (aFlags & AtkStringConvertFlags::ConvertTextToAsterisks) {
|
||||
ConvertTexttoAsterisks(str);
|
||||
}
|
||||
return converter.ConvertAdjusted(str);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,10 +86,11 @@ static nsresult LoadGtkModule(GnomeAccessibilityModule& aModule) {
|
|||
int16_t subLen = 0;
|
||||
while (loc2 >= 0) {
|
||||
loc2 = libPath.FindChar(':', loc1);
|
||||
if (loc2 < 0)
|
||||
if (loc2 < 0) {
|
||||
subLen = libPath.Length() - loc1;
|
||||
else
|
||||
} else {
|
||||
subLen = loc2 - loc1;
|
||||
}
|
||||
nsAutoCString sub(Substring(libPath, loc1, subLen));
|
||||
sub.AppendLiteral("/gtk-3.0/modules/");
|
||||
sub.Append(aModule.libName);
|
||||
|
@ -122,8 +123,9 @@ void a11y::PlatformInit() {
|
|||
AtkGetTypeType pfn_atk_hyperlink_impl_get_type =
|
||||
(AtkGetTypeType)PR_FindFunctionSymbol(sATKLib,
|
||||
sATKHyperlinkImplGetTypeSymbol);
|
||||
if (pfn_atk_hyperlink_impl_get_type)
|
||||
if (pfn_atk_hyperlink_impl_get_type) {
|
||||
g_atk_hyperlink_impl_type = pfn_atk_hyperlink_impl_get_type();
|
||||
}
|
||||
|
||||
AtkGetTypeType pfn_atk_socket_get_type =
|
||||
(AtkGetTypeType)PR_FindFunctionSymbol(
|
||||
|
@ -150,8 +152,9 @@ void a11y::PlatformInit() {
|
|||
atkMajorVersion = strtol(version, &endPtr, 10);
|
||||
if (atkMajorVersion != 0L) {
|
||||
atkMinorVersion = strtol(endPtr + 1, &endPtr, 10);
|
||||
if (atkMinorVersion != 0L)
|
||||
if (atkMinorVersion != 0L) {
|
||||
atkMicroVersion = strtol(endPtr + 1, &endPtr, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -275,8 +278,9 @@ bool a11y::ShouldA11yBeEnabled() {
|
|||
sPendingCall = nullptr;
|
||||
if (!reply ||
|
||||
dbus_message_get_type(reply) != DBUS_MESSAGE_TYPE_METHOD_RETURN ||
|
||||
strcmp(dbus_message_get_signature(reply), DBUS_TYPE_VARIANT_AS_STRING))
|
||||
strcmp(dbus_message_get_signature(reply), DBUS_TYPE_VARIANT_AS_STRING)) {
|
||||
goto dbus_done;
|
||||
}
|
||||
|
||||
DBusMessageIter iter, iter_variant, iter_struct;
|
||||
dbus_bool_t dResult;
|
||||
|
|
|
@ -136,8 +136,9 @@ void finalizeCB(GObject* aObj) {
|
|||
maiAtkHyperlink->maiHyperlink = nullptr;
|
||||
|
||||
/* call parent finalize function */
|
||||
if (G_OBJECT_CLASS(parent_class)->finalize)
|
||||
if (G_OBJECT_CLASS(parent_class)->finalize) {
|
||||
G_OBJECT_CLASS(parent_class)->finalize(aObj);
|
||||
}
|
||||
}
|
||||
|
||||
gchar* getUriCB(AtkHyperlink* aLink, gint aLinkIndex) {
|
||||
|
@ -183,8 +184,9 @@ gint getEndIndexCB(AtkHyperlink* aLink) {
|
|||
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
|
||||
if (!maiLink) return false;
|
||||
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
|
||||
return static_cast<gint>(hyperlink->EndOffset());
|
||||
}
|
||||
|
||||
bool valid = false;
|
||||
uint32_t endIdx = maiLink->Proxy()->EndOffset(&valid);
|
||||
|
@ -195,8 +197,9 @@ gint getStartIndexCB(AtkHyperlink* aLink) {
|
|||
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
|
||||
if (!maiLink) return -1;
|
||||
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
|
||||
return static_cast<gint>(hyperlink->StartOffset());
|
||||
}
|
||||
|
||||
bool valid = false;
|
||||
uint32_t startIdx = maiLink->Proxy()->StartOffset(&valid);
|
||||
|
@ -207,8 +210,9 @@ gboolean isValidCB(AtkHyperlink* aLink) {
|
|||
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
|
||||
if (!maiLink) return false;
|
||||
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
|
||||
return static_cast<gboolean>(hyperlink->IsLinkValid());
|
||||
}
|
||||
|
||||
return static_cast<gboolean>(maiLink->Proxy()->IsLinkValid());
|
||||
}
|
||||
|
@ -217,8 +221,9 @@ gint getAnchorCountCB(AtkHyperlink* aLink) {
|
|||
MaiHyperlink* maiLink = GetMaiHyperlink(aLink);
|
||||
if (!maiLink) return -1;
|
||||
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink())
|
||||
if (Accessible* hyperlink = maiLink->GetAccHyperlink()) {
|
||||
return static_cast<gint>(hyperlink->AnchorCount());
|
||||
}
|
||||
|
||||
bool valid = false;
|
||||
uint32_t anchorCount = maiLink->Proxy()->AnchorCount(&valid);
|
||||
|
|
|
@ -672,7 +672,8 @@ void textInterfaceInitCB(AtkTextIface* aIface) {
|
|||
}
|
||||
|
||||
// Cache the string values of the atk text attribute names.
|
||||
for (uint32_t i = 0; i < ArrayLength(sAtkTextAttrNames); i++)
|
||||
for (uint32_t i = 0; i < ArrayLength(sAtkTextAttrNames); i++) {
|
||||
sAtkTextAttrNames[i] =
|
||||
atk_text_attribute_get_name(static_cast<AtkTextAttribute>(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,8 +83,9 @@ static void getMinimumIncrementCB(AtkValue* obj, GValue* minimumIncrement) {
|
|||
|
||||
memset(minimumIncrement, 0, sizeof(GValue));
|
||||
double accValue = accWrap ? accWrap->Step() : proxy->Step();
|
||||
if (IsNaN(accValue))
|
||||
if (IsNaN(accValue)) {
|
||||
accValue = 0; // zero if the minimum increment is undefined
|
||||
}
|
||||
|
||||
g_value_init(minimumIncrement, G_TYPE_DOUBLE);
|
||||
g_value_set_double(minimumIncrement, accValue);
|
||||
|
|
|
@ -1449,9 +1449,11 @@ uint64_t aria::UniversalStatesFor(mozilla::dom::Element* aElement) {
|
|||
}
|
||||
|
||||
uint8_t aria::AttrCharacteristicsFor(nsAtom* aAtom) {
|
||||
for (uint32_t i = 0; i < ArrayLength(gWAIUnivAttrMap); i++)
|
||||
if (gWAIUnivAttrMap[i].attributeName == aAtom)
|
||||
for (uint32_t i = 0; i < ArrayLength(gWAIUnivAttrMap); i++) {
|
||||
if (gWAIUnivAttrMap[i].attributeName == aAtom) {
|
||||
return gWAIUnivAttrMap[i].characteristics;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1481,12 +1483,14 @@ bool AttrIterator::Next(nsAString& aAttrName, nsAString& aAttrValue) {
|
|||
if (!StringBeginsWith(attrStr, u"aria-"_ns)) continue; // Not ARIA
|
||||
|
||||
uint8_t attrFlags = aria::AttrCharacteristicsFor(attrAtom);
|
||||
if (attrFlags & ATTR_BYPASSOBJ)
|
||||
if (attrFlags & ATTR_BYPASSOBJ) {
|
||||
continue; // No need to handle exposing as obj attribute here
|
||||
}
|
||||
|
||||
if ((attrFlags & ATTR_VALTOKEN) &&
|
||||
!nsAccUtils::HasDefinedARIAToken(mElement, attrAtom))
|
||||
!nsAccUtils::HasDefinedARIAToken(mElement, attrAtom)) {
|
||||
continue; // only expose token based attributes if they are defined
|
||||
}
|
||||
|
||||
if ((attrFlags & ATTR_BYPASSOBJ_IF_FALSE) &&
|
||||
mElement->AttrValueIs(kNameSpaceID_None, attrAtom, nsGkAtoms::_false,
|
||||
|
|
|
@ -266,8 +266,9 @@ bool aria::MapToState(EStateRule aRule, dom::Element* aElement,
|
|||
|
||||
case eIndeterminateIfNoValue: {
|
||||
if (!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow) &&
|
||||
!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext))
|
||||
!aElement->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_valuetext)) {
|
||||
*aState |= states::MIXED;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -276,8 +277,9 @@ bool aria::MapToState(EStateRule aRule, dom::Element* aElement,
|
|||
if (!nsAccUtils::HasDefinedARIAToken(aElement,
|
||||
nsGkAtoms::aria_disabled) ||
|
||||
aElement->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_disabled,
|
||||
nsGkAtoms::_false, eCaseMatters))
|
||||
nsGkAtoms::_false, eCaseMatters)) {
|
||||
*aState |= states::FOCUSABLE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -308,10 +310,11 @@ static void MapTokenType(dom::Element* aElement, uint64_t* aState,
|
|||
if (nsAccUtils::HasDefinedARIAToken(aElement, aData.mAttrName)) {
|
||||
if (aElement->AttrValueIs(kNameSpaceID_None, aData.mAttrName,
|
||||
nsGkAtoms::mixed, eCaseMatters)) {
|
||||
if (aData.mType & eMixedType)
|
||||
if (aData.mType & eMixedType) {
|
||||
*aState |= aData.mPermanentState | states::MIXED;
|
||||
else // unsupported use of 'mixed' is an authoring error
|
||||
} else { // unsupported use of 'mixed' is an authoring error
|
||||
*aState |= aData.mPermanentState | aData.mFalseState;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -325,6 +328,7 @@ static void MapTokenType(dom::Element* aElement, uint64_t* aState,
|
|||
return;
|
||||
}
|
||||
|
||||
if (aData.mType & eDefinedIfAbsent)
|
||||
if (aData.mType & eDefinedIfAbsent) {
|
||||
*aState |= aData.mPermanentState | aData.mFalseState;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,10 +37,11 @@ static_assert(static_cast<bool>(eNoUserInput) == false &&
|
|||
AccEvent::AccEvent(uint32_t aEventType, Accessible* aAccessible,
|
||||
EIsFromUserInput aIsFromUserInput, EEventRule aEventRule)
|
||||
: mEventType(aEventType), mEventRule(aEventRule), mAccessible(aAccessible) {
|
||||
if (aIsFromUserInput == eAutoDetect)
|
||||
if (aIsFromUserInput == eAutoDetect) {
|
||||
mIsFromUserInput = dom::UserActivation::IsHandlingUserInput();
|
||||
else
|
||||
} else {
|
||||
mIsFromUserInput = aIsFromUserInput == eFromUserInput ? true : false;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -157,10 +158,11 @@ AccSelChangeEvent::AccSelChangeEvent(Accessible* aWidget, Accessible* aItem,
|
|||
mPreceedingCount(0),
|
||||
mPackedEvent(nullptr) {
|
||||
if (aSelChangeType == eSelectionAdd) {
|
||||
if (mWidget->GetSelectedItem(1))
|
||||
if (mWidget->GetSelectedItem(1)) {
|
||||
mEventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
|
||||
else
|
||||
} else {
|
||||
mEventType = nsIAccessibleEvent::EVENT_SELECTION;
|
||||
}
|
||||
} else {
|
||||
mEventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
|
||||
}
|
||||
|
|
|
@ -153,13 +153,16 @@ Accessible* AccGroupInfo::FirstItemOf(const Accessible* aContainer) {
|
|||
a11y::role containerRole = aContainer->Role();
|
||||
Accessible* item = aContainer->LocalNextSibling();
|
||||
if (item) {
|
||||
if (containerRole == roles::OUTLINEITEM && item->Role() == roles::GROUPING)
|
||||
if (containerRole == roles::OUTLINEITEM &&
|
||||
item->Role() == roles::GROUPING) {
|
||||
item = item->LocalFirstChild();
|
||||
}
|
||||
|
||||
if (item) {
|
||||
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
|
||||
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer)
|
||||
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -174,8 +177,9 @@ Accessible* AccGroupInfo::FirstItemOf(const Accessible* aContainer) {
|
|||
item = item->LocalFirstChild();
|
||||
if (item) {
|
||||
AccGroupInfo* itemGroupInfo = item->GetGroupInfo();
|
||||
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer)
|
||||
if (itemGroupInfo && itemGroupInfo->ConceptualParent() == aContainer) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -56,8 +56,9 @@ class AccGroupInfo {
|
|||
role != mozilla::a11y::roles::RADIO_MENU_ITEM &&
|
||||
role != mozilla::a11y::roles::RADIOBUTTON &&
|
||||
role != mozilla::a11y::roles::PAGETAB &&
|
||||
role != mozilla::a11y::roles::COMMENT)
|
||||
role != mozilla::a11y::roles::COMMENT) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AccGroupInfo* info = new AccGroupInfo(aAccessible, BaseRole(role));
|
||||
return info;
|
||||
|
@ -90,11 +91,13 @@ class AccGroupInfo {
|
|||
static mozilla::a11y::role BaseRole(mozilla::a11y::role aRole) {
|
||||
if (aRole == mozilla::a11y::roles::CHECK_MENU_ITEM ||
|
||||
aRole == mozilla::a11y::roles::PARENT_MENUITEM ||
|
||||
aRole == mozilla::a11y::roles::RADIO_MENU_ITEM)
|
||||
aRole == mozilla::a11y::roles::RADIO_MENU_ITEM) {
|
||||
return mozilla::a11y::roles::MENUITEM;
|
||||
}
|
||||
|
||||
if (aRole == mozilla::a11y::roles::CHECK_RICH_OPTION)
|
||||
if (aRole == mozilla::a11y::roles::CHECK_RICH_OPTION) {
|
||||
return mozilla::a11y::roles::RICH_OPTION;
|
||||
}
|
||||
|
||||
return aRole;
|
||||
}
|
||||
|
|
|
@ -323,8 +323,9 @@ Accessible* XULTreeItemIterator::Next() {
|
|||
int32_t level = 0;
|
||||
mTreeView->GetLevel(mCurrRowIdx, &level);
|
||||
|
||||
if (level == mContainerLevel + 1)
|
||||
if (level == mContainerLevel + 1) {
|
||||
return mXULTree->GetTreeItemAccessible(mCurrRowIdx++);
|
||||
}
|
||||
|
||||
if (level <= mContainerLevel) { // got level up
|
||||
mCurrRowIdx = mRowCount;
|
||||
|
|
|
@ -202,9 +202,10 @@ bool DocManager::Init() {
|
|||
void DocManager::Shutdown() {
|
||||
nsCOMPtr<nsIWebProgress> progress = components::DocLoader::Service();
|
||||
|
||||
if (progress)
|
||||
if (progress) {
|
||||
progress->RemoveProgressListener(
|
||||
static_cast<nsIWebProgressListener*>(this));
|
||||
}
|
||||
|
||||
ClearDocCache();
|
||||
}
|
||||
|
@ -224,8 +225,9 @@ DocManager::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
|
|||
NS_ASSERTION(aStateFlags & STATE_IS_DOCUMENT, "Other notifications excluded");
|
||||
|
||||
if (nsAccessibilityService::IsShutdown() || !aWebProgress ||
|
||||
(aStateFlags & (STATE_START | STATE_STOP)) == 0)
|
||||
(aStateFlags & (STATE_START | STATE_STOP)) == 0) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<mozIDOMWindowProxy> DOMWindow;
|
||||
aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow));
|
||||
|
@ -240,8 +242,9 @@ DocManager::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
|
|||
// Document was loaded.
|
||||
if (aStateFlags & STATE_STOP) {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
if (logging::IsEnabled(logging::eDocLoad)) {
|
||||
logging::DocLoad("document loaded", aWebProgress, aRequest, aStateFlags);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Figure out an event type to notify the document has been loaded.
|
||||
|
@ -250,8 +253,9 @@ DocManager::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
|
|||
// Some XUL documents get start state and then stop state with failure
|
||||
// status when everything is ok. Fire document load complete event in this
|
||||
// case.
|
||||
if (NS_SUCCEEDED(aStatus) || !nsCoreUtils::IsContentDocument(document))
|
||||
if (NS_SUCCEEDED(aStatus) || !nsCoreUtils::IsContentDocument(document)) {
|
||||
eventType = nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE;
|
||||
}
|
||||
|
||||
// If end consumer has been retargeted for loaded content then do not fire
|
||||
// any event because it means no new document has been loaded, for example,
|
||||
|
@ -268,9 +272,10 @@ DocManager::OnStateChange(nsIWebProgress* aWebProgress, nsIRequest* aRequest,
|
|||
|
||||
// Document loading was started.
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
if (logging::IsEnabled(logging::eDocLoad)) {
|
||||
logging::DocLoad("start document loading", aWebProgress, aRequest,
|
||||
aStateFlags);
|
||||
}
|
||||
#endif
|
||||
|
||||
DocAccessible* docAcc = GetExistingDocAccessible(document);
|
||||
|
@ -350,8 +355,9 @@ DocManager::HandleEvent(Event* aEvent) {
|
|||
// processing.
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocDestroy))
|
||||
if (logging::IsEnabled(logging::eDocDestroy)) {
|
||||
logging::DocDestroy("received 'pagehide' event", document);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Shutdown this one and sub document accessibles.
|
||||
|
@ -370,8 +376,9 @@ DocManager::HandleEvent(Event* aEvent) {
|
|||
if (type.EqualsLiteral("DOMContentLoaded") &&
|
||||
nsCoreUtils::IsErrorPage(document)) {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
if (logging::IsEnabled(logging::eDocLoad)) {
|
||||
logging::DocLoad("handled 'DOMContentLoaded' event", document);
|
||||
}
|
||||
#endif
|
||||
|
||||
HandleDOMDocumentLoad(document,
|
||||
|
@ -405,16 +412,18 @@ void DocManager::AddListeners(Document* aDocument,
|
|||
elm->AddEventListenerByType(this, u"pagehide"_ns, TrustedEventsAtCapture());
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocCreate))
|
||||
if (logging::IsEnabled(logging::eDocCreate)) {
|
||||
logging::Text("added 'pagehide' listener");
|
||||
}
|
||||
#endif
|
||||
|
||||
if (aAddDOMContentLoadedListener) {
|
||||
elm->AddEventListenerByType(this, u"DOMContentLoaded"_ns,
|
||||
TrustedEventsAtCapture());
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocCreate))
|
||||
if (logging::IsEnabled(logging::eDocCreate)) {
|
||||
logging::Text("added 'DOMContentLoaded' listener");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,8 +50,9 @@ int32_t EmbeddedObjCollector::GetIndexAt(Accessible* aAccessible) {
|
|||
if (aAccessible->mParent != mRoot) return -1;
|
||||
|
||||
MOZ_ASSERT(!aAccessible->IsProxy());
|
||||
if (aAccessible->mInt.mIndexOfEmbeddedChild != -1)
|
||||
if (aAccessible->mInt.mIndexOfEmbeddedChild != -1) {
|
||||
return aAccessible->mInt.mIndexOfEmbeddedChild;
|
||||
}
|
||||
|
||||
return !aAccessible->IsText() ? EnsureNGetIndex(aAccessible) : -1;
|
||||
}
|
||||
|
|
|
@ -167,8 +167,9 @@ void EventQueue::CoalesceEvents() {
|
|||
AccStateChangeEvent* tailSCEvent = downcast_accEvent(tailEvent);
|
||||
if (thisSCEvent->mState == tailSCEvent->mState) {
|
||||
thisEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
if (thisSCEvent->mIsEnabled != tailSCEvent->mIsEnabled)
|
||||
if (thisSCEvent->mIsEnabled != tailSCEvent->mIsEnabled) {
|
||||
tailEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -187,8 +188,9 @@ void EventQueue::CoalesceEvents() {
|
|||
AccTextSelChangeEvent* thisTSCEvent = downcast_accEvent(thisEvent);
|
||||
AccTextSelChangeEvent* tailTSCEvent = downcast_accEvent(tailEvent);
|
||||
if (thisTSCEvent->mSel == tailTSCEvent->mSel ||
|
||||
thisEvent->mAccessible == tailEvent->mAccessible)
|
||||
thisEvent->mAccessible == tailEvent->mAccessible) {
|
||||
thisEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
}
|
||||
}
|
||||
}
|
||||
break; // eCoalesceTextSelChange
|
||||
|
@ -233,8 +235,9 @@ void EventQueue::CoalesceSelChangeEvents(AccSelChangeEvent* aTailEvent,
|
|||
AccEvent* prevEvent = mEvents[jdx];
|
||||
if (prevEvent->mEventRule == aTailEvent->mEventRule) {
|
||||
AccSelChangeEvent* prevSelChangeEvent = downcast_accEvent(prevEvent);
|
||||
if (prevSelChangeEvent->mWidget == aTailEvent->mWidget)
|
||||
if (prevSelChangeEvent->mWidget == aTailEvent->mWidget) {
|
||||
prevSelChangeEvent->mEventRule = AccEvent::eDoNotEmit;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,8 +290,9 @@ void EventQueue::CoalesceSelChangeEvents(AccSelChangeEvent* aTailEvent,
|
|||
|
||||
// Convert into selection add since control has single selection but other
|
||||
// selection events for this control are queued.
|
||||
if (aTailEvent->mEventType == nsIAccessibleEvent::EVENT_SELECTION)
|
||||
if (aTailEvent->mEventType == nsIAccessibleEvent::EVENT_SELECTION) {
|
||||
aTailEvent->mEventType = nsIAccessibleEvent::EVENT_SELECTION_ADD;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -19,8 +19,9 @@ uint32_t filters::GetSelected(Accessible* aAccessible) {
|
|||
}
|
||||
|
||||
uint32_t filters::GetSelectable(Accessible* aAccessible) {
|
||||
if (aAccessible->InteractiveState() & states::SELECTABLE)
|
||||
if (aAccessible->InteractiveState() & states::SELECTABLE) {
|
||||
return eMatch | eSkipSubtree;
|
||||
}
|
||||
|
||||
return eSkip;
|
||||
}
|
||||
|
|
|
@ -106,8 +106,9 @@ bool FocusManager::WasLastFocused(const Accessible* aAccessible) const {
|
|||
|
||||
void FocusManager::NotifyOfDOMFocus(nsISupports* aTarget) {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::FocusNotificationTarget("DOM focus", "Target", aTarget);
|
||||
}
|
||||
#endif
|
||||
|
||||
mActiveItem = nullptr;
|
||||
|
@ -118,8 +119,9 @@ void FocusManager::NotifyOfDOMFocus(nsISupports* aTarget) {
|
|||
GetAccService()->GetDocAccessible(targetNode->OwnerDoc());
|
||||
if (document) {
|
||||
// Set selection listener for focused element.
|
||||
if (targetNode->IsElement())
|
||||
if (targetNode->IsElement()) {
|
||||
SelectionMgr()->SetControlSelectionListener(targetNode->AsElement());
|
||||
}
|
||||
|
||||
document->HandleNotification<FocusManager, nsINode>(
|
||||
this, &FocusManager::ProcessDOMFocus, targetNode);
|
||||
|
@ -129,8 +131,9 @@ void FocusManager::NotifyOfDOMFocus(nsISupports* aTarget) {
|
|||
|
||||
void FocusManager::NotifyOfDOMBlur(nsISupports* aTarget) {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::FocusNotificationTarget("DOM blur", "Target", aTarget);
|
||||
}
|
||||
#endif
|
||||
|
||||
mActiveItem = nullptr;
|
||||
|
@ -143,8 +146,9 @@ void FocusManager::NotifyOfDOMBlur(nsISupports* aTarget) {
|
|||
DocAccessible* document = GetAccService()->GetDocAccessible(DOMDoc);
|
||||
if (document) {
|
||||
// Clear selection listener for previously focused element.
|
||||
if (targetNode->IsElement())
|
||||
if (targetNode->IsElement()) {
|
||||
SelectionMgr()->ClearControlSelectionListener();
|
||||
}
|
||||
|
||||
document->HandleNotification<FocusManager, nsINode>(
|
||||
this, &FocusManager::ProcessDOMFocus, DOMDoc);
|
||||
|
@ -154,8 +158,9 @@ void FocusManager::NotifyOfDOMBlur(nsISupports* aTarget) {
|
|||
|
||||
void FocusManager::ActiveItemChanged(Accessible* aItem, bool aCheckIfActive) {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::FocusNotificationTarget("active item changed", "Item", aItem);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Nothing changed, happens for XUL trees and HTML selects.
|
||||
|
@ -168,8 +173,9 @@ void FocusManager::ActiveItemChanged(Accessible* aItem, bool aCheckIfActive) {
|
|||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus)) logging::ActiveWidget(widget);
|
||||
#endif
|
||||
if (!widget || !widget->IsActiveWidget() || !widget->AreItemsOperable())
|
||||
if (!widget || !widget->IsActiveWidget() || !widget->AreItemsOperable()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
mActiveItem = aItem;
|
||||
|
||||
|
@ -225,8 +231,9 @@ void FocusManager::DispatchFocusEvent(DocAccessible* aDocument,
|
|||
|
||||
void FocusManager::ProcessDOMFocus(nsINode* aTarget) {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::FocusNotificationTarget("process DOM focus", "Target", aTarget);
|
||||
}
|
||||
#endif
|
||||
|
||||
DocAccessible* document =
|
||||
|
@ -330,8 +337,9 @@ void FocusManager::ProcessFocusEvent(AccEvent* aEvent) {
|
|||
}
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::FocusNotificationTarget("fire focus event", "Target", target);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reset cached caret value. The cache will be updated upon processing the
|
||||
|
|
|
@ -309,14 +309,17 @@ static void LogRequest(nsIRequest* aRequest) {
|
|||
aRequest->GetLoadFlags(&loadFlags);
|
||||
printf(" request load flags: %x; ", loadFlags);
|
||||
if (loadFlags & nsIChannel::LOAD_DOCUMENT_URI) printf("document uri; ");
|
||||
if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI)
|
||||
if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) {
|
||||
printf("retargeted document uri; ");
|
||||
}
|
||||
if (loadFlags & nsIChannel::LOAD_REPLACE) printf("replace; ");
|
||||
if (loadFlags & nsIChannel::LOAD_INITIAL_DOCUMENT_URI)
|
||||
if (loadFlags & nsIChannel::LOAD_INITIAL_DOCUMENT_URI) {
|
||||
printf("initial document uri; ");
|
||||
}
|
||||
if (loadFlags & nsIChannel::LOAD_TARGETED) printf("targeted; ");
|
||||
if (loadFlags & nsIChannel::LOAD_CALL_CONTENT_SNIFFERS)
|
||||
if (loadFlags & nsIChannel::LOAD_CALL_CONTENT_SNIFFERS) {
|
||||
printf("call content sniffers; ");
|
||||
}
|
||||
if (loadFlags & nsIChannel::LOAD_BYPASS_URL_CLASSIFIER) {
|
||||
printf("bypass classify uri; ");
|
||||
}
|
||||
|
@ -327,14 +330,15 @@ static void LogRequest(nsIRequest* aRequest) {
|
|||
|
||||
static void LogDocAccState(DocAccessible* aDocument) {
|
||||
printf("document acc state: ");
|
||||
if (aDocument->HasLoadState(DocAccessible::eCompletelyLoaded))
|
||||
if (aDocument->HasLoadState(DocAccessible::eCompletelyLoaded)) {
|
||||
printf("completely loaded;");
|
||||
else if (aDocument->HasLoadState(DocAccessible::eReady))
|
||||
} else if (aDocument->HasLoadState(DocAccessible::eReady)) {
|
||||
printf("ready;");
|
||||
else if (aDocument->HasLoadState(DocAccessible::eDOMLoaded))
|
||||
} else if (aDocument->HasLoadState(DocAccessible::eDOMLoaded)) {
|
||||
printf("DOM loaded;");
|
||||
else if (aDocument->HasLoadState(DocAccessible::eTreeConstructed))
|
||||
} else if (aDocument->HasLoadState(DocAccessible::eTreeConstructed)) {
|
||||
printf("tree constructed;");
|
||||
}
|
||||
}
|
||||
|
||||
static void GetDocLoadEventType(AccEvent* aEvent, nsACString& aEventType) {
|
||||
|
@ -349,10 +353,11 @@ static void GetDocLoadEventType(AccEvent* aEvent, nsACString& aEventType) {
|
|||
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
||||
if (event->GetState() == states::BUSY) {
|
||||
aEventType.AssignLiteral("busy ");
|
||||
if (event->IsStateEnabled())
|
||||
if (event->IsStateEnabled()) {
|
||||
aEventType.AppendLiteral("true");
|
||||
else
|
||||
} else {
|
||||
aEventType.AppendLiteral("false");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -560,11 +565,12 @@ void logging::FocusNotificationTarget(const char* aMsg,
|
|||
|
||||
if (aTargetThing) {
|
||||
nsCOMPtr<nsINode> targetNode(do_QueryInterface(aTargetThing));
|
||||
if (targetNode)
|
||||
if (targetNode) {
|
||||
AccessibleNNode(aTargetDescr, targetNode);
|
||||
else
|
||||
} else {
|
||||
printf(" %s: %p, window\n", aTargetDescr,
|
||||
static_cast<void*>(aTargetThing));
|
||||
}
|
||||
}
|
||||
|
||||
MsgEnd();
|
||||
|
@ -600,12 +606,13 @@ void logging::SelChange(dom::Selection* aSelection, DocAccessible* aDocument,
|
|||
SelectionType type = aSelection->GetType();
|
||||
|
||||
const char* strType = 0;
|
||||
if (type == SelectionType::eNormal)
|
||||
if (type == SelectionType::eNormal) {
|
||||
strType = "normal";
|
||||
else if (type == SelectionType::eSpellCheck)
|
||||
} else if (type == SelectionType::eSpellCheck) {
|
||||
strType = "spellcheck";
|
||||
else
|
||||
} else {
|
||||
strType = "unknown";
|
||||
}
|
||||
|
||||
bool isIgnored = !aDocument || !aDocument->IsContentLoaded();
|
||||
printf(
|
||||
|
@ -911,8 +918,9 @@ bool logging::IsEnabledAll(uint32_t aModules) {
|
|||
|
||||
bool logging::IsEnabled(const nsAString& aModuleStr) {
|
||||
for (unsigned int idx = 0; idx < ArrayLength(sModuleMap); idx++) {
|
||||
if (aModuleStr.EqualsASCII(sModuleMap[idx].mStr))
|
||||
if (aModuleStr.EqualsASCII(sModuleMap[idx].mStr)) {
|
||||
return sModules & sModuleMap[idx].mModule;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
@ -86,8 +86,9 @@ void NotificationController::Shutdown() {
|
|||
// Shutdown handling child documents.
|
||||
int32_t childDocCount = mHangingChildDocuments.Length();
|
||||
for (int32_t idx = childDocCount - 1; idx >= 0; idx--) {
|
||||
if (!mHangingChildDocuments[idx]->IsDefunct())
|
||||
if (!mHangingChildDocuments[idx]->IsDefunct()) {
|
||||
mHangingChildDocuments[idx]->Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
mHangingChildDocuments.Clear();
|
||||
|
@ -437,8 +438,9 @@ void NotificationController::ScheduleProcessing() {
|
|||
// asynchronously (after style and layout).
|
||||
if (mObservingState == eNotObservingRefresh) {
|
||||
if (mPresShell->AddRefreshObserver(this, FlushType::Display,
|
||||
"Accessibility notifications"))
|
||||
"Accessibility notifications")) {
|
||||
mObservingState = eRefreshObserving;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -217,8 +217,9 @@ class NotificationController final : public EventQueue,
|
|||
if (!IsUpdatePending()) {
|
||||
#ifdef A11Y_LOG
|
||||
if (mozilla::a11y::logging::IsEnabled(
|
||||
mozilla::a11y::logging::eNotifications))
|
||||
mozilla::a11y::logging::eNotifications)) {
|
||||
mozilla::a11y::logging::Text("sync notification processing");
|
||||
}
|
||||
#endif
|
||||
(aInstance->*aMethod)(aArgs...);
|
||||
return;
|
||||
|
|
|
@ -47,10 +47,11 @@ class Relation {
|
|||
}
|
||||
|
||||
inline void AppendIter(AccIterable* aIter) {
|
||||
if (mLastIter)
|
||||
if (mLastIter) {
|
||||
mLastIter->mNextIter.reset(aIter);
|
||||
else
|
||||
} else {
|
||||
mFirstIter.reset(aIter);
|
||||
}
|
||||
|
||||
mLastIter = aIter;
|
||||
}
|
||||
|
@ -76,8 +77,9 @@ class Relation {
|
|||
inline Accessible* Next() {
|
||||
Accessible* target = nullptr;
|
||||
|
||||
while (mFirstIter && !(target = mFirstIter->Next()))
|
||||
while (mFirstIter && !(target = mFirstIter->Next())) {
|
||||
mFirstIter = std::move(mFirstIter->mNextIter);
|
||||
}
|
||||
|
||||
if (!mFirstIter) mLastIter = nullptr;
|
||||
|
||||
|
|
|
@ -148,8 +148,9 @@ SelectionManager::NotifySelectionChanged(dom::Document* aDocument,
|
|||
DocAccessible* document = GetAccService()->GetDocAccessible(aDocument);
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eSelection))
|
||||
if (logging::IsEnabled(logging::eSelection)) {
|
||||
logging::SelChange(aSelection, document, aReason);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (document) {
|
||||
|
|
|
@ -65,8 +65,9 @@ void TextAttrsMgr::GetAttributes(nsIPersistentProperties* aAttributes,
|
|||
// Get the content and frame of the accessible. In the case of document
|
||||
// accessible it's role content and root frame.
|
||||
nsIContent* hyperTextElm = mHyperTextAcc->GetContent();
|
||||
if (!hyperTextElm)
|
||||
if (!hyperTextElm) {
|
||||
return; // XXX: we don't support text attrs on document with no body
|
||||
}
|
||||
|
||||
nsIFrame* rootFrame = mHyperTextAcc->GetFrame();
|
||||
MOZ_ASSERT(rootFrame, "No frame for accessible!");
|
||||
|
@ -124,13 +125,15 @@ void TextAttrsMgr::GetAttributes(nsIPersistentProperties* aAttributes,
|
|||
|
||||
// Expose text attributes if applicable.
|
||||
if (aAttributes) {
|
||||
for (uint32_t idx = 0; idx < ArrayLength(attrArray); idx++)
|
||||
for (uint32_t idx = 0; idx < ArrayLength(attrArray); idx++) {
|
||||
attrArray[idx]->Expose(aAttributes, mIncludeDefAttrs);
|
||||
}
|
||||
}
|
||||
|
||||
// Expose text attributes range where they are applied if applicable.
|
||||
if (mOffsetAcc)
|
||||
if (mOffsetAcc) {
|
||||
GetRange(attrArray, ArrayLength(attrArray), aStartOffset, aEndOffset);
|
||||
}
|
||||
}
|
||||
|
||||
void TextAttrsMgr::GetRange(TextAttr* aAttrArray[], uint32_t aAttrArrayLen,
|
||||
|
@ -576,10 +579,11 @@ TextAttrsMgr::AutoGeneratedTextAttr::AutoGeneratedTextAttr(
|
|||
mRootNativeValue = false;
|
||||
mIsRootDefined = false;
|
||||
|
||||
if (aAccessible)
|
||||
if (aAccessible) {
|
||||
mIsDefined = mNativeValue =
|
||||
((aAccessible->NativeRole() == roles::STATICTEXT) ||
|
||||
(aAccessible->NativeRole() == roles::LISTITEM_MARKER));
|
||||
}
|
||||
}
|
||||
|
||||
bool TextAttrsMgr::AutoGeneratedTextAttr::GetValueFor(Accessible* aAccessible,
|
||||
|
|
|
@ -136,13 +136,15 @@ class TextAttrsMgr {
|
|||
}
|
||||
|
||||
if (mIsDefined) {
|
||||
if (aIncludeDefAttrValue || mRootNativeValue != mNativeValue)
|
||||
if (aIncludeDefAttrValue || mRootNativeValue != mNativeValue) {
|
||||
ExposeValue(aAttributes, mNativeValue);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (aIncludeDefAttrValue && mIsRootDefined)
|
||||
if (aIncludeDefAttrValue && mIsRootDefined) {
|
||||
ExposeValue(aAttributes, mRootNativeValue);
|
||||
}
|
||||
}
|
||||
|
||||
virtual bool Equal(Accessible* aAccessible) override {
|
||||
|
|
|
@ -38,8 +38,9 @@ bool TextPoint::operator<(const TextPoint& aPoint) const {
|
|||
for (uint32_t len = std::min(pos1, pos2); len > 0; --len) {
|
||||
Accessible* child1 = parents1.ElementAt(--pos1);
|
||||
Accessible* child2 = parents2.ElementAt(--pos2);
|
||||
if (child1 != child2)
|
||||
if (child1 != child2) {
|
||||
return child1->IndexInParent() < child2->IndexInParent();
|
||||
}
|
||||
}
|
||||
|
||||
if (pos1 != 0) {
|
||||
|
|
|
@ -127,8 +127,9 @@ void TextUpdater::DoUpdate(const nsAString& aNewText, const nsAString& aOldText,
|
|||
delete[] entries;
|
||||
|
||||
// Fire events.
|
||||
for (int32_t idx = events.Length() - 1; idx >= 0; idx--)
|
||||
for (int32_t idx = events.Length() - 1; idx >= 0; idx--) {
|
||||
mDocument->FireDelayedEvent(events[idx]);
|
||||
}
|
||||
|
||||
mDocument->MaybeNotifyOfValueChange(mHyperText);
|
||||
|
||||
|
|
|
@ -126,8 +126,9 @@ bool TreeWalker::Seek(nsIContent* aChildNode) {
|
|||
|
||||
Accessible* ownedChild = nullptr;
|
||||
while ((ownedChild = mDoc->ARIAOwnedAt(mContext, mARIAOwnsIdx++)) &&
|
||||
ownedChild != child)
|
||||
ownedChild != child) {
|
||||
;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(ownedChild, "A child has to be in ARIA owned elements");
|
||||
mPhase = eAtARIAOwns;
|
||||
|
|
|
@ -131,8 +131,9 @@ void nsAccUtils::SetLiveContainerAttributes(
|
|||
if (relevant.IsEmpty() &&
|
||||
HasDefinedARIAToken(ancestor, nsGkAtoms::aria_relevant) &&
|
||||
ancestor->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_relevant, relevant))
|
||||
nsGkAtoms::aria_relevant, relevant)) {
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerRelevant, relevant);
|
||||
}
|
||||
|
||||
// container-live, and container-live-role attributes
|
||||
if (live.IsEmpty()) {
|
||||
|
@ -169,8 +170,9 @@ void nsAccUtils::SetLiveContainerAttributes(
|
|||
// container-busy attribute
|
||||
if (busy.IsEmpty() && HasDefinedARIAToken(ancestor, nsGkAtoms::aria_busy) &&
|
||||
ancestor->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_busy,
|
||||
busy))
|
||||
busy)) {
|
||||
SetAccAttr(aAttributes, nsGkAtoms::containerBusy, busy);
|
||||
}
|
||||
|
||||
if (ancestor == topEl) {
|
||||
break;
|
||||
|
|
|
@ -995,19 +995,22 @@ Accessible* nsAccessibilityService::CreateAccessible(nsINode* aNode,
|
|||
// create,
|
||||
const HTMLMarkupMapInfo* markupMap =
|
||||
mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom());
|
||||
if (markupMap && markupMap->new_func)
|
||||
if (markupMap && markupMap->new_func) {
|
||||
newAcc = markupMap->new_func(content->AsElement(), aContext);
|
||||
}
|
||||
|
||||
if (!newAcc) // try by frame accessible type.
|
||||
if (!newAcc) { // try by frame accessible type.
|
||||
newAcc = CreateAccessibleByFrameType(frame, content, aContext);
|
||||
}
|
||||
}
|
||||
|
||||
// In case of ARIA grid or table use table-specific classes if it's not
|
||||
// native table based.
|
||||
if (isARIATablePart && (!newAcc || newAcc->IsGenericHyperText())) {
|
||||
if ((roleMapEntry->accTypes & eTableCell)) {
|
||||
if (aContext->IsTableRow())
|
||||
if (aContext->IsTableRow()) {
|
||||
newAcc = new ARIAGridCellAccessibleWrap(content, document);
|
||||
}
|
||||
|
||||
} else if (roleMapEntry->IsOfType(eTableRow)) {
|
||||
if (aContext->IsTable() ||
|
||||
|
@ -1025,8 +1028,9 @@ Accessible* nsAccessibilityService::CreateAccessible(nsINode* aNode,
|
|||
if (!roleMapEntry && newAcc && aContext->HasStrongARIARole()) {
|
||||
if (frame->AccessibleType() == eHTMLTableRowType) {
|
||||
const nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
|
||||
if (!contextRoleMap->IsOfType(eTable))
|
||||
if (!contextRoleMap->IsOfType(eTable)) {
|
||||
roleMapEntry = &aria::gEmptyRoleMap;
|
||||
}
|
||||
|
||||
} else if (frame->AccessibleType() == eHTMLTableCellType &&
|
||||
aContext->ARIARoleMap() == &aria::gEmptyRoleMap) {
|
||||
|
@ -1036,8 +1040,9 @@ Accessible* nsAccessibilityService::CreateAccessible(nsINode* aNode,
|
|||
nsGkAtoms::dd) ||
|
||||
frame->AccessibleType() == eHTMLLiType) {
|
||||
const nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
|
||||
if (!contextRoleMap->IsOfType(eList))
|
||||
if (!contextRoleMap->IsOfType(eList)) {
|
||||
roleMapEntry = &aria::gEmptyRoleMap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1095,8 +1100,9 @@ Accessible* nsAccessibilityService::CreateAccessible(nsINode* aNode,
|
|||
} else if (content->IsMathMLElement()) {
|
||||
const HTMLMarkupMapInfo* markupMap =
|
||||
mHTMLMarkupMap.Get(content->NodeInfo()->NameAtom());
|
||||
if (markupMap && markupMap->new_func)
|
||||
if (markupMap && markupMap->new_func) {
|
||||
newAcc = markupMap->new_func(content->AsElement(), aContext);
|
||||
}
|
||||
|
||||
// Fall back to text when encountering Content MathML.
|
||||
if (!newAcc && !content->IsAnyOfMathMLElements(
|
||||
|
@ -1165,12 +1171,14 @@ bool nsAccessibilityService::Init() {
|
|||
|
||||
eventListenerService->AddListenerChangeListener(this);
|
||||
|
||||
for (uint32_t i = 0; i < ArrayLength(sHTMLMarkupMapList); i++)
|
||||
for (uint32_t i = 0; i < ArrayLength(sHTMLMarkupMapList); i++) {
|
||||
mHTMLMarkupMap.Put(sHTMLMarkupMapList[i].tag, &sHTMLMarkupMapList[i]);
|
||||
}
|
||||
|
||||
#ifdef MOZ_XUL
|
||||
for (uint32_t i = 0; i < ArrayLength(sXULMarkupMapList); i++)
|
||||
for (uint32_t i = 0; i < ArrayLength(sXULMarkupMapList); i++) {
|
||||
mXULMarkupMap.Put(sXULMarkupMapList[i].tag, &sXULMarkupMapList[i]);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
|
@ -1326,10 +1334,11 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
|||
newAcc = new HTMLSpinnerAccessible(aContent, document);
|
||||
break;
|
||||
case eHTMLTableType:
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::table))
|
||||
if (aContent->IsHTMLElement(nsGkAtoms::table)) {
|
||||
newAcc = new HTMLTableAccessibleWrap(aContent, document);
|
||||
else
|
||||
} else {
|
||||
newAcc = new HyperTextAccessibleWrap(aContent, document);
|
||||
}
|
||||
break;
|
||||
case eHTMLTableCellType:
|
||||
// Accessible HTML table cell should be a child of accessible HTML table
|
||||
|
@ -1337,10 +1346,11 @@ nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
|
|||
// certain degree).
|
||||
// Otherwise create a generic text accessible to avoid text jamming
|
||||
// when reading by AT.
|
||||
if (aContext->IsHTMLTableRow() || aContext->IsHTMLTable())
|
||||
if (aContext->IsHTMLTableRow() || aContext->IsHTMLTable()) {
|
||||
newAcc = new HTMLTableCellAccessibleWrap(aContent, document);
|
||||
else
|
||||
} else {
|
||||
newAcc = new HyperTextAccessibleWrap(aContent, document);
|
||||
}
|
||||
break;
|
||||
|
||||
case eHTMLTableRowType: {
|
||||
|
@ -1435,8 +1445,9 @@ void nsAccessibilityService::MarkupAttributes(
|
|||
value);
|
||||
}
|
||||
|
||||
if (!value.IsEmpty())
|
||||
if (!value.IsEmpty()) {
|
||||
nsAccUtils::SetAccAttr(aAttributes, info->name, value);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -89,8 +89,9 @@ nsAccessiblePivot::SetPosition(nsIAccessible* aPosition) {
|
|||
|
||||
if (aPosition) {
|
||||
position = aPosition->ToInternalAccessible();
|
||||
if (!position || !IsDescendantOf(position, GetActiveRoot()))
|
||||
if (!position || !IsDescendantOf(position, GetActiveRoot())) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
// Swap old position with new position, saves us an AddRef/Release.
|
||||
|
@ -119,8 +120,9 @@ nsAccessiblePivot::SetModalRoot(nsIAccessible* aModalRoot) {
|
|||
|
||||
if (aModalRoot) {
|
||||
modalRoot = aModalRoot->ToInternalAccessible();
|
||||
if (!modalRoot || !IsDescendantOf(modalRoot, mRoot))
|
||||
if (!modalRoot || !IsDescendantOf(modalRoot, mRoot)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
}
|
||||
|
||||
mModalRoot = modalRoot;
|
||||
|
@ -165,12 +167,14 @@ nsAccessiblePivot::SetTextRange(nsIAccessibleText* aTextAccessible,
|
|||
NS_ENSURE_ARG(acc);
|
||||
|
||||
HyperTextAccessible* position = acc->AsHyperText();
|
||||
if (!position || !IsDescendantOf(position, GetActiveRoot()))
|
||||
if (!position || !IsDescendantOf(position, GetActiveRoot())) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
// Make sure the given offsets don't exceed the character count.
|
||||
if (aEndOffset > static_cast<int32_t>(position->CharacterCount()))
|
||||
if (aEndOffset > static_cast<int32_t>(position->CharacterCount())) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
|
||||
mStartOffset = aStartOffset;
|
||||
|
@ -199,8 +203,9 @@ nsAccessiblePivot::MoveNext(nsIAccessibleTraversalRule* aRule,
|
|||
if (aArgc > 0 && aAnchor) anchor = aAnchor->ToInternalAccessible();
|
||||
|
||||
if (anchor &&
|
||||
(anchor->IsDefunct() || !IsDescendantOf(anchor, GetActiveRoot())))
|
||||
(anchor->IsDefunct() || !IsDescendantOf(anchor, GetActiveRoot()))) {
|
||||
return NS_ERROR_NOT_IN_TREE;
|
||||
}
|
||||
|
||||
Pivot pivot(GetActiveRoot());
|
||||
RuleCache rule(aRule);
|
||||
|
@ -233,8 +238,9 @@ nsAccessiblePivot::MovePrevious(nsIAccessibleTraversalRule* aRule,
|
|||
if (aArgc > 0 && aAnchor) anchor = aAnchor->ToInternalAccessible();
|
||||
|
||||
if (anchor &&
|
||||
(anchor->IsDefunct() || !IsDescendantOf(anchor, GetActiveRoot())))
|
||||
(anchor->IsDefunct() || !IsDescendantOf(anchor, GetActiveRoot()))) {
|
||||
return NS_ERROR_NOT_IN_TREE;
|
||||
}
|
||||
|
||||
Pivot pivot(GetActiveRoot());
|
||||
RuleCache rule(aRule);
|
||||
|
@ -442,8 +448,9 @@ bool nsAccessiblePivot::NotifyOfPivotChange(Accessible* aOldPosition,
|
|||
int16_t aBoundaryType,
|
||||
bool aIsFromUserInput) {
|
||||
if (aOldPosition == mPosition && aOldStart == mStartOffset &&
|
||||
aOldEnd == mEndOffset)
|
||||
aOldEnd == mEndOffset) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAccessible> xpcOldPos = ToXPC(aOldPosition); // death grip
|
||||
for (nsIAccessiblePivotObserver* obs : mObservers.ForwardRange()) {
|
||||
|
@ -480,16 +487,19 @@ uint16_t RuleCache::Match(const AccessibleOrProxy& aAccOrProxy) {
|
|||
}
|
||||
|
||||
if ((nsIAccessibleTraversalRule::PREFILTER_INVISIBLE & mPreFilter) &&
|
||||
(state & states::INVISIBLE))
|
||||
(state & states::INVISIBLE)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((nsIAccessibleTraversalRule::PREFILTER_OFFSCREEN & mPreFilter) &&
|
||||
(state & states::OFFSCREEN))
|
||||
(state & states::OFFSCREEN)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((nsIAccessibleTraversalRule::PREFILTER_NOT_FOCUSABLE & mPreFilter) &&
|
||||
!(state & states::FOCUSABLE))
|
||||
!(state & states::FOCUSABLE)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (aAccOrProxy.IsAccessible() &&
|
||||
(nsIAccessibleTraversalRule::PREFILTER_TRANSPARENT & mPreFilter) &&
|
||||
|
|
|
@ -165,9 +165,10 @@ uint32_t nsCoreUtils::GetAccessKeyFor(nsIContent* aContent) {
|
|||
// Accesskeys are registered by @accesskey attribute only. At first check
|
||||
// whether it is presented on the given element to avoid the slow
|
||||
// EventStateManager::GetRegisteredAccessKey() method.
|
||||
if (!aContent->IsElement() ||
|
||||
!aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::accesskey))
|
||||
if (!aContent->IsElement() || !aContent->AsElement()->HasAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::accesskey)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
nsPresContext* presContext = aContent->OwnerDoc()->GetPresContext();
|
||||
if (!presContext) return 0;
|
||||
|
@ -329,8 +330,9 @@ nsIntPoint nsCoreUtils::GetScreenCoordsForWindow(nsINode* aNode) {
|
|||
if (!treeOwner) return coords;
|
||||
|
||||
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(treeOwner);
|
||||
if (baseWindow)
|
||||
if (baseWindow) {
|
||||
baseWindow->GetPosition(&coords.x, &coords.y); // in device pixels
|
||||
}
|
||||
|
||||
return coords;
|
||||
}
|
||||
|
@ -419,8 +421,9 @@ void nsCoreUtils::GetLanguageFor(nsIContent* aContent, nsIContent* aRootContent,
|
|||
while (walkUp && walkUp != aRootContent &&
|
||||
(!walkUp->IsElement() ||
|
||||
!walkUp->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::lang,
|
||||
aLanguage)))
|
||||
aLanguage))) {
|
||||
walkUp = walkUp->GetParent();
|
||||
}
|
||||
}
|
||||
|
||||
XULTreeElement* nsCoreUtils::GetTree(nsIContent* aContent) {
|
||||
|
|
|
@ -191,8 +191,9 @@ nsresult nsTextEquivUtils::AppendFromAccessible(Accessible* aAccessible,
|
|||
// If the name is from tooltip then append it to result string in the end
|
||||
// (see h. step of name computation guide).
|
||||
nsAutoString text;
|
||||
if (aAccessible->Name(text) != eNameFromTooltip)
|
||||
if (aAccessible->Name(text) != eNameFromTooltip) {
|
||||
isEmptyTextEquiv = !AppendString(aString, text);
|
||||
}
|
||||
|
||||
// Implementation of f. step.
|
||||
nsresult rv = AppendFromValue(aAccessible, aString);
|
||||
|
@ -223,8 +224,9 @@ nsresult nsTextEquivUtils::AppendFromAccessible(Accessible* aAccessible,
|
|||
|
||||
nsresult nsTextEquivUtils::AppendFromValue(Accessible* aAccessible,
|
||||
nsAString* aString) {
|
||||
if (GetRoleRule(aAccessible->Role()) != eNameFromValueRule)
|
||||
if (GetRoleRule(aAccessible->Role()) != eNameFromValueRule) {
|
||||
return NS_OK_NO_NAME_CLAUSE_HANDLED;
|
||||
}
|
||||
|
||||
// Implementation of step f. of text equivalent computation. If the given
|
||||
// accessible is not root accessible (the accessible the text equivalent is
|
||||
|
@ -298,13 +300,15 @@ bool nsTextEquivUtils::AppendString(nsAString* aString,
|
|||
if (aTextEquivalent.IsEmpty()) return false;
|
||||
|
||||
// Insert spaces to insure that words from controls aren't jammed together.
|
||||
if (!aString->IsEmpty() && !nsCoreUtils::IsWhitespace(aString->Last()))
|
||||
if (!aString->IsEmpty() && !nsCoreUtils::IsWhitespace(aString->Last())) {
|
||||
aString->Append(char16_t(' '));
|
||||
}
|
||||
|
||||
aString->Append(aTextEquivalent);
|
||||
|
||||
if (!nsCoreUtils::IsWhitespace(aString->Last()))
|
||||
if (!nsCoreUtils::IsWhitespace(aString->Last())) {
|
||||
aString->Append(char16_t(' '));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -179,11 +179,12 @@ uint32_t ARIAGridAccessible::SelectedColCount() {
|
|||
AccIterator cellIter(row, filters::GetCell);
|
||||
Accessible* cell = nullptr;
|
||||
for (uint32_t colIdx = 0; (cell = cellIter.Next()) && colIdx < colCount;
|
||||
colIdx++)
|
||||
colIdx++) {
|
||||
if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
|
||||
isColSelArray[colIdx] = false;
|
||||
selColCount--;
|
||||
}
|
||||
}
|
||||
} while ((row = rowIter.Next()));
|
||||
|
||||
return selColCount;
|
||||
|
@ -252,8 +253,9 @@ void ARIAGridAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells) {
|
|||
Accessible* row = nullptr;
|
||||
for (uint32_t rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
|
||||
if (nsAccUtils::IsARIASelected(row)) {
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++)
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
aCells->AppendElement(rowIdx * colCount + colIdx);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
@ -261,8 +263,9 @@ void ARIAGridAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells) {
|
|||
AccIterator cellIter(row, filters::GetCell);
|
||||
Accessible* cell = nullptr;
|
||||
for (uint32_t colIdx = 0; (cell = cellIter.Next()); colIdx++) {
|
||||
if (nsAccUtils::IsARIASelected(cell))
|
||||
if (nsAccUtils::IsARIASelected(cell)) {
|
||||
aCells->AppendElement(rowIdx * colCount + colIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,14 +290,16 @@ void ARIAGridAccessible::SelectedColIndices(nsTArray<uint32_t>* aCols) {
|
|||
AccIterator cellIter(row, filters::GetCell);
|
||||
Accessible* cell = nullptr;
|
||||
for (uint32_t colIdx = 0; (cell = cellIter.Next()) && colIdx < colCount;
|
||||
colIdx++)
|
||||
colIdx++) {
|
||||
if (isColSelArray[colIdx] && !nsAccUtils::IsARIASelected(cell)) {
|
||||
isColSelArray[colIdx] = false;
|
||||
}
|
||||
}
|
||||
} while ((row = rowIter.Next()));
|
||||
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++)
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
if (isColSelArray[colIdx]) aCols->AppendElement(colIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void ARIAGridAccessible::SelectedRowIndices(nsTArray<uint32_t>* aRows) {
|
||||
|
@ -384,12 +389,13 @@ nsresult ARIAGridAccessible::SetARIASelected(Accessible* aAccessible,
|
|||
|
||||
nsresult rv = NS_OK;
|
||||
if (content->IsElement()) {
|
||||
if (aIsSelected)
|
||||
if (aIsSelected) {
|
||||
rv = content->AsElement()->SetAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::aria_selected, u"true"_ns, aNotify);
|
||||
else
|
||||
} else {
|
||||
rv = content->AsElement()->SetAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::aria_selected, u"false"_ns, aNotify);
|
||||
}
|
||||
}
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -570,8 +576,9 @@ void ARIAGridCellAccessible::ApplyARIAState(uint64_t* aState) const {
|
|||
if (nsAccUtils::HasDefinedARIAToken(rowContent, nsGkAtoms::aria_selected) &&
|
||||
!rowContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_selected,
|
||||
nsGkAtoms::_false, eCaseMatters))
|
||||
nsGkAtoms::_false, eCaseMatters)) {
|
||||
*aState |= states::SELECTABLE | states::SELECTED;
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIPersistentProperties>
|
||||
|
@ -596,8 +603,9 @@ ARIAGridCellAccessible::NativeAttributes() {
|
|||
|
||||
roles::Role role = child->Role();
|
||||
if (role == roles::CELL || role == roles::GRID_CELL ||
|
||||
role == roles::ROWHEADER || role == roles::COLUMNHEADER)
|
||||
role == roles::ROWHEADER || role == roles::COLUMNHEADER) {
|
||||
colCount++;
|
||||
}
|
||||
}
|
||||
|
||||
nsAutoString stringIdx;
|
||||
|
|
|
@ -22,8 +22,9 @@ namespace a11y {
|
|||
|
||||
inline mozilla::a11y::role Accessible::Role() const {
|
||||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
if (!roleMapEntry || roleMapEntry->roleRule != kUseMapRole)
|
||||
if (!roleMapEntry || roleMapEntry->roleRule != kUseMapRole) {
|
||||
return ARIATransformRole(NativeRole());
|
||||
}
|
||||
|
||||
return ARIATransformRole(roleMapEntry->role);
|
||||
}
|
||||
|
@ -48,8 +49,9 @@ inline const nsRoleMapEntry* Accessible::ARIARoleMap() const {
|
|||
|
||||
inline mozilla::a11y::role Accessible::ARIARole() {
|
||||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
if (!roleMapEntry || roleMapEntry->roleRule != kUseMapRole)
|
||||
if (!roleMapEntry || roleMapEntry->roleRule != kUseMapRole) {
|
||||
return mozilla::a11y::roles::NOTHING;
|
||||
}
|
||||
|
||||
return ARIATransformRole(roleMapEntry->role);
|
||||
}
|
||||
|
@ -80,8 +82,9 @@ inline bool Accessible::ARIAHasNumericValue() const {
|
|||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
if (!roleMapEntry || roleMapEntry->valueRule == eNoValue) return false;
|
||||
|
||||
if (roleMapEntry->valueRule == eHasValueMinMaxIfFocusable)
|
||||
if (roleMapEntry->valueRule == eHasValueMinMaxIfFocusable) {
|
||||
return InteractiveState() & states::FOCUSABLE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -320,8 +320,9 @@ uint64_t Accessible::VisibilityState() const {
|
|||
nsIFrame* curFrame = frame;
|
||||
do {
|
||||
nsView* view = curFrame->GetView();
|
||||
if (view && view->GetVisibility() == nsViewVisibility_kHide)
|
||||
if (view && view->GetVisibility() == nsViewVisibility_kHide) {
|
||||
return states::INVISIBLE;
|
||||
}
|
||||
|
||||
if (nsLayoutUtils::IsPopup(curFrame)) return 0;
|
||||
|
||||
|
@ -330,8 +331,9 @@ uint64_t Accessible::VisibilityState() const {
|
|||
nsIFrame* parentFrame = curFrame->GetParent();
|
||||
nsDeckFrame* deckFrame = do_QueryFrame(parentFrame);
|
||||
if (deckFrame && deckFrame->GetSelectedBox() != curFrame) {
|
||||
if (deckFrame->GetContent()->IsXULElement(nsGkAtoms::tabpanels))
|
||||
if (deckFrame->GetContent()->IsXULElement(nsGkAtoms::tabpanels)) {
|
||||
return states::OFFSCREEN;
|
||||
}
|
||||
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"Children of not selected deck panel are not accessible.");
|
||||
|
@ -395,8 +397,9 @@ uint64_t Accessible::NativeState() const {
|
|||
|
||||
if (elementState.HasState(NS_EVENT_STATE_INVALID)) state |= states::INVALID;
|
||||
|
||||
if (elementState.HasState(NS_EVENT_STATE_REQUIRED))
|
||||
if (elementState.HasState(NS_EVENT_STATE_REQUIRED)) {
|
||||
state |= states::REQUIRED;
|
||||
}
|
||||
|
||||
state |= NativeInteractiveState();
|
||||
if (FocusMgr()->IsFocused(this)) state |= states::FOCUSED;
|
||||
|
@ -415,24 +418,27 @@ uint64_t Accessible::NativeState() const {
|
|||
const nsStyleXUL* xulStyle = frame->StyleXUL();
|
||||
if (xulStyle && frame->IsXULBoxFrame()) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
if (xulStyle->mBoxOrient == StyleBoxOrient::Vertical)
|
||||
if (xulStyle->mBoxOrient == StyleBoxOrient::Vertical) {
|
||||
state |= states::VERTICAL;
|
||||
else
|
||||
} else {
|
||||
state |= states::HORIZONTAL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if a XUL element has the popup attribute (an attached popup menu).
|
||||
if (HasOwnContent() && mContent->IsXULElement() &&
|
||||
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup)) {
|
||||
state |= states::HASPOPUP;
|
||||
}
|
||||
|
||||
// Bypass the link states specialization for non links.
|
||||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
if (!roleMapEntry || roleMapEntry->roleRule == kUseNativeRole ||
|
||||
roleMapEntry->role == roles::LINK)
|
||||
roleMapEntry->role == roles::LINK) {
|
||||
state |= NativeLinkState();
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -475,8 +481,9 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||
nsIntRect rect = Bounds();
|
||||
if (rect.Contains(aX, aY)) fallbackAnswer = this;
|
||||
|
||||
if (nsAccUtils::MustPrune(this)) // Do not dig any further
|
||||
if (nsAccUtils::MustPrune(this)) { // Do not dig any further
|
||||
return fallbackAnswer;
|
||||
}
|
||||
|
||||
// Search an accessible at the given point starting from accessible document
|
||||
// because containing block (see CSS2) for out of flow element (for example,
|
||||
|
@ -513,8 +520,9 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||
Accessible* popupAcc =
|
||||
popupDoc->GetAccessibleOrContainer(popupFrame->GetContent());
|
||||
Accessible* popupChild = this;
|
||||
while (popupChild && !popupChild->IsDoc() && popupChild != popupAcc)
|
||||
while (popupChild && !popupChild->IsDoc() && popupChild != popupAcc) {
|
||||
popupChild = popupChild->LocalParent();
|
||||
}
|
||||
|
||||
if (popupChild == popupAcc) startFrame = popupFrame;
|
||||
}
|
||||
|
@ -528,8 +536,9 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||
RelativeTo{startFrame, ViewportType::Visual}, offset);
|
||||
|
||||
nsIContent* content = nullptr;
|
||||
if (!foundFrame || !(content = foundFrame->GetContent()))
|
||||
if (!foundFrame || !(content = foundFrame->GetContent())) {
|
||||
return fallbackAnswer;
|
||||
}
|
||||
|
||||
// Get accessible for the node with the point or the first accessible in
|
||||
// the DOM parent chain.
|
||||
|
@ -574,8 +583,9 @@ Accessible* Accessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||
nsIntRect childRect = child->Bounds();
|
||||
if (childRect.Contains(aX, aY) &&
|
||||
(child->State() & states::INVISIBLE) == 0) {
|
||||
if (aWhichChild == eDeepestChild)
|
||||
if (aWhichChild == eDeepestChild) {
|
||||
return child->ChildAtPoint(aX, aY, eDeepestChild);
|
||||
}
|
||||
|
||||
return child;
|
||||
}
|
||||
|
@ -802,8 +812,9 @@ nsresult Accessible::HandleAccEvent(AccEvent* aEvent) {
|
|||
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())
|
||||
if (!aEvent->GetAccessible()->IsApplication()) {
|
||||
ipcDoc->SendEvent(id, aEvent->GetEventType());
|
||||
}
|
||||
break;
|
||||
case nsIAccessibleEvent::EVENT_STATE_CHANGE: {
|
||||
AccStateChangeEvent* event = downcast_accEvent(aEvent);
|
||||
|
@ -940,8 +951,9 @@ already_AddRefed<nsIPersistentProperties> Accessible::Attributes() {
|
|||
nsAutoString unused;
|
||||
aria::AttrIterator attribIter(mContent);
|
||||
nsAutoString name, value;
|
||||
while (attribIter.Next(name, value))
|
||||
while (attribIter.Next(name, value)) {
|
||||
attributes->SetStringProperty(NS_ConvertUTF16toUTF8(name), value, unused);
|
||||
}
|
||||
|
||||
// If there is no aria-live attribute then expose default value of 'live'
|
||||
// object attribute used for ARIA role of this accessible.
|
||||
|
@ -955,8 +967,9 @@ already_AddRefed<nsIPersistentProperties> Accessible::Attributes() {
|
|||
nsAutoString live;
|
||||
nsAccUtils::GetAccAttr(attributes, nsGkAtoms::live, live);
|
||||
if (live.IsEmpty()) {
|
||||
if (nsAccUtils::GetLiveAttrValue(roleMapEntry->liveAttRule, live))
|
||||
if (nsAccUtils::GetLiveAttrValue(roleMapEntry->liveAttRule, live)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::live, live);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1021,14 +1034,16 @@ already_AddRefed<nsIPersistentProperties> Accessible::NativeAttributes() {
|
|||
if (!mContent->IsElement()) return attributes.forget();
|
||||
|
||||
nsAutoString id;
|
||||
if (nsCoreUtils::GetID(mContent, id))
|
||||
if (nsCoreUtils::GetID(mContent, id)) {
|
||||
attributes->SetStringProperty("id"_ns, id, unused);
|
||||
}
|
||||
|
||||
// Expose class because it may have useful microformat information.
|
||||
nsAutoString _class;
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::_class,
|
||||
_class))
|
||||
_class)) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::_class, _class);
|
||||
}
|
||||
|
||||
// Expose tag.
|
||||
nsAutoString tagName;
|
||||
|
@ -1159,8 +1174,9 @@ uint64_t Accessible::State() {
|
|||
Accessible* relTarget = nullptr;
|
||||
while ((relTarget = rel.Next())) {
|
||||
if (relTarget->Role() == roles::PROPERTYPAGE &&
|
||||
FocusMgr()->IsFocusWithin(relTarget))
|
||||
FocusMgr()->IsFocusWithin(relTarget)) {
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (state & states::FOCUSED) {
|
||||
|
@ -1194,8 +1210,9 @@ uint64_t Accessible::State() {
|
|||
if (widget && widget->CurrentItem() == this) state |= states::ACTIVE;
|
||||
}
|
||||
|
||||
if ((state & states::COLLAPSED) || (state & states::EXPANDED))
|
||||
if ((state & states::COLLAPSED) || (state & states::EXPANDED)) {
|
||||
state |= states::EXPANDABLE;
|
||||
}
|
||||
|
||||
// For some reasons DOM node may have not a frame. We tract such accessibles
|
||||
// as invisible.
|
||||
|
@ -1267,8 +1284,9 @@ void Accessible::ApplyARIAState(uint64_t* aState) const {
|
|||
// special case: A native button element whose role got transformed by ARIA to
|
||||
// a toggle button Also applies to togglable button menus, like in the Dev
|
||||
// Tools Web Console.
|
||||
if (IsButton() || IsMenuButton())
|
||||
if (IsButton() || IsMenuButton()) {
|
||||
aria::MapToState(aria::eARIAPressed, element, aState);
|
||||
}
|
||||
|
||||
if (!roleMapEntry) return;
|
||||
|
||||
|
@ -1276,8 +1294,9 @@ void Accessible::ApplyARIAState(uint64_t* aState) const {
|
|||
|
||||
if (aria::MapToState(roleMapEntry->attributeMap1, element, aState) &&
|
||||
aria::MapToState(roleMapEntry->attributeMap2, element, aState) &&
|
||||
aria::MapToState(roleMapEntry->attributeMap3, element, aState))
|
||||
aria::MapToState(roleMapEntry->attributeMap3, element, aState)) {
|
||||
aria::MapToState(roleMapEntry->attributeMap4, element, aState);
|
||||
}
|
||||
|
||||
// ARIA gridcell inherits readonly state from the grid until it's overridden.
|
||||
if ((roleMapEntry->Is(nsGkAtoms::gridcell) ||
|
||||
|
@ -1436,13 +1455,15 @@ role Accessible::ARIATransformRole(role aRole) const {
|
|||
// Listbox is owned by a combobox
|
||||
Relation rel = RelationByType(RelationType::NODE_CHILD_OF);
|
||||
Accessible* targetAcc = nullptr;
|
||||
while ((targetAcc = rel.Next()))
|
||||
while ((targetAcc = rel.Next())) {
|
||||
if (targetAcc->IsCombobox()) return roles::COMBOBOX_LIST;
|
||||
}
|
||||
}
|
||||
|
||||
} else if (aRole == roles::OPTION) {
|
||||
if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
|
||||
if (mParent && mParent->Role() == roles::COMBOBOX_LIST) {
|
||||
return roles::COMBOBOX_OPTION;
|
||||
}
|
||||
|
||||
} else if (aRole == roles::MENUITEM) {
|
||||
// Menuitem has a submenu.
|
||||
|
@ -1504,12 +1525,13 @@ void Accessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
|
||||
case eCheckUncheckAction: {
|
||||
uint64_t state = State();
|
||||
if (state & states::CHECKED)
|
||||
if (state & states::CHECKED) {
|
||||
aName.AssignLiteral("uncheck");
|
||||
else if (state & states::MIXED)
|
||||
} else if (state & states::MIXED) {
|
||||
aName.AssignLiteral("cycle");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("check");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1518,10 +1540,11 @@ void Accessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
return;
|
||||
|
||||
case eOpenCloseAction:
|
||||
if (State() & states::COLLAPSED)
|
||||
if (State() & states::COLLAPSED) {
|
||||
aName.AssignLiteral("open");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("close");
|
||||
}
|
||||
return;
|
||||
|
||||
case eSelectAction:
|
||||
|
@ -1537,10 +1560,11 @@ void Accessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
return;
|
||||
|
||||
case eExpandAction:
|
||||
if (State() & states::COLLAPSED)
|
||||
if (State() & states::COLLAPSED) {
|
||||
aName.AssignLiteral("expand");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("collapse");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1562,8 +1586,9 @@ nsIContent* Accessible::GetAtomicRegion() const {
|
|||
while (loopContent &&
|
||||
(!loopContent->IsElement() ||
|
||||
!loopContent->AsElement()->GetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_atomic, atomic)))
|
||||
nsGkAtoms::aria_atomic, atomic))) {
|
||||
loopContent = loopContent->GetParent();
|
||||
}
|
||||
|
||||
return atomic.EqualsLiteral("true") ? loopContent : nullptr;
|
||||
}
|
||||
|
@ -1590,8 +1615,9 @@ Relation Accessible::RelationByType(RelationType aType) const {
|
|||
case RelationType::LABEL_FOR: {
|
||||
Relation rel(new RelatedAccIterator(Document(), mContent,
|
||||
nsGkAtoms::aria_labelledby));
|
||||
if (mContent->IsXULElement(nsGkAtoms::label))
|
||||
if (mContent->IsXULElement(nsGkAtoms::label)) {
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::control));
|
||||
}
|
||||
|
||||
return rel;
|
||||
}
|
||||
|
@ -1599,8 +1625,9 @@ Relation Accessible::RelationByType(RelationType aType) const {
|
|||
case RelationType::DESCRIBED_BY: {
|
||||
Relation rel(
|
||||
new IDRefsIterator(mDoc, mContent, nsGkAtoms::aria_describedby));
|
||||
if (mContent->IsXULElement())
|
||||
if (mContent->IsXULElement()) {
|
||||
rel.AppendIter(new XULDescriptionIterator(Document(), mContent));
|
||||
}
|
||||
|
||||
return rel;
|
||||
}
|
||||
|
@ -1612,8 +1639,9 @@ Relation Accessible::RelationByType(RelationType aType) const {
|
|||
// This affectively adds an optional control attribute to xul:description,
|
||||
// which only affects accessibility, by allowing the description to be
|
||||
// tied to a control.
|
||||
if (mContent->IsXULElement(nsGkAtoms::description))
|
||||
if (mContent->IsXULElement(nsGkAtoms::description)) {
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::control));
|
||||
}
|
||||
|
||||
return rel;
|
||||
}
|
||||
|
@ -1653,8 +1681,9 @@ Relation Accessible::RelationByType(RelationType aType) const {
|
|||
nsView* view = frame->GetView();
|
||||
if (view) {
|
||||
nsIScrollableFrame* scrollFrame = do_QueryFrame(frame);
|
||||
if (scrollFrame || view->GetWidget() || !frame->GetParent())
|
||||
if (scrollFrame || view->GetWidget() || !frame->GetParent()) {
|
||||
rel.AppendTarget(LocalParent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1904,8 +1933,9 @@ void Accessible::ScrollToPoint(uint32_t aCoordinateType, int32_t aX,
|
|||
nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType, this);
|
||||
|
||||
nsIFrame* parentFrame = frame;
|
||||
while ((parentFrame = parentFrame->GetParent()))
|
||||
while ((parentFrame = parentFrame->GetParent())) {
|
||||
nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords);
|
||||
}
|
||||
}
|
||||
|
||||
void Accessible::AppendTextTo(nsAString& aText, uint32_t aStartOffset,
|
||||
|
@ -1955,8 +1985,9 @@ void Accessible::Shutdown() {
|
|||
|
||||
mContent = nullptr;
|
||||
mDoc = nullptr;
|
||||
if (SelectionMgr() && SelectionMgr()->AccessibleWithCaret(nullptr) == this)
|
||||
if (SelectionMgr() && SelectionMgr()->AccessibleWithCaret(nullptr) == this) {
|
||||
SelectionMgr()->ResetCaretOffset();
|
||||
}
|
||||
}
|
||||
|
||||
// Accessible protected
|
||||
|
@ -2279,8 +2310,9 @@ int32_t Accessible::IndexInParent() const { return mIndexInParent; }
|
|||
|
||||
uint32_t Accessible::EmbeddedChildCount() {
|
||||
if (mStateFlags & eHasTextKids) {
|
||||
if (!mEmbeddedObjCollector)
|
||||
if (!mEmbeddedObjCollector) {
|
||||
mEmbeddedObjCollector.reset(new EmbeddedObjCollector(this));
|
||||
}
|
||||
return mEmbeddedObjCollector->Count();
|
||||
}
|
||||
|
||||
|
@ -2289,8 +2321,9 @@ uint32_t Accessible::EmbeddedChildCount() {
|
|||
|
||||
Accessible* Accessible::GetEmbeddedChildAt(uint32_t aIndex) {
|
||||
if (mStateFlags & eHasTextKids) {
|
||||
if (!mEmbeddedObjCollector)
|
||||
if (!mEmbeddedObjCollector) {
|
||||
mEmbeddedObjCollector.reset(new EmbeddedObjCollector(this));
|
||||
}
|
||||
return mEmbeddedObjCollector.get()
|
||||
? mEmbeddedObjCollector->GetAccessibleAt(aIndex)
|
||||
: nullptr;
|
||||
|
@ -2301,8 +2334,9 @@ Accessible* Accessible::GetEmbeddedChildAt(uint32_t aIndex) {
|
|||
|
||||
int32_t Accessible::GetIndexOfEmbeddedChild(Accessible* aChild) {
|
||||
if (mStateFlags & eHasTextKids) {
|
||||
if (!mEmbeddedObjCollector)
|
||||
if (!mEmbeddedObjCollector) {
|
||||
mEmbeddedObjCollector.reset(new EmbeddedObjCollector(this));
|
||||
}
|
||||
return mEmbeddedObjCollector.get()
|
||||
? mEmbeddedObjCollector->GetIndexAt(aChild)
|
||||
: -1;
|
||||
|
@ -2470,8 +2504,9 @@ bool Accessible::IsActiveWidget() const {
|
|||
uint32_t childCount = ChildCount();
|
||||
for (uint32_t idx = 0; idx < childCount; idx++) {
|
||||
Accessible* child = mChildren.ElementAt(idx);
|
||||
if (child->Role() == roles::ENTRY)
|
||||
if (child->Role() == roles::ENTRY) {
|
||||
return FocusMgr()->HasDOMFocus(child->GetContent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2577,13 +2612,15 @@ Accessible* Accessible::GetSiblingAtOffset(int32_t aOffset,
|
|||
|
||||
double Accessible::AttrNumericValue(nsAtom* aAttr) const {
|
||||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
if (!roleMapEntry || roleMapEntry->valueRule == eNoValue)
|
||||
if (!roleMapEntry || roleMapEntry->valueRule == eNoValue) {
|
||||
return UnspecifiedNaN<double>();
|
||||
}
|
||||
|
||||
nsAutoString attrValue;
|
||||
if (!mContent->IsElement() ||
|
||||
!mContent->AsElement()->GetAttr(kNameSpaceID_None, aAttr, attrValue))
|
||||
!mContent->AsElement()->GetAttr(kNameSpaceID_None, aAttr, attrValue)) {
|
||||
return UnspecifiedNaN<double>();
|
||||
}
|
||||
|
||||
nsresult error = NS_OK;
|
||||
double value = attrValue.ToDouble(&error);
|
||||
|
@ -2591,13 +2628,16 @@ double Accessible::AttrNumericValue(nsAtom* aAttr) const {
|
|||
}
|
||||
|
||||
uint32_t Accessible::GetActionRule() const {
|
||||
if (!HasOwnContent() || (InteractiveState() & states::UNAVAILABLE))
|
||||
if (!HasOwnContent() || (InteractiveState() & states::UNAVAILABLE)) {
|
||||
return eNoAction;
|
||||
}
|
||||
|
||||
// Return "click" action on elements that have an attached popup menu.
|
||||
if (mContent->IsXULElement())
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup))
|
||||
if (mContent->IsXULElement()) {
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::popup)) {
|
||||
return eClickAction;
|
||||
}
|
||||
}
|
||||
|
||||
// Has registered 'click' event handler.
|
||||
bool isOnclick = nsCoreUtils::HasClickListener(mContent);
|
||||
|
@ -2606,12 +2646,14 @@ uint32_t Accessible::GetActionRule() const {
|
|||
|
||||
// Get an action based on ARIA role.
|
||||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
if (roleMapEntry && roleMapEntry->actionRule != eNoAction)
|
||||
if (roleMapEntry && roleMapEntry->actionRule != eNoAction) {
|
||||
return roleMapEntry->actionRule;
|
||||
}
|
||||
|
||||
// Get an action based on ARIA attribute.
|
||||
if (nsAccUtils::HasDefinedARIAToken(mContent, nsGkAtoms::aria_expanded))
|
||||
if (nsAccUtils::HasDefinedARIAToken(mContent, nsGkAtoms::aria_expanded)) {
|
||||
return eExpandAction;
|
||||
}
|
||||
|
||||
return eNoAction;
|
||||
}
|
||||
|
@ -2684,10 +2726,11 @@ int32_t Accessible::GetLevelInternal() {
|
|||
while ((parent = parent->LocalParent())) {
|
||||
roles::Role parentRole = parent->Role();
|
||||
|
||||
if (parentRole == roles::LISTITEM)
|
||||
if (parentRole == roles::LISTITEM) {
|
||||
++level;
|
||||
else if (parentRole != roles::LIST && parentRole != roles::GROUPING)
|
||||
} else if (parentRole != roles::LIST && parentRole != roles::GROUPING) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (level == 0) {
|
||||
|
@ -2701,8 +2744,10 @@ int32_t Accessible::GetLevelInternal() {
|
|||
Accessible* siblingChild = sibling->LocalLastChild();
|
||||
if (siblingChild) {
|
||||
roles::Role lastChildRole = siblingChild->Role();
|
||||
if (lastChildRole == roles::LIST || lastChildRole == roles::GROUPING)
|
||||
if (lastChildRole == roles::LIST ||
|
||||
lastChildRole == roles::GROUPING) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -2761,10 +2806,11 @@ void KeyBinding::ToPlatformFormat(nsAString& aValue) const {
|
|||
nsCOMPtr<nsIStringBundle> keyStringBundle;
|
||||
nsCOMPtr<nsIStringBundleService> stringBundleService =
|
||||
mozilla::components::StringBundle::Service();
|
||||
if (stringBundleService)
|
||||
if (stringBundleService) {
|
||||
stringBundleService->CreateBundle(
|
||||
"chrome://global-platform/locale/platformKeys.properties",
|
||||
getter_AddRefs(keyStringBundle));
|
||||
}
|
||||
|
||||
if (!keyStringBundle) return;
|
||||
|
||||
|
|
|
@ -919,10 +919,11 @@ class Accessible : public nsISupports {
|
|||
*/
|
||||
bool IsRelocated() const { return mStateFlags & eRelocated; }
|
||||
void SetRelocated(bool aRelocated) {
|
||||
if (aRelocated)
|
||||
if (aRelocated) {
|
||||
mStateFlags |= eRelocated;
|
||||
else
|
||||
} else {
|
||||
mStateFlags &= ~eRelocated;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1255,10 +1256,11 @@ class KeyBinding {
|
|||
inline void AppendToString(nsAString& aValue,
|
||||
Format aFormat = ePlatformFormat) const {
|
||||
if (mKey) {
|
||||
if (aFormat == ePlatformFormat)
|
||||
if (aFormat == ePlatformFormat) {
|
||||
ToPlatformFormat(aValue);
|
||||
else
|
||||
} else {
|
||||
ToAtkFormat(aValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,9 @@ inline void DocAccessible::UpdateText(nsIContent* aTextNode) {
|
|||
NS_ASSERTION(mNotificationController, "The document was shut down!");
|
||||
|
||||
// Ignore the notification if initial tree construction hasn't been done yet.
|
||||
if (mNotificationController && HasLoadState(eTreeConstructed))
|
||||
if (mNotificationController && HasLoadState(eTreeConstructed)) {
|
||||
mNotificationController->ScheduleTextUpdate(aTextNode);
|
||||
}
|
||||
}
|
||||
|
||||
inline void DocAccessible::NotifyOfLoad(uint32_t aLoadEventType) {
|
||||
|
|
|
@ -196,8 +196,9 @@ role DocAccessible::NativeRole() const {
|
|||
int32_t itemType = docShell->ItemType();
|
||||
if (sameTypeRoot == docShell) {
|
||||
// Root of content or chrome tree
|
||||
if (itemType == nsIDocShellTreeItem::typeChrome)
|
||||
if (itemType == nsIDocShellTreeItem::typeChrome) {
|
||||
return roles::CHROME_WINDOW;
|
||||
}
|
||||
|
||||
if (itemType == nsIDocShellTreeItem::typeContent) {
|
||||
return roles::DOCUMENT;
|
||||
|
@ -273,8 +274,9 @@ already_AddRefed<nsIPersistentProperties> DocAccessible::Attributes() {
|
|||
// Override ARIA object attributes from outerdoc.
|
||||
aria::AttrIterator attribIter(mParent->GetContent());
|
||||
nsAutoString name, value, unused;
|
||||
while (attribIter.Next(name, value))
|
||||
while (attribIter.Next(name, value)) {
|
||||
attributes->SetStringProperty(NS_ConvertUTF16toUTF8(name), value, unused);
|
||||
}
|
||||
|
||||
return attributes.forget();
|
||||
}
|
||||
|
@ -299,8 +301,9 @@ already_AddRefed<TextEditor> DocAccessible::GetEditor() const {
|
|||
// Check if document is editable (designMode="on" case). Otherwise check if
|
||||
// the html:body (for HTML document case) or document element is editable.
|
||||
if (!mDocumentNode->HasFlag(NODE_IS_EDITABLE) &&
|
||||
(!mContent || !mContent->HasFlag(NODE_IS_EDITABLE)))
|
||||
(!mContent || !mContent->HasFlag(NODE_IS_EDITABLE))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShell> docShell = mDocumentNode->GetDocShell();
|
||||
if (!docShell) {
|
||||
|
@ -358,8 +361,9 @@ void DocAccessible::DocType(nsAString& aType) const {
|
|||
|
||||
void DocAccessible::Init() {
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocCreate))
|
||||
if (logging::IsEnabled(logging::eDocCreate)) {
|
||||
logging::DocCreate("document initialize", mDocumentNode, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Initialize notification controller.
|
||||
|
@ -368,8 +372,10 @@ void DocAccessible::Init() {
|
|||
// Mark the document accessible as loaded if its DOM document was loaded at
|
||||
// this point (this can happen because a11y is started late or DOM document
|
||||
// having no container was loaded.
|
||||
if (mDocumentNode->GetReadyStateEnum() == dom::Document::READYSTATE_COMPLETE)
|
||||
if (mDocumentNode->GetReadyStateEnum() ==
|
||||
dom::Document::READYSTATE_COMPLETE) {
|
||||
mLoadState |= eDOMLoaded;
|
||||
}
|
||||
|
||||
AddEventListeners();
|
||||
}
|
||||
|
@ -380,8 +386,9 @@ void DocAccessible::Shutdown() {
|
|||
}
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocDestroy))
|
||||
if (logging::IsEnabled(logging::eDocDestroy)) {
|
||||
logging::DocDestroy("document shutdown", mDocumentNode, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Mark the document as shutdown before AT is notified about the document
|
||||
|
@ -413,8 +420,9 @@ void DocAccessible::Shutdown() {
|
|||
// Walk the array backwards because child documents remove themselves from the
|
||||
// array as they are shutdown.
|
||||
int32_t childDocCount = mChildDocuments.Length();
|
||||
for (int32_t idx = childDocCount - 1; idx >= 0; idx--)
|
||||
for (int32_t idx = childDocCount - 1; idx >= 0; idx--) {
|
||||
mChildDocuments[idx]->Shutdown();
|
||||
}
|
||||
|
||||
mChildDocuments.Clear();
|
||||
|
||||
|
@ -519,8 +527,9 @@ nsresult DocAccessible::AddEventListeners() {
|
|||
// an editor.
|
||||
if (docShell->ItemType() == nsIDocShellTreeItem::typeContent) {
|
||||
RefPtr<nsCommandManager> commandManager = docShell->GetCommandManager();
|
||||
if (commandManager)
|
||||
if (commandManager) {
|
||||
commandManager->AddCommandObserver(this, "obs_documentCreated");
|
||||
}
|
||||
}
|
||||
|
||||
SelectionMgr()->AddDocSelectionListener(mPresShell);
|
||||
|
@ -672,8 +681,9 @@ void DocAccessible::AttributeWillChange(dom::Element* aElement,
|
|||
// Update dependent IDs cache. Take care of elements that are accessible
|
||||
// because dependent IDs cache doesn't contain IDs from non accessible
|
||||
// elements.
|
||||
if (aModType != dom::MutationEvent_Binding::ADDITION)
|
||||
if (aModType != dom::MutationEvent_Binding::ADDITION) {
|
||||
RemoveDependentIDsFor(accessible, aAttribute);
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::id) {
|
||||
RelocateARIAOwnedIfNeeded(aElement);
|
||||
|
@ -923,9 +933,10 @@ void DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_describedby))
|
||||
if (!elm->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_describedby)) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_DESCRIPTION_CHANGE,
|
||||
aAccessible);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -999,8 +1010,9 @@ void DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
|||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::value) {
|
||||
if (aAccessible->IsProgress())
|
||||
if (aAccessible->IsProgress()) {
|
||||
FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1146,9 +1158,10 @@ void DocAccessible::ARIAActiveDescendantChanged(Accessible* aAccessible) {
|
|||
if (activeDescendant) {
|
||||
FocusMgr()->ActiveItemChanged(activeDescendant, false);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("ARIA activedescedant changed",
|
||||
activeDescendant);
|
||||
}
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
@ -1244,8 +1257,9 @@ void DocAccessible::ParentChainChanged(nsIContent* aContent) {}
|
|||
|
||||
#ifdef A11Y_LOG
|
||||
nsresult DocAccessible::HandleAccEvent(AccEvent* aEvent) {
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
if (logging::IsEnabled(logging::eDocLoad)) {
|
||||
logging::DocLoadEventHandled(aEvent);
|
||||
}
|
||||
|
||||
return HyperTextAccessible::HandleAccEvent(aEvent);
|
||||
}
|
||||
|
@ -1377,8 +1391,9 @@ Accessible* DocAccessible::GetAccessibleOrDescendant(nsINode* aNode) const {
|
|||
void DocAccessible::BindToDocument(Accessible* aAccessible,
|
||||
const nsRoleMapEntry* aRoleMapEntry) {
|
||||
// Put into DOM node cache.
|
||||
if (aAccessible->IsNodeMapEntry())
|
||||
if (aAccessible->IsNodeMapEntry()) {
|
||||
mNodeToAccessibleMap.Put(aAccessible->GetNode(), aAccessible);
|
||||
}
|
||||
|
||||
// Put into unique ID cache.
|
||||
mAccessibleCache.Put(aAccessible->UniqueID(), RefPtr{aAccessible});
|
||||
|
@ -1405,15 +1420,17 @@ void DocAccessible::UnbindFromDocument(Accessible* aAccessible) {
|
|||
if (FocusMgr()->WasLastFocused(aAccessible)) {
|
||||
FocusMgr()->ActiveItemChanged(nullptr);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("tree shutdown", aAccessible);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// Remove an accessible from node-to-accessible map if it exists there.
|
||||
if (aAccessible->IsNodeMapEntry() &&
|
||||
mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible)
|
||||
mNodeToAccessibleMap.Get(aAccessible->GetNode()) == aAccessible) {
|
||||
mNodeToAccessibleMap.Remove(aAccessible->GetNode());
|
||||
}
|
||||
|
||||
aAccessible->mStateFlags |= eIsNotInDocument;
|
||||
|
||||
|
@ -1652,8 +1669,9 @@ void DocAccessible::ProcessInvalidationList() {
|
|||
|
||||
Accessible* DocAccessible::GetAccessibleEvenIfNotInMap(nsINode* aNode) const {
|
||||
if (!aNode->IsContent() ||
|
||||
!aNode->AsContent()->IsHTMLElement(nsGkAtoms::area))
|
||||
!aNode->AsContent()->IsHTMLElement(nsGkAtoms::area)) {
|
||||
return GetAccessible(aNode);
|
||||
}
|
||||
|
||||
// XXX Bug 135040, incorrect when multiple images use the same map.
|
||||
nsIFrame* frame = aNode->AsContent()->GetPrimaryFrame();
|
||||
|
@ -1781,8 +1799,9 @@ void DocAccessible::ProcessLoad() {
|
|||
mLoadState |= eCompletelyLoaded;
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDocLoad))
|
||||
if (logging::IsEnabled(logging::eDocLoad)) {
|
||||
logging::DocCompleteLoad(this, IsLoadEventTarget());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Do not fire document complete/stop events for root chrome document
|
||||
|
@ -1818,13 +1837,15 @@ void DocAccessible::AddDependentIDsFor(Accessible* aRelProvider,
|
|||
|
||||
if (relAttr == nsGkAtoms::_for) {
|
||||
if (!relProviderEl->IsAnyOfHTMLElements(nsGkAtoms::label,
|
||||
nsGkAtoms::output))
|
||||
nsGkAtoms::output)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
} else if (relAttr == nsGkAtoms::control) {
|
||||
if (!relProviderEl->IsAnyOfXULElements(nsGkAtoms::label,
|
||||
nsGkAtoms::description))
|
||||
nsGkAtoms::description)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
IDRefsIterator iter(this, relProviderEl, relAttr);
|
||||
|
@ -1835,8 +1856,9 @@ void DocAccessible::AddDependentIDsFor(Accessible* aRelProvider,
|
|||
nsIContent* dependentContent = iter.GetElem(id);
|
||||
if (!dependentContent ||
|
||||
(relAttr == nsGkAtoms::aria_owns &&
|
||||
!aRelProvider->IsAcceptableChild(dependentContent)))
|
||||
!aRelProvider->IsAcceptableChild(dependentContent))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
AttrRelProviders* providers =
|
||||
GetOrCreateRelProviders(dependentContent->AsElement(), id);
|
||||
|
@ -2554,8 +2576,9 @@ void DocAccessible::CacheChildrenInSubtree(Accessible* aRoot,
|
|||
// If the accessible is focused then report a focus event after all related
|
||||
// mutation events.
|
||||
if (aFocusedAcc && !*aFocusedAcc &&
|
||||
FocusMgr()->HasDOMFocus(aRoot->GetContent()))
|
||||
FocusMgr()->HasDOMFocus(aRoot->GetContent())) {
|
||||
*aFocusedAcc = aRoot;
|
||||
}
|
||||
|
||||
Accessible* root = aRoot->IsHTMLCombobox() ? aRoot->LocalFirstChild() : aRoot;
|
||||
if (root->KidsFromDOM()) {
|
||||
|
@ -2615,8 +2638,9 @@ void DocAccessible::UncacheChildrenInSubtree(Accessible* aRoot) {
|
|||
}
|
||||
|
||||
if (aRoot->IsNodeMapEntry() &&
|
||||
mNodeToAccessibleMap.Get(aRoot->GetNode()) == aRoot)
|
||||
mNodeToAccessibleMap.Get(aRoot->GetNode()) == aRoot) {
|
||||
mNodeToAccessibleMap.Remove(aRoot->GetNode());
|
||||
}
|
||||
}
|
||||
|
||||
void DocAccessible::ShutdownChildrenInSubtree(Accessible* aAccessible) {
|
||||
|
|
|
@ -109,8 +109,9 @@ inline void HyperTextAccessible::PasteText(int32_t aPosition) {
|
|||
}
|
||||
|
||||
inline index_t HyperTextAccessible::ConvertMagicOffset(int32_t aOffset) const {
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT)
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT) {
|
||||
return CharacterCount();
|
||||
}
|
||||
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) return CaretOffset();
|
||||
|
||||
|
|
|
@ -467,8 +467,9 @@ DOMPoint HyperTextAccessible::OffsetToDOMPoint(int32_t aOffset) const {
|
|||
nsIContent* content = child->GetContent();
|
||||
int32_t idx = 0;
|
||||
if (NS_FAILED(RenderedToContentOffset(content->GetPrimaryFrame(),
|
||||
innerOffset, &idx)))
|
||||
innerOffset, &idx))) {
|
||||
return DOMPoint();
|
||||
}
|
||||
|
||||
return DOMPoint(content, idx);
|
||||
}
|
||||
|
@ -720,8 +721,9 @@ uint32_t HyperTextAccessible::FindLineBoundary(
|
|||
case ePrevLineBegin: {
|
||||
// Fetch a previous line and move to its start (as arrow up and home keys
|
||||
// were pressed).
|
||||
if (IsEmptyLastLineOffset(aOffset))
|
||||
if (IsEmptyLastLineOffset(aOffset)) {
|
||||
return FindOffset(aOffset, eDirPrevious, eSelectBeginLine);
|
||||
}
|
||||
|
||||
uint32_t tmpOffset = FindOffset(aOffset, eDirPrevious, eSelectLine);
|
||||
return FindOffset(tmpOffset, eDirPrevious, eSelectBeginLine);
|
||||
|
@ -978,13 +980,15 @@ void HyperTextAccessible::TextBeforeOffset(int32_t aOffset,
|
|||
}
|
||||
|
||||
uint32_t adjustedOffset = convertedOffset;
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
|
||||
adjustedOffset = AdjustCaretOffset(adjustedOffset);
|
||||
}
|
||||
|
||||
switch (aBoundaryType) {
|
||||
case nsIAccessibleText::BOUNDARY_CHAR:
|
||||
if (convertedOffset != 0)
|
||||
if (convertedOffset != 0) {
|
||||
CharAt(convertedOffset - 1, aText, aStartOffset, aEndOffset);
|
||||
}
|
||||
break;
|
||||
|
||||
case nsIAccessibleText::BOUNDARY_WORD_START: {
|
||||
|
@ -1054,15 +1058,17 @@ void HyperTextAccessible::TextAtOffset(int32_t aOffset,
|
|||
// Return no char if caret is at the end of wrapped line (case of no line
|
||||
// end character). Returning a next line char is confusing for AT.
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET &&
|
||||
IsCaretAtEndOfLine())
|
||||
IsCaretAtEndOfLine()) {
|
||||
*aStartOffset = *aEndOffset = adjustedOffset;
|
||||
else
|
||||
} else {
|
||||
CharAt(adjustedOffset, aText, aStartOffset, aEndOffset);
|
||||
}
|
||||
break;
|
||||
|
||||
case nsIAccessibleText::BOUNDARY_WORD_START:
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
|
||||
adjustedOffset = AdjustCaretOffset(adjustedOffset);
|
||||
}
|
||||
|
||||
*aEndOffset = FindWordBoundary(adjustedOffset, eDirNext, eStartWord);
|
||||
*aStartOffset = FindWordBoundary(*aEndOffset, eDirPrevious, eStartWord);
|
||||
|
@ -1079,8 +1085,9 @@ void HyperTextAccessible::TextAtOffset(int32_t aOffset,
|
|||
break;
|
||||
|
||||
case nsIAccessibleText::BOUNDARY_LINE_START:
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
|
||||
adjustedOffset = AdjustCaretOffset(adjustedOffset);
|
||||
}
|
||||
|
||||
*aStartOffset = FindLineBoundary(adjustedOffset, eThisLineBegin);
|
||||
*aEndOffset = FindLineBoundary(adjustedOffset, eNextLineBegin);
|
||||
|
@ -1088,8 +1095,9 @@ void HyperTextAccessible::TextAtOffset(int32_t aOffset,
|
|||
break;
|
||||
|
||||
case nsIAccessibleText::BOUNDARY_LINE_END:
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
|
||||
adjustedOffset = AdjustCaretOffset(adjustedOffset);
|
||||
}
|
||||
|
||||
// In contrast to word end boundary we follow the spec here.
|
||||
*aStartOffset = FindLineBoundary(adjustedOffset, ePrevLineEnd);
|
||||
|
@ -1138,17 +1146,19 @@ void HyperTextAccessible::TextAfterOffset(int32_t aOffset,
|
|||
}
|
||||
|
||||
uint32_t adjustedOffset = convertedOffset;
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
|
||||
adjustedOffset = AdjustCaretOffset(adjustedOffset);
|
||||
}
|
||||
|
||||
switch (aBoundaryType) {
|
||||
case nsIAccessibleText::BOUNDARY_CHAR:
|
||||
// If caret is at the end of wrapped line (case of no line end character)
|
||||
// then char after the offset is a first char at next line.
|
||||
if (adjustedOffset >= CharacterCount())
|
||||
if (adjustedOffset >= CharacterCount()) {
|
||||
*aStartOffset = *aEndOffset = CharacterCount();
|
||||
else
|
||||
} else {
|
||||
CharAt(adjustedOffset + 1, aText, aStartOffset, aEndOffset);
|
||||
}
|
||||
break;
|
||||
|
||||
case nsIAccessibleText::BOUNDARY_WORD_START:
|
||||
|
@ -1461,8 +1471,9 @@ int32_t HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY,
|
|||
ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
|
||||
|
||||
nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits();
|
||||
if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y))
|
||||
if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y)) {
|
||||
return -1; // Not found
|
||||
}
|
||||
|
||||
nsPoint pointInHyperText(coordsInAppUnits.x - frameScreenRect.X(),
|
||||
coordsInAppUnits.y - frameScreenRect.Y());
|
||||
|
@ -1689,8 +1700,9 @@ int32_t HyperTextAccessible::CaretOffset() const {
|
|||
|
||||
nsINode* textNode = text->GetNode();
|
||||
// Ignore offset if cached accessible isn't a text leaf.
|
||||
if (nsCoreUtils::IsAncestorOf(GetNode(), textNode))
|
||||
if (nsCoreUtils::IsAncestorOf(GetNode(), textNode)) {
|
||||
return TransformOffset(text, textNode->IsText() ? caretOffset : 0, false);
|
||||
}
|
||||
}
|
||||
|
||||
// No caret if the focused node is not inside this DOM node and this DOM node
|
||||
|
@ -1715,8 +1727,9 @@ int32_t HyperTextAccessible::CaretOffset() const {
|
|||
|
||||
nsINode* thisNode = GetNode();
|
||||
if (resultNode != thisNode &&
|
||||
!nsCoreUtils::IsAncestorOf(thisNode, resultNode))
|
||||
!nsCoreUtils::IsAncestorOf(thisNode, resultNode)) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return DOMPointToOffset(focusNode, focusOffset);
|
||||
|
@ -1830,8 +1843,9 @@ void HyperTextAccessible::GetSelectionDOMRanges(SelectionType aSelectionType,
|
|||
// Ignore selection if it is not visible.
|
||||
RefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
if (!frameSelection || frameSelection->GetDisplaySelection() <=
|
||||
nsISelectionController::SELECTION_HIDDEN)
|
||||
nsISelectionController::SELECTION_HIDDEN) {
|
||||
return;
|
||||
}
|
||||
|
||||
dom::Selection* domSel = frameSelection->GetSelection(aSelectionType);
|
||||
if (!domSel) return;
|
||||
|
@ -1870,8 +1884,9 @@ bool HyperTextAccessible::SelectionBoundsAt(int32_t aSelectionNum,
|
|||
GetSelectionDOMRanges(SelectionType::eNormal, &ranges);
|
||||
|
||||
uint32_t rangeCount = ranges.Length();
|
||||
if (aSelectionNum < 0 || aSelectionNum >= static_cast<int32_t>(rangeCount))
|
||||
if (aSelectionNum < 0 || aSelectionNum >= static_cast<int32_t>(rangeCount)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsRange* range = ranges[aSelectionNum];
|
||||
|
||||
|
@ -1899,15 +1914,17 @@ bool HyperTextAccessible::SelectionBoundsAt(int32_t aSelectionNum,
|
|||
endOffset = tempOffset;
|
||||
}
|
||||
|
||||
if (!startNode->IsInclusiveDescendantOf(mContent))
|
||||
if (!startNode->IsInclusiveDescendantOf(mContent)) {
|
||||
*aStartOffset = 0;
|
||||
else
|
||||
} else {
|
||||
*aStartOffset = DOMPointToOffset(startNode, startOffset);
|
||||
}
|
||||
|
||||
if (!endNode->IsInclusiveDescendantOf(mContent))
|
||||
if (!endNode->IsInclusiveDescendantOf(mContent)) {
|
||||
*aEndOffset = CharacterCount();
|
||||
else
|
||||
} else {
|
||||
*aEndOffset = DOMPointToOffset(endNode, endOffset, true);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1931,8 +1948,9 @@ bool HyperTextAccessible::RemoveFromSelection(int32_t aSelectionNum) {
|
|||
if (!domSel) return false;
|
||||
|
||||
if (aSelectionNum < 0 ||
|
||||
aSelectionNum >= static_cast<int32_t>(domSel->RangeCount()))
|
||||
aSelectionNum >= static_cast<int32_t>(domSel->RangeCount())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const RefPtr<nsRange> range{domSel->GetRangeAt(aSelectionNum)};
|
||||
domSel->RemoveRangeAndUnselectFramesAndNotifyListeners(*range,
|
||||
|
@ -2091,8 +2109,9 @@ ENameValueFlag HyperTextAccessible::NativeName(nsString& aName) const {
|
|||
// a valid name from markup. Otherwise their name isn't picked up by recursive
|
||||
// name computation algorithm. See NS_OK_NAME_FROM_TOOLTIP.
|
||||
if (IsAbbreviation() && mContent->AsElement()->GetAttr(
|
||||
kNameSpaceID_None, nsGkAtoms::title, aName))
|
||||
kNameSpaceID_None, nsGkAtoms::title, aName)) {
|
||||
aName.CompressWhitespace();
|
||||
}
|
||||
|
||||
return hasImgAlt ? eNoNameOnPurpose : eNameOK;
|
||||
}
|
||||
|
@ -2391,8 +2410,9 @@ void HyperTextAccessible::GetSpellTextAttr(
|
|||
// The previous range might not be within this accessible. In that case,
|
||||
// DOMPointToOffset returns length as a fallback. We don't want to use
|
||||
// that offset if so, hence the startOffset < *aEndOffset check.
|
||||
if (startOffset > *aStartOffset && startOffset < *aEndOffset)
|
||||
if (startOffset > *aStartOffset && startOffset < *aEndOffset) {
|
||||
*aStartOffset = startOffset;
|
||||
}
|
||||
|
||||
if (endOffset < *aEndOffset) *aEndOffset = endOffset;
|
||||
|
||||
|
@ -2410,8 +2430,9 @@ void HyperTextAccessible::GetSpellTextAttr(
|
|||
// The previous range might not be within this accessible. In that case,
|
||||
// DOMPointToOffset returns length as a fallback. We don't want to use
|
||||
// that offset if so, hence the startOffset < *aEndOffset check.
|
||||
if (startOffset > *aStartOffset && startOffset < *aEndOffset)
|
||||
if (startOffset > *aStartOffset && startOffset < *aEndOffset) {
|
||||
*aStartOffset = startOffset;
|
||||
}
|
||||
}
|
||||
|
||||
bool HyperTextAccessible::IsTextRole() {
|
||||
|
@ -2420,8 +2441,9 @@ bool HyperTextAccessible::IsTextRole() {
|
|||
roleMapEntry->role == roles::IMAGE_MAP ||
|
||||
roleMapEntry->role == roles::SLIDER ||
|
||||
roleMapEntry->role == roles::PROGRESSBAR ||
|
||||
roleMapEntry->role == roles::SEPARATOR))
|
||||
roleMapEntry->role == roles::SEPARATOR)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,10 @@ uint64_t ImageAccessible::NativeState() const {
|
|||
nsCOMPtr<nsIImageLoadingContent> content(do_QueryInterface(mContent));
|
||||
nsCOMPtr<imgIRequest> imageRequest;
|
||||
|
||||
if (content)
|
||||
if (content) {
|
||||
content->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
|
||||
getter_AddRefs(imageRequest));
|
||||
}
|
||||
|
||||
if (imageRequest) {
|
||||
nsCOMPtr<imgIContainer> imgContainer;
|
||||
|
@ -106,10 +107,11 @@ uint8_t ImageAccessible::ActionCount() const {
|
|||
|
||||
void ImageAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
aName.Truncate();
|
||||
if (IsLongDescIndex(aIndex) && HasLongDesc())
|
||||
if (IsLongDescIndex(aIndex) && HasLongDesc()) {
|
||||
aName.AssignLiteral("showlongdesc");
|
||||
else
|
||||
} else {
|
||||
LinkableAccessible::ActionNameAt(aIndex, aName);
|
||||
}
|
||||
}
|
||||
|
||||
bool ImageAccessible::DoAction(uint8_t aIndex) const {
|
||||
|
|
|
@ -108,19 +108,22 @@ uint64_t RootAccessible::NativeState() const {
|
|||
|
||||
#ifdef MOZ_XUL
|
||||
uint32_t chromeFlags = GetChromeFlags();
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE)
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_WINDOW_RESIZE) {
|
||||
state |= states::SIZEABLE;
|
||||
}
|
||||
// If it has a titlebar it's movable
|
||||
// XXX unless it's minimized or maximized, but not sure
|
||||
// how to detect that
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR)
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_TITLEBAR) {
|
||||
state |= states::MOVEABLE;
|
||||
}
|
||||
if (chromeFlags & nsIWebBrowserChrome::CHROME_MODAL) state |= states::MODAL;
|
||||
#endif
|
||||
|
||||
nsFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm && fm->GetActiveWindow() == mDocumentNode->GetWindow())
|
||||
if (fm && fm->GetActiveWindow() == mDocumentNode->GetWindow()) {
|
||||
state |= states::ACTIVE;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -254,8 +257,9 @@ void RootAccessible::ProcessDOMEvent(Event* aDOMEvent, nsINode* aTarget) {
|
|||
aDOMEvent->GetType(eventType);
|
||||
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eDOMEvents))
|
||||
if (logging::IsEnabled(logging::eDOMEvents)) {
|
||||
logging::DOMEvent("processed", aTarget, eventType);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (eventType.EqualsLiteral("popuphiding")) {
|
||||
|
@ -308,8 +312,9 @@ void RootAccessible::ProcessDOMEvent(Event* aDOMEvent, nsINode* aTarget) {
|
|||
if (isEnabled) {
|
||||
FocusMgr()->ActiveItemChanged(accessible);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("RadioStateChange", accessible);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -394,8 +399,9 @@ void RootAccessible::ProcessDOMEvent(Event* aDOMEvent, nsINode* aTarget) {
|
|||
} else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
|
||||
FocusMgr()->ActiveItemChanged(accessible);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("DOMMenuItemActive", accessible);
|
||||
}
|
||||
#endif
|
||||
} else if (eventType.EqualsLiteral("DOMMenuItemInactive")) {
|
||||
// Process DOMMenuItemInactive event for autocomplete only because this is
|
||||
|
@ -407,8 +413,9 @@ void RootAccessible::ProcessDOMEvent(Event* aDOMEvent, nsINode* aTarget) {
|
|||
if (widget && widget->IsAutoCompletePopup()) {
|
||||
FocusMgr()->ActiveItemChanged(nullptr);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("DOMMenuItemInactive", accessible);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if (eventType.EqualsLiteral(
|
||||
|
@ -426,8 +433,9 @@ void RootAccessible::ProcessDOMEvent(Event* aDOMEvent, nsINode* aTarget) {
|
|||
if (activeItem) {
|
||||
FocusMgr()->ActiveItemChanged(activeItem);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("DOMMenuBarActive", accessible);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
} else if (eventType.EqualsLiteral(
|
||||
|
@ -437,8 +445,9 @@ void RootAccessible::ProcessDOMEvent(Event* aDOMEvent, nsINode* aTarget) {
|
|||
|
||||
FocusMgr()->ActiveItemChanged(nullptr);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("DOMMenuBarInactive", accessible);
|
||||
}
|
||||
#endif
|
||||
} else if (accessible->NeedsDOMUIEvent() &&
|
||||
eventType.EqualsLiteral("ValueChange")) {
|
||||
|
@ -623,8 +632,9 @@ void RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode) {
|
|||
if (notifyOf & kNotifyOfFocus) {
|
||||
FocusMgr()->ActiveItemChanged(nullptr);
|
||||
#ifdef A11Y_LOG
|
||||
if (logging::IsEnabled(logging::eFocus))
|
||||
if (logging::IsEnabled(logging::eFocus)) {
|
||||
logging::ActiveItemChangeCausedBy("popuphiding", popup);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,9 @@ void TableCellAccessible::RowHeaderCells(nsTArray<Accessible*>* aCells) {
|
|||
|
||||
// Avoid addding cells multiple times, if this cell spans more columns
|
||||
// we'll get it later.
|
||||
if (tableCell->ColIdx() == curColIdx && cell->Role() == roles::ROWHEADER)
|
||||
if (tableCell->ColIdx() == curColIdx && cell->Role() == roles::ROWHEADER) {
|
||||
aCells->AppendElement(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,8 +79,9 @@ bool HTMLLabelAccessible::DoAction(uint8_t aIndex) const {
|
|||
|
||||
Relation HTMLOutputAccessible::RelationByType(RelationType aType) const {
|
||||
Relation rel = AccessibleWrap::RelationByType(aType);
|
||||
if (aType == RelationType::CONTROLLED_BY)
|
||||
if (aType == RelationType::CONTROLLED_BY) {
|
||||
rel.AppendIter(new IDRefsIterator(mDoc, mContent, nsGkAtoms::_for));
|
||||
}
|
||||
|
||||
return rel;
|
||||
}
|
||||
|
|
|
@ -191,11 +191,14 @@ ENameValueFlag HTMLButtonAccessible::NativeName(nsString& aName) const {
|
|||
ENameValueFlag nameFlag = Accessible::NativeName(aName);
|
||||
if (!aName.IsEmpty() || !mContent->IsHTMLElement(nsGkAtoms::input) ||
|
||||
!mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::image, eCaseMatters))
|
||||
nsGkAtoms::image, eCaseMatters)) {
|
||||
return nameFlag;
|
||||
}
|
||||
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt,
|
||||
aName)) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
|
||||
}
|
||||
|
||||
aName.CompressWhitespace();
|
||||
return eNameOK;
|
||||
|
@ -287,8 +290,9 @@ ENameValueFlag HTMLTextFieldAccessible::NativeName(nsString& aName) const {
|
|||
|
||||
void HTMLTextFieldAccessible::Value(nsString& aValue) const {
|
||||
aValue.Truncate();
|
||||
if (NativeState() & states::PROTECTED) // Don't return password text!
|
||||
if (NativeState() & states::PROTECTED) { // Don't return password text!
|
||||
return;
|
||||
}
|
||||
|
||||
HTMLTextAreaElement* textArea = HTMLTextAreaElement::FromNode(mContent);
|
||||
if (textArea) {
|
||||
|
@ -311,8 +315,9 @@ void HTMLTextFieldAccessible::ApplyARIAState(uint64_t* aState) const {
|
|||
// If part of compound of XUL widget then pick up ARIA stuff from XUL widget
|
||||
// element.
|
||||
nsIContent* widgetElm = BindingOrWidgetParent();
|
||||
if (widgetElm)
|
||||
if (widgetElm) {
|
||||
aria::MapToState(aria::eARIAAutoComplete, widgetElm->AsElement(), aState);
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t HTMLTextFieldAccessible::NativeState() const {
|
||||
|
@ -338,8 +343,9 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
|
|||
: states::MULTI_LINE;
|
||||
|
||||
if (state & (states::PROTECTED | states::MULTI_LINE | states::READONLY |
|
||||
states::UNAVAILABLE))
|
||||
states::UNAVAILABLE)) {
|
||||
return state;
|
||||
}
|
||||
|
||||
// Expose autocomplete states if this input is part of autocomplete widget.
|
||||
Accessible* widget = ContainerWidget();
|
||||
|
@ -349,8 +355,9 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
|
|||
}
|
||||
|
||||
// Expose autocomplete state if it has associated autocomplete list.
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list_))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::list_)) {
|
||||
return state | states::SUPPORTS_AUTOCOMPLETION | states::HASPOPUP;
|
||||
}
|
||||
|
||||
// Ordinal XUL textboxes don't support autocomplete.
|
||||
if (!BindingOrWidgetParent() &&
|
||||
|
@ -371,8 +378,9 @@ uint64_t HTMLTextFieldAccessible::NativeState() const {
|
|||
autocomplete);
|
||||
}
|
||||
|
||||
if (!formElement || !autocomplete.LowerCaseEqualsLiteral("off"))
|
||||
if (!formElement || !autocomplete.LowerCaseEqualsLiteral("off")) {
|
||||
state |= states::SUPPORTS_AUTOCOMPLETION;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -606,8 +614,9 @@ ENameValueFlag HTMLGroupboxAccessible::NativeName(nsString& aName) const {
|
|||
if (!aName.IsEmpty()) return nameFlag;
|
||||
|
||||
nsIContent* legendContent = GetLegend();
|
||||
if (legendContent)
|
||||
if (legendContent) {
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(this, legendContent, &aName);
|
||||
}
|
||||
|
||||
aName.CompressWhitespace();
|
||||
return eNameOK;
|
||||
|
@ -634,8 +643,9 @@ Relation HTMLLegendAccessible::RelationByType(RelationType aType) const {
|
|||
if (aType != RelationType::LABEL_FOR) return rel;
|
||||
|
||||
Accessible* groupbox = LocalParent();
|
||||
if (groupbox && groupbox->Role() == roles::GROUPING)
|
||||
if (groupbox && groupbox->Role() == roles::GROUPING) {
|
||||
rel.AppendTarget(groupbox);
|
||||
}
|
||||
|
||||
return rel;
|
||||
}
|
||||
|
@ -653,8 +663,9 @@ ENameValueFlag HTMLFigureAccessible::NativeName(nsString& aName) const {
|
|||
if (!aName.IsEmpty()) return nameFlag;
|
||||
|
||||
nsIContent* captionContent = Caption();
|
||||
if (captionContent)
|
||||
if (captionContent) {
|
||||
nsTextEquivUtils::AppendTextEquivFromContent(this, captionContent, &aName);
|
||||
}
|
||||
|
||||
aName.CompressWhitespace();
|
||||
return eNameOK;
|
||||
|
|
|
@ -125,8 +125,10 @@ ENameValueFlag HTMLAreaAccessible::NativeName(nsString& aName) const {
|
|||
ENameValueFlag nameFlag = Accessible::NativeName(aName);
|
||||
if (!aName.IsEmpty()) return nameFlag;
|
||||
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt, aName))
|
||||
if (!mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::alt,
|
||||
aName)) {
|
||||
Value(aName);
|
||||
}
|
||||
|
||||
return eNameOK;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,9 @@ uint64_t HTMLLinkAccessible::NativeLinkState() const {
|
|||
EventStates eventState = mContent->AsElement()->State();
|
||||
if (eventState.HasState(NS_EVENT_STATE_UNVISITED)) return states::LINKED;
|
||||
|
||||
if (eventState.HasState(NS_EVENT_STATE_VISITED))
|
||||
if (eventState.HasState(NS_EVENT_STATE_VISITED)) {
|
||||
return states::LINKED | states::TRAVERSED;
|
||||
}
|
||||
|
||||
// This is a either named anchor (a link with also a name attribute) or
|
||||
// it doesn't have any attributes. Check if 'click' event handler is
|
||||
|
@ -55,8 +56,9 @@ uint64_t HTMLLinkAccessible::NativeInteractiveState() const {
|
|||
// This is how we indicate it is a named anchor. In other words, this anchor
|
||||
// can be selected as a location :) There is no other better state to use to
|
||||
// indicate this.
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::name))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::name)) {
|
||||
state |= states::SELECTABLE;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -65,8 +67,9 @@ void HTMLLinkAccessible::Value(nsString& aValue) const {
|
|||
aValue.Truncate();
|
||||
|
||||
HyperTextAccessible::Value(aValue);
|
||||
if (aValue.IsEmpty())
|
||||
if (aValue.IsEmpty()) {
|
||||
nsContentUtils::GetLinkLocation(mContent->AsElement(), aValue);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t HTMLLinkAccessible::ActionCount() const {
|
||||
|
|
|
@ -39,8 +39,9 @@ HTMLSelectListAccessible::HTMLSelectListAccessible(nsIContent* aContent,
|
|||
|
||||
uint64_t HTMLSelectListAccessible::NativeState() const {
|
||||
uint64_t state = AccessibleWrap::NativeState();
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple)) {
|
||||
state |= states::MULTISELECTABLE | states::EXTSELECTABLE;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -196,8 +197,9 @@ int32_t HTMLSelectOptionAccessible::GetLevelInternal() {
|
|||
int32_t level =
|
||||
parentContent->NodeInfo()->Equals(nsGkAtoms::optgroup) ? 2 : 1;
|
||||
|
||||
if (level == 1 && Role() != roles::HEADING)
|
||||
if (level == 1 && Role() != roles::HEADING) {
|
||||
level = 0; // In a single level list, the level is irrelevant
|
||||
}
|
||||
|
||||
return level;
|
||||
}
|
||||
|
@ -205,8 +207,9 @@ int32_t HTMLSelectOptionAccessible::GetLevelInternal() {
|
|||
nsRect HTMLSelectOptionAccessible::RelativeBounds(
|
||||
nsIFrame** aBoundingFrame) const {
|
||||
Accessible* combobox = GetCombobox();
|
||||
if (combobox && (combobox->State() & states::COLLAPSED))
|
||||
if (combobox && (combobox->State() & states::COLLAPSED)) {
|
||||
return combobox->RelativeBounds(aBoundingFrame);
|
||||
}
|
||||
|
||||
return HyperTextAccessibleWrap::RelativeBounds(aBoundingFrame);
|
||||
}
|
||||
|
@ -322,10 +325,11 @@ uint64_t HTMLComboboxAccessible::NativeState() const {
|
|||
uint64_t state = Accessible::NativeState();
|
||||
|
||||
nsComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
|
||||
if (comboFrame && comboFrame->IsDroppedDown())
|
||||
if (comboFrame && comboFrame->IsDroppedDown()) {
|
||||
state |= states::EXPANDED;
|
||||
else
|
||||
} else {
|
||||
state |= states::COLLAPSED;
|
||||
}
|
||||
|
||||
state |= states::HASPOPUP;
|
||||
return state;
|
||||
|
@ -364,10 +368,11 @@ void HTMLComboboxAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
nsComboboxControlFrame* comboFrame = do_QueryFrame(GetFrame());
|
||||
if (!comboFrame) return;
|
||||
|
||||
if (comboFrame->IsDroppedDown())
|
||||
if (comboFrame->IsDroppedDown()) {
|
||||
aName.AssignLiteral("close");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("open");
|
||||
}
|
||||
}
|
||||
|
||||
bool HTMLComboboxAccessible::IsAcceptableChild(nsIContent* aEl) const {
|
||||
|
@ -449,10 +454,11 @@ uint64_t HTMLComboboxListAccessible::NativeState() const {
|
|||
uint64_t state = Accessible::NativeState();
|
||||
|
||||
nsComboboxControlFrame* comboFrame = do_QueryFrame(mParent->GetFrame());
|
||||
if (comboFrame && comboFrame->IsDroppedDown())
|
||||
if (comboFrame && comboFrame->IsDroppedDown()) {
|
||||
state |= states::FLOATING;
|
||||
else
|
||||
} else {
|
||||
state |= states::INVISIBLE;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
|
|
@ -103,18 +103,21 @@ HTMLTableCellAccessible::NativeAttributes() {
|
|||
}
|
||||
}
|
||||
}
|
||||
if (abbrText.IsEmpty())
|
||||
if (abbrText.IsEmpty()) {
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::abbr,
|
||||
abbrText);
|
||||
}
|
||||
|
||||
if (!abbrText.IsEmpty())
|
||||
if (!abbrText.IsEmpty()) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::abbr, abbrText);
|
||||
}
|
||||
|
||||
// axis attribute
|
||||
nsAutoString axisText;
|
||||
mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::axis, axisText);
|
||||
if (!axisText.IsEmpty())
|
||||
if (!axisText.IsEmpty()) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::axis, axisText);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
nsAutoString unused;
|
||||
|
@ -194,8 +197,9 @@ void HTMLTableCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells) {
|
|||
// If referred table cell is at the same column then treat it as a column
|
||||
// header.
|
||||
TableCellAccessible* tableCell = cell->AsTableCell();
|
||||
if (tableCell && tableCell->ColIdx() == ColIdx())
|
||||
if (tableCell && tableCell->ColIdx() == ColIdx()) {
|
||||
aCells->AppendElement(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,8 +216,9 @@ void HTMLTableCellAccessible::RowHeaderCells(nsTArray<Accessible*>* aCells) {
|
|||
// If referred table cell is at the same row then treat it as a column
|
||||
// header.
|
||||
TableCellAccessible* tableCell = cell->AsTableCell();
|
||||
if (tableCell && tableCell->RowIdx() == RowIdx())
|
||||
if (tableCell && tableCell->RowIdx() == RowIdx()) {
|
||||
aCells->AppendElement(cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -284,15 +289,17 @@ role HTMLTableHeaderCellAccessible::NativeRole() const {
|
|||
// a row header for it.
|
||||
uint32_t rowIdx = RowIdx(), colIdx = ColIdx();
|
||||
Accessible* cell = table->CellAt(rowIdx, colIdx + ColExtent());
|
||||
if (cell && !nsCoreUtils::IsHTMLTableHeader(cell->GetContent()))
|
||||
if (cell && !nsCoreUtils::IsHTMLTableHeader(cell->GetContent())) {
|
||||
return roles::ROWHEADER;
|
||||
}
|
||||
|
||||
// If the cell below this one is not a header cell then assume this cell is
|
||||
// a column header for it.
|
||||
uint32_t rowExtent = RowExtent();
|
||||
cell = table->CellAt(rowIdx + rowExtent, colIdx);
|
||||
if (cell && !nsCoreUtils::IsHTMLTableHeader(cell->GetContent()))
|
||||
if (cell && !nsCoreUtils::IsHTMLTableHeader(cell->GetContent())) {
|
||||
return roles::COLUMNHEADER;
|
||||
}
|
||||
|
||||
// Otherwise if this cell is surrounded by header cells only then make a guess
|
||||
// based on its cell spanning. In other words if it is row spanned then assume
|
||||
|
@ -457,8 +464,9 @@ uint32_t HTMLTableAccessible::SelectedCellCount() {
|
|||
uint32_t HTMLTableAccessible::SelectedColCount() {
|
||||
uint32_t count = 0, colCount = ColCount();
|
||||
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++)
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
if (IsColSelected(colIdx)) count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -466,8 +474,9 @@ uint32_t HTMLTableAccessible::SelectedColCount() {
|
|||
uint32_t HTMLTableAccessible::SelectedRowCount() {
|
||||
uint32_t count = 0, rowCount = RowCount();
|
||||
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++)
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
if (IsRowSelected(rowIdx)) count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -504,22 +513,25 @@ void HTMLTableAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells) {
|
|||
|
||||
uint32_t startCol = cellFrame->ColIndex();
|
||||
uint32_t startRow = cellFrame->RowIndex();
|
||||
if (startRow == rowIdx && startCol == colIdx)
|
||||
if (startRow == rowIdx && startCol == colIdx) {
|
||||
aCells->AppendElement(CellIndexAt(rowIdx, colIdx));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLTableAccessible::SelectedColIndices(nsTArray<uint32_t>* aCols) {
|
||||
uint32_t colCount = ColCount();
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++)
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
if (IsColSelected(colIdx)) aCols->AppendElement(colIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void HTMLTableAccessible::SelectedRowIndices(nsTArray<uint32_t>* aRows) {
|
||||
uint32_t rowCount = RowCount();
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++)
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
if (IsRowSelected(rowIdx)) aRows->AppendElement(rowIdx);
|
||||
}
|
||||
}
|
||||
|
||||
Accessible* HTMLTableAccessible::CellAt(uint32_t aRowIdx, uint32_t aColIdx) {
|
||||
|
@ -703,10 +715,11 @@ nsresult HTMLTableAccessible::AddRowOrColumnToSelection(
|
|||
if (!tableFrame) return NS_OK;
|
||||
|
||||
uint32_t count = 0;
|
||||
if (doSelectRow)
|
||||
if (doSelectRow) {
|
||||
count = ColCount();
|
||||
else
|
||||
} else {
|
||||
count = RowCount();
|
||||
}
|
||||
|
||||
PresShell* presShell = mDoc->PresShellPtr();
|
||||
RefPtr<nsFrameSelection> tableSelection =
|
||||
|
@ -742,9 +755,10 @@ nsresult HTMLTableAccessible::RemoveRowsOrColumnsFromSelection(
|
|||
int32_t startColIdx = doUnselectRow ? 0 : aIndex;
|
||||
int32_t endColIdx = doUnselectRow ? count - 1 : aIndex;
|
||||
|
||||
if (aIsOuter)
|
||||
if (aIsOuter) {
|
||||
return tableSelection->RestrictCellsToSelection(
|
||||
mContent, startRowIdx, startColIdx, endRowIdx, endColIdx);
|
||||
}
|
||||
|
||||
return tableSelection->RemoveCellsFromSelection(
|
||||
mContent, startRowIdx, startColIdx, endRowIdx, endColIdx);
|
||||
|
|
|
@ -15,8 +15,9 @@ namespace a11y {
|
|||
/* static */
|
||||
uint32_t DocAccessibleChildBase::InterfacesFor(Accessible* aAcc) {
|
||||
uint32_t interfaces = 0;
|
||||
if (aAcc->IsHyperText() && aAcc->AsHyperText()->IsTextRole())
|
||||
if (aAcc->IsHyperText() && aAcc->AsHyperText()->IsTextRole()) {
|
||||
interfaces |= Interfaces::HYPERTEXT;
|
||||
}
|
||||
|
||||
if (aAcc->IsLink()) interfaces |= Interfaces::HYPERLINK;
|
||||
|
||||
|
|
|
@ -772,10 +772,11 @@ void DocAccessibleParent::Destroy() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (DocAccessibleParent* parentDoc = thisDoc->ParentDoc())
|
||||
if (DocAccessibleParent* parentDoc = thisDoc->ParentDoc()) {
|
||||
parentDoc->RemoveChildDoc(thisDoc);
|
||||
else if (IsTopLevel())
|
||||
} else if (IsTopLevel()) {
|
||||
GetAccService()->RemoteDocShutdown(this);
|
||||
}
|
||||
}
|
||||
|
||||
DocAccessibleParent* DocAccessibleParent::ParentDoc() const {
|
||||
|
|
|
@ -161,8 +161,9 @@ mozilla::ipc::IPCResult DocAccessibleChild::RecvRelationByType(
|
|||
|
||||
auto type = static_cast<RelationType>(aType);
|
||||
Relation rel = acc->RelationByType(type);
|
||||
while (Accessible* target = rel.Next())
|
||||
while (Accessible* target = rel.Next()) {
|
||||
aTargets->AppendElement(reinterpret_cast<uint64_t>(target->UniqueID()));
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
@ -171,8 +172,9 @@ static void AddRelation(Accessible* aAcc, RelationType aType,
|
|||
nsTArray<RelationTargets>* aTargets) {
|
||||
Relation rel = aAcc->RelationByType(aType);
|
||||
nsTArray<uint64_t> targets;
|
||||
while (Accessible* target = rel.Next())
|
||||
while (Accessible* target = rel.Next()) {
|
||||
targets.AppendElement(reinterpret_cast<uint64_t>(target->UniqueID()));
|
||||
}
|
||||
|
||||
if (!targets.IsEmpty()) {
|
||||
RelationTargets* newRelation = aTargets->AppendElement(
|
||||
|
|
|
@ -60,9 +60,11 @@ nsTArray<ProxyAccessible*> ProxyAccessible::RelationByType(
|
|||
|
||||
size_t targetCount = targetIDs.Length();
|
||||
nsTArray<ProxyAccessible*> targets(targetCount);
|
||||
for (size_t i = 0; i < targetCount; i++)
|
||||
if (ProxyAccessible* proxy = mDoc->GetAccessible(targetIDs[i]))
|
||||
for (size_t i = 0; i < targetCount; i++) {
|
||||
if (ProxyAccessible* proxy = mDoc->GetAccessible(targetIDs[i])) {
|
||||
targets.AppendElement(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
return targets;
|
||||
}
|
||||
|
@ -82,10 +84,12 @@ void ProxyAccessible::Relations(
|
|||
|
||||
size_t targetCount = ipcRelations[i].Targets().Length();
|
||||
nsTArray<ProxyAccessible*> targets(targetCount);
|
||||
for (size_t j = 0; j < targetCount; j++)
|
||||
for (size_t j = 0; j < targetCount; j++) {
|
||||
if (ProxyAccessible* proxy =
|
||||
mDoc->GetAccessible(ipcRelations[i].Targets()[j]))
|
||||
mDoc->GetAccessible(ipcRelations[i].Targets()[j])) {
|
||||
targets.AppendElement(proxy);
|
||||
}
|
||||
}
|
||||
|
||||
if (targets.IsEmpty()) continue;
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@ nsAccessibleRelation::nsAccessibleRelation(uint32_t aType, Relation* aRel)
|
|||
: mType(aType) {
|
||||
mTargets = do_CreateInstance(NS_ARRAY_CONTRACTID);
|
||||
Accessible* targetAcc = nullptr;
|
||||
while ((targetAcc = aRel->Next()))
|
||||
while ((targetAcc = aRel->Next())) {
|
||||
mTargets->AppendElement(static_cast<nsIAccessible*>(ToXPC(targetAcc)));
|
||||
}
|
||||
}
|
||||
|
||||
nsAccessibleRelation::nsAccessibleRelation(
|
||||
|
|
|
@ -40,8 +40,9 @@ NS_IMETHODIMP_(MozExternalRefCountType)
|
|||
xpcAccessibilityService::AddRef(void) {
|
||||
MOZ_ASSERT_TYPE_OK_FOR_REFCOUNTING(xpcAccessibilityService)
|
||||
MOZ_ASSERT(int32_t(mRefCnt) >= 0, "illegal refcnt");
|
||||
if (!nsAutoRefCnt::isThreadSafe)
|
||||
if (!nsAutoRefCnt::isThreadSafe) {
|
||||
NS_ASSERT_OWNINGTHREAD(xpcAccessibilityService);
|
||||
}
|
||||
nsrefcnt count = ++mRefCnt;
|
||||
NS_LOG_ADDREF(this, count, "xpcAccessibilityService", sizeof(*this));
|
||||
|
||||
|
|
|
@ -241,13 +241,14 @@ NS_IMETHODIMP
|
|||
xpcAccessible::GetState(uint32_t* aState, uint32_t* aExtraState) {
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
if (IntlGeneric().IsNull())
|
||||
if (IntlGeneric().IsNull()) {
|
||||
nsAccUtils::To32States(states::DEFUNCT, aState, aExtraState);
|
||||
else if (Intl())
|
||||
} else if (Intl()) {
|
||||
nsAccUtils::To32States(Intl()->State(), aState, aExtraState);
|
||||
else
|
||||
} else {
|
||||
nsAccUtils::To32States(IntlGeneric().AsProxy()->State(), aState,
|
||||
aExtraState);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -160,16 +160,17 @@ xpcAccessibleGeneric* xpcAccessibleDocument::GetAccessible(
|
|||
xpcAccessibleGeneric* xpcAcc = mCache.Get(aAccessible);
|
||||
if (xpcAcc) return xpcAcc;
|
||||
|
||||
if (aAccessible->IsImage())
|
||||
if (aAccessible->IsImage()) {
|
||||
xpcAcc = new xpcAccessibleImage(aAccessible);
|
||||
else if (aAccessible->IsTable())
|
||||
} else if (aAccessible->IsTable()) {
|
||||
xpcAcc = new xpcAccessibleTable(aAccessible);
|
||||
else if (aAccessible->IsTableCell())
|
||||
} else if (aAccessible->IsTableCell()) {
|
||||
xpcAcc = new xpcAccessibleTableCell(aAccessible);
|
||||
else if (aAccessible->IsHyperText())
|
||||
} else if (aAccessible->IsHyperText()) {
|
||||
xpcAcc = new xpcAccessibleHyperText(aAccessible);
|
||||
else
|
||||
} else {
|
||||
xpcAcc = new xpcAccessibleGeneric(aAccessible);
|
||||
}
|
||||
|
||||
mCache.Put(aAccessible, xpcAcc);
|
||||
return xpcAcc;
|
||||
|
|
|
@ -93,8 +93,9 @@ xpcAccessibleHyperLink::GetURI(int32_t aIndex, nsIURI** aURI) {
|
|||
if (aIndex < 0) return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (Intl().IsAccessible()) {
|
||||
if (aIndex >= static_cast<int32_t>(Intl().AsAccessible()->AnchorCount()))
|
||||
if (aIndex >= static_cast<int32_t>(Intl().AsAccessible()->AnchorCount())) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
RefPtr<nsIURI>(Intl().AsAccessible()->AnchorURIAt(aIndex)).forget(aURI);
|
||||
} else {
|
||||
|
@ -127,8 +128,9 @@ xpcAccessibleHyperLink::GetAnchor(int32_t aIndex, nsIAccessible** aAccessible) {
|
|||
if (aIndex < 0) return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (Intl().IsAccessible()) {
|
||||
if (aIndex >= static_cast<int32_t>(Intl().AsAccessible()->AnchorCount()))
|
||||
if (aIndex >= static_cast<int32_t>(Intl().AsAccessible()->AnchorCount())) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aAccessible = ToXPC(Intl().AsAccessible()->AnchorAt(aIndex)));
|
||||
} else {
|
||||
|
|
|
@ -487,9 +487,10 @@ xpcAccessibleHyperText::GetSelectionRanges(nsIArray** aRanges) {
|
|||
AutoTArray<TextRange, 1> ranges;
|
||||
Intl()->SelectionRanges(&ranges);
|
||||
uint32_t len = ranges.Length();
|
||||
for (uint32_t idx = 0; idx < len; idx++)
|
||||
for (uint32_t idx = 0; idx < len; idx++) {
|
||||
xpcRanges->AppendElement(
|
||||
new xpcAccessibleTextRange(std::move(ranges[idx])));
|
||||
}
|
||||
|
||||
xpcRanges.forget(aRanges);
|
||||
return NS_OK;
|
||||
|
@ -510,9 +511,10 @@ xpcAccessibleHyperText::GetVisibleRanges(nsIArray** aRanges) {
|
|||
nsTArray<TextRange> ranges;
|
||||
Intl()->VisibleRanges(&ranges);
|
||||
uint32_t len = ranges.Length();
|
||||
for (uint32_t idx = 0; idx < len; idx++)
|
||||
for (uint32_t idx = 0; idx < len; idx++) {
|
||||
xpcRanges->AppendElement(
|
||||
new xpcAccessibleTextRange(std::move(ranges[idx])));
|
||||
}
|
||||
|
||||
xpcRanges.forget(aRanges);
|
||||
return NS_OK;
|
||||
|
|
|
@ -24,8 +24,9 @@ class xpcAccessibleHyperText : public xpcAccessibleGeneric,
|
|||
public:
|
||||
explicit xpcAccessibleHyperText(Accessible* aIntl)
|
||||
: xpcAccessibleGeneric(aIntl) {
|
||||
if (aIntl->IsHyperText() && aIntl->AsHyperText()->IsTextRole())
|
||||
if (aIntl->IsHyperText() && aIntl->AsHyperText()->IsTextRole()) {
|
||||
mSupportedIfaces |= eText;
|
||||
}
|
||||
}
|
||||
|
||||
xpcAccessibleHyperText(ProxyAccessible* aProxy, uint32_t aInterfaces)
|
||||
|
|
|
@ -33,8 +33,9 @@ xpcAccessibleSelectable::GetSelectedItems(nsIArray** aSelectedItems) {
|
|||
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
for (uint32_t idx = 0; idx < itemCount; idx++)
|
||||
for (uint32_t idx = 0; idx < itemCount; idx++) {
|
||||
xpcItems->AppendElement(static_cast<nsIAccessible*>(ToXPC(items[idx])));
|
||||
}
|
||||
|
||||
NS_ADDREF(*aSelectedItems = xpcItems);
|
||||
return NS_OK;
|
||||
|
|
|
@ -67,8 +67,9 @@ xpcAccessibleTable::GetCellAt(int32_t aRowIdx, int32_t aColIdx,
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount() ||
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IF_ADDREF(*aCell = ToXPC(Intl()->CellAt(aRowIdx, aColIdx)));
|
||||
return NS_OK;
|
||||
|
@ -83,8 +84,9 @@ xpcAccessibleTable::GetCellIndexAt(int32_t aRowIdx, int32_t aColIdx,
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount() ||
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aCellIdx = Intl()->CellIndexAt(aRowIdx, aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -99,8 +101,9 @@ xpcAccessibleTable::GetColumnExtentAt(int32_t aRowIdx, int32_t aColIdx,
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount() ||
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aColumnExtent = Intl()->ColExtentAt(aRowIdx, aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -115,8 +118,9 @@ xpcAccessibleTable::GetRowExtentAt(int32_t aRowIdx, int32_t aColIdx,
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount() ||
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aRowExtent = Intl()->RowExtentAt(aRowIdx, aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -127,8 +131,9 @@ xpcAccessibleTable::GetColumnDescription(int32_t aColIdx,
|
|||
nsAString& aDescription) {
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsAutoString description;
|
||||
Intl()->ColDescription(aColIdx, description);
|
||||
|
@ -142,8 +147,9 @@ xpcAccessibleTable::GetRowDescription(int32_t aRowIdx,
|
|||
nsAString& aDescription) {
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->ColCount())
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsAutoString description;
|
||||
Intl()->RowDescription(aRowIdx, description);
|
||||
|
@ -159,8 +165,9 @@ xpcAccessibleTable::IsColumnSelected(int32_t aColIdx, bool* aIsSelected) {
|
|||
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aIsSelected = Intl()->IsColSelected(aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -173,8 +180,9 @@ xpcAccessibleTable::IsRowSelected(int32_t aRowIdx, bool* aIsSelected) {
|
|||
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount())
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aIsSelected = Intl()->IsRowSelected(aRowIdx);
|
||||
return NS_OK;
|
||||
|
@ -189,8 +197,9 @@ xpcAccessibleTable::IsCellSelected(int32_t aRowIdx, int32_t aColIdx,
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount() ||
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aIsSelected = Intl()->IsCellSelected(aRowIdx, aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -289,8 +298,9 @@ xpcAccessibleTable::GetColumnIndexAt(int32_t aCellIdx, int32_t* aColIdx) {
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aCellIdx < 0 || static_cast<uint32_t>(aCellIdx) >=
|
||||
Intl()->RowCount() * Intl()->ColCount())
|
||||
Intl()->RowCount() * Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aColIdx = Intl()->ColIndexAt(aCellIdx);
|
||||
return NS_OK;
|
||||
|
@ -304,8 +314,9 @@ xpcAccessibleTable::GetRowIndexAt(int32_t aCellIdx, int32_t* aRowIdx) {
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aCellIdx < 0 || static_cast<uint32_t>(aCellIdx) >=
|
||||
Intl()->RowCount() * Intl()->ColCount())
|
||||
Intl()->RowCount() * Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
*aRowIdx = Intl()->RowIndexAt(aCellIdx);
|
||||
return NS_OK;
|
||||
|
@ -322,8 +333,9 @@ xpcAccessibleTable::GetRowAndColumnIndicesAt(int32_t aCellIdx, int32_t* aRowIdx,
|
|||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aCellIdx < 0 || static_cast<uint32_t>(aCellIdx) >=
|
||||
Intl()->RowCount() * Intl()->ColCount())
|
||||
Intl()->RowCount() * Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
Intl()->RowAndColIndicesAt(aCellIdx, aRowIdx, aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -354,8 +366,9 @@ NS_IMETHODIMP
|
|||
xpcAccessibleTable::SelectColumn(int32_t aColIdx) {
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
Intl()->SelectCol(aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -365,8 +378,9 @@ NS_IMETHODIMP
|
|||
xpcAccessibleTable::SelectRow(int32_t aRowIdx) {
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount())
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
Intl()->SelectRow(aRowIdx);
|
||||
return NS_OK;
|
||||
|
@ -376,8 +390,9 @@ NS_IMETHODIMP
|
|||
xpcAccessibleTable::UnselectColumn(int32_t aColIdx) {
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount())
|
||||
if (aColIdx < 0 || static_cast<uint32_t>(aColIdx) >= Intl()->ColCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
Intl()->UnselectCol(aColIdx);
|
||||
return NS_OK;
|
||||
|
@ -387,8 +402,9 @@ NS_IMETHODIMP
|
|||
xpcAccessibleTable::UnselectRow(int32_t aRowIdx) {
|
||||
if (!Intl()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount())
|
||||
if (aRowIdx < 0 || static_cast<uint32_t>(aRowIdx) >= Intl()->RowCount()) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
Intl()->UnselectRow(aRowIdx);
|
||||
return NS_OK;
|
||||
|
|
|
@ -78,8 +78,9 @@ xpcAccessibleTextRange::GetEmbeddedChildren(nsIArray** aList) {
|
|||
mRange.EmbeddedChildren(&objects);
|
||||
|
||||
uint32_t len = objects.Length();
|
||||
for (uint32_t idx = 0; idx < len; idx++)
|
||||
for (uint32_t idx = 0; idx < len; idx++) {
|
||||
xpcList->AppendElement(static_cast<nsIAccessible*>(ToXPC(objects[idx])));
|
||||
}
|
||||
|
||||
xpcList.forget(aList);
|
||||
|
||||
|
@ -110,10 +111,11 @@ xpcAccessibleTextRange::CompareEndPoints(uint32_t aEndPoint,
|
|||
? xpcRange->mRange.StartPoint()
|
||||
: xpcRange->mRange.EndPoint();
|
||||
|
||||
if (p == otherPoint)
|
||||
if (p == otherPoint) {
|
||||
*aResult = 0;
|
||||
else
|
||||
} else {
|
||||
*aResult = p < otherPoint ? -1 : 1;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -17,8 +17,9 @@ xpcAccessibleValue::GetMaximumValue(double* aValue) {
|
|||
|
||||
if (Intl().IsNull()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
double value;
|
||||
if (Intl().IsAccessible()) {
|
||||
|
@ -39,8 +40,9 @@ xpcAccessibleValue::GetMinimumValue(double* aValue) {
|
|||
|
||||
if (Intl().IsNull()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
double value;
|
||||
if (Intl().IsAccessible()) {
|
||||
|
@ -61,8 +63,9 @@ xpcAccessibleValue::GetCurrentValue(double* aValue) {
|
|||
|
||||
if (Intl().IsNull()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
double value;
|
||||
if (Intl().IsAccessible()) {
|
||||
|
@ -80,8 +83,9 @@ NS_IMETHODIMP
|
|||
xpcAccessibleValue::SetCurrentValue(double aValue) {
|
||||
if (Intl().IsNull()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (Intl().IsAccessible()) {
|
||||
Intl().AsAccessible()->SetCurValue(aValue);
|
||||
|
@ -99,8 +103,9 @@ xpcAccessibleValue::GetMinimumIncrement(double* aValue) {
|
|||
|
||||
if (Intl().IsNull()) return NS_ERROR_FAILURE;
|
||||
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct())
|
||||
if (Intl().IsAccessible() && Intl().AsAccessible()->IsDefunct()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
double value;
|
||||
if (Intl().IsAccessible()) {
|
||||
|
|
|
@ -44,10 +44,11 @@ uint64_t XULComboboxAccessible::NativeState() const {
|
|||
if (menuList) {
|
||||
bool isOpen = false;
|
||||
menuList->GetOpen(&isOpen);
|
||||
if (isOpen)
|
||||
if (isOpen) {
|
||||
state |= states::EXPANDED;
|
||||
else
|
||||
} else {
|
||||
state |= states::COLLAPSED;
|
||||
}
|
||||
}
|
||||
|
||||
return state | states::HASPOPUP;
|
||||
|
@ -102,10 +103,11 @@ void XULComboboxAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
|
||||
bool isDroppedDown = false;
|
||||
menuList->GetOpen(&isDroppedDown);
|
||||
if (isDroppedDown)
|
||||
if (isDroppedDown) {
|
||||
aName.AssignLiteral("close");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("open");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -117,8 +119,9 @@ bool XULComboboxAccessible::IsActiveWidget() const {
|
|||
int32_t childCount = mChildren.Length();
|
||||
for (int32_t idx = 0; idx < childCount; idx++) {
|
||||
Accessible* child = mChildren[idx];
|
||||
if (child->Role() == roles::ENTRY)
|
||||
if (child->Role() == roles::ENTRY) {
|
||||
return FocusMgr()->HasDOMFocus(child->GetContent());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -92,8 +92,9 @@ uint64_t XULButtonAccessible::NativeState() const {
|
|||
|
||||
if (ContainsMenu()) state |= states::HASPOPUP;
|
||||
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_default))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::_default)) {
|
||||
state |= states::DEFAULT;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -178,10 +179,11 @@ bool XULDropmarkerAccessible::DropmarkerOpen(bool aToggleOpen) const {
|
|||
void XULDropmarkerAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
aName.Truncate();
|
||||
if (aIndex == eAction_Click) {
|
||||
if (DropmarkerOpen(false))
|
||||
if (DropmarkerOpen(false)) {
|
||||
aName.AssignLiteral("close");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("open");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -418,8 +420,9 @@ role XULToolbarAccessible::NativeRole() const { return roles::TOOLBAR; }
|
|||
|
||||
ENameValueFlag XULToolbarAccessible::NativeName(nsString& aName) const {
|
||||
if (mContent->AsElement()->GetAttr(kNameSpaceID_None, nsGkAtoms::toolbarname,
|
||||
aName))
|
||||
aName)) {
|
||||
aName.CompressWhitespace();
|
||||
}
|
||||
|
||||
return eNameOK;
|
||||
}
|
||||
|
|
|
@ -101,8 +101,9 @@ role XULListboxAccessible::NativeRole() const {
|
|||
// A richlistbox is used with the new autocomplete URL bar, and has a parent
|
||||
// popup <panel>.
|
||||
if (mContent->GetParent() &&
|
||||
mContent->GetParent()->IsXULElement(nsGkAtoms::panel))
|
||||
mContent->GetParent()->IsXULElement(nsGkAtoms::panel)) {
|
||||
return roles::COMBOBOX_LIST;
|
||||
}
|
||||
|
||||
return IsMulticolumn() ? roles::TABLE : roles::LISTBOX;
|
||||
}
|
||||
|
@ -267,9 +268,11 @@ void XULListboxAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells) {
|
|||
if (item) {
|
||||
int32_t itemIdx = -1;
|
||||
control->GetIndexOfItem(item, &itemIdx);
|
||||
if (itemIdx >= 0)
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++, cellsIdx++)
|
||||
if (itemIdx >= 0) {
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++, cellsIdx++) {
|
||||
aCells->ElementAt(cellsIdx) = itemIdx * colCount + colIdx;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -278,8 +281,9 @@ void XULListboxAccessible::SelectedColIndices(nsTArray<uint32_t>* aCols) {
|
|||
uint32_t selColCount = SelectedColCount();
|
||||
aCols->SetCapacity(selColCount);
|
||||
|
||||
for (uint32_t colIdx = 0; colIdx < selColCount; colIdx++)
|
||||
for (uint32_t colIdx = 0; colIdx < selColCount; colIdx++) {
|
||||
aCols->AppendElement(colIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void XULListboxAccessible::SelectedRowIndices(nsTArray<uint32_t>* aRows) {
|
||||
|
@ -459,8 +463,9 @@ role XULListitemAccessible::NativeRole() const {
|
|||
|
||||
if (mIsCheckbox) return roles::CHECK_RICH_OPTION;
|
||||
|
||||
if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
|
||||
if (mParent && mParent->Role() == roles::COMBOBOX_LIST) {
|
||||
return roles::COMBOBOX_OPTION;
|
||||
}
|
||||
|
||||
return roles::RICH_OPTION;
|
||||
}
|
||||
|
@ -492,10 +497,11 @@ uint64_t XULListitemAccessible::NativeInteractiveState() const {
|
|||
void XULListitemAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
||||
if (aIndex == eAction_Click && mIsCheckbox) {
|
||||
uint64_t states = NativeState();
|
||||
if (states & states::CHECKED)
|
||||
if (states & states::CHECKED) {
|
||||
aName.AssignLiteral("uncheck");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("check");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,11 @@ uint64_t XULMenuitemAccessible::NativeState() const {
|
|||
// Has Popup?
|
||||
if (mContent->NodeInfo()->Equals(nsGkAtoms::menu, kNameSpaceID_XUL)) {
|
||||
state |= states::HASPOPUP;
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::open))
|
||||
if (mContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::open)) {
|
||||
state |= states::EXPANDED;
|
||||
else
|
||||
} else {
|
||||
state |= states::COLLAPSED;
|
||||
}
|
||||
}
|
||||
|
||||
// Checkable/checked?
|
||||
|
@ -61,8 +62,9 @@ uint64_t XULMenuitemAccessible::NativeState() const {
|
|||
// Checked?
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::checked, nsGkAtoms::_true,
|
||||
eCaseMatters))
|
||||
eCaseMatters)) {
|
||||
state |= states::CHECKED;
|
||||
}
|
||||
}
|
||||
|
||||
// Combo box listitem
|
||||
|
@ -225,12 +227,14 @@ role XULMenuitemAccessible::NativeRole() const {
|
|||
}
|
||||
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::radio, eCaseMatters))
|
||||
nsGkAtoms::radio, eCaseMatters)) {
|
||||
return roles::RADIO_MENU_ITEM;
|
||||
}
|
||||
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
|
||||
nsGkAtoms::checkbox, eCaseMatters))
|
||||
nsGkAtoms::checkbox, eCaseMatters)) {
|
||||
return roles::CHECK_MENU_ITEM;
|
||||
}
|
||||
|
||||
return roles::MENUITEM;
|
||||
}
|
||||
|
@ -406,14 +410,16 @@ role XULMenupopupAccessible::NativeRole() const {
|
|||
}
|
||||
|
||||
if (mParent) {
|
||||
if (mParent->IsCombobox() || mParent->IsAutoComplete())
|
||||
if (mParent->IsCombobox() || mParent->IsAutoComplete()) {
|
||||
return roles::COMBOBOX_LIST;
|
||||
}
|
||||
|
||||
if (mParent->Role() == roles::PUSHBUTTON) {
|
||||
// Some widgets like the search bar have several popups, owned by buttons.
|
||||
Accessible* grandParent = mParent->LocalParent();
|
||||
if (grandParent && grandParent->IsAutoComplete())
|
||||
if (grandParent && grandParent->IsAutoComplete()) {
|
||||
return roles::COMBOBOX_LIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,16 +451,19 @@ Accessible* XULMenupopupAccessible::ContainerWidget() const {
|
|||
while (menuPopupFrame) {
|
||||
Accessible* menuPopup =
|
||||
document->GetAccessible(menuPopupFrame->GetContent());
|
||||
if (!menuPopup) // shouldn't be a real case
|
||||
if (!menuPopup) { // shouldn't be a real case
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsMenuFrame* menuFrame = do_QueryFrame(menuPopupFrame->GetParent());
|
||||
if (!menuFrame) // context menu or popups
|
||||
if (!menuFrame) { // context menu or popups
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsMenuParent* menuParent = menuFrame->GetMenuParent();
|
||||
if (!menuParent) // menulist or menubutton
|
||||
if (!menuParent) { // menulist or menubutton
|
||||
return menuPopup->LocalParent();
|
||||
}
|
||||
|
||||
if (menuParent->IsMenuBar()) { // menubar menu
|
||||
nsMenuBarFrame* menuBarFrame = static_cast<nsMenuBarFrame*>(menuParent);
|
||||
|
|
|
@ -65,12 +65,14 @@ uint64_t XULTabAccessible::NativeState() const {
|
|||
Elm()->AsXULSelectControlItem();
|
||||
if (tab) {
|
||||
bool selected = false;
|
||||
if (NS_SUCCEEDED(tab->GetSelected(&selected)) && selected)
|
||||
if (NS_SUCCEEDED(tab->GetSelected(&selected)) && selected) {
|
||||
state |= states::SELECTED;
|
||||
}
|
||||
|
||||
if (mContent->AsElement()->AttrValueIs(kNameSpaceID_None, nsGkAtoms::pinned,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
state |= states::PINNED;
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
|
|
|
@ -173,8 +173,9 @@ Accessible* XULTreeAccessible::ChildAtPoint(int32_t aX, int32_t aY,
|
|||
|
||||
// If we failed to find tree cell for the given point then it might be
|
||||
// tree columns.
|
||||
if (cellInfo.mRow == -1 || !cellInfo.mCol)
|
||||
if (cellInfo.mRow == -1 || !cellInfo.mCol) {
|
||||
return AccessibleWrap::ChildAtPoint(aX, aY, aWhichChild);
|
||||
}
|
||||
|
||||
Accessible* child = GetTreeItemAccessible(cellInfo.mRow);
|
||||
if (aWhichChild == eDeepestChild && child) {
|
||||
|
@ -363,8 +364,9 @@ uint32_t XULTreeAccessible::ChildCount() const {
|
|||
|
||||
Relation XULTreeAccessible::RelationByType(RelationType aType) const {
|
||||
if (aType == RelationType::NODE_PARENT_OF) {
|
||||
if (mTreeView)
|
||||
if (mTreeView) {
|
||||
return Relation(new XULTreeItemIterator(this, mTreeView, -1));
|
||||
}
|
||||
|
||||
return Relation();
|
||||
}
|
||||
|
@ -671,8 +673,9 @@ Relation XULTreeItemAccessibleBase::RelationByType(RelationType aType) const {
|
|||
switch (aType) {
|
||||
case RelationType::NODE_CHILD_OF: {
|
||||
int32_t parentIndex = -1;
|
||||
if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex)))
|
||||
if (!NS_SUCCEEDED(mTreeView->GetParentIndex(mRow, &parentIndex))) {
|
||||
return Relation();
|
||||
}
|
||||
|
||||
if (parentIndex == -1) return Relation(mParent);
|
||||
|
||||
|
@ -682,11 +685,13 @@ Relation XULTreeItemAccessibleBase::RelationByType(RelationType aType) const {
|
|||
|
||||
case RelationType::NODE_PARENT_OF: {
|
||||
bool isTrue = false;
|
||||
if (NS_FAILED(mTreeView->IsContainerEmpty(mRow, &isTrue)) || isTrue)
|
||||
if (NS_FAILED(mTreeView->IsContainerEmpty(mRow, &isTrue)) || isTrue) {
|
||||
return Relation();
|
||||
}
|
||||
|
||||
if (NS_FAILED(mTreeView->IsContainerOpen(mRow, &isTrue)) || !isTrue)
|
||||
if (NS_FAILED(mTreeView->IsContainerOpen(mRow, &isTrue)) || !isTrue) {
|
||||
return Relation();
|
||||
}
|
||||
|
||||
XULTreeAccessible* tree = mParent->AsXULTree();
|
||||
return Relation(new XULTreeItemIterator(tree, mTreeView, mRow));
|
||||
|
@ -712,16 +717,19 @@ void XULTreeItemAccessibleBase::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
if (aIndex == eAction_Expand && IsExpandable()) {
|
||||
bool isContainerOpen = false;
|
||||
mTreeView->IsContainerOpen(mRow, &isContainerOpen);
|
||||
if (isContainerOpen)
|
||||
if (isContainerOpen) {
|
||||
aName.AssignLiteral("collapse");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("expand");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool XULTreeItemAccessibleBase::DoAction(uint8_t aIndex) const {
|
||||
if (aIndex != eAction_Click && (aIndex != eAction_Expand || !IsExpandable()))
|
||||
if (aIndex != eAction_Click &&
|
||||
(aIndex != eAction_Expand || !IsExpandable())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
DoCommand(nullptr, aIndex);
|
||||
return true;
|
||||
|
@ -803,8 +811,9 @@ uint64_t XULTreeItemAccessibleBase::NativeState() const {
|
|||
// invisible state
|
||||
int32_t firstVisibleRow = mTree->GetFirstVisibleRow();
|
||||
int32_t lastVisibleRow = mTree->GetLastVisibleRow();
|
||||
if (mRow < firstVisibleRow || mRow > lastVisibleRow)
|
||||
if (mRow < firstVisibleRow || mRow > lastVisibleRow) {
|
||||
state |= states::INVISIBLE;
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
@ -873,8 +882,9 @@ bool XULTreeItemAccessibleBase::IsExpandable() const {
|
|||
RefPtr<nsTreeColumns> columns = mTree->GetColumns();
|
||||
if (columns) {
|
||||
nsTreeColumn* primaryColumn = columns->GetPrimaryColumn();
|
||||
if (primaryColumn && !nsCoreUtils::IsColumnHidden(primaryColumn))
|
||||
if (primaryColumn && !nsCoreUtils::IsColumnHidden(primaryColumn)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -976,8 +986,9 @@ XULTreeColumAccessible::XULTreeColumAccessible(nsIContent* aContent,
|
|||
|
||||
Accessible* XULTreeColumAccessible::GetSiblingAtOffset(int32_t aOffset,
|
||||
nsresult* aError) const {
|
||||
if (aOffset < 0)
|
||||
if (aOffset < 0) {
|
||||
return XULColumAccessible::GetSiblingAtOffset(aOffset, aError);
|
||||
}
|
||||
|
||||
if (aError) *aError = NS_OK; // fail peacefully
|
||||
|
||||
|
|
|
@ -77,10 +77,13 @@ void XULTreeGridAccessible::SelectedCells(nsTArray<Accessible*>* aCells) {
|
|||
void XULTreeGridAccessible::SelectedCellIndices(nsTArray<uint32_t>* aCells) {
|
||||
uint32_t colCount = ColCount(), rowCount = RowCount();
|
||||
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++)
|
||||
if (IsRowSelected(rowIdx))
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++)
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
if (IsRowSelected(rowIdx)) {
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
aCells->AppendElement(rowIdx * colCount + colIdx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void XULTreeGridAccessible::SelectedColIndices(nsTArray<uint32_t>* aCols) {
|
||||
|
@ -88,14 +91,16 @@ void XULTreeGridAccessible::SelectedColIndices(nsTArray<uint32_t>* aCols) {
|
|||
|
||||
uint32_t colCount = ColCount();
|
||||
aCols->SetCapacity(colCount);
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++)
|
||||
for (uint32_t colIdx = 0; colIdx < colCount; colIdx++) {
|
||||
aCols->AppendElement(colIdx);
|
||||
}
|
||||
}
|
||||
|
||||
void XULTreeGridAccessible::SelectedRowIndices(nsTArray<uint32_t>* aRows) {
|
||||
uint32_t rowCount = RowCount();
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++)
|
||||
for (uint32_t rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||
if (IsRowSelected(rowIdx)) aRows->AppendElement(rowIdx);
|
||||
}
|
||||
}
|
||||
|
||||
Accessible* XULTreeGridAccessible::CellAt(uint32_t aRowIndex,
|
||||
|
@ -323,8 +328,9 @@ void XULTreeGridRowAccessible::RowInvalidated(int32_t aStartColIdx,
|
|||
}
|
||||
}
|
||||
|
||||
if (nameChanged)
|
||||
if (nameChanged) {
|
||||
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, this);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -346,10 +352,11 @@ XULTreeGridCellAccessible::XULTreeGridCellAccessible(
|
|||
|
||||
NS_ASSERTION(mTreeView, "mTreeView is null");
|
||||
|
||||
if (mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX)
|
||||
if (mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX) {
|
||||
mTreeView->GetCellValue(mRow, mColumn, mCachedTextEquiv);
|
||||
else
|
||||
} else {
|
||||
mTreeView->GetCellText(mRow, mColumn, mCachedTextEquiv);
|
||||
}
|
||||
}
|
||||
|
||||
XULTreeGridCellAccessible::~XULTreeGridCellAccessible() {}
|
||||
|
@ -435,8 +442,10 @@ nsRect XULTreeGridCellAccessible::BoundsInAppUnits() const {
|
|||
uint8_t XULTreeGridCellAccessible::ActionCount() const {
|
||||
if (mColumn->Cycler()) return 1;
|
||||
|
||||
if (mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX && IsEditable())
|
||||
if (mColumn->Type() == dom::TreeColumn_Binding::TYPE_CHECKBOX &&
|
||||
IsEditable()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -455,10 +464,11 @@ void XULTreeGridCellAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName) {
|
|||
IsEditable()) {
|
||||
nsAutoString value;
|
||||
mTreeView->GetCellValue(mRow, mColumn, value);
|
||||
if (value.EqualsLiteral("true"))
|
||||
if (value.EqualsLiteral("true")) {
|
||||
aName.AssignLiteral("uncheck");
|
||||
else
|
||||
} else {
|
||||
aName.AssignLiteral("check");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -533,8 +543,9 @@ XULTreeGridCellAccessible::NativeAttributes() {
|
|||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::tableCellIndex, stringIdx);
|
||||
|
||||
// "cycles" attribute
|
||||
if (mColumn->Cycler())
|
||||
if (mColumn->Cycler()) {
|
||||
nsAccUtils::SetAccAttr(attributes, nsGkAtoms::cycles, u"true"_ns);
|
||||
}
|
||||
|
||||
return attributes.forget();
|
||||
}
|
||||
|
@ -656,8 +667,9 @@ bool XULTreeGridCellAccessible::IsEditable() const {
|
|||
dom::Element* columnElm = mColumn->Element();
|
||||
|
||||
if (!columnElm->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
|
||||
nsGkAtoms::_true, eCaseMatters))
|
||||
nsGkAtoms::_true, eCaseMatters)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mContent->AsElement()->AttrValueIs(
|
||||
kNameSpaceID_None, nsGkAtoms::editable, nsGkAtoms::_true, eCaseMatters);
|
||||
|
|
Загрузка…
Ссылка в новой задаче