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) |
{ |