Title: [158138] branches/safari-537.73-branch/Source

Diff

Modified: branches/safari-537.73-branch/Source/WebCore/ChangeLog (158137 => 158138)


--- branches/safari-537.73-branch/Source/WebCore/ChangeLog	2013-10-28 22:08:51 UTC (rev 158137)
+++ branches/safari-537.73-branch/Source/WebCore/ChangeLog	2013-10-28 22:13:09 UTC (rev 158138)
@@ -1,5 +1,26 @@
 2013-10-28  Lucas Forschler  <[email protected]>
 
+        Merge r156219
+
+    2013-09-20  Roger Fong  <[email protected]>
+
+            Handle panning gestures messages properly on Windows.
+            https://bugs.webkit.org/show_bug.cgi?id=121711.
+
+            Reviewed by Brent Fulgham.
+
+            This is needed by the Windows port to keep track to determine whether or not
+            we need to overpan.
+
+            No new functionality added.
+
+            * rendering/RenderLayer.cpp:
+            (WebCore::RenderLayer::scrollByRecursively):
+            * rendering/RenderLayer.h: 
+            Added an argument to keep track of which scrollview was actually scrolled
+
+2013-10-28  Lucas Forschler  <[email protected]>
+
         Merge r156302
 
     2013-09-23  Patrick Gansterer  <[email protected]>

Modified: branches/safari-537.73-branch/Source/WebCore/rendering/RenderLayer.cpp (158137 => 158138)


--- branches/safari-537.73-branch/Source/WebCore/rendering/RenderLayer.cpp	2013-10-28 22:08:51 UTC (rev 158137)
+++ branches/safari-537.73-branch/Source/WebCore/rendering/RenderLayer.cpp	2013-10-28 22:13:09 UTC (rev 158138)
@@ -2124,7 +2124,7 @@
     scrollByRecursively(adjustedScrollDelta(delta), ScrollOffsetClamped);
 }
 
-void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollOffsetClamping clamp)
+void RenderLayer::scrollByRecursively(const IntSize& delta, ScrollOffsetClamping clamp, ScrollView** scrolledView)
 {
     if (delta.isZero())
         return;
@@ -2136,12 +2136,13 @@
     if (renderer()->hasOverflowClip() && !restrictedByLineClamp) {
         IntSize newScrollOffset = scrollOffset() + delta;
         scrollToOffset(newScrollOffset, clamp);
+        *scrolledView = renderer()->view()->frameView();
 
         // If this layer can't do the scroll we ask the next layer up that can scroll to try
         IntSize remainingScrollOffset = newScrollOffset - scrollOffset();
         if (!remainingScrollOffset.isZero() && renderer()->parent()) {
             if (RenderLayer* scrollableLayer = enclosingScrollableLayer())
-                scrollableLayer->scrollByRecursively(remainingScrollOffset);
+                scrollableLayer->scrollByRecursively(remainingScrollOffset, clamp, scrolledView);
 
             Frame* frame = renderer()->frame();
             if (frame)
@@ -2151,6 +2152,7 @@
         // If we are here, we were called on a renderer that can be programmatically scrolled, but doesn't
         // have an overflow clip. Which means that it is a document node that can be scrolled.
         renderer()->view()->frameView()->scrollBy(delta);
+        *scrolledView = renderer()->view()->frameView();
 
         // FIXME: If we didn't scroll the whole way, do we want to try looking at the frames ownerElement? 
         // https://bugs.webkit.org/show_bug.cgi?id=28237

Modified: branches/safari-537.73-branch/Source/WebCore/rendering/RenderLayer.h (158137 => 158138)


--- branches/safari-537.73-branch/Source/WebCore/rendering/RenderLayer.h	2013-10-28 22:08:51 UTC (rev 158137)
+++ branches/safari-537.73-branch/Source/WebCore/rendering/RenderLayer.h	2013-10-28 22:13:09 UTC (rev 158138)
@@ -392,7 +392,7 @@
     };
 
     // Scrolling methods for layers that can scroll their overflow.
-    void scrollByRecursively(const IntSize&, ScrollOffsetClamping = ScrollOffsetUnclamped);
+    void scrollByRecursively(const IntSize&, ScrollOffsetClamping = ScrollOffsetUnclamped, ScrollView** scrolledView = 0);
     void scrollToOffset(const IntSize&, ScrollOffsetClamping = ScrollOffsetUnclamped);
     void scrollToXOffset(int x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(IntSize(x, scrollYOffset()), clamp); }
     void scrollToYOffset(int y, ScrollOffsetClamping clamp = ScrollOffsetUnclamped) { scrollToOffset(IntSize(scrollXOffset(), y), clamp); }

Modified: branches/safari-537.73-branch/Source/WebKit/win/ChangeLog (158137 => 158138)


--- branches/safari-537.73-branch/Source/WebKit/win/ChangeLog	2013-10-28 22:08:51 UTC (rev 158137)
+++ branches/safari-537.73-branch/Source/WebKit/win/ChangeLog	2013-10-28 22:13:09 UTC (rev 158138)
@@ -1,5 +1,28 @@
 2013-10-28  Lucas Forschler  <[email protected]>
 
+        Merge r156219
+
+    2013-09-20  Roger Fong  <[email protected]>
+
+            Handle panning gestures messages properly on Windows.
+            https://bugs.webkit.org/show_bug.cgi?id=121711.
+
+            Reviewed by Brent Fulgham.
+
+            This fixes a number of issues with panning gestures on Windows.
+            1. Two finger panning in one direction can sometimes cause some unexpected scrolling 
+            in the other direction when the gesture first begins (directions meaning horizontal and vertical)
+            2. Single finger horizontal panning should only be disabled when attempting to select text.
+            3. Scrolling via panning should be clamped, other wise we can scroll contents completely out of the scrollview.
+            4. Horizontal overpan should work.
+            5. Overpan should occur whenever we scroll to the extents of whichever scroll view we're currently scrolling.
+
+            * WebView.cpp:
+            (WebView::gestureNotify):
+            (WebView::gesture):
+
+2013-10-28  Lucas Forschler  <[email protected]>
+
         Merge r156302
 
     2013-09-23  Patrick Gansterer  <[email protected]>

Modified: branches/safari-537.73-branch/Source/WebKit/win/WebView.cpp (158137 => 158138)


--- branches/safari-537.73-branch/Source/WebKit/win/WebView.cpp	2013-10-28 22:08:51 UTC (rev 158137)
+++ branches/safari-537.73-branch/Source/WebKit/win/WebView.cpp	2013-10-28 22:13:09 UTC (rev 158138)
@@ -1592,7 +1592,8 @@
         // The hit testing above won't detect if we've hit the main frame's vertical scrollbar. Check that manually now.
         RECT webViewRect;
         GetWindowRect(m_viewWindow, &webViewRect);
-        hitScrollbar = view->verticalScrollbar() && (gestureBeginPoint.x > (webViewRect.right - view->verticalScrollbar()->theme()->scrollbarThickness()));  
+        hitScrollbar = (view->verticalScrollbar() && (gestureBeginPoint.x > (webViewRect.right - view->verticalScrollbar()->theme()->scrollbarThickness()))) 
+            || (view->horizontalScrollbar() && (gestureBeginPoint.y > (webViewRect.bottom - view->horizontalScrollbar()->theme()->scrollbarThickness())));  
     }
 
     bool canBeScrolled = false;
@@ -1608,20 +1609,24 @@
     // We always allow two-fingered panning with inertia and a gutter (which limits movement to one
     // direction in most cases).
     DWORD dwPanWant = GC_PAN | GC_PAN_WITH_INERTIA | GC_PAN_WITH_GUTTER;
-    // We never allow single-fingered horizontal panning. That gesture is reserved for creating text
-    // selections. This matches IE.
-    DWORD dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
+    DWORD dwPanBlock = 0;
 
     if (hitScrollbar || !canBeScrolled) {
         // The part of the page under the gesture can't be scrolled, or the gesture is on a scrollbar.
-        // Disallow single-fingered vertical panning in this case, too, so we'll fall back to the default
+        // Disallow single-fingered panning in this case so we'll fall back to the default
         // behavior (which allows the scrollbar thumb to be dragged, text selections to be made, etc.).
-        dwPanBlock |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+        dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
     } else {
         // The part of the page the gesture is under can be scrolled, and we're not under a scrollbar.
         // Allow single-fingered vertical panning in this case, so the user will be able to pan the page
         // with one or two fingers.
         dwPanWant |= GC_PAN_WITH_SINGLE_FINGER_VERTICALLY;
+
+        // Disable single-fingered horizontal panning only if the target node is text.
+        if (m_gestureTargetNode && m_gestureTargetNode->isTextNode())
+            dwPanBlock = GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
+        else
+            dwPanWant |= GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY;
     }
 
     GESTURECONFIG gc = { GID_PAN, dwPanWant, dwPanBlock };
@@ -1652,6 +1657,10 @@
         m_gestureTargetNode = 0;
         break;
     case GID_PAN: {
+        if (gi.dwFlags & GF_BEGIN) {
+            m_lastPanX = gi.ptsLocation.x;
+            m_lastPanY = gi.ptsLocation.y;
+        }
         // Where are the fingers currently?
         long currentX = gi.ptsLocation.x;
         long currentY = gi.ptsLocation.y;
@@ -1671,44 +1680,51 @@
             return false;
         }
 
-        if (!m_gestureTargetNode || !m_gestureTargetNode->renderer())
-            return false;
+        ScrollView* scrolledView = 0;
 
-        // We negate here since panning up moves the content up, but moves the scrollbar down.
-        m_gestureTargetNode->renderer()->enclosingLayer()->scrollByRecursively(IntSize(-deltaX, -deltaY));
-           
+        if (!m_gestureTargetNode || !m_gestureTargetNode->renderer()) {
+            // We might directly hit the document without hitting any nodes
+            coreFrame->view()->scrollBy(IntSize(-deltaX, -deltaY));
+            scrolledView = coreFrame->view();
+        } else
+            m_gestureTargetNode->renderer()->enclosingLayer()->scrollByRecursively(IntSize(-deltaX, -deltaY), WebCore::RenderLayer::ScrollOffsetClamped, &scrolledView);
+
         if (!(UpdatePanningFeedbackPtr() && BeginPanningFeedbackPtr() && EndPanningFeedbackPtr())) {
             CloseGestureInfoHandlePtr()(gestureHandle);
             return true;
         }
 
+        // Handle overpanning
         if (gi.dwFlags & GF_BEGIN) {
             BeginPanningFeedbackPtr()(m_viewWindow);
             m_yOverpan = 0;
+            m_xOverpan = 0;
         } else if (gi.dwFlags & GF_END) {
             EndPanningFeedbackPtr()(m_viewWindow, true);
             m_yOverpan = 0;
+            m_xOverpan = 0;
         }
 
-        ScrollView* view = coreFrame->view();
-        if (!view) {
+        if (!scrolledView) {
             CloseGestureInfoHandlePtr()(gestureHandle);
             return true;
         }
-        Scrollbar* vertScrollbar = view->verticalScrollbar();
-        if (!vertScrollbar) {
-            CloseGestureInfoHandlePtr()(gestureHandle);
-            return true;
-        }
 
-        // FIXME: Support Horizontal Window Bounce. <https://webkit.org/b/28500>.
-        // FIXME: If the user starts panning down after a window bounce has started, the window doesn't bounce back 
-        // until they release their finger. <https://webkit.org/b/28501>.
-        if (vertScrollbar->currentPos() == 0)
-            UpdatePanningFeedbackPtr()(m_viewWindow, 0, m_yOverpan, gi.dwFlags & GF_INERTIA);
-        else if (vertScrollbar->currentPos() >= vertScrollbar->maximum())
-            UpdatePanningFeedbackPtr()(m_viewWindow, 0, m_yOverpan, gi.dwFlags & GF_INERTIA);
+        Scrollbar* vertScrollbar = scrolledView->verticalScrollbar();
 
+        int ypan = 0;
+        int xpan = 0;
+
+        if (vertScrollbar && (!vertScrollbar->currentPos() || vertScrollbar->currentPos() >= vertScrollbar->maximum()))
+            ypan = m_yOverpan;
+
+        Scrollbar* horiScrollbar = scrolledView->horizontalScrollbar();
+
+        if (horiScrollbar && (!horiScrollbar->currentPos() || horiScrollbar->currentPos() >= horiScrollbar->maximum()))
+            xpan = m_xOverpan;
+
+        UpdatePanningFeedbackPtr()(m_viewWindow, xpan, ypan, gi.dwFlags & GF_INERTIA);
+
         CloseGestureInfoHandlePtr()(gestureHandle);
         return true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to