本文整理汇总了C++中EventTarget::hasEventListeners方法的典型用法代码示例。如果您正苦于以下问题:C++ EventTarget::hasEventListeners方法的具体用法?C++ EventTarget::hasEventListeners怎么用?C++ EventTarget::hasEventListeners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventTarget
的用法示例。
在下文中一共展示了EventTarget::hasEventListeners方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: supportsSpatialNavigationFocus
bool HTMLElement::supportsSpatialNavigationFocus() const
{
// This function checks whether the element satisfies the extended criteria
// for the element to be focusable, introduced by spatial navigation feature,
// i.e. checks if click or keyboard event handler is specified.
// This is the way to make it possible to navigate to (focus) elements
// which web designer meant for being active (made them respond to click events).
if (!document().settings() || !document().settings()->spatialNavigationEnabled())
return false;
EventTarget* target = const_cast<HTMLElement*>(this);
return target->hasEventListeners(eventNames().clickEvent)
|| target->hasEventListeners(eventNames().keydownEvent)
|| target->hasEventListeners(eventNames().keypressEvent)
|| target->hasEventListeners(eventNames().keyupEvent);
}
示例2: updateAllEventHandlers
void EventHandlerRegistry::updateAllEventHandlers(ChangeOperation op, EventTarget& target)
{
if (!target.hasEventListeners())
return;
Vector<AtomicString> eventTypes = target.eventTypes();
for (size_t i = 0; i < eventTypes.size(); ++i) {
EventHandlerClass handlerClass;
if (!eventTypeToClass(eventTypes[i], &handlerClass))
continue;
if (op == RemoveAll) {
updateEventHandlerInternal(op, handlerClass, &target);
continue;
}
for (unsigned count = target.getEventListeners(eventTypes[i]).size(); count > 0; --count)
updateEventHandlerInternal(op, handlerClass, &target);
}
}