Exemple #1
0
void PageViewportControllerClientQt::animateContentRectVisible(const QRectF& contentRect)
{
    ASSERT(m_scaleAnimation->state() == QAbstractAnimation::Stopped);

    ASSERT(!scrollAnimationActive());
    if (scrollAnimationActive())
        return;

    QRectF viewportRectInContentCoords = m_viewportItem->mapRectToWebContent(m_viewportItem->boundingRect());
    if (contentRect == viewportRectInContentCoords) {
        m_scaleChange.end();
        updateViewportController();
        return;
    }

    // Inform the web process about the requested visible content rect immediately so that new tiles
    // are rendered at the final destination during the animation.
    m_controller->didChangeContentsVisibility(contentRect.topLeft(), viewportScaleForRect(contentRect));

    // Since we have to animate scale and position at the same time the scale animation interpolates
    // from the current viewport rect in content coordinates to a visible rect of the content.
    m_scaleAnimation->setStartValue(viewportRectInContentCoords);
    m_scaleAnimation->setEndValue(contentRect);

    m_scaleAnimation->start();
}
Exemple #2
0
void PageViewportControllerClientQt::pageItemPositionChanged()
{
    if (m_ignoreViewportChanges)
        return;

    QPointF newPosition = m_viewportItem->contentPos();

    updateViewportController(m_lastScrollPosition - newPosition);

    m_lastScrollPosition = newPosition;
}
Exemple #3
0
void PageViewportControllerClientQt::scaleAnimationStateChanged(QAbstractAnimation::State newState, QAbstractAnimation::State /*oldState*/)
{
    switch (newState) {
    case QAbstractAnimation::Running:
        m_scaleChange.begin();
        break;
    case QAbstractAnimation::Stopped:
        m_scaleChange.end();
        updateViewportController();
        break;
    default:
        break;
    }
}
Exemple #4
0
void PageViewportControllerClientQt::resumeAndUpdateContent()
{
    m_controller->resumeContent();
    // Make sure that tiles all around the viewport will be requested.
    updateViewportController();
}
Exemple #5
0
void PageViewportControllerClientQt::setContentsRectToNearestValidBounds()
{
    float targetScale = m_controller->innerBoundedViewportScale(m_pageItem->contentsScale());
    setContentRectVisiblePositionAtScale(nearestValidVisibleContentsRect().topLeft(), targetScale);
    updateViewportController();
}
Exemple #6
0
void PageViewportControllerClientQt::didResumeContent()
{
    // Make sure that tiles all around the viewport will be requested.
    updateViewportController();
}
Exemple #7
0
void PageViewportControllerClientQt::setViewportPosition(const FloatPoint& contentsPoint)
{
    QPointF newPosition((m_pageItem->position() + QPointF(contentsPoint)) * m_pageItem->contentsScale());
    m_viewportItem->setContentPos(newPosition);
    updateViewportController();
}
Exemple #8
0
void PageViewportControllerClientQt::pinchGestureCancelled()
{
    m_pinchStartScale = -1;
    m_scaleChange.end();
    updateViewportController();
}
Exemple #9
0
void PageViewportControllerClientQt::flickMoveEnded()
{
    // This method is called on the end of the pan or pan kinetic animation.
    m_scrollChange.end();
    updateViewportController();
}