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

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: 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
Index: Source/web/WebViewImpl.cpp
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp
index 9f36a8070a6b2992fc961c234a97530078f747b2..9fe57d0bcbc8029e83ce9841586d2dd6dedc60eb 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,25 +4249,6 @@ 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,
@@ -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();
skobes 2015/06/03 16:57:57 It's confusing to use both "layout viewport" and "
bokan 2015/06/03 17:04:58 Done.
+
+ DoublePoint layoutViewportPosition = layoutViewport->scrollPositionDouble()
+ + DoubleSize(outerViewportDelta.width, outerViewportDelta.height);
+
+ if (layoutViewport->scrollPositionDouble() != layoutViewportPosition) {
+ layoutViewport->notifyScrollPositionChanged(layoutViewportPosition);
+ frameView->setWasScrolledByUser(true);
+ }
}
void WebViewImpl::recordFrameTimingEvent(FrameTimingEventType eventType, int64_t FrameId, const WebVector<WebFrameTimingEvent>& events)

Powered by Google App Engine
This is Rietveld 408576698