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

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

Issue 1300393003: Attempt scroll restoration anytime viewport size changes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix minor bug Created 5 years, 4 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/FrameView.cpp
diff --git a/Source/core/frame/FrameView.cpp b/Source/core/frame/FrameView.cpp
index c9c429ac81677e8f703528ccb03a89e71f526610..17ad78f34544828492c8721e5e5029a434f82f57 100644
--- a/Source/core/frame/FrameView.cpp
+++ b/Source/core/frame/FrameView.cpp
@@ -406,8 +406,11 @@ void FrameView::setFrameRect(const IntRect& newRect)
viewportSizeChanged(newRect.width() != oldRect.width(), newRect.height() != oldRect.height());
- if (oldRect.size() != newRect.size() && m_frame->isMainFrame())
- page()->frameHost().visualViewport().mainFrameDidChangeSize();
+ if (oldRect.size() != newRect.size()) {
+ if (m_frame->isMainFrame())
+ page()->frameHost().visualViewport().mainFrameDidChangeSize();
Nate Chapin 2015/08/24 17:18:18 Nit: this line should be m_frame->host() instead o
majidvp 2015/08/25 19:12:42 Done.
+ frame().loader().restoreScrollPositionAndViewState();
+ }
}
Page* FrameView::page() const
@@ -509,20 +512,7 @@ void FrameView::setContentsSize(const IntSize& size)
updateScrollableAreaSet();
page->chromeClient().contentsSizeChanged(m_frame.get(), size);
-}
-
-IntPoint FrameView::clampOffsetAtScale(const IntPoint& offset, float scale) const
-{
- IntPoint maxScrollExtent(contentsSize().width() - scrollOrigin().x(), contentsSize().height() - scrollOrigin().y());
- FloatSize scaledSize = visibleContentSize();
- if (scale)
- scaledSize.scale(1 / scale);
-
- IntPoint clampedOffset = offset;
- clampedOffset = clampedOffset.shrunkTo(maxScrollExtent - expandedIntSize(scaledSize));
- clampedOffset = clampedOffset.expandedTo(-scrollOrigin());
-
- return clampedOffset;
+ frame().loader().restoreScrollPositionAndViewState();
}
void FrameView::adjustViewSize()

Powered by Google App Engine
This is Rietveld 408576698