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

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

Issue 850443002: Scroll Customization Prototype (Not for review, WIP) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase / cleanup / minor bug fixes Created 5 years, 10 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/LocalFrame.h ('k') | Source/core/page/EventHandler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/frame/LocalFrame.cpp
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp
index 3178d84acd3e95b710339411de20d438d4f5d8d7..c06d8512394632a78368e2f8d13e7e98656e3477 100644
--- a/Source/core/frame/LocalFrame.cpp
+++ b/Source/core/frame/LocalFrame.cpp
@@ -765,6 +765,33 @@ void LocalFrame::removeSpellingMarkersUnderWords(const Vector<String>& words)
spellChecker().removeSpellingMarkersUnderWords(words);
}
+static bool scrollAreaOnBothAxes(const FloatSize& delta, ScrollableArea& view)
+{
+ bool scrolledHorizontal = view.scroll(ScrollLeft, ScrollByPrecisePixel, delta.width());
+ bool scrolledVertical = view.scroll(ScrollUp, ScrollByPrecisePixel, delta.height());
+ return scrolledHorizontal || scrolledVertical;
+}
+
+// Returns true if a scroll occurred.
+bool LocalFrame::scrollByDelta(const FloatSize& delta)
+{
+ // FIXME: handle top controls.
+ if (!view())
+ return false;
+
+ if (scrollAreaOnBothAxes(delta, *view()))
+ return true;
+
+ // If this is the main frame and it didn't scroll, propagate up to the pinch viewport.
+ if (!settings()->pinchVirtualViewportEnabled() || !isMainFrame())
+ return false;
+
+ if (scrollAreaOnBothAxes(delta, page()->frameHost().pinchViewport()))
+ return true;
+
+ return false;
+}
+
#if ENABLE(OILPAN)
void LocalFrame::registerPluginElement(HTMLPlugInElement* plugin)
{
« no previous file with comments | « Source/core/frame/LocalFrame.h ('k') | Source/core/page/EventHandler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698