本文整理汇总了C++中DocAccessible::GetContainerAccessible方法的典型用法代码示例。如果您正苦于以下问题:C++ DocAccessible::GetContainerAccessible方法的具体用法?C++ DocAccessible::GetContainerAccessible怎么用?C++ DocAccessible::GetContainerAccessible使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocAccessible
的用法示例。
在下文中一共展示了DocAccessible::GetContainerAccessible方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AccTextChangeEvent
void
NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent)
{
DocAccessible* document = aEvent->GetDocAccessible();
Accessible* container = document->GetContainerAccessible(aEvent->mNode);
if (!container)
return;
HyperTextAccessible* textAccessible = container->AsHyperText();
if (!textAccessible)
return;
// Don't fire event for the first html:br in an editor.
if (aEvent->mAccessible->Role() == roles::WHITESPACE) {
nsCOMPtr<nsIEditor> editor = textAccessible->GetEditor();
if (editor) {
bool isEmpty = false;
editor->GetDocumentIsEmpty(&isEmpty);
if (isEmpty)
return;
}
}
int32_t offset = textAccessible->GetChildOffset(aEvent->mAccessible);
nsAutoString text;
aEvent->mAccessible->AppendTextTo(text);
if (text.IsEmpty())
return;
aEvent->mTextChangeEvent =
new AccTextChangeEvent(textAccessible, offset, text, aEvent->IsShow(),
aEvent->mIsFromUserInput ? eFromUserInput : eNoUserInput);
}
示例2: nsIntPoint
nsIntPoint
nsAccUtils::GetScreenCoordsForParent(nsAccessNode *aAccessNode)
{
DocAccessible* document = aAccessNode->Document();
nsAccessible* parent = document->GetContainerAccessible(aAccessNode->GetNode());
if (!parent)
return nsIntPoint(0, 0);
nsIFrame *parentFrame = parent->GetFrame();
if (!parentFrame)
return nsIntPoint(0, 0);
nsIntRect parentRect = parentFrame->GetScreenRectExternal();
return nsIntPoint(parentRect.x, parentRect.y);
}
示例3: nsIntPoint
nsIntPoint
nsAccUtils::GetScreenCoordsForParent(nsAccessNode *aAccessNode)
{
DocAccessible* document = aAccessNode->Document();
Accessible* parent = document->GetContainerAccessible(aAccessNode->GetNode());
if (!parent)
return nsIntPoint(0, 0);
nsIFrame *parentFrame = parent->GetFrame();
if (!parentFrame)
return nsIntPoint(0, 0);
nsRect rect = parentFrame->GetScreenRectInAppUnits();
return nsPoint(rect.x, rect.y).
ToNearestPixels(parentFrame->PresContext()->AppUnitsPerDevPixel());
}
示例4: AccStateChangeEvent
void
RootAccessible::HandlePopupHidingEvent(nsINode* aPopupNode)
{
// Get popup accessible. There are cases when popup element isn't accessible
// but an underlying widget is and behaves like popup, an example is
// autocomplete popups.
DocAccessible* document = nsAccUtils::GetDocAccessibleFor(aPopupNode);
if (!document)
return;
Accessible* popup = document->GetAccessible(aPopupNode);
if (!popup) {
Accessible* popupContainer = document->GetContainerAccessible(aPopupNode);
if (!popupContainer)
return;
uint32_t childCount = popupContainer->ChildCount();
for (uint32_t idx = 0; idx < childCount; idx++) {
Accessible* child = popupContainer->GetChildAt(idx);
if (child->IsAutoCompletePopup()) {
popup = child;
break;
}
}
// No popup no events. Focus is managed by DOM. This is a case for
// menupopups of menus on Linux since there are no accessible for popups.
if (!popup)
return;
}
// In case of autocompletes and comboboxes fire state change event for
// expanded state. Note, HTML form autocomplete isn't a subject of state
// change event because they aren't autocompletes strictly speaking.
// When popup closes (except nested popups and menus) then fire focus event to
// where it was. The focus event is expected even if popup didn't take a focus.
static const uint32_t kNotifyOfFocus = 1;
static const uint32_t kNotifyOfState = 2;
uint32_t notifyOf = 0;
// HTML select is target of popuphidding event. Otherwise get container
// widget. No container widget means this is either tooltip or menupopup.
// No events in the former case.
Accessible* widget = nullptr;
if (popup->IsCombobox()) {
widget = popup;
} else {
widget = popup->ContainerWidget();
if (!widget) {
if (!popup->IsMenuPopup())
return;
widget = popup;
}
}
if (popup->IsAutoCompletePopup()) {
// No focus event for autocomplete because it's managed by
// DOMMenuItemInactive events.
if (widget->IsAutoComplete())
notifyOf = kNotifyOfState;
} else if (widget->IsCombobox()) {
// Fire focus for active combobox, otherwise the focus is managed by DOM
// focus notifications. Always fire state change event.
if (widget->IsActiveWidget())
notifyOf = kNotifyOfFocus;
notifyOf |= kNotifyOfState;
} else if (widget->IsMenuButton()) {
// Can be a part of autocomplete.
Accessible* compositeWidget = widget->ContainerWidget();
if (compositeWidget && compositeWidget->IsAutoComplete()) {
widget = compositeWidget;
notifyOf = kNotifyOfState;
}
// Autocomplete (like searchbar) can be inactive when popup hiddens
notifyOf |= kNotifyOfFocus;
} else if (widget == popup) {
// Top level context menus and alerts.
// Ignore submenus and menubar. When submenu is closed then sumbenu
// container menuitem takes a focus via DOMMenuItemActive notification.
// For menubars processing we listen DOMMenubarActive/Inactive
// notifications.
notifyOf = kNotifyOfFocus;
}
// Restore focus to where it was.
if (notifyOf & kNotifyOfFocus) {
FocusMgr()->ActiveItemChanged(nullptr);
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eFocus))
logging::ActiveItemChangeCausedBy("popuphiding", popup);
#endif
}
// Fire expanded state change event.
//.........这里部分代码省略.........