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

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: Added backward compatibility, tests 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..6bd8d8bbaa3da824c24869be0fa51e20c32a0876 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));
+ setScale(1);
+}
+
void PinchViewport::mainFrameDidChangeSize()
{
// In unit tests we may not have initialized the layer tree.
@@ -124,8 +130,13 @@ void PinchViewport::setLocation(const FloatPoint& newLocation)
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 +144,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.
aelias_OOO_until_Jul13 2014/05/07 08:06:03 Separate from this patch, but the only thing in yo
+ // see Page::setPageScaleFactor.
}
// Modifies the top of the graphics layer tree to add layers needed to support
@@ -324,6 +338,8 @@ void PinchViewport::invalidateScrollbarRect(Scrollbar*, const IntRect&)
void PinchViewport::setScrollOffset(const IntPoint& offset)
{
setLocation(offset);
+
+ mainFrame()->loader().saveScrollState();
}
GraphicsLayer* PinchViewport::layerForContainer() const

Powered by Google App Engine
This is Rietveld 408576698