Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(881)

Unified Diff: Source/core/frame/PinchViewport.cpp

Issue 263853008: Added pinch viewport offset to history item. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Feedback addressed + small fix for broken unit test Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/PinchViewport.cpp
diff --git a/Source/core/frame/PinchViewport.cpp b/Source/core/frame/PinchViewport.cpp
index 505a8895eadcbeeb9a3b05a04fe97c3095d78f88..4fc171b365f0e7e56395c440c100a0357a81a6a4 100644
--- a/Source/core/frame/PinchViewport.cpp
+++ b/Source/core/frame/PinchViewport.cpp
@@ -91,6 +91,12 @@ void PinchViewport::setSize(const IntSize& size)
setupScrollbar(WebScrollbar::Vertical);
}
+void PinchViewport::reset()
+{
+ setLocation(FloatPoint(0, 0));
abarth-chromium 2014/05/09 14:11:23 setLocation(FloatPoint());
bokan 2014/05/09 14:32:57 Done.
+ setScale(1);
+}
+
void PinchViewport::mainFrameDidChangeSize()
{
// In unit tests we may not have initialized the layer tree.
@@ -120,12 +126,19 @@ 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;
+ mainFrame()->loader().saveScrollState();
+
// Old-style pinch sets scale here but we shouldn't call into the
// clamping code below.
if (!m_innerViewportScrollLayer)
@@ -133,6 +146,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

Powered by Google App Engine
This is Rietveld 408576698