- Revision
- 98474
- Author
- abe...@webkit.org
- Date
- 2011-10-26 06:50:05 -0700 (Wed, 26 Oct 2011)
Log Message
[Qt][WK2] Rename clean-up of QtPinchGestureRecognizer and QtViewportInteractionEngine
https://bugs.webkit.org/show_bug.cgi?id=70903
Reviewed by Kenneth Rohde Christiansen.
Rename computeTouchCenter to computePinchCenter,
and use the plural form of coordinate where appropriate.
* UIProcess/API/qt/qtouchwebview.cpp:
(QTouchWebViewPrivate::_q_viewportUpdated):
* UIProcess/qt/QtPinchGestureRecognizer.cpp:
(WebKit::computePinchCenter):
(WebKit::QtPinchGestureRecognizer::recognize):
* UIProcess/qt/QtViewportInteractionEngine.cpp:
(WebKit::contentRectInViewportCoordinates):
(WebKit::QtViewportInteractionEngine::event):
(WebKit::QtViewportInteractionEngine::pinchGestureStarted):
(WebKit::QtViewportInteractionEngine::pinchGestureRequestUpdate):
(WebKit::QtViewportInteractionEngine::scaleContent):
* UIProcess/qt/QtViewportInteractionEngine.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (98473 => 98474)
--- trunk/Source/WebKit2/ChangeLog 2011-10-26 13:34:27 UTC (rev 98473)
+++ trunk/Source/WebKit2/ChangeLog 2011-10-26 13:50:05 UTC (rev 98474)
@@ -1,3 +1,26 @@
+2011-10-26 Andras Becsi <andras.be...@nokia.com>
+
+ [Qt][WK2] Rename clean-up of QtPinchGestureRecognizer and QtViewportInteractionEngine
+ https://bugs.webkit.org/show_bug.cgi?id=70903
+
+ Reviewed by Kenneth Rohde Christiansen.
+
+ Rename computeTouchCenter to computePinchCenter,
+ and use the plural form of coordinate where appropriate.
+
+ * UIProcess/API/qt/qtouchwebview.cpp:
+ (QTouchWebViewPrivate::_q_viewportUpdated):
+ * UIProcess/qt/QtPinchGestureRecognizer.cpp:
+ (WebKit::computePinchCenter):
+ (WebKit::QtPinchGestureRecognizer::recognize):
+ * UIProcess/qt/QtViewportInteractionEngine.cpp:
+ (WebKit::contentRectInViewportCoordinates):
+ (WebKit::QtViewportInteractionEngine::event):
+ (WebKit::QtViewportInteractionEngine::pinchGestureStarted):
+ (WebKit::QtViewportInteractionEngine::pinchGestureRequestUpdate):
+ (WebKit::QtViewportInteractionEngine::scaleContent):
+ * UIProcess/qt/QtViewportInteractionEngine.h:
+
2011-10-26 Zalan Bujtas <zbuj...@gmail.com>
Name viewport change event consistently.
Modified: trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp (98473 => 98474)
--- trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp 2011-10-26 13:34:27 UTC (rev 98473)
+++ trunk/Source/WebKit2/UIProcess/API/qt/qtouchwebview.cpp 2011-10-26 13:50:05 UTC (rev 98474)
@@ -49,9 +49,9 @@
void QTouchWebViewPrivate::_q_viewportUpdated()
{
- const QRectF visibleRectInPageViewCoordinate = q->mapRectToItem(pageView.data(), q->boundingRect()).intersected(pageView->boundingRect());
+ const QRectF visibleRectInPageViewCoordinates = q->mapRectToItem(pageView.data(), q->boundingRect()).intersected(pageView->boundingRect());
float scale = pageView->scale();
- page.setVisibleContentRectAndScale(visibleRectInPageViewCoordinate, scale);
+ page.setVisibleContentRectAndScale(visibleRectInPageViewCoordinates, scale);
}
void QTouchWebViewPrivate::_q_viewportTrajectoryVectorChanged(const QPointF& trajectoryVector)
Modified: trunk/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp (98473 => 98474)
--- trunk/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp 2011-10-26 13:34:27 UTC (rev 98473)
+++ trunk/Source/WebKit2/UIProcess/qt/QtPinchGestureRecognizer.cpp 2011-10-26 13:50:05 UTC (rev 98474)
@@ -44,7 +44,7 @@
return -1;
}
-static inline QPointF computeTouchCenter(const QTouchEvent::TouchPoint& point1, const QTouchEvent::TouchPoint& point2)
+static inline QPointF computePinchCenter(const QTouchEvent::TouchPoint& point1, const QTouchEvent::TouchPoint& point2)
{
return (point1.pos() + point2.pos()) / 2.0f;
}
@@ -96,7 +96,7 @@
if (pinchDistance < pinchInitialTriggerDistanceThreshold)
return false;
m_state = GestureRecognized;
- m_viewportInteractionEngine->pinchGestureStarted(computeTouchCenter(point1, point2));
+ m_viewportInteractionEngine->pinchGestureStarted(computePinchCenter(point1, point2));
// We reset the initial position to the previous position in order to avoid the jump caused
// by skipping all the events between the beginning and when the threshold is hit.
@@ -109,8 +109,8 @@
const qreal currentSpanDistance = QLineF(point1.screenPos(), point2.screenPos()).length();
const qreal initialSpanDistance = QLineF(m_point1.initialScreenPosition, m_point2.initialScreenPosition).length();
const qreal totalScaleFactor = currentSpanDistance / initialSpanDistance;
- const QPointF touchCenterInPageViewCoordinate = computeTouchCenter(point1, point2);
- m_viewportInteractionEngine->pinchGestureRequestUpdate(touchCenterInPageViewCoordinate, totalScaleFactor);
+ const QPointF touchCenterInPageViewCoordinates = computePinchCenter(point1, point2);
+ m_viewportInteractionEngine->pinchGestureRequestUpdate(touchCenterInPageViewCoordinates, totalScaleFactor);
return true;
break;
}
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp (98473 => 98474)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp 2011-10-26 13:34:27 UTC (rev 98473)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp 2011-10-26 13:50:05 UTC (rev 98474)
@@ -33,7 +33,7 @@
static const int kScaleAnimationDurationMillis = 400;
-static inline QRectF contentRectInViewportCoordinate(const QSGItem* content, const QSGItem* viewport)
+static inline QRectF contentRectInViewportCoordinates(const QSGItem* content, const QSGItem* viewport)
{
return viewport->mapRectFromItem(content, content->boundingRect());
}
@@ -158,7 +158,7 @@
case QEvent::ScrollPrepare: {
QScrollPrepareEvent* prepareEvent = static_cast<QScrollPrepareEvent*>(event);
const QRectF viewportRect = m_viewport->boundingRect();
- const QRectF contentRect = contentRectInViewportCoordinate(m_content, m_viewport);
+ const QRectF contentRect = contentRectInViewportCoordinates(m_content, m_viewport);
const QRectF contentPositionRange = calculateBoundariesForScale(contentRect.size(), viewportRect.size(), 1);
prepareEvent->setContentPosRange(contentPositionRange);
prepareEvent->setViewportSize(viewportRect.size());
@@ -312,13 +312,13 @@
scroller()->handleInput(QScroller::InputRelease, m_viewport->mapFromItem(m_content, touchPoint), eventTimestampMillis);
}
-void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenterInContentCoordinate)
+void QtViewportInteractionEngine::pinchGestureStarted(const QPointF& pinchCenterInContentCoordinates)
{
if (!m_constraints.isUserScalable)
return;
m_pinchViewportUpdateDeferrer = adoptPtr(new ViewportUpdateGuard(this));
- m_lastPinchCenterInViewportCoordinates = m_viewport->mapFromItem(m_content, pinchCenterInContentCoordinate);
+ m_lastPinchCenterInViewportCoordinates = m_viewport->mapFromItem(m_content, pinchCenterInContentCoordinates);
m_userInteractionFlags |= UserHasScaledContent;
m_userInteractionFlags |= UserHasMovedContent;
m_pinchStartScale = m_content->scale();
@@ -327,7 +327,7 @@
emit viewportTrajectoryVectorChanged(QPointF());
}
-void QtViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinchCenterInContentCoordinate, qreal totalScaleFactor)
+void QtViewportInteractionEngine::pinchGestureRequestUpdate(const QPointF& pinchCenterInContentCoordinates, qreal totalScaleFactor)
{
if (!m_constraints.isUserScalable)
return;
@@ -341,9 +341,9 @@
// Allow zooming out beyond mimimum scale on pages that do not explicitly disallow it.
const qreal boundedScale = outerBoundedScale(scale);
- QPointF pinchCenterInViewportCoordinates = m_viewport->mapFromItem(m_content, pinchCenterInContentCoordinate);
+ QPointF pinchCenterInViewportCoordinates = m_viewport->mapFromItem(m_content, pinchCenterInContentCoordinates);
- scaleContent(pinchCenterInContentCoordinate, boundedScale);
+ scaleContent(pinchCenterInContentCoordinates, boundedScale);
const QPointF positionDiff = pinchCenterInViewportCoordinates - m_lastPinchCenterInViewportCoordinates;
m_lastPinchCenterInViewportCoordinates = pinchCenterInViewportCoordinates;
@@ -370,11 +370,11 @@
animateContentIntoBoundariesIfNeeded();
}
-void QtViewportInteractionEngine::scaleContent(const QPointF& centerInContentCoordinate, qreal scale)
+void QtViewportInteractionEngine::scaleContent(const QPointF& centerInContentCoordinates, qreal scale)
{
- QPointF oldPinchCenterOnParent = m_content->mapToItem(m_content->parentItem(), centerInContentCoordinate);
+ QPointF oldPinchCenterOnParent = m_content->mapToItem(m_content->parentItem(), centerInContentCoordinates);
m_content->setScale(scale);
- QPointF newPinchCenterOnParent = m_content->mapToItem(m_content->parentItem(), centerInContentCoordinate);
+ QPointF newPinchCenterOnParent = m_content->mapToItem(m_content->parentItem(), centerInContentCoordinates);
m_content->setPos(m_content->pos() - (newPinchCenterOnParent - oldPinchCenterOnParent));
}
Modified: trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h (98473 => 98474)
--- trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h 2011-10-26 13:34:27 UTC (rev 98473)
+++ trunk/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.h 2011-10-26 13:50:05 UTC (rev 98474)
@@ -70,8 +70,8 @@
void panGestureCancelled();
void panGestureEnded(const QPointF& touchPoint, qint64 eventTimestampMillis);
- void pinchGestureStarted(const QPointF& pinchCenterInContentCoordinate);
- void pinchGestureRequestUpdate(const QPointF& pinchCenterInContentCoordinate, qreal totalScaleFactor);
+ void pinchGestureStarted(const QPointF& pinchCenterInContentCoordinates);
+ void pinchGestureRequestUpdate(const QPointF& pinchCenterInContentCoordinates, qreal totalScaleFactor);
void pinchGestureEnded();
void stopAnimations();
@@ -91,7 +91,7 @@
const QRectF calculateBoundariesForScale(const QSizeF contentSize, const QSizeF viewportSize, qreal scale);
void animateContentIntoBoundariesIfNeeded();
- void scaleContent(const QPointF& centerInContentCoordinate, qreal scale);
+ void scaleContent(const QPointF& centerInContentCoordinates, qreal scale);
// As long as the object exists this function will always return the same QScroller instance.
QScroller* scroller() { return QScroller::scroller(this); }