Skip to content
Permalink
Browse files
[Qt][WK2] Use movementStarted/Ended signals instead of movingChanged …
…on QtViewportInterationEngine

https://bugs.webkit.org/show_bug.cgi?id=79521

Patch by Hugo Parente Lima <hugo.lima@openbossa.org> on 2012-02-28
Reviewed by Kenneth Rohde Christiansen.

movingChanged() signal is emitted many times, so the use of movementStarted() and
movementEnded() is a better choice.

* UIProcess/qt/QtFlickProvider.cpp:
(QtFlickProvider::QtFlickProvider):
* UIProcess/qt/QtFlickProvider.h:
(QtFlickProvider):
* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine):
* UIProcess/qt/QtViewportInteractionEngine.h:
(QtViewportInteractionEngine):

Canonical link: https://commits.webkit.org/96855@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@109094 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Hugo Parente Lima authored and webkit-commit-queue committed Feb 28, 2012
1 parent d99f8ab commit 126a1ceed57f671565cd1a916500b195fa711a19
@@ -1,3 +1,22 @@
2012-02-28 Hugo Parente Lima <hugo.lima@openbossa.org>

[Qt][WK2] Use movementStarted/Ended signals instead of movingChanged on QtViewportInterationEngine
https://bugs.webkit.org/show_bug.cgi?id=79521

Reviewed by Kenneth Rohde Christiansen.

movingChanged() signal is emitted many times, so the use of movementStarted() and
movementEnded() is a better choice.

* UIProcess/qt/QtFlickProvider.cpp:
(QtFlickProvider::QtFlickProvider):
* UIProcess/qt/QtFlickProvider.h:
(QtFlickProvider):
* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::QtViewportInteractionEngine::QtViewportInteractionEngine):
* UIProcess/qt/QtViewportInteractionEngine.h:
(QtViewportInteractionEngine):

2012-02-27 Shinya Kawanaka <shinyak@chromium.org>

Element::removeShadowRoot() and setShadowRoot() should be moved into ShadowTree.
@@ -106,7 +106,8 @@ QtFlickProvider::QtFlickProvider(QQuickWebView* viewItem, QQuickWebPage* pageIte
pageItem->setParentItem(m_contentItem);

// Propagate flickable signals.
connect(m_flickable, SIGNAL(movingChanged()), SIGNAL(movingChanged()), Qt::DirectConnection);
connect(m_flickable, SIGNAL(movementStarted()), SIGNAL(movementStarted()), Qt::DirectConnection);
connect(m_flickable, SIGNAL(movementEnded()), SIGNAL(movementEnded()), Qt::DirectConnection);
connect(m_flickable, SIGNAL(flickingChanged()), SIGNAL(flickingChanged()), Qt::DirectConnection);
connect(m_flickable, SIGNAL(draggingChanged()), SIGNAL(draggingChanged()), Qt::DirectConnection);
connect(m_flickable, SIGNAL(contentWidthChanged()), SIGNAL(contentWidthChanged()), Qt::DirectConnection);
@@ -72,7 +72,8 @@ class QtFlickProvider : public QObject {
void contentHeightChanged();
void contentXChanged();
void contentYChanged();
void movingChanged();
void movementStarted();
void movementEnded();
void flickingChanged();
void draggingChanged();

@@ -125,7 +125,8 @@ QtViewportInteractionEngine::QtViewportInteractionEngine(QQuickWebView* viewport

connect(m_content, SIGNAL(widthChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection);
connect(m_content, SIGNAL(heightChanged()), SLOT(itemSizeChanged()), Qt::DirectConnection);
connect(m_flickProvider, SIGNAL(movingChanged()), SLOT(flickableMovingStateChanged()), Qt::DirectConnection);
connect(m_flickProvider, SIGNAL(movementStarted()), SLOT(flickableMoveStarted()), Qt::DirectConnection);
connect(m_flickProvider, SIGNAL(movementEnded()), SLOT(flickableMoveEnded()), Qt::DirectConnection);

connect(m_scaleAnimation, SIGNAL(valueChanged(QVariant)),
SLOT(scaleAnimationValueChanged(QVariant)), Qt::DirectConnection);
@@ -187,27 +188,19 @@ bool QtViewportInteractionEngine::animateItemRectVisible(const QRectF& itemRect)
return true;
}

void QtViewportInteractionEngine::flickableMovingStateChanged()
{
if (m_flickProvider->isMoving()) {
if (m_scrollUpdateDeferrer)
return; // We get the isMoving() signal multiple times.
panMoveStarted();
} else
panMoveEnded();
}

void QtViewportInteractionEngine::panMoveStarted()
void QtViewportInteractionEngine::flickableMoveStarted()
{
Q_ASSERT(m_flickProvider->isMoving());
m_scrollUpdateDeferrer = adoptPtr(new ViewportUpdateDeferrer(this));

m_lastScrollPosition = m_flickProvider->contentPos();
connect(m_flickProvider, SIGNAL(contentXChanged()), SLOT(flickableMovingPositionUpdate()));
connect(m_flickProvider, SIGNAL(contentYChanged()), SLOT(flickableMovingPositionUpdate()));
}

void QtViewportInteractionEngine::panMoveEnded()
void QtViewportInteractionEngine::flickableMoveEnded()
{
Q_ASSERT(!m_flickProvider->isMoving());
// This method is called on the end of the pan or pan kinetic animation.
m_scrollUpdateDeferrer.clear();

@@ -113,12 +113,14 @@ private Q_SLOTS:
// Respond to changes of content that are not driven by us, like the page resizing itself.
void itemSizeChanged();

void flickableMovingStateChanged();
void flickableMovingPositionUpdate();

void scaleAnimationStateChanged(QAbstractAnimation::State, QAbstractAnimation::State);
void scaleAnimationValueChanged(QVariant value) { setItemRectVisible(value.toRectF()); }

void flickableMoveStarted(); // Called when panning starts.
void flickableMoveEnded(); // Called when panning (+ kinetic animation) ends.

private:
friend class ViewportUpdateDeferrer;

@@ -130,9 +132,6 @@ private Q_SLOTS:
qreal innerBoundedCSSScale(qreal);
qreal outerBoundedCSSScale(qreal);

void panMoveStarted(); // Called when panning starts.
void panMoveEnded(); // Called when panning (+ kinetic animation) ends.

QRectF computePosRangeForItemAtScale(qreal itemScale) const;
bool ensureContentWithinViewportBoundary(bool immediate = false);

0 comments on commit 126a1ce

Please sign in to comment.