Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (144232 => 144233)
--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-02-27 21:23:05 UTC (rev 144232)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp 2013-02-27 21:30:16 UTC (rev 144233)
@@ -407,7 +407,7 @@
, m_minimumScale(-1.0)
, m_maximumScale(-1.0)
, m_forceRespectViewportArguments(false)
- , m_blockZoomFinalScale(1.0)
+ , m_finalAnimationScale(1.0)
, m_anchorInNodeRectRatio(-1, -1)
, m_currentBlockZoomNode(0)
, m_currentBlockZoomAdjustedNode(0)
@@ -2983,7 +2983,7 @@
if (!m_mainFrame)
return;
- IntPoint anchor(roundUntransformedPoint(m_finalBlockPoint));
+ IntPoint anchor(roundUntransformedPoint(m_finalAnimationDocumentScrollPosition));
bool willUseTextReflow = false;
#if ENABLE(VIEWPORT_REFLOW)
@@ -2993,7 +2993,7 @@
#endif
TransformationMatrix zoom;
- zoom.scale(m_blockZoomFinalScale);
+ zoom.scale(m_finalAnimationScale);
*m_transformationMatrix = zoom;
// FIXME: Do we really need to suspend/resume both backingstore and screen here?
m_backingStore->d->suspendBackingStoreUpdates();
@@ -3012,7 +3012,7 @@
if (willUseTextReflow && m_shouldReflowBlock) {
IntRect reflowedRect = rectForNode(m_currentBlockZoomAdjustedNode.get());
reflowedRect = adjustRectOffsetForFrameOffset(reflowedRect, m_currentBlockZoomAdjustedNode.get());
- reflowedRect.move(roundTransformedPoint(m_finalBlockPointReflowOffset).x(), roundTransformedPoint(m_finalBlockPointReflowOffset).y());
+ reflowedRect.move(roundTransformedPoint(m_finalAnimationDocumentScrollPositionReflowOffset).x(), roundTransformedPoint(m_finalAnimationDocumentScrollPositionReflowOffset).y());
RenderObject* renderer = m_currentBlockZoomAdjustedNode->renderer();
IntPoint topLeftPoint(reflowedRect.location());
if (renderer && renderer->isText()) {
@@ -3049,7 +3049,7 @@
} else if (willUseTextReflow) {
IntRect finalRect = rectForNode(m_currentBlockZoomAdjustedNode.get());
finalRect = adjustRectOffsetForFrameOffset(finalRect, m_currentBlockZoomAdjustedNode.get());
- setScrollPosition(IntPoint(0, finalRect.y() + m_finalBlockPointReflowOffset.y()));
+ setScrollPosition(IntPoint(0, finalRect.y() + m_finalAnimationDocumentScrollPositionReflowOffset.y()));
resetBlockZoom();
}
#endif
@@ -4693,17 +4693,17 @@
if (newBlockHeight <= scaledViewportHeight) {
// The block fits in the viewport so center it.
- d->m_finalBlockPoint = FloatPoint(anchor.x() - dx, anchor.y() - dy);
+ d->m_finalAnimationDocumentScrollPosition = FloatPoint(anchor.x() - dx, anchor.y() - dy);
} else {
// The block is longer than the viewport so top align it and add 3 pixel margin.
- d->m_finalBlockPoint = FloatPoint(anchor.x() - dx, anchor.y() - 3);
+ d->m_finalAnimationDocumentScrollPosition = FloatPoint(anchor.x() - dx, anchor.y() - 3);
}
#if ENABLE(VIEWPORT_REFLOW)
// We don't know how long the reflowed block will be so we position it at the top of the screen with a small margin.
if (settings()->textReflowMode() != WebSettings::TextReflowDisabled) {
- d->m_finalBlockPoint = FloatPoint(anchor.x() - dx, anchor.y() - 3);
- d->m_finalBlockPointReflowOffset = FloatPoint(-dx, -3);
+ d->m_finalAnimationDocumentScrollPosition = FloatPoint(anchor.x() - dx, anchor.y() - 3);
+ d->m_finalAnimationDocumentScrollPositionReflowOffset = FloatPoint(-dx, -3);
}
#endif
@@ -4711,25 +4711,25 @@
// not be the same as the original node rect, and it could force the original node rect off the screen.
FloatRect br(anchor, FloatSize(scaledViewportWidth, scaledViewportHeight));
if (!br.contains(IntPoint(documentTargetPoint))) {
- d->m_finalBlockPointReflowOffset.move(0, (documentTargetPoint.y() - scaledViewportHeight / 2) - d->m_finalBlockPoint.y());
- d->m_finalBlockPoint = FloatPoint(d->m_finalBlockPoint.x(), documentTargetPoint.y() - scaledViewportHeight / 2);
+ d->m_finalAnimationDocumentScrollPositionReflowOffset.move(0, (documentTargetPoint.y() - scaledViewportHeight / 2) - d->m_finalAnimationDocumentScrollPosition.y());
+ d->m_finalAnimationDocumentScrollPosition = FloatPoint(d->m_finalAnimationDocumentScrollPosition.x(), documentTargetPoint.y() - scaledViewportHeight / 2);
}
// Clamp the finalBlockPoint to not cause any overflow scrolling.
- if (d->m_finalBlockPoint.x() < 0) {
- d->m_finalBlockPoint.setX(0);
- d->m_finalBlockPointReflowOffset.setX(0);
- } else if (d->m_finalBlockPoint.x() + scaledViewportWidth > d->contentsSize().width()) {
- d->m_finalBlockPoint.setX(d->contentsSize().width() - scaledViewportWidth);
- d->m_finalBlockPointReflowOffset.setX(0);
+ if (d->m_finalAnimationDocumentScrollPosition.x() < 0) {
+ d->m_finalAnimationDocumentScrollPosition.setX(0);
+ d->m_finalAnimationDocumentScrollPositionReflowOffset.setX(0);
+ } else if (d->m_finalAnimationDocumentScrollPosition.x() + scaledViewportWidth > d->contentsSize().width()) {
+ d->m_finalAnimationDocumentScrollPosition.setX(d->contentsSize().width() - scaledViewportWidth);
+ d->m_finalAnimationDocumentScrollPositionReflowOffset.setX(0);
}
- if (d->m_finalBlockPoint.y() < 0) {
- d->m_finalBlockPoint.setY(0);
- d->m_finalBlockPointReflowOffset.setY(0);
- } else if (d->m_finalBlockPoint.y() + scaledViewportHeight > d->contentsSize().height()) {
- d->m_finalBlockPoint.setY(d->contentsSize().height() - scaledViewportHeight);
- d->m_finalBlockPointReflowOffset.setY(0);
+ if (d->m_finalAnimationDocumentScrollPosition.y() < 0) {
+ d->m_finalAnimationDocumentScrollPosition.setY(0);
+ d->m_finalAnimationDocumentScrollPositionReflowOffset.setY(0);
+ } else if (d->m_finalAnimationDocumentScrollPosition.y() + scaledViewportHeight > d->contentsSize().height()) {
+ d->m_finalAnimationDocumentScrollPosition.setY(d->contentsSize().height() - scaledViewportHeight);
+ d->m_finalAnimationDocumentScrollPositionReflowOffset.setY(0);
}
// Don't block zoom if the user is zooming and the new scale is only marginally different from the
@@ -4737,7 +4737,7 @@
// that the zoom level is the minimumScale.
if (!endOfBlockZoomMode && abs(newScale - oldScale) / oldScale < minimumExpandingRatio) {
const double minimumDisplacement = minimumExpandingRatio * webkitThreadViewportAccessor()->documentViewportSize().width();
- if (oldScale == d->minimumScale() || (distanceBetweenPoints(d->scrollPosition(), roundUntransformedPoint(d->m_finalBlockPoint)) < minimumDisplacement && abs(newScale - oldScale) / oldScale < 0.10)) {
+ if (oldScale == d->minimumScale() || (distanceBetweenPoints(d->scrollPosition(), roundUntransformedPoint(d->m_finalAnimationDocumentScrollPosition)) < minimumDisplacement && abs(newScale - oldScale) / oldScale < 0.10)) {
if (isFirstZoom) {
d->resetBlockZoom();
return false;
@@ -4748,12 +4748,12 @@
}
}
- d->m_blockZoomFinalScale = newScale;
+ d->m_finalAnimationScale = newScale;
// We set this here to make sure we don't try to re-render the page at a different zoom level during loading.
d->m_userPerformedManualZoom = true;
d->m_userPerformedManualScroll = true;
- d->m_client->animateBlockZoom(d->m_blockZoomFinalScale, d->m_finalBlockPoint);
+ d->m_client->animateBlockZoom(d->m_finalAnimationScale, d->m_finalAnimationDocumentScrollPosition);
return true;
}
@@ -6318,5 +6318,24 @@
#endif
}
+void WebPagePrivate::animateToScaleAndDocumentScrollPosition(double destinationZoomScale, const WebCore::FloatPoint& destinationScrollPosition, bool shouldConstrainScrollingToContentEdge)
+{
+ if (destinationScrollPosition == scrollPosition() && destinationZoomScale == currentScale())
+ return;
+
+ m_finalAnimationDocumentScrollPosition = destinationScrollPosition;
+ m_finalAnimationScale = destinationZoomScale;
+ m_shouldReflowBlock = false;
+ m_userPerformedManualZoom = true;
+ m_userPerformedManualScroll = true;
+ m_shouldConstrainScrollingToContentEdge = shouldConstrainScrollingToContentEdge;
+ client()->animateBlockZoom(destinationZoomScale, destinationScrollPosition);
}
+
+void WebPage::animateToScaleAndDocumentScrollPosition(double destinationZoomScale, const BlackBerry::Platform::FloatPoint& destinationScrollPosition, bool shouldConstrainScrollingToContentEdge)
+{
+ d->animateToScaleAndDocumentScrollPosition(destinationZoomScale, destinationScrollPosition, shouldConstrainScrollingToContentEdge);
}
+
+}
+}
Modified: trunk/Source/WebKit/blackberry/Api/WebPage_p.h (144232 => 144233)
--- trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2013-02-27 21:23:05 UTC (rev 144232)
+++ trunk/Source/WebKit/blackberry/Api/WebPage_p.h 2013-02-27 21:30:16 UTC (rev 144233)
@@ -471,6 +471,8 @@
NotificationManager& notificationManager() { return m_notificationManager; };
#endif
+ void animateToScaleAndDocumentScrollPosition(double destinationZoomScale, const WebCore::FloatPoint& destinationScrollPosition, bool shouldConstrainScrollingToContentEdge = true);
+
WebPage* m_webPage;
WebPageClient* m_client;
WebCore::InspectorClientBlackBerry* m_inspectorClient;
@@ -540,10 +542,10 @@
double m_maximumScale;
bool m_forceRespectViewportArguments;
- // Block zoom animation data.
- WebCore::FloatPoint m_finalBlockPoint;
- WebCore::FloatPoint m_finalBlockPointReflowOffset;
- double m_blockZoomFinalScale;
+ // Block zoom & zoom/scroll animation data.
+ WebCore::FloatPoint m_finalAnimationDocumentScrollPosition;
+ WebCore::FloatPoint m_finalAnimationDocumentScrollPositionReflowOffset;
+ double m_finalAnimationScale;
RefPtr<WebCore::Node> m_currentPinchZoomNode;
WebCore::FloatPoint m_anchorInNodeRectRatio;
RefPtr<WebCore::Node> m_currentBlockZoomNode;
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp (144232 => 144233)
--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2013-02-27 21:23:05 UTC (rev 144232)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp 2013-02-27 21:30:16 UTC (rev 144233)
@@ -1381,22 +1381,13 @@
}
}
- if (destinationScrollLocation != mainFrameView->scrollPosition() || zoomScaleRequired != m_webPage->currentScale()) {
- InputLog(Platform::LogLevelInfo,
- "InputHandler::ensureFocusTextElementVisible zooming in to %f from %f and scrolling to point %s from %s",
- zoomScaleRequired, m_webPage->currentScale(),
- Platform::IntPoint(destinationScrollLocation).toString().c_str(),
- Platform::IntPoint(mainFrameView->scrollPosition()).toString().c_str());
+ InputLog(Platform::LogLevelInfo,
+ "InputHandler::ensureFocusTextElementVisible zooming in to %f from %f and scrolling to point %s from %s",
+ zoomScaleRequired, m_webPage->currentScale(),
+ Platform::IntPoint(destinationScrollLocation).toString().c_str(),
+ Platform::IntPoint(mainFrameView->scrollPosition()).toString().c_str());
- // Animate to given scroll position & zoom level
- m_webPage->m_finalBlockPoint = WebCore::FloatPoint(destinationScrollLocation);
- m_webPage->m_blockZoomFinalScale = zoomScaleRequired;
- m_webPage->m_shouldReflowBlock = false;
- m_webPage->m_userPerformedManualZoom = true;
- m_webPage->m_userPerformedManualScroll = true;
- m_webPage->m_shouldConstrainScrollingToContentEdge = shouldConstrainScrollingToContentEdge;
- m_webPage->client()->animateBlockZoom(zoomScaleRequired, m_webPage->m_finalBlockPoint);
- }
+ m_webPage->animateToScaleAndDocumentScrollPosition(zoomScaleRequired, WebCore::FloatPoint(destinationScrollLocation), shouldConstrainScrollingToContentEdge);
}
void InputHandler::ensureFocusPluginElementVisible()