本文整理汇总了C++中nsCOMPtr::GetMatchRoles方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCOMPtr::GetMatchRoles方法的具体用法?C++ nsCOMPtr::GetMatchRoles怎么用?C++ nsCOMPtr::GetMatchRoles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCOMPtr
的用法示例。
在下文中一共展示了nsCOMPtr::GetMatchRoles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
nsresult
RuleCache::ApplyFilter(Accessible* aAccessible, uint16_t* aResult)
{
*aResult = nsIAccessibleTraversalRule::FILTER_IGNORE;
if (!mAcceptRoles) {
nsresult rv = mRule->GetMatchRoles(&mAcceptRoles, &mAcceptRolesLength);
NS_ENSURE_SUCCESS(rv, rv);
rv = mRule->GetPreFilter(&mPreFilter);
NS_ENSURE_SUCCESS(rv, rv);
}
if (mPreFilter) {
uint64_t state = aAccessible->State();
if ((nsIAccessibleTraversalRule::PREFILTER_INVISIBLE & mPreFilter) &&
(state & states::INVISIBLE))
return NS_OK;
if ((nsIAccessibleTraversalRule::PREFILTER_OFFSCREEN & mPreFilter) &&
(state & states::OFFSCREEN))
return NS_OK;
if ((nsIAccessibleTraversalRule::PREFILTER_NOT_FOCUSABLE & mPreFilter) &&
!(state & states::FOCUSABLE))
return NS_OK;
if (nsIAccessibleTraversalRule::PREFILTER_ARIA_HIDDEN & mPreFilter) {
if (aAccessible->IsARIAHidden()) {
*aResult |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
return NS_OK;
}
}
if ((nsIAccessibleTraversalRule::PREFILTER_TRANSPARENT & mPreFilter) &&
!(state & states::OPAQUE1)) {
nsIFrame* frame = aAccessible->GetFrame();
if (frame->StyleDisplay()->mOpacity == 0.0f) {
*aResult |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
return NS_OK;
}
}
}
if (mAcceptRolesLength > 0) {
uint32_t accessibleRole = aAccessible->Role();
bool matchesRole = false;
for (uint32_t idx = 0; idx < mAcceptRolesLength; idx++) {
matchesRole = mAcceptRoles[idx] == accessibleRole;
if (matchesRole)
break;
}
if (!matchesRole)
return NS_OK;
}
return mRule->Match(ToXPC(aAccessible), aResult);
}
示例2:
nsresult
RuleCache::ApplyFilter(Accessible* aAccessible, uint16_t* aResult)
{
*aResult = nsIAccessibleTraversalRule::FILTER_IGNORE;
if (!mAcceptRoles) {
nsresult rv = mRule->GetMatchRoles(&mAcceptRoles, &mAcceptRolesLength);
NS_ENSURE_SUCCESS(rv, rv);
rv = mRule->GetPreFilter(&mPreFilter);
NS_ENSURE_SUCCESS(rv, rv);
}
if (mPreFilter) {
uint64_t state = aAccessible->State();
if ((nsIAccessibleTraversalRule::PREFILTER_INVISIBLE & mPreFilter) &&
(state & states::INVISIBLE))
return NS_OK;
if ((nsIAccessibleTraversalRule::PREFILTER_OFFSCREEN & mPreFilter) &&
(state & states::OFFSCREEN))
return NS_OK;
if ((nsIAccessibleTraversalRule::PREFILTER_NOT_FOCUSABLE & mPreFilter) &&
!(state & states::FOCUSABLE))
return NS_OK;
if (nsIAccessibleTraversalRule::PREFILTER_ARIA_HIDDEN & mPreFilter) {
nsIContent* content = aAccessible->GetContent();
if (content &&
nsAccUtils::HasDefinedARIAToken(content, nsGkAtoms::aria_hidden) &&
!content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_hidden,
nsGkAtoms::_false, eCaseMatters)) {
*aResult |= nsIAccessibleTraversalRule::FILTER_IGNORE_SUBTREE;
return NS_OK;
}
}
}
if (mAcceptRolesLength > 0) {
uint32_t accessibleRole = aAccessible->Role();
bool matchesRole = false;
for (uint32_t idx = 0; idx < mAcceptRolesLength; idx++) {
matchesRole = mAcceptRoles[idx] == accessibleRole;
if (matchesRole)
break;
}
if (!matchesRole)
return NS_OK;
}
return mRule->Match(aAccessible, aResult);
}