/* * This is called for all changes of item scale, width or height. * This is called when interacting, ie. during for instance pinch-zooming. * * FIXME: This is currently called twice if you concurrently change width and height. */ void QtViewportInteractionEngine::itemSizeChanged() { if (m_suspendCount) return; setItemRectVisible(nearestValidBounds()); }
void QtViewportHandler::pageContentsSizeChanged(const QSize& newSize, const QSize& viewportSize) { if (viewportSize.isEmpty()) return; float minimumScale = WebCore::computeMinimumScaleFactorForContentContained(m_rawAttributes, viewportSize, newSize); if (!qFuzzyCompare(minimumScale, m_rawAttributes.minimumScale)) { m_minimumScale = minimumScale; emit m_viewportItem->experimental()->test()->viewportChanged(); if (!m_hadUserInteraction && !m_hasSuspendedContent) { // Emits contentsScaleChanged(); setCSSScale(minimumScale); } } // Emit for testing purposes, so that it can be verified that // we didn't do scale adjustment. emit m_viewportItem->experimental()->test()->contentsScaleCommitted(); if (!m_hasSuspendedContent) { ViewportUpdateDeferrer guard(this); setPageItemRectVisible(nearestValidBounds()); } }
void QtViewportHandler::pinchGestureEnded() { ASSERT(m_suspendCount); if (!m_allowsUserScaling) return; m_pinchStartScale = -1; animatePageItemRectVisible(nearestValidBounds()); m_scaleUpdateDeferrer.clear(); // Clear after starting potential animation, which takes over deferring. }
void QtViewportInteractionEngine::cancelScrollAnimation() { if (!scrollAnimationActive()) return; // If the pan gesture recognizer receives a touch begin event // during an ongoing kinetic scroll animation of a previous // pan gesture, the animation is stopped and the content is // immediately positioned back to valid boundaries. m_viewport->cancelFlick(); setItemRectVisible(nearestValidBounds()); }