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

Unified Diff: third_party/WebKit/Source/core/frame/LocalFrame.cpp

Issue 1840113005: Move viewport actions into an ApplyScroll callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: third_party/WebKit/Source/core/frame/LocalFrame.cpp
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index 7f498ae448b032effb3a861c69e685fd909acc33..2644b4fc0e185421c76360ebd13f130a5eacfffa 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -62,6 +62,8 @@
#include "core/page/ChromeClient.h"
#include "core/page/FocusController.h"
#include "core/page/Page.h"
+#include "core/page/scrolling/ScrollState.h"
+#include "core/page/scrolling/ScrollStateCallback.h"
#include "core/page/scrolling/ScrollingCoordinator.h"
#include "core/paint/ObjectPainter.h"
#include "core/paint/PaintInfo.h"
@@ -764,50 +766,6 @@ void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words)
spellChecker().removeSpellingMarkersUnderWords(words);
}
-ScrollResult LocalFrame::applyScrollDelta(ScrollGranularity granularity, const FloatSize& delta, bool isScrollBegin)
-{
- if (isScrollBegin)
- host()->topControls().scrollBegin();
-
- if (!view() || delta.isZero())
- return ScrollResult(false, false, delta.width(), delta.height());
-
- FloatSize remainingDelta = delta;
-
- // If this is main frame, allow top controls to scroll first.
- if (shouldScrollTopControls(granularity, delta))
- remainingDelta = host()->topControls().scrollBy(remainingDelta);
-
- if (remainingDelta.isZero())
- return ScrollResult(delta.width(), delta.height(), 0.0f, 0.0f);
-
- ScrollResult result = view()->getScrollableArea()->userScroll(granularity, remainingDelta);
- result.didScrollX = result.didScrollX || (remainingDelta.width() != delta.width());
- result.didScrollY = result.didScrollY || (remainingDelta.height() != delta.height());
-
- return result;
-}
-
-bool LocalFrame::shouldScrollTopControls(ScrollGranularity granularity, const FloatSize& delta) const
-{
- if (!isMainFrame())
- return false;
-
- if (granularity != ScrollByPixel && granularity != ScrollByPrecisePixel)
- return false;
-
- // Always give the delta to the top controls if the scroll is in
- // the direction to show the top controls. If it's in the
- // direction to hide the top controls, only give the delta to the
- // top controls when the frame can scroll.
- DoublePoint maximumScrollPosition =
- host()->visualViewport().maximumScrollPositionDouble() +
- toDoubleSize(view()->maximumScrollPositionDouble());
- DoublePoint scrollPosition = host()->visualViewport()
- .visibleRectInDocument().location();
- return delta.height() < 0 || scrollPosition.y() < maximumScrollPosition.y();
-}
-
String LocalFrame::localLayerTreeAsText(unsigned flags) const
{
if (!contentLayoutObject())

Powered by Google App Engine
This is Rietveld 408576698