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

Unified Diff: Source/web/WebViewImpl.cpp

Issue 1163433003: Remove WebViewImpl helper methods for setting scroll offset. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Renamed outerViewport to layoutViewport Created 5 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/web/WebViewImpl.h ('k') | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 0a683325d5d93c87b0855723013b0ed8cdb384fb..486bc442792f7e29bdb116be608d93f4022544b9 100644
--- a/Source/web/WebViewImpl.cpp
+++ b/Source/web/WebViewImpl.cpp
@@ -3141,11 +3141,6 @@ void WebViewImpl::setPageScaleFactor(float scaleFactor)
page()->frameHost().pinchViewport().setScale(scaleFactor);
}
-void WebViewImpl::setMainFrameScrollOffset(const WebPoint& origin)
-{
- updateLayoutViewportScrollPosition(DoublePoint(origin.x, origin.y), false);
-}
-
float WebViewImpl::deviceScaleFactor() const
{
if (!page())
@@ -3403,12 +3398,18 @@ float WebViewImpl::maximumPageScaleFactor() const
void WebViewImpl::resetScrollAndScaleState()
{
- updateLayoutViewportScrollPosition(IntPoint(), true);
page()->frameHost().pinchViewport().reset();
if (!page()->mainFrame()->isLocalFrame())
return;
+ if (FrameView* frameView = toLocalFrame(page()->mainFrame())->view()) {
+ ScrollableArea* scrollableArea = frameView->layoutViewportScrollableArea();
+
+ if (scrollableArea->scrollPositionDouble() != DoublePoint::zero())
+ scrollableArea->notifyScrollPositionChanged(DoublePoint::zero());
+ }
+
// Clear out the values for the current history item. This will prevent the history item from clobbering the
// value determined during page scale initialization, which may be less than 1.
page()->deprecatedLocalMainFrame()->loader().clearScrollPositionAndViewState();
@@ -4248,28 +4249,9 @@ void WebViewImpl::initializeLayerTreeView()
ASSERT(m_layerTreeView || !m_client || m_client->allowsBrokenNullLayerTreeView());
}
-void WebViewImpl::updateLayoutViewportScrollPosition(const DoublePoint& scrollPosition, bool programmaticScroll)
-{
- if (!page()->mainFrame()->isLocalFrame())
- return;
-
- // FIXME(305811): Refactor for OOPI.
- FrameView* frameView = page()->deprecatedLocalMainFrame()->view();
- if (!frameView)
- return;
-
- ScrollableArea* scrollableArea = frameView->layoutViewportScrollableArea();
- if (scrollableArea->scrollPositionDouble() == scrollPosition)
- return;
-
- scrollableArea->notifyScrollPositionChanged(scrollPosition);
- if (!programmaticScroll)
- frameView->setWasScrolledByUser(true);
-}
-
void WebViewImpl::applyViewportDeltas(
const WebFloatSize& pinchViewportDelta,
- const WebFloatSize& outerViewportDelta,
+ const WebFloatSize& layoutViewportDelta,
const WebFloatSize& elasticOverscrollDelta,
float pageScaleDelta,
float topControlsShownRatioDelta)
@@ -4291,8 +4273,15 @@ void WebViewImpl::applyViewportDeltas(
frameView->setElasticOverscroll(elasticOverscrollDelta + frameView->elasticOverscroll());
- updateLayoutViewportScrollPosition(frameView->layoutViewportScrollableArea()->scrollPositionDouble() +
- DoubleSize(outerViewportDelta.width, outerViewportDelta.height), /* programmaticScroll */ false);
+ ScrollableArea* layoutViewport = frameView->layoutViewportScrollableArea();
+
+ DoublePoint layoutViewportPosition = layoutViewport->scrollPositionDouble()
+ + DoubleSize(layoutViewportDelta.width, layoutViewportDelta.height);
+
+ if (layoutViewport->scrollPositionDouble() != layoutViewportPosition) {
+ layoutViewport->notifyScrollPositionChanged(layoutViewportPosition);
+ frameView->setWasScrolledByUser(true);
+ }
}
void WebViewImpl::recordFrameTimingEvent(FrameTimingEventType eventType, int64_t FrameId, const WebVector<WebFrameTimingEvent>& events)
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/PinchViewportTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698