Exemplo n.º 1
0
bool WebCompositorInputHandlerImpl::touchpadFlingScroll(const WebPoint& increment)
{
    WebMouseWheelEvent syntheticWheel;
    syntheticWheel.type = WebInputEvent::MouseWheel;
    syntheticWheel.deltaX = increment.x;
    syntheticWheel.deltaY = increment.y;
    syntheticWheel.hasPreciseScrollingDeltas = true;
    syntheticWheel.x = m_flingParameters.point.x;
    syntheticWheel.y = m_flingParameters.point.y;
    syntheticWheel.globalX = m_flingParameters.globalPoint.x;
    syntheticWheel.globalY = m_flingParameters.globalPoint.y;
    syntheticWheel.modifiers = m_flingParameters.modifiers;

    WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(syntheticWheel);
    switch (disposition) {
    case DidHandle:
        return true;
    case DropEvent:
        break;
    case DidNotHandle:
        TRACE_EVENT_INSTANT0("webkit", "WebCompositorInputHandlerImpl::scrollBy::AbortFling");
        // If we got a DidNotHandle, that means we need to deliver wheels on the main thread.
        // In this case we need to schedule a commit and transfer the fling curve over to the main
        // thread and run the rest of the wheels from there.
        // This can happen when flinging a page that contains a scrollable subarea that we can't
        // scroll on the thread if the fling starts outside the subarea but then is flung "under" the
        // pointer.
        m_client->transferActiveWheelFlingAnimation(m_flingParameters);
        m_flingActiveOnMainThread = true;
        cancelCurrentFling();
        break;
    }

    return false;
}
Exemplo n.º 2
0
void WebCompositorInputHandlerImpl::scrollBy(const IntPoint& increment)
{
    if (increment == IntPoint::zero())
        return;

    TRACE_EVENT2("cc", "WebCompositorInputHandlerImpl::scrollBy", "x", increment.x(), "y", increment.y());

    WebMouseWheelEvent event;
    event.type = WebInputEvent::MouseWheel;
    event.deltaX = -increment.x();
    event.deltaY = -increment.y();
    event.hasPreciseScrollingDeltas = true;
    event.x = m_wheelFlingPoint.x();
    event.y = m_wheelFlingPoint.y();

    WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event);
    switch (disposition) {
    case DidHandle:
    case DropEvent:
        break;
    case DidNotHandle:
        TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::scrollBy::AbortFling");
        // FIXME: If we got a DidNotHandle, that means we need to deliver wheels on the main thread.
        // In this case we need to schedule a commit and transfer the fling curve over to the main
        // thread and run the rest of the wheels from there.
        // This can happen when flinging a page that contains a scrollable subarea that we can't
        // scroll on the thread if the fling starts outside the subarea but then is flung "under" the
        // pointer.
        // For now, just abort the fling.
        cancelCurrentFling();
    }
}
void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event)
{
    ASSERT(m_client);

    WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event);
    switch (disposition) {
    case DidHandle:
        m_client->didHandleInputEvent();
        break;
    case DidNotHandle:
        m_client->didNotHandleInputEvent(true /* sendToWidget */);
        break;
    case DropEvent:
        m_client->didNotHandleInputEvent(false /* sendToWidget */);
        break;
    }
}
Exemplo n.º 4
0
void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event)
{
    ASSERT(m_client);

    WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event);
    switch (disposition) {
    case DidHandle:
        m_client->didHandleInputEvent();
        break;
    case DidNotHandle:
        m_client->didNotHandleInputEvent(true /* sendToWidget */);
        break;
    case DropEvent:
        m_client->didNotHandleInputEvent(false /* sendToWidget */);
        break;
    }
    if (event.modifiers & WebInputEvent::IsLastInputEventForCurrentVSync)
        m_inputHandlerClient->didReceiveLastInputEventForVSync();
}