void TouchEventContext::handleLocalEvents(Event* event) const
{
    ASSERT(event->isTouchEvent());
    TouchEvent* touchEvent = toTouchEvent(event);
    touchEvent->setTouches(m_touches);
    touchEvent->setTargetTouches(m_targetTouches);
    touchEvent->setChangedTouches(m_changedTouches);
}
Example #2
0
bool EventDispatcher::dispatchEvent(Node* origin, PassRefPtr<Event> prpEvent)
{
    ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
    if (!prpEvent)
        return true;

    ASSERT(origin);
    RefPtr<Node> node(origin);
    RefPtr<Event> event(prpEvent);
    RefPtr<FrameView> view = node->document().view();
    EventPath eventPath(*node, *event);

    if (EventTarget* relatedTarget = event->relatedTarget())
        eventPath.setRelatedTarget(*node, *relatedTarget);
#if ENABLE(TOUCH_EVENTS) && !PLATFORM(IOS)
    if (event->isTouchEvent()) {
        if (!eventPath.updateTouchLists(*toTouchEvent(event.get())))
            return true;
    }
#endif

    ChildNodesLazySnapshot::takeChildNodesLazySnapshot();

    event->setTarget(&eventTargetRespectingTargetRules(*node));
    ASSERT(!NoEventDispatchAssertion::isEventDispatchForbidden());
    ASSERT(event->target());
    WindowEventContext windowEventContext(node.get(), eventPath.lastContextIfExists());

    InputElementClickState clickHandlingState;
    if (isHTMLInputElement(node.get()))
        toHTMLInputElement(*node).willDispatchEvent(*event, clickHandlingState);

    if (!event->propagationStopped() && !eventPath.isEmpty())
        dispatchEventInDOM(*event, eventPath, windowEventContext);

    event->setTarget(&eventTargetRespectingTargetRules(*node));
    event->setCurrentTarget(0);
    event->setEventPhase(0);

    if (clickHandlingState.stateful)
        toHTMLInputElement(*node).didDispatchClickEvent(*event, clickHandlingState);

    // Call default event handlers. While the DOM does have a concept of preventing
    // default handling, the detail of which handlers are called is an internal
    // implementation detail and not part of the DOM.
    if (!event->defaultPrevented() && !event->defaultHandled())
        callDefaultEventHandlersInTheBubblingOrder(*event, eventPath);

    // Ensure that after event dispatch, the event's target object is the
    // outermost shadow DOM boundary.
    event->setTarget(windowEventContext.target());
    event->setCurrentTarget(0);

    return !event->defaultPrevented();
}
void TouchEventContext::handleLocalEvents(Event* event) const
{
#ifndef NDEBUG
    checkReachability(m_touches.get());
    checkReachability(m_targetTouches.get());
    checkReachability(m_changedTouches.get());
#endif
    ASSERT(event->isTouchEvent());
    TouchEvent* touchEvent = toTouchEvent(event);
    touchEvent->setTouches(m_touches);
    touchEvent->setTargetTouches(m_targetTouches);
    touchEvent->setChangedTouches(m_changedTouches);
    EventContext::handleLocalEvents(event);
}
Example #4
0
TouchEvent* TouchEventDispatchMediator::event() const
{
    return toTouchEvent(EventDispatchMediator::event());
}
Example #5
0
void SliderContainerElement::defaultEventHandler(Event* event) {
  if (event->isTouchEvent()) {
    handleTouchEvent(toTouchEvent(event));
    return;
  }
}