本文整理汇总了C++中Accessible::AsHyperText方法的典型用法代码示例。如果您正苦于以下问题:C++ Accessible::AsHyperText方法的具体用法?C++ Accessible::AsHyperText怎么用?C++ Accessible::AsHyperText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Accessible
的用法示例。
在下文中一共展示了Accessible::AsHyperText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AccTextChangeEvent
void
EventQueue::CreateTextChangeEventFor(AccMutationEvent* aEvent)
{
Accessible* container = aEvent->mAccessible->Parent();
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: IdToAccessible
HyperTextAccessible*
DocAccessibleChild::IdToHyperTextAccessible(const uint64_t& aID)
{
Accessible* acc = IdToAccessible(aID);
MOZ_ASSERT(!acc || acc->IsHyperText());
return acc ? acc->AsHyperText() : nullptr;
}
示例3: GetActiveRoot
HyperTextAccessible*
nsAccessiblePivot::SearchForText(Accessible* aAccessible, bool aBackward)
{
Accessible* root = GetActiveRoot();
Accessible* accessible = aAccessible;
while (true) {
Accessible* child = nullptr;
while ((child = (aBackward ? accessible->LastChild() :
accessible->FirstChild()))) {
accessible = child;
if (child->IsHyperText())
return child->AsHyperText();
}
Accessible* sibling = nullptr;
Accessible* temp = accessible;
do {
if (temp == root)
break;
if (temp != aAccessible && temp->IsHyperText())
return temp->AsHyperText();
sibling = aBackward ? temp->PrevSibling() : temp->NextSibling();
if (sibling)
break;
} while ((temp = temp->Parent()));
if (!sibling)
break;
accessible = sibling;
if (accessible->IsHyperText())
return accessible->AsHyperText();
}
return nullptr;
}
示例4: GetAccService
HyperTextAccessible*
nsAccUtils::GetTextContainer(nsINode* aNode)
{
// Get text accessible containing the result node.
DocAccessible* doc =
GetAccService()->GetDocAccessible(aNode->OwnerDoc());
Accessible* accessible =
doc ? doc->GetAccessibleOrContainer(aNode) : nullptr;
if (!accessible)
return nullptr;
do {
HyperTextAccessible* textAcc = accessible->AsHyperText();
if (textAcc)
return textAcc;
accessible = accessible->Parent();
} while (accessible);
return nullptr;
}
示例5: HandleAccEvent
nsresult
HyperTextAccessibleWrap::HandleAccEvent(AccEvent* aEvent)
{
uint32_t eventType = aEvent->GetEventType();
if (eventType == nsIAccessibleEvent::EVENT_TEXT_REMOVED ||
eventType == nsIAccessibleEvent::EVENT_TEXT_INSERTED) {
Accessible* accessible = aEvent->GetAccessible();
if (accessible && accessible->IsHyperText()) {
AccTextChangeEvent* event = downcast_accEvent(aEvent);
HyperTextAccessibleWrap* text =
static_cast<HyperTextAccessibleWrap*>(accessible->AsHyperText());
ia2AccessibleText::UpdateTextChangeData(text, event->IsTextInserted(),
event->ModifiedText(),
event->GetStartOffset(),
event->GetLength());
}
}
return HyperTextAccessible::HandleAccEvent(aEvent);
}
示例6: focusNode
HyperTextAccessible*
nsAccUtils::GetTextAccessibleFromSelection(nsISelection* aSelection)
{
// Get accessible from selection's focus DOM point (the DOM point where
// selection is ended).
nsCOMPtr<nsIDOMNode> focusDOMNode;
aSelection->GetFocusNode(getter_AddRefs(focusDOMNode));
if (!focusDOMNode)
return nullptr;
int32_t focusOffset = 0;
aSelection->GetFocusOffset(&focusOffset);
nsCOMPtr<nsINode> focusNode(do_QueryInterface(focusDOMNode));
nsCOMPtr<nsINode> resultNode =
nsCoreUtils::GetDOMNodeFromDOMPoint(focusNode, focusOffset);
// Get text accessible containing the result node.
DocAccessible* doc =
GetAccService()->GetDocAccessible(resultNode->OwnerDoc());
Accessible* accessible = doc ?
doc->GetAccessibleOrContainer(resultNode) : nullptr;
if (!accessible) {
NS_NOTREACHED("No nsIAccessibleText for selection change event!");
return nullptr;
}
do {
HyperTextAccessible* textAcc = accessible->AsHyperText();
if (textAcc)
return textAcc;
accessible = accessible->Parent();
} while (accessible);
NS_NOTREACHED("We must reach document accessible implementing nsIAccessibleText!");
return nullptr;
}
示例7: FocusMgr
void
EventQueue::ProcessEventQueue()
{
// Process only currently queued events.
nsTArray<nsRefPtr<AccEvent> > events;
events.SwapElements(mEvents);
uint32_t eventCount = events.Length();
#ifdef A11Y_LOG
if (eventCount > 0 && logging::IsEnabled(logging::eEvents)) {
logging::MsgBegin("EVENTS", "events processing");
logging::Address("document", mDocument);
logging::MsgEnd();
}
#endif
for (uint32_t idx = 0; idx < eventCount; idx++) {
AccEvent* event = events[idx];
if (event->mEventRule != AccEvent::eDoNotEmit) {
Accessible* target = event->GetAccessible();
if (!target || target->IsDefunct())
continue;
// Dispatch the focus event if target is still focused.
if (event->mEventType == nsIAccessibleEvent::EVENT_FOCUS) {
FocusMgr()->ProcessFocusEvent(event);
continue;
}
// Dispatch caret moved and text selection change events.
if (event->mEventType == nsIAccessibleEvent::EVENT_TEXT_CARET_MOVED) {
AccCaretMoveEvent* caretMoveEvent = downcast_accEvent(event);
HyperTextAccessible* hyperText = target->AsHyperText();
if (hyperText &&
NS_SUCCEEDED(hyperText->GetCaretOffset(&caretMoveEvent->mCaretOffset))) {
nsEventShell::FireEvent(caretMoveEvent);
// There's a selection so fire selection change as well.
int32_t selectionCount;
hyperText->GetSelectionCount(&selectionCount);
if (selectionCount)
nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED,
hyperText);
}
continue;
}
// Fire selected state change events in support to selection events.
if (event->mEventType == nsIAccessibleEvent::EVENT_SELECTION_ADD) {
nsEventShell::FireEvent(event->mAccessible, states::SELECTED,
true, event->mIsFromUserInput);
} else if (event->mEventType == nsIAccessibleEvent::EVENT_SELECTION_REMOVE) {
nsEventShell::FireEvent(event->mAccessible, states::SELECTED,
false, event->mIsFromUserInput);
} else if (event->mEventType == nsIAccessibleEvent::EVENT_SELECTION) {
AccSelChangeEvent* selChangeEvent = downcast_accEvent(event);
nsEventShell::FireEvent(event->mAccessible, states::SELECTED,
(selChangeEvent->mSelChangeType == AccSelChangeEvent::eSelectionAdd),
event->mIsFromUserInput);
if (selChangeEvent->mPackedEvent) {
nsEventShell::FireEvent(selChangeEvent->mPackedEvent->mAccessible,
states::SELECTED,
(selChangeEvent->mPackedEvent->mSelChangeType == AccSelChangeEvent::eSelectionAdd),
selChangeEvent->mPackedEvent->mIsFromUserInput);
}
}
nsEventShell::FireEvent(event);
// Fire text change events.
AccMutationEvent* mutationEvent = downcast_accEvent(event);
if (mutationEvent) {
if (mutationEvent->mTextChangeEvent)
nsEventShell::FireEvent(mutationEvent->mTextChangeEvent);
}
}
if (event->mEventType == nsIAccessibleEvent::EVENT_HIDE)
mDocument->ShutdownChildrenInSubtree(event->mAccessible);
if (!mDocument)
return;
}
}