Index: Source/core/frame/PinchViewport.cpp |
diff --git a/Source/core/frame/PinchViewport.cpp b/Source/core/frame/PinchViewport.cpp |
index 505a8895eadcbeeb9a3b05a04fe97c3095d78f88..1b9e37faa9d087cfd521209e01b9497566d3e9e1 100644 |
--- a/Source/core/frame/PinchViewport.cpp |
+++ b/Source/core/frame/PinchViewport.cpp |
@@ -64,8 +64,8 @@ namespace WebCore { |
PinchViewport::PinchViewport(FrameHost& owner) |
: m_frameHost(owner) |
- , m_scale(1) |
{ |
+ reset(); |
} |
PinchViewport::~PinchViewport() { } |
@@ -91,6 +91,12 @@ void PinchViewport::setSize(const IntSize& size) |
setupScrollbar(WebScrollbar::Vertical); |
} |
+void PinchViewport::reset() |
+{ |
+ setLocation(FloatPoint()); |
+ setScale(1); |
+} |
+ |
void PinchViewport::mainFrameDidChangeSize() |
{ |
// In unit tests we may not have initialized the layer tree. |
@@ -120,12 +126,20 @@ void PinchViewport::setLocation(const FloatPoint& newLocation) |
ScrollingCoordinator* coordinator = m_frameHost.page().scrollingCoordinator(); |
ASSERT(coordinator); |
coordinator->scrollableAreaScrollLayerDidChange(this); |
+ |
+ mainFrame()->loader().saveScrollState(); |
} |
void PinchViewport::setScale(float scale) |
{ |
+ if (scale == m_scale) |
+ return; |
+ |
m_scale = scale; |
+ if (mainFrame()) |
+ mainFrame()->loader().saveScrollState(); |
+ |
// Old-style pinch sets scale here but we shouldn't call into the |
// clamping code below. |
if (!m_innerViewportScrollLayer) |
@@ -133,6 +147,9 @@ void PinchViewport::setScale(float scale) |
// Ensure we clamp so we remain within the bounds. |
setLocation(visibleRect().location()); |
+ |
+ // TODO: We should probably be calling scaleDidChange type functions here. |
+ // see Page::setPageScaleFactor. |
} |
// Modifies the top of the graphics layer tree to add layers needed to support |