Example #1
0
 EventRelatedNodeResolver(Touch& touch, TouchEventContext::TouchListType touchListType)
     : m_relatedNode(*touch.target()->toNode())
     , m_relatedNodeTreeScope(m_relatedNode.treeScope())
     , m_relatedNodeInCurrentTreeScope(nullptr)
     , m_currentTreeScope(nullptr)
     , m_touch(&touch)
     , m_touchListType(touchListType)
 {
     ASSERT(touch.target()->toNode());
 }
Example #2
0
JSValue jsTouchTarget(ExecState* exec, JSValue slotBase, const Identifier&)
{
    JSTouch* castedThis = static_cast<JSTouch*>(asObject(slotBase));
    UNUSED_PARAM(exec);
    Touch* imp = static_cast<Touch*>(castedThis->impl());
    JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->target()));
    return result;
}
Example #3
0
void EventPath::retargetTouch(TouchEventContext::TouchListType touchListType, const Touch& touch)
{
    EventTarget* eventTarget = touch.target();
    if (!eventTarget)
        return;

    Node* targetNode = eventTarget->toNode();
    if (!targetNode)
        return;

    RelatedNodeRetargeter retargeter(*targetNode, *m_path[0]->node());
    TreeScope* previousTreeScope = nullptr;
    for (auto& context : m_path) {
        Node& currentTarget = *context->node();
        TreeScope& currentTreeScope = currentTarget.treeScope();
        if (UNLIKELY(previousTreeScope && &currentTreeScope != previousTreeScope))
            retargeter.moveToNewTreeScope(previousTreeScope, currentTreeScope);

        Node* currentRelatedNode = retargeter.currentNode(currentTarget);
        downcast<TouchEventContext>(*context).touchList(touchListType)->append(touch.cloneWithNewTarget(currentRelatedNode));

        previousTreeScope = &currentTreeScope;
    }
}