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

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: 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
« no previous file with comments | « Source/core/frame/PinchViewport.h ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/frame/PinchViewport.h ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698