本文整理汇总了C++中EventPath::append方法的典型用法代码示例。如果您正苦于以下问题:C++ EventPath::append方法的具体用法?C++ EventPath::append怎么用?C++ EventPath::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventPath
的用法示例。
在下文中一共展示了EventPath::append方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calculateEventPath
void EventRetargeter::calculateEventPath(Node* targetNode, Event* event, EventPath& eventPath)
{
bool inDocument = targetNode->inDocument();
bool isSVGElement = targetNode->isSVGElement();
bool isMouseOrFocusEvent = event->isMouseEvent() || event->isFocusEvent();
#if ENABLE(TOUCH_EVENTS)
bool isTouchEvent = event->isTouchEvent();
#endif
Vector<EventTarget*, 32> targetStack;
for (Node* node = nodeOrHostIfPseudoElement(targetNode); node; node = node->parentOrShadowHostNode()) {
if (targetStack.isEmpty())
targetStack.append(eventTargetRespectingTargetRules(node));
if (isMouseOrFocusEvent)
eventPath.append(adoptPtr(new MouseOrFocusEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
#if ENABLE(TOUCH_EVENTS)
else if (isTouchEvent)
eventPath.append(adoptPtr(new TouchEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
#endif
else
eventPath.append(adoptPtr(new EventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
if (!inDocument)
return;
if (!node->isShadowRoot())
continue;
if (determineDispatchBehavior(event, toShadowRoot(node), targetStack.last()) == StayInsideShadowDOM)
return;
if (!isSVGElement) {
ASSERT(!targetStack.isEmpty());
targetStack.removeLast();
}
}
}
示例2: calculateEventPath
void EventRetargeter::calculateEventPath(Node* node, Event* event, EventPath& eventPath)
{
bool inDocument = node->inDocument();
bool isSVGElement = node->isSVGElement();
bool isMouseOrFocusEvent = event->isMouseEvent() || event->isFocusEvent();
#if ENABLE(TOUCH_EVENTS)
bool isTouchEvent = event->isTouchEvent();
#endif
Vector<EventTarget*, 32> targetStack;
for (EventPathWalker walker(node); walker.node(); walker.moveToParent()) {
Node* node = walker.node();
if (targetStack.isEmpty())
targetStack.append(eventTargetRespectingTargetRules(node));
else if (walker.isVisitingInsertionPointInReprojection())
targetStack.append(targetStack.last());
if (isMouseOrFocusEvent)
eventPath.append(adoptPtr(new MouseOrFocusEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
#if ENABLE(TOUCH_EVENTS)
else if (isTouchEvent)
eventPath.append(adoptPtr(new TouchEventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
#endif
else
eventPath.append(adoptPtr(new EventContext(node, eventTargetRespectingTargetRules(node), targetStack.last())));
if (!inDocument)
return;
if (!node->isShadowRoot())
continue;
if (determineDispatchBehavior(event, toShadowRoot(node), targetStack.last()) == StayInsideShadowDOM)
return;
if (!isSVGElement) {
ASSERT(!targetStack.isEmpty());
targetStack.removeLast();
}
}
}