../WebCore: Unify rubberband control
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2013 23:25:55 +0000 (23:25 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Oct 2013 23:25:55 +0000 (23:25 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122341

Reviewed by Tim Horton.

- Consolidates the two ways we were passing state about whether
  to rubber-band on a particular edge down to one.

* WebCore.exp.in:
* page/Page.cpp:
* page/Page.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::isRubberBandInProgress):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::ScrollingTree):
(WebCore::ScrollingTree::setCanRubberBandState):
(WebCore::ScrollingTree::rubberBandsAtLeft):
(WebCore::ScrollingTree::rubberBandsAtRight):
(WebCore::ScrollingTree::rubberBandsAtBottom):
(WebCore::ScrollingTree::rubberBandsAtTop):
(WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
* page/scrolling/ScrollingTree.h:
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::shouldRubberBandInDirection):

../WebKit2: Unify rubber-band control
https://bugs.webkit.org/show_bug.cgi?id=122341

Reviewed by Tim Horton.

- Consolidates the two ways we were passing state about whether
  to rubber-band on a particular edge down to one.
- Adds SPI to control whether you can rubber band on the left
  or right edge.
- Add a linked-on-or-after check to control whether we use the
  legacy implicit rubber band control based on back/forward.

* UIProcess/API/C/WKPage.cpp:
(WKPageRubberBandsAtLeft):
(WKPageSetRubberBandsAtLeft):
(WKPageRubberBandsAtRight):
(WKPageSetRubberBandsAtRight):
(WKPageRubberBandsAtBottom):
(WKPageSetRubberBandsAtBottom):
* UIProcess/API/C/WKPage.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::sendWheelEvent):
(WebKit::WebPageProxy::rubberBandsAtLeft):
(WebKit::WebPageProxy::setRubberBandsAtLeft):
(WebKit::WebPageProxy::rubberBandsAtRight):
(WebKit::WebPageProxy::setRubberBandsAtRight):
(WebKit::WebPageProxy::rubberBandsAtTop):
(WebKit::WebPageProxy::setRubberBandsAtTop):
(WebKit::WebPageProxy::rubberBandsAtBottom):
(WebKit::WebPageProxy::setRubberBandsAtBottom):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::shouldUseLegacyImplicitRubberBandControl):
(WebKit::WebPageProxy::platformInitialize):
* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::wheelEvent):
* WebProcess/WebPage/EventDispatcher.h:
* WebProcess/WebPage/EventDispatcher.messages.in:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

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

22 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/UIProcess/mac/WebPageProxyMac.mm
Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp
Source/WebKit2/WebProcess/WebPage/EventDispatcher.h
Source/WebKit2/WebProcess/WebPage/EventDispatcher.messages.in
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in

index 47c7a47..b6c616b 100644 (file)
@@ -1,3 +1,32 @@
+2013-10-04  Sam Weinig  <sam@webkit.org>
+
+        Unify rubberband control
+        https://bugs.webkit.org/show_bug.cgi?id=122341
+
+        Reviewed by Tim Horton.
+
+        - Consolidates the two ways we were passing state about whether
+          to rubber-band on a particular edge down to one.
+
+        * WebCore.exp.in:
+        * page/Page.cpp:
+        * page/Page.h:
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::isRubberBandInProgress):
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::ScrollingTree):
+        (WebCore::ScrollingTree::setCanRubberBandState):
+        (WebCore::ScrollingTree::rubberBandsAtLeft):
+        (WebCore::ScrollingTree::rubberBandsAtRight):
+        (WebCore::ScrollingTree::rubberBandsAtBottom):
+        (WebCore::ScrollingTree::rubberBandsAtTop):
+        (WebCore::ScrollingTree::willWheelEventStartSwipeGesture):
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeMac::shouldRubberBandInDirection):
+
 2013-10-04  Andreas Kling  <akling@apple.com>
 
         CTTE: SubframeLoader backpointer to Frame should be a reference.
index 403b95f..ec1f23e 100644 (file)
@@ -868,7 +868,6 @@ __ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE
 __ZN7WebCore4Page19addFooterWithHeightEi
 __ZN7WebCore4Page19addHeaderWithHeightEi
 __ZN7WebCore4Page19addLayoutMilestonesEj
-__ZN7WebCore4Page19setRubberBandsAtTopEb
 __ZN7WebCore4Page19visitedStateChangedEPNS_9PageGroupEy
 __ZN7WebCore4Page20setDeviceScaleFactorEf
 __ZN7WebCore4Page20unmarkAllTextMatchesEv
@@ -876,7 +875,6 @@ __ZN7WebCore4Page21markAllMatchesForTextERKN3WTF6StringEjbj
 __ZN7WebCore4Page22allVisitedStateChangedEPNS_9PageGroupE
 __ZN7WebCore4Page22nonFastScrollableRectsEPKNS_5FrameE
 __ZN7WebCore4Page22removeLayoutMilestonesEj
-__ZN7WebCore4Page22setRubberBandsAtBottomEb
 __ZN7WebCore4Page23clearUndoRedoOperationsEv
 __ZN7WebCore4Page24findStringMatchingRangesERKN3WTF6StringEjiPNS1_6VectorINS1_6RefPtrINS_5RangeEEELm0ENS1_15CrashOnOverflowEEERi
 __ZN7WebCore4Page24resumeScriptedAnimationsEv
@@ -2739,17 +2737,13 @@ __ZN7WebCore8Document19accessSVGExtensionsEv
 #endif
 
 #if ENABLE(THREADED_SCROLLING)
-__ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
+__ZN7WebCore13ScrollingTree21setCanRubberBandStateEbbbb
 __ZN7WebCore13ScrollingTree21tryToHandleWheelEventERKNS_18PlatformWheelEventE
-__ZN7WebCore13ScrollingTree22updateBackForwardStateEbb
+__ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
 __ZN7WebCore13ScrollingTreeD1Ev
 __ZN7WebCore15ScrollingThread15dispatchBarrierERKN3WTF8FunctionIFvvEEE
 __ZN7WebCore15ScrollingThread8dispatchERKN3WTF8FunctionIFvvEEE
 __ZN7WebCore20ScrollingCoordinator44setForceMainThreadScrollLayerPositionUpdatesEb
-__ZNK7WebCore23ScrollingCoordinatorMac19rubberBandsAtBottomEv
-__ZNK7WebCore23ScrollingCoordinatorMac16rubberBandsAtTopEv
-__ZN7WebCore23ScrollingCoordinatorMac22setRubberBandsAtBottomEb
-__ZN7WebCore23ScrollingCoordinatorMac19setRubberBandsAtTopEb
 __ZN7WebCore4Page20scrollingCoordinatorEv
 #endif
 
index e584127..f25b716 100644 (file)
@@ -837,34 +837,6 @@ void Page::lockAllOverlayScrollbarsToHidden(bool lockOverlayScrollbars)
     }
 }
 
-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 0dd80d9..87466da 100644 (file)
@@ -284,11 +284,6 @@ public:
     void setShouldSuppressScrollbarAnimations(bool suppressAnimations);
     void lockAllOverlayScrollbarsToHidden(bool lockOverlayScrollbars);
 
-    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 bcb2061..4ecfcf9 100644 (file)
@@ -124,10 +124,6 @@ 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) { }
     virtual void setScrollPinningBehavior(ScrollPinningBehavior) { }
 
     // Generated a unique id for scroll layers.
index e0f1bde..228ae3e 100644 (file)
@@ -49,12 +49,12 @@ PassRefPtr<ScrollingTree> ScrollingTree::create(ScrollingCoordinator* scrollingC
 ScrollingTree::ScrollingTree(ScrollingCoordinator* scrollingCoordinator)
     : m_scrollingCoordinator(scrollingCoordinator)
     , m_hasWheelEventHandlers(false)
-    , m_canGoBack(false)
-    , m_canGoForward(false)
+    , m_rubberBandsAtLeft(true)
+    , m_rubberBandsAtRight(true)
+    , m_rubberBandsAtTop(true)
+    , m_rubberBandsAtBottom(true)
     , m_mainFramePinnedToTheLeft(false)
     , m_mainFramePinnedToTheRight(false)
-    , m_rubberBandsAtBottom(true)
-    , m_rubberBandsAtTop(true)
     , m_mainFramePinnedToTheTop(false)
     , m_mainFramePinnedToTheBottom(false)
     , m_mainFrameIsRubberBanding(false)
@@ -93,14 +93,6 @@ ScrollingTree::EventResult ScrollingTree::tryToHandleWheelEvent(const PlatformWh
     return DidHandleEvent;
 }
 
-void ScrollingTree::updateBackForwardState(bool canGoBack, bool canGoForward)
-{
-    MutexLocker locker(m_swipeStateMutex);
-
-    m_canGoBack = canGoBack;
-    m_canGoForward = canGoForward;
-}
-
 void ScrollingTree::handleWheelEvent(const PlatformWheelEvent& wheelEvent)
 {
     ASSERT(ScrollingThread::isCurrentThread());
@@ -272,20 +264,6 @@ void ScrollingTree::handleWheelEventPhase(PlatformWheelEventPhase phase)
 }
 #endif
 
-bool ScrollingTree::canGoBack()
-{
-    MutexLocker lock(m_swipeStateMutex);
-
-    return m_canGoBack;
-}
-
-bool ScrollingTree::canGoForward()
-{
-    MutexLocker lock(m_swipeStateMutex);
-
-    return m_canGoForward;
-}
-
 bool ScrollingTree::isRubberBandInProgress()
 {
     MutexLocker lock(m_mutex);    
@@ -300,32 +278,42 @@ void ScrollingTree::setMainFrameIsRubberBanding(bool isRubberBanding)
     m_mainFrameIsRubberBanding = isRubberBanding;
 }
 
-bool ScrollingTree::rubberBandsAtBottom()
+void ScrollingTree::setCanRubberBandState(bool canRubberBandsAtLeft, bool canRubberBandsAtRight, bool canRubberBandsAtTop, bool canRubberBandsAtBottom)
+{
+    MutexLocker locker(m_swipeStateMutex);
+
+    m_rubberBandsAtLeft = canRubberBandsAtLeft;
+    m_rubberBandsAtRight = canRubberBandsAtRight;
+    m_rubberBandsAtTop = canRubberBandsAtTop;
+    m_rubberBandsAtBottom = canRubberBandsAtBottom;
+}
+
+bool ScrollingTree::rubberBandsAtLeft()
 {
     MutexLocker lock(m_swipeStateMutex);
 
-    return m_rubberBandsAtBottom;
+    return m_rubberBandsAtLeft;
 }
 
-void ScrollingTree::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+bool ScrollingTree::rubberBandsAtRight()
 {
-    MutexLocker locker(m_swipeStateMutex);
+    MutexLocker lock(m_swipeStateMutex);
 
-    m_rubberBandsAtBottom = rubberBandsAtBottom;
+    return m_rubberBandsAtRight;
 }
 
-bool ScrollingTree::rubberBandsAtTop()
+bool ScrollingTree::rubberBandsAtBottom()
 {
     MutexLocker lock(m_swipeStateMutex);
 
-    return m_rubberBandsAtTop;
+    return m_rubberBandsAtBottom;
 }
 
-void ScrollingTree::setRubberBandsAtTop(bool rubberBandsAtTop)
+bool ScrollingTree::rubberBandsAtTop()
 {
-    MutexLocker locker(m_swipeStateMutex);
+    MutexLocker lock(m_swipeStateMutex);
 
-    m_rubberBandsAtTop = rubberBandsAtTop;
+    return m_rubberBandsAtTop;
 }
     
 void ScrollingTree::setScrollPinningBehavior(ScrollPinningBehavior pinning)
@@ -349,9 +337,9 @@ bool ScrollingTree::willWheelEventStartSwipeGesture(const PlatformWheelEvent& wh
 
     MutexLocker lock(m_swipeStateMutex);
 
-    if (wheelEvent.deltaX() > 0 && m_mainFramePinnedToTheLeft && m_canGoBack)
+    if (wheelEvent.deltaX() > 0 && m_mainFramePinnedToTheLeft && !m_rubberBandsAtLeft)
         return true;
-    if (wheelEvent.deltaX() < 0 && m_mainFramePinnedToTheRight && m_canGoForward)
+    if (wheelEvent.deltaX() < 0 && m_mainFramePinnedToTheRight && !m_rubberBandsAtRight)
         return true;
     if (wheelEvent.deltaY() > 0 && m_mainFramePinnedToTheTop && !m_rubberBandsAtTop)
         return true;
index 423eefd..f60c821 100644 (file)
@@ -73,9 +73,6 @@ public:
     EventResult tryToHandleWheelEvent(const PlatformWheelEvent&);
     bool hasWheelEventHandlers() const { return m_hasWheelEventHandlers; }
 
-    // Can be called from any thread. Will update the back forward state of the page, used for rubber-banding.
-    void updateBackForwardState(bool canGoBack, bool canGoForward);
-
     // Must be called from the scrolling thread. Handles the wheel event.
     void handleWheelEvent(const PlatformWheelEvent&);
 
@@ -94,13 +91,13 @@ public:
     void handleWheelEventPhase(PlatformWheelEventPhase);
 #endif
 
-    bool canGoBack();
-    bool canGoForward();
+    // Can be called from any thread. Will update what edges allow rubber-banding.
+    void setCanRubberBandState(bool canRubberBandsAtLeft, bool canRubberBandsAtRight, bool canRubberBandsAtTop, bool canRubberBandsAtBottom);
 
-    bool rubberBandsAtBottom();
-    void setRubberBandsAtBottom(bool);
+    bool rubberBandsAtLeft();
+    bool rubberBandsAtRight();
     bool rubberBandsAtTop();
-    void setRubberBandsAtTop(bool);
+    bool rubberBandsAtBottom();
     
     void setScrollPinningBehavior(ScrollPinningBehavior);
     ScrollPinningBehavior scrollPinningBehavior();
@@ -130,12 +127,12 @@ private:
     bool m_hasWheelEventHandlers;
 
     Mutex m_swipeStateMutex;
-    bool m_canGoBack;
-    bool m_canGoForward;
+    bool m_rubberBandsAtLeft;
+    bool m_rubberBandsAtRight;
+    bool m_rubberBandsAtTop;
+    bool m_rubberBandsAtBottom;
     bool m_mainFramePinnedToTheLeft;
     bool m_mainFramePinnedToTheRight;
-    bool m_rubberBandsAtBottom;
-    bool m_rubberBandsAtTop;
     bool m_mainFramePinnedToTheTop;
     bool m_mainFramePinnedToTheBottom;
     bool m_mainFrameIsRubberBanding;
index 038fb5f..9355cea 100644 (file)
@@ -73,10 +73,6 @@ 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;
     
     virtual void setScrollPinningBehavior(ScrollPinningBehavior) OVERRIDE;
 
index 536084d..8005815 100644 (file)
@@ -92,26 +92,6 @@ 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::setScrollPinningBehavior(ScrollPinningBehavior pinning)
 {
     scrollingTree()->setScrollPinningBehavior(pinning);
index 6a00075..75a7432 100644 (file)
@@ -222,15 +222,9 @@ bool ScrollingTreeScrollingNodeMac::canScrollVertically()
     return hasEnabledVerticalScrollbar();
 }
 
-bool ScrollingTreeScrollingNodeMac::shouldRubberBandInDirection(ScrollDirection direction)
+bool ScrollingTreeScrollingNodeMac::shouldRubberBandInDirection(ScrollDirection)
 {
-    if (direction == ScrollLeft)
-        return !scrollingTree()->canGoBack();
-    if (direction == ScrollRight)
-        return !scrollingTree()->canGoForward();
-
-    ASSERT_NOT_REACHED();
-    return false;
+    return true;
 }
 
 IntPoint ScrollingTreeScrollingNodeMac::absoluteScrollPosition()
index fa9f832..a65bf64 100644 (file)
@@ -1,3 +1,48 @@
+2013-10-04  Sam Weinig  <sam@webkit.org>
+
+        Unify rubber-band control
+        https://bugs.webkit.org/show_bug.cgi?id=122341
+
+        Reviewed by Tim Horton.
+
+        - Consolidates the two ways we were passing state about whether
+          to rubber-band on a particular edge down to one.
+        - Adds SPI to control whether you can rubber band on the left
+          or right edge.
+        - Add a linked-on-or-after check to control whether we use the
+          legacy implicit rubber band control based on back/forward.
+
+        * UIProcess/API/C/WKPage.cpp:
+        (WKPageRubberBandsAtLeft):
+        (WKPageSetRubberBandsAtLeft):
+        (WKPageRubberBandsAtRight):
+        (WKPageSetRubberBandsAtRight):
+        (WKPageRubberBandsAtBottom):
+        (WKPageSetRubberBandsAtBottom):
+        * UIProcess/API/C/WKPage.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::sendWheelEvent):
+        (WebKit::WebPageProxy::rubberBandsAtLeft):
+        (WebKit::WebPageProxy::setRubberBandsAtLeft):
+        (WebKit::WebPageProxy::rubberBandsAtRight):
+        (WebKit::WebPageProxy::setRubberBandsAtRight):
+        (WebKit::WebPageProxy::rubberBandsAtTop):
+        (WebKit::WebPageProxy::setRubberBandsAtTop):
+        (WebKit::WebPageProxy::rubberBandsAtBottom):
+        (WebKit::WebPageProxy::setRubberBandsAtBottom):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::shouldUseLegacyImplicitRubberBandControl):
+        (WebKit::WebPageProxy::platformInitialize):
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::wheelEvent):
+        * WebProcess/WebPage/EventDispatcher.h:
+        * WebProcess/WebPage/EventDispatcher.messages.in:
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
 2013-10-04  Lorenzo Tilve  <ltilve@igalia.com>
 
         [GTK] Enable text edition UndoOperations support in WebKit2
index 611186f..be50203 100644 (file)
@@ -454,15 +454,24 @@ bool WKPageIsPinnedToBottomSide(WKPageRef pageRef)
     return toImpl(pageRef)->isPinnedToBottomSide();
 }
 
+bool WKPageRubberBandsAtLeft(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->rubberBandsAtLeft();
+}
 
-bool WKPageRubberBandsAtBottom(WKPageRef pageRef)
+void WKPageSetRubberBandsAtLeft(WKPageRef pageRef, bool rubberBandsAtLeft)
 {
-    return toImpl(pageRef)->rubberBandsAtBottom();
+    toImpl(pageRef)->setRubberBandsAtLeft(rubberBandsAtLeft);
 }
 
-void WKPageSetRubberBandsAtBottom(WKPageRef pageRef, bool rubberBandsAtBottom)
+bool WKPageRubberBandsAtRight(WKPageRef pageRef)
 {
-    toImpl(pageRef)->setRubberBandsAtBottom(rubberBandsAtBottom);
+    return toImpl(pageRef)->rubberBandsAtRight();
+}
+
+void WKPageSetRubberBandsAtRight(WKPageRef pageRef, bool rubberBandsAtRight)
+{
+    toImpl(pageRef)->setRubberBandsAtRight(rubberBandsAtRight);
 }
 
 bool WKPageRubberBandsAtTop(WKPageRef pageRef)
@@ -475,6 +484,16 @@ void WKPageSetRubberBandsAtTop(WKPageRef pageRef, bool rubberBandsAtTop)
     toImpl(pageRef)->setRubberBandsAtTop(rubberBandsAtTop);
 }
 
+bool WKPageRubberBandsAtBottom(WKPageRef pageRef)
+{
+    return toImpl(pageRef)->rubberBandsAtBottom();
+}
+
+void WKPageSetRubberBandsAtBottom(WKPageRef pageRef, bool rubberBandsAtBottom)
+{
+    toImpl(pageRef)->setRubberBandsAtBottom(rubberBandsAtBottom);
+}
+
 void WKPageSetPaginationMode(WKPageRef pageRef, WKPaginationMode paginationMode)
 {
     Pagination::Mode mode;
index 6aa31f9..85611ed 100644 (file)
@@ -470,10 +470,14 @@ 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 WKPageRubberBandsAtLeft(WKPageRef);
+WK_EXPORT void WKPageSetRubberBandsAtLeft(WKPageRef, bool rubberBandsAtLeft);
+WK_EXPORT bool WKPageRubberBandsAtRight(WKPageRef);
+WK_EXPORT void WKPageSetRubberBandsAtRight(WKPageRef, bool rubberBandsAtRight);
 WK_EXPORT bool WKPageRubberBandsAtTop(WKPageRef);
 WK_EXPORT void WKPageSetRubberBandsAtTop(WKPageRef, bool rubberBandsAtTop);
+WK_EXPORT bool WKPageRubberBandsAtBottom(WKPageRef);
+WK_EXPORT void WKPageSetRubberBandsAtBottom(WKPageRef, bool rubberBandsAtBottom);
 
 WK_EXPORT bool WKPageCanDelete(WKPageRef page);
 WK_EXPORT bool WKPageHasSelectedRange(WKPageRef page);
index 1f87eb9..e47b196 100644 (file)
@@ -295,8 +295,11 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
     , m_mainFrameIsPinnedToRightSide(false)
     , m_mainFrameIsPinnedToTopSide(false)
     , m_mainFrameIsPinnedToBottomSide(false)
-    , m_rubberBandsAtBottom(false)
-    , m_rubberBandsAtTop(false)
+    , m_useLegacyImplicitRubberBandControl(false)
+    , m_rubberBandsAtLeft(true)
+    , m_rubberBandsAtRight(true)
+    , m_rubberBandsAtTop(true)
+    , m_rubberBandsAtBottom(true)
     , m_mainFrameInViewSourceMode(false)
     , m_pageCount(0)
     , m_renderTreeSize(0)
@@ -316,6 +319,8 @@ WebPageProxy::WebPageProxy(PageClient* pageClient, PassRefPtr<WebProcessProxy> p
 #endif
     , m_scrollPinningBehavior(DoNotPin)
 {
+    platformInitialize();
+
 #if ENABLE(PAGE_VISIBILITY_API)
     if (!m_isVisible)
         m_visibilityState = PageVisibilityStateHidden;
@@ -337,10 +342,6 @@ 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);
 
@@ -1395,7 +1396,15 @@ void WebPageProxy::sendWheelEvent(const WebWheelEvent& event)
         return;
     }
 
-    m_process->send(Messages::EventDispatcher::WheelEvent(m_pageID, event, canGoBack(), canGoForward()), 0);
+    m_process->send(
+        Messages::EventDispatcher::WheelEvent(
+            m_pageID,
+            event,
+            m_useLegacyImplicitRubberBandControl ? !canGoBack() : rubberBandsAtLeft(),
+            m_useLegacyImplicitRubberBandControl ? !canGoForward() : rubberBandsAtRight(),
+            rubberBandsAtTop(),
+            rubberBandsAtBottom()
+        ), 0);
 }
 
 void WebPageProxy::handleKeyboardEvent(const NativeWebKeyboardEvent& event)
@@ -1828,30 +1837,44 @@ void WebPageProxy::setSuppressScrollbarAnimations(bool suppressAnimations)
     m_process->send(Messages::WebPage::SetSuppressScrollbarAnimations(suppressAnimations), m_pageID);
 }
 
-void WebPageProxy::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+bool WebPageProxy::rubberBandsAtLeft() const
 {
-    if (rubberBandsAtBottom == m_rubberBandsAtBottom)
-        return;
+    return m_rubberBandsAtLeft;
+}
 
-    m_rubberBandsAtBottom = rubberBandsAtBottom;
+void WebPageProxy::setRubberBandsAtLeft(bool rubberBandsAtLeft)
+{
+    m_rubberBandsAtLeft = rubberBandsAtLeft;
+}
 
-    if (!isValid())
-        return;
+bool WebPageProxy::rubberBandsAtRight() const
+{
+    return m_rubberBandsAtRight;
+}
+
+void WebPageProxy::setRubberBandsAtRight(bool rubberBandsAtRight)
+{
+    m_rubberBandsAtRight = rubberBandsAtRight;
+}
 
-    m_process->send(Messages::WebPage::SetRubberBandsAtBottom(rubberBandsAtBottom), m_pageID);
+bool WebPageProxy::rubberBandsAtTop() const
+{
+    return m_rubberBandsAtTop;
 }
 
 void WebPageProxy::setRubberBandsAtTop(bool rubberBandsAtTop)
 {
-    if (rubberBandsAtTop == m_rubberBandsAtTop)
-        return;
-
     m_rubberBandsAtTop = rubberBandsAtTop;
+}
 
-    if (!isValid())
-        return;
+bool WebPageProxy::rubberBandsAtBottom() const
+{
+    return m_rubberBandsAtBottom;
+}
 
-    m_process->send(Messages::WebPage::SetRubberBandsAtTop(rubberBandsAtTop), m_pageID);
+void WebPageProxy::setRubberBandsAtBottom(bool rubberBandsAtBottom)
+{
+    m_rubberBandsAtBottom = rubberBandsAtBottom;
 }
 
 void WebPageProxy::setPaginationMode(WebCore::Pagination::Mode mode)
index 584cc07..908ee39 100644 (file)
@@ -493,10 +493,14 @@ 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; }
+    bool rubberBandsAtLeft() const;
+    void setRubberBandsAtLeft(bool);
+    bool rubberBandsAtRight() const;
+    void setRubberBandsAtRight(bool);
+    bool rubberBandsAtTop() const;
     void setRubberBandsAtTop(bool);
+    bool rubberBandsAtBottom() const;
+    void setRubberBandsAtBottom(bool);
 
     void setPaginationMode(WebCore::Pagination::Mode);
     WebCore::Pagination::Mode paginationMode() const { return m_paginationMode; }
@@ -761,6 +765,7 @@ public:
         
 private:
     WebPageProxy(PageClient*, PassRefPtr<WebProcessProxy>, WebPageGroup*, uint64_t pageID);
+    void platformInitialize();
 
     void resetStateAfterProcessExited();
 
@@ -1214,8 +1219,11 @@ private:
     bool m_mainFrameIsPinnedToTopSide;
     bool m_mainFrameIsPinnedToBottomSide;
 
-    bool m_rubberBandsAtBottom;
+    bool m_useLegacyImplicitRubberBandControl;
+    bool m_rubberBandsAtLeft;
+    bool m_rubberBandsAtRight;
     bool m_rubberBandsAtTop;
+    bool m_rubberBandsAtBottom;
 
     bool m_mainFrameInViewSourceMode;
         
index c7f96a5..ee9a078 100644 (file)
@@ -46,6 +46,7 @@
 #import <WebCore/TextAlternativeWithRange.h>
 #import <WebKitSystemInterface.h>
 #import <wtf/text/StringConcatenate.h>
+#import <mach-o/dyld.h>
 
 @interface NSApplication (Details)
 - (void)speakString:(NSString *)string;
@@ -57,6 +58,17 @@ using namespace WebCore;
 
 namespace WebKit {
 
+static bool shouldUseLegacyImplicitRubberBandControl()
+{
+    static bool linkedAgainstExecutableExpectingImplicitRubberBandControl = NSVersionOfLinkTimeLibrary("WebKit2") < 0x021A0200 /* 538.2.0 */;
+    return linkedAgainstExecutableExpectingImplicitRubberBandControl;
+}
+
+void WebPageProxy::platformInitialize()
+{
+    m_useLegacyImplicitRubberBandControl = shouldUseLegacyImplicitRubberBandControl();
+}
+
 #if defined(__ppc__) || defined(__ppc64__)
 #define PROCESSOR "PPC"
 #elif defined(__i386__) || defined(__x86_64__)
index d2751d8..b0ac484 100644 (file)
@@ -84,7 +84,7 @@ void EventDispatcher::initializeConnection(CoreIPC::Connection* connection)
     connection->addWorkQueueMessageReceiver(Messages::EventDispatcher::messageReceiverName(), m_queue.get(), this);
 }
 
-void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEvent, bool canGoBack, bool canGoForward)
+void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEvent, bool canRubberBandsAtLeft, bool canRubberBandsAtRight, bool canRubberBandsAtTop, bool canRubberBandsAtBottom)
 {
 #if ENABLE(THREADED_SCROLLING)
     MutexLocker locker(m_scrollingTreesMutex);
@@ -96,7 +96,7 @@ void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEven
         // scrolling tree can be notified.
         // We only need to do this at the beginning of the gesture.
         if (platformWheelEvent.phase() == PlatformWheelEventPhaseBegan)
-            ScrollingThread::dispatch(bind(&ScrollingTree::updateBackForwardState, scrollingTree, canGoBack, canGoForward));
+            ScrollingThread::dispatch(bind(&ScrollingTree::setCanRubberBandState, scrollingTree, canRubberBandsAtLeft, canRubberBandsAtRight, canRubberBandsAtTop, canRubberBandsAtBottom));
 
         ScrollingTree::EventResult result = scrollingTree->tryToHandleWheelEvent(platformWheelEvent);
         if (result == ScrollingTree::DidHandleEvent || result == ScrollingTree::DidNotHandleEvent) {
@@ -104,9 +104,6 @@ void EventDispatcher::wheelEvent(uint64_t pageID, const WebWheelEvent& wheelEven
             return;
         }
     }
-#else
-    UNUSED_PARAM(canGoBack);
-    UNUSED_PARAM(canGoForward);
 #endif
 
     RunLoop::main()->dispatch(bind(&EventDispatcher::dispatchWheelEvent, this, pageID, wheelEvent));
index c93e177..78e1406 100644 (file)
@@ -65,7 +65,7 @@ private:
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
 
     // Message handlers
-    void wheelEvent(uint64_t pageID, const WebWheelEvent&, bool canGoBack, bool canGoForward);
+    void wheelEvent(uint64_t pageID, const WebWheelEvent&, bool canRubberBandsAtLeft, bool canRubberBandsAtRight, bool canRubberBandsAtTop, bool canRubberBandsAtBottom);
 #if ENABLE(GESTURE_EVENTS)
     void gestureEvent(uint64_t pageID, const WebGestureEvent&);
 #endif
index 774a6ce..fcdea00 100644 (file)
@@ -21,7 +21,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 messages -> EventDispatcher {
-    WheelEvent(uint64_t pageID, WebKit::WebWheelEvent event, bool canGoBack, bool canGoForward)
+    WheelEvent(uint64_t pageID, WebKit::WebWheelEvent event, bool canRubberBandsAtLeft, bool canRubberBandsAtRight, bool canRubberBandsAtTop, bool canRubberBandsAtBottom)
 
 #if ENABLE(GESTURE_EVENTS)
     GestureEvent(uint64_t pageID, WebKit::WebGestureEvent event)
index ce4ef66..c50de78 100644 (file)
@@ -1281,16 +1281,6 @@ 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 0fb1fe9..25cf84a 100644 (file)
@@ -312,9 +312,6 @@ public:
 
     void setSuppressScrollbarAnimations(bool);
 
-    void setRubberBandsAtBottom(bool);
-    void setRubberBandsAtTop(bool);
-
     void setPaginationMode(uint32_t /* WebCore::Pagination::Mode */);
     void setPaginationBehavesLikeColumns(bool);
     void setPageLength(double);
index 6ee7f03..02e7d73 100644 (file)
@@ -136,9 +136,6 @@ 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)