Allow UI clients to handle vertical wheel events.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Feb 2013 01:42:47 +0000 (01:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 20 Feb 2013 01:42:47 +0000 (01:42 +0000)
https://bugs.webkit.org/show_bug.cgi?id=110006

Patch by Conrad Shultz <conrad_shultz@apple.com> on 2013-02-19
Reviewed by Tim Horton.

Source/WebCore:

Add API to allow matching changes in WebKit2 to control rubber-banding behavior at vertical page extrema.
If rubber-banding is disabled during a scroll event that would otherwise trigger rubber-banding, dispatch
didNotHandleWheelEvent() to the page UI client.

* WebCore.exp.in:
Export new rubber-banding API.

* page/Page.cpp:
(WebCore):
(WebCore::Page::rubberBandsAtBottom):
Proxy for the corresponding function in ScrollingCoordinator.
(WebCore::Page::setRubberBandsAtBottom):
Ditto.
(WebCore::Page::rubberBandsAtTop):
Ditto.
(WebCore::Page::setRubberBandsAtTop):
Ditto.

* page/Page.h:
(Page):
Declare new rubber-banding API (above).

* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::rubberBandsAtBottom):
Stub API implementation.
(WebCore::ScrollingCoordinator::setRubberBandsAtBottom):
Ditto.
(WebCore::ScrollingCoordinator::rubberBandsAtTop):
Ditto.
(WebCore::ScrollingCoordinator::setRubberBandsAtTop):
Ditto.

* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::ScrollingTree):
Initialize new member variables.
(WebCore::ScrollingTree::setMainFramePinState):
Set top/bottom pinned states.
(WebCore::ScrollingTree::rubberBandsAtBottom):
New accessor function.
(WebCore::ScrollingTree::setRubberBandsAtBottom):
New mutator function.
(WebCore::ScrollingTree::rubberBandsAtTop):
New accessor function.
(WebCore::ScrollingTree::setRubberBandsAtTop):
New mutator function.
(WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
Start a vertical swipe event if the frame is pinned at the top or bottom and associated rubber-banding is disabled.

* page/scrolling/ScrollingTree.h:
(ScrollingTree):
Declare new rubber-banding API and associated member variables.

* page/scrolling/mac/ScrollingCoordinatorMac.h:
(ScrollingCoordinatorMac):
Declare API overrides.

* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::rubberBandsAtBottom):
Method override; proxy to corresponding function in ScrollingTree.
(WebCore::ScrollingCoordinatorMac::setRubberBandsAtBottom):
Ditto.
(WebCore::ScrollingCoordinatorMac::rubberBandsAtTop):
Ditto.
(WebCore::ScrollingCoordinatorMac::setRubberBandsAtTop):
Ditto.

* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::pinnedInDirection):
Remove trailing whitespace.
(WebCore::ScrollingTreeScrollingNodeMac::updateMainFramePinState):
Calculate and pass vertical pinning state to ScrollingTree::setMainFramePinState().

Source/WebKit2:

Add API to allow clients to selectively control rubber-banding at vertical page extrema.

* UIProcess/API/C/WKPage.cpp:
(WKPageRubberBandsAtBottom):
Proxy for the corresponding function in WebCore::Page.
(WKPageSetRubberBandsAtBottom):
Ditto.
(WKPageRubberBandsAtTop):
Ditto.
(WKPageSetRubberBandsAtTop):
Ditto.

* UIProcess/API/C/WKPage.h:
Declare new API.

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
Initialize new member variables.
(WebKit::WebPageProxy::setRubberBandsAtBottom):
New function; dispatches a matching message to the WebKit::WebPage.
(WebKit::WebPageProxy::setRubberBandsAtTop):
Ditto.

* UIProcess/WebPageProxy.h:
(WebPageProxy):
Declare new API.
(WebKit::WebPageProxy::rubberBandsAtBottom):
New accessor function.
(WebKit::WebPageProxy::rubberBandsAtTop):
Ditto.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::setRubberBandsAtBottom):
New function; call the matching function on the associated WebCore::Page.
(WebKit::WebPage::setRubberBandsAtTop):
Ditto.

* WebProcess/WebPage/WebPage.h:
(WebPage):
Declare new rubber-banding API.

* WebProcess/WebPage/WebPage.messages.in:
Declare new rubber-banding API.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143418 268f45cc-cd09-0410-ab3c-d52691b4dbfc

18 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebCore/page/scrolling/ScrollingCoordinator.h
Source/WebCore/page/scrolling/ScrollingTree.cpp
Source/WebCore/page/scrolling/ScrollingTree.h
Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h
Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm
Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/API/C/WKPage.cpp
Source/WebKit2/UIProcess/API/C/WKPage.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index 050600f026da20d5ea565d2f97807126c32c6de3..b40f59be00208a194f7caedd4e95a24c51505109 100644 (file)
@@ -1,3 +1,82 @@
+2013-02-19  Conrad Shultz  <conrad_shultz@apple.com>
+
+        Allow UI clients to handle vertical wheel events.
+        https://bugs.webkit.org/show_bug.cgi?id=110006
+
+        Reviewed by Tim Horton.
+
+        Add API to allow matching changes in WebKit2 to control rubber-banding behavior at vertical page extrema.
+        If rubber-banding is disabled during a scroll event that would otherwise trigger rubber-banding, dispatch
+        didNotHandleWheelEvent() to the page UI client.
+
+        * WebCore.exp.in:
+        Export new rubber-banding API.
+
+        * page/Page.cpp:
+        (WebCore):
+        (WebCore::Page::rubberBandsAtBottom):
+        Proxy for the corresponding function in ScrollingCoordinator.
+        (WebCore::Page::setRubberBandsAtBottom):
+        Ditto.
+        (WebCore::Page::rubberBandsAtTop):
+        Ditto.
+        (WebCore::Page::setRubberBandsAtTop):
+        Ditto.
+
+        * page/Page.h:
+        (Page):
+        Declare new rubber-banding API (above).
+
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::rubberBandsAtBottom):
+        Stub API implementation.
+        (WebCore::ScrollingCoordinator::setRubberBandsAtBottom):
+        Ditto.
+        (WebCore::ScrollingCoordinator::rubberBandsAtTop):
+        Ditto.
+        (WebCore::ScrollingCoordinator::setRubberBandsAtTop):
+        Ditto.
+
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::ScrollingTree):
+        Initialize new member variables.
+        (WebCore::ScrollingTree::setMainFramePinState):
+        Set top/bottom pinned states.
+        (WebCore::ScrollingTree::rubberBandsAtBottom):
+        New accessor function.
+        (WebCore::ScrollingTree::setRubberBandsAtBottom):
+        New mutator function.
+        (WebCore::ScrollingTree::rubberBandsAtTop):
+        New accessor function.
+        (WebCore::ScrollingTree::setRubberBandsAtTop):
+        New mutator function.
+        (WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
+        Start a vertical swipe event if the frame is pinned at the top or bottom and associated rubber-banding is disabled.
+
+        * page/scrolling/ScrollingTree.h:
+        (ScrollingTree):
+        Declare new rubber-banding API and associated member variables.
+
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        (ScrollingCoordinatorMac):
+        Declare API overrides.
+
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::rubberBandsAtBottom):
+        Method override; proxy to corresponding function in ScrollingTree.
+        (WebCore::ScrollingCoordinatorMac::setRubberBandsAtBottom):
+        Ditto.
+        (WebCore::ScrollingCoordinatorMac::rubberBandsAtTop):
+        Ditto.
+        (WebCore::ScrollingCoordinatorMac::setRubberBandsAtTop):
+        Ditto.
+
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeMac::pinnedInDirection):
+        Remove trailing whitespace.
+        (WebCore::ScrollingTreeScrollingNodeMac::updateMainFramePinState):
+        Calculate and pass vertical pinning state to ScrollingTree::setMainFramePinState().
+
 2013-02-19  Simon Fraser  <simon.fraser@apple.com>
 
         Rubber-banding should not affect the visibleRect of the TileCache
index 18895849d535e26206d0ea389e1a4222075d8c5d..8dba0aa410c852122437ade4f369debc48c60092 100644 (file)
@@ -782,11 +782,13 @@ __ZN7WebCore4Page18removeSchedulePairEN3WTF10PassRefPtrINS_12SchedulePairEEE
 __ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
 __ZN7WebCore4Page19addLayoutMilestonesEj
 __ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy
+__ZN7WebCore4Page19setRubberBandsAtTopEb
 __ZN7WebCore4Page20setDeviceScaleFactorEf
 __ZN7WebCore4Page20unmarkAllTextMatchesEv
 __ZN7WebCore4Page21markAllMatchesForTextERKN3WTF6StringEjbj
 __ZN7WebCore4Page22allVisitedStateChangedEPNS_9PageGroupE
 __ZN7WebCore4Page22nonFastScrollableRectsEPKNS_5FrameE
+__ZN7WebCore4Page22setRubberBandsAtBottomEb
 __ZN7WebCore4Page23clearUndoRedoOperationsEv
 __ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEjiPNS1_6VectorINS1_6RefPtrINS_5RangeEEELm0EEERi
 __ZN7WebCore4Page24resumeScriptedAnimationsEv
@@ -2701,6 +2703,10 @@ __ZN7WebCore13ScrollingTreeD1Ev
 __ZN7WebCore15ScrollingThread15dispatchBarrierERKN3WTF8FunctionIFvvEEE
 __ZN7WebCore15ScrollingThread8dispatchERKN3WTF8FunctionIFvvEEE
 __ZN7WebCore20ScrollingCoordinator44setForceMainThreadScrollLayerPositionUpdatesEb
+__ZNK7WebCore23ScrollingCoordinatorMac19rubberBandsAtBottomEv
+__ZNK7WebCore23ScrollingCoordinatorMac16rubberBandsAtTopEv
+__ZN7WebCore23ScrollingCoordinatorMac22setRubberBandsAtBottomEb
+__ZN7WebCore23ScrollingCoordinatorMac19setRubberBandsAtTopEb
 __ZN7WebCore4Page20scrollingCoordinatorEv
 #endif
 
index ef9e8686805e991b45becb004dc9a7b199a73cbf..dc1dd4764ff100e17e8adc146afd3e2215d1b707 100644 (file)
@@ -815,6 +815,34 @@ void Page::setShouldSuppressScrollbarAnimations(bool suppressAnimations)
     m_suppressScrollbarAnimations = suppressAnimations;
 }
 
+bool Page::rubberBandsAtBottom()
+{
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+        return scrollingCoordinator->rubberBandsAtBottom();
+
+    return false;
+}
+
+void Page::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+{
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+        scrollingCoordinator->setRubberBandsAtBottom(rubberBandsAtBottom);
+}
+
+bool Page::rubberBandsAtTop()
+{
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+        return scrollingCoordinator->rubberBandsAtTop();
+
+    return false;
+}
+
+void Page::setRubberBandsAtTop(bool rubberBandsAtTop)
+{
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+        scrollingCoordinator->setRubberBandsAtTop(rubberBandsAtTop);
+}
+
 void Page::setPagination(const Pagination& pagination)
 {
     if (m_pagination == pagination)
index d84e399eb27f0a6dfb4ca340ebe0d301a0539bb2..633d13c25601a8c0ce6ae86a7b5a40041d8ebfb6 100644 (file)
@@ -271,6 +271,11 @@ public:
     bool shouldSuppressScrollbarAnimations() const { return m_suppressScrollbarAnimations; }
     void setShouldSuppressScrollbarAnimations(bool suppressAnimations);
 
+    bool rubberBandsAtBottom();
+    void setRubberBandsAtBottom(bool);
+    bool rubberBandsAtTop();
+    void setRubberBandsAtTop(bool);
+
     // Page and FrameView both store a Pagination value. Page::pagination() is set only by API,
     // and FrameView::pagination() is set only by CSS. Page::pagination() will affect all
     // FrameViews in the page cache, but FrameView::pagination() only affects the current
index d84fbdbcd7cecaeedc0fc21498da8146d9f617ea..f183f31f39cec84b054039e087a4a9ca11548593 100644 (file)
@@ -124,6 +124,10 @@ public:
     virtual void syncChildPositions(const LayoutRect&) { }
     virtual String scrollingStateTreeAsText() const;
     virtual bool isRubberBandInProgress() const { return false; }
+    virtual bool rubberBandsAtBottom() const { return false; }
+    virtual void setRubberBandsAtBottom(bool) { }
+    virtual bool rubberBandsAtTop() const { return false; }
+    virtual void setRubberBandsAtTop(bool) { }
 
     // Generated a unique id for scroll layers.
     ScrollingNodeID uniqueScrollLayerID();
index b79ce62df006865eedde1fdb02b472b01f9b3667..2c766048c56cfab20050829987c2d43120e4c7de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -53,6 +53,10 @@ ScrollingTree::ScrollingTree(ScrollingCoordinator* scrollingCoordinator)
     , m_canGoForward(false)
     , m_mainFramePinnedToTheLeft(false)
     , m_mainFramePinnedToTheRight(false)
+    , m_rubberBandsAtBottom(true)
+    , m_rubberBandsAtTop(true)
+    , m_mainFramePinnedToTheTop(false)
+    , m_mainFramePinnedToTheBottom(false)
     , m_mainFrameIsRubberBanding(false)
     , m_scrollingPerformanceLoggingEnabled(false)
     , m_isHandlingProgrammaticScroll(false)
@@ -225,12 +229,14 @@ void ScrollingTree::removeDestroyedNodes(ScrollingStateTree* stateTree)
     }
 }
 
-void ScrollingTree::setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight)
+void ScrollingTree::setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom)
 {
     MutexLocker locker(m_swipeStateMutex);
 
     m_mainFramePinnedToTheLeft = pinnedToTheLeft;
     m_mainFramePinnedToTheRight = pinnedToTheRight;
+    m_mainFramePinnedToTheTop = pinnedToTheTop;
+    m_mainFramePinnedToTheBottom = pinnedToTheBottom;
 }
 
 void ScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
@@ -290,12 +296,38 @@ void ScrollingTree::setMainFrameIsRubberBanding(bool isRubberBanding)
     m_mainFrameIsRubberBanding = isRubberBanding;
 }
 
+bool ScrollingTree::rubberBandsAtBottom()
+{
+    MutexLocker lock(m_swipeStateMutex);
+
+    return m_rubberBandsAtBottom;
+}
+
+void ScrollingTree::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+{
+    MutexLocker locker(m_swipeStateMutex);
+
+    m_rubberBandsAtBottom = rubberBandsAtBottom;
+}
+
+bool ScrollingTree::rubberBandsAtTop()
+{
+    MutexLocker lock(m_swipeStateMutex);
+
+    return m_rubberBandsAtTop;
+}
+
+void ScrollingTree::setRubberBandsAtTop(bool rubberBandsAtTop)
+{
+    MutexLocker locker(m_swipeStateMutex);
+
+    m_rubberBandsAtTop = rubberBandsAtTop;
+}
+
 bool ScrollingTree::willWheelEventStartSwipeGesture(const PlatformWheelEvent& wheelEvent)
 {
     if (wheelEvent.phase() != PlatformWheelEventPhaseBegan)
         return false;
-    if (!wheelEvent.deltaX())
-        return false;
 
     MutexLocker lock(m_swipeStateMutex);
 
@@ -303,6 +335,10 @@ bool ScrollingTree::willWheelEventStartSwipeGesture(const PlatformWheelEvent& wh
         return true;
     if (wheelEvent.deltaX() < 0 && m_mainFramePinnedToTheRight && m_canGoForward)
         return true;
+    if (wheelEvent.deltaY() > 0 && m_mainFramePinnedToTheTop && !m_rubberBandsAtTop)
+        return true;
+    if (wheelEvent.deltaY() < 0 && m_mainFramePinnedToTheBottom && !m_rubberBandsAtBottom)
+        return true;
 
     return false;
 }
index 84cd9148a9ea307cdaf38224da454f1dda351d92..ad7bceb229cc241a1775a15006de9646876ded31 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -85,7 +85,7 @@ public:
     void invalidate();
     void commitNewTreeState(PassOwnPtr<ScrollingStateTree>);
 
-    void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight);
+    void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom);
 
     void updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition);
     IntPoint mainFrameScrollPosition();
@@ -97,6 +97,11 @@ public:
     bool canGoBack();
     bool canGoForward();
 
+    bool rubberBandsAtBottom();
+    void setRubberBandsAtBottom(bool);
+    bool rubberBandsAtTop();
+    void setRubberBandsAtTop(bool);
+
     bool willWheelEventStartSwipeGesture(const PlatformWheelEvent&);
 
     void setScrollingPerformanceLoggingEnabled(bool flag);
@@ -126,6 +131,10 @@ private:
     bool m_canGoForward;
     bool m_mainFramePinnedToTheLeft;
     bool m_mainFramePinnedToTheRight;
+    bool m_rubberBandsAtBottom;
+    bool m_rubberBandsAtTop;
+    bool m_mainFramePinnedToTheTop;
+    bool m_mainFramePinnedToTheBottom;
     bool m_mainFrameIsRubberBanding;
 
     bool m_scrollingPerformanceLoggingEnabled;
index 41afec5aef29e06f98cf096f908f6c03dbb6adb2..ecefd5f2d7de423e27cfe243b9fade3494659da9 100644 (file)
@@ -76,6 +76,10 @@ public:
     virtual String scrollingStateTreeAsText() const OVERRIDE;
 
     virtual bool isRubberBandInProgress() const OVERRIDE;
+    virtual bool rubberBandsAtBottom() const OVERRIDE;
+    virtual void setRubberBandsAtBottom(bool) OVERRIDE;
+    virtual bool rubberBandsAtTop() const OVERRIDE;
+    virtual void setRubberBandsAtTop(bool) OVERRIDE;
 
 private:
     // Return whether this scrolling coordinator can keep fixed position layers fixed to their
index ca09c08a91867753b3ee632bff727e444018091e..f464b768359b6080953bcb19603d989e943bebba 100644 (file)
@@ -93,6 +93,26 @@ bool ScrollingCoordinatorMac::isRubberBandInProgress() const
     return scrollingTree()->isRubberBandInProgress();
 }
 
+bool ScrollingCoordinatorMac::rubberBandsAtBottom() const
+{
+    return scrollingTree()->rubberBandsAtBottom();
+}
+
+void ScrollingCoordinatorMac::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+{
+    scrollingTree()->setRubberBandsAtBottom(rubberBandsAtBottom);
+}
+
+bool ScrollingCoordinatorMac::rubberBandsAtTop() const
+{
+    return scrollingTree()->rubberBandsAtTop();
+}
+
+void ScrollingCoordinatorMac::setRubberBandsAtTop(bool rubberBandsAtTop)
+{
+    scrollingTree()->setRubberBandsAtTop(rubberBandsAtTop);
+}
+
 void ScrollingCoordinatorMac::commitTreeStateIfNeeded()
 {
     if (!m_scrollingStateTree->hasChangedProperties())
index e79eae68b9fc1c84eb6b41fa75861c9869a6813b..e17abc6d6180199cf2694a7f4223705369c49a3c 100644 (file)
@@ -200,7 +200,7 @@ bool ScrollingTreeScrollingNodeMac::pinnedInDirection(const FloatSize& delta)
         }
     }
 
-    if ((delta.width() || delta.height()) && (limitDelta.width() < 1 && limitDelta.height() < 1))        
+    if ((delta.width() || delta.height()) && (limitDelta.width() < 1 && limitDelta.height() < 1))
         return true;
 
     return false;
@@ -349,8 +349,10 @@ void ScrollingTreeScrollingNodeMac::updateMainFramePinState(const IntPoint& scro
 {
     bool pinnedToTheLeft = scrollPosition.x() <= minimumScrollPosition().x();
     bool pinnedToTheRight = scrollPosition.x() >= maximumScrollPosition().x();
+    bool pinnedToTheTop = scrollPosition.y() <= minimumScrollPosition().y();
+    bool pinnedToTheBottom = scrollPosition.y() >= maximumScrollPosition().y();
 
-    scrollingTree()->setMainFramePinState(pinnedToTheLeft, pinnedToTheRight);
+    scrollingTree()->setMainFramePinState(pinnedToTheLeft, pinnedToTheRight, pinnedToTheTop, pinnedToTheBottom);
 }
 
 void ScrollingTreeScrollingNodeMac::logExposedUnfilledArea()
index 64bdf26b8ee1b78f1cc3fed3f81925789d25f3f7..cc10d87153130a81ee561a80c130434c6136d76b 100644 (file)
@@ -1,3 +1,54 @@
+2013-02-19  Conrad Shultz  <conrad_shultz@apple.com>
+
+        Allow UI clients to handle vertical wheel events.
+        https://bugs.webkit.org/show_bug.cgi?id=110006
+
+        Reviewed by Tim Horton.
+
+        Add API to allow clients to selectively control rubber-banding at vertical page extrema.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageRubberBandsAtBottom):
+        Proxy for the corresponding function in WebCore::Page.
+        (WKPageSetRubberBandsAtBottom):
+        Ditto.
+        (WKPageRubberBandsAtTop):
+        Ditto.
+        (WKPageSetRubberBandsAtTop):
+        Ditto.
+
+        * UIProcess/API/C/WKPage.h:
+        Declare new API.
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        Initialize new member variables.
+        (WebKit::WebPageProxy::setRubberBandsAtBottom):
+        New function; dispatches a matching message to the WebKit::WebPage.
+        (WebKit::WebPageProxy::setRubberBandsAtTop):
+        Ditto.
+
+        * UIProcess/WebPageProxy.h:
+        (WebPageProxy):
+        Declare new API.
+        (WebKit::WebPageProxy::rubberBandsAtBottom):
+        New accessor function.
+        (WebKit::WebPageProxy::rubberBandsAtTop):
+        Ditto.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::setRubberBandsAtBottom):
+        New function; call the matching function on the associated WebCore::Page.
+        (WebKit::WebPage::setRubberBandsAtTop):
+        Ditto.
+
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage):
+        Declare new rubber-banding API.
+
+        * WebProcess/WebPage/WebPage.messages.in:
+        Declare new rubber-banding API.
+
 2013-02-19  Anders Carlsson  <andersca@apple.com>
 
         StorageAreaProxy should know its quota
index 550d7bee3d0275faf9b8f0be1276ea7722faea50..a3a4488b44f9f5a57f072a134dffdf681e57f7cf 100644 (file)
@@ -394,6 +394,27 @@ bool WKPageIsPinnedToBottomSide(WKPageRef pageRef)
     return toImpl(pageRef)->isPinnedToBottomSide();
 }
 
+
+bool WKPageRubberBandsAtBottom(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->rubberBandsAtBottom();
+}
+
+void WKPageSetRubberBandsAtBottom(WKPageRef pageRef, bool rubberBandsAtBottom)
+{
+    toImpl(pageRef)->setRubberBandsAtBottom(rubberBandsAtBottom);
+}
+
+bool WKPageRubberBandsAtTop(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->rubberBandsAtTop();
+}
+
+void WKPageSetRubberBandsAtTop(WKPageRef pageRef, bool rubberBandsAtTop)
+{
+    toImpl(pageRef)->setRubberBandsAtTop(rubberBandsAtTop);
+}
+
 void WKPageSetPaginationMode(WKPageRef pageRef, WKPaginationMode paginationMode)
 {
     Pagination::Mode mode;
index 1a85657110b4c7f3898e725ea1101313a1c35033..a59aee5771b61b565ae7141f1d8a9f3e6451aee0 100644 (file)
@@ -444,6 +444,11 @@ WK_EXPORT bool WKPageIsPinnedToRightSide(WKPageRef page);
 WK_EXPORT bool WKPageIsPinnedToTopSide(WKPageRef page);
 WK_EXPORT bool WKPageIsPinnedToBottomSide(WKPageRef page);
 
+WK_EXPORT bool WKPageRubberBandsAtBottom(WKPageRef);
+WK_EXPORT void WKPageSetRubberBandsAtBottom(WKPageRef, bool rubberBandsAtBottom);
+WK_EXPORT bool WKPageRubberBandsAtTop(WKPageRef);
+WK_EXPORT void WKPageSetRubberBandsAtTop(WKPageRef, bool rubberBandsAtTop);
+
 WK_EXPORT bool WKPageCanDelete(WKPageRef page);
 WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page);
 WK_EXPORT bool WKPageIsContentEditable(WKPageRef page);
index 9d8a358f2964c1b2126ab584f7f19cc009afd151..427935290ff1c98fd65ad4d81aabd42cbf59bb98 100644 (file)
@@ -226,6 +226,8 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
     , m_mainFrameIsPinnedToRightSide(false)
     , m_mainFrameIsPinnedToTopSide(false)
     , m_mainFrameIsPinnedToBottomSide(false)
+    , m_rubberBandsAtBottom(false)
+    , m_rubberBandsAtTop(false)
     , m_mainFrameInViewSourceMode(false)
     , m_pageCount(0)
     , m_renderTreeSize(0)
@@ -259,6 +261,10 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
 #if ENABLE(VIBRATION)
     m_vibration = WebVibrationProxy::create(this);
 #endif
+#if ENABLE(THREADED_SCROLLING)
+    m_rubberBandsAtBottom = true;
+    m_rubberBandsAtTop = true;
+#endif
 
     m_process->addMessageReceiver(Messages::WebPageProxy::messageReceiverName(), m_pageID, this);
     m_process->context()->storageManager().createSessionStorageNamespace(m_pageID);
@@ -1673,6 +1679,32 @@ void WebPageProxy::setSuppressScrollbarAnimations(bool suppressAnimations)
     m_process->send(Messages::WebPage::SetSuppressScrollbarAnimations(suppressAnimations), m_pageID);
 }
 
+void WebPageProxy::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+{
+    if (rubberBandsAtBottom == m_rubberBandsAtBottom)
+        return;
+
+    m_rubberBandsAtBottom = rubberBandsAtBottom;
+
+    if (!isValid())
+        return;
+
+    m_process->send(Messages::WebPage::SetRubberBandsAtBottom(rubberBandsAtBottom), m_pageID);
+}
+
+void WebPageProxy::setRubberBandsAtTop(bool rubberBandsAtTop)
+{
+    if (rubberBandsAtTop == m_rubberBandsAtTop)
+        return;
+
+    m_rubberBandsAtTop = rubberBandsAtTop;
+
+    if (!isValid())
+        return;
+
+    m_process->send(Messages::WebPage::SetRubberBandsAtTop(rubberBandsAtTop), m_pageID);
+}
+
 void WebPageProxy::setPaginationMode(WebCore::Pagination::Mode mode)
 {
     if (mode == m_paginationMode)
index 2a781d51f3b29dbbd479b74846932f477fbf13e3..36a02bef9252c7de78b3509e5d7e812782c2b289 100644 (file)
@@ -502,6 +502,11 @@ public:
     bool isPinnedToTopSide() const { return m_mainFrameIsPinnedToTopSide; }
     bool isPinnedToBottomSide() const { return m_mainFrameIsPinnedToBottomSide; }
 
+    bool rubberBandsAtBottom() const { return m_rubberBandsAtBottom; }
+    void setRubberBandsAtBottom(bool);
+    bool rubberBandsAtTop() const { return m_rubberBandsAtTop; }
+    void setRubberBandsAtTop(bool);
+
     void setPaginationMode(WebCore::Pagination::Mode);
     WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; }
     void setPaginationBehavesLikeColumns(bool);
@@ -1209,6 +1214,9 @@ private:
     bool m_mainFrameIsPinnedToTopSide;
     bool m_mainFrameIsPinnedToBottomSide;
 
+    bool m_rubberBandsAtBottom;
+    bool m_rubberBandsAtTop;
+
     bool m_mainFrameInViewSourceMode;
 
     unsigned m_pageCount;
index 4c2ae441a4e773a04d59ab1dbc7e5ea0e40f9245..3a43ac18bf44809fa8cbcf6a11a3b0a1cef795f6 100644 (file)
@@ -1312,6 +1312,16 @@ void WebPage::setSuppressScrollbarAnimations(bool suppressAnimations)
     m_page->setShouldSuppressScrollbarAnimations(suppressAnimations);
 }
 
+void WebPage::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+{
+    m_page->setRubberBandsAtBottom(rubberBandsAtBottom);
+}
+
+void WebPage::setRubberBandsAtTop(bool rubberBandsAtTop)
+{
+    m_page->setRubberBandsAtTop(rubberBandsAtTop);
+}
+
 void WebPage::setPaginationMode(uint32_t mode)
 {
     Pagination pagination = m_page->pagination();
index a6e0606027251c5db2c1dfdfdb982eeee4bb25b8..92a2e4e38e3a225d209e8b9ab8d005efbfa3a805 100644 (file)
@@ -315,6 +315,9 @@ public:
 
     void setSuppressScrollbarAnimations(bool);
 
+    void setRubberBandsAtBottom(bool);
+    void setRubberBandsAtTop(bool);
+
     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
     void setPaginationBehavesLikeColumns(bool);
     void setPageLength(double);
index 67bce6a2d2f8790a068dc30d9fc80307b157d2de..b34db5c4e8519c101eec001725009b2660d259c9 100644 (file)
@@ -142,6 +142,9 @@ messages -> WebPage LegacyReceiver {
     ListenForLayoutMilestones(uint32_t milestones)
     SetSuppressScrollbarAnimations(bool suppressAnimations)
 
+    SetRubberBandsAtBottom(bool rubberBandsAtBottom)
+    SetRubberBandsAtTop(bool rubberBandsAtTop)
+
     SetPaginationMode(uint32_t mode)
     SetPaginationBehavesLikeColumns(bool behavesLikeColumns)
     SetPageLength(double pageLength)