当前位置: 首页>>代码示例>>C++>>正文


C++ EventDispatcher::node方法代码示例

本文整理汇总了C++中EventDispatcher::node方法的典型用法代码示例。如果您正苦于以下问题:C++ EventDispatcher::node方法的具体用法?C++ EventDispatcher::node怎么用?C++ EventDispatcher::node使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventDispatcher的用法示例。


在下文中一共展示了EventDispatcher::node方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dispatchEvent

bool MouseEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
{
    if (isSyntheticMouseEvent()) {
        event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().relatedTarget());
        return dispatcher.dispatch();
    }

    if (isDisabledFormControl(&dispatcher.node()))
        return false;

    if (event().type().isEmpty())
        return true; // Shouldn't happen.

    ASSERT(!event().target() || event().target() != event().relatedTarget());

    EventTarget* relatedTarget = event().relatedTarget();
    event().eventPath().adjustForRelatedTarget(dispatcher.node(), relatedTarget);

    dispatcher.dispatch();
    bool swallowEvent = event().defaultHandled() || event().defaultPrevented();

    if (event().type() != EventTypeNames::click || event().detail() != 2)
        return !swallowEvent;

    // Special case: If it's a double click event, we also send the dblclick event. This is not part
    // of the DOM specs, but is used for compatibility with the ondblclick="" attribute. This is treated
    // as a separate event in other DOM-compliant browsers like Firefox, and so we do the same.
    RefPtrWillBeRawPtr<MouseEvent> doubleClickEvent = MouseEvent::create();
    doubleClickEvent->initMouseEvent(nullptr, EventTypeNames::dblclick, event().bubbles(), event().cancelable(), event().view(),
        event().detail(), event().screenX(), event().screenY(), event().clientX(), event().clientY(),
        event().ctrlKey(), event().altKey(), event().shiftKey(), event().metaKey(),
        event().button(), relatedTarget, event().buttons());
    if (event().defaultHandled())
        doubleClickEvent->setDefaultHandled();
    EventDispatcher::dispatchEvent(dispatcher.node(), MouseEventDispatchMediator::create(doubleClickEvent));
    if (doubleClickEvent->defaultHandled() || doubleClickEvent->defaultPrevented())
        return false;
    return !swallowEvent;
}
开发者ID:kingysu,项目名称:blink-crosswalk,代码行数:39,代码来源:MouseEvent.cpp

示例2: dispatchEvent

bool DragEventDispatchMediator::dispatchEvent(EventDispatcher& dispatcher) const
{
    event().eventPath().adjustForRelatedTarget(dispatcher.node(), event().relatedTarget());
    return EventDispatchMediator::dispatchEvent(dispatcher);
}
开发者ID:smishenk,项目名称:chromium-crosswalk,代码行数:5,代码来源:DragEvent.cpp


注:本文中的EventDispatcher::node方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。